fix: allow any membership level
This commit is contained in:
@@ -63,6 +63,7 @@ function getInitialState({ user, lang }: { user?: User; lang: Lang }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!membership.membershipLevel) return null
|
if (!membership.membershipLevel) return null
|
||||||
|
// @ts-expect-error: membership levels needs proper fix
|
||||||
const level = membershipLevels[membership.membershipLevel]
|
const level = membershipLevels[membership.membershipLevel]
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
@@ -155,6 +156,7 @@ export default function OverviewTable({
|
|||||||
|
|
||||||
let activeMembershipLevel: membershipLevels | null = null
|
let activeMembershipLevel: membershipLevels | null = null
|
||||||
if (activeMembership?.membershipLevel) {
|
if (activeMembership?.membershipLevel) {
|
||||||
|
// @ts-expect-error: membershiplevel needs proper fix
|
||||||
activeMembershipLevel = membershipLevels[activeMembership?.membershipLevel]
|
activeMembershipLevel = membershipLevels[activeMembership?.membershipLevel]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export default async function Friend({
|
|||||||
if (!membership?.membershipLevel) {
|
if (!membership?.membershipLevel) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
// @ts-expect-error: membershiplevel needs proper fix
|
||||||
const isHighestLevel = isHighestMembership(membership.membershipLevel)
|
const isHighestLevel = isHighestMembership(membership.membershipLevel)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -31,11 +32,13 @@ export default async function Friend({
|
|||||||
{formatMessage(
|
{formatMessage(
|
||||||
isHighestLevel
|
isHighestLevel
|
||||||
? { id: "Highest level" }
|
? { id: "Highest level" }
|
||||||
: { id: `Level ${membershipLevels[membership.membershipLevel]}` }
|
: // @ts-expect-error: membershiplevel needs proper fix
|
||||||
|
{ id: `Level ${membershipLevels[membership.membershipLevel]}` }
|
||||||
)}
|
)}
|
||||||
</Body>
|
</Body>
|
||||||
{membership ? (
|
{membership ? (
|
||||||
<MembershipLevel
|
<MembershipLevel
|
||||||
|
// @ts-expect-error: membershiplevel needs proper fix
|
||||||
level={membershipLevels[membership.membershipLevel]}
|
level={membershipLevels[membership.membershipLevel]}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
|
|
||||||
import { MembershipLevelEnum } from "@/constants/membershipLevels"
|
|
||||||
|
|
||||||
import { countriesMap } from "@/components/TempDesignSystem/Form/Country/countries"
|
import { countriesMap } from "@/components/TempDesignSystem/Form/Country/countries"
|
||||||
|
|
||||||
export const getUserSchema = z.object({
|
export const getUserSchema = z.object({
|
||||||
@@ -22,7 +20,7 @@ export const getUserSchema = z.object({
|
|||||||
currentPoints: z.number(),
|
currentPoints: z.number(),
|
||||||
expirationDate: z.string(),
|
expirationDate: z.string(),
|
||||||
membershipNumber: z.string(),
|
membershipNumber: z.string(),
|
||||||
membershipLevel: z.nativeEnum(MembershipLevelEnum).optional(),
|
membershipLevel: z.string().optional(),
|
||||||
memberSince: z.string(),
|
memberSince: z.string(),
|
||||||
membershipType: z.string(),
|
membershipType: z.string(),
|
||||||
nextLevel: z.string().optional(),
|
nextLevel: z.string().optional(),
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import type {
|
|||||||
LoginType,
|
LoginType,
|
||||||
TrackingSDKUserData,
|
TrackingSDKUserData,
|
||||||
} from "@/types/components/tracking"
|
} from "@/types/components/tracking"
|
||||||
|
import type { MembershipLevel } from "@/constants/membershipLevels"
|
||||||
|
|
||||||
// OpenTelemetry metrics: User
|
// OpenTelemetry metrics: User
|
||||||
const meter = metrics.getMeter("trpc.user")
|
const meter = metrics.getMeter("trpc.user")
|
||||||
@@ -437,7 +438,7 @@ export const userQueryRouter = router({
|
|||||||
loginStatus: "logged in",
|
loginStatus: "logged in",
|
||||||
loginType: ctx.session.token.loginType as LoginType,
|
loginType: ctx.session.token.loginType as LoginType,
|
||||||
memberId: membership?.membershipNumber,
|
memberId: membership?.membershipNumber,
|
||||||
memberLevel: membership?.membershipLevel,
|
memberLevel: membership?.membershipLevel as MembershipLevel,
|
||||||
noOfNightsStayed: verifiedPreviousStaysData.data.links?.totalCount ?? 0,
|
noOfNightsStayed: verifiedPreviousStaysData.data.links?.totalCount ?? 0,
|
||||||
totalPointsAvailableToSpend: membership?.currentPoints,
|
totalPointsAvailableToSpend: membership?.currentPoints,
|
||||||
loginAction: "login success",
|
loginAction: "login success",
|
||||||
|
|||||||
Reference in New Issue
Block a user