| 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 |
blogImages: z.array(z.string()).optional(), |
| 12 |
images: z.array(z.string()).optional(), |
| 13 |
}); |
| 14 |
export const homeTemplateShape = z.looseObject({ |
| 15 |
id: z.string(), |
| 16 |
slug: z.string(), |
| 17 |
headerCode: z.string().optional(), |
| 18 |
footerCode: z.string().optional(), |
| 19 |
patterns: z.array(patternShape), |
| 20 |
}); |
| 21 |
export const getHomeShape = z.looseObject({ |
| 22 |
home: homeTemplateShape, |
| 23 |
}); |
| 24 |
|
| 25 |
// get-images |
| 26 |
const libraryImageShape = z.looseObject({ url: z.string() }); |
| 27 |
export const getImagesShape = z.looseObject({ |
| 28 |
siteImages: z.object({ |
| 29 |
hero: z.array(libraryImageShape).default([]), |
| 30 |
general: z.array(libraryImageShape).default([]), |
| 31 |
}), |
| 32 |
}); |
| 33 |
|
| 34 |
// get-logo |
| 35 |
export const getLogoShape = z.looseObject({ |
| 36 |
logoUrl: z.url(), |
| 37 |
}); |
| 38 |
|
| 39 |
// get-pages |
| 40 |
export const pageTemplateShape = z.looseObject({ |
| 41 |
id: z.string(), |
| 42 |
slug: z.string(), |
| 43 |
name: z.string(), |
| 44 |
patterns: z.array(patternShape), |
| 45 |
siteStyle: z.object(), |
| 46 |
}); |
| 47 |
export const getPagesShape = z.looseObject({ |
| 48 |
pages: z.array(pageTemplateShape), |
| 49 |
}); |
| 50 |
|
| 51 |
// get-plugins |
| 52 |
export const pluginShape = z.looseObject({ |
| 53 |
name: z.string(), |
| 54 |
wordpressSlug: z.string(), |
| 55 |
}); |
| 56 |
export const getPluginsShape = z.object({ |
| 57 |
sitePlugins: z.array(pluginShape), |
| 58 |
}); |
| 59 |
|
| 60 |
// get-profile |
| 61 |
export const socialProfilesShape = z.looseObject({ |
| 62 |
facebook: z.string().nullish(), |
| 63 |
instagram: z.string().nullish(), |
| 64 |
x: z.string().nullish(), |
| 65 |
tiktok: z.string().nullish(), |
| 66 |
}); |
| 67 |
export const getProfileShape = z.looseObject({ |
| 68 |
type: z.string(), |
| 69 |
title: z.string(), |
| 70 |
description: z.string(), |
| 71 |
descriptionRaw: z.string().optional(), |
| 72 |
objective: z.string(), |
| 73 |
category: z.string().optional(), |
| 74 |
structure: z.string(), |
| 75 |
imageSearchTerms: z.array(z.string()), |
| 76 |
tone: z.array(z.string()), |
| 77 |
logoObjectName: z.string(), |
| 78 |
products: z.union([z.string(), z.literal(false)]), |
| 79 |
appointments: z.boolean(), |
| 80 |
events: z.boolean(), |
| 81 |
donations: z.boolean(), |
| 82 |
multilingual: z.boolean(), |
| 83 |
contact: z.boolean(), |
| 84 |
address: z.union([z.boolean(), z.string()]), |
| 85 |
blog: z.boolean(), |
| 86 |
landingPage: z.boolean(), |
| 87 |
landingPageCTALink: z.union([z.literal(false), z.string()]), |
| 88 |
phoneNumber: z.union([z.boolean(), z.string()]).optional(), |
| 89 |
email: z.string().nullish(), |
| 90 |
socialProfiles: socialProfilesShape.nullish(), |
| 91 |
}); |
| 92 |
|
| 93 |
// get-launch-decisions |
| 94 |
export const getLaunchDecisionsShape = z.looseObject({ |
| 95 |
navExtras: z.string().optional(), |
| 96 |
navButtonLabel: z.string().optional(), |
| 97 |
}); |
| 98 |
|
| 99 |
// get-strings |
| 100 |
export const getStringsShape = z.looseObject({ |
| 101 |
aiHeaders: z.array(z.string()), |
| 102 |
aiBlogTitles: z.array(z.string()), |
| 103 |
heroDescription: z.string().optional(), |
| 104 |
}); |
| 105 |
|
| 106 |
// get-style |
| 107 |
export const styleShape = z.looseObject({ |
| 108 |
vibe: z.string(), |
| 109 |
fonts: z.looseObject(), |
| 110 |
variation: z.looseObject(), |
| 111 |
colorPalette: z.string(), |
| 112 |
animation: z.string(), |
| 113 |
}); |
| 114 |
export const getStyleShape = z.object({ |
| 115 |
siteStyle: styleShape.extend({ variation: z.looseObject().optional() }), |
| 116 |
}); |
| 117 |
|
| 118 |
// get-design-build |
| 119 |
const designBuildShape = z.looseObject({ |
| 120 |
siteProfile: getProfileShape, |
| 121 |
pages: z.array( |
| 122 |
z.object({ |
| 123 |
slug: z.string(), |
| 124 |
name: z.string(), |
| 125 |
description: z.string().optional(), |
| 126 |
}), |
| 127 |
), |
| 128 |
siteStyle: styleShape.omit({ variation: true }), |
| 129 |
selectedPlugins: z.array(pluginShape), |
| 130 |
logoUrl: z.url().nullish(), |
| 131 |
templateParts: z.looseObject({ |
| 132 |
header: z.string().nullish(), |
| 133 |
footer: z.string().nullish(), |
| 134 |
}), |
| 135 |
builtPages: z.array( |
| 136 |
z.object({ |
| 137 |
slug: z.string(), |
| 138 |
fullPage: z.boolean(), |
| 139 |
patterns: z.array(patternShape), |
| 140 |
}), |
| 141 |
), |
| 142 |
}); |
| 143 |
export const getDesignBuildShape = designBuildShape; |
| 144 |
|