Merged in feat/LOY-431-profile-v2 (pull request #3202)

Feat/LOY-431: Switch to V2 of Profile endpoint

* feat(LOY-431): switch to v2 of profile endpoint

* feat(LOY-431): use CreditCard

* feat(LOY-431): remove hotelinformation from friendTransaction schema

* chore(LOY-431): add hotel data request to transactions

* fix(LOY-431): use v1 of friendTransactions


Approved-by: Linus Flood
Approved-by: Erik Tiekstra
Approved-by: Anton Gunnarsson
This commit is contained in:
Matilda Landström
2025-11-28 13:58:06 +00:00
parent c29b724317
commit 22dd2f60fe
15 changed files with 98 additions and 81 deletions

View File

@@ -156,7 +156,7 @@ export const editProfile = protectedServerActionProcedure
)
}
const apiResponse = await api.patch(api.endpoints.v1.Profile.profile, {
const apiResponse = await api.patch(api.endpoints.v2.Profile.profile, {
body,
cache: "no-store",
headers: {

View File

@@ -4,8 +4,8 @@ import { usePathname } from "next/navigation"
import { useIntl } from "react-intl"
import { dt } from "@scandic-hotels/common/dt"
import Link from "@scandic-hotels/design-system/OldDSLink"
import Table from "@scandic-hotels/design-system/Table"
import { TextLink } from "@scandic-hotels/design-system/TextLink"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { Transactions } from "@scandic-hotels/trpc/enums/transactions"
@@ -15,7 +15,11 @@ import useLang from "@/hooks/useLang"
import AwardPoints from "../../../AwardPoints"
import type { RowProps } from "@/types/components/myPages/myPage/earnAndBurn"
import type { Transaction } from "@/types/components/myPages/myPage/earnAndBurn"
interface RowProps {
transaction: Transaction
}
export default function Row({ transaction }: RowProps) {
const intl = useIntl()
@@ -23,6 +27,7 @@ export default function Row({ transaction }: RowProps) {
const pathName = usePathname()
const isWebview = webviews.includes(pathName)
const { hotelName, city } = transaction
const nightsMsg = intl.formatMessage(
{
id: "booking.numberOfNights",
@@ -39,8 +44,8 @@ export default function Row({ transaction }: RowProps) {
id: "earnAndBurn.journeyTable.pointsActivity",
defaultMessage: "Point activity",
})
: transaction.hotelName && transaction.city
? `${transaction.hotelName}, ${transaction.city} ${nightsMsg}`
: hotelName && city
? `${hotelName}, ${city} ${nightsMsg}`
: `${nightsMsg}`
switch (transaction.type) {
@@ -107,9 +112,9 @@ export default function Row({ transaction }: RowProps) {
transaction.type === Transactions.rewardType.rewardNight)
) {
return (
<Link textDecoration="underline" href={transaction.bookingUrl}>
<TextLink href={transaction.bookingUrl}>
{transaction.confirmationNumber}
</Link>
</TextLink>
)
}

View File

@@ -9,7 +9,11 @@ import Row from "./Row"
import styles from "./clientTable.module.css"
import type { ClientTableProps } from "@/types/components/myPages/myPage/earnAndBurn"
import type { Transactions } from "@/types/components/myPages/myPage/earnAndBurn"
interface ClientTableProps {
transactions: Transactions
}
export default function ClientTable({ transactions }: ClientTableProps) {
const intl = useIntl()

View File

@@ -7,17 +7,8 @@ type TransactionResponse = Awaited<
ReturnType<UserQueryRouter["transaction"]["friendTransactions"]>
>
type TransactionsNonNullResponseObject = NonNullable<TransactionResponse>
type Transactions =
export type Transactions =
NonNullable<TransactionsNonNullResponseObject>["data"]["transactions"]
type Transaction =
NonNullable<TransactionsNonNullResponseObject>["data"]["transactions"][number]
export interface ClientTableProps {
transactions: Transactions
}
export interface RowProps {
transaction: Transaction
}
export type Transaction = Transactions[number]
export type AwardPointsVariantProps = VariantProps<typeof awardPointsVariants>