128 lines
3.0 KiB
TypeScript
128 lines
3.0 KiB
TypeScript
import { z } from "zod"
|
|
|
|
import { systemSchema } from "../schemas/system"
|
|
|
|
export const getBreadcrumbsSchema = z.array(
|
|
z.object({
|
|
href: z.string().optional(),
|
|
title: z.string(),
|
|
uid: z.string(),
|
|
})
|
|
)
|
|
|
|
const breadcrumbsRefs = z.object({
|
|
web: z
|
|
.object({
|
|
breadcrumbs: z
|
|
.object({
|
|
title: z.string(),
|
|
parentsConnection: z.object({
|
|
edges: z.array(
|
|
z.object({
|
|
node: z.object({
|
|
system: systemSchema,
|
|
}),
|
|
})
|
|
),
|
|
}),
|
|
})
|
|
.optional(),
|
|
})
|
|
.optional(),
|
|
system: systemSchema,
|
|
})
|
|
|
|
export type BreadcrumbsRefs = z.infer<typeof breadcrumbsRefs>
|
|
|
|
export const validateMyPagesBreadcrumbsRefsContentstackSchema = z.object({
|
|
account_page: breadcrumbsRefs,
|
|
})
|
|
|
|
export type GetMyPagesBreadcrumbsRefsData = z.infer<
|
|
typeof validateMyPagesBreadcrumbsRefsContentstackSchema
|
|
>
|
|
|
|
export const validateLoyaltyPageBreadcrumbsRefsContentstackSchema = z.object({
|
|
loyalty_page: breadcrumbsRefs,
|
|
})
|
|
|
|
export type GetLoyaltyPageBreadcrumbsRefsData = z.infer<
|
|
typeof validateLoyaltyPageBreadcrumbsRefsContentstackSchema
|
|
>
|
|
|
|
export const validateCollectionPageBreadcrumbsRefsContentstackSchema = z.object(
|
|
{
|
|
collection_page: breadcrumbsRefs,
|
|
}
|
|
)
|
|
|
|
export type GetCollectionPageBreadcrumbsRefsData = z.infer<
|
|
typeof validateCollectionPageBreadcrumbsRefsContentstackSchema
|
|
>
|
|
|
|
export const validateContentPageBreadcrumbsRefsContentstackSchema = z.object({
|
|
content_page: breadcrumbsRefs,
|
|
})
|
|
|
|
export type GetContentPageBreadcrumbsRefsData = z.infer<
|
|
typeof validateContentPageBreadcrumbsRefsContentstackSchema
|
|
>
|
|
|
|
const page = z.object({
|
|
web: z.object({
|
|
breadcrumbs: z.object({
|
|
title: z.string(),
|
|
parentsConnection: z.object({
|
|
edges: z.array(
|
|
z.object({
|
|
node: z.object({
|
|
web: z.object({
|
|
breadcrumbs: z.object({
|
|
title: z.string(),
|
|
}),
|
|
}),
|
|
system: systemSchema,
|
|
url: z.string(),
|
|
}),
|
|
})
|
|
),
|
|
}),
|
|
}),
|
|
}),
|
|
system: systemSchema,
|
|
})
|
|
|
|
export type Page = z.infer<typeof page>
|
|
|
|
export const validateMyPagesBreadcrumbsContentstackSchema = z.object({
|
|
account_page: page,
|
|
})
|
|
|
|
export type GetMyPagesBreadcrumbsData = z.infer<
|
|
typeof validateMyPagesBreadcrumbsContentstackSchema
|
|
>
|
|
|
|
export const validateLoyaltyPageBreadcrumbsContentstackSchema = z.object({
|
|
loyalty_page: page,
|
|
})
|
|
|
|
export type GetLoyaltyPageBreadcrumbsData = z.infer<
|
|
typeof validateLoyaltyPageBreadcrumbsContentstackSchema
|
|
>
|
|
|
|
export const validateContentPageBreadcrumbsContentstackSchema = z.object({
|
|
content_page: page,
|
|
})
|
|
|
|
export type GetContentPageBreadcrumbsData = z.infer<
|
|
typeof validateContentPageBreadcrumbsContentstackSchema
|
|
>
|
|
|
|
export const validateCollectionPageBreadcrumbsContentstackSchema = z.object({
|
|
collection_page: page,
|
|
})
|
|
|
|
export type GetCollectionPageBreadcrumbsData = z.infer<
|
|
typeof validateCollectionPageBreadcrumbsContentstackSchema
|
|
>
|