@pro-laico/create-atomic-payload 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +159 -0
- package/package.json +29 -0
- package/template/.env.example +35 -0
- package/template/.gitattributes +2 -0
- package/template/.prettierrc.json +6 -0
- package/template/.vscode/extensions.json +3 -0
- package/template/.vscode/launch.json +24 -0
- package/template/.vscode/settings.json +86 -0
- package/template/.yarnrc +1 -0
- package/template/LICENSE.md +22 -0
- package/template/README.md +128 -0
- package/template/eslint.config.mjs +32 -0
- package/template/next-env.d.ts +6 -0
- package/template/next.config.ts +36 -0
- package/template/package.json +75 -0
- package/template/public/adminFavicon.svg +1 -0
- package/template/public/ogImage.webp +0 -0
- package/template/src/access/anyone.ts +3 -0
- package/template/src/access/authenticated.ts +7 -0
- package/template/src/access/authenticatedOrPublished.ts +6 -0
- package/template/src/app/(frontend)/[...slug]/page.tsx +48 -0
- package/template/src/app/(frontend)/layout.tsx +49 -0
- package/template/src/app/(frontend)/next/exit-preview/route.ts +7 -0
- package/template/src/app/(frontend)/next/preview/route.ts +45 -0
- package/template/src/app/(frontend)/next/seed/route.ts +31 -0
- package/template/src/app/(frontend)/not-found.tsx +93 -0
- package/template/src/app/(frontend)/page.tsx +5 -0
- package/template/src/app/(frontend)/sitemap.ts +14 -0
- package/template/src/app/(payload)/admin/[[...segments]]/not-found.tsx +24 -0
- package/template/src/app/(payload)/admin/[[...segments]]/page.tsx +24 -0
- package/template/src/app/(payload)/admin/importMap.js +85 -0
- package/template/src/app/(payload)/api/[...slug]/route.ts +19 -0
- package/template/src/app/(payload)/custom.scss +29 -0
- package/template/src/app/(payload)/layout.tsx +31 -0
- package/template/src/blocks/actions/blocks.ts +27 -0
- package/template/src/blocks/actions/cookieConsent/set/block.ts +17 -0
- package/template/src/blocks/actions/cookieConsent/set/filter.ts +3 -0
- package/template/src/blocks/actions/cookieConsent/set/options.ts +35 -0
- package/template/src/blocks/actions/cookieConsent/toDA/block.ts +14 -0
- package/template/src/blocks/actions/cookieConsent/toDA/filter.ts +3 -0
- package/template/src/blocks/actions/cookieConsent/toDA/options.ts +19 -0
- package/template/src/blocks/actions/dynamicStore/boolean/set/block.ts +15 -0
- package/template/src/blocks/actions/dynamicStore/boolean/set/filter.ts +4 -0
- package/template/src/blocks/actions/dynamicStore/boolean/set/options.ts +18 -0
- package/template/src/blocks/actions/dynamicStore/boolean/toDA/block.ts +10 -0
- package/template/src/blocks/actions/dynamicStore/boolean/toDA/filter.ts +3 -0
- package/template/src/blocks/actions/dynamicStore/boolean/toDA/options.ts +12 -0
- package/template/src/blocks/actions/dynamicStore/text/cycle/block.ts +41 -0
- package/template/src/blocks/actions/dynamicStore/text/cycle/filter.ts +4 -0
- package/template/src/blocks/actions/dynamicStore/text/cycle/options.ts +23 -0
- package/template/src/blocks/actions/dynamicStore/text/toDA/block.ts +10 -0
- package/template/src/blocks/actions/dynamicStore/text/toDA/filter.ts +3 -0
- package/template/src/blocks/actions/dynamicStore/text/toDA/options.ts +12 -0
- package/template/src/blocks/actions/filters.ts +27 -0
- package/template/src/blocks/actions/form/errorToDA/block.ts +18 -0
- package/template/src/blocks/actions/form/errorToDA/filter.ts +3 -0
- package/template/src/blocks/actions/form/errorToDA/options.ts +15 -0
- package/template/src/blocks/actions/form/reset/block.ts +18 -0
- package/template/src/blocks/actions/form/reset/filter.ts +3 -0
- package/template/src/blocks/actions/form/reset/options.ts +30 -0
- package/template/src/blocks/actions/form/statusToDA/block.ts +12 -0
- package/template/src/blocks/actions/form/statusToDA/filter.ts +3 -0
- package/template/src/blocks/actions/form/statusToDA/options.ts +15 -0
- package/template/src/blocks/actions/form/submit/block.ts +18 -0
- package/template/src/blocks/actions/form/submit/filter.ts +3 -0
- package/template/src/blocks/actions/form/submit/options.ts +35 -0
- package/template/src/blocks/actions/portal/set/block.ts +25 -0
- package/template/src/blocks/actions/portal/set/filter.ts +3 -0
- package/template/src/blocks/actions/portal/set/options.ts +43 -0
- package/template/src/blocks/actions/processor.ts +263 -0
- package/template/src/blocks/actions/theme/set/block.ts +10 -0
- package/template/src/blocks/actions/theme/set/filter.ts +3 -0
- package/template/src/blocks/actions/theme/set/options.ts +9 -0
- package/template/src/blocks/actions/zap.ts +4 -0
- package/template/src/blocks/children/atomic/block.ts +123 -0
- package/template/src/blocks/children/atomic/controlBar.ts +43 -0
- package/template/src/blocks/children/atomic/variants/button/typeField.ts +16 -0
- package/template/src/blocks/children/atomic/variants/button/variants/link/component.client.tsx +21 -0
- package/template/src/blocks/children/atomic/variants/button/variants/link/component.tsx +13 -0
- package/template/src/blocks/children/atomic/variants/button/variants/link/controlBar.ts +73 -0
- package/template/src/blocks/children/atomic/variants/button/variants/link/settings.ts +26 -0
- package/template/src/blocks/children/atomic/variants/button/variants/portal/controlBar.ts +35 -0
- package/template/src/blocks/children/atomic/variants/button/variants/portal/dialog/component.tsx +36 -0
- package/template/src/blocks/children/atomic/variants/button/variants/portal/dialog/settings.ts +24 -0
- package/template/src/blocks/children/atomic/variants/button/variants/portal/popover/component.tsx +41 -0
- package/template/src/blocks/children/atomic/variants/button/variants/portal/popover/settings.ts +111 -0
- package/template/src/blocks/children/atomic/variants/button/variants/regular/component.client.tsx +19 -0
- package/template/src/blocks/children/atomic/variants/button/variants/regular/component.tsx +11 -0
- package/template/src/blocks/children/atomic/variants/form/component.tsx +18 -0
- package/template/src/blocks/children/atomic/variants/form/controlBar.ts +22 -0
- package/template/src/blocks/children/atomic/variants/form/settings.ts +20 -0
- package/template/src/blocks/children/atomic/variants/input/autoCompleteOptions.ts +51 -0
- package/template/src/blocks/children/atomic/variants/input/controlBar.ts +13 -0
- package/template/src/blocks/children/atomic/variants/input/settings.ts +35 -0
- package/template/src/blocks/children/atomic/variants/input/typeField.ts +23 -0
- package/template/src/blocks/children/atomic/variants/input/variants/checkBox/component.client.tsx +12 -0
- package/template/src/blocks/children/atomic/variants/input/variants/checkBox/component.tsx +6 -0
- package/template/src/blocks/children/atomic/variants/input/variants/checkBox/settings.ts +9 -0
- package/template/src/blocks/children/atomic/variants/input/variants/number/component.client.tsx +12 -0
- package/template/src/blocks/children/atomic/variants/input/variants/number/component.tsx +6 -0
- package/template/src/blocks/children/atomic/variants/input/variants/number/settings.ts +9 -0
- package/template/src/blocks/children/atomic/variants/input/variants/radio/component.client.tsx +12 -0
- package/template/src/blocks/children/atomic/variants/input/variants/radio/component.tsx +6 -0
- package/template/src/blocks/children/atomic/variants/input/variants/radio/settings.ts +9 -0
- package/template/src/blocks/children/atomic/variants/input/variants/text/component.client.tsx +12 -0
- package/template/src/blocks/children/atomic/variants/input/variants/text/component.tsx +7 -0
- package/template/src/blocks/children/atomic/variants/input/variants/text/settings.ts +12 -0
- package/template/src/blocks/children/atomic/variants/tag/component.client.tsx +17 -0
- package/template/src/blocks/children/atomic/variants/tag/component.tsx +13 -0
- package/template/src/blocks/children/atomic/variants/tag/controlBar.ts +6 -0
- package/template/src/blocks/children/atomic/variants/tag/settings.ts +9 -0
- package/template/src/blocks/children/blocks.ts +13 -0
- package/template/src/blocks/children/icon/block.ts +41 -0
- package/template/src/blocks/children/icon/component.tsx +17 -0
- package/template/src/blocks/children/image/block.ts +80 -0
- package/template/src/blocks/children/image/component.tsx +21 -0
- package/template/src/blocks/children/richText/block.ts +50 -0
- package/template/src/blocks/children/richText/component/converters/index.tsx +10 -0
- package/template/src/blocks/children/richText/component/converters/internalLink.tsx +8 -0
- package/template/src/blocks/children/richText/component/index.tsx +10 -0
- package/template/src/blocks/children/richText/component.tsx +7 -0
- package/template/src/blocks/children/richText/defaultLexical.ts +65 -0
- package/template/src/blocks/children/simpleText/block.ts +41 -0
- package/template/src/blocks/children/simpleText/component.client.tsx +18 -0
- package/template/src/blocks/children/simpleText/component.tsx +11 -0
- package/template/src/blocks/children/svg/block.ts +39 -0
- package/template/src/blocks/children/svg/component.tsx +6 -0
- package/template/src/blocks/children/video/block.ts +70 -0
- package/template/src/blocks/children/video/component.tsx +11 -0
- package/template/src/blocks/children/zap.ts +54 -0
- package/template/src/blocks/submitForm/form/rateLimiting/blocks.ts +5 -0
- package/template/src/blocks/submitForm/form/rateLimiting/functions.ts +1 -0
- package/template/src/blocks/submitForm/form/rateLimiting/simpleSlidingWindow/block.ts +23 -0
- package/template/src/blocks/submitForm/form/rateLimiting/simpleSlidingWindow/serverFunction.ts +46 -0
- package/template/src/blocks/submitForm/form/sanitation/blocks.ts +6 -0
- package/template/src/blocks/submitForm/form/sanitation/combineTwoFields/block.ts +19 -0
- package/template/src/blocks/submitForm/form/sanitation/combineTwoFields/serverFunction.ts +22 -0
- package/template/src/blocks/submitForm/form/sanitation/functions.ts +1 -0
- package/template/src/blocks/submitForm/form/validation/blocks.ts +6 -0
- package/template/src/blocks/submitForm/form/validation/functions.ts +1 -0
- package/template/src/blocks/submitForm/form/validation/isUnique/block.ts +19 -0
- package/template/src/blocks/submitForm/form/validation/isUnique/serverFunction.ts +40 -0
- package/template/src/blocks/submitForm/form/zap.ts +8 -0
- package/template/src/blocks/submitForm/formProcessor.ts +222 -0
- package/template/src/blocks/submitForm/input/sanitation/blocks.ts +5 -0
- package/template/src/blocks/submitForm/input/sanitation/functions.ts +1 -0
- package/template/src/blocks/submitForm/input/sanitation/trimText/block.ts +24 -0
- package/template/src/blocks/submitForm/input/sanitation/trimText/serverFunction.ts +63 -0
- package/template/src/blocks/submitForm/input/useOn.ts +8 -0
- package/template/src/blocks/submitForm/input/validation/blocks.ts +6 -0
- package/template/src/blocks/submitForm/input/validation/contains/block.ts +12 -0
- package/template/src/blocks/submitForm/input/validation/contains/serverFunction.ts +23 -0
- package/template/src/blocks/submitForm/input/validation/doesNotContain/block.ts +12 -0
- package/template/src/blocks/submitForm/input/validation/doesNotContain/serverFunction.ts +23 -0
- package/template/src/blocks/submitForm/input/validation/functions.ts +2 -0
- package/template/src/blocks/submitForm/input/zap.ts +6 -0
- package/template/src/blocks/submitForm/serverFunction.ts +42 -0
- package/template/src/collections/designSets/collection.ts +44 -0
- package/template/src/collections/designSets/defaults.ts +20 -0
- package/template/src/collections/designSets/tabs/animation.ts +71 -0
- package/template/src/collections/designSets/tabs/colors.ts +31 -0
- package/template/src/collections/designSets/tabs/fonts.ts +53 -0
- package/template/src/collections/designSets/tabs/miscellaneous.ts +22 -0
- package/template/src/collections/designSets/tabs/prose.ts +151 -0
- package/template/src/collections/designSets/tabs/settings.ts +52 -0
- package/template/src/collections/designSets/tabs/sizes.ts +30 -0
- package/template/src/collections/designSets/tabs/storage.ts +51 -0
- package/template/src/collections/designSets/tabs/variables.ts +28 -0
- package/template/src/collections/favicons.ts +11 -0
- package/template/src/collections/fonts/collection.ts +20 -0
- package/template/src/collections/fonts/script.ts +199 -0
- package/template/src/collections/footers/collection.ts +48 -0
- package/template/src/collections/footers/component.tsx +13 -0
- package/template/src/collections/headers/collection.ts +47 -0
- package/template/src/collections/headers/component.tsx +13 -0
- package/template/src/collections/iconSets/collection.ts +80 -0
- package/template/src/collections/iconSets/defaults.ts +81 -0
- package/template/src/collections/icons.ts +20 -0
- package/template/src/collections/images.ts +29 -0
- package/template/src/collections/index.ts +17 -0
- package/template/src/collections/muxVideos.ts +13 -0
- package/template/src/collections/pages/collection.ts +88 -0
- package/template/src/collections/pages/tabs/SEO.ts +70 -0
- package/template/src/collections/pages/tabs/settings.ts +17 -0
- package/template/src/collections/posthogProperty.ts +48 -0
- package/template/src/collections/shortcutSets/collection.ts +30 -0
- package/template/src/collections/shortcutSets/defaults.ts +1 -0
- package/template/src/collections/shortcutSets/protectedNames.ts +135 -0
- package/template/src/collections/shortcutSets/tabs/settings.ts +13 -0
- package/template/src/collections/shortcutSets/tabs/shortcuts.ts +70 -0
- package/template/src/collections/users.ts +11 -0
- package/template/src/collections/zap.ts +59 -0
- package/template/src/components/child/SSRProps.ts +381 -0
- package/template/src/components/child/renderChildren.tsx +148 -0
- package/template/src/components/livePreviewListener.tsx +10 -0
- package/template/src/components/providers/formProvider.tsx +11 -0
- package/template/src/components/providers/tracking/gtm.tsx +11 -0
- package/template/src/components/providers/tracking/index.tsx +46 -0
- package/template/src/components/providers/tracking/postHog.tsx +41 -0
- package/template/src/components/providers/tracking/vercel.tsx +10 -0
- package/template/src/components/toast/index.module.css +142 -0
- package/template/src/components/toast/index.tsx +55 -0
- package/template/src/endpoints/seed/backendForm.ts +48 -0
- package/template/src/endpoints/seed/designSet.ts +476 -0
- package/template/src/endpoints/seed/footer.ts +389 -0
- package/template/src/endpoints/seed/header.ts +3511 -0
- package/template/src/endpoints/seed/iconSet.ts +19 -0
- package/template/src/endpoints/seed/icons/assets/check.svg +4 -0
- package/template/src/endpoints/seed/icons/assets/close.svg +4 -0
- package/template/src/endpoints/seed/icons/assets/cookie.svg +7 -0
- package/template/src/endpoints/seed/icons/assets/github.svg +1 -0
- package/template/src/endpoints/seed/icons/assets/logo.svg +11 -0
- package/template/src/endpoints/seed/icons/assets/menu.svg +4 -0
- package/template/src/endpoints/seed/icons/assets/theme.svg +4 -0
- package/template/src/endpoints/seed/icons/check.ts +14 -0
- package/template/src/endpoints/seed/icons/close.ts +14 -0
- package/template/src/endpoints/seed/icons/cookie.ts +14 -0
- package/template/src/endpoints/seed/icons/github.ts +14 -0
- package/template/src/endpoints/seed/icons/index.ts +7 -0
- package/template/src/endpoints/seed/icons/logo.ts +14 -0
- package/template/src/endpoints/seed/icons/menu.ts +14 -0
- package/template/src/endpoints/seed/icons/theme.ts +14 -0
- package/template/src/endpoints/seed/index.ts +100 -0
- package/template/src/endpoints/seed/pages/home.ts +858 -0
- package/template/src/endpoints/seed/pages/index.ts +4 -0
- package/template/src/endpoints/seed/pages/notFoundPage.ts +287 -0
- package/template/src/endpoints/seed/pages/prose.ts +1436 -0
- package/template/src/endpoints/seed/pages/testing.ts +2181 -0
- package/template/src/endpoints/seed/shortcutSet.ts +187 -0
- package/template/src/endpoints/seed/siteMetaData.ts +10 -0
- package/template/src/fields/actions/changeKey.ts +12 -0
- package/template/src/fields/actions/index.ts +6 -0
- package/template/src/fields/actions/initialValueCheckbox.ts +14 -0
- package/template/src/fields/actions/keyText.ts +10 -0
- package/template/src/fields/actions/persisted.ts +14 -0
- package/template/src/fields/actions/setData.ts +20 -0
- package/template/src/fields/actions/strict/index.ts +3 -0
- package/template/src/fields/actions/strict/keySelect.ts +28 -0
- package/template/src/fields/actions/strict/listenSelect.ts +28 -0
- package/template/src/fields/actions/strict/performSelect.ts +30 -0
- package/template/src/fields/actions/strict/registry/cookieConsent.ts +14 -0
- package/template/src/fields/actions/strict/registry/index.ts +6 -0
- package/template/src/fields/actions/strict/registry/theme.ts +9 -0
- package/template/src/fields/active.ts +16 -0
- package/template/src/fields/apf/index.ts +69 -0
- package/template/src/fields/apf/storage.ts +38 -0
- package/template/src/fields/blocks/actions.ts +30 -0
- package/template/src/fields/blocks/backdropChildren.ts +11 -0
- package/template/src/fields/blocks/children.ts +15 -0
- package/template/src/fields/blocks/submitForm/form.ts +24 -0
- package/template/src/fields/blocks/submitForm/input.ts +25 -0
- package/template/src/fields/className.ts +26 -0
- package/template/src/fields/coloredEnd.ts +5 -0
- package/template/src/fields/defaultOpen.ts +14 -0
- package/template/src/fields/designSets/value.ts +80 -0
- package/template/src/fields/devMode.ts +11 -0
- package/template/src/fields/favicon.ts +18 -0
- package/template/src/fields/for.ts +11 -0
- package/template/src/fields/keepMounted.ts +11 -0
- package/template/src/fields/modal.ts +16 -0
- package/template/src/fields/slug.ts +35 -0
- package/template/src/fields/staticDataAttributes.ts +29 -0
- package/template/src/fields/tabs/block/children/actions.ts +49 -0
- package/template/src/fields/tabs/block/children/backdrop.ts +17 -0
- package/template/src/fields/tabs/block/children/settings.ts +45 -0
- package/template/src/fields/tabs/block/children/submitForm/form.ts +23 -0
- package/template/src/fields/tabs/block/children/submitForm/input.ts +14 -0
- package/template/src/fields/tabs/block/children/tracking.ts +25 -0
- package/template/src/fields/tabs/collection/storage.ts +55 -0
- package/template/src/fields/tagType.ts +32 -0
- package/template/src/fields/testPath.ts +3 -0
- package/template/src/fields/uniqueTitle.ts +8 -0
- package/template/src/fields/validationMessage.ts +13 -0
- package/template/src/globals/index.ts +8 -0
- package/template/src/globals/settings.ts +36 -0
- package/template/src/globals/siteMetaData.ts +29 -0
- package/template/src/globals/storage.ts +15 -0
- package/template/src/globals/tracking/global.ts +25 -0
- package/template/src/globals/tracking/tabs/gtm.ts +18 -0
- package/template/src/globals/tracking/tabs/postHog.ts +35 -0
- package/template/src/hooks/collection/atomicHook/atomicHook.ts +223 -0
- package/template/src/hooks/collection/atomicHook/processors/cssProcessor.ts +60 -0
- package/template/src/hooks/collection/atomicHook/processors/processDesignSet/generatePreflights.ts +36 -0
- package/template/src/hooks/collection/atomicHook/processors/processDesignSet/index.ts +176 -0
- package/template/src/hooks/collection/atomicHook/processors/unsetActive.ts +24 -0
- package/template/src/hooks/collection/formatSVG.ts +157 -0
- package/template/src/hooks/collection/revalidate.ts +53 -0
- package/template/src/hooks/collection/sanitizeCollection.ts +5 -0
- package/template/src/hooks/field/apf.ts +59 -0
- package/template/src/hooks/field/formatSlug.ts +23 -0
- package/template/src/hooks/field/href.ts +6 -0
- package/template/src/hooks/field/publishedAt.ts +5 -0
- package/template/src/hooks/frontEnd/atomicStore/create.ts +69 -0
- package/template/src/hooks/frontEnd/atomicStore/index.tsx +20 -0
- package/template/src/hooks/frontEnd/atomicStore/slices/base.ts +7 -0
- package/template/src/hooks/frontEnd/atomicStore/slices/consent.ts +76 -0
- package/template/src/hooks/frontEnd/atomicStore/slices/dynamic.ts +51 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/boolToDA/function.ts +14 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/boolToDA/zap.ts +12 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/cCToDA/function.ts +34 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/cCToDA/zap.ts +17 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/errorToDA/function.ts +22 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/errorToDA/zap.ts +10 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/function.ts +20 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/statusToDA/function.ts +24 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/statusToDA/zap.ts +10 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/textToDA/function.ts +21 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/textToDA/zap.ts +12 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/attributer/zap.ts +15 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/index.ts +2 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/cycleText/function.ts +30 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/cycleText/zap.ts +12 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/function.ts +21 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/resetForm/function.ts +7 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/resetForm/zap.ts +9 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/setBool/function.ts +10 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/setBool/zap.ts +11 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/setCCs/function.ts +33 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/setCCs/zap.ts +14 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/setThemes/function.ts +11 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/setThemes/zap.ts +10 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/submitForm/function.ts +32 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/submitForm/zap.ts +9 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/runner/zap.ts +16 -0
- package/template/src/hooks/frontEnd/useActions/dispatch/zap.ts +2 -0
- package/template/src/hooks/frontEnd/useActions/index.ts +6 -0
- package/template/src/hooks/frontEnd/useActions/useActionContext.ts +21 -0
- package/template/src/hooks/frontEnd/useActions/useButtonActions.ts +17 -0
- package/template/src/hooks/frontEnd/useActions/useDaToText.ts +34 -0
- package/template/src/hooks/frontEnd/useActions/useForm.ts +114 -0
- package/template/src/hooks/frontEnd/useActions/usePortal.ts +33 -0
- package/template/src/hooks/frontEnd/useActions/useToDa.ts +12 -0
- package/template/src/hooks/global/revalidate.ts +26 -0
- package/template/src/payload.config.ts +78 -0
- package/template/src/plugins/blurDataUrls.ts +8 -0
- package/template/src/plugins/formBuilder.ts +40 -0
- package/template/src/plugins/index.ts +17 -0
- package/template/src/plugins/muxVideo.ts +13 -0
- package/template/src/plugins/nestedDocs.ts +9 -0
- package/template/src/plugins/vercelBlobStorage.ts +8 -0
- package/template/src/ts/JSONSchema.ts +93 -0
- package/template/src/ts/declarations.ts +24 -0
- package/template/src/ts/types/actions.ts +175 -0
- package/template/src/ts/types/apf.ts +108 -0
- package/template/src/ts/types/cache.ts +166 -0
- package/template/src/ts/types/css.ts +14 -0
- package/template/src/ts/types/forms.ts +214 -0
- package/template/src/ts/types/frontEnd.ts +115 -0
- package/template/src/ts/types/index.ts +49 -0
- package/template/src/ts/types/payload-types.ts +3684 -0
- package/template/src/ts/zap/ap.ts +82 -0
- package/template/src/ts/zap/index.ts +4 -0
- package/template/src/ui/apf/controls.tsx +88 -0
- package/template/src/ui/apf/field.tsx +81 -0
- package/template/src/ui/apf/index.scss +59 -0
- package/template/src/ui/apf/label.tsx +23 -0
- package/template/src/ui/assets/Icon.tsx +21 -0
- package/template/src/ui/assets/Logo.tsx +21 -0
- package/template/src/ui/assets/atomicIcon.tsx +27 -0
- package/template/src/ui/assets/warningIcon.ts +6 -0
- package/template/src/ui/blocks/actionBlock.tsx +44 -0
- package/template/src/ui/blocks/inputBlock.tsx +24 -0
- package/template/src/ui/decorative/coloredEnd.tsx +16 -0
- package/template/src/ui/decorative/index.scss +46 -0
- package/template/src/ui/fields/iconSelect/index.tsx +19 -0
- package/template/src/ui/fields/slug/index.scss +12 -0
- package/template/src/ui/fields/slug/index.tsx +72 -0
- package/template/src/ui/index.ts +32 -0
- package/template/src/ui/root/beforeDashboard/index.scss +22 -0
- package/template/src/ui/root/beforeDashboard/index.tsx +39 -0
- package/template/src/ui/root/beforeDashboard/seedButton/index.scss +12 -0
- package/template/src/ui/root/beforeDashboard/seedButton/index.tsx +84 -0
- package/template/src/ui/root/siteTriggers/index.scss +22 -0
- package/template/src/ui/root/siteTriggers/index.tsx +94 -0
- package/template/src/ui/root/siteTriggers/triggerVercelDeploy.ts +37 -0
- package/template/src/ui/rowLabels/animation.tsx +27 -0
- package/template/src/ui/rowLabels/atomic/index.scss +62 -0
- package/template/src/ui/rowLabels/atomic/index.tsx +96 -0
- package/template/src/ui/rowLabels/color.tsx +33 -0
- package/template/src/ui/rowLabels/designToken.tsx +30 -0
- package/template/src/ui/rowLabels/icon.tsx +32 -0
- package/template/src/ui/rowLabels/shortcut/index.scss +21 -0
- package/template/src/ui/rowLabels/shortcut/index.tsx +30 -0
- package/template/src/ui/rowLabels/simpleText.tsx +41 -0
- package/template/src/utilities/deepMerge.ts +30 -0
- package/template/src/utilities/extractSVG.ts +9 -0
- package/template/src/utilities/format/toKebabCase.ts +79 -0
- package/template/src/utilities/format/toTitleCase.ts +47 -0
- package/template/src/utilities/formatDurationWithTokens.ts +56 -0
- package/template/src/utilities/generateMetaData.ts +45 -0
- package/template/src/utilities/generatePreviewPath.ts +43 -0
- package/template/src/utilities/get/cache/getAtomicActions.ts +48 -0
- package/template/src/utilities/get/cache/getAtomicClasses.ts +20 -0
- package/template/src/utilities/get/cache/getDesignSet.ts +15 -0
- package/template/src/utilities/get/cache/getFooter.ts +17 -0
- package/template/src/utilities/get/cache/getFormSubmissions.ts +17 -0
- package/template/src/utilities/get/cache/getForms.ts +43 -0
- package/template/src/utilities/get/cache/getHeader.ts +17 -0
- package/template/src/utilities/get/cache/getIcon.ts +51 -0
- package/template/src/utilities/get/cache/getImage.ts +20 -0
- package/template/src/utilities/get/cache/getPage.ts +35 -0
- package/template/src/utilities/get/cache/getPages.ts +24 -0
- package/template/src/utilities/get/cache/getShortcutSet.ts +17 -0
- package/template/src/utilities/get/cache/getSiteCSS.ts +17 -0
- package/template/src/utilities/get/cache/getSiteMetadata.ts +14 -0
- package/template/src/utilities/get/cache/getSitemap.ts +50 -0
- package/template/src/utilities/get/cache/getTracking.ts +14 -0
- package/template/src/utilities/get/cache/index.ts +129 -0
- package/template/src/utilities/get/cache/react.ts +5 -0
- package/template/src/utilities/get/getImageURL.ts +20 -0
- package/template/src/utilities/get/getMeUser.ts +22 -0
- package/template/src/utilities/get/getURL.ts +20 -0
- package/template/src/utilities/log/cache.ts +8 -0
- package/template/src/utilities/log/manual.ts +11 -0
- package/template/src/utilities/log/revalidation.ts +6 -0
- package/template/src/utilities/mergeTags.ts +7 -0
- package/template/src/utilities/propertyApplicatorUtility.ts +20 -0
- package/template/src/utilities/revalidateTag.ts +55 -0
- package/template/src/utilities/runAPF.ts +10 -0
- package/template/src/utilities/sanitizeData.ts +24 -0
- package/template/src/utilities/seedNestedRelationship.ts +5 -0
- package/template/tailwind.config.js +9 -0
- package/template/tsconfig.json +49 -0
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import 'server-only' //DO NOT REMOVE
|
|
2
|
+
import { createBlurUp } from '@mux/blurup'
|
|
3
|
+
import { PassThroughs, ChildBlocks, StaticDataAttributes } from '@/ts/types'
|
|
4
|
+
import postHogPropertyApplicator from '@/utilities/propertyApplicatorUtility'
|
|
5
|
+
|
|
6
|
+
type PassThrough = { p: Record<string, unknown>; da: Record<string, string> }
|
|
7
|
+
|
|
8
|
+
function formatStaticDataAttributes(staticDataAttributes: StaticDataAttributes): Record<string, string> | undefined {
|
|
9
|
+
if (!staticDataAttributes) return undefined
|
|
10
|
+
return staticDataAttributes
|
|
11
|
+
.filter((item) => item?.key && typeof item.key === 'string' && item.key.trim() !== '')
|
|
12
|
+
.reduce(
|
|
13
|
+
(acc, item) => {
|
|
14
|
+
acc[`data-${item.key}`] = item.value === 'true' ? '' : item.value
|
|
15
|
+
return acc
|
|
16
|
+
},
|
|
17
|
+
{} as Record<string, string>,
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const breakpoints = {
|
|
22
|
+
'3xl': 1920,
|
|
23
|
+
'2xl': 1536,
|
|
24
|
+
xl: 1280,
|
|
25
|
+
lg: 1024,
|
|
26
|
+
md: 768,
|
|
27
|
+
sm: 640,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Securely generates all props that should be generated server side. */
|
|
31
|
+
export async function SSRProps<T extends ChildBlocks[number]>(block: T): Promise<PassThroughs> {
|
|
32
|
+
const { blockType, cid, contentPostHogProperty, ClassName } = block
|
|
33
|
+
|
|
34
|
+
/** Content Pass Throughs */
|
|
35
|
+
const c: PassThrough & { children?: React.ReactNode } = { p: {}, da: {} }
|
|
36
|
+
/** Trigger Pass Throughs */
|
|
37
|
+
const t: PassThrough = { p: {}, da: {} }
|
|
38
|
+
/** Backdrop Pass Throughs */
|
|
39
|
+
const b: Omit<PassThrough, 'da'> = { p: {} }
|
|
40
|
+
/** Dialog Pass Throughs */
|
|
41
|
+
const di: Omit<PassThrough, 'children' | 'da'> = { p: {} }
|
|
42
|
+
/** Popover Pass Throughs */
|
|
43
|
+
const pop: Omit<PassThrough, 'children' | 'da'> = { p: {} }
|
|
44
|
+
|
|
45
|
+
// Universal Static Props
|
|
46
|
+
if (cid) c.p.id = cid
|
|
47
|
+
if (ClassName) c.p.className = ClassName
|
|
48
|
+
if (contentPostHogProperty) c.p = { ...c.p, ...postHogPropertyApplicator(contentPostHogProperty) }
|
|
49
|
+
|
|
50
|
+
if ('staticDataAttributes' in block && block.staticDataAttributes && Object.keys(block.staticDataAttributes).length > 0) {
|
|
51
|
+
const dataAttributes = formatStaticDataAttributes(block.staticDataAttributes)
|
|
52
|
+
if (dataAttributes) c.da = { ...c.da, ...dataAttributes }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Static Props Based On Block Type
|
|
56
|
+
switch (blockType) {
|
|
57
|
+
case 'AtomicChild': {
|
|
58
|
+
const { type } = block
|
|
59
|
+
|
|
60
|
+
switch (type) {
|
|
61
|
+
case 'tag':
|
|
62
|
+
const { htmlFor } = block
|
|
63
|
+
if (htmlFor) c.p.htmlFor = htmlFor
|
|
64
|
+
break
|
|
65
|
+
case 'button': {
|
|
66
|
+
const { buttonType, triggerClassName, triggerPostHogProperty } = block
|
|
67
|
+
|
|
68
|
+
if (block?.triggerStaticDataAttributes && Object.keys(block.triggerStaticDataAttributes).length > 0) {
|
|
69
|
+
const dataAttributes = formatStaticDataAttributes(block.triggerStaticDataAttributes)
|
|
70
|
+
if (dataAttributes) t.da = { ...t.da, ...dataAttributes }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (triggerClassName) t.p.className = triggerClassName
|
|
74
|
+
if (triggerPostHogProperty) t.p = { ...t.p, ...postHogPropertyApplicator(triggerPostHogProperty) }
|
|
75
|
+
if ('backdropClassName' in block && block.backdropClassName) b.p.className = block.backdropClassName
|
|
76
|
+
|
|
77
|
+
switch (buttonType) {
|
|
78
|
+
case 'link': {
|
|
79
|
+
const {
|
|
80
|
+
linkType,
|
|
81
|
+
internalLink,
|
|
82
|
+
externalLink,
|
|
83
|
+
download,
|
|
84
|
+
email,
|
|
85
|
+
phone,
|
|
86
|
+
anchor,
|
|
87
|
+
parameters,
|
|
88
|
+
newTab,
|
|
89
|
+
noOpener,
|
|
90
|
+
noReferrer,
|
|
91
|
+
ariaLabel,
|
|
92
|
+
prefetch,
|
|
93
|
+
} = block
|
|
94
|
+
|
|
95
|
+
let href = ''
|
|
96
|
+
switch (linkType) {
|
|
97
|
+
case 'internalLink': {
|
|
98
|
+
if (typeof internalLink === 'string') href = '/404'
|
|
99
|
+
else href = `${internalLink?.href}`
|
|
100
|
+
break
|
|
101
|
+
}
|
|
102
|
+
case 'externalLink': {
|
|
103
|
+
if (externalLink) {
|
|
104
|
+
if (!externalLink.match(/^(https?:\/\/|mailto:|tel:)/i)) href = `https://${externalLink}`
|
|
105
|
+
else href = `${externalLink}`
|
|
106
|
+
}
|
|
107
|
+
break
|
|
108
|
+
}
|
|
109
|
+
case 'download': {
|
|
110
|
+
if (typeof download !== 'string') href = `${download?.url}`
|
|
111
|
+
break
|
|
112
|
+
}
|
|
113
|
+
case 'email': {
|
|
114
|
+
href = `mailto:${email}`
|
|
115
|
+
break
|
|
116
|
+
}
|
|
117
|
+
case 'phone': {
|
|
118
|
+
href = `tel:${phone}`
|
|
119
|
+
break
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
t.p.href = href.concat(anchor ? `#${anchor}` : '').concat(parameters ? `?${parameters}` : '')
|
|
123
|
+
t.p.rel = newTab ? 'noopener noreferrer' : `${noOpener ? 'noopener' : ''} ${noReferrer ? 'noreferrer' : ''}`.trim()
|
|
124
|
+
t.p.prefetch = prefetch
|
|
125
|
+
t.p['aria-label'] = ariaLabel || undefined
|
|
126
|
+
t.p.target = noOpener || newTab ? '_blank' : undefined
|
|
127
|
+
t.p.download = linkType === 'download' ? true : undefined
|
|
128
|
+
|
|
129
|
+
break
|
|
130
|
+
}
|
|
131
|
+
case 'regular': {
|
|
132
|
+
break
|
|
133
|
+
}
|
|
134
|
+
case 'portal': {
|
|
135
|
+
switch (block.portalType) {
|
|
136
|
+
case 'popover': {
|
|
137
|
+
const {
|
|
138
|
+
delay,
|
|
139
|
+
hasArrow,
|
|
140
|
+
closeDelay,
|
|
141
|
+
openOnHover,
|
|
142
|
+
defaultOpen,
|
|
143
|
+
modal,
|
|
144
|
+
side,
|
|
145
|
+
align,
|
|
146
|
+
sticky,
|
|
147
|
+
sideOffset,
|
|
148
|
+
alignOffset,
|
|
149
|
+
trackAnchor,
|
|
150
|
+
arrowPadding,
|
|
151
|
+
positionMethod,
|
|
152
|
+
keepMounted,
|
|
153
|
+
} = block.pops || {}
|
|
154
|
+
const popPortal: Record<string, unknown> = {}
|
|
155
|
+
const popPositioner: Record<string, unknown> = {}
|
|
156
|
+
|
|
157
|
+
//Root Props
|
|
158
|
+
if (hasArrow) pop.p.hasArrow = hasArrow
|
|
159
|
+
if (defaultOpen) pop.p.defaultOpen = defaultOpen
|
|
160
|
+
|
|
161
|
+
switch (modal) {
|
|
162
|
+
case 'Block':
|
|
163
|
+
pop.p.modal = true
|
|
164
|
+
break
|
|
165
|
+
case 'Window':
|
|
166
|
+
pop.p.modal = false
|
|
167
|
+
break
|
|
168
|
+
case 'trap-focus':
|
|
169
|
+
pop.p.modal = 'trap-focus'
|
|
170
|
+
break
|
|
171
|
+
default:
|
|
172
|
+
pop.p.modal = false
|
|
173
|
+
break
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
//Trigger Props
|
|
177
|
+
if (delay) t.p.delay = delay
|
|
178
|
+
if (closeDelay) t.p.closeDelay = closeDelay
|
|
179
|
+
if (openOnHover) t.p.openOnHover = openOnHover
|
|
180
|
+
|
|
181
|
+
//Positioner Props
|
|
182
|
+
if (side) popPositioner.side = side
|
|
183
|
+
if (align) popPositioner.align = align
|
|
184
|
+
if (sticky) popPositioner.sticky = sticky
|
|
185
|
+
if (sideOffset) popPositioner.sideOffset = sideOffset
|
|
186
|
+
if (alignOffset) popPositioner.alignOffset = alignOffset
|
|
187
|
+
if (trackAnchor) popPositioner.trackAnchor = trackAnchor
|
|
188
|
+
if (arrowPadding) popPositioner.arrowPadding = arrowPadding
|
|
189
|
+
if (positionMethod) popPositioner.positionMethod = positionMethod
|
|
190
|
+
|
|
191
|
+
//Portal Props
|
|
192
|
+
if (keepMounted) popPortal.keepMounted = keepMounted
|
|
193
|
+
|
|
194
|
+
if (Object.keys(popPortal).length > 0) pop.p = { ...pop.p, popPortal }
|
|
195
|
+
if (Object.keys(popPositioner).length > 0) pop.p = { ...pop.p, popPositioner }
|
|
196
|
+
|
|
197
|
+
break
|
|
198
|
+
}
|
|
199
|
+
case 'dialog': {
|
|
200
|
+
const { defaultOpen, dismissible, modal, keepMounted } = block.ds || {}
|
|
201
|
+
|
|
202
|
+
/** Dialog Portal Components Props */
|
|
203
|
+
const dialogPortal: Record<string, unknown> = {}
|
|
204
|
+
|
|
205
|
+
//Root Props
|
|
206
|
+
if (defaultOpen) di.p.defaultOpen = defaultOpen
|
|
207
|
+
di.p.dismissible = Boolean(dismissible)
|
|
208
|
+
|
|
209
|
+
switch (modal) {
|
|
210
|
+
case 'Block':
|
|
211
|
+
di.p.modal = true
|
|
212
|
+
break
|
|
213
|
+
case 'Window':
|
|
214
|
+
di.p.modal = false
|
|
215
|
+
break
|
|
216
|
+
case 'trap-focus':
|
|
217
|
+
di.p.modal = 'trap-focus'
|
|
218
|
+
break
|
|
219
|
+
default:
|
|
220
|
+
di.p.modal = false
|
|
221
|
+
break
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
//Portal Props
|
|
225
|
+
if (keepMounted) dialogPortal.keepMounted = keepMounted
|
|
226
|
+
|
|
227
|
+
if (Object.keys(dialogPortal).length > 0) di.p = { ...di.p, dialogPortal }
|
|
228
|
+
break
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
break
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
break
|
|
235
|
+
}
|
|
236
|
+
case 'input': {
|
|
237
|
+
const { inputType, inputName, required, autocomplete } = block
|
|
238
|
+
|
|
239
|
+
if (inputType) c.p.type = inputType
|
|
240
|
+
if (inputName) c.p.name = inputName
|
|
241
|
+
if (required) c.p.required = required
|
|
242
|
+
if (autocomplete) c.p.autoComplete = autocomplete
|
|
243
|
+
|
|
244
|
+
switch (inputType) {
|
|
245
|
+
case 'checkbox': {
|
|
246
|
+
const { checkboxDefault } = block
|
|
247
|
+
if (checkboxDefault) c.p.defaultChecked = checkboxDefault
|
|
248
|
+
if (!cid) c.p.id = inputName
|
|
249
|
+
break
|
|
250
|
+
}
|
|
251
|
+
case 'number': {
|
|
252
|
+
const { numberPlaceholder, numberDefault } = block
|
|
253
|
+
if (numberDefault) c.p.defaultValue = numberDefault
|
|
254
|
+
if (numberPlaceholder) c.p.placeholder = numberPlaceholder
|
|
255
|
+
if (!cid) c.p.id = inputName
|
|
256
|
+
break
|
|
257
|
+
}
|
|
258
|
+
case 'radio': {
|
|
259
|
+
const { radioDefault, radioValue } = block
|
|
260
|
+
if (c.p.autoComplete) delete c.p.autoComplete
|
|
261
|
+
if (radioDefault) c.p.defaultChecked = radioDefault
|
|
262
|
+
if (radioValue) {
|
|
263
|
+
c.p.value = radioValue
|
|
264
|
+
if (!cid) c.p.id = radioValue
|
|
265
|
+
}
|
|
266
|
+
break
|
|
267
|
+
}
|
|
268
|
+
case 'text':
|
|
269
|
+
case 'email':
|
|
270
|
+
case 'textarea': {
|
|
271
|
+
const { textPlaceholder, textDefault } = block
|
|
272
|
+
if (!cid) c.p.id = inputName
|
|
273
|
+
if (textDefault) c.p.defaultValue = textDefault
|
|
274
|
+
if (textPlaceholder) c.p.placeholder = textPlaceholder
|
|
275
|
+
break
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
break
|
|
280
|
+
}
|
|
281
|
+
case 'form':
|
|
282
|
+
break
|
|
283
|
+
}
|
|
284
|
+
break
|
|
285
|
+
}
|
|
286
|
+
case 'SimpleTextChild': {
|
|
287
|
+
const { htmlFor } = block
|
|
288
|
+
if (htmlFor) c.p.htmlFor = htmlFor
|
|
289
|
+
break
|
|
290
|
+
}
|
|
291
|
+
case 'RichTextChild': {
|
|
292
|
+
break
|
|
293
|
+
}
|
|
294
|
+
case 'ImageChild': {
|
|
295
|
+
const { image, alt, priority, size, quality, loading, fill, decoding, unoptimized, version } = block
|
|
296
|
+
if (!image || typeof image === 'string') break
|
|
297
|
+
const { blurDataUrl, alt: altFromMedia, sizes } = image
|
|
298
|
+
|
|
299
|
+
const width = version ? sizes?.[version]?.width : image.width
|
|
300
|
+
const height = version ? sizes?.[version]?.height : image.height
|
|
301
|
+
|
|
302
|
+
c.p.alt = alt || altFromMedia || ''
|
|
303
|
+
c.p.src = version ? sizes?.[version]?.url || image.url : image.url
|
|
304
|
+
|
|
305
|
+
if (decoding) c.p.decoding = decoding
|
|
306
|
+
|
|
307
|
+
if (priority) c.p.priority = priority
|
|
308
|
+
else if (loading) c.p.loading = loading
|
|
309
|
+
|
|
310
|
+
if (!unoptimized) c.p.quality = quality
|
|
311
|
+
else c.p.unoptimized = unoptimized
|
|
312
|
+
|
|
313
|
+
c.p.sizes = size
|
|
314
|
+
? size
|
|
315
|
+
: Object.entries(breakpoints)
|
|
316
|
+
.map(([, value]) => `(max-width: ${value}px) ${value * 2}w`)
|
|
317
|
+
.join(', ')
|
|
318
|
+
|
|
319
|
+
if (block.blur) {
|
|
320
|
+
c.p.placeholder = 'blur'
|
|
321
|
+
c.p.blurDataURL = blurDataUrl
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (!fill) {
|
|
325
|
+
c.p.height = height
|
|
326
|
+
c.p.width = width
|
|
327
|
+
} else c.p.fill = fill
|
|
328
|
+
|
|
329
|
+
break
|
|
330
|
+
}
|
|
331
|
+
case 'VideoChild': {
|
|
332
|
+
const { preload, autoplay, loop, muted, video, disableBlur, time, quality, blur } = block
|
|
333
|
+
if (typeof video === 'string') break
|
|
334
|
+
const { playbackOptions } = video
|
|
335
|
+
if (!playbackOptions) break
|
|
336
|
+
const { playbackId } = playbackOptions[0]
|
|
337
|
+
|
|
338
|
+
if (!disableBlur && playbackId) {
|
|
339
|
+
try {
|
|
340
|
+
const { blurDataURL: blurDataURLTemp, aspectRatio } = await createBlurUp(playbackId, {
|
|
341
|
+
time: time ?? 0,
|
|
342
|
+
blur: blur ?? 20,
|
|
343
|
+
quality: quality ?? 1,
|
|
344
|
+
})
|
|
345
|
+
c.p.poster = blurDataURLTemp
|
|
346
|
+
c.p.style = { aspectRatio }
|
|
347
|
+
} catch (error) {
|
|
348
|
+
console.warn('Failed to generate video blurup image.')
|
|
349
|
+
console.log(error)
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
c.p.streamType = 'on-demand'
|
|
354
|
+
if (loop) c.p.loop = loop
|
|
355
|
+
if (preload) c.p.preload = preload
|
|
356
|
+
if (autoplay) {
|
|
357
|
+
c.p.muted = true
|
|
358
|
+
c.p.autoPlay = true
|
|
359
|
+
c.p.playsInline = true
|
|
360
|
+
}
|
|
361
|
+
if (muted) c.p.muted = muted
|
|
362
|
+
if (playbackId) c.p.playbackId = playbackId
|
|
363
|
+
|
|
364
|
+
break
|
|
365
|
+
}
|
|
366
|
+
case 'IconChild': {
|
|
367
|
+
if (block.ariaHidden) c.p['aria-hidden'] = block.ariaHidden
|
|
368
|
+
break
|
|
369
|
+
}
|
|
370
|
+
case 'SVGChild': {
|
|
371
|
+
const { viewBox, contents, fill } = block
|
|
372
|
+
c.p.viewBox = viewBox
|
|
373
|
+
if (fill) c.p.fill = fill
|
|
374
|
+
c.p.dangerouslySetInnerHTML = { __html: contents }
|
|
375
|
+
if (block.ariaHidden) c.p['aria-hidden'] = block.ariaHidden
|
|
376
|
+
break
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return { c, t, po: { b, di, pop } }
|
|
381
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
import 'server-only' //DO NOT REMOVE
|
|
3
|
+
|
|
4
|
+
import { BlockSlug } from 'payload'
|
|
5
|
+
import { SSRProps } from './SSRProps'
|
|
6
|
+
import { RenderChildrenProps, AtomicChild, ChildBySlug, ChildrenWithActions, ChildBlocks, PassThroughs, BlockBySlug } from '@/ts/types'
|
|
7
|
+
|
|
8
|
+
//Components
|
|
9
|
+
import { SVGChild } from '@/blocks/children/svg/component'
|
|
10
|
+
import { IconChild } from '@/blocks/children/icon/component'
|
|
11
|
+
import { ImageChild } from '@/blocks/children/image/component'
|
|
12
|
+
import { VideoChild } from '@/blocks/children/video/component'
|
|
13
|
+
import { RichTextChild } from '@/blocks/children/richText/component'
|
|
14
|
+
|
|
15
|
+
//Simple Text Child
|
|
16
|
+
import { SimpleTextChild } from '@/blocks/children/simpleText/component'
|
|
17
|
+
import { SimpleTextChildClient } from '@/blocks/children/simpleText/component.client'
|
|
18
|
+
|
|
19
|
+
// Atomic Components - Direct imports
|
|
20
|
+
import { AtomicTag } from '@/blocks/children/atomic/variants/tag/component'
|
|
21
|
+
import { AtomicTagClient } from '@/blocks/children/atomic/variants/tag/component.client'
|
|
22
|
+
import { AtomicForm } from '@/blocks/children/atomic/variants/form/component'
|
|
23
|
+
//Input Variants
|
|
24
|
+
import { TextInputClient } from '@/blocks/children/atomic/variants/input/variants/text/component.client'
|
|
25
|
+
import { TextInput } from '@/blocks/children/atomic/variants/input/variants/text/component'
|
|
26
|
+
import { RadioInputClient } from '@/blocks/children/atomic/variants/input/variants/radio/component.client'
|
|
27
|
+
import { RadioInput } from '@/blocks/children/atomic/variants/input/variants/radio/component'
|
|
28
|
+
import { NumberInputClient } from '@/blocks/children/atomic/variants/input/variants/number/component.client'
|
|
29
|
+
import { NumberInput } from '@/blocks/children/atomic/variants/input/variants/number/component'
|
|
30
|
+
import { CheckboxInputClient } from '@/blocks/children/atomic/variants/input/variants/checkBox/component.client'
|
|
31
|
+
import { CheckboxInput } from '@/blocks/children/atomic/variants/input/variants/checkBox/component'
|
|
32
|
+
//Button Variants
|
|
33
|
+
import { AtomicButtonLinkClient } from '@/blocks/children/atomic/variants/button/variants/link/component.client'
|
|
34
|
+
import { AtomicButtonLink } from '@/blocks/children/atomic/variants/button/variants/link/component'
|
|
35
|
+
|
|
36
|
+
import { AtomicButtonRegular } from '@/blocks/children/atomic/variants/button/variants/regular/component'
|
|
37
|
+
import { AtomicButtonRegularClient } from '@/blocks/children/atomic/variants/button/variants/regular/component.client'
|
|
38
|
+
import { AtomicButtonPortalDialog } from '@/blocks/children/atomic/variants/button/variants/portal/dialog/component'
|
|
39
|
+
import { AtomicButtonPortalPopover } from '@/blocks/children/atomic/variants/button/variants/portal/popover/component'
|
|
40
|
+
|
|
41
|
+
const components = {
|
|
42
|
+
SVGChild,
|
|
43
|
+
IconChild,
|
|
44
|
+
ImageChild,
|
|
45
|
+
VideoChild,
|
|
46
|
+
RichTextChild,
|
|
47
|
+
SimpleTextChild,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const clientComponents = {
|
|
51
|
+
SimpleTextChild: SimpleTextChildClient,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Helper function to get the correct atomic component since we dont use layered registries
|
|
55
|
+
const getAtomicComponent = (block: AtomicChild, client: boolean) => {
|
|
56
|
+
const { type, buttonType, inputType, portalType } = block
|
|
57
|
+
|
|
58
|
+
if (type === 'button') {
|
|
59
|
+
if (buttonType === 'link') return client ? AtomicButtonLinkClient : AtomicButtonLink
|
|
60
|
+
if (buttonType === 'regular') return client ? AtomicButtonRegularClient : AtomicButtonRegular
|
|
61
|
+
if (buttonType === 'portal') {
|
|
62
|
+
if (portalType === 'dialog') return AtomicButtonPortalDialog
|
|
63
|
+
if (portalType === 'popover') return AtomicButtonPortalPopover
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (type === 'input') {
|
|
68
|
+
switch (inputType) {
|
|
69
|
+
case 'radio':
|
|
70
|
+
return client ? RadioInputClient : RadioInput
|
|
71
|
+
case 'number':
|
|
72
|
+
return client ? NumberInputClient : NumberInput
|
|
73
|
+
case 'checkbox':
|
|
74
|
+
return client ? CheckboxInputClient : CheckboxInput
|
|
75
|
+
case 'text':
|
|
76
|
+
case 'email':
|
|
77
|
+
case 'textarea':
|
|
78
|
+
return client ? TextInputClient : TextInput
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (type === 'tag') return client ? AtomicTagClient : AtomicTag
|
|
83
|
+
if (type === 'form') return AtomicForm
|
|
84
|
+
|
|
85
|
+
return null
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function is<T extends BlockSlug>(item: BlockBySlug<BlockSlug>, slug: T): item is BlockBySlug<T>
|
|
89
|
+
function is<T extends BlockSlug>(item: BlockBySlug<BlockSlug>, slug: T): item is BlockBySlug<Extract<T, BlockSlug>> {
|
|
90
|
+
if ('blockType' in item && typeof item.blockType === 'string') return item.blockType === slug
|
|
91
|
+
return true
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const hasActions = (block: ChildBlocks[number], passThroughs: PassThroughs): block is ChildBySlug<ChildrenWithActions> => {
|
|
95
|
+
return Boolean(
|
|
96
|
+
('contentActions' in block && block?.contentActions?.actions && block?.contentActions?.actions.length > 0) ||
|
|
97
|
+
('triggerActions' in block && block?.triggerActions?.actions && block?.triggerActions?.actions.length > 0) ||
|
|
98
|
+
(is(block, 'SimpleTextChild') && Boolean(Object.keys(passThroughs.c?.da || {}).length > 0)),
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const hasChildren = <T extends ChildBlocks[number], V extends 'children' | 'trigger' | 'backdrop'>(
|
|
103
|
+
block: T,
|
|
104
|
+
v: V,
|
|
105
|
+
): block is T &
|
|
106
|
+
(V extends 'children' ? { children: ChildBlocks } : V extends 'trigger' ? { triggerChildren: ChildBlocks } : { backdropChildren: ChildBlocks }) => {
|
|
107
|
+
if (v === 'children') return Boolean('children' in block && block.children && block.children?.length > 0)
|
|
108
|
+
if (v === 'trigger') return Boolean('triggerChildren' in block && block.triggerChildren && block.triggerChildren?.length > 0)
|
|
109
|
+
if (v === 'backdrop') return Boolean('backdropChildren' in block && block.backdropChildren && block.backdropChildren?.length > 0)
|
|
110
|
+
return false
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Render Children - Renders all payload child blocks. */
|
|
114
|
+
export const RenderChildren: RenderChildrenProps = async ({ blocks }) => {
|
|
115
|
+
if (blocks && Array.isArray(blocks) && blocks.length > 0) {
|
|
116
|
+
const renderedBlocks = await Promise.all(
|
|
117
|
+
blocks.map(async (block, index) => {
|
|
118
|
+
if ('blockType' in block) {
|
|
119
|
+
let Component: React.FC<any> | null = null
|
|
120
|
+
const passThroughs = await SSRProps(block)
|
|
121
|
+
const useAction = hasActions(block, passThroughs)
|
|
122
|
+
|
|
123
|
+
if (is(block, 'AtomicChild')) Component = getAtomicComponent(block, useAction)
|
|
124
|
+
else Component = useAction ? clientComponents[block.blockType] : components[block.blockType]
|
|
125
|
+
if (!Component) return null
|
|
126
|
+
|
|
127
|
+
// Pre-render children conditionally to avoid creating elements unnecessarily
|
|
128
|
+
const contentChildren = hasChildren(block, 'children') ? <RenderChildren blocks={block.children} /> : undefined
|
|
129
|
+
const triggerChildren = hasChildren(block, 'trigger') ? <RenderChildren blocks={block.triggerChildren} /> : undefined
|
|
130
|
+
const backdropChildren = hasChildren(block, 'backdrop') ? <RenderChildren blocks={block.backdropChildren} /> : undefined
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<Component
|
|
134
|
+
key={index}
|
|
135
|
+
block={block}
|
|
136
|
+
pt={passThroughs}
|
|
137
|
+
contentChildren={contentChildren}
|
|
138
|
+
triggerChildren={triggerChildren}
|
|
139
|
+
backdropChildren={backdropChildren}
|
|
140
|
+
/>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
}),
|
|
144
|
+
)
|
|
145
|
+
return <>{renderedBlocks}</>
|
|
146
|
+
}
|
|
147
|
+
return null
|
|
148
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { useRouter } from 'next/navigation'
|
|
4
|
+
import { getClientSideURL } from '@/utilities/get/getURL'
|
|
5
|
+
import { RefreshRouteOnSave as PayloadLivePreview } from '@payloadcms/live-preview-react'
|
|
6
|
+
|
|
7
|
+
export default function LivePreviewListener() {
|
|
8
|
+
const router = useRouter()
|
|
9
|
+
return <PayloadLivePreview refresh={router.refresh} serverURL={getClientSideURL()} />
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import type { FullFormContext } from '@/ts/types'
|
|
3
|
+
import React, { createContext, useContext } from 'react'
|
|
4
|
+
|
|
5
|
+
const FormContext = createContext<FullFormContext>({ formResponse: null })
|
|
6
|
+
|
|
7
|
+
export const useFormContext = () => useContext(FormContext)
|
|
8
|
+
|
|
9
|
+
export const FormContextProvider = ({ children, formResponse }: { children: React.ReactNode } & FullFormContext) => {
|
|
10
|
+
return <FormContext.Provider value={{ formResponse }}>{children}</FormContext.Provider>
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tracking } from '@/ts/types'
|
|
2
|
+
import { GoogleTagManager } from '@next/third-parties/google'
|
|
3
|
+
|
|
4
|
+
export function GoogleTagManagerProvider({ children, tracking }: { children: React.ReactNode; tracking?: Tracking }) {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
{tracking?.googleTagManagerId && <GoogleTagManager gtmId={tracking.googleTagManagerId} />}
|
|
8
|
+
{children}
|
|
9
|
+
</>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { ReactNode } from 'react'
|
|
3
|
+
import { Tracking } from '@/ts/types'
|
|
4
|
+
import { VercelProvider } from './vercel'
|
|
5
|
+
import { PostHogProvider } from './postHog'
|
|
6
|
+
import { GoogleTagManagerProvider } from './gtm'
|
|
7
|
+
|
|
8
|
+
type ProviderType = 'postHog' | 'vercel' | 'googleTagManager'
|
|
9
|
+
|
|
10
|
+
type ProviderConfig = {
|
|
11
|
+
type: ProviderType
|
|
12
|
+
component: React.ComponentType<{ children: ReactNode; tracking?: Tracking }>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const providerRegistry: Record<ProviderType, ProviderConfig> = {
|
|
16
|
+
vercel: { type: 'vercel', component: ({ children }) => <VercelProvider>{children}</VercelProvider> },
|
|
17
|
+
postHog: { type: 'postHog', component: ({ children, tracking }) => <PostHogProvider tracking={tracking}>{children}</PostHogProvider> },
|
|
18
|
+
googleTagManager: {
|
|
19
|
+
type: 'googleTagManager',
|
|
20
|
+
component: ({ children, tracking }) => <GoogleTagManagerProvider tracking={tracking}>{children}</GoogleTagManagerProvider>,
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface DynamicProviderProps {
|
|
25
|
+
tracking?: Tracking
|
|
26
|
+
children: ReactNode
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const TrackingProvider = ({ tracking, children }: DynamicProviderProps) => {
|
|
30
|
+
if (!tracking) return <>{children}</>
|
|
31
|
+
|
|
32
|
+
const activeProviders = {
|
|
33
|
+
postHog: tracking.postHogEnabled,
|
|
34
|
+
vercel: tracking.vercelAnalyticsEnabled,
|
|
35
|
+
googleTagManager: tracking.googleTagManagerEnabled,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const validProviders = Object.entries(activeProviders)
|
|
39
|
+
.filter(([_, isActive]) => isActive)
|
|
40
|
+
.map(([type]) => ({ type: type as ProviderType, tracking }))
|
|
41
|
+
|
|
42
|
+
return validProviders.reduceRight((acc, { type, tracking }) => {
|
|
43
|
+
const Provider = providerRegistry[type].component
|
|
44
|
+
return <Provider tracking={tracking}>{acc}</Provider>
|
|
45
|
+
}, children)
|
|
46
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import posthog from 'posthog-js'
|
|
3
|
+
import { useEffect } from 'react'
|
|
4
|
+
import { Tracking } from '@/ts/types'
|
|
5
|
+
import { usePathname } from 'next/navigation'
|
|
6
|
+
import { PostHogProvider as PHProvider } from 'posthog-js/react'
|
|
7
|
+
|
|
8
|
+
export function PostHogProvider({ children, tracking }: { children: React.ReactNode; tracking?: Tracking }) {
|
|
9
|
+
const pathname = usePathname()
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!tracking) return
|
|
12
|
+
const {
|
|
13
|
+
postHogPublicKey,
|
|
14
|
+
postHogHost,
|
|
15
|
+
disableSessionRecording,
|
|
16
|
+
disableSurveys,
|
|
17
|
+
capturePerformance,
|
|
18
|
+
enableAutoCapture,
|
|
19
|
+
postHogAutoCaptureSettings,
|
|
20
|
+
} = tracking
|
|
21
|
+
if (!postHogPublicKey || !postHogHost) return
|
|
22
|
+
|
|
23
|
+
if (!pathname?.includes('/admin')) {
|
|
24
|
+
posthog.init(postHogPublicKey, {
|
|
25
|
+
api_host: postHogHost,
|
|
26
|
+
defaults: '2025-05-24',
|
|
27
|
+
...(enableAutoCapture && {
|
|
28
|
+
autocapture: {
|
|
29
|
+
url_allowlist: postHogAutoCaptureSettings?.urlAllowList?.map((item) => item.url ?? ''),
|
|
30
|
+
url_ignorelist: postHogAutoCaptureSettings?.urlIgnoreList?.map((item) => item.url ?? ''),
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
...(disableSessionRecording && { disable_session_recording: disableSessionRecording }),
|
|
34
|
+
...(disableSurveys && { disable_surveys: disableSurveys }),
|
|
35
|
+
...(capturePerformance && { capture_performance: capturePerformance }),
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
}, [pathname, tracking])
|
|
39
|
+
|
|
40
|
+
return <PHProvider client={posthog}>{children}</PHProvider>
|
|
41
|
+
}
|