fix: refactor use of tokens
This commit is contained in:
@@ -21,9 +21,15 @@ const pageLink = z.object({
|
||||
uid: z.string(),
|
||||
locale: z.nativeEnum(Lang),
|
||||
}),
|
||||
web: z
|
||||
.object({
|
||||
original_url: z.string().nullable(),
|
||||
})
|
||||
.nullable()
|
||||
.optional(),
|
||||
url: z.string(),
|
||||
title: z.string(),
|
||||
__typename: z.string(),
|
||||
__typename: z.string().optional(),
|
||||
}),
|
||||
})
|
||||
),
|
||||
@@ -39,21 +45,7 @@ const loyaltyPageDynamicContent = z.object({
|
||||
component: z.nativeEnum(LoyaltyComponentEnum),
|
||||
link: z.object({
|
||||
text: z.string().nullable(),
|
||||
pageConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: z.object({
|
||||
system: z.object({
|
||||
uid: z.string(),
|
||||
locale: z.nativeEnum(Lang),
|
||||
}),
|
||||
url: z.string(),
|
||||
title: z.string(),
|
||||
}),
|
||||
})
|
||||
),
|
||||
totalCount: z.number(),
|
||||
}),
|
||||
pageConnection: pageLink,
|
||||
}),
|
||||
}),
|
||||
})
|
||||
@@ -65,27 +57,7 @@ const loyaltyPageShortcuts = z.object({
|
||||
preamble: z.string().nullable(),
|
||||
shortcuts: z.array(
|
||||
z.object({
|
||||
linkConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: z.object({
|
||||
system: z.object({
|
||||
uid: z.string(),
|
||||
locale: z.nativeEnum(Lang),
|
||||
}),
|
||||
url: z.string(),
|
||||
web: z
|
||||
.object({
|
||||
original_url: z.string().nullable(),
|
||||
})
|
||||
.nullable()
|
||||
.optional(),
|
||||
title: z.string(),
|
||||
}),
|
||||
})
|
||||
),
|
||||
totalCount: z.number(),
|
||||
}),
|
||||
linkConnection: pageLink,
|
||||
text: z.string().nullable(),
|
||||
open_in_new_tab: z.boolean(),
|
||||
})
|
||||
@@ -193,7 +165,6 @@ const loyaltyPageJoinLoyaltyContact = z.object({
|
||||
),
|
||||
contact: z.object({
|
||||
display_text: z.string().nullable(),
|
||||
|
||||
contact_field: z.string(),
|
||||
}),
|
||||
})
|
||||
@@ -243,38 +214,29 @@ export interface RteBlockContent extends BlockContentRaw {
|
||||
|
||||
type CardsGridRaw = z.infer<typeof loyaltyPageCards>
|
||||
|
||||
export type CardsRaw =
|
||||
CardsGridRaw["cards_grid"]["cardConnection"]["edges"][number]["node"]
|
||||
|
||||
export type CardsGrid = Omit<CardsGridRaw, "cards_grid"> & {
|
||||
cards_grid: Omit<CardsGridRaw["cards_grid"], "cardConnection"> & {
|
||||
cards: {
|
||||
system: {
|
||||
locale: Lang
|
||||
uid: string
|
||||
}
|
||||
heading: string | null
|
||||
body_text: string | null
|
||||
scripted_top_title: string | null
|
||||
cards: (Omit<CardsRaw, "primaryButton" | "secondaryButton"> & {
|
||||
primaryButton:
|
||||
| {
|
||||
open_in_new_tab: boolean
|
||||
link: {
|
||||
title: string
|
||||
href: string
|
||||
}
|
||||
openInNewTab: boolean
|
||||
title: string
|
||||
href: string
|
||||
isExternal: boolean
|
||||
}
|
||||
| undefined
|
||||
secondaryButton:
|
||||
| {
|
||||
open_in_new_tab: boolean
|
||||
link: {
|
||||
title: string
|
||||
href: string
|
||||
}
|
||||
openInNewTab: boolean
|
||||
title: string
|
||||
href: string
|
||||
isExternal: boolean
|
||||
}
|
||||
| undefined
|
||||
background_image?: any
|
||||
}[]
|
||||
})[]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user