diff --git a/apps/scandic-web/actions/editProfile.ts b/apps/scandic-web/actions/editProfile.ts
index 97e092d1f..80383375f 100644
--- a/apps/scandic-web/actions/editProfile.ts
+++ b/apps/scandic-web/actions/editProfile.ts
@@ -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: {
diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Points/EarnAndBurn/JourneyTable/ClientTable/Row/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Points/EarnAndBurn/JourneyTable/ClientTable/Row/index.tsx
index eed37d83d..f35fe468a 100644
--- a/apps/scandic-web/components/Blocks/DynamicContent/Points/EarnAndBurn/JourneyTable/ClientTable/Row/index.tsx
+++ b/apps/scandic-web/components/Blocks/DynamicContent/Points/EarnAndBurn/JourneyTable/ClientTable/Row/index.tsx
@@ -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 (
-
+
{transaction.confirmationNumber}
-
+
)
}
diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Points/EarnAndBurn/JourneyTable/ClientTable/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Points/EarnAndBurn/JourneyTable/ClientTable/index.tsx
index 4a0b051ae..0a77a1d9d 100644
--- a/apps/scandic-web/components/Blocks/DynamicContent/Points/EarnAndBurn/JourneyTable/ClientTable/index.tsx
+++ b/apps/scandic-web/components/Blocks/DynamicContent/Points/EarnAndBurn/JourneyTable/ClientTable/index.tsx
@@ -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()
diff --git a/apps/scandic-web/types/components/myPages/myPage/earnAndBurn.ts b/apps/scandic-web/types/components/myPages/myPage/earnAndBurn.ts
index 2766c0587..3cb6b0f67 100644
--- a/apps/scandic-web/types/components/myPages/myPage/earnAndBurn.ts
+++ b/apps/scandic-web/types/components/myPages/myPage/earnAndBurn.ts
@@ -7,17 +7,8 @@ type TransactionResponse = Awaited<
ReturnType
>
type TransactionsNonNullResponseObject = NonNullable
-type Transactions =
+export type Transactions =
NonNullable["data"]["transactions"]
-type Transaction =
- NonNullable["data"]["transactions"][number]
-
-export interface ClientTableProps {
- transactions: Transactions
-}
-
-export interface RowProps {
- transaction: Transaction
-}
+export type Transaction = Transactions[number]
export type AwardPointsVariantProps = VariantProps
diff --git a/packages/trpc/lib/api/endpoints.ts b/packages/trpc/lib/api/endpoints.ts
index b7eb198ec..058843eb8 100644
--- a/packages/trpc/lib/api/endpoints.ts
+++ b/packages/trpc/lib/api/endpoints.ts
@@ -18,6 +18,7 @@ export namespace endpoints {
Breakfast = "breakfast",
Cities = "Cities",
Countries = "Countries",
+ CreditCard = "CreditCard",
Hotels = "Hotels",
Locations = "Locations",
Packages = "packages",
@@ -173,42 +174,6 @@ export namespace endpoints {
* https://tstapi.scandichotels.com/profile/swagger/v1/index.html
*/
export namespace Profile {
- export const invalidateSessions = `${base.path.profile}/${version}/${base.enitity.Profile}/invalidateSessions`
- export const membership = `${base.path.profile}/${version}/${base.enitity.Profile}/membership`
- export const profile = `${base.path.profile}/${version}/${base.enitity.Profile}`
- export const subscriberId = `${base.path.profile}/${version}/${base.enitity.Profile}/SubscriberId`
- export const link = `${base.path.profile}/${version}/${base.enitity.Profile}/link`
- export const unlink = `${base.path.profile}/${version}/${base.enitity.Profile}/Unlink`
- export const matchTier = `${base.path.profile}/${version}/${base.enitity.Profile}/MatchTier`
- export const pointTransfer = `${base.path.profile}/${version}/${base.enitity.Profile}/PointTransfer/Partner`
-
- export function deleteProfile(profileId: string) {
- return `${profile}/${profileId}`
- }
-
- export const creditCards = `${base.path.profile}/${version}/${base.enitity.Profile}/creditCards`
- export namespace CreditCards {
- export const initiateSaveCard = `${creditCards}/initiateSaveCard`
-
- export function deleteCreditCard(creditCardId: string) {
- return `${creditCards}/${creditCardId}`
- }
- export function transaction(transactionId: string) {
- return `${creditCards}/${transactionId}`
- }
- }
-
- export namespace Reward {
- export const allTiers = `${base.path.profile}/${version}/${base.enitity.Reward}/allTiers`
- export const reward = `${base.path.profile}/${version}/${base.enitity.Reward}`
- export const redeem = `${base.path.profile}/${version}/${base.enitity.Reward}/redeem`
- export const unwrap = `${base.path.profile}/${version}/${base.enitity.Reward}/unwrap`
-
- export function claim(rewardId: string) {
- return `${base.path.profile}/${version}/${base.enitity.Reward}/Claim/${rewardId}`
- }
- }
-
export const enum Transaction {
friendTransactions = `${base.path.profile}/${version}/${base.enitity.Transaction}/friendTransactions`,
}
@@ -224,14 +189,60 @@ export namespace endpoints {
*/
export namespace Profile {
export const profile = `${base.path.profile}/${version}/${base.enitity.Profile}`
+
export const basicProfile = `${profile}/BasicInfo`
export const promoCampaign = `${profile}/Promotion`
+ export const membership = `${profile}/membership`
+ export const subscriberId = `${profile}/SubscriberId`
+
+ export const invalidateSessions = `${profile}/invalidateSessions`
+
+ export const link = `${profile}/link`
+ export const unlink = `${profile}/Unlink`
+ export const matchTier = `${profile}/MatchTier`
+ export const pointTransfer = `${profile}/PointTransfer/Partner`
+
+ export function deleteProfile(profileId: string) {
+ return `${profile}/${profileId}`
+ }
+
export function teamMemberCard(employeeId: string) {
return `${profile}/${employeeId}/TeamMemberCard`
}
+
+ export namespace CreditCard {
+ export const creditCard = `${base.path.profile}/${version}/${base.enitity.CreditCard}`
+
+ export const initiateSaveCard = `${creditCard}/initiateSaveCard`
+
+ export function deleteCreditCard(creditCardId: string) {
+ return `${creditCard}/${creditCardId}`
+ }
+
+ export function transaction(transactionId: string) {
+ return `${creditCard}/${transactionId}`
+ }
+ }
+
+ export namespace Reward {
+ export const reward = `${base.path.profile}/${version}/${base.enitity.Reward}`
+
+ export const allTiers = `${reward}/allTiers`
+
+ export const redeem = `${reward}/redeem`
+ export const unwrap = `${reward}/unwrap`
+
+ export function claim(rewardId: string) {
+ return `${reward}/Claim/${rewardId}`
+ }
+ }
+
+ /* Currently no hotelInformation in v2 */
+ export const enum Transaction {
+ friendTransactions = `${base.path.profile}/${version}/${base.enitity.Transaction}/friendTransactions`,
+ }
}
}
}
-
export type Endpoint = string
diff --git a/packages/trpc/lib/routers/contentstack/reward/query.ts b/packages/trpc/lib/routers/contentstack/reward/query.ts
index 6061bff31..24cab7615 100644
--- a/packages/trpc/lib/routers/contentstack/reward/query.ts
+++ b/packages/trpc/lib/routers/contentstack/reward/query.ts
@@ -188,7 +188,7 @@ export const rewardQueryRouter = router({
metricsGetCurrentReward.start()
const apiResponse = await api.get(
- api.endpoints.v1.Profile.Reward.reward,
+ api.endpoints.v2.Profile.Reward.reward,
{
headers: {
Authorization: `Bearer ${ctx.session.token.access_token}`,
@@ -246,7 +246,7 @@ export const rewardQueryRouter = router({
metricsGetSurprises.start()
- const endpoint = api.endpoints.v1.Profile.Reward.reward
+ const endpoint = api.endpoints.v2.Profile.Reward.reward
const apiResponse = await api.get(endpoint, {
cache: undefined,
@@ -316,7 +316,7 @@ export const rewardQueryRouter = router({
metricsGetUnwrapSurprise.start()
const apiResponse = await api.post(
- api.endpoints.v1.Profile.Reward.unwrap,
+ api.endpoints.v2.Profile.Reward.unwrap,
{
body: {
rewardId,
@@ -367,7 +367,7 @@ export const rewardQueryRouter = router({
metricGetRedeem.start()
const apiResponse = await api.post(
- api.endpoints.v1.Profile.Reward.redeem,
+ api.endpoints.v2.Profile.Reward.redeem,
{
body: {
rewardId,
diff --git a/packages/trpc/lib/routers/contentstack/reward/utils.ts b/packages/trpc/lib/routers/contentstack/reward/utils.ts
index 27b4752d3..feaec2095 100644
--- a/packages/trpc/lib/routers/contentstack/reward/utils.ts
+++ b/packages/trpc/lib/routers/contentstack/reward/utils.ts
@@ -48,7 +48,7 @@ export async function getCachedAllTierRewards(token: string) {
metricsGetApiRewardAllTiers.start()
const apiResponse = await api.get(
- api.endpoints.v1.Profile.Reward.allTiers,
+ api.endpoints.v2.Profile.Reward.allTiers,
{
headers: {
Authorization: `Bearer ${token}`,
diff --git a/packages/trpc/lib/routers/partners/sas/linkAccount.ts b/packages/trpc/lib/routers/partners/sas/linkAccount.ts
index 8e4839a07..3233586f3 100644
--- a/packages/trpc/lib/routers/partners/sas/linkAccount.ts
+++ b/packages/trpc/lib/routers/partners/sas/linkAccount.ts
@@ -29,7 +29,7 @@ export const linkAccount = protectedProcedure
sasLogger.debug("[SAS] link account")
- const apiResponse = await api.post(api.endpoints.v1.Profile.link, {
+ const apiResponse = await api.post(api.endpoints.v2.Profile.link, {
headers: {
Authorization: `Bearer ${ctx.session.token.access_token}`,
},
diff --git a/packages/trpc/lib/routers/partners/sas/performLevelUpgrade.ts b/packages/trpc/lib/routers/partners/sas/performLevelUpgrade.ts
index ca52f6ade..d3c48635a 100644
--- a/packages/trpc/lib/routers/partners/sas/performLevelUpgrade.ts
+++ b/packages/trpc/lib/routers/partners/sas/performLevelUpgrade.ts
@@ -42,7 +42,7 @@ export const performLevelUpgrade = protectedProcedure
sasLogger.debug("tier match started")
- const apiResponse = await api.post(api.endpoints.v1.Profile.matchTier, {
+ const apiResponse = await api.post(api.endpoints.v2.Profile.matchTier, {
headers: {
Authorization: `Bearer ${ctx.session.token.access_token}`,
},
diff --git a/packages/trpc/lib/routers/partners/sas/transferPoints.ts b/packages/trpc/lib/routers/partners/sas/transferPoints.ts
index 57fa84968..17de8abee 100644
--- a/packages/trpc/lib/routers/partners/sas/transferPoints.ts
+++ b/packages/trpc/lib/routers/partners/sas/transferPoints.ts
@@ -25,7 +25,7 @@ export const transferPoints = protectedProcedure
const { referenceId } = await getOTPState()
const apiResponse = await api.post(
- api.endpoints.v1.Profile.pointTransfer,
+ api.endpoints.v2.Profile.pointTransfer,
{
headers: {
Authorization: `Bearer ${ctx.session.token.access_token}`,
diff --git a/packages/trpc/lib/routers/partners/sas/unlinkAccount.ts b/packages/trpc/lib/routers/partners/sas/unlinkAccount.ts
index 11d9f95a1..09b213811 100644
--- a/packages/trpc/lib/routers/partners/sas/unlinkAccount.ts
+++ b/packages/trpc/lib/routers/partners/sas/unlinkAccount.ts
@@ -17,7 +17,7 @@ export const unlinkAccount = protectedProcedure
const sasAuthToken = await getSasToken()
const { referenceId } = await getOTPState()
- const apiResponse = await api.post(api.endpoints.v1.Profile.unlink, {
+ const apiResponse = await api.post(api.endpoints.v2.Profile.unlink, {
headers: {
Authorization: `Bearer ${ctx.session.token.access_token}`,
},
diff --git a/packages/trpc/lib/routers/user/mutation.ts b/packages/trpc/lib/routers/user/mutation.ts
index 503f4c476..dd2577bfd 100644
--- a/packages/trpc/lib/routers/user/mutation.ts
+++ b/packages/trpc/lib/routers/user/mutation.ts
@@ -30,7 +30,7 @@ export const userMutationRouter = router({
JSON.stringify({ query: { language: input.language } })
)
const apiResponse = await api.post(
- api.endpoints.v1.Profile.CreditCards.initiateSaveCard,
+ api.endpoints.v2.Profile.CreditCard.initiateSaveCard,
{
headers: {
Authorization: `Bearer ${ctx.session.token.access_token}`,
@@ -85,7 +85,7 @@ export const userMutationRouter = router({
JSON.stringify({})
)
const apiResponse = await api.post(
- api.endpoints.v1.Profile.CreditCards.transaction(input.transactionId),
+ api.endpoints.v2.Profile.CreditCard.transaction(input.transactionId),
{
headers: {
Authorization: `Bearer ${ctx.session.token.access_token}`,
@@ -121,7 +121,7 @@ export const userMutationRouter = router({
JSON.stringify({ query: {} })
)
const apiResponse = await api.remove(
- api.endpoints.v1.Profile.CreditCards.deleteCreditCard(
+ api.endpoints.v2.Profile.CreditCard.deleteCreditCard(
input.creditCardId
),
{
@@ -165,7 +165,7 @@ export const userMutationRouter = router({
metricsGeneratePreferencesLink.start()
- const apiResponse = await api.get(api.endpoints.v1.Profile.subscriberId, {
+ const apiResponse = await api.get(api.endpoints.v2.Profile.subscriberId, {
headers: {
Authorization: `Bearer ${ctx.session.token.access_token}`,
},
diff --git a/packages/trpc/lib/routers/user/query/index.ts b/packages/trpc/lib/routers/user/query/index.ts
index 1191fddfd..6621c04dd 100644
--- a/packages/trpc/lib/routers/user/query/index.ts
+++ b/packages/trpc/lib/routers/user/query/index.ts
@@ -309,14 +309,14 @@ export const userQueryRouter = router({
awardPoints: attributes.awardPoints,
checkinDate: attributes.checkinDate,
checkoutDate: attributes.checkoutDate,
- city: attributes.hotelInformation?.city,
confirmationNumber: attributes.confirmationNumber,
- hotelName: attributes.hotelInformation?.name,
nights: attributes.nights,
pointsCalculated: attributes.pointsCalculated,
hotelId: attributes.hotelOperaId,
transactionDate: attributes.transactionDate,
bookingUrl: attributes.bookingUrl,
+ hotelName: attributes.hotelInformation?.name,
+ city: attributes.hotelInformation?.city,
}
}),
},
diff --git a/packages/trpc/lib/routers/user/services/getCreditCards.ts b/packages/trpc/lib/routers/user/services/getCreditCards.ts
index 103206645..278e9443c 100644
--- a/packages/trpc/lib/routers/user/services/getCreditCards.ts
+++ b/packages/trpc/lib/routers/user/services/getCreditCards.ts
@@ -22,11 +22,14 @@ export const getCreditCards = cache(
metricsGetCreditCards.start()
- const apiResponse = await api.get(api.endpoints.v1.Profile.creditCards, {
- headers: {
- Authorization: `Bearer ${session.token.access_token}`,
- },
- })
+ const apiResponse = await api.get(
+ api.endpoints.v2.Profile.CreditCard.creditCard,
+ {
+ headers: {
+ Authorization: `Bearer ${session.token.access_token}`,
+ },
+ }
+ )
if (!apiResponse.ok) {
await metricsGetCreditCards.httpError(apiResponse)
diff --git a/packages/trpc/lib/routers/user/utils.ts b/packages/trpc/lib/routers/user/utils.ts
index 32e7a311c..e96465fad 100644
--- a/packages/trpc/lib/routers/user/utils.ts
+++ b/packages/trpc/lib/routers/user/utils.ts
@@ -135,11 +135,14 @@ export const getCreditCards = cache(
metricsGetCreditCards.start()
- const apiResponse = await api.get(api.endpoints.v1.Profile.creditCards, {
- headers: {
- Authorization: `Bearer ${session.token.access_token}`,
- },
- })
+ const apiResponse = await api.get(
+ api.endpoints.v2.Profile.CreditCard.creditCard,
+ {
+ headers: {
+ Authorization: `Bearer ${session.token.access_token}`,
+ },
+ }
+ )
if (!apiResponse.ok) {
await metricsGetCreditCards.httpError(apiResponse)