| 1 |
import { z } from 'zod'; |
| 2 |
|
| 3 |
// get-home |
| 4 |
const patternShape = z.looseObject({ |
| 5 |
name: z.string(), |
| 6 |
code: z.string(), |
| 7 |
patternTypes: z.array(z.string()), |
| 8 |
contentGenerated: z.boolean().optional(), |
| 9 |
navSlug: z.string().optional(), |
| 10 |
navLabel: z.string().optional(), |
| 11 |
}); |
| 12 |
export const homeTemplateShape = z.looseObject({ |
| 13 |
id: z.string(), |
| 14 |
slug: z.string(), |
| 15 |
headerCode: z.string().optional(), |
| 16 |
footerCode: z.string().optional(), |
| 17 |
patterns: z.array(patternShape), |
| 18 |
}); |
| 19 |
export const getHomeShape = z.looseObject({ |
| 20 |
home: homeTemplateShape, |
| 21 |
}); |
| 22 |
|
| 23 |
// get-images |
| 24 |
export const getImagesShape = z.looseObject({ |
| 25 |
siteImages: z.array(z.string()), |
| 26 |
}); |
| 27 |
|
| 28 |
// get-logo |
| 29 |
export const getLogoShape = z.looseObject({ |
| 30 |
logoUrl: z.url(), |
| 31 |
}); |
| 32 |
|
| 33 |
// get-pages |
| 34 |
export const pageTemplateShape = z.looseObject({ |
| 35 |
id: z.string(), |
| 36 |
slug: z.string(), |
| 37 |
name: z.string(), |
| 38 |
patterns: z.array(patternShape), |
| 39 |
siteStyle: z.object(), |
| 40 |
}); |
| 41 |
export const getPagesShape = z.looseObject({ |
| 42 |
pages: z.array(pageTemplateShape), |
| 43 |
}); |
| 44 |
|
| 45 |
// get-plugins |
| 46 |
export const pluginShape = z.looseObject({ |
| 47 |
name: z.string(), |
| 48 |
wordpressSlug: z.string(), |
| 49 |
}); |
| 50 |
export const getPluginsShape = z.object({ |
| 51 |
sitePlugins: z.array(pluginShape), |
| 52 |
}); |
| 53 |
|
| 54 |
// get-profile |
| 55 |
export const getProfileShape = z.looseObject({ |
| 56 |
type: z.string(), |
| 57 |
title: z.string(), |
| 58 |
description: z.string(), |
| 59 |
descriptionRaw: z.string().optional(), |
| 60 |
objective: z.string(), |
| 61 |
category: z.string().optional(), |
| 62 |
structure: z.string(), |
| 63 |
imageSearchTerms: z.array(z.string()), |
| 64 |
tone: z.array(z.string()), |
| 65 |
logoObjectName: z.string(), |
| 66 |
products: z.union([z.string(), z.literal(false)]), |
| 67 |
appointments: z.boolean(), |
| 68 |
events: z.boolean(), |
| 69 |
donations: z.boolean(), |
| 70 |
multilingual: z.boolean(), |
| 71 |
contact: z.boolean(), |
| 72 |
address: z.union([z.boolean(), z.string()]), |
| 73 |
blog: z.boolean(), |
| 74 |
landingPage: z.boolean(), |
| 75 |
landingPageCTALink: z.union([z.literal(false), z.string()]), |
| 76 |
phoneNumber: z.union([z.boolean(), z.string()]).optional(), |
| 77 |
}); |
| 78 |
|
| 79 |
// get-strings |
| 80 |
export const getStringsShape = z.looseObject({ |
| 81 |
aiHeaders: z.array(z.string()), |
| 82 |
aiBlogTitles: z.array(z.string()), |
| 83 |
}); |
| 84 |
|
| 85 |
// get-style |
| 86 |
export const styleShape = z.looseObject({ |
| 87 |
vibe: z.string(), |
| 88 |
fonts: z.looseObject(), |
| 89 |
variation: z.looseObject(), |
| 90 |
colorPalette: z.string(), |
| 91 |
animation: z.string(), |
| 92 |
}); |
| 93 |
export const getStyleShape = z.object({ |
| 94 |
siteStyle: styleShape.extend({ variation: z.looseObject().optional() }), |
| 95 |
}); |
| 96 |
|
| 97 |
// get-design-build |
| 98 |
const designBuildShape = z.looseObject({ |
| 99 |
siteProfile: getProfileShape, |
| 100 |
pages: z.array( |
| 101 |
z.object({ |
| 102 |
slug: z.string(), |
| 103 |
name: z.string(), |
| 104 |
description: z.string().optional(), |
| 105 |
}), |
| 106 |
), |
| 107 |
patternId: z.string(), |
| 108 |
headerCode: z.string(), |
| 109 |
siteStyle: styleShape.omit({ variation: true }), |
| 110 |
selectedPlugins: z.array(pluginShape), |
| 111 |
html: z.string(), |
| 112 |
patternCode: z.string(), |
| 113 |
logoUrl: z.url().nullish(), |
| 114 |
}); |
| 115 |
export const getDesignBuildShape = designBuildShape; |
| 116 |
|