fix: hide new cs rewards model behind feature flag

This commit is contained in:
Christian Andolf
2024-12-10 16:21:08 +01:00
parent f075521421
commit 0d607d7cc7
11 changed files with 106 additions and 23 deletions

View File

@@ -92,6 +92,30 @@ export const validateApiTierRewardsSchema = z.record(
)
export const validateCmsRewardsSchema = z
.object({
data: z.object({
all_reward: z.object({
items: z.array(
z.object({
taxonomies: z.array(
z.object({
term_uid: z.string().optional(),
})
),
label: z.string().optional(),
reward_id: z.string(),
grouped_label: z.string().optional(),
description: z.string().optional(),
grouped_description: z.string().optional(),
value: z.string().optional(),
})
),
}),
}),
})
.transform((data) => data.data.all_reward.items)
export const validateCmsRewardsWithRedeemSchema = z
.object({
data: z.object({
all_reward: z.object({
@@ -125,12 +149,24 @@ export type SurpriseReward = z.output<typeof SurpriseReward>
export type CmsRewardsResponse = z.input<typeof validateCmsRewardsSchema>
export type CmsRewardsWithRedeemResponse = z.input<
typeof validateCmsRewardsWithRedeemSchema
>
export type CMSReward = z.output<typeof validateCmsRewardsSchema>[0]
export type CMSRewardWithRedeem = z.output<
typeof validateCmsRewardsWithRedeemSchema
>[0]
export type Reward = CMSReward & {
id: string | undefined
}
export type RewardWithRedeem = CMSRewardWithRedeem & {
id: string | undefined
}
// New endpoint related types and schemas.
const BenefitReward = z.object({