@wildo-ai/saas-website 1.1.1
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/LICENSE +34 -0
- package/dist/esm/.builder.pid +9 -0
- package/dist/esm/astro/blog-post-bridge.d.ts +324 -0
- package/dist/esm/astro/blog-post-bridge.d.ts.map +1 -0
- package/dist/esm/astro/blog-post-bridge.js +57 -0
- package/dist/esm/astro/blog-post-bridge.js.map +1 -0
- package/dist/esm/astro/blog-post-head.renderer.d.ts +129 -0
- package/dist/esm/astro/blog-post-head.renderer.d.ts.map +1 -0
- package/dist/esm/astro/blog-post-head.renderer.js +139 -0
- package/dist/esm/astro/blog-post-head.renderer.js.map +1 -0
- package/dist/esm/astro/bridge-runtime.d.ts +224 -0
- package/dist/esm/astro/bridge-runtime.d.ts.map +1 -0
- package/dist/esm/astro/bridge-runtime.js +30 -0
- package/dist/esm/astro/bridge-runtime.js.map +1 -0
- package/dist/esm/astro/collect-expected-label-keys.d.ts +65 -0
- package/dist/esm/astro/collect-expected-label-keys.d.ts.map +1 -0
- package/dist/esm/astro/collect-expected-label-keys.js +101 -0
- package/dist/esm/astro/collect-expected-label-keys.js.map +1 -0
- package/dist/esm/astro/headers-renderer.d.ts +32 -0
- package/dist/esm/astro/headers-renderer.d.ts.map +1 -0
- package/dist/esm/astro/headers-renderer.js +64 -0
- package/dist/esm/astro/headers-renderer.js.map +1 -0
- package/dist/esm/astro/i18n-routing.helper.d.ts +91 -0
- package/dist/esm/astro/i18n-routing.helper.d.ts.map +1 -0
- package/dist/esm/astro/i18n-routing.helper.js +23 -0
- package/dist/esm/astro/i18n-routing.helper.js.map +1 -0
- package/dist/esm/astro/internal/html-escape.d.ts +31 -0
- package/dist/esm/astro/internal/html-escape.d.ts.map +1 -0
- package/dist/esm/astro/internal/html-escape.js +40 -0
- package/dist/esm/astro/internal/html-escape.js.map +1 -0
- package/dist/esm/astro/label-pack-loader.d.ts +134 -0
- package/dist/esm/astro/label-pack-loader.d.ts.map +1 -0
- package/dist/esm/astro/label-pack-loader.js +298 -0
- package/dist/esm/astro/label-pack-loader.js.map +1 -0
- package/dist/esm/astro/llms-txt-server.d.ts +28 -0
- package/dist/esm/astro/llms-txt-server.d.ts.map +1 -0
- package/dist/esm/astro/llms-txt-server.js +33 -0
- package/dist/esm/astro/llms-txt-server.js.map +1 -0
- package/dist/esm/astro/pick-labels-for-page.d.ts +63 -0
- package/dist/esm/astro/pick-labels-for-page.d.ts.map +1 -0
- package/dist/esm/astro/pick-labels-for-page.js +73 -0
- package/dist/esm/astro/pick-labels-for-page.js.map +1 -0
- package/dist/esm/astro/robots-renderer.d.ts +85 -0
- package/dist/esm/astro/robots-renderer.d.ts.map +1 -0
- package/dist/esm/astro/robots-renderer.js +157 -0
- package/dist/esm/astro/robots-renderer.js.map +1 -0
- package/dist/esm/astro/sitemap-coverage.d.ts +101 -0
- package/dist/esm/astro/sitemap-coverage.d.ts.map +1 -0
- package/dist/esm/astro/sitemap-coverage.js +67 -0
- package/dist/esm/astro/sitemap-coverage.js.map +1 -0
- package/dist/esm/astro/structured-data.renderer.d.ts +21 -0
- package/dist/esm/astro/structured-data.renderer.d.ts.map +1 -0
- package/dist/esm/astro/structured-data.renderer.js +142 -0
- package/dist/esm/astro/structured-data.renderer.js.map +1 -0
- package/dist/esm/astro/website-page-head.renderer.d.ts +93 -0
- package/dist/esm/astro/website-page-head.renderer.d.ts.map +1 -0
- package/dist/esm/astro/website-page-head.renderer.js +184 -0
- package/dist/esm/astro/website-page-head.renderer.js.map +1 -0
- package/dist/esm/astro/website-page-runtime.helper.d.ts +112 -0
- package/dist/esm/astro/website-page-runtime.helper.d.ts.map +1 -0
- package/dist/esm/astro/website-page-runtime.helper.js +60 -0
- package/dist/esm/astro/website-page-runtime.helper.js.map +1 -0
- package/dist/esm/astro/website-site-context.d.ts +126 -0
- package/dist/esm/astro/website-site-context.d.ts.map +1 -0
- package/dist/esm/astro/website-site-context.js +37 -0
- package/dist/esm/astro/website-site-context.js.map +1 -0
- package/dist/esm/astro-island.d.ts +56 -0
- package/dist/esm/astro-island.d.ts.map +1 -0
- package/dist/esm/astro-island.js +61 -0
- package/dist/esm/astro-island.js.map +1 -0
- package/dist/esm/astro.d.ts +151 -0
- package/dist/esm/astro.d.ts.map +1 -0
- package/dist/esm/astro.js +151 -0
- package/dist/esm/astro.js.map +1 -0
- package/dist/esm/companion-exports.d.ts +38 -0
- package/dist/esm/companion-exports.d.ts.map +1 -0
- package/dist/esm/companion-exports.js +38 -0
- package/dist/esm/companion-exports.js.map +1 -0
- package/dist/esm/components/low-level/WebsiteButton.d.ts +73 -0
- package/dist/esm/components/low-level/WebsiteButton.d.ts.map +1 -0
- package/dist/esm/components/low-level/WebsiteButton.js +68 -0
- package/dist/esm/components/low-level/WebsiteButton.js.map +1 -0
- package/dist/esm/components/low-level/WebsiteHeading.d.ts +78 -0
- package/dist/esm/components/low-level/WebsiteHeading.d.ts.map +1 -0
- package/dist/esm/components/low-level/WebsiteHeading.js +41 -0
- package/dist/esm/components/low-level/WebsiteHeading.js.map +1 -0
- package/dist/esm/components/low-level/WebsiteImage.d.ts +73 -0
- package/dist/esm/components/low-level/WebsiteImage.d.ts.map +1 -0
- package/dist/esm/components/low-level/WebsiteImage.js +21 -0
- package/dist/esm/components/low-level/WebsiteImage.js.map +1 -0
- package/dist/esm/components/low-level/WebsiteInternalButton.d.ts +90 -0
- package/dist/esm/components/low-level/WebsiteInternalButton.d.ts.map +1 -0
- package/dist/esm/components/low-level/WebsiteInternalButton.js +47 -0
- package/dist/esm/components/low-level/WebsiteInternalButton.js.map +1 -0
- package/dist/esm/components/low-level/WebsiteInternalLink.d.ts +99 -0
- package/dist/esm/components/low-level/WebsiteInternalLink.d.ts.map +1 -0
- package/dist/esm/components/low-level/WebsiteInternalLink.js +68 -0
- package/dist/esm/components/low-level/WebsiteInternalLink.js.map +1 -0
- package/dist/esm/components/low-level/WebsiteLink.d.ts +50 -0
- package/dist/esm/components/low-level/WebsiteLink.d.ts.map +1 -0
- package/dist/esm/components/low-level/WebsiteLink.js +22 -0
- package/dist/esm/components/low-level/WebsiteLink.js.map +1 -0
- package/dist/esm/components/low-level/WebsiteText.d.ts +57 -0
- package/dist/esm/components/low-level/WebsiteText.d.ts.map +1 -0
- package/dist/esm/components/low-level/WebsiteText.js +57 -0
- package/dist/esm/components/low-level/WebsiteText.js.map +1 -0
- package/dist/esm/config/define-website-config.d.ts +83 -0
- package/dist/esm/config/define-website-config.d.ts.map +1 -0
- package/dist/esm/config/define-website-config.js +126 -0
- package/dist/esm/config/define-website-config.js.map +1 -0
- package/dist/esm/config/index.d.ts +38 -0
- package/dist/esm/config/index.d.ts.map +1 -0
- package/dist/esm/config/index.js +38 -0
- package/dist/esm/config/index.js.map +1 -0
- package/dist/esm/config/load-website-config.d.ts +136 -0
- package/dist/esm/config/load-website-config.d.ts.map +1 -0
- package/dist/esm/config/load-website-config.js +177 -0
- package/dist/esm/config/load-website-config.js.map +1 -0
- package/dist/esm/config/wildo-website-config.schemas.d.ts +251 -0
- package/dist/esm/config/wildo-website-config.schemas.d.ts.map +1 -0
- package/dist/esm/config/wildo-website-config.schemas.js +302 -0
- package/dist/esm/config/wildo-website-config.schemas.js.map +1 -0
- package/dist/esm/config-loader.d.ts +35 -0
- package/dist/esm/config-loader.d.ts.map +1 -0
- package/dist/esm/config-loader.js +35 -0
- package/dist/esm/config-loader.js.map +1 -0
- package/dist/esm/core/anonymous-session/InboundContactForm.d.ts +38 -0
- package/dist/esm/core/anonymous-session/InboundContactForm.d.ts.map +1 -0
- package/dist/esm/core/anonymous-session/InboundContactForm.js +77 -0
- package/dist/esm/core/anonymous-session/InboundContactForm.js.map +1 -0
- package/dist/esm/core/anonymous-session/inbound-contact-form.schema.d.ts +41 -0
- package/dist/esm/core/anonymous-session/inbound-contact-form.schema.d.ts.map +1 -0
- package/dist/esm/core/anonymous-session/inbound-contact-form.schema.js +58 -0
- package/dist/esm/core/anonymous-session/inbound-contact-form.schema.js.map +1 -0
- package/dist/esm/core/anonymous-session/website-anonymous-session-client.d.ts +81 -0
- package/dist/esm/core/anonymous-session/website-anonymous-session-client.d.ts.map +1 -0
- package/dist/esm/core/anonymous-session/website-anonymous-session-client.js +177 -0
- package/dist/esm/core/anonymous-session/website-anonymous-session-client.js.map +1 -0
- package/dist/esm/core/contexts/WebsitePageContext.d.ts +40 -0
- package/dist/esm/core/contexts/WebsitePageContext.d.ts.map +1 -0
- package/dist/esm/core/contexts/WebsitePageContext.js +8 -0
- package/dist/esm/core/contexts/WebsitePageContext.js.map +1 -0
- package/dist/esm/core/contexts/WebsiteRuntimeContext.d.ts +162 -0
- package/dist/esm/core/contexts/WebsiteRuntimeContext.d.ts.map +1 -0
- package/dist/esm/core/contexts/WebsiteRuntimeContext.js +22 -0
- package/dist/esm/core/contexts/WebsiteRuntimeContext.js.map +1 -0
- package/dist/esm/core/contexts/WebsiteSectionContext.d.ts +47 -0
- package/dist/esm/core/contexts/WebsiteSectionContext.d.ts.map +1 -0
- package/dist/esm/core/contexts/WebsiteSectionContext.js +8 -0
- package/dist/esm/core/contexts/WebsiteSectionContext.js.map +1 -0
- package/dist/esm/core/contexts/useWebsitePage.d.ts +13 -0
- package/dist/esm/core/contexts/useWebsitePage.d.ts.map +1 -0
- package/dist/esm/core/contexts/useWebsitePage.js +22 -0
- package/dist/esm/core/contexts/useWebsitePage.js.map +1 -0
- package/dist/esm/core/contexts/useWebsiteRuntime.d.ts +19 -0
- package/dist/esm/core/contexts/useWebsiteRuntime.d.ts.map +1 -0
- package/dist/esm/core/contexts/useWebsiteRuntime.js +28 -0
- package/dist/esm/core/contexts/useWebsiteRuntime.js.map +1 -0
- package/dist/esm/core/contexts/useWebsiteSection.d.ts +12 -0
- package/dist/esm/core/contexts/useWebsiteSection.d.ts.map +1 -0
- package/dist/esm/core/contexts/useWebsiteSection.js +22 -0
- package/dist/esm/core/contexts/useWebsiteSection.js.map +1 -0
- package/dist/esm/core/external-providers/frontend-provider-registry.website.d.ts +17 -0
- package/dist/esm/core/external-providers/frontend-provider-registry.website.d.ts.map +1 -0
- package/dist/esm/core/external-providers/frontend-provider-registry.website.js +23 -0
- package/dist/esm/core/external-providers/frontend-provider-registry.website.js.map +1 -0
- package/dist/esm/core/factories/define-website-page-manifest.d.ts +70 -0
- package/dist/esm/core/factories/define-website-page-manifest.d.ts.map +1 -0
- package/dist/esm/core/factories/define-website-page-manifest.js +51 -0
- package/dist/esm/core/factories/define-website-page-manifest.js.map +1 -0
- package/dist/esm/core/factories/define-website-section.d.ts +101 -0
- package/dist/esm/core/factories/define-website-section.d.ts.map +1 -0
- package/dist/esm/core/factories/define-website-section.js +71 -0
- package/dist/esm/core/factories/define-website-section.js.map +1 -0
- package/dist/esm/core/hooks/useWebsiteDesignTokens.d.ts +23 -0
- package/dist/esm/core/hooks/useWebsiteDesignTokens.d.ts.map +1 -0
- package/dist/esm/core/hooks/useWebsiteDesignTokens.js +25 -0
- package/dist/esm/core/hooks/useWebsiteDesignTokens.js.map +1 -0
- package/dist/esm/core/hooks/useWebsiteLabel.d.ts +68 -0
- package/dist/esm/core/hooks/useWebsiteLabel.d.ts.map +1 -0
- package/dist/esm/core/hooks/useWebsiteLabel.js +103 -0
- package/dist/esm/core/hooks/useWebsiteLabel.js.map +1 -0
- package/dist/esm/core/layouts/WebsitePageLayout.d.ts +87 -0
- package/dist/esm/core/layouts/WebsitePageLayout.d.ts.map +1 -0
- package/dist/esm/core/layouts/WebsitePageLayout.js +170 -0
- package/dist/esm/core/layouts/WebsitePageLayout.js.map +1 -0
- package/dist/esm/core/layouts/WebsiteSection.d.ts +91 -0
- package/dist/esm/core/layouts/WebsiteSection.d.ts.map +1 -0
- package/dist/esm/core/layouts/WebsiteSection.js +26 -0
- package/dist/esm/core/layouts/WebsiteSection.js.map +1 -0
- package/dist/esm/core/routing/internal-routing.utils.d.ts +65 -0
- package/dist/esm/core/routing/internal-routing.utils.d.ts.map +1 -0
- package/dist/esm/core/routing/internal-routing.utils.js +14 -0
- package/dist/esm/core/routing/internal-routing.utils.js.map +1 -0
- package/dist/esm/index.d.ts +129 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +129 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/mdx/BlogPost.d.ts +193 -0
- package/dist/esm/mdx/BlogPost.d.ts.map +1 -0
- package/dist/esm/mdx/BlogPost.js +161 -0
- package/dist/esm/mdx/BlogPost.js.map +1 -0
- package/dist/esm/mdx/blog-post-collection.config.d.ts +139 -0
- package/dist/esm/mdx/blog-post-collection.config.d.ts.map +1 -0
- package/dist/esm/mdx/blog-post-collection.config.js +27 -0
- package/dist/esm/mdx/blog-post-collection.config.js.map +1 -0
- package/dist/esm/mdx/blog-post-frontmatter-source.d.ts +12 -0
- package/dist/esm/mdx/blog-post-frontmatter-source.d.ts.map +1 -0
- package/dist/esm/mdx/blog-post-frontmatter-source.js +13 -0
- package/dist/esm/mdx/blog-post-frontmatter-source.js.map +1 -0
- package/dist/esm/mdx/index.d.ts +22 -0
- package/dist/esm/mdx/index.d.ts.map +1 -0
- package/dist/esm/mdx/index.js +22 -0
- package/dist/esm/mdx/index.js.map +1 -0
- package/dist/esm/mdx/website-mdx-provider.d.ts +90 -0
- package/dist/esm/mdx/website-mdx-provider.d.ts.map +1 -0
- package/dist/esm/mdx/website-mdx-provider.js +8 -0
- package/dist/esm/mdx/website-mdx-provider.js.map +1 -0
- package/dist/esm/mdx.d.ts +38 -0
- package/dist/esm/mdx.d.ts.map +1 -0
- package/dist/esm/mdx.js +38 -0
- package/dist/esm/mdx.js.map +1 -0
- package/dist/esm/schemas/blog/blog-post-frontmatter.shared.schemas.d.ts +75 -0
- package/dist/esm/schemas/blog/blog-post-frontmatter.shared.schemas.d.ts.map +1 -0
- package/dist/esm/schemas/blog/blog-post-frontmatter.shared.schemas.js +85 -0
- package/dist/esm/schemas/blog/blog-post-frontmatter.shared.schemas.js.map +1 -0
- package/dist/esm/schemas/design-tokens/website-design-tokens.shared.schemas.d.ts +120 -0
- package/dist/esm/schemas/design-tokens/website-design-tokens.shared.schemas.d.ts.map +1 -0
- package/dist/esm/schemas/design-tokens/website-design-tokens.shared.schemas.js +152 -0
- package/dist/esm/schemas/design-tokens/website-design-tokens.shared.schemas.js.map +1 -0
- package/dist/esm/schemas/label-keys/website-label-key.schemas.d.ts +73 -0
- package/dist/esm/schemas/label-keys/website-label-key.schemas.d.ts.map +1 -0
- package/dist/esm/schemas/label-keys/website-label-key.schemas.js +76 -0
- package/dist/esm/schemas/label-keys/website-label-key.schemas.js.map +1 -0
- package/dist/esm/schemas/manifests/website-page-manifest.shared.schemas.d.ts +209 -0
- package/dist/esm/schemas/manifests/website-page-manifest.shared.schemas.d.ts.map +1 -0
- package/dist/esm/schemas/manifests/website-page-manifest.shared.schemas.js +218 -0
- package/dist/esm/schemas/manifests/website-page-manifest.shared.schemas.js.map +1 -0
- package/dist/esm/schemas/manifests/website-root-config.shared.schemas.d.ts +431 -0
- package/dist/esm/schemas/manifests/website-root-config.shared.schemas.d.ts.map +1 -0
- package/dist/esm/schemas/manifests/website-root-config.shared.schemas.js +438 -0
- package/dist/esm/schemas/manifests/website-root-config.shared.schemas.js.map +1 -0
- package/dist/esm/schemas/refs/page-ref.schemas.d.ts +40 -0
- package/dist/esm/schemas/refs/page-ref.schemas.d.ts.map +1 -0
- package/dist/esm/schemas/refs/page-ref.schemas.js +43 -0
- package/dist/esm/schemas/refs/page-ref.schemas.js.map +1 -0
- package/dist/esm/schemas/refs/section-ref.schemas.d.ts +41 -0
- package/dist/esm/schemas/refs/section-ref.schemas.d.ts.map +1 -0
- package/dist/esm/schemas/refs/section-ref.schemas.js +44 -0
- package/dist/esm/schemas/refs/section-ref.schemas.js.map +1 -0
- package/dist/esm/schemas/sections/website-section-category.shared.d.ts +63 -0
- package/dist/esm/schemas/sections/website-section-category.shared.d.ts.map +1 -0
- package/dist/esm/schemas/sections/website-section-category.shared.js +64 -0
- package/dist/esm/schemas/sections/website-section-category.shared.js.map +1 -0
- package/dist/esm/schemas/sections/website-section-definition.shared.schemas.d.ts +114 -0
- package/dist/esm/schemas/sections/website-section-definition.shared.schemas.d.ts.map +1 -0
- package/dist/esm/schemas/sections/website-section-definition.shared.schemas.js +69 -0
- package/dist/esm/schemas/sections/website-section-definition.shared.schemas.js.map +1 -0
- package/dist/esm/schemas/structured-data/structured-data-reconciliation.shared.d.ts +100 -0
- package/dist/esm/schemas/structured-data/structured-data-reconciliation.shared.d.ts.map +1 -0
- package/dist/esm/schemas/structured-data/structured-data-reconciliation.shared.js +355 -0
- package/dist/esm/schemas/structured-data/structured-data-reconciliation.shared.js.map +1 -0
- package/dist/esm/schemas/structured-data/website-structured-data.shared.schemas.d.ts +58 -0
- package/dist/esm/schemas/structured-data/website-structured-data.shared.schemas.d.ts.map +1 -0
- package/dist/esm/schemas/structured-data/website-structured-data.shared.schemas.js +2 -0
- package/dist/esm/schemas/structured-data/website-structured-data.shared.schemas.js.map +1 -0
- package/dist/esm/schemas/validators/label-pack.validator.d.ts +144 -0
- package/dist/esm/schemas/validators/label-pack.validator.d.ts.map +1 -0
- package/dist/esm/schemas/validators/label-pack.validator.js +100 -0
- package/dist/esm/schemas/validators/label-pack.validator.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +143 -0
- package/src/__tests__/bundle-isolation.test.ts +607 -0
- package/src/astro/__tests__/blog-post-bridge.test.tsx +288 -0
- package/src/astro/__tests__/blog-post-head.renderer.test.ts +249 -0
- package/src/astro/__tests__/bridge-runtime.test.tsx +198 -0
- package/src/astro/__tests__/collect-expected-label-keys.test.ts +69 -0
- package/src/astro/__tests__/headers-renderer.test.ts +143 -0
- package/src/astro/__tests__/i18n-routing.helper.test.ts +116 -0
- package/src/astro/__tests__/label-pack-loader.test.ts +305 -0
- package/src/astro/__tests__/llms-txt-server.test.ts +127 -0
- package/src/astro/__tests__/pick-labels-for-page.test.ts +60 -0
- package/src/astro/__tests__/robots-renderer.test.ts +228 -0
- package/src/astro/__tests__/sitemap-coverage.test.ts +230 -0
- package/src/astro/__tests__/structured-data.renderer.test.ts +172 -0
- package/src/astro/__tests__/website-page-head.renderer.test.ts +424 -0
- package/src/astro/__tests__/website-page-runtime.helper.test.ts +157 -0
- package/src/astro/__tests__/website-site-context.test.ts +121 -0
- package/src/astro/blog-post-bridge.tsx +404 -0
- package/src/astro/blog-post-head.renderer.ts +293 -0
- package/src/astro/bridge-runtime.tsx +270 -0
- package/src/astro/collect-expected-label-keys.ts +113 -0
- package/src/astro/headers-renderer.ts +82 -0
- package/src/astro/i18n-routing.helper.ts +116 -0
- package/src/astro/internal/html-escape.ts +41 -0
- package/src/astro/label-pack-loader.ts +385 -0
- package/src/astro/llms-txt-server.ts +56 -0
- package/src/astro/pick-labels-for-page.ts +85 -0
- package/src/astro/robots-renderer.ts +171 -0
- package/src/astro/sitemap-coverage.ts +186 -0
- package/src/astro/structured-data.renderer.ts +171 -0
- package/src/astro/website-page-head.renderer.ts +279 -0
- package/src/astro/website-page-runtime.helper.ts +188 -0
- package/src/astro/website-site-context.ts +136 -0
- package/src/astro-island.ts +61 -0
- package/src/astro.ts +151 -0
- package/src/companion-exports.ts +38 -0
- package/src/components/low-level/WebsiteButton.tsx +118 -0
- package/src/components/low-level/WebsiteHeading.tsx +96 -0
- package/src/components/low-level/WebsiteImage.tsx +96 -0
- package/src/components/low-level/WebsiteInternalButton.tsx +172 -0
- package/src/components/low-level/WebsiteInternalLink.tsx +193 -0
- package/src/components/low-level/WebsiteLink.tsx +71 -0
- package/src/components/low-level/WebsiteText.tsx +75 -0
- package/src/components/low-level/__tests__/WebsiteInternalButton.test.tsx +169 -0
- package/src/components/low-level/__tests__/WebsiteInternalLink.test.tsx +202 -0
- package/src/components/low-level/__tests__/primitives.test.tsx +141 -0
- package/src/config/__tests__/define-website-config.test.ts +231 -0
- package/src/config/__tests__/load-website-config.test.ts +215 -0
- package/src/config/define-website-config.ts +134 -0
- package/src/config/index.ts +38 -0
- package/src/config/load-website-config.ts +229 -0
- package/src/config/wildo-website-config.schemas.ts +322 -0
- package/src/config-loader.ts +35 -0
- package/src/core/__tests__/WebsitePageLayout.test.tsx +184 -0
- package/src/core/__tests__/WebsiteSection.test.tsx +85 -0
- package/src/core/__tests__/contexts.test.tsx +133 -0
- package/src/core/__tests__/core-boundary.test.ts +85 -0
- package/src/core/__tests__/define-website-page-manifest.test.tsx +111 -0
- package/src/core/__tests__/define-website-section.test.tsx +89 -0
- package/src/core/__tests__/useWebsiteDesignTokens.test.tsx +41 -0
- package/src/core/__tests__/useWebsiteLabel.test.tsx +117 -0
- package/src/core/anonymous-session/InboundContactForm.tsx +157 -0
- package/src/core/anonymous-session/__tests__/inbound-contact-form.schema.test.ts +44 -0
- package/src/core/anonymous-session/inbound-contact-form.schema.ts +62 -0
- package/src/core/anonymous-session/website-anonymous-session-client.ts +194 -0
- package/src/core/contexts/WebsitePageContext.tsx +52 -0
- package/src/core/contexts/WebsiteRuntimeContext.tsx +175 -0
- package/src/core/contexts/WebsiteSectionContext.tsx +59 -0
- package/src/core/contexts/useWebsitePage.ts +28 -0
- package/src/core/contexts/useWebsiteRuntime.ts +34 -0
- package/src/core/contexts/useWebsiteSection.ts +28 -0
- package/src/core/external-providers/frontend-provider-registry.website.ts +62 -0
- package/src/core/factories/define-website-page-manifest.ts +102 -0
- package/src/core/factories/define-website-section.ts +128 -0
- package/src/core/hooks/useWebsiteDesignTokens.ts +26 -0
- package/src/core/hooks/useWebsiteLabel.ts +121 -0
- package/src/core/layouts/WebsitePageLayout.tsx +311 -0
- package/src/core/layouts/WebsiteSection.tsx +139 -0
- package/src/core/routing/__tests__/internal-routing.utils.test.ts +134 -0
- package/src/core/routing/internal-routing.utils.ts +77 -0
- package/src/index.ts +132 -0
- package/src/mdx/BlogPost.tsx +296 -0
- package/src/mdx/__tests__/BlogPost.test.tsx +218 -0
- package/src/mdx/__tests__/blog-post-collection.config.test.ts +127 -0
- package/src/mdx/__tests__/website-mdx-provider.test.tsx +82 -0
- package/src/mdx/blog-post-collection.config.ts +177 -0
- package/src/mdx/blog-post-frontmatter-source.ts +31 -0
- package/src/mdx/index.ts +39 -0
- package/src/mdx/website-mdx-provider.tsx +95 -0
- package/src/mdx.ts +38 -0
- package/src/schemas/__tests__/blog-frontmatter.test.ts +50 -0
- package/src/schemas/__tests__/companion-exports-react-free.test.ts +51 -0
- package/src/schemas/__tests__/design-tokens.test.ts +163 -0
- package/src/schemas/__tests__/label-key.test.ts +46 -0
- package/src/schemas/__tests__/label-pack-validator.test.ts +146 -0
- package/src/schemas/__tests__/page-manifest.test.ts +66 -0
- package/src/schemas/__tests__/refs.test.ts +37 -0
- package/src/schemas/__tests__/root-config.test.ts +292 -0
- package/src/schemas/__tests__/section-definition.test.ts +47 -0
- package/src/schemas/__tests__/structured-data-reconciliation.test.ts +543 -0
- package/src/schemas/blog/blog-post-frontmatter.shared.schemas.ts +111 -0
- package/src/schemas/design-tokens/website-design-tokens.shared.schemas.ts +166 -0
- package/src/schemas/label-keys/website-label-key.schemas.ts +88 -0
- package/src/schemas/manifests/website-page-manifest.shared.schemas.ts +266 -0
- package/src/schemas/manifests/website-root-config.shared.schemas.ts +504 -0
- package/src/schemas/refs/page-ref.schemas.ts +49 -0
- package/src/schemas/refs/section-ref.schemas.ts +50 -0
- package/src/schemas/sections/website-section-category.shared.ts +65 -0
- package/src/schemas/sections/website-section-definition.shared.schemas.ts +120 -0
- package/src/schemas/structured-data/structured-data-reconciliation.shared.ts +579 -0
- package/src/schemas/structured-data/website-structured-data.shared.schemas.ts +62 -0
- package/src/schemas/validators/label-pack.validator.ts +201 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { describe, expect, it, vi, afterEach } from 'vitest';
|
|
3
|
+
import { render, renderHook } from '@testing-library/react';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
WebsiteRuntimeContextProvider,
|
|
8
|
+
type WebsiteRuntimeContextValue,
|
|
9
|
+
} from '../contexts/WebsiteRuntimeContext';
|
|
10
|
+
import { useWebsiteRuntime } from '../contexts/useWebsiteRuntime';
|
|
11
|
+
import { WebsitePageContextProvider } from '../contexts/WebsitePageContext';
|
|
12
|
+
import { useWebsitePage } from '../contexts/useWebsitePage';
|
|
13
|
+
import { WebsiteSectionContextProvider } from '../contexts/WebsiteSectionContext';
|
|
14
|
+
import { useWebsiteSection } from '../contexts/useWebsiteSection';
|
|
15
|
+
import { WebsiteSectionCategory } from '../../schemas/sections/website-section-category.shared';
|
|
16
|
+
import { WebsitePageRefSchema } from '../../schemas/refs/page-ref.schemas';
|
|
17
|
+
import { WebsiteSectionRefSchema } from '../../schemas/refs/section-ref.schemas';
|
|
18
|
+
import { WebsiteLabelKeySchema } from '../../schemas/label-keys/website-label-key.schemas';
|
|
19
|
+
import { AvailableLanguage } from '@wildo-ai/saas-models/public-runtime';
|
|
20
|
+
|
|
21
|
+
const NoopHeader = () => <span data-testid="header" />;
|
|
22
|
+
const NoopFooter = () => <span data-testid="footer" />;
|
|
23
|
+
|
|
24
|
+
const RUNTIME_FIXTURE: WebsiteRuntimeContextValue = {
|
|
25
|
+
locale: AvailableLanguage.EN,
|
|
26
|
+
defaultLocale: AvailableLanguage.EN,
|
|
27
|
+
labelPack: { 'website.landing.hero.headline': 'Hello' },
|
|
28
|
+
skipToMainContentLabelKey: WebsiteLabelKeySchema.parse('website.chrome.layout.skip-to-main-content'),
|
|
29
|
+
designTokens: {
|
|
30
|
+
colors: {
|
|
31
|
+
background: '#fff',
|
|
32
|
+
foreground: '#000',
|
|
33
|
+
primary: '#000',
|
|
34
|
+
primaryForeground: '#fff',
|
|
35
|
+
accent: '#000',
|
|
36
|
+
accentForeground: '#fff',
|
|
37
|
+
surface: '#fff',
|
|
38
|
+
surfaceForeground: '#000',
|
|
39
|
+
border: '#ccc',
|
|
40
|
+
muted: '#eee',
|
|
41
|
+
mutedForeground: '#666',
|
|
42
|
+
},
|
|
43
|
+
radii: { none: '0', sm: '2px', md: '4px', lg: '8px', xl: '12px', full: '9999px' },
|
|
44
|
+
},
|
|
45
|
+
navigation: {
|
|
46
|
+
headerComponent: NoopHeader,
|
|
47
|
+
footerComponent: NoopFooter,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
afterEach(() => {
|
|
52
|
+
vi.restoreAllMocks();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('WebsiteRuntimeContext', () => {
|
|
56
|
+
it('provides the runtime value through the provider component', () => {
|
|
57
|
+
const { result } = renderHook(() => useWebsiteRuntime(), {
|
|
58
|
+
wrapper: ({ children }) => (
|
|
59
|
+
<WebsiteRuntimeContextProvider value={RUNTIME_FIXTURE}>
|
|
60
|
+
{children}
|
|
61
|
+
</WebsiteRuntimeContextProvider>
|
|
62
|
+
),
|
|
63
|
+
});
|
|
64
|
+
expect(result.current).toBe(RUNTIME_FIXTURE);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('throws with a clear message when used outside the provider', () => {
|
|
68
|
+
/**
|
|
69
|
+
* Suppress the React error-boundary logging — the throw is the
|
|
70
|
+
* test's expected outcome.
|
|
71
|
+
*/
|
|
72
|
+
vi.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
73
|
+
expect(() => renderHook(() => useWebsiteRuntime())).toThrowError(
|
|
74
|
+
/must be called inside <WebsiteRuntimeContextProvider>/,
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe('WebsitePageContext', () => {
|
|
80
|
+
it('provides the page ref through the provider component', () => {
|
|
81
|
+
const pageRef = WebsitePageRefSchema.parse('landing');
|
|
82
|
+
const { result } = renderHook(() => useWebsitePage(), {
|
|
83
|
+
wrapper: ({ children }) => (
|
|
84
|
+
<WebsitePageContextProvider value={{ pageRef }}>
|
|
85
|
+
{children}
|
|
86
|
+
</WebsitePageContextProvider>
|
|
87
|
+
),
|
|
88
|
+
});
|
|
89
|
+
expect(result.current.pageRef).toBe(pageRef);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('throws when used outside <WebsitePageLayout>', () => {
|
|
93
|
+
vi.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
94
|
+
expect(() => renderHook(() => useWebsitePage())).toThrowError(
|
|
95
|
+
/must be called inside <WebsitePageLayout>/,
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe('WebsiteSectionContext', () => {
|
|
101
|
+
it('provides the section ref + category through the provider component', () => {
|
|
102
|
+
const sectionRef = WebsiteSectionRefSchema.parse('hero');
|
|
103
|
+
const { result } = renderHook(() => useWebsiteSection(), {
|
|
104
|
+
wrapper: ({ children }) => (
|
|
105
|
+
<WebsiteSectionContextProvider
|
|
106
|
+
value={{ sectionRef, category: WebsiteSectionCategory.HERO }}
|
|
107
|
+
>
|
|
108
|
+
{children}
|
|
109
|
+
</WebsiteSectionContextProvider>
|
|
110
|
+
),
|
|
111
|
+
});
|
|
112
|
+
expect(result.current.sectionRef).toBe(sectionRef);
|
|
113
|
+
expect(result.current.category).toBe(WebsiteSectionCategory.HERO);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('throws when used outside <WebsiteSection>', () => {
|
|
117
|
+
vi.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
118
|
+
expect(() => renderHook(() => useWebsiteSection())).toThrowError(
|
|
119
|
+
/must be called inside <WebsiteSection>/,
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
describe('Provider component renders children', () => {
|
|
125
|
+
it('WebsiteRuntimeContextProvider passes children through', () => {
|
|
126
|
+
const { getByTestId } = render(
|
|
127
|
+
<WebsiteRuntimeContextProvider value={RUNTIME_FIXTURE}>
|
|
128
|
+
<div data-testid="child" />
|
|
129
|
+
</WebsiteRuntimeContextProvider>,
|
|
130
|
+
);
|
|
131
|
+
expect(getByTestId('child')).toBeInTheDocument();
|
|
132
|
+
});
|
|
133
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { readFileSync, readdirSync, statSync } from 'fs';
|
|
3
|
+
import { join, resolve } from 'path';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Boundary test for the `core/` and `components/` directories.
|
|
7
|
+
*
|
|
8
|
+
* Per `engine/saas-website/src/index.ts` `@wildo-boundary` block:
|
|
9
|
+
* - `core/` : MAY use React; MUST NOT import `~wildo-frontend-lib/**`
|
|
10
|
+
* or `@wildo-ai/saas-frontend-lib`
|
|
11
|
+
* - `components/` : same rules as `core/` (D18 — L1 primitives are
|
|
12
|
+
* self-contained placeholders, not re-exports of
|
|
13
|
+
* `saas-frontend-lib`)
|
|
14
|
+
*
|
|
15
|
+
* The constraint exists because `saas-website` does NOT depend on
|
|
16
|
+
* `saas-frontend-lib` (per `package.json`) — the marketing-site engine
|
|
17
|
+
* is a parallel surface to the SaaS app frontend. Phase 6 dogfood will
|
|
18
|
+
* decide whether to promote the L1 primitives to a shared
|
|
19
|
+
* `ComponentRegistryService` registry; until then this boundary is
|
|
20
|
+
* load-bearing.
|
|
21
|
+
*
|
|
22
|
+
* **Implementation**: AST parsing would be ideal but is overkill for a
|
|
23
|
+
* static-import grep. We scan source files (excluding `__tests__`) and
|
|
24
|
+
* fail the test if any forbidden import path appears.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const ROOT = resolve(__dirname, '../..');
|
|
28
|
+
const SCAN_DIRS = ['core', 'components'];
|
|
29
|
+
const FORBIDDEN_PATTERNS: readonly RegExp[] = [
|
|
30
|
+
/from\s+['"]~wildo-frontend-lib(?:\/[^'"]*)?['"]/,
|
|
31
|
+
/from\s+['"]@wildo-ai\/saas-frontend-lib(?:\/[^'"]*)?['"]/,
|
|
32
|
+
/import\s*\(\s*['"]~wildo-frontend-lib(?:\/[^'"]*)?['"]\s*\)/,
|
|
33
|
+
/import\s*\(\s*['"]@wildo-ai\/saas-frontend-lib(?:\/[^'"]*)?['"]\s*\)/,
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
function* walk(dir: string): Generator<string> {
|
|
37
|
+
for (const entry of readdirSync(dir)) {
|
|
38
|
+
if (entry === '__tests__') continue;
|
|
39
|
+
const full = join(dir, entry);
|
|
40
|
+
const s = statSync(full);
|
|
41
|
+
if (s.isDirectory()) {
|
|
42
|
+
yield* walk(full);
|
|
43
|
+
} else if (entry.endsWith('.ts') || entry.endsWith('.tsx')) {
|
|
44
|
+
yield full;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function findViolations(): { file: string; pattern: string; line: string }[] {
|
|
50
|
+
const violations: { file: string; pattern: string; line: string }[] = [];
|
|
51
|
+
for (const dirName of SCAN_DIRS) {
|
|
52
|
+
const dir = join(ROOT, dirName);
|
|
53
|
+
for (const file of walk(dir)) {
|
|
54
|
+
const content = readFileSync(file, 'utf8');
|
|
55
|
+
const lines = content.split('\n');
|
|
56
|
+
for (const [lineIdx, line] of lines.entries()) {
|
|
57
|
+
for (const pattern of FORBIDDEN_PATTERNS) {
|
|
58
|
+
if (pattern.test(line)) {
|
|
59
|
+
violations.push({
|
|
60
|
+
file: file.replace(ROOT + '/', ''),
|
|
61
|
+
pattern: pattern.source,
|
|
62
|
+
line: `${lineIdx + 1}: ${line.trim()}`,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return violations;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
describe('core/ + components/ boundary (D18)', () => {
|
|
73
|
+
it('does not import from ~wildo-frontend-lib or @wildo-ai/saas-frontend-lib', () => {
|
|
74
|
+
const violations = findViolations();
|
|
75
|
+
if (violations.length > 0) {
|
|
76
|
+
const report = violations
|
|
77
|
+
.map((v) => ` ${v.file} (matched /${v.pattern}/)\n ${v.line}`)
|
|
78
|
+
.join('\n');
|
|
79
|
+
throw new Error(
|
|
80
|
+
`Boundary violations detected — saas-website MUST NOT depend on saas-frontend-lib (D18):\n${report}`,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
expect(violations).toEqual([]);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { describe, expect, expectTypeOf, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { defineWebsitePageManifest } from '../factories/define-website-page-manifest';
|
|
5
|
+
import { WebsiteLabelKeySchema } from '../../schemas/label-keys/website-label-key.schemas';
|
|
6
|
+
import { WebsitePageHydrationStrategy } from '../../schemas/manifests/website-page-manifest.shared.schemas';
|
|
7
|
+
|
|
8
|
+
interface BlogPostPageProps {
|
|
9
|
+
slug: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function BlogPostPage({ slug }: BlogPostPageProps): React.ReactElement {
|
|
13
|
+
return <div data-testid="blog">{slug}</div>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const TITLE_KEY = WebsiteLabelKeySchema.parse('website.landing.meta.title');
|
|
17
|
+
const DESCRIPTION_KEY = WebsiteLabelKeySchema.parse('website.landing.meta.description');
|
|
18
|
+
|
|
19
|
+
describe('defineWebsitePageManifest', () => {
|
|
20
|
+
it('produces a manifest that round-trips through the schema', () => {
|
|
21
|
+
const manifest = defineWebsitePageManifest({
|
|
22
|
+
ref: 'landing',
|
|
23
|
+
routePath: '/',
|
|
24
|
+
pageComponent: () => null,
|
|
25
|
+
sectionRefs: ['hero', 'cta'],
|
|
26
|
+
metaLabelKeys: { titleKey: TITLE_KEY, descriptionKey: DESCRIPTION_KEY },
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
expect(manifest.ref as unknown as string).toBe('landing');
|
|
30
|
+
expect(manifest.routePath as unknown as string).toBe('/');
|
|
31
|
+
expect(manifest.sectionRefs.map((r) => r as unknown as string)).toEqual(['hero', 'cta']);
|
|
32
|
+
expect(manifest.metaLabelKeys.titleKey).toBe(TITLE_KEY);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('preserves the precise pageComponent prop type via the generic', () => {
|
|
36
|
+
const manifest = defineWebsitePageManifest<BlogPostPageProps>({
|
|
37
|
+
ref: 'blog-post',
|
|
38
|
+
routePath: '/blog/[slug]',
|
|
39
|
+
pageComponent: BlogPostPage,
|
|
40
|
+
sectionRefs: ['post-body'],
|
|
41
|
+
metaLabelKeys: {
|
|
42
|
+
titleKey: WebsiteLabelKeySchema.parse('website.blog-post.meta.title'),
|
|
43
|
+
descriptionKey: WebsiteLabelKeySchema.parse('website.blog-post.meta.description'),
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
expectTypeOf(manifest.pageComponent).toEqualTypeOf<
|
|
48
|
+
React.ComponentType<BlogPostPageProps>
|
|
49
|
+
>();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('rejects duplicate sectionRefs (schema superRefine)', () => {
|
|
53
|
+
expect(() =>
|
|
54
|
+
defineWebsitePageManifest({
|
|
55
|
+
ref: 'landing',
|
|
56
|
+
routePath: '/',
|
|
57
|
+
pageComponent: () => null,
|
|
58
|
+
sectionRefs: ['hero', 'hero'],
|
|
59
|
+
metaLabelKeys: { titleKey: TITLE_KEY, descriptionKey: DESCRIPTION_KEY },
|
|
60
|
+
}),
|
|
61
|
+
).toThrowError(/Duplicate sectionRef/);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('rejects metaLabelKeys not rooted under the page ref', () => {
|
|
65
|
+
expect(() =>
|
|
66
|
+
defineWebsitePageManifest({
|
|
67
|
+
ref: 'pricing',
|
|
68
|
+
routePath: '/pricing',
|
|
69
|
+
pageComponent: () => null,
|
|
70
|
+
sectionRefs: ['tiers'],
|
|
71
|
+
/**
|
|
72
|
+
* `landing` keys under a `pricing` page — the schema's
|
|
73
|
+
* `superRefine` enforces the page-prefix discipline.
|
|
74
|
+
*/
|
|
75
|
+
metaLabelKeys: { titleKey: TITLE_KEY, descriptionKey: DESCRIPTION_KEY },
|
|
76
|
+
}),
|
|
77
|
+
).toThrowError(/must be rooted under the page ref/);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('preserves the optional hydration field', () => {
|
|
81
|
+
const manifest = defineWebsitePageManifest({
|
|
82
|
+
ref: 'contact',
|
|
83
|
+
routePath: '/contact',
|
|
84
|
+
pageComponent: () => null,
|
|
85
|
+
sectionRefs: ['form'],
|
|
86
|
+
metaLabelKeys: {
|
|
87
|
+
titleKey: WebsiteLabelKeySchema.parse('website.contact.meta.title'),
|
|
88
|
+
descriptionKey: WebsiteLabelKeySchema.parse('website.contact.meta.description'),
|
|
89
|
+
},
|
|
90
|
+
hydration: WebsitePageHydrationStrategy.EAGER,
|
|
91
|
+
});
|
|
92
|
+
expect(manifest.hydration).toBe(WebsitePageHydrationStrategy.EAGER);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('preserves the optional seo field', () => {
|
|
96
|
+
const manifest = defineWebsitePageManifest({
|
|
97
|
+
ref: 'pricing',
|
|
98
|
+
routePath: '/pricing',
|
|
99
|
+
pageComponent: () => null,
|
|
100
|
+
sectionRefs: ['tiers'],
|
|
101
|
+
metaLabelKeys: {
|
|
102
|
+
titleKey: WebsiteLabelKeySchema.parse('website.pricing.meta.title'),
|
|
103
|
+
descriptionKey: WebsiteLabelKeySchema.parse('website.pricing.meta.description'),
|
|
104
|
+
},
|
|
105
|
+
seo: {
|
|
106
|
+
noaiOptOut: true,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
expect(manifest.seo?.noaiOptOut).toBe(true);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { describe, expect, expectTypeOf, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
defineWebsiteSection,
|
|
6
|
+
type TypedWebsiteSectionDefinition,
|
|
7
|
+
} from '../factories/define-website-section';
|
|
8
|
+
import { WebsiteSectionCategory } from '../../schemas/sections/website-section-category.shared';
|
|
9
|
+
|
|
10
|
+
interface HeroProps {
|
|
11
|
+
headlineKey: string;
|
|
12
|
+
subheadlineKey: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function HeroSection({ headlineKey }: HeroProps): React.ReactElement {
|
|
16
|
+
return <h1 data-testid="hero">{headlineKey}</h1>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
describe('defineWebsiteSection', () => {
|
|
20
|
+
it('produces a definition that round-trips through the schema', () => {
|
|
21
|
+
const def = defineWebsiteSection<HeroProps>({
|
|
22
|
+
sectionRef: 'hero',
|
|
23
|
+
category: WebsiteSectionCategory.HERO,
|
|
24
|
+
expectedLabelKeys: [
|
|
25
|
+
'website.landing.hero.headline',
|
|
26
|
+
'website.landing.hero.subheadline',
|
|
27
|
+
],
|
|
28
|
+
Component: HeroSection,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
expect(def.sectionRef as unknown as string).toBe('hero');
|
|
32
|
+
expect(def.category).toBe(WebsiteSectionCategory.HERO);
|
|
33
|
+
expect(def.expectedLabelKeys).toHaveLength(2);
|
|
34
|
+
expect(def.Component).toBe(HeroSection);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('preserves the precise component prop type via the generic', () => {
|
|
38
|
+
const def = defineWebsiteSection<HeroProps>({
|
|
39
|
+
sectionRef: 'hero',
|
|
40
|
+
category: WebsiteSectionCategory.HERO,
|
|
41
|
+
expectedLabelKeys: ['website.landing.hero.headline'],
|
|
42
|
+
Component: HeroSection,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Compile-time check: the returned `Component` must accept HeroProps,
|
|
47
|
+
* not the lowest-common-denominator `ComponentType<unknown>` that the
|
|
48
|
+
* schema-inferred type carries.
|
|
49
|
+
*/
|
|
50
|
+
expectTypeOf(def.Component).toEqualTypeOf<React.ComponentType<HeroProps>>();
|
|
51
|
+
expectTypeOf<TypedWebsiteSectionDefinition<HeroProps>['Component']>().toEqualTypeOf<
|
|
52
|
+
React.ComponentType<HeroProps>
|
|
53
|
+
>();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('validates malformed sectionRef at module-load time (parse-time fail-loud)', () => {
|
|
57
|
+
expect(() =>
|
|
58
|
+
defineWebsiteSection<Record<string, never>>({
|
|
59
|
+
sectionRef: 'INVALID UPPERCASE WITH SPACES',
|
|
60
|
+
category: WebsiteSectionCategory.HERO,
|
|
61
|
+
expectedLabelKeys: [],
|
|
62
|
+
Component: () => null,
|
|
63
|
+
}),
|
|
64
|
+
).toThrowError(/WebsiteSectionRef/);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('validates malformed expected label keys', () => {
|
|
68
|
+
expect(() =>
|
|
69
|
+
defineWebsiteSection<Record<string, never>>({
|
|
70
|
+
sectionRef: 'hero',
|
|
71
|
+
category: WebsiteSectionCategory.HERO,
|
|
72
|
+
expectedLabelKeys: ['not-a-valid-website-label-key'],
|
|
73
|
+
Component: () => null,
|
|
74
|
+
}),
|
|
75
|
+
).toThrowError(/WebsiteLabelKey/);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('preserves an optional getStructuredData hook', () => {
|
|
79
|
+
const getStructuredData = () => ({ '@type': 'Organization' });
|
|
80
|
+
const def = defineWebsiteSection<Record<string, never>>({
|
|
81
|
+
sectionRef: 'hero',
|
|
82
|
+
category: WebsiteSectionCategory.HERO,
|
|
83
|
+
expectedLabelKeys: ['website.landing.hero.headline'],
|
|
84
|
+
Component: () => null,
|
|
85
|
+
getStructuredData,
|
|
86
|
+
});
|
|
87
|
+
expect(def.getStructuredData).toBe(getStructuredData);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { renderHook } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
WebsiteRuntimeContextProvider,
|
|
7
|
+
type WebsiteRuntimeContextValue,
|
|
8
|
+
} from '../contexts/WebsiteRuntimeContext';
|
|
9
|
+
import { useWebsiteDesignTokens } from '../hooks/useWebsiteDesignTokens';
|
|
10
|
+
import { WebsiteLabelKeySchema } from '../../schemas/label-keys/website-label-key.schemas';
|
|
11
|
+
import { AvailableLanguage } from '@wildo-ai/saas-models/public-runtime';
|
|
12
|
+
|
|
13
|
+
const TOKENS = {
|
|
14
|
+
colors: {
|
|
15
|
+
background: '#fff', foreground: '#000', primary: '#000',
|
|
16
|
+
primaryForeground: '#fff', accent: '#000', accentForeground: '#fff',
|
|
17
|
+
surface: '#fff', surfaceForeground: '#000', border: '#ccc',
|
|
18
|
+
muted: '#eee', mutedForeground: '#666',
|
|
19
|
+
},
|
|
20
|
+
radii: { none: '0', sm: '2px', md: '4px', lg: '8px', xl: '12px', full: '9999px' },
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const RUNTIME: WebsiteRuntimeContextValue = {
|
|
24
|
+
locale: AvailableLanguage.EN,
|
|
25
|
+
defaultLocale: AvailableLanguage.EN,
|
|
26
|
+
labelPack: {},
|
|
27
|
+
designTokens: TOKENS,
|
|
28
|
+
navigation: { headerComponent: () => null, footerComponent: () => null },
|
|
29
|
+
skipToMainContentLabelKey: WebsiteLabelKeySchema.parse('website.chrome.layout.skip-to-main-content'),
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
describe('useWebsiteDesignTokens', () => {
|
|
33
|
+
it('returns the runtime context design tokens by reference', () => {
|
|
34
|
+
const { result } = renderHook(() => useWebsiteDesignTokens(), {
|
|
35
|
+
wrapper: ({ children }) => (
|
|
36
|
+
<WebsiteRuntimeContextProvider value={RUNTIME}>{children}</WebsiteRuntimeContextProvider>
|
|
37
|
+
),
|
|
38
|
+
});
|
|
39
|
+
expect(result.current).toBe(TOKENS);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { describe, expect, it, vi, afterEach } from 'vitest';
|
|
3
|
+
import { renderHook } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
WebsiteRuntimeContextProvider,
|
|
7
|
+
type WebsiteRuntimeContextValue,
|
|
8
|
+
} from '../contexts/WebsiteRuntimeContext';
|
|
9
|
+
import { WebsitePageContextProvider } from '../contexts/WebsitePageContext';
|
|
10
|
+
import { WebsiteSectionContextProvider } from '../contexts/WebsiteSectionContext';
|
|
11
|
+
import { useWebsiteLabel, useWebsiteLabelByKey } from '../hooks/useWebsiteLabel';
|
|
12
|
+
import { WebsitePageRefSchema } from '../../schemas/refs/page-ref.schemas';
|
|
13
|
+
import { WebsiteSectionRefSchema } from '../../schemas/refs/section-ref.schemas';
|
|
14
|
+
import { WebsiteSectionCategory } from '../../schemas/sections/website-section-category.shared';
|
|
15
|
+
import { WebsiteLabelKeySchema } from '../../schemas/label-keys/website-label-key.schemas';
|
|
16
|
+
import { AvailableLanguage } from '@wildo-ai/saas-models/public-runtime';
|
|
17
|
+
|
|
18
|
+
const RUNTIME: WebsiteRuntimeContextValue = {
|
|
19
|
+
locale: AvailableLanguage.EN,
|
|
20
|
+
defaultLocale: AvailableLanguage.EN,
|
|
21
|
+
labelPack: {
|
|
22
|
+
'website.landing.hero.headline': 'Welcome to Wonder Todos',
|
|
23
|
+
'website.landing.hero.cta.primary': 'Get started',
|
|
24
|
+
},
|
|
25
|
+
designTokens: {
|
|
26
|
+
colors: {
|
|
27
|
+
background: '#fff', foreground: '#000', primary: '#000',
|
|
28
|
+
primaryForeground: '#fff', accent: '#000', accentForeground: '#fff',
|
|
29
|
+
surface: '#fff', surfaceForeground: '#000', border: '#ccc',
|
|
30
|
+
muted: '#eee', mutedForeground: '#666',
|
|
31
|
+
},
|
|
32
|
+
radii: { none: '0', sm: '2px', md: '4px', lg: '8px', xl: '12px', full: '9999px' },
|
|
33
|
+
},
|
|
34
|
+
navigation: {
|
|
35
|
+
headerComponent: () => null,
|
|
36
|
+
footerComponent: () => null,
|
|
37
|
+
},
|
|
38
|
+
skipToMainContentLabelKey: WebsiteLabelKeySchema.parse('website.chrome.layout.skip-to-main-content'),
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const wrap =
|
|
42
|
+
(pageRef: string, sectionRef: string) =>
|
|
43
|
+
({ children }: { children: React.ReactNode }) => (
|
|
44
|
+
<WebsiteRuntimeContextProvider value={RUNTIME}>
|
|
45
|
+
<WebsitePageContextProvider value={{ pageRef: WebsitePageRefSchema.parse(pageRef) }}>
|
|
46
|
+
<WebsiteSectionContextProvider
|
|
47
|
+
value={{
|
|
48
|
+
sectionRef: WebsiteSectionRefSchema.parse(sectionRef),
|
|
49
|
+
category: WebsiteSectionCategory.HERO,
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
</WebsiteSectionContextProvider>
|
|
54
|
+
</WebsitePageContextProvider>
|
|
55
|
+
</WebsiteRuntimeContextProvider>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
afterEach(() => {
|
|
59
|
+
vi.restoreAllMocks();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('useWebsiteLabel', () => {
|
|
63
|
+
it('composes leaf with page+section context and resolves the label', () => {
|
|
64
|
+
const { result } = renderHook(() => useWebsiteLabel('headline'), {
|
|
65
|
+
wrapper: wrap('landing', 'hero'),
|
|
66
|
+
});
|
|
67
|
+
expect(result.current).toBe('Welcome to Wonder Todos');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('composes nested leaf paths (dot notation)', () => {
|
|
71
|
+
const { result } = renderHook(() => useWebsiteLabel('cta.primary'), {
|
|
72
|
+
wrapper: wrap('landing', 'hero'),
|
|
73
|
+
});
|
|
74
|
+
expect(result.current).toBe('Get started');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('returns the composed key + warns when the pack lacks the entry', () => {
|
|
78
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
|
|
79
|
+
const { result } = renderHook(() => useWebsiteLabel('missing-leaf'), {
|
|
80
|
+
wrapper: wrap('landing', 'hero'),
|
|
81
|
+
});
|
|
82
|
+
expect(result.current).toBe('website.landing.hero.missing-leaf');
|
|
83
|
+
expect(warn).toHaveBeenCalledOnce();
|
|
84
|
+
expect(warn.mock.calls[0]?.[0]).toMatch(/Missing label for key "website\.landing\.hero\.missing-leaf"/);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('throws when invoked outside any of the three required contexts', () => {
|
|
88
|
+
vi.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
89
|
+
expect(() => renderHook(() => useWebsiteLabel('headline'))).toThrowError(
|
|
90
|
+
/must be called inside <WebsiteRuntimeContextProvider>/,
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe('useWebsiteLabelByKey', () => {
|
|
96
|
+
it('looks up a fully-composed key', () => {
|
|
97
|
+
const key = WebsiteLabelKeySchema.parse('website.landing.hero.headline');
|
|
98
|
+
const { result } = renderHook(() => useWebsiteLabelByKey(key), {
|
|
99
|
+
wrapper: ({ children }) => (
|
|
100
|
+
<WebsiteRuntimeContextProvider value={RUNTIME}>{children}</WebsiteRuntimeContextProvider>
|
|
101
|
+
),
|
|
102
|
+
});
|
|
103
|
+
expect(result.current).toBe('Welcome to Wonder Todos');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('returns the key + warns on miss', () => {
|
|
107
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
|
|
108
|
+
const key = WebsiteLabelKeySchema.parse('website.landing.hero.missing');
|
|
109
|
+
const { result } = renderHook(() => useWebsiteLabelByKey(key), {
|
|
110
|
+
wrapper: ({ children }) => (
|
|
111
|
+
<WebsiteRuntimeContextProvider value={RUNTIME}>{children}</WebsiteRuntimeContextProvider>
|
|
112
|
+
),
|
|
113
|
+
});
|
|
114
|
+
expect(result.current).toBe('website.landing.hero.missing');
|
|
115
|
+
expect(warn).toHaveBeenCalledOnce();
|
|
116
|
+
});
|
|
117
|
+
});
|