Merged in feat/3614-basicInfo (pull request #3427)

feat(SW-3614): use new loyalty prop in basicProfile

* feat(SW-3614): use new loyalty prop in basicProfile

* PR fixes


Approved-by: Matilda Landström
This commit is contained in:
Linus Flood
2026-01-15 14:02:28 +00:00
parent b9d134bca6
commit 7639daf792
12 changed files with 83 additions and 46 deletions

View File

@@ -3,22 +3,25 @@ import { cache } from "react"
import * as routes from "@scandic-hotels/common/constants/routes/myPages"
import { safeTry } from "@scandic-hotels/common/utils/safeTry"
import { getEurobonusMembership } from "../../user/helpers"
import { scandicMembershipTypes } from "../../user/helpers"
import type { Lang } from "@scandic-hotels/common/constants/language"
import type { UserLoyalty } from "../../../types/user"
import type { BasicUserProfile } from "../../../types/user"
import type { MyPagesLink } from "./MyPagesLink"
export const getPrimaryLinks = cache(
async ({
lang,
userLoyalty,
basicUserLoyalty,
}: {
lang: Lang
userLoyalty?: UserLoyalty
basicUserLoyalty?: BasicUserProfile["loyalty"]
}): Promise<MyPagesLink[]> => {
const showSASLink = userLoyalty ? isScandicXSASActive(userLoyalty) : false
const showSASLink = basicUserLoyalty?.memberships?.some(
(m) => m.membershipType === scandicMembershipTypes.SAS_EB
)
const [showTeamMemberLink] = await safeTry(showTeamMemberCard())
const menuItems: MyPagesLink[] = [
@@ -64,11 +67,6 @@ export const getPrimaryLinks = cache(
}
)
const isScandicXSASActive = (loyalty: UserLoyalty) => {
const eurobonusMembership = getEurobonusMembership(loyalty)
return Boolean(eurobonusMembership)
}
const showTeamMemberCard = cache(async () => {
async function getIsTeamMember() {
// TODO: Implement this check