@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,24 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
import 'server-only' //DO NOT REMOVE
|
|
3
|
+
import { GCFunction } from '@/ts/types'
|
|
4
|
+
import { getPayload, Where } from 'payload'
|
|
5
|
+
import configPromise from '@payload-config'
|
|
6
|
+
import cacheLogger from '@/utilities/log/cache'
|
|
7
|
+
|
|
8
|
+
/** Gets all pages set in the pages collection and returns them as an array of strings. */
|
|
9
|
+
export const getCachedPages: GCFunction<'pages'> = async (tag, draft) => {
|
|
10
|
+
const payload = await getPayload({ config: configPromise })
|
|
11
|
+
const where: Where = { href: { exists: true } }
|
|
12
|
+
if (!draft) Object.assign(where, { live: { equals: true } })
|
|
13
|
+
const result = await payload.find({
|
|
14
|
+
collection: 'pages',
|
|
15
|
+
draft,
|
|
16
|
+
where,
|
|
17
|
+
limit: 0,
|
|
18
|
+
overrideAccess: draft,
|
|
19
|
+
select: { href: true },
|
|
20
|
+
})
|
|
21
|
+
const returns = result.docs?.map(({ href }) => href).filter((href) => href != null) || []
|
|
22
|
+
cacheLogger({ tag, draft })
|
|
23
|
+
return returns
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
import 'server-only' //DO NOT REMOVE
|
|
3
|
+
import { getPayload } from 'payload'
|
|
4
|
+
import { GCFunction } from '@/ts/types'
|
|
5
|
+
import configPromise from '@payload-config'
|
|
6
|
+
import cacheLogger from '@/utilities/log/cache'
|
|
7
|
+
|
|
8
|
+
/** Gets the active shortcut set. */
|
|
9
|
+
export const getCachedShortcutSet: GCFunction<'shortcutSet'> = async (tag, draft) => {
|
|
10
|
+
const payload = await getPayload({ config: configPromise })
|
|
11
|
+
const shortcutSet = await payload
|
|
12
|
+
.find({ draft, collection: 'shortcutSet', pagination: false, limit: 1, where: { active: { equals: true } } })
|
|
13
|
+
.then((result) => result.docs[0] || null)
|
|
14
|
+
|
|
15
|
+
cacheLogger({ tag, draft })
|
|
16
|
+
return shortcutSet
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
import 'server-only' //DO NOT REMOVE
|
|
3
|
+
import { getPayload } from 'payload'
|
|
4
|
+
import { GCFunction } from '@/ts/types'
|
|
5
|
+
import configPromise from '@payload-config'
|
|
6
|
+
import cacheLogger from '@/utilities/log/cache'
|
|
7
|
+
|
|
8
|
+
// Gets the site css stored in payload, under the global 'draftStorage' or 'publishedStorage'.
|
|
9
|
+
export const getCachedSiteCSS: GCFunction<'site-css'> = async (tag, draft) => {
|
|
10
|
+
const payload = await getPayload({ config: configPromise })
|
|
11
|
+
const results = await payload
|
|
12
|
+
.findGlobal({ draft, slug: `${draft ? 'draft' : 'published'}Storage`, select: { layoutCSS: true } })
|
|
13
|
+
.then((res) => res.layoutCSS)
|
|
14
|
+
|
|
15
|
+
cacheLogger({ tag, draft })
|
|
16
|
+
return results || ''
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
import 'server-only' //DO NOT REMOVE
|
|
3
|
+
import { getPayload } from 'payload'
|
|
4
|
+
import configPromise from '@payload-config'
|
|
5
|
+
import type { GCFunction } from '@/ts/types'
|
|
6
|
+
import cacheLogger from '@/utilities/log/cache'
|
|
7
|
+
|
|
8
|
+
/** Gets all site metadata from the siteMetaData global.*/
|
|
9
|
+
export const getCachedSiteMetadata: GCFunction<'site-metadata'> = async (tag, draft) => {
|
|
10
|
+
const payload = await getPayload({ config: configPromise })
|
|
11
|
+
const results = await payload.findGlobal({ slug: 'siteMetaData', draft })
|
|
12
|
+
cacheLogger({ tag, draft })
|
|
13
|
+
return results
|
|
14
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
import 'server-only' //DO NOT REMOVE
|
|
3
|
+
import { GCFunction } from '@/ts/types'
|
|
4
|
+
import { getPayload, Where } from 'payload'
|
|
5
|
+
import configPromise from '@payload-config'
|
|
6
|
+
import cacheLogger from '@/utilities/log/cache'
|
|
7
|
+
import { getServerSideURL } from '@/utilities/get/getURL'
|
|
8
|
+
|
|
9
|
+
/** Gets the pages stored in payload and formats them into a sitemap array. */
|
|
10
|
+
export const getCachedSitemap: GCFunction<'sitemap'> = async (tag, draft) => {
|
|
11
|
+
const payload = await getPayload({ config: configPromise })
|
|
12
|
+
const where: Where = { href: { exists: true } }
|
|
13
|
+
if (!draft) Object.assign(where, { live: { equals: true }, 'meta.noIndex': { equals: false } })
|
|
14
|
+
const results = await payload.find({
|
|
15
|
+
collection: 'pages',
|
|
16
|
+
draft,
|
|
17
|
+
where,
|
|
18
|
+
depth: 0,
|
|
19
|
+
limit: 0,
|
|
20
|
+
overrideAccess: draft,
|
|
21
|
+
select: { href: true, updatedAt: true, meta: { priority: true, noIndex: true, changeFrequency: true } },
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const pages = results.docs || []
|
|
25
|
+
const pagesWithout404 = pages.filter(({ href }) => href !== '/404') // Exclude 404 page
|
|
26
|
+
const dateFallback = new Date().toISOString()
|
|
27
|
+
|
|
28
|
+
const sitemap = pagesWithout404
|
|
29
|
+
? pagesWithout404.map((page) => {
|
|
30
|
+
const { href, updatedAt, meta } = page
|
|
31
|
+
if (href === '/') {
|
|
32
|
+
return {
|
|
33
|
+
priority: 1,
|
|
34
|
+
url: `${getServerSideURL()}`,
|
|
35
|
+
lastModified: updatedAt || dateFallback,
|
|
36
|
+
changeFrequency: meta?.changeFrequency || 'monthly',
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
priority: meta?.priority || 0.5,
|
|
41
|
+
url: `${getServerSideURL()}${href}`,
|
|
42
|
+
lastModified: updatedAt || dateFallback,
|
|
43
|
+
changeFrequency: meta?.changeFrequency || 'monthly',
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
: []
|
|
47
|
+
|
|
48
|
+
cacheLogger({ tag, draft })
|
|
49
|
+
return sitemap
|
|
50
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
import 'server-only' //DO NOT REMOVE
|
|
3
|
+
import { getPayload } from 'payload'
|
|
4
|
+
import { GCFunction } from '@/ts/types'
|
|
5
|
+
import configPromise from '@payload-config'
|
|
6
|
+
import cacheLogger from '@/utilities/log/cache'
|
|
7
|
+
|
|
8
|
+
/** Gets tracking settings from payload about posthog, vercel and google tag manager. */
|
|
9
|
+
export const getCachedTracking: GCFunction<'tracking'> = async (tag, draft) => {
|
|
10
|
+
const payload = await getPayload({ config: configPromise })
|
|
11
|
+
const results = await payload.findGlobal({ slug: 'tracking', draft })
|
|
12
|
+
cacheLogger({ tag, draft })
|
|
13
|
+
return results
|
|
14
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
import 'server-only' //DO NOT REMOVE
|
|
3
|
+
import { mt } from '@/utilities/mergeTags'
|
|
4
|
+
import { unstable_cache } from 'next/cache'
|
|
5
|
+
import { GCArgs, GCReturns, GCFunction, Last } from '@/ts/types'
|
|
6
|
+
|
|
7
|
+
//Getter Imports
|
|
8
|
+
import { getCachedPages } from './getPages'
|
|
9
|
+
import { getCachedImage } from './getImage'
|
|
10
|
+
import { getCachedFooter } from './getFooter'
|
|
11
|
+
import { getCachedHeader } from './getHeader'
|
|
12
|
+
import { getCachedSiteCSS } from './getSiteCSS'
|
|
13
|
+
import { getCachedSitemap } from './getSitemap'
|
|
14
|
+
import { getCachedPageByHref } from './getPage'
|
|
15
|
+
import { getCachedTracking } from './getTracking'
|
|
16
|
+
import { getCachedDesignSet } from './getDesignSet'
|
|
17
|
+
import { getCachedShortcutSet } from './getShortcutSet'
|
|
18
|
+
import { getCachedSiteMetadata } from './getSiteMetadata'
|
|
19
|
+
import { getCachedAtomicClasses } from './getAtomicClasses'
|
|
20
|
+
import { getCachedAtomicActions } from './getAtomicActions'
|
|
21
|
+
import { getCachedFormSubmissions } from './getFormSubmissions'
|
|
22
|
+
import { getCachedIconByName, getCachedIconSet, getCachedIconOptions } from './getIcon'
|
|
23
|
+
import { getCachedAllForms, getCachedAtomicForms, getCachedBackendForms } from './getForms'
|
|
24
|
+
|
|
25
|
+
const getRegistry = {
|
|
26
|
+
pages: getCachedPages,
|
|
27
|
+
image: getCachedImage,
|
|
28
|
+
header: getCachedHeader,
|
|
29
|
+
footer: getCachedFooter,
|
|
30
|
+
page: getCachedPageByHref,
|
|
31
|
+
icon: getCachedIconByName,
|
|
32
|
+
sitemap: getCachedSitemap,
|
|
33
|
+
iconSet: getCachedIconSet,
|
|
34
|
+
tracking: getCachedTracking,
|
|
35
|
+
'site-css': getCachedSiteCSS,
|
|
36
|
+
designSet: getCachedDesignSet,
|
|
37
|
+
'all-forms': getCachedAllForms,
|
|
38
|
+
shortcutSet: getCachedShortcutSet,
|
|
39
|
+
'atomic-forms': getCachedAtomicForms,
|
|
40
|
+
'icon-options': getCachedIconOptions,
|
|
41
|
+
'site-metadata': getCachedSiteMetadata,
|
|
42
|
+
'backend-forms': getCachedBackendForms,
|
|
43
|
+
'atomic-classes': getCachedAtomicClasses,
|
|
44
|
+
'atomic-actions': getCachedAtomicActions,
|
|
45
|
+
'form-submissions': getCachedFormSubmissions,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function getCached(...args: GCArgs<'icon'>): GCReturns<'icon'>
|
|
49
|
+
async function getCached(...args: GCArgs<'page'>): GCReturns<'page'>
|
|
50
|
+
async function getCached(...args: GCArgs<'image'>): GCReturns<'image'>
|
|
51
|
+
async function getCached(...args: GCArgs<'pages'>): GCReturns<'pages'>
|
|
52
|
+
async function getCached(...args: GCArgs<'header'>): GCReturns<'header'>
|
|
53
|
+
async function getCached(...args: GCArgs<'footer'>): GCReturns<'footer'>
|
|
54
|
+
async function getCached(...args: GCArgs<'sitemap'>): GCReturns<'sitemap'>
|
|
55
|
+
async function getCached(...args: GCArgs<'iconSet'>): GCReturns<'iconSet'>
|
|
56
|
+
async function getCached(...args: GCArgs<'site-css'>): GCReturns<'site-css'>
|
|
57
|
+
async function getCached(...args: GCArgs<'tracking'>): GCReturns<'tracking'>
|
|
58
|
+
async function getCached(...args: GCArgs<'all-forms'>): GCReturns<'all-forms'>
|
|
59
|
+
async function getCached(...args: GCArgs<'designSet'>): GCReturns<'designSet'>
|
|
60
|
+
async function getCached(...args: GCArgs<'shortcutSet'>): GCReturns<'shortcutSet'>
|
|
61
|
+
async function getCached(...args: GCArgs<'atomic-forms'>): GCReturns<'atomic-forms'>
|
|
62
|
+
async function getCached(...args: GCArgs<'icon-options'>): GCReturns<'icon-options'>
|
|
63
|
+
async function getCached(...args: GCArgs<'backend-forms'>): GCReturns<'backend-forms'>
|
|
64
|
+
async function getCached(...args: GCArgs<'site-metadata'>): GCReturns<'site-metadata'>
|
|
65
|
+
async function getCached(...args: GCArgs<'atomic-classes'>): GCReturns<'atomic-classes'>
|
|
66
|
+
async function getCached(...args: GCArgs<'atomic-actions'>): GCReturns<'atomic-actions'>
|
|
67
|
+
async function getCached(...args: GCArgs<'form-submissions'>): GCReturns<'form-submissions'>
|
|
68
|
+
async function getCached(...args: GCArgs<'all'>): GCReturns<'all'> {
|
|
69
|
+
const [tag, a, b] = args
|
|
70
|
+
let tid = ''
|
|
71
|
+
let draft = false
|
|
72
|
+
|
|
73
|
+
if (typeof a === 'string') tid = a
|
|
74
|
+
if (typeof a === 'boolean') draft = a
|
|
75
|
+
if (typeof b === 'boolean') draft = b
|
|
76
|
+
|
|
77
|
+
const draftTag: 'draft' | undefined = draft ? 'draft' : undefined
|
|
78
|
+
|
|
79
|
+
// Key parts are used to create the cache key that identifies this specific cache.
|
|
80
|
+
// e.g: ['pages', '/example', 'draft']
|
|
81
|
+
const keyParts: string[] = [tag] /* 'page' */
|
|
82
|
+
if (tid) keyParts.push(tid) /* '/example' */
|
|
83
|
+
if (draft) keyParts.push('draft') /* 'draft' */
|
|
84
|
+
|
|
85
|
+
// When any tag inside dependencyTags is revalidated, this cache will be busted.
|
|
86
|
+
// e.g: ['pages', 'draft', '/example', 'pages:draft']
|
|
87
|
+
const dependencyTags: string[] = [tag]
|
|
88
|
+
if (tid) dependencyTags.push(tid) /* '/example' */
|
|
89
|
+
if (draft) dependencyTags.push(mt([tag, draftTag])) /* 'page:draft' */
|
|
90
|
+
dependencyTags.push(draft ? 'draft' : 'published') /* Enables revalidation of all draft or published documents respectively */
|
|
91
|
+
if (tid) dependencyTags.push(mt([tag, tid, draftTag])) /* 'page:/example:draft' */
|
|
92
|
+
|
|
93
|
+
const getter = getRegistry[tag] as GCFunction<typeof tag>
|
|
94
|
+
|
|
95
|
+
// Additional dependency tags
|
|
96
|
+
switch (tag) {
|
|
97
|
+
case 'icon': {
|
|
98
|
+
const iconSet = args[args.length - 1] as Last<typeof args>
|
|
99
|
+
dependencyTags.push(mt(['iconSet', draftTag]))
|
|
100
|
+
//If you update the icon doc, this ensures the icon is updated.
|
|
101
|
+
const iconItem = iconSet.iconsArray?.find((item) => item.name === tid)
|
|
102
|
+
if (iconItem && iconItem.icon) dependencyTags.push(mt(['icon', iconItem.icon]))
|
|
103
|
+
break
|
|
104
|
+
}
|
|
105
|
+
case 'icon-options': {
|
|
106
|
+
dependencyTags.push(mt(['iconSet', draftTag]))
|
|
107
|
+
break
|
|
108
|
+
}
|
|
109
|
+
case 'form-submissions': {
|
|
110
|
+
dependencyTags.push(mt(['backend-forms']))
|
|
111
|
+
break
|
|
112
|
+
}
|
|
113
|
+
case 'atomic-actions': {
|
|
114
|
+
dependencyTags.push(mt(['settings', draftTag]))
|
|
115
|
+
break
|
|
116
|
+
}
|
|
117
|
+
case 'all-forms': {
|
|
118
|
+
dependencyTags.push(mt(['backend-forms']))
|
|
119
|
+
dependencyTags.push(mt(['atomic-forms', draftTag]))
|
|
120
|
+
break
|
|
121
|
+
}
|
|
122
|
+
default:
|
|
123
|
+
break
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return unstable_cache(async () => getter(...args), keyParts, { tags: dependencyTags })()
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export default getCached
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getClientSideURL } from '@/utilities/get/getURL'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Processes image resource URL to ensure proper formatting
|
|
5
|
+
* @param url The original URL from the resource
|
|
6
|
+
* @param cacheTag Optional cache tag to append to the URL
|
|
7
|
+
* @returns Properly formatted URL with cache tag if provided
|
|
8
|
+
*/
|
|
9
|
+
export const getImageUrl = (url: string | null | undefined, cacheTag?: string | null): string => {
|
|
10
|
+
if (!url) return ''
|
|
11
|
+
|
|
12
|
+
if (cacheTag && cacheTag !== '') cacheTag = encodeURIComponent(cacheTag)
|
|
13
|
+
|
|
14
|
+
// Check if URL already has http/https protocol
|
|
15
|
+
if (url.startsWith('http://') || url.startsWith('https://')) return cacheTag ? `${url}?${cacheTag}` : url
|
|
16
|
+
|
|
17
|
+
// Otherwise prepend client-side URL
|
|
18
|
+
const baseUrl = getClientSideURL()
|
|
19
|
+
return cacheTag ? `${baseUrl}${url}?${cacheTag}` : `${baseUrl}${url}`
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cookies } from 'next/headers'
|
|
2
|
+
import type { User } from '@/ts/types'
|
|
3
|
+
import { redirect } from 'next/navigation'
|
|
4
|
+
import { getClientSideURL } from './getURL'
|
|
5
|
+
|
|
6
|
+
type MeUserArgs = { nullUserRedirect?: string; validUserRedirect?: string }
|
|
7
|
+
|
|
8
|
+
export const getMeUser = async (args?: MeUserArgs): Promise<{ token: string; user: User }> => {
|
|
9
|
+
const { nullUserRedirect, validUserRedirect } = args || {}
|
|
10
|
+
const cookieStore = await cookies()
|
|
11
|
+
const token = cookieStore.get('payload-token')?.value
|
|
12
|
+
|
|
13
|
+
const meUserReq = await fetch(`${getClientSideURL()}/api/users/me`, { headers: { Authorization: `JWT ${token}` } })
|
|
14
|
+
|
|
15
|
+
const { user }: { user: User } = await meUserReq.json()
|
|
16
|
+
|
|
17
|
+
if (validUserRedirect && meUserReq.ok && user) redirect(validUserRedirect)
|
|
18
|
+
if (nullUserRedirect && (!meUserReq.ok || !user)) redirect(nullUserRedirect)
|
|
19
|
+
|
|
20
|
+
// Token will exist here because if it doesn't the user will be redirected
|
|
21
|
+
return { token: token!, user }
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const getServerSideURL = () => {
|
|
2
|
+
const url = process.env.NEXT_PUBLIC_SERVER_URL
|
|
3
|
+
|
|
4
|
+
if (!url && process.env.VERCEL_PROJECT_PRODUCTION_URL) return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
|
|
5
|
+
|
|
6
|
+
return url || 'http://localhost:3000'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const getClientSideURL = () => {
|
|
10
|
+
if (!!(typeof window !== 'undefined' && window.document && window.document.createElement)) {
|
|
11
|
+
const protocol = window.location.protocol
|
|
12
|
+
const domain = window.location.hostname
|
|
13
|
+
const port = window.location.port
|
|
14
|
+
return `${protocol}//${domain}${port ? `:${port}` : ''}`
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (process.env.VERCEL_PROJECT_PRODUCTION_URL) return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
|
|
18
|
+
|
|
19
|
+
return process.env.NEXT_PUBLIC_SERVER_URL || ''
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import 'server-only'
|
|
2
|
+
import { AllTags } from '@/ts/types'
|
|
3
|
+
import { mt } from '@/utilities/mergeTags'
|
|
4
|
+
|
|
5
|
+
export default function cacheLogger({ tag, tid, draft }: { tag: AllTags; tid?: string; draft?: boolean }) {
|
|
6
|
+
const fullTag: string = mt([tag, tid, draft ? 'draft' : undefined])
|
|
7
|
+
if (process?.env?.LOGS === 'true') console.log('\x1b[32m%s\x1b[0m', `[GET] - ${fullTag}`)
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default function manualLogger(message: string) {
|
|
2
|
+
let color
|
|
3
|
+
if (message.includes('[INFO]')) color = '\x1b[38;5;117m%s\x1b[0m'
|
|
4
|
+
if (message.includes('[Warning]')) color = '\x1b[38;5;208m%s\x1b[0m'
|
|
5
|
+
if (message.includes('[Error]')) color = '\x1b[38;5;196m%s\x1b[0m'
|
|
6
|
+
if (message.includes('[Preview]')) color = '\x1b[38;5;226m%s\x1b[0m'
|
|
7
|
+
if (message.includes('[STORE]')) color = '\x1b[38;5;117m%s\x1b[0m'
|
|
8
|
+
if (message.includes('[UPDATE]')) color = '\x1b[38;5;117m%s\x1b[0m'
|
|
9
|
+
if (message.includes('[GENERATE]')) color = '\x1b[38;5;117m%s\x1b[0m'
|
|
10
|
+
if (process?.env?.LOGS === 'true') console.log(color, message)
|
|
11
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import 'server-only'
|
|
2
|
+
import { RevalidationLoggerType } from '@/ts/types'
|
|
3
|
+
|
|
4
|
+
export default function revalidationLogger(tags: RevalidationLoggerType) {
|
|
5
|
+
if (process?.env?.LOGS === 'true') console.log('\x1b[38;5;226m%s\x1b[0m', `[Revalidate] - Tags | ${tags.join(' | ')}`)
|
|
6
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PosthogProperty } from '@/ts/types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generates data attributes as props for server components
|
|
5
|
+
* @param attributes Array of attribute objects containing property and value
|
|
6
|
+
* @returns An object with data attributes as props
|
|
7
|
+
*/
|
|
8
|
+
export default function postHogPropertyApplicator(attributes: (string | PosthogProperty)[] | null | undefined): Record<string, string> | undefined {
|
|
9
|
+
if (!Array.isArray(attributes) || attributes.length === 0) return
|
|
10
|
+
if (!attributes.every((attr) => typeof attr === 'object' && attr !== null && 'propertyObfuscated' in attr && 'valueObfuscated' in attr)) return
|
|
11
|
+
|
|
12
|
+
return (attributes as PosthogProperty[]).reduce(
|
|
13
|
+
(acc, attr) => {
|
|
14
|
+
const { propertyObfuscated, valueObfuscated } = attr
|
|
15
|
+
acc[`data-ph-capture-attribute-${propertyObfuscated}`] = String(valueObfuscated)
|
|
16
|
+
return acc
|
|
17
|
+
},
|
|
18
|
+
{} as Record<string, string>,
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use server'
|
|
2
|
+
import 'server-only'
|
|
3
|
+
import { mt } from './mergeTags'
|
|
4
|
+
import { revalidateTag as rt } from 'next/cache'
|
|
5
|
+
import revalidationLogger from '@/utilities/log/revalidation'
|
|
6
|
+
import { AllTags, PromiseTagGroup, RArgs, RReturns } from '@/ts/types'
|
|
7
|
+
|
|
8
|
+
/** Used by the admin ui site triggers component to revalidate all draft or published pages */
|
|
9
|
+
async function revalidateTag<T extends PromiseTagGroup>(...args: RArgs<T>): RReturns<T>
|
|
10
|
+
async function revalidateTag<T extends Exclude<AllTags, PromiseTagGroup>>(...args: RArgs<T>): RReturns<T>
|
|
11
|
+
async function revalidateTag(...args: RArgs<'all'>): RReturns<'all'> {
|
|
12
|
+
const [tag, a, b] = args
|
|
13
|
+
let tid = ''
|
|
14
|
+
let draft = false
|
|
15
|
+
|
|
16
|
+
if (typeof a === 'string') tid = a
|
|
17
|
+
if (typeof a === 'boolean') draft = a
|
|
18
|
+
if (typeof b === 'boolean') draft = b
|
|
19
|
+
|
|
20
|
+
const tags: string[] = []
|
|
21
|
+
let t: string = tag
|
|
22
|
+
|
|
23
|
+
if (tid) t = mt([tag, tid])
|
|
24
|
+
|
|
25
|
+
// Secondary revalidations and special handlings for specific tags.
|
|
26
|
+
switch (tag) {
|
|
27
|
+
case 'pages':
|
|
28
|
+
revalidateTag('sitemap', draft)
|
|
29
|
+
break
|
|
30
|
+
case 'designSet':
|
|
31
|
+
case 'shortcutSet':
|
|
32
|
+
case 'atomic-classes':
|
|
33
|
+
revalidateTag('site-css', draft)
|
|
34
|
+
break
|
|
35
|
+
case 'draft':
|
|
36
|
+
case 'published':
|
|
37
|
+
rt(t,'max')
|
|
38
|
+
revalidationLogger([t])
|
|
39
|
+
return { success: true, message: `Revalidated ${tag}`, timestamp: new Date().toISOString() }
|
|
40
|
+
default:
|
|
41
|
+
break
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (draft) {
|
|
45
|
+
rt(mt([t, 'draft']),'max')
|
|
46
|
+
tags.push(mt([t, 'draft']))
|
|
47
|
+
} else {
|
|
48
|
+
rt(t,'max')
|
|
49
|
+
tags.push(t)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
revalidationLogger(tags)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { revalidateTag }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RunAPFProps } from '@/ts/types/apf'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a document has been marked as changed in the context.
|
|
5
|
+
* If the documents data includes 'active' it will only return true if active = true.
|
|
6
|
+
*/
|
|
7
|
+
export const runAPF = ({ context, id, apf, data }: RunAPFProps): boolean => {
|
|
8
|
+
if (data instanceof Object && 'active' in data && data.active) return Boolean(context[`${id}-${apf}`])
|
|
9
|
+
else return Boolean(context[`${id}-${apf}`])
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import traverse from 'traverse'
|
|
2
|
+
|
|
3
|
+
/** Recursively removes undefined, null, empty arrays, and empty objects without mutating the original data. */
|
|
4
|
+
function sanitizeData<T>(incomingData: T): T {
|
|
5
|
+
const data = traverse(incomingData).clone()
|
|
6
|
+
traverse(data).forEach(function () {
|
|
7
|
+
this.before(function (node) {
|
|
8
|
+
if (this.key === 'richText') this.update(node, true) // Do Not Sanitize Children Of Rich Text
|
|
9
|
+
})
|
|
10
|
+
this.after(function (node) {
|
|
11
|
+
if (
|
|
12
|
+
node === undefined ||
|
|
13
|
+
node === null ||
|
|
14
|
+
(Array.isArray(node) && node.length === 0) ||
|
|
15
|
+
(typeof node === 'object' && !Array.isArray(node) && Object.keys(node).length === 0)
|
|
16
|
+
) {
|
|
17
|
+
this.remove()
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
return data
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default sanitizeData
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
|
|
3
|
+
//This is purely to allow you to have tailwind intellisense when writing actual tailwind classes.
|
|
4
|
+
//It has 0 effect on the actual css. Which is handled by unocss.
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
content: ['./src/**/*.{js,ts,jsx,tsx,mdx}', './src/**/*.{html,vue,svelte,astro}'],
|
|
8
|
+
corePlugins: { preflight: false },
|
|
9
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"baseUrl": ".",
|
|
6
|
+
"lib": [
|
|
7
|
+
"DOM",
|
|
8
|
+
"DOM.Iterable",
|
|
9
|
+
"ES2022"
|
|
10
|
+
],
|
|
11
|
+
"allowJs": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"module": "esnext",
|
|
16
|
+
"moduleResolution": "bundler",
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"isolatedModules": true,
|
|
19
|
+
"jsx": "react-jsx",
|
|
20
|
+
"incremental": true,
|
|
21
|
+
"plugins": [
|
|
22
|
+
{
|
|
23
|
+
"name": "next"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"paths": {
|
|
27
|
+
"@/*": [
|
|
28
|
+
"./src/*"
|
|
29
|
+
],
|
|
30
|
+
"react": [
|
|
31
|
+
"./node_modules/@types/react"
|
|
32
|
+
],
|
|
33
|
+
"@payload-config": [
|
|
34
|
+
"./src/payload.config.ts"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"include": [
|
|
39
|
+
"**/*.ts",
|
|
40
|
+
"**/*.tsx",
|
|
41
|
+
"next-env.d.ts",
|
|
42
|
+
"tailwind.config.js",
|
|
43
|
+
".next/types/**/*.ts",
|
|
44
|
+
".next/dev/types/**/*.ts"
|
|
45
|
+
],
|
|
46
|
+
"exclude": [
|
|
47
|
+
"node_modules"
|
|
48
|
+
]
|
|
49
|
+
}
|