LOY-493/Sidepeek upcoming stays * chore(LOY-493): Add icon to next stay card cta * chore(LOY-493): better folder org for stays * chore(LOY-494): more folder reorg * feat(LOY-493): Implement Sidepeek for Upcoming Stays 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({
|
|
limit: z.number().int().positive(),
|
|
page: z.number().int().positive(),
|
|
lang: z.nativeEnum(Lang).optional(),
|
|
})
|
|
.default({ limit: 5, page: 1 })
|
|
|
|
// 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),
|
|
})
|