@woodsportal/hubspot-kit 1.0.41-dev.4 → 1.0.41-dev.6
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/CHANGELOG.md +7 -0
- package/README.md +191 -157
- package/dist/{chunk-S2YJDWZU.js → chunk-NWBK3XBZ.js} +1 -1
- package/dist/chunk-NWBK3XBZ.js.map +1 -0
- package/dist/chunk-WHYTQEZX.js +554 -0
- package/dist/chunk-WHYTQEZX.js.map +1 -0
- package/dist/cli.js +1494 -650
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/scaffold-page-lifecycle-EHMPWPPE.js +194 -0
- package/dist/scaffold-page-lifecycle-EHMPWPPE.js.map +1 -0
- package/dist/vite/index.js +1 -1
- package/examples/greenfield/module-hybrid-cdn/public/fields.json +73 -28
- package/examples/greenfield/module-hybrid-cdn/public/module.html +21 -5
- package/examples/greenfield/module-hybrid-cdn/src/assets/css/main.dev.css +15 -0
- package/examples/greenfield/module-hybrid-cdn/src/components/layout/starter-nav.tsx +12 -15
- package/examples/greenfield/module-hybrid-cdn/src/config/starter-nav.ts +9 -0
- package/examples/greenfield/module-hybrid-cdn/src/features/starter/components/starter-home.tsx +25 -29
- package/examples/greenfield/module-hybrid-cdn/src/features/starter/hooks/starter-preview-values.ts +60 -0
- package/examples/greenfield/module-hybrid-cdn/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
- package/examples/greenfield/module-hybrid-cdn/src/features/starter/hooks/use-starter-preview.ts +20 -37
- package/examples/greenfield/module-hybrid-cdn-auth-full/.env.dev.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/.env.local.example +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/.env.prod.example +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/.env.stg.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/.wphs/README.md +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/README.md +59 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/hubspot.config.yml.example +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/index.html +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/package.json +34 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/portal.cdn.json.example +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/public/fields.json +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/public/meta.json +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/public/module.html +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/app.tsx +172 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/assets/css/main.dev.css +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/assets/css/main.prod.css +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/assets/css/tailwind.css.config.css +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/cdn/app-entry.ts +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/cdn/vendor-entry.ts +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/AuthLayout.tsx +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/DefaultLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/MainLayout.tsx +42 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/index.ts +13 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/layout/section-card.tsx +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/layout/starter-nav.tsx +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/layout/starter-shell.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/Button.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/Form.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/Input.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/Toaster.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/auth/SsoLoginButton.tsx +34 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/link.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/loader/loader.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/auth-tier.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/nav-scaffold.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/portal-nav.ts +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/router.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/routes.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/data/hubSpotContext.ts +57 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/data/sync-sdk-hub-context.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/defaultData.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/env.ts +59 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/app-bootstrap-guards.ts +14 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/auth-navigation.ts +81 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/auth-route-paths.ts +29 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/auth-session-events.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/auth-session.ts +51 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/clear-client-auth-session.ts +62 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/components/starter-login.tsx +83 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/login-email-storage.ts +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/login-session-bridge.ts +74 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/mfa-otp-utils.ts +24 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/mfa-pending-storage.ts +108 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/mfa-portal.ts +45 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/post-login-path.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/resolve-auth-login-error-message.ts +52 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/resolve-post-login-path.ts +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/sso-callback.ts +120 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/use-mfa-login-otp-flow.ts +78 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/use-portal-session.ts +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/use-signed-in-email.ts +55 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/use-sso-callback-handler.ts +92 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-guide-page.tsx +210 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-home-page.tsx +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-home.tsx +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-page-frame.tsx +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-protected-page.tsx +54 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-single-page.tsx +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/content/auth-guide-content.ts +85 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/content/woodscli-guide-content.ts +86 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/hooks/starter-preview-values.ts +60 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/hooks/use-starter-preview.ts +30 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/index.ts +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/bootstrap.ts +16 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/default-data.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/is-cms-editor.ts +78 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/module-entry.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/types.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/integrations/configure-woodsportal-sdk.ts +98 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/integrations/tanstack-query/root-provider.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/integrations/tanstack-router/router.tsx +39 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/integrations/woodsportal-sdk.ts +37 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/main.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/portal/api-endpoint.ts +11 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/portal/ensure-portal-cdn-stylesheet.ts +115 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/portal/mount-dev-preview.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/portal/mount-portal.tsx +57 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routeTree.gen.ts +182 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/__root.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/_app/portal.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/_auth/login/sso.tsx +27 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/_auth/login.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/_auth/two-fa.tsx +91 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/guide.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/index.tsx +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/unauthorized.tsx +50 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/ValidationSchema.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/cookie.ts +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/normalize-router-path.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/private-route.tsx +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/public-route.tsx +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/resolve-api-base-url.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/safe-router-navigation.ts +82 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/tsconfig.json +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.cdn-app.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.cdn-esm.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.cdn-vendor.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.dev.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.hubspot.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.monolith.mjs +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/woodscli.json +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/wphs.adapter.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/.env.dev.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/.env.local.example +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/.env.prod.example +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/.env.stg.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/.wphs/README.md +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/README.md +59 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/hubspot.config.yml.example +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/index.html +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/package.json +34 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/portal.cdn.json.example +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/public/fields.json +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/public/meta.json +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/public/module.html +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/app.tsx +180 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/assets/css/main.dev.css +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/assets/css/main.prod.css +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/assets/css/tailwind.css.config.css +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/cdn/app-entry.ts +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/cdn/vendor-entry.ts +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/AuthLayout.tsx +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/DefaultLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/MainLayout.tsx +42 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/index.ts +13 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/layout/section-card.tsx +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/layout/starter-nav.tsx +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/layout/starter-shell.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/Button.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/Form.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/Input.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/Toaster.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/auth/SsoLoginButton.tsx +34 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/link.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/loader/loader.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/auth-tier.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/nav-scaffold.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/portal-nav.ts +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/router.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/routes.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/data/hubSpotContext.ts +57 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/data/sync-sdk-hub-context.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/defaultData.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/env.ts +59 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/app-bootstrap-guards.ts +14 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/auth-navigation.ts +81 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/auth-route-paths.ts +29 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/auth-session-events.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/auth-session.ts +26 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/clear-client-auth-session.ts +62 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/components/starter-login.tsx +83 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/login-email-storage.ts +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/login-session-bridge.ts +72 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/post-login-path.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/resolve-auth-login-error-message.ts +52 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/resolve-post-login-path.ts +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/sso-callback.ts +120 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/use-portal-session.ts +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/use-signed-in-email.ts +55 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/use-sso-callback-handler.ts +92 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-guide-page.tsx +210 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-home-page.tsx +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-home.tsx +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-page-frame.tsx +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-protected-page.tsx +54 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-single-page.tsx +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/content/auth-guide-content.ts +85 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/content/woodscli-guide-content.ts +86 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/hooks/starter-preview-values.ts +60 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/hooks/use-starter-preview.ts +30 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/index.ts +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/bootstrap.ts +16 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/default-data.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/is-cms-editor.ts +78 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/module-entry.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/types.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/integrations/configure-woodsportal-sdk.ts +94 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/integrations/tanstack-query/root-provider.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/integrations/tanstack-router/router.tsx +39 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/integrations/woodsportal-sdk.ts +37 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/main.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/portal/api-endpoint.ts +11 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/portal/ensure-portal-cdn-stylesheet.ts +115 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/portal/mount-dev-preview.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/portal/mount-portal.tsx +57 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routeTree.gen.ts +155 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/__root.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/_app/portal.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/_auth/login/sso.tsx +27 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/_auth/login.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/guide.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/index.tsx +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/unauthorized.tsx +50 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/ValidationSchema.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/cookie.ts +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/normalize-router-path.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/private-route.tsx +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/public-route.tsx +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/resolve-api-base-url.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/safe-router-navigation.ts +82 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/tsconfig.json +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.cdn-app.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.cdn-esm.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.cdn-vendor.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.dev.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.hubspot.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.monolith.mjs +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/woodscli.json +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/wphs.adapter.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/.env.dev.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/.env.local.example +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/.env.prod.example +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/.env.stg.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/.wphs/README.md +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/README.md +59 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/hubspot.config.yml.example +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/index.html +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/package.json +34 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/portal.cdn.json.example +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/public/fields.json +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/public/meta.json +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/public/module.html +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/app.tsx +173 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/assets/css/main.dev.css +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/assets/css/main.prod.css +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/assets/css/tailwind.css.config.css +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/cdn/app-entry.ts +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/cdn/vendor-entry.ts +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/AuthLayout.tsx +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/DefaultLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/MainLayout.tsx +42 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/index.ts +13 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/layout/section-card.tsx +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/layout/starter-nav.tsx +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/layout/starter-shell.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/Button.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/Form.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/Input.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/Toaster.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/link.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/loader/loader.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/auth-tier.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/nav-scaffold.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/portal-nav.ts +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/router.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/routes.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/data/hubSpotContext.ts +57 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/data/sync-sdk-hub-context.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/defaultData.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/env.ts +59 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/app-bootstrap-guards.ts +14 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/auth-navigation.ts +81 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/auth-route-paths.ts +29 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/auth-session-events.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/auth-session.ts +26 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/clear-client-auth-session.ts +62 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/components/starter-login.tsx +76 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/login-email-storage.ts +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/login-session-bridge.ts +72 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/post-login-path.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/resolve-auth-login-error-message.ts +52 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/resolve-post-login-path.ts +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/use-portal-session.ts +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/use-signed-in-email.ts +55 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-guide-page.tsx +218 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-home-page.tsx +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-home.tsx +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-page-frame.tsx +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-protected-page.tsx +54 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-single-page.tsx +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/content/auth-guide-content.ts +91 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/content/woodscli-guide-content.ts +86 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/hooks/starter-preview-values.ts +60 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/hooks/use-starter-preview.ts +30 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/index.ts +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/bootstrap.ts +16 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/default-data.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/is-cms-editor.ts +78 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/module-entry.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/types.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/integrations/configure-woodsportal-sdk.ts +94 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/integrations/tanstack-query/root-provider.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/integrations/tanstack-router/router.tsx +39 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/integrations/woodsportal-sdk.ts +37 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/main.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/portal/api-endpoint.ts +11 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/portal/ensure-portal-cdn-stylesheet.ts +115 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/portal/mount-dev-preview.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/portal/mount-portal.tsx +52 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routeTree.gen.ts +134 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/__root.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/_app/portal.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/_auth/login.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/guide.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/index.tsx +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/unauthorized.tsx +50 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/ValidationSchema.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/cookie.ts +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/normalize-router-path.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/private-route.tsx +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/public-route.tsx +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/resolve-api-base-url.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/safe-router-navigation.ts +82 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/tsconfig.json +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.cdn-app.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.cdn-esm.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.cdn-vendor.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.dev.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.hubspot.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.monolith.mjs +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/woodscli.json +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/wphs.adapter.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.env.dev.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.env.local.example +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.env.prod.example +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.env.stg.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.wphs/README.md +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/README.md +59 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/hubspot.config.yml.example +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/index.html +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/package.json +34 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/portal.cdn.json.example +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/public/fields.json +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/public/meta.json +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/public/module.html +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/app.tsx +173 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/assets/css/main.dev.css +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/assets/css/main.prod.css +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/assets/css/tailwind.css.config.css +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/cdn/app-entry.ts +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/cdn/vendor-entry.ts +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/AuthLayout.tsx +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/DefaultLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/MainLayout.tsx +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/index.ts +13 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/portal-sidebar-nav.tsx +33 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/portal-sidebar.tsx +139 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/section-card.tsx +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/starter-nav.tsx +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/starter-shell.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/Button.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/Form.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/Input.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/Toaster.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/link.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/loader/loader.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/auth-tier.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/nav-scaffold.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/portal-nav.ts +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/router.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/routes.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/data/hubSpotContext.ts +57 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/data/sync-sdk-hub-context.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/defaultData.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/env.ts +59 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/app-bootstrap-guards.ts +14 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/auth-navigation.ts +81 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/auth-route-paths.ts +29 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/auth-session-events.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/auth-session.ts +26 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/clear-client-auth-session.ts +62 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/components/starter-login.tsx +76 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/login-email-storage.ts +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/login-session-bridge.ts +72 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/post-login-path.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/resolve-auth-login-error-message.ts +52 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/resolve-post-login-path.ts +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/use-portal-session.ts +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/use-signed-in-email.ts +55 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-guide-page.tsx +210 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-home-page.tsx +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-home.tsx +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-page-frame.tsx +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-protected-page.tsx +54 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-single-page.tsx +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/content/auth-guide-content.ts +85 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/content/woodscli-guide-content.ts +86 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/hooks/starter-preview-values.ts +60 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/hooks/use-starter-preview.ts +30 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/index.ts +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/bootstrap.ts +16 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/default-data.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/is-cms-editor.ts +78 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/module-entry.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/types.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/integrations/configure-woodsportal-sdk.ts +94 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/integrations/tanstack-query/root-provider.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/integrations/tanstack-router/router.tsx +39 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/integrations/woodsportal-sdk.ts +37 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/main.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/portal/api-endpoint.ts +11 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/portal/ensure-portal-cdn-stylesheet.ts +115 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/portal/mount-dev-preview.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/portal/mount-portal.tsx +52 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routeTree.gen.ts +134 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/__root.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/_app/portal.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/_auth/login.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/guide.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/index.tsx +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/unauthorized.tsx +50 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/ValidationSchema.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/cookie.ts +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/normalize-router-path.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/private-route.tsx +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/public-route.tsx +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/resolve-api-base-url.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/safe-router-navigation.ts +82 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/tsconfig.json +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.cdn-app.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.cdn-esm.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.cdn-vendor.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.dev.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.hubspot.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.monolith.mjs +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/woodscli.json +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/wphs.adapter.ts +7 -0
- package/examples/greenfield/module-monolith/public/fields.json +66 -16
- package/examples/greenfield/module-monolith/src/assets/css/main.dev.css +7 -0
- package/examples/greenfield/module-monolith/src/components/layout/starter-nav.tsx +12 -15
- package/examples/greenfield/module-monolith/src/config/starter-nav.ts +9 -0
- package/examples/greenfield/module-monolith/src/features/starter/components/starter-home.tsx +25 -29
- package/examples/greenfield/module-monolith/src/features/starter/hooks/starter-preview-values.ts +60 -0
- package/examples/greenfield/module-monolith/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
- package/examples/greenfield/module-monolith/src/features/starter/hooks/use-starter-preview.ts +20 -37
- package/examples/manifest.json +5 -1
- package/examples/smoke/run-matrix.mjs +37 -0
- package/package.json +7 -5
- package/scripts/cli-smoke-helpers.mjs +150 -0
- package/scripts/regenerate-route-tree.mjs +71 -0
- package/scripts/sync-auth-scaffold-from-client.mjs +41 -0
- package/scripts/wp-cli-smoke.test.mjs +263 -0
- package/src/dev/bootstrap-greenfield.tsx +6 -0
- package/templates/module-hybrid-cdn/public/fields.json +47 -7
- package/templates/module-hybrid-cdn/public/module.html +7 -6
- package/templates/module-hybrid-cdn/src/assets/css/main.dev.css +7 -0
- package/templates/module-hybrid-cdn/src/components/layout/starter-nav.tsx +12 -15
- package/templates/module-hybrid-cdn/src/config/starter-nav.ts +9 -0
- package/templates/module-hybrid-cdn/src/features/starter/components/starter-home.tsx +25 -27
- package/templates/module-hybrid-cdn/src/features/starter/hooks/starter-preview-values.ts +5 -5
- package/templates/module-monolith/public/fields.json +49 -6
- package/templates/module-monolith/src/assets/css/main.dev.css +7 -0
- package/templates/module-monolith/src/components/layout/starter-nav.tsx +12 -15
- package/templates/module-monolith/src/config/starter-nav.ts +9 -0
- package/templates/module-monolith/src/features/starter/components/starter-home.tsx +25 -27
- package/templates/module-monolith/src/features/starter/hooks/starter-preview-values.ts +5 -5
- package/templates/scaffold/auth/_full/src/app.tsx +172 -0
- package/templates/scaffold/auth/_full/src/config/auth-tier.ts +4 -0
- package/templates/scaffold/auth/_full/src/features/auth/auth-session.ts +51 -0
- package/templates/scaffold/auth/_full/src/features/auth/login-session-bridge.ts +74 -0
- package/templates/scaffold/auth/_full/src/features/auth/mfa-otp-utils.ts +24 -0
- package/templates/scaffold/auth/_full/src/features/auth/mfa-pending-storage.ts +108 -0
- package/templates/scaffold/auth/_full/src/features/auth/mfa-portal.ts +45 -0
- package/templates/scaffold/auth/_full/src/features/auth/use-mfa-login-otp-flow.ts +78 -0
- package/templates/scaffold/auth/_full/src/routeTree.gen.ts +182 -0
- package/templates/scaffold/auth/_full/src/routes/_auth/two-fa.tsx +91 -0
- package/templates/scaffold/auth/_nav-sidebar/src/components/Layouts/MainLayout.tsx +7 -0
- package/templates/scaffold/auth/_nav-sidebar/src/components/layout/portal-sidebar-nav.tsx +33 -0
- package/templates/scaffold/auth/_nav-sidebar/src/components/layout/portal-sidebar.tsx +139 -0
- package/templates/scaffold/auth/_nav-top/src/components/Layouts/MainLayout.tsx +42 -0
- package/templates/scaffold/auth/_shared/src/app.tsx +178 -0
- package/templates/scaffold/auth/_shared/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
- package/templates/scaffold/auth/_shared/src/components/Layouts/AuthLayout.tsx +7 -0
- package/templates/scaffold/auth/_shared/src/components/Layouts/DefaultLayout.tsx +5 -0
- package/templates/scaffold/auth/_shared/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
- package/templates/scaffold/auth/_shared/src/components/Layouts/index.ts +13 -0
- package/templates/scaffold/auth/_shared/src/components/ui/Button.tsx +22 -0
- package/templates/scaffold/auth/_shared/src/components/ui/Form.tsx +22 -0
- package/templates/scaffold/auth/_shared/src/components/ui/Input.tsx +12 -0
- package/templates/scaffold/auth/_shared/src/components/ui/Toaster.tsx +5 -0
- package/templates/scaffold/auth/_shared/src/components/ui/link.tsx +10 -0
- package/templates/scaffold/auth/_shared/src/components/ui/loader/loader.tsx +18 -0
- package/templates/scaffold/auth/_shared/src/config/auth-tier.ts +4 -0
- package/templates/scaffold/auth/_shared/src/config/nav-scaffold.ts +4 -0
- package/templates/scaffold/auth/_shared/src/config/portal-nav.ts +9 -0
- package/templates/scaffold/auth/_shared/src/config/router.ts +1 -0
- package/templates/scaffold/auth/_shared/src/config/routes.ts +10 -0
- package/templates/scaffold/auth/_shared/src/data/hubSpotContext.ts +57 -0
- package/templates/scaffold/auth/_shared/src/data/sync-sdk-hub-context.ts +44 -0
- package/templates/scaffold/auth/_shared/src/env.ts +59 -0
- package/templates/scaffold/auth/_shared/src/features/auth/app-bootstrap-guards.ts +14 -0
- package/templates/scaffold/auth/_shared/src/features/auth/auth-navigation.ts +81 -0
- package/templates/scaffold/auth/_shared/src/features/auth/auth-route-paths.ts +29 -0
- package/templates/scaffold/auth/_shared/src/features/auth/auth-session-events.ts +2 -0
- package/templates/scaffold/auth/_shared/src/features/auth/auth-session.ts +26 -0
- package/templates/scaffold/auth/_shared/src/features/auth/clear-client-auth-session.ts +62 -0
- package/templates/scaffold/auth/_shared/src/features/auth/components/starter-login.tsx +76 -0
- package/templates/scaffold/auth/_shared/src/features/auth/login-email-storage.ts +64 -0
- package/templates/scaffold/auth/_shared/src/features/auth/login-session-bridge.ts +72 -0
- package/templates/scaffold/auth/_shared/src/features/auth/post-login-path.ts +17 -0
- package/templates/scaffold/auth/_shared/src/features/auth/resolve-auth-login-error-message.ts +52 -0
- package/templates/scaffold/auth/_shared/src/features/auth/resolve-post-login-path.ts +21 -0
- package/templates/scaffold/auth/_shared/src/features/auth/use-portal-session.ts +25 -0
- package/templates/scaffold/auth/_shared/src/features/auth/use-signed-in-email.ts +55 -0
- package/templates/scaffold/auth/_shared/src/features/starter/components/starter-guide-page.tsx +218 -0
- package/templates/scaffold/auth/_shared/src/features/starter/components/starter-page-frame.tsx +25 -0
- package/templates/scaffold/auth/_shared/src/features/starter/components/starter-protected-page.tsx +54 -0
- package/templates/scaffold/auth/_shared/src/features/starter/content/auth-guide-content.ts +91 -0
- package/templates/scaffold/auth/_shared/src/hubspot/is-cms-editor.ts +78 -0
- package/templates/scaffold/auth/_shared/src/integrations/configure-woodsportal-sdk.ts +100 -0
- package/templates/scaffold/auth/_shared/src/integrations/tanstack-query/root-provider.tsx +18 -0
- package/templates/scaffold/auth/_shared/src/integrations/tanstack-router/router.tsx +39 -0
- package/templates/scaffold/auth/_shared/src/integrations/woodsportal-sdk.ts +37 -0
- package/templates/scaffold/auth/_shared/src/portal/mount-portal.tsx +59 -0
- package/templates/scaffold/auth/_shared/src/routeTree.gen.ts +134 -0
- package/templates/scaffold/auth/_shared/src/routes/__root.tsx +12 -0
- package/templates/scaffold/auth/_shared/src/routes/_app/portal.tsx +10 -0
- package/templates/scaffold/auth/_shared/src/routes/_auth/login.tsx +10 -0
- package/templates/scaffold/auth/_shared/src/routes/guide.tsx +9 -0
- package/templates/scaffold/auth/_shared/src/routes/index.tsx +8 -0
- package/templates/scaffold/auth/_shared/src/routes/unauthorized.tsx +50 -0
- package/templates/scaffold/auth/_shared/src/utils/ValidationSchema.ts +1 -0
- package/templates/scaffold/auth/_shared/src/utils/cookie.ts +23 -0
- package/templates/scaffold/auth/_shared/src/utils/normalize-router-path.ts +10 -0
- package/templates/scaffold/auth/_shared/src/utils/private-route.tsx +100 -0
- package/templates/scaffold/auth/_shared/src/utils/public-route.tsx +64 -0
- package/templates/scaffold/auth/_shared/src/utils/resolve-api-base-url.ts +44 -0
- package/templates/scaffold/auth/_shared/src/utils/safe-router-navigation.ts +82 -0
- package/templates/scaffold/auth/_sso/src/app.tsx +180 -0
- package/templates/scaffold/auth/_sso/src/components/ui/auth/SsoLoginButton.tsx +34 -0
- package/templates/scaffold/auth/_sso/src/config/auth-tier.ts +4 -0
- package/templates/scaffold/auth/_sso/src/features/auth/components/starter-login.tsx +83 -0
- package/templates/scaffold/auth/_sso/src/features/auth/sso-callback.ts +120 -0
- package/templates/scaffold/auth/_sso/src/features/auth/use-sso-callback-handler.ts +92 -0
- package/templates/scaffold/auth/_sso/src/routeTree.gen.ts +155 -0
- package/templates/scaffold/auth/_sso/src/routes/_auth/login/sso.tsx +27 -0
- package/templates/scaffold/auth/nav-manifest.json +8 -0
- package/templates/scaffold/auth/sync-manifest.json +16 -0
- package/templates/scaffold/auth/tier-manifest.json +18 -0
- package/templates/scaffold/page/page-component-auth.tsx.tpl +10 -0
- package/templates/scaffold/page/page-component-plain.tsx.tpl +11 -0
- package/templates/scaffold/page/route-protected-auth.tsx.tpl +10 -0
- package/templates/scaffold/page/route-public-auth.tsx.tpl +9 -0
- package/templates/scaffold/page/route-public-plain.tsx.tpl +6 -0
- package/dist/chunk-S2YJDWZU.js.map +0 -1
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { SectionCard } from '@/components/layout/section-card'
|
|
2
|
+
import { Link } from '@/components/ui/link'
|
|
3
|
+
import { AUTH_SCAFFOLD_TIER } from '@/config/auth-tier'
|
|
4
|
+
import { NAV_SCAFFOLD_MODE } from '@/config/nav-scaffold'
|
|
5
|
+
import { Routes } from '@/config/routes'
|
|
6
|
+
import {
|
|
7
|
+
AUTH_BOOT_STEPS,
|
|
8
|
+
AUTH_ENV_VARS,
|
|
9
|
+
AUTH_INIT_EXAMPLES,
|
|
10
|
+
AUTH_NAV_EXAMPLES,
|
|
11
|
+
AUTH_PROJECT_PATHS,
|
|
12
|
+
AUTH_TIER_DESCRIPTION,
|
|
13
|
+
PORTAL_AUTH_VS_HUBSPOT,
|
|
14
|
+
authRoutesForTier,
|
|
15
|
+
} from '@/features/starter/content/auth-guide-content'
|
|
16
|
+
import {
|
|
17
|
+
DEV_WORKFLOW,
|
|
18
|
+
PROJECT_LAYOUT,
|
|
19
|
+
WOODSCLI_ABOUT,
|
|
20
|
+
WOODSCLI_COMMANDS,
|
|
21
|
+
} from '@/features/starter/content/woodscli-guide-content'
|
|
22
|
+
import { StarterPageFrame } from '@/features/starter/components/starter-page-frame'
|
|
23
|
+
|
|
24
|
+
export function StarterGuidePage() {
|
|
25
|
+
const tier = AUTH_SCAFFOLD_TIER
|
|
26
|
+
const routes = authRoutesForTier(tier)
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<StarterPageFrame
|
|
30
|
+
className="max-w-4xl"
|
|
31
|
+
title="Developer guide"
|
|
32
|
+
description={
|
|
33
|
+
<>
|
|
34
|
+
WoodsCLI module with portal auth (<strong>{tier}</strong> tier). Use this page for
|
|
35
|
+
commands, project layout, and auth wiring — then replace the starter features with your CRM
|
|
36
|
+
UI under <code className="rounded bg-gray-100 px-1 text-xs">src/features/</code>.
|
|
37
|
+
</>
|
|
38
|
+
}
|
|
39
|
+
>
|
|
40
|
+
<div className="space-y-6">
|
|
41
|
+
<SectionCard title={`Portal auth — ${tier} tier`}>
|
|
42
|
+
<p className="text-sm leading-relaxed text-[#516f90]">{AUTH_TIER_DESCRIPTION[tier]}</p>
|
|
43
|
+
<ul className="mt-4 list-disc space-y-2 pl-5 text-sm text-[#516f90]">
|
|
44
|
+
<li>
|
|
45
|
+
<Link to={Routes.login}>Sign in</Link> at <code className="font-mono text-xs">/#/login</code>{' '}
|
|
46
|
+
(posts <code className="font-mono text-xs">username</code> + password to{' '}
|
|
47
|
+
<code className="font-mono text-xs">/api/auth/login</code>).
|
|
48
|
+
</li>
|
|
49
|
+
<li>
|
|
50
|
+
After login, visit the protected sample at{' '}
|
|
51
|
+
<Link to={Routes.portal}>/portal</Link> — session + profile via{' '}
|
|
52
|
+
<code className="font-mono text-xs">GET /api/auth/me</code>.
|
|
53
|
+
</li>
|
|
54
|
+
<li>
|
|
55
|
+
Set <code className="font-mono text-xs">VITE_PUBLIC_REST_API_ENDPOINT</code> in{' '}
|
|
56
|
+
<code className="font-mono text-xs">.env.local</code> after{' '}
|
|
57
|
+
<code className="font-mono text-xs">wp setup</code>.
|
|
58
|
+
</li>
|
|
59
|
+
</ul>
|
|
60
|
+
<p className="mt-4 text-xs text-[#516f90]">
|
|
61
|
+
Re-scaffold:{' '}
|
|
62
|
+
<code className="rounded bg-[#eaf0f6] px-1.5 py-0.5 font-mono">{AUTH_INIT_EXAMPLES[tier]}</code>
|
|
63
|
+
</p>
|
|
64
|
+
</SectionCard>
|
|
65
|
+
|
|
66
|
+
<SectionCard title={`Navigation — ${NAV_SCAFFOLD_MODE} shell`}>
|
|
67
|
+
<p className="text-sm leading-relaxed text-[#516f90]">
|
|
68
|
+
Menu links come from{' '}
|
|
69
|
+
<code className="rounded bg-gray-100 px-1 text-xs">src/config/portal-nav.ts</code> — edit
|
|
70
|
+
once for both top nav and sidebar layouts.
|
|
71
|
+
</p>
|
|
72
|
+
<p className="mt-4 text-xs text-[#516f90]">
|
|
73
|
+
Sidebar init:{' '}
|
|
74
|
+
<code className="rounded bg-[#eaf0f6] px-1.5 py-0.5 font-mono">
|
|
75
|
+
{AUTH_NAV_EXAMPLES.sidebar}
|
|
76
|
+
</code>
|
|
77
|
+
</p>
|
|
78
|
+
</SectionCard>
|
|
79
|
+
|
|
80
|
+
<SectionCard title="Auth routes (this tier)">
|
|
81
|
+
<ul className="divide-y divide-[#eaf0f6]">
|
|
82
|
+
{routes.map(({ path, access }) => (
|
|
83
|
+
<li key={path} className="flex flex-col gap-1 py-3 first:pt-0 last:pb-0 sm:flex-row sm:gap-4">
|
|
84
|
+
<code className="shrink-0 rounded bg-[#eaf0f6] px-2 py-1 font-mono text-xs text-[#0091ae]">
|
|
85
|
+
{path}
|
|
86
|
+
</code>
|
|
87
|
+
<span className="text-sm leading-relaxed text-[#516f90]">{access}</span>
|
|
88
|
+
</li>
|
|
89
|
+
))}
|
|
90
|
+
</ul>
|
|
91
|
+
</SectionCard>
|
|
92
|
+
|
|
93
|
+
<SectionCard title="Two auth concepts">
|
|
94
|
+
<ul className="space-y-4">
|
|
95
|
+
{PORTAL_AUTH_VS_HUBSPOT.map(({ label, cmds, purpose }) => (
|
|
96
|
+
<li key={label}>
|
|
97
|
+
<h3 className="text-sm font-medium text-[#33475b]">{label}</h3>
|
|
98
|
+
<p className="mt-1 font-mono text-xs text-[#0091ae]">{cmds}</p>
|
|
99
|
+
<p className="mt-1 text-sm leading-relaxed text-[#516f90]">{purpose}</p>
|
|
100
|
+
</li>
|
|
101
|
+
))}
|
|
102
|
+
</ul>
|
|
103
|
+
</SectionCard>
|
|
104
|
+
|
|
105
|
+
<SectionCard title="Environment (.env.local)">
|
|
106
|
+
<ul className="space-y-3">
|
|
107
|
+
{AUTH_ENV_VARS.map(({ name, note }) => (
|
|
108
|
+
<li key={name} className="text-sm leading-relaxed">
|
|
109
|
+
<code className="rounded bg-[#eaf0f6] px-1.5 py-0.5 font-mono text-xs text-[#33475b]">
|
|
110
|
+
{name}
|
|
111
|
+
</code>
|
|
112
|
+
<span className="mt-1 block text-[#516f90] sm:mt-0 sm:inline sm:before:content-['—_']">
|
|
113
|
+
{note}
|
|
114
|
+
</span>
|
|
115
|
+
</li>
|
|
116
|
+
))}
|
|
117
|
+
</ul>
|
|
118
|
+
</SectionCard>
|
|
119
|
+
|
|
120
|
+
<SectionCard title="Session boot order">
|
|
121
|
+
<ol className="list-decimal space-y-2 pl-5 text-sm leading-relaxed text-[#516f90]">
|
|
122
|
+
{AUTH_BOOT_STEPS.map((step) => (
|
|
123
|
+
<li key={step}>{step}</li>
|
|
124
|
+
))}
|
|
125
|
+
</ol>
|
|
126
|
+
</SectionCard>
|
|
127
|
+
|
|
128
|
+
<SectionCard title="About WoodsCLI">
|
|
129
|
+
<p className="text-sm leading-relaxed text-[#516f90]">{WOODSCLI_ABOUT.tagline}</p>
|
|
130
|
+
<p className="mt-3 text-sm leading-relaxed text-[#516f90]">{WOODSCLI_ABOUT.docsHint}</p>
|
|
131
|
+
</SectionCard>
|
|
132
|
+
|
|
133
|
+
<SectionCard title="Essential commands">
|
|
134
|
+
<ul className="divide-y divide-[#eaf0f6]">
|
|
135
|
+
{WOODSCLI_COMMANDS.map(({ cmd, desc }) => (
|
|
136
|
+
<li key={cmd} className="flex flex-col gap-1 py-3 first:pt-0 last:pb-0 sm:flex-row sm:gap-4">
|
|
137
|
+
<code className="shrink-0 rounded bg-[#eaf0f6] px-2 py-1 font-mono text-xs text-[#0091ae]">
|
|
138
|
+
{cmd}
|
|
139
|
+
</code>
|
|
140
|
+
<span className="text-sm leading-relaxed text-[#516f90]">{desc}</span>
|
|
141
|
+
</li>
|
|
142
|
+
))}
|
|
143
|
+
</ul>
|
|
144
|
+
</SectionCard>
|
|
145
|
+
|
|
146
|
+
<SectionCard title="Auth-related paths">
|
|
147
|
+
<ul className="space-y-3">
|
|
148
|
+
{AUTH_PROJECT_PATHS.map(({ path, note }) => (
|
|
149
|
+
<li key={path} className="text-sm leading-relaxed">
|
|
150
|
+
<code className="rounded bg-[#eaf0f6] px-1.5 py-0.5 font-mono text-xs text-[#33475b]">
|
|
151
|
+
{path}
|
|
152
|
+
</code>
|
|
153
|
+
<span className="mt-1 block text-[#516f90] sm:mt-0 sm:inline sm:before:content-['—_']">
|
|
154
|
+
{note}
|
|
155
|
+
</span>
|
|
156
|
+
</li>
|
|
157
|
+
))}
|
|
158
|
+
</ul>
|
|
159
|
+
</SectionCard>
|
|
160
|
+
|
|
161
|
+
<SectionCard title="Project layout">
|
|
162
|
+
<ul className="space-y-3">
|
|
163
|
+
{PROJECT_LAYOUT.map(({ path, note }) => (
|
|
164
|
+
<li key={path} className="text-sm leading-relaxed">
|
|
165
|
+
<code className="rounded bg-[#eaf0f6] px-1.5 py-0.5 font-mono text-xs text-[#33475b]">
|
|
166
|
+
{path}
|
|
167
|
+
</code>
|
|
168
|
+
<span className="mt-1 block text-[#516f90] sm:mt-0 sm:inline sm:before:content-['—_']">
|
|
169
|
+
{note}
|
|
170
|
+
</span>
|
|
171
|
+
</li>
|
|
172
|
+
))}
|
|
173
|
+
</ul>
|
|
174
|
+
</SectionCard>
|
|
175
|
+
|
|
176
|
+
<SectionCard title="Developer workflow">
|
|
177
|
+
<ol className="space-y-4">
|
|
178
|
+
<li>
|
|
179
|
+
<h3 className="text-sm font-medium text-[#33475b]">0 · Verify portal login</h3>
|
|
180
|
+
<p className="mt-1 text-sm leading-relaxed text-[#516f90]">
|
|
181
|
+
Run <code className="font-mono text-xs">wp dev</code>, open{' '}
|
|
182
|
+
<Link to={Routes.login}>/#/login</Link>, and confirm you reach{' '}
|
|
183
|
+
<Link to={Routes.portal}>/portal</Link> with an active session before building CRM
|
|
184
|
+
features.
|
|
185
|
+
</p>
|
|
186
|
+
</li>
|
|
187
|
+
{DEV_WORKFLOW.map(({ title: stepTitle, body }) => (
|
|
188
|
+
<li key={stepTitle}>
|
|
189
|
+
<h3 className="text-sm font-medium text-[#33475b]">{stepTitle}</h3>
|
|
190
|
+
<p className="mt-1 text-sm leading-relaxed text-[#516f90]">{body}</p>
|
|
191
|
+
</li>
|
|
192
|
+
))}
|
|
193
|
+
</ol>
|
|
194
|
+
</SectionCard>
|
|
195
|
+
|
|
196
|
+
<SectionCard title="Routing & customization">
|
|
197
|
+
<p className="text-sm leading-relaxed text-[#516f90]">
|
|
198
|
+
File routes live under <code className="font-mono text-xs">src/routes/</code> and delegate
|
|
199
|
+
to <code className="font-mono text-xs">src/features/</code>. Hash history is the default
|
|
200
|
+
for HubSpot CMS embeds. Add protected routes with{' '}
|
|
201
|
+
<code className="font-mono text-xs">beforeLoad: {'() => ({ requiresAuth: true })'}</code>.
|
|
202
|
+
Replace <code className="font-mono text-xs">src/features/starter/</code> when you outgrow
|
|
203
|
+
the demo. Kit docs:{' '}
|
|
204
|
+
<code className="font-mono text-xs">node_modules/@woodsportal/hubspot-kit/docs/AUTH-SCAFFOLD.md</code>.
|
|
205
|
+
</p>
|
|
206
|
+
</SectionCard>
|
|
207
|
+
</div>
|
|
208
|
+
</StarterPageFrame>
|
|
209
|
+
)
|
|
210
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Link } from '@tanstack/react-router'
|
|
2
|
+
|
|
3
|
+
import { ROUTES } from '@/config/routes'
|
|
4
|
+
|
|
5
|
+
import { StarterHome } from './starter-home'
|
|
6
|
+
|
|
7
|
+
export function StarterHomePage() {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<StarterHome />
|
|
11
|
+
<div className="mx-auto max-w-4xl px-6 pb-10 sm:px-10">
|
|
12
|
+
<Link
|
|
13
|
+
to={ROUTES.guide}
|
|
14
|
+
className="inline-flex items-center rounded-md bg-[#0091ae] px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-[#007a8c]"
|
|
15
|
+
>
|
|
16
|
+
Open developer guide →
|
|
17
|
+
</Link>
|
|
18
|
+
</div>
|
|
19
|
+
</>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useStarterPreview } from '../hooks/use-starter-preview'
|
|
2
|
+
import { STARTER_FEATURES, WOODSCLI_ABOUT } from '../content/woodscli-guide-content'
|
|
3
|
+
|
|
4
|
+
export function StarterHome() {
|
|
5
|
+
const { title, tagline, showFeatureCards, heroStyle } = useStarterPreview()
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
<section
|
|
10
|
+
className={
|
|
11
|
+
heroStyle === 'minimal'
|
|
12
|
+
? 'px-6 py-14 sm:px-10 sm:py-16 bg-[var(--mc-bg-shell,#f5f8fa)] text-[var(--mc-text,#33475b)] border-b border-[var(--mc-border,#cbd6e2)]'
|
|
13
|
+
: heroStyle === 'bold'
|
|
14
|
+
? 'px-6 py-14 sm:px-10 sm:py-16 bg-[#1c1c1f] text-white'
|
|
15
|
+
: 'px-6 py-14 sm:px-10 sm:py-16 bg-gradient-to-br from-[var(--primary-color,#FF7A59)] to-[var(--secondary-color,#2797AF)] text-white'
|
|
16
|
+
}
|
|
17
|
+
>
|
|
18
|
+
<div className="mx-auto max-w-4xl">
|
|
19
|
+
<p className="mb-2 text-xs font-semibold uppercase tracking-widest opacity-80">
|
|
20
|
+
{WOODSCLI_ABOUT.package} · local dev
|
|
21
|
+
</p>
|
|
22
|
+
<h1 className="text-3xl font-semibold tracking-tight sm:text-4xl">{title}</h1>
|
|
23
|
+
<p className="mt-4 max-w-2xl text-base leading-relaxed opacity-90 sm:text-lg">{tagline}</p>
|
|
24
|
+
<p className="mt-6 text-sm opacity-75">
|
|
25
|
+
Module config overlay:{' '}
|
|
26
|
+
<kbd className="rounded bg-black/10 px-1.5 py-0.5 font-mono text-xs">Ctrl+Shift+Z</kbd>
|
|
27
|
+
{' · '}
|
|
28
|
+
Mac: <kbd className="rounded bg-black/10 px-1.5 py-0.5 font-mono text-xs">⌃⇧Z</kbd>
|
|
29
|
+
</p>
|
|
30
|
+
</div>
|
|
31
|
+
</section>
|
|
32
|
+
|
|
33
|
+
{showFeatureCards ? (
|
|
34
|
+
<div className="mx-auto grid max-w-4xl gap-4 px-6 py-10 sm:grid-cols-3 sm:px-10">
|
|
35
|
+
{STARTER_FEATURES.map((feature) => (
|
|
36
|
+
<article
|
|
37
|
+
key={feature.title}
|
|
38
|
+
className="rounded-lg border border-[#cbd6e2] bg-white p-5 shadow-sm"
|
|
39
|
+
>
|
|
40
|
+
<h2 className="text-sm font-semibold text-[var(--primary-color,#FF7A59)]">{feature.title}</h2>
|
|
41
|
+
<p className="mt-2 text-sm leading-relaxed text-[#516f90]">{feature.body}</p>
|
|
42
|
+
</article>
|
|
43
|
+
))}
|
|
44
|
+
</div>
|
|
45
|
+
) : null}
|
|
46
|
+
</>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
type StarterPageFrameProps = {
|
|
4
|
+
title: string
|
|
5
|
+
description?: ReactNode
|
|
6
|
+
children?: ReactNode
|
|
7
|
+
className?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function StarterPageFrame({
|
|
11
|
+
title,
|
|
12
|
+
description,
|
|
13
|
+
children,
|
|
14
|
+
className = 'max-w-2xl',
|
|
15
|
+
}: StarterPageFrameProps) {
|
|
16
|
+
return (
|
|
17
|
+
<div className={`mx-auto space-y-4 ${className}`}>
|
|
18
|
+
<div>
|
|
19
|
+
<h1 className="text-2xl font-semibold text-gray-900">{title}</h1>
|
|
20
|
+
{description ? <p className="mt-2 text-gray-600">{description}</p> : null}
|
|
21
|
+
</div>
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useRouter } from '@tanstack/react-router'
|
|
2
|
+
|
|
3
|
+
import { Button } from '@/components/ui/Button'
|
|
4
|
+
import { Routes } from '@/config/routes'
|
|
5
|
+
import { clearClientAuthSession } from '@/features/auth/clear-client-auth-session'
|
|
6
|
+
import { useSignedInEmail } from '@/features/auth/use-signed-in-email'
|
|
7
|
+
import { usePortalSession } from '@/features/auth/use-portal-session'
|
|
8
|
+
import { StarterPageFrame } from '@/features/starter/components/starter-page-frame'
|
|
9
|
+
import { api } from '@/integrations/woodsportal-sdk'
|
|
10
|
+
|
|
11
|
+
export function StarterProtectedPage() {
|
|
12
|
+
const isAuthenticated = usePortalSession()
|
|
13
|
+
const { email, isLoading } = useSignedInEmail()
|
|
14
|
+
const router = useRouter()
|
|
15
|
+
|
|
16
|
+
const signedInLabel = isLoading ? 'Loading…' : (email ?? 'Signed in')
|
|
17
|
+
|
|
18
|
+
const handleLogout = async () => {
|
|
19
|
+
clearClientAuthSession()
|
|
20
|
+
try {
|
|
21
|
+
const { logout } = api.auth.logout({})
|
|
22
|
+
await logout()
|
|
23
|
+
} catch {
|
|
24
|
+
// local state already cleared
|
|
25
|
+
}
|
|
26
|
+
router.navigate({ to: Routes.login })
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<StarterPageFrame
|
|
31
|
+
title="Protected portal"
|
|
32
|
+
description={
|
|
33
|
+
<>
|
|
34
|
+
You reached <code className="rounded bg-gray-100 px-1">/portal</code> — sample authenticated
|
|
35
|
+
page for the auth scaffold.
|
|
36
|
+
</>
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
<dl className="rounded-lg border border-gray-200 bg-gray-50 p-4 text-sm">
|
|
40
|
+
<div className="flex justify-between gap-4">
|
|
41
|
+
<dt className="text-gray-500">Session</dt>
|
|
42
|
+
<dd className="font-medium text-gray-900">{isAuthenticated ? 'Active' : 'None'}</dd>
|
|
43
|
+
</div>
|
|
44
|
+
<div className="mt-2 flex justify-between gap-4">
|
|
45
|
+
<dt className="text-gray-500">Signed in as</dt>
|
|
46
|
+
<dd className="font-medium text-gray-900">{signedInLabel}</dd>
|
|
47
|
+
</div>
|
|
48
|
+
</dl>
|
|
49
|
+
<Button variant="outline" onClick={() => void handleLogout()}>
|
|
50
|
+
Sign out
|
|
51
|
+
</Button>
|
|
52
|
+
</StarterPageFrame>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StarterShell } from '@/components/layout/starter-shell'
|
|
2
|
+
|
|
3
|
+
import { StarterGuidePage } from './starter-guide-page'
|
|
4
|
+
import { StarterHome } from './starter-home'
|
|
5
|
+
|
|
6
|
+
/** Single-page starter when `wp init --router none` (no TanStack Router). */
|
|
7
|
+
export function StarterSinglePage() {
|
|
8
|
+
return (
|
|
9
|
+
<StarterShell showNav={false}>
|
|
10
|
+
<StarterHome />
|
|
11
|
+
<div className="mx-auto max-w-4xl px-6 sm:px-10">
|
|
12
|
+
<hr className="my-10 border-[#cbd6e2]" />
|
|
13
|
+
</div>
|
|
14
|
+
<StarterGuidePage />
|
|
15
|
+
</StarterShell>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export type AuthTierName = 'starter' | 'sso' | 'full'
|
|
2
|
+
|
|
3
|
+
export const AUTH_TIER_DESCRIPTION: Record<AuthTierName, string> = {
|
|
4
|
+
starter: 'Email + password login with a protected /portal sample page.',
|
|
5
|
+
sso: 'Starter login plus SSO OAuth callback handling at /login/sso.',
|
|
6
|
+
full: 'SSO plus MFA gate at /two-fa — recommended when the hub enforces 2FA.',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const AUTH_ENV_VARS = [
|
|
10
|
+
{
|
|
11
|
+
name: 'VITE_PUBLIC_REST_API_ENDPOINT',
|
|
12
|
+
note: 'woodsportal-api base URL (required for login). Example: https://api.dev.woodsportal.com',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'VITE_DEV_PORTAL_ID',
|
|
16
|
+
note: 'Optional local dev portal id — sent as X-Dev-Portal-Id when logging in.',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'VITE_REFRESH_TOKEN',
|
|
20
|
+
note: 'Cookie name for the refresh token (not the token value). Default: wp.c.auth.refresh',
|
|
21
|
+
},
|
|
22
|
+
] as const
|
|
23
|
+
|
|
24
|
+
export const AUTH_BOOT_STEPS = [
|
|
25
|
+
'mountPortal → syncSdkHubContextFromRuntime',
|
|
26
|
+
'configureWoodsPortalSdk (woodsportal-client-sdk HTTP client)',
|
|
27
|
+
'SSO URL normalization (sso / full tiers)',
|
|
28
|
+
'App bootstrap refresh (existing refresh cookie)',
|
|
29
|
+
'TanStack Router + PublicRoute / PrivateRoute guards',
|
|
30
|
+
'MainLayout → api.auth.me() (GET /api/auth/me) when authenticated',
|
|
31
|
+
] as const
|
|
32
|
+
|
|
33
|
+
export const AUTH_PROJECT_PATHS = [
|
|
34
|
+
{ path: 'src/config/auth-tier.ts', note: 'Scaffold tier patched by wp init (starter | sso | full)' },
|
|
35
|
+
{ path: 'src/config/portal-nav.ts', note: 'Shared nav links for top nav and sidebar layouts' },
|
|
36
|
+
{ path: 'src/config/nav-scaffold.ts', note: 'Nav shell mode patched by wp init (top | sidebar)' },
|
|
37
|
+
{ path: 'src/features/auth/', note: 'Login UI, session bridge, route guards, email storage' },
|
|
38
|
+
{ path: 'src/integrations/configure-woodsportal-sdk.ts', note: 'SDK HTTP init — API URL, cookies, routes' },
|
|
39
|
+
{ path: 'src/integrations/woodsportal-sdk.ts', note: 'Single import surface for api.auth.* and api.crm.*' },
|
|
40
|
+
{ path: 'src/app.tsx', note: 'Session bootstrap before RouterProvider mounts' },
|
|
41
|
+
{ path: 'src/utils/public-route.tsx', note: 'Redirects authenticated users away from /login' },
|
|
42
|
+
{ path: 'src/utils/private-route.tsx', note: 'Protects routes with requiresAuth: true' },
|
|
43
|
+
] as const
|
|
44
|
+
|
|
45
|
+
export const AUTH_INIT_EXAMPLES: Record<AuthTierName, string> = {
|
|
46
|
+
starter:
|
|
47
|
+
'npx wp init -t module-hybrid-cdn -n my-portal --router hash --auth starter -y',
|
|
48
|
+
sso: 'npx wp init -t module-hybrid-cdn -n my-portal --router hash --auth sso -y',
|
|
49
|
+
full: 'npx wp init -t module-hybrid-cdn -n my-portal --router hash --auth full -y',
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const AUTH_NAV_EXAMPLES = {
|
|
53
|
+
top: 'npx wp init -t module-hybrid-cdn -n my-portal --router hash --auth starter -y',
|
|
54
|
+
sidebar:
|
|
55
|
+
'npx wp init -t module-hybrid-cdn -n my-portal --router hash --auth starter --nav sidebar -y',
|
|
56
|
+
} as const
|
|
57
|
+
|
|
58
|
+
export function authRoutesForTier(tier: AuthTierName): Array<{ path: string; access: string }> {
|
|
59
|
+
const routes = [
|
|
60
|
+
{ path: '/guide', access: 'Public — this page' },
|
|
61
|
+
{ path: '/login', access: 'Public — email + password' },
|
|
62
|
+
{ path: '/portal', access: 'Protected — sample page after login' },
|
|
63
|
+
{ path: '/unauthorized', access: 'Public' },
|
|
64
|
+
]
|
|
65
|
+
if (tier === 'sso' || tier === 'full') {
|
|
66
|
+
routes.splice(2, 0, { path: '/login/sso', access: 'Public — SSO OAuth callback' })
|
|
67
|
+
}
|
|
68
|
+
if (tier === 'full') {
|
|
69
|
+
routes.splice(3, 0, { path: '/two-fa', access: 'Public — MFA OTP gate' })
|
|
70
|
+
}
|
|
71
|
+
return routes
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const PORTAL_AUTH_VS_HUBSPOT = [
|
|
75
|
+
{
|
|
76
|
+
label: 'HubSpot CLI auth',
|
|
77
|
+
cmds: 'wp auth · wp portal use',
|
|
78
|
+
purpose: 'Upload/watch module files to Design Manager',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: 'Portal user auth',
|
|
82
|
+
cmds: 'wp init --auth starter|sso|full',
|
|
83
|
+
purpose: 'End users sign in via woodsportal-api + woodsportal-client-sdk',
|
|
84
|
+
},
|
|
85
|
+
] as const
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Static WoodsCLI developer reference — shown on the wp init starter pages. */
|
|
2
|
+
|
|
3
|
+
export const WOODSCLI_COMMANDS = [
|
|
4
|
+
{
|
|
5
|
+
cmd: 'wp dev',
|
|
6
|
+
desc: 'Local Vite preview + module-config overlay (this page). Alias: wp local.',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
cmd: 'wp doctor',
|
|
10
|
+
desc: 'Validate Node, deps, .wphs/, index.html, fields.json, and HubSpot CLI setup.',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
cmd: 'wp build --tier prod',
|
|
14
|
+
desc: 'Production build (CDN bundle and/or HubSpot module, per projectType).',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
cmd: 'wp deploy --tier prod',
|
|
18
|
+
desc: 'Build, publish CDN artifacts, and upload the module to HubSpot.',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
cmd: 'wp setup',
|
|
22
|
+
desc: 'Copy hubspot.config.yml, .env.*, and vite shims from kit templates.',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
cmd: 'wp migrate --yes',
|
|
26
|
+
desc: 'Move legacy .dev/ or woodsportal.hs.json to .wphs/ + woodscli.json.',
|
|
27
|
+
},
|
|
28
|
+
] as const
|
|
29
|
+
|
|
30
|
+
export const PROJECT_LAYOUT = [
|
|
31
|
+
{ path: 'woodscli.json', note: 'Project config — module paths, entries, dev.adapter' },
|
|
32
|
+
{ path: 'public/fields.json', note: 'HubSpot module field schema (Content / Styles tabs)' },
|
|
33
|
+
{ path: '.wphs/', note: 'Local workspace — config, fixtures, kit symlinks (gitignore most)' },
|
|
34
|
+
{ path: 'wphs.adapter.ts', note: 'Syncs module field values → window.__WPHS_DATA__ in dev' },
|
|
35
|
+
{ path: 'src/config/router.ts', note: 'Hash vs browser history — set by wp init (hash = client-frontend)' },
|
|
36
|
+
{ path: 'src/routes/', note: 'TanStack Router file routes (thin — delegate to features/)' },
|
|
37
|
+
{ path: 'src/app.tsx', note: 'RouterProvider shell — same role as woodsportal-client-frontend App' },
|
|
38
|
+
{ path: 'src/features/starter/', note: 'Starter demo UI — replace with your portal features' },
|
|
39
|
+
{ path: 'src/portal/', note: 'Dev vs production mount (mount-dev-preview, mount-portal)' },
|
|
40
|
+
{ path: 'src/integrations/', note: 'Third-party wiring (TanStack Router, SDK, etc.)' },
|
|
41
|
+
{ path: 'src/hubspot/', note: 'HubSpot runtime types and dev fixtures' },
|
|
42
|
+
{ path: 'src/main.tsx', note: 'Dev entry — mounts overlay + routed preview' },
|
|
43
|
+
{ path: 'hubspot.config.yml', note: 'HubSpot CLI portal + PAT (copy from .example)' },
|
|
44
|
+
] as const
|
|
45
|
+
|
|
46
|
+
export const DEV_WORKFLOW = [
|
|
47
|
+
{
|
|
48
|
+
title: '1 · Edit module fields',
|
|
49
|
+
body: 'Press Ctrl+Shift+Z (Mac ⌃⇧Z) to open the HubSpot-style Content / Styles panel. Changes apply to the preview after you click Apply changes.',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: '2 · Iterate in src/',
|
|
53
|
+
body: 'Add features under src/features/, shared UI under src/components/, and wire HubSpot data via wphs.adapter.ts and public/fields.json.',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
title: '3 · Connect HubSpot',
|
|
57
|
+
body: 'Copy hubspot.config.yml.example → hubspot.config.yml, add a personal access key, then wp upload or wp watch for CMS sync.',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
title: '4 · Ship',
|
|
61
|
+
body: 'Hybrid CDN: wp deploy. Monolith: wp build --hubspot-only then wp upload.',
|
|
62
|
+
},
|
|
63
|
+
] as const
|
|
64
|
+
|
|
65
|
+
export const WOODSCLI_ABOUT = {
|
|
66
|
+
package: '@woodsportal/hubspot-kit',
|
|
67
|
+
tagline:
|
|
68
|
+
'WoodsCLI is WoodsPortal’s dev kit for HubSpot CMS modules and themes — Vite local preview, fields.json editing, CDN + module build pipelines, and HubSpot CLI integration.',
|
|
69
|
+
docsHint:
|
|
70
|
+
'Full command list and guides ship in node_modules/@woodsportal/hubspot-kit/docs/ (CLI-REFERENCE.md, MODULES.md, HUBSPOT-CLI-SETUP.md).',
|
|
71
|
+
} as const
|
|
72
|
+
|
|
73
|
+
export const STARTER_FEATURES = [
|
|
74
|
+
{
|
|
75
|
+
title: 'Module fields',
|
|
76
|
+
body: 'Content and Styles tabs mirror HubSpot’s module editor. Apply changes to refresh this preview.',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
title: 'Local persistence',
|
|
80
|
+
body: 'Saved values land in .wphs/config/module-config.local.json — safe to gitignore.',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
title: 'Ship when ready',
|
|
84
|
+
body: 'Run wp build and wp deploy when your module is ready for HubSpot.',
|
|
85
|
+
},
|
|
86
|
+
] as const
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type StarterPreviewValues = {
|
|
2
|
+
title: string
|
|
3
|
+
tagline: string
|
|
4
|
+
showFeatureCards: boolean
|
|
5
|
+
heroStyle: 'gradient' | 'minimal' | 'bold'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function normalizeHeroStyle(raw: unknown): StarterPreviewValues['heroStyle'] {
|
|
9
|
+
const key = String(raw ?? 'gradient').toLowerCase()
|
|
10
|
+
if (key === 'minimal' || key === 'bold') return key
|
|
11
|
+
return 'gradient'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** CONTENT-tab fields may live under a `content` group (fields.json) or flat legacy keys. */
|
|
15
|
+
function readContentField(module: Record<string, unknown>, key: string): unknown {
|
|
16
|
+
const content = module.content
|
|
17
|
+
if (content && typeof content === 'object' && key in (content as Record<string, unknown>)) {
|
|
18
|
+
return (content as Record<string, unknown>)[key]
|
|
19
|
+
}
|
|
20
|
+
return module[key]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** STYLE-tab fields may live under a `style` group (fields.json) or legacy `styles` / flat keys. */
|
|
24
|
+
function readStyleField(module: Record<string, unknown>, key: string): unknown {
|
|
25
|
+
const style = module.style
|
|
26
|
+
if (style && typeof style === 'object' && key in (style as Record<string, unknown>)) {
|
|
27
|
+
return (style as Record<string, unknown>)[key]
|
|
28
|
+
}
|
|
29
|
+
const styles = module.styles
|
|
30
|
+
if (styles && typeof styles === 'object' && key in (styles as Record<string, unknown>)) {
|
|
31
|
+
return (styles as Record<string, unknown>)[key]
|
|
32
|
+
}
|
|
33
|
+
return module[key]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function mapStarterPreviewValues(module: Record<string, unknown>): StarterPreviewValues {
|
|
37
|
+
return {
|
|
38
|
+
title: String(readContentField(module, 'title') ?? 'My HubSpot Portal'),
|
|
39
|
+
tagline: String(
|
|
40
|
+
readContentField(module, 'tagline') ??
|
|
41
|
+
'Customize this preview with Ctrl+Shift+Z, then replace this page with your portal app.',
|
|
42
|
+
),
|
|
43
|
+
showFeatureCards: readContentField(module, 'show_feature_cards') !== false,
|
|
44
|
+
heroStyle: normalizeHeroStyle(readStyleField(module, 'hero_style')),
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** HubSpot module field blob on window (dev adapter + CMS runtime). */
|
|
49
|
+
export function readStarterModuleFields(): Record<string, unknown> {
|
|
50
|
+
const win = window as Window & {
|
|
51
|
+
__WPHS_DATA__?: Record<string, unknown>
|
|
52
|
+
hubSpotData?: Record<string, unknown>
|
|
53
|
+
}
|
|
54
|
+
const blob = win.__WPHS_DATA__ ?? win.hubSpotData ?? {}
|
|
55
|
+
const nested = blob.module
|
|
56
|
+
if (nested && typeof nested === 'object') {
|
|
57
|
+
return nested as Record<string, unknown>
|
|
58
|
+
}
|
|
59
|
+
return blob
|
|
60
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MODULE_CONFIG_CHANGED } from '@/dev/module-config/schema/types'
|
|
2
|
+
import { getModuleFieldValues } from '@/dev/module-config/runtime/module-config-runtime'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
mapStarterPreviewValues,
|
|
6
|
+
type StarterPreviewValues,
|
|
7
|
+
} from './starter-preview-values'
|
|
8
|
+
|
|
9
|
+
/** Dev-only: refresh when module-config overlay applies changes. */
|
|
10
|
+
export function subscribeStarterPreview(
|
|
11
|
+
onChange: (values: StarterPreviewValues) => void,
|
|
12
|
+
): () => void {
|
|
13
|
+
const refresh = () => onChange(mapStarterPreviewValues(getModuleFieldValues()))
|
|
14
|
+
|
|
15
|
+
refresh()
|
|
16
|
+
window.addEventListener(MODULE_CONFIG_CHANGED, refresh)
|
|
17
|
+
return () => window.removeEventListener(MODULE_CONFIG_CHANGED, refresh)
|
|
18
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
mapStarterPreviewValues,
|
|
5
|
+
readStarterModuleFields,
|
|
6
|
+
type StarterPreviewValues,
|
|
7
|
+
} from './starter-preview-values'
|
|
8
|
+
|
|
9
|
+
/** Module field values for the starter preview (dev overlay + production window data). */
|
|
10
|
+
export function useStarterPreview(): StarterPreviewValues {
|
|
11
|
+
const [values, setValues] = useState(() => mapStarterPreviewValues(readStarterModuleFields()))
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!import.meta.env.DEV) {
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let unsubscribe = () => {}
|
|
19
|
+
|
|
20
|
+
void import('./use-starter-preview.dev').then(({ subscribeStarterPreview }) => {
|
|
21
|
+
unsubscribe = subscribeStarterPreview(setValues)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
return () => unsubscribe()
|
|
25
|
+
}, [])
|
|
26
|
+
|
|
27
|
+
return values
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type { StarterPreviewValues } from './starter-preview-values'
|