feat/SW-1444 destination page add destination list component * feat(SW-1444): add list component * feat(SW-1444): add subtitle to accordion * feat(SW-1444): refactor component structure * feat(SW-1444): add desktop breakpoint * feat(SW-1444): fix typo * feat(SW-1444): add props * feat(SW-1444): add query * feat(SW-1444): updated query * feat(SW-1444): display data * feat(SW-1444): fix merge hickup * feat(SW-1444): change var name * feat(SW-1444): remove unsued translations * feat(SW-1444): use country as title * feat(SW-1444): sort hotels in query * feat(SW-1444): make responsive * feat(SW-1444): fetch country url * feat(SW-1444): update logging * feat(SW-1444): remove spread Approved-by: Erik Tiekstra
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import { z } from "zod"
|
|
|
|
import { removeMultipleSlashes } from "@/utils/url"
|
|
|
|
import { systemSchema } from "../schemas/system"
|
|
|
|
export const destinationOverviewPageSchema = z.object({
|
|
destination_overview_page: z.object({
|
|
title: z.string(),
|
|
system: systemSchema.merge(
|
|
z.object({
|
|
created_at: z.string(),
|
|
updated_at: z.string(),
|
|
})
|
|
),
|
|
}),
|
|
trackingProps: z.object({
|
|
url: z.string(),
|
|
}),
|
|
})
|
|
|
|
export const countryPageUrlSchema = z
|
|
.object({
|
|
all_destination_country_page: z.object({
|
|
items: z.array(
|
|
z
|
|
.object({
|
|
url: z.string(),
|
|
system: systemSchema,
|
|
})
|
|
.transform((data) => {
|
|
return {
|
|
url: removeMultipleSlashes(`/${data.system.locale}/${data.url}`),
|
|
}
|
|
})
|
|
),
|
|
}),
|
|
})
|
|
.transform(
|
|
({ all_destination_country_page }) => all_destination_country_page.items[0]
|
|
)
|
|
|
|
/** REFS */
|
|
export const destinationOverviewPageRefsSchema = z.object({
|
|
destination_overview_page: z.object({
|
|
system: systemSchema,
|
|
}),
|
|
})
|