Feat/LOY-391 my points transactions table design * feat(LOY-391): Added new design to point transaction table * fix(LOY-391): rebase fix * fix(LOY-391): fix * fix(LOY-391): fix * fix(LOY-391): fixed sticky header etc. * feat(LOY-391): added focus on the newest loaded item in the list * fix(LOY-391): cleaned up * fix(LOY-391): style fix * fix(LOY-391): fixed PR-comments, types, removed the old files for earn and burn table * fix(LOY-391): fixed PR-comments * feat(LOY-391): added useCallback so scrolling is avoided when clicking see all on expiring points Approved-by: Anton Gunnarsson Approved-by: Matilda Landström
80 lines
1.8 KiB
TypeScript
80 lines
1.8 KiB
TypeScript
import { z } from "zod"
|
|
|
|
import { Lang } from "@scandic-hotels/common/constants/language"
|
|
|
|
import { signUpSchema } from "./schemas"
|
|
|
|
// Query
|
|
|
|
export const staysInput = z
|
|
.object({
|
|
cursor: z
|
|
.number()
|
|
.optional()
|
|
.transform((num) => (num ? String(num) : undefined)),
|
|
limit: z.number().min(0).default(6),
|
|
lang: z.nativeEnum(Lang).optional(),
|
|
includeFirstStay: z.boolean().optional(),
|
|
})
|
|
.default({})
|
|
|
|
export const friendTransactionsInput = z
|
|
.object({
|
|
cursor: z.number().optional(),
|
|
limit: z.number().min(0).default(10),
|
|
lang: z.nativeEnum(Lang).optional(),
|
|
})
|
|
.default({})
|
|
|
|
// Mutation
|
|
export const addCreditCardInput = z.object({
|
|
language: z.string(),
|
|
})
|
|
|
|
export const deleteCreditCardInput = z.object({
|
|
creditCardId: z.string(),
|
|
})
|
|
|
|
export const saveCreditCardInput = z.object({
|
|
transactionId: z.string(),
|
|
merchantId: z.string().optional(),
|
|
})
|
|
|
|
export const signupInput = signUpSchema
|
|
.extend({
|
|
language: z.nativeEnum(Lang),
|
|
})
|
|
.omit({ termsAccepted: true })
|
|
.transform(({ profilingConsent, ...data }) => ({
|
|
...data,
|
|
phoneNumber: data.phoneNumber.replace(/\s+/g, ""),
|
|
address: {
|
|
...data.address,
|
|
city: "",
|
|
country: "",
|
|
streetAddress: "",
|
|
},
|
|
...(profilingConsent ? { profilingConsent } : {}),
|
|
}))
|
|
|
|
export const profilingConsentInput = z.object({
|
|
profilingConsent: z.boolean(),
|
|
})
|
|
|
|
export const profilingConsentPromptDateInput = z.object({
|
|
profilingConsentPromptDate: z.string(),
|
|
})
|
|
|
|
export const getSavedPaymentCardsInput = z.object({
|
|
supportedCards: z.array(z.string()),
|
|
})
|
|
|
|
export type GetSavedPaymentCardsInput = z.input<
|
|
typeof getSavedPaymentCardsInput
|
|
>
|
|
|
|
export const addPromoCampaignInput = z.object({
|
|
promotionId: z.string(),
|
|
language: z.nativeEnum(Lang),
|
|
})
|