Merged in feat/sw-1313-show-sas-points (pull request #1682)

SW-1313 - Add support for getting SAS EB points

Approved-by: Joakim Jäderberg
This commit is contained in:
Anton Gunnarsson
2025-04-08 11:03:38 +00:00
parent d30cc7e2be
commit 5cb19dfccd
5 changed files with 62 additions and 13 deletions

View File

@@ -1,11 +1,12 @@
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { getProfileSafely } from "@/lib/trpc/memoizedRequests"
import { getProfileWithExtendedPartnerData } from "@/lib/trpc/memoizedRequests"
import Image from "@/components/Image"
import SkeletonShimmer from "@/components/SkeletonShimmer"
import { getIntl } from "@/i18n"
import { getEurobonusMembership } from "@/utils/user"
import { TransferPointsFormClient } from "./TransferPointsFormClient"
@@ -13,14 +14,17 @@ import styles from "./transferPoints.module.css"
import type { Lang } from "@/constants/languages"
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
export async function TransferPointsForm({ lang }: { lang: Lang }) {
const profile = await getProfileSafely()
const profile = await getProfileWithExtendedPartnerData()
if (!profile) return null
const eurobonusMembership = getEurobonusMembership(profile?.loyalty)
if (!eurobonusMembership) return null
const scandicPoints = profile?.membership?.currentPoints ?? 0
const sasPoints = eurobonusMembership.spendablePoints || 0
// TODO get from api
await wait(1_000)
const sasPoints = 250_000
const exchangeRate = 2
return (
@@ -89,7 +93,11 @@ async function TransferPointsFormContent({
</p>
</Typography>
{sasPoints === null ? (
<SkeletonShimmer width="10ch" height="20px" />
<SkeletonShimmer
width="10ch"
height="20px"
display="inline-block"
/>
) : (
<Typography variant="Body/Paragraph/mdRegular">
<p>
@@ -132,7 +140,11 @@ async function TransferPointsFormContent({
</p>
</Typography>
{scandicPoints === null ? (
<SkeletonShimmer width="10ch" height="20px" />
<SkeletonShimmer
width="10ch"
height="20px"
display="inline-block"
/>
) : (
<Typography variant="Body/Paragraph/mdRegular">
<p>