@woodsportal/hubspot-kit 1.0.41 → 1.0.42-dev.0

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.
Files changed (598) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +191 -157
  3. package/dist/{chunk-S2YJDWZU.js → chunk-NWBK3XBZ.js} +1 -1
  4. package/dist/chunk-NWBK3XBZ.js.map +1 -0
  5. package/dist/chunk-WHYTQEZX.js +554 -0
  6. package/dist/chunk-WHYTQEZX.js.map +1 -0
  7. package/dist/cli.js +1778 -864
  8. package/dist/cli.js.map +1 -1
  9. package/dist/ensure-wphs-workspace-5S3GTO6K.js +234 -0
  10. package/dist/ensure-wphs-workspace-5S3GTO6K.js.map +1 -0
  11. package/dist/index.d.ts +12 -0
  12. package/dist/index.js +6 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/scaffold-page-lifecycle-EHMPWPPE.js +194 -0
  15. package/dist/scaffold-page-lifecycle-EHMPWPPE.js.map +1 -0
  16. package/dist/vite/index.js +1 -1
  17. package/examples/greenfield/module-hybrid-cdn/public/fields.json +73 -28
  18. package/examples/greenfield/module-hybrid-cdn/public/module.html +21 -5
  19. package/examples/greenfield/module-hybrid-cdn/src/assets/css/main.dev.css +15 -0
  20. package/examples/greenfield/module-hybrid-cdn/src/components/layout/starter-nav.tsx +12 -15
  21. package/examples/greenfield/module-hybrid-cdn/src/config/starter-nav.ts +9 -0
  22. package/examples/greenfield/module-hybrid-cdn/src/features/starter/components/starter-home.tsx +25 -29
  23. package/examples/greenfield/module-hybrid-cdn/src/features/starter/hooks/starter-preview-values.ts +60 -0
  24. package/examples/greenfield/module-hybrid-cdn/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
  25. package/examples/greenfield/module-hybrid-cdn/src/features/starter/hooks/use-starter-preview.ts +20 -37
  26. package/examples/greenfield/module-hybrid-cdn-auth-full/.env.dev.example +3 -0
  27. package/examples/greenfield/module-hybrid-cdn-auth-full/.env.local.example +6 -0
  28. package/examples/greenfield/module-hybrid-cdn-auth-full/.env.prod.example +5 -0
  29. package/examples/greenfield/module-hybrid-cdn-auth-full/.env.stg.example +3 -0
  30. package/examples/greenfield/module-hybrid-cdn-auth-full/.wphs/README.md +17 -0
  31. package/examples/greenfield/module-hybrid-cdn-auth-full/README.md +59 -0
  32. package/examples/greenfield/module-hybrid-cdn-auth-full/hubspot.config.yml.example +10 -0
  33. package/examples/greenfield/module-hybrid-cdn-auth-full/index.html +12 -0
  34. package/examples/greenfield/module-hybrid-cdn-auth-full/package.json +34 -0
  35. package/examples/greenfield/module-hybrid-cdn-auth-full/portal.cdn.json.example +8 -0
  36. package/examples/greenfield/module-hybrid-cdn-auth-full/public/fields.json +100 -0
  37. package/examples/greenfield/module-hybrid-cdn-auth-full/public/meta.json +9 -0
  38. package/examples/greenfield/module-hybrid-cdn-auth-full/public/module.html +38 -0
  39. package/examples/greenfield/module-hybrid-cdn-auth-full/src/app.tsx +172 -0
  40. package/examples/greenfield/module-hybrid-cdn-auth-full/src/assets/css/main.dev.css +23 -0
  41. package/examples/greenfield/module-hybrid-cdn-auth-full/src/assets/css/main.prod.css +12 -0
  42. package/examples/greenfield/module-hybrid-cdn-auth-full/src/assets/css/tailwind.css.config.css +7 -0
  43. package/examples/greenfield/module-hybrid-cdn-auth-full/src/cdn/app-entry.ts +48 -0
  44. package/examples/greenfield/module-hybrid-cdn-auth-full/src/cdn/vendor-entry.ts +28 -0
  45. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
  46. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/AuthLayout.tsx +7 -0
  47. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/DefaultLayout.tsx +5 -0
  48. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/MainLayout.tsx +42 -0
  49. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
  50. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/index.ts +13 -0
  51. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/layout/section-card.tsx +20 -0
  52. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/layout/starter-nav.tsx +28 -0
  53. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/layout/starter-shell.tsx +18 -0
  54. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/Button.tsx +22 -0
  55. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/Form.tsx +22 -0
  56. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/Input.tsx +12 -0
  57. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/Toaster.tsx +5 -0
  58. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/auth/SsoLoginButton.tsx +34 -0
  59. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/link.tsx +10 -0
  60. package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/loader/loader.tsx +18 -0
  61. package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/auth-tier.ts +4 -0
  62. package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/nav-scaffold.ts +4 -0
  63. package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/portal-nav.ts +9 -0
  64. package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/router.ts +1 -0
  65. package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/routes.ts +10 -0
  66. package/examples/greenfield/module-hybrid-cdn-auth-full/src/data/hubSpotContext.ts +57 -0
  67. package/examples/greenfield/module-hybrid-cdn-auth-full/src/data/sync-sdk-hub-context.ts +44 -0
  68. package/examples/greenfield/module-hybrid-cdn-auth-full/src/defaultData.ts +2 -0
  69. package/examples/greenfield/module-hybrid-cdn-auth-full/src/env.ts +59 -0
  70. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/app-bootstrap-guards.ts +14 -0
  71. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/auth-navigation.ts +81 -0
  72. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/auth-route-paths.ts +29 -0
  73. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/auth-session-events.ts +2 -0
  74. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/auth-session.ts +51 -0
  75. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/clear-client-auth-session.ts +62 -0
  76. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/components/starter-login.tsx +83 -0
  77. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/login-email-storage.ts +64 -0
  78. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/login-session-bridge.ts +74 -0
  79. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/mfa-otp-utils.ts +24 -0
  80. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/mfa-pending-storage.ts +108 -0
  81. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/mfa-portal.ts +45 -0
  82. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/post-login-path.ts +17 -0
  83. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/resolve-auth-login-error-message.ts +52 -0
  84. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/resolve-post-login-path.ts +21 -0
  85. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/sso-callback.ts +120 -0
  86. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/use-mfa-login-otp-flow.ts +78 -0
  87. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/use-portal-session.ts +25 -0
  88. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/use-signed-in-email.ts +55 -0
  89. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/use-sso-callback-handler.ts +92 -0
  90. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-guide-page.tsx +210 -0
  91. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-home-page.tsx +21 -0
  92. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-home.tsx +48 -0
  93. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-page-frame.tsx +25 -0
  94. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-protected-page.tsx +54 -0
  95. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-single-page.tsx +17 -0
  96. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/content/auth-guide-content.ts +85 -0
  97. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/content/woodscli-guide-content.ts +86 -0
  98. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/hooks/starter-preview-values.ts +60 -0
  99. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
  100. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/hooks/use-starter-preview.ts +30 -0
  101. package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/index.ts +6 -0
  102. package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/bootstrap.ts +16 -0
  103. package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/default-data.ts +7 -0
  104. package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/is-cms-editor.ts +78 -0
  105. package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/module-entry.tsx +9 -0
  106. package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/types.ts +17 -0
  107. package/examples/greenfield/module-hybrid-cdn-auth-full/src/integrations/configure-woodsportal-sdk.ts +98 -0
  108. package/examples/greenfield/module-hybrid-cdn-auth-full/src/integrations/tanstack-query/root-provider.tsx +18 -0
  109. package/examples/greenfield/module-hybrid-cdn-auth-full/src/integrations/tanstack-router/router.tsx +39 -0
  110. package/examples/greenfield/module-hybrid-cdn-auth-full/src/integrations/woodsportal-sdk.ts +37 -0
  111. package/examples/greenfield/module-hybrid-cdn-auth-full/src/main.tsx +5 -0
  112. package/examples/greenfield/module-hybrid-cdn-auth-full/src/portal/api-endpoint.ts +11 -0
  113. package/examples/greenfield/module-hybrid-cdn-auth-full/src/portal/ensure-portal-cdn-stylesheet.ts +115 -0
  114. package/examples/greenfield/module-hybrid-cdn-auth-full/src/portal/mount-dev-preview.tsx +12 -0
  115. package/examples/greenfield/module-hybrid-cdn-auth-full/src/portal/mount-portal.tsx +57 -0
  116. package/examples/greenfield/module-hybrid-cdn-auth-full/src/routeTree.gen.ts +182 -0
  117. package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/__root.tsx +12 -0
  118. package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/_app/portal.tsx +10 -0
  119. package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/_auth/login/sso.tsx +27 -0
  120. package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/_auth/login.tsx +10 -0
  121. package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/_auth/two-fa.tsx +91 -0
  122. package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/guide.tsx +9 -0
  123. package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/index.tsx +8 -0
  124. package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/unauthorized.tsx +50 -0
  125. package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/ValidationSchema.ts +1 -0
  126. package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/cookie.ts +23 -0
  127. package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/normalize-router-path.ts +10 -0
  128. package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/private-route.tsx +100 -0
  129. package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/public-route.tsx +64 -0
  130. package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/resolve-api-base-url.ts +44 -0
  131. package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/safe-router-navigation.ts +82 -0
  132. package/examples/greenfield/module-hybrid-cdn-auth-full/tsconfig.json +20 -0
  133. package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.cdn-app.mjs +1 -0
  134. package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.cdn-esm.mjs +1 -0
  135. package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.cdn-vendor.mjs +1 -0
  136. package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.dev.mjs +1 -0
  137. package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.hubspot.mjs +1 -0
  138. package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.monolith.mjs +8 -0
  139. package/examples/greenfield/module-hybrid-cdn-auth-full/woodscli.json +38 -0
  140. package/examples/greenfield/module-hybrid-cdn-auth-full/wphs.adapter.ts +7 -0
  141. package/examples/greenfield/module-hybrid-cdn-auth-sso/.env.dev.example +3 -0
  142. package/examples/greenfield/module-hybrid-cdn-auth-sso/.env.local.example +6 -0
  143. package/examples/greenfield/module-hybrid-cdn-auth-sso/.env.prod.example +5 -0
  144. package/examples/greenfield/module-hybrid-cdn-auth-sso/.env.stg.example +3 -0
  145. package/examples/greenfield/module-hybrid-cdn-auth-sso/.wphs/README.md +17 -0
  146. package/examples/greenfield/module-hybrid-cdn-auth-sso/README.md +59 -0
  147. package/examples/greenfield/module-hybrid-cdn-auth-sso/hubspot.config.yml.example +10 -0
  148. package/examples/greenfield/module-hybrid-cdn-auth-sso/index.html +12 -0
  149. package/examples/greenfield/module-hybrid-cdn-auth-sso/package.json +34 -0
  150. package/examples/greenfield/module-hybrid-cdn-auth-sso/portal.cdn.json.example +8 -0
  151. package/examples/greenfield/module-hybrid-cdn-auth-sso/public/fields.json +100 -0
  152. package/examples/greenfield/module-hybrid-cdn-auth-sso/public/meta.json +9 -0
  153. package/examples/greenfield/module-hybrid-cdn-auth-sso/public/module.html +38 -0
  154. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/app.tsx +180 -0
  155. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/assets/css/main.dev.css +23 -0
  156. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/assets/css/main.prod.css +12 -0
  157. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/assets/css/tailwind.css.config.css +7 -0
  158. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/cdn/app-entry.ts +48 -0
  159. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/cdn/vendor-entry.ts +28 -0
  160. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
  161. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/AuthLayout.tsx +7 -0
  162. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/DefaultLayout.tsx +5 -0
  163. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/MainLayout.tsx +42 -0
  164. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
  165. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/index.ts +13 -0
  166. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/layout/section-card.tsx +20 -0
  167. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/layout/starter-nav.tsx +28 -0
  168. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/layout/starter-shell.tsx +18 -0
  169. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/Button.tsx +22 -0
  170. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/Form.tsx +22 -0
  171. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/Input.tsx +12 -0
  172. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/Toaster.tsx +5 -0
  173. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/auth/SsoLoginButton.tsx +34 -0
  174. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/link.tsx +10 -0
  175. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/loader/loader.tsx +18 -0
  176. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/auth-tier.ts +4 -0
  177. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/nav-scaffold.ts +4 -0
  178. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/portal-nav.ts +9 -0
  179. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/router.ts +1 -0
  180. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/routes.ts +10 -0
  181. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/data/hubSpotContext.ts +57 -0
  182. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/data/sync-sdk-hub-context.ts +44 -0
  183. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/defaultData.ts +2 -0
  184. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/env.ts +59 -0
  185. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/app-bootstrap-guards.ts +14 -0
  186. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/auth-navigation.ts +81 -0
  187. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/auth-route-paths.ts +29 -0
  188. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/auth-session-events.ts +2 -0
  189. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/auth-session.ts +26 -0
  190. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/clear-client-auth-session.ts +62 -0
  191. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/components/starter-login.tsx +83 -0
  192. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/login-email-storage.ts +64 -0
  193. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/login-session-bridge.ts +72 -0
  194. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/post-login-path.ts +17 -0
  195. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/resolve-auth-login-error-message.ts +52 -0
  196. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/resolve-post-login-path.ts +21 -0
  197. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/sso-callback.ts +120 -0
  198. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/use-portal-session.ts +25 -0
  199. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/use-signed-in-email.ts +55 -0
  200. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/use-sso-callback-handler.ts +92 -0
  201. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-guide-page.tsx +210 -0
  202. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-home-page.tsx +21 -0
  203. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-home.tsx +48 -0
  204. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-page-frame.tsx +25 -0
  205. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-protected-page.tsx +54 -0
  206. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-single-page.tsx +17 -0
  207. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/content/auth-guide-content.ts +85 -0
  208. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/content/woodscli-guide-content.ts +86 -0
  209. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/hooks/starter-preview-values.ts +60 -0
  210. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
  211. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/hooks/use-starter-preview.ts +30 -0
  212. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/index.ts +6 -0
  213. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/bootstrap.ts +16 -0
  214. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/default-data.ts +7 -0
  215. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/is-cms-editor.ts +78 -0
  216. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/module-entry.tsx +9 -0
  217. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/types.ts +17 -0
  218. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/integrations/configure-woodsportal-sdk.ts +94 -0
  219. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/integrations/tanstack-query/root-provider.tsx +18 -0
  220. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/integrations/tanstack-router/router.tsx +39 -0
  221. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/integrations/woodsportal-sdk.ts +37 -0
  222. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/main.tsx +5 -0
  223. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/portal/api-endpoint.ts +11 -0
  224. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/portal/ensure-portal-cdn-stylesheet.ts +115 -0
  225. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/portal/mount-dev-preview.tsx +12 -0
  226. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/portal/mount-portal.tsx +57 -0
  227. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routeTree.gen.ts +155 -0
  228. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/__root.tsx +12 -0
  229. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/_app/portal.tsx +10 -0
  230. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/_auth/login/sso.tsx +27 -0
  231. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/_auth/login.tsx +10 -0
  232. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/guide.tsx +9 -0
  233. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/index.tsx +8 -0
  234. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/unauthorized.tsx +50 -0
  235. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/ValidationSchema.ts +1 -0
  236. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/cookie.ts +23 -0
  237. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/normalize-router-path.ts +10 -0
  238. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/private-route.tsx +100 -0
  239. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/public-route.tsx +64 -0
  240. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/resolve-api-base-url.ts +44 -0
  241. package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/safe-router-navigation.ts +82 -0
  242. package/examples/greenfield/module-hybrid-cdn-auth-sso/tsconfig.json +20 -0
  243. package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.cdn-app.mjs +1 -0
  244. package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.cdn-esm.mjs +1 -0
  245. package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.cdn-vendor.mjs +1 -0
  246. package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.dev.mjs +1 -0
  247. package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.hubspot.mjs +1 -0
  248. package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.monolith.mjs +8 -0
  249. package/examples/greenfield/module-hybrid-cdn-auth-sso/woodscli.json +38 -0
  250. package/examples/greenfield/module-hybrid-cdn-auth-sso/wphs.adapter.ts +7 -0
  251. package/examples/greenfield/module-hybrid-cdn-auth-starter/.env.dev.example +3 -0
  252. package/examples/greenfield/module-hybrid-cdn-auth-starter/.env.local.example +6 -0
  253. package/examples/greenfield/module-hybrid-cdn-auth-starter/.env.prod.example +5 -0
  254. package/examples/greenfield/module-hybrid-cdn-auth-starter/.env.stg.example +3 -0
  255. package/examples/greenfield/module-hybrid-cdn-auth-starter/.wphs/README.md +17 -0
  256. package/examples/greenfield/module-hybrid-cdn-auth-starter/README.md +59 -0
  257. package/examples/greenfield/module-hybrid-cdn-auth-starter/hubspot.config.yml.example +10 -0
  258. package/examples/greenfield/module-hybrid-cdn-auth-starter/index.html +12 -0
  259. package/examples/greenfield/module-hybrid-cdn-auth-starter/package.json +34 -0
  260. package/examples/greenfield/module-hybrid-cdn-auth-starter/portal.cdn.json.example +8 -0
  261. package/examples/greenfield/module-hybrid-cdn-auth-starter/public/fields.json +100 -0
  262. package/examples/greenfield/module-hybrid-cdn-auth-starter/public/meta.json +9 -0
  263. package/examples/greenfield/module-hybrid-cdn-auth-starter/public/module.html +38 -0
  264. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/app.tsx +173 -0
  265. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/assets/css/main.dev.css +23 -0
  266. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/assets/css/main.prod.css +12 -0
  267. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/assets/css/tailwind.css.config.css +7 -0
  268. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/cdn/app-entry.ts +48 -0
  269. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/cdn/vendor-entry.ts +28 -0
  270. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
  271. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/AuthLayout.tsx +7 -0
  272. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/DefaultLayout.tsx +5 -0
  273. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/MainLayout.tsx +42 -0
  274. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
  275. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/index.ts +13 -0
  276. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/layout/section-card.tsx +20 -0
  277. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/layout/starter-nav.tsx +28 -0
  278. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/layout/starter-shell.tsx +18 -0
  279. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/Button.tsx +22 -0
  280. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/Form.tsx +22 -0
  281. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/Input.tsx +12 -0
  282. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/Toaster.tsx +5 -0
  283. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/link.tsx +10 -0
  284. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/loader/loader.tsx +18 -0
  285. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/auth-tier.ts +4 -0
  286. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/nav-scaffold.ts +4 -0
  287. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/portal-nav.ts +9 -0
  288. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/router.ts +1 -0
  289. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/routes.ts +10 -0
  290. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/data/hubSpotContext.ts +57 -0
  291. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/data/sync-sdk-hub-context.ts +44 -0
  292. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/defaultData.ts +2 -0
  293. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/env.ts +59 -0
  294. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/app-bootstrap-guards.ts +14 -0
  295. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/auth-navigation.ts +81 -0
  296. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/auth-route-paths.ts +29 -0
  297. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/auth-session-events.ts +2 -0
  298. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/auth-session.ts +26 -0
  299. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/clear-client-auth-session.ts +62 -0
  300. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/components/starter-login.tsx +76 -0
  301. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/login-email-storage.ts +64 -0
  302. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/login-session-bridge.ts +72 -0
  303. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/post-login-path.ts +17 -0
  304. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/resolve-auth-login-error-message.ts +52 -0
  305. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/resolve-post-login-path.ts +21 -0
  306. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/use-portal-session.ts +25 -0
  307. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/use-signed-in-email.ts +55 -0
  308. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-guide-page.tsx +218 -0
  309. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-home-page.tsx +21 -0
  310. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-home.tsx +48 -0
  311. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-page-frame.tsx +25 -0
  312. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-protected-page.tsx +54 -0
  313. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-single-page.tsx +17 -0
  314. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/content/auth-guide-content.ts +91 -0
  315. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/content/woodscli-guide-content.ts +86 -0
  316. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/hooks/starter-preview-values.ts +60 -0
  317. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
  318. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/hooks/use-starter-preview.ts +30 -0
  319. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/index.ts +6 -0
  320. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/bootstrap.ts +16 -0
  321. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/default-data.ts +7 -0
  322. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/is-cms-editor.ts +78 -0
  323. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/module-entry.tsx +9 -0
  324. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/types.ts +17 -0
  325. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/integrations/configure-woodsportal-sdk.ts +94 -0
  326. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/integrations/tanstack-query/root-provider.tsx +18 -0
  327. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/integrations/tanstack-router/router.tsx +39 -0
  328. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/integrations/woodsportal-sdk.ts +37 -0
  329. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/main.tsx +5 -0
  330. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/portal/api-endpoint.ts +11 -0
  331. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/portal/ensure-portal-cdn-stylesheet.ts +115 -0
  332. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/portal/mount-dev-preview.tsx +12 -0
  333. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/portal/mount-portal.tsx +52 -0
  334. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routeTree.gen.ts +134 -0
  335. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/__root.tsx +12 -0
  336. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/_app/portal.tsx +10 -0
  337. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/_auth/login.tsx +10 -0
  338. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/guide.tsx +9 -0
  339. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/index.tsx +8 -0
  340. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/unauthorized.tsx +50 -0
  341. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/ValidationSchema.ts +1 -0
  342. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/cookie.ts +23 -0
  343. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/normalize-router-path.ts +10 -0
  344. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/private-route.tsx +100 -0
  345. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/public-route.tsx +64 -0
  346. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/resolve-api-base-url.ts +44 -0
  347. package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/safe-router-navigation.ts +82 -0
  348. package/examples/greenfield/module-hybrid-cdn-auth-starter/tsconfig.json +20 -0
  349. package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.cdn-app.mjs +1 -0
  350. package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.cdn-esm.mjs +1 -0
  351. package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.cdn-vendor.mjs +1 -0
  352. package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.dev.mjs +1 -0
  353. package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.hubspot.mjs +1 -0
  354. package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.monolith.mjs +8 -0
  355. package/examples/greenfield/module-hybrid-cdn-auth-starter/woodscli.json +38 -0
  356. package/examples/greenfield/module-hybrid-cdn-auth-starter/wphs.adapter.ts +7 -0
  357. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.env.dev.example +3 -0
  358. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.env.local.example +6 -0
  359. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.env.prod.example +5 -0
  360. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.env.stg.example +3 -0
  361. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.wphs/README.md +17 -0
  362. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/README.md +59 -0
  363. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/hubspot.config.yml.example +10 -0
  364. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/index.html +12 -0
  365. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/package.json +34 -0
  366. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/portal.cdn.json.example +8 -0
  367. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/public/fields.json +100 -0
  368. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/public/meta.json +9 -0
  369. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/public/module.html +38 -0
  370. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/app.tsx +173 -0
  371. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/assets/css/main.dev.css +23 -0
  372. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/assets/css/main.prod.css +12 -0
  373. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/assets/css/tailwind.css.config.css +7 -0
  374. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/cdn/app-entry.ts +48 -0
  375. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/cdn/vendor-entry.ts +28 -0
  376. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
  377. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/AuthLayout.tsx +7 -0
  378. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/DefaultLayout.tsx +5 -0
  379. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/MainLayout.tsx +7 -0
  380. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
  381. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/index.ts +13 -0
  382. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/portal-sidebar-nav.tsx +33 -0
  383. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/portal-sidebar.tsx +139 -0
  384. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/section-card.tsx +20 -0
  385. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/starter-nav.tsx +28 -0
  386. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/starter-shell.tsx +18 -0
  387. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/Button.tsx +22 -0
  388. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/Form.tsx +22 -0
  389. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/Input.tsx +12 -0
  390. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/Toaster.tsx +5 -0
  391. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/link.tsx +10 -0
  392. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/loader/loader.tsx +18 -0
  393. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/auth-tier.ts +4 -0
  394. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/nav-scaffold.ts +4 -0
  395. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/portal-nav.ts +9 -0
  396. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/router.ts +1 -0
  397. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/routes.ts +10 -0
  398. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/data/hubSpotContext.ts +57 -0
  399. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/data/sync-sdk-hub-context.ts +44 -0
  400. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/defaultData.ts +2 -0
  401. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/env.ts +59 -0
  402. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/app-bootstrap-guards.ts +14 -0
  403. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/auth-navigation.ts +81 -0
  404. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/auth-route-paths.ts +29 -0
  405. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/auth-session-events.ts +2 -0
  406. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/auth-session.ts +26 -0
  407. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/clear-client-auth-session.ts +62 -0
  408. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/components/starter-login.tsx +76 -0
  409. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/login-email-storage.ts +64 -0
  410. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/login-session-bridge.ts +72 -0
  411. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/post-login-path.ts +17 -0
  412. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/resolve-auth-login-error-message.ts +52 -0
  413. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/resolve-post-login-path.ts +21 -0
  414. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/use-portal-session.ts +25 -0
  415. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/use-signed-in-email.ts +55 -0
  416. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-guide-page.tsx +210 -0
  417. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-home-page.tsx +21 -0
  418. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-home.tsx +48 -0
  419. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-page-frame.tsx +25 -0
  420. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-protected-page.tsx +54 -0
  421. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-single-page.tsx +17 -0
  422. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/content/auth-guide-content.ts +85 -0
  423. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/content/woodscli-guide-content.ts +86 -0
  424. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/hooks/starter-preview-values.ts +60 -0
  425. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
  426. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/hooks/use-starter-preview.ts +30 -0
  427. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/index.ts +6 -0
  428. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/bootstrap.ts +16 -0
  429. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/default-data.ts +7 -0
  430. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/is-cms-editor.ts +78 -0
  431. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/module-entry.tsx +9 -0
  432. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/types.ts +17 -0
  433. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/integrations/configure-woodsportal-sdk.ts +94 -0
  434. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/integrations/tanstack-query/root-provider.tsx +18 -0
  435. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/integrations/tanstack-router/router.tsx +39 -0
  436. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/integrations/woodsportal-sdk.ts +37 -0
  437. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/main.tsx +5 -0
  438. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/portal/api-endpoint.ts +11 -0
  439. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/portal/ensure-portal-cdn-stylesheet.ts +115 -0
  440. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/portal/mount-dev-preview.tsx +12 -0
  441. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/portal/mount-portal.tsx +52 -0
  442. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routeTree.gen.ts +134 -0
  443. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/__root.tsx +12 -0
  444. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/_app/portal.tsx +10 -0
  445. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/_auth/login.tsx +10 -0
  446. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/guide.tsx +9 -0
  447. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/index.tsx +8 -0
  448. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/unauthorized.tsx +50 -0
  449. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/ValidationSchema.ts +1 -0
  450. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/cookie.ts +23 -0
  451. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/normalize-router-path.ts +10 -0
  452. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/private-route.tsx +100 -0
  453. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/public-route.tsx +64 -0
  454. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/resolve-api-base-url.ts +44 -0
  455. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/safe-router-navigation.ts +82 -0
  456. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/tsconfig.json +20 -0
  457. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.cdn-app.mjs +1 -0
  458. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.cdn-esm.mjs +1 -0
  459. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.cdn-vendor.mjs +1 -0
  460. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.dev.mjs +1 -0
  461. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.hubspot.mjs +1 -0
  462. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.monolith.mjs +8 -0
  463. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/woodscli.json +38 -0
  464. package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/wphs.adapter.ts +7 -0
  465. package/examples/greenfield/module-monolith/public/fields.json +66 -16
  466. package/examples/greenfield/module-monolith/src/assets/css/main.dev.css +7 -0
  467. package/examples/greenfield/module-monolith/src/components/layout/starter-nav.tsx +12 -15
  468. package/examples/greenfield/module-monolith/src/config/starter-nav.ts +9 -0
  469. package/examples/greenfield/module-monolith/src/features/starter/components/starter-home.tsx +25 -29
  470. package/examples/greenfield/module-monolith/src/features/starter/hooks/starter-preview-values.ts +60 -0
  471. package/examples/greenfield/module-monolith/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
  472. package/examples/greenfield/module-monolith/src/features/starter/hooks/use-starter-preview.ts +20 -37
  473. package/examples/manifest.json +5 -1
  474. package/examples/smoke/run-matrix.mjs +37 -0
  475. package/package.json +28 -12
  476. package/scripts/audit-tdz-split.mjs +11 -5
  477. package/scripts/check-cdn-size-regression.mjs +49 -0
  478. package/scripts/check-hubspot-bundle-size.mjs +18 -4
  479. package/scripts/cli-smoke-helpers.mjs +150 -0
  480. package/scripts/generate-cdn-bundle-breakdown.mjs +61 -0
  481. package/scripts/generate-cdn-manifest.mjs +23 -8
  482. package/scripts/portal-vite-env.mjs +76 -2
  483. package/scripts/publish-cdn-github.mjs +79 -14
  484. package/scripts/refresh-artifact-sizes.mjs +77 -0
  485. package/scripts/regenerate-route-tree.mjs +71 -0
  486. package/scripts/sync-auth-scaffold-from-client.mjs +41 -0
  487. package/scripts/verify-cdn-api-endpoint.mjs +17 -10
  488. package/scripts/vite/create-dev-server-config.mjs +7 -1
  489. package/scripts/vite/portal-build-shared.js +62 -2
  490. package/scripts/wp-cli-smoke.test.mjs +263 -0
  491. package/src/dev/bootstrap-greenfield.tsx +6 -0
  492. package/src/dev-module-config/ui/module-config-overlay-side.ts +13 -3
  493. package/src/dev-module-config/ui/module-config-toolbar-theme.ts +12 -3
  494. package/templates/module-hybrid-cdn/public/fields.json +47 -7
  495. package/templates/module-hybrid-cdn/public/module.html +7 -6
  496. package/templates/module-hybrid-cdn/src/assets/css/main.dev.css +7 -0
  497. package/templates/module-hybrid-cdn/src/components/layout/starter-nav.tsx +12 -15
  498. package/templates/module-hybrid-cdn/src/config/starter-nav.ts +9 -0
  499. package/templates/module-hybrid-cdn/src/features/starter/components/starter-home.tsx +25 -27
  500. package/templates/module-hybrid-cdn/src/features/starter/hooks/starter-preview-values.ts +5 -5
  501. package/templates/module-monolith/public/fields.json +49 -6
  502. package/templates/module-monolith/src/assets/css/main.dev.css +7 -0
  503. package/templates/module-monolith/src/components/layout/starter-nav.tsx +12 -15
  504. package/templates/module-monolith/src/config/starter-nav.ts +9 -0
  505. package/templates/module-monolith/src/features/starter/components/starter-home.tsx +25 -27
  506. package/templates/module-monolith/src/features/starter/hooks/starter-preview-values.ts +5 -5
  507. package/templates/scaffold/auth/_full/src/app.tsx +172 -0
  508. package/templates/scaffold/auth/_full/src/config/auth-tier.ts +4 -0
  509. package/templates/scaffold/auth/_full/src/features/auth/auth-session.ts +51 -0
  510. package/templates/scaffold/auth/_full/src/features/auth/login-session-bridge.ts +74 -0
  511. package/templates/scaffold/auth/_full/src/features/auth/mfa-otp-utils.ts +24 -0
  512. package/templates/scaffold/auth/_full/src/features/auth/mfa-pending-storage.ts +108 -0
  513. package/templates/scaffold/auth/_full/src/features/auth/mfa-portal.ts +45 -0
  514. package/templates/scaffold/auth/_full/src/features/auth/use-mfa-login-otp-flow.ts +78 -0
  515. package/templates/scaffold/auth/_full/src/routeTree.gen.ts +182 -0
  516. package/templates/scaffold/auth/_full/src/routes/_auth/two-fa.tsx +91 -0
  517. package/templates/scaffold/auth/_nav-sidebar/src/components/Layouts/MainLayout.tsx +7 -0
  518. package/templates/scaffold/auth/_nav-sidebar/src/components/layout/portal-sidebar-nav.tsx +33 -0
  519. package/templates/scaffold/auth/_nav-sidebar/src/components/layout/portal-sidebar.tsx +139 -0
  520. package/templates/scaffold/auth/_nav-top/src/components/Layouts/MainLayout.tsx +42 -0
  521. package/templates/scaffold/auth/_shared/src/app.tsx +178 -0
  522. package/templates/scaffold/auth/_shared/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
  523. package/templates/scaffold/auth/_shared/src/components/Layouts/AuthLayout.tsx +7 -0
  524. package/templates/scaffold/auth/_shared/src/components/Layouts/DefaultLayout.tsx +5 -0
  525. package/templates/scaffold/auth/_shared/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
  526. package/templates/scaffold/auth/_shared/src/components/Layouts/index.ts +13 -0
  527. package/templates/scaffold/auth/_shared/src/components/ui/Button.tsx +22 -0
  528. package/templates/scaffold/auth/_shared/src/components/ui/Form.tsx +22 -0
  529. package/templates/scaffold/auth/_shared/src/components/ui/Input.tsx +12 -0
  530. package/templates/scaffold/auth/_shared/src/components/ui/Toaster.tsx +5 -0
  531. package/templates/scaffold/auth/_shared/src/components/ui/link.tsx +10 -0
  532. package/templates/scaffold/auth/_shared/src/components/ui/loader/loader.tsx +18 -0
  533. package/templates/scaffold/auth/_shared/src/config/auth-tier.ts +4 -0
  534. package/templates/scaffold/auth/_shared/src/config/nav-scaffold.ts +4 -0
  535. package/templates/scaffold/auth/_shared/src/config/portal-nav.ts +9 -0
  536. package/templates/scaffold/auth/_shared/src/config/router.ts +1 -0
  537. package/templates/scaffold/auth/_shared/src/config/routes.ts +10 -0
  538. package/templates/scaffold/auth/_shared/src/data/hubSpotContext.ts +57 -0
  539. package/templates/scaffold/auth/_shared/src/data/sync-sdk-hub-context.ts +44 -0
  540. package/templates/scaffold/auth/_shared/src/env.ts +59 -0
  541. package/templates/scaffold/auth/_shared/src/features/auth/app-bootstrap-guards.ts +14 -0
  542. package/templates/scaffold/auth/_shared/src/features/auth/auth-navigation.ts +81 -0
  543. package/templates/scaffold/auth/_shared/src/features/auth/auth-route-paths.ts +29 -0
  544. package/templates/scaffold/auth/_shared/src/features/auth/auth-session-events.ts +2 -0
  545. package/templates/scaffold/auth/_shared/src/features/auth/auth-session.ts +26 -0
  546. package/templates/scaffold/auth/_shared/src/features/auth/clear-client-auth-session.ts +62 -0
  547. package/templates/scaffold/auth/_shared/src/features/auth/components/starter-login.tsx +76 -0
  548. package/templates/scaffold/auth/_shared/src/features/auth/login-email-storage.ts +64 -0
  549. package/templates/scaffold/auth/_shared/src/features/auth/login-session-bridge.ts +72 -0
  550. package/templates/scaffold/auth/_shared/src/features/auth/post-login-path.ts +17 -0
  551. package/templates/scaffold/auth/_shared/src/features/auth/resolve-auth-login-error-message.ts +52 -0
  552. package/templates/scaffold/auth/_shared/src/features/auth/resolve-post-login-path.ts +21 -0
  553. package/templates/scaffold/auth/_shared/src/features/auth/use-portal-session.ts +25 -0
  554. package/templates/scaffold/auth/_shared/src/features/auth/use-signed-in-email.ts +55 -0
  555. package/templates/scaffold/auth/_shared/src/features/starter/components/starter-guide-page.tsx +218 -0
  556. package/templates/scaffold/auth/_shared/src/features/starter/components/starter-page-frame.tsx +25 -0
  557. package/templates/scaffold/auth/_shared/src/features/starter/components/starter-protected-page.tsx +54 -0
  558. package/templates/scaffold/auth/_shared/src/features/starter/content/auth-guide-content.ts +91 -0
  559. package/templates/scaffold/auth/_shared/src/hubspot/is-cms-editor.ts +78 -0
  560. package/templates/scaffold/auth/_shared/src/integrations/configure-woodsportal-sdk.ts +100 -0
  561. package/templates/scaffold/auth/_shared/src/integrations/tanstack-query/root-provider.tsx +18 -0
  562. package/templates/scaffold/auth/_shared/src/integrations/tanstack-router/router.tsx +39 -0
  563. package/templates/scaffold/auth/_shared/src/integrations/woodsportal-sdk.ts +37 -0
  564. package/templates/scaffold/auth/_shared/src/portal/mount-portal.tsx +59 -0
  565. package/templates/scaffold/auth/_shared/src/routeTree.gen.ts +134 -0
  566. package/templates/scaffold/auth/_shared/src/routes/__root.tsx +12 -0
  567. package/templates/scaffold/auth/_shared/src/routes/_app/portal.tsx +10 -0
  568. package/templates/scaffold/auth/_shared/src/routes/_auth/login.tsx +10 -0
  569. package/templates/scaffold/auth/_shared/src/routes/guide.tsx +9 -0
  570. package/templates/scaffold/auth/_shared/src/routes/index.tsx +8 -0
  571. package/templates/scaffold/auth/_shared/src/routes/unauthorized.tsx +50 -0
  572. package/templates/scaffold/auth/_shared/src/utils/ValidationSchema.ts +1 -0
  573. package/templates/scaffold/auth/_shared/src/utils/cookie.ts +23 -0
  574. package/templates/scaffold/auth/_shared/src/utils/normalize-router-path.ts +10 -0
  575. package/templates/scaffold/auth/_shared/src/utils/private-route.tsx +100 -0
  576. package/templates/scaffold/auth/_shared/src/utils/public-route.tsx +64 -0
  577. package/templates/scaffold/auth/_shared/src/utils/resolve-api-base-url.ts +44 -0
  578. package/templates/scaffold/auth/_shared/src/utils/safe-router-navigation.ts +82 -0
  579. package/templates/scaffold/auth/_sso/src/app.tsx +180 -0
  580. package/templates/scaffold/auth/_sso/src/components/ui/auth/SsoLoginButton.tsx +34 -0
  581. package/templates/scaffold/auth/_sso/src/config/auth-tier.ts +4 -0
  582. package/templates/scaffold/auth/_sso/src/features/auth/components/starter-login.tsx +83 -0
  583. package/templates/scaffold/auth/_sso/src/features/auth/sso-callback.ts +120 -0
  584. package/templates/scaffold/auth/_sso/src/features/auth/use-sso-callback-handler.ts +92 -0
  585. package/templates/scaffold/auth/_sso/src/routeTree.gen.ts +155 -0
  586. package/templates/scaffold/auth/_sso/src/routes/_auth/login/sso.tsx +27 -0
  587. package/templates/scaffold/auth/nav-manifest.json +8 -0
  588. package/templates/scaffold/auth/sync-manifest.json +16 -0
  589. package/templates/scaffold/auth/tier-manifest.json +18 -0
  590. package/templates/scaffold/page/page-component-auth.tsx.tpl +10 -0
  591. package/templates/scaffold/page/page-component-plain.tsx.tpl +11 -0
  592. package/templates/scaffold/page/route-protected-auth.tsx.tpl +10 -0
  593. package/templates/scaffold/page/route-public-auth.tsx.tpl +9 -0
  594. package/templates/scaffold/page/route-public-plain.tsx.tpl +6 -0
  595. package/vite/vite.config.cdn-app.mjs +43 -30
  596. package/vite/vite.config.cdn-audit.mjs +34 -0
  597. package/vite/vite.config.cdn-esm.mjs +1 -1
  598. package/dist/chunk-S2YJDWZU.js.map +0 -1
@@ -0,0 +1,78 @@
1
+ import { useCallback, useEffect, useState } from 'react'
2
+ import { toast } from 'sonner'
3
+ import type { MfaMethod } from '@/integrations/woodsportal-sdk'
4
+ import { api } from '@/integrations/woodsportal-sdk'
5
+ import { getMfaPendingContext } from '@/features/auth/mfa-pending-storage'
6
+ import {
7
+ getResendSecondsLeft,
8
+ isValidOtpCode,
9
+ MFA_OTP_RESEND_COOLDOWN_MS,
10
+ normalizeOtpCode,
11
+ } from '@/features/auth/mfa-otp-utils'
12
+ import { resolveMfaPortalId } from '@/features/auth/mfa-portal'
13
+
14
+ export function useMfaLoginOtpFlow() {
15
+ const pending = getMfaPendingContext()
16
+ const [method, setMethod] = useState<MfaMethod>(pending?.defaultMethod ?? 'EMAIL_OTP')
17
+ const [otp, setOtp] = useState('')
18
+ const [isSending, setIsSending] = useState(false)
19
+ const [isVerifying, setIsVerifying] = useState(false)
20
+ const [cooldownUntil, setCooldownUntil] = useState<number | null>(null)
21
+
22
+ const resendSecondsLeft = getResendSecondsLeft(cooldownUntil)
23
+
24
+ const sendOtp = useCallback(async () => {
25
+ if (resendSecondsLeft > 0) {
26
+ return
27
+ }
28
+ setIsSending(true)
29
+ try {
30
+ const portalId = resolveMfaPortalId()
31
+ const { sendOtp: send } = api.auth.mfa.sendOtp()
32
+ await send({ method, portalId })
33
+ setCooldownUntil(Date.now() + MFA_OTP_RESEND_COOLDOWN_MS)
34
+ toast.success('Verification code sent')
35
+ } catch {
36
+ toast.error('Could not send verification code')
37
+ } finally {
38
+ setIsSending(false)
39
+ }
40
+ }, [method, resendSecondsLeft])
41
+
42
+ useEffect(() => {
43
+ void sendOtp()
44
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- auto-send once on MFA gate mount
45
+ }, [])
46
+
47
+ const verifyOtp = async () => {
48
+ const code = normalizeOtpCode(otp)
49
+ if (!isValidOtpCode(code)) {
50
+ toast.error('Enter the 6-digit code')
51
+ return null
52
+ }
53
+ setIsVerifying(true)
54
+ try {
55
+ const portalId = resolveMfaPortalId()
56
+ const { verifyOtp: verify } = api.auth.mfa.verifyOtp()
57
+ return await verify({ method, otp: code, portalId })
58
+ } catch {
59
+ toast.error('Invalid or expired code')
60
+ return null
61
+ } finally {
62
+ setIsVerifying(false)
63
+ }
64
+ }
65
+
66
+ return {
67
+ method,
68
+ setMethod,
69
+ otp,
70
+ setOtp,
71
+ destination: pending?.otpDestination,
72
+ isSending,
73
+ isVerifying,
74
+ resendSecondsLeft,
75
+ sendOtp,
76
+ verifyOtp,
77
+ }
78
+ }
@@ -0,0 +1,182 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ // TanStack Router generated route tree (starter + SSO + MFA tier).
4
+
5
+ import { Route as rootRouteImport } from './routes/__root'
6
+ import { Route as UnauthorizedRouteImport } from './routes/unauthorized'
7
+ import { Route as GuideRouteImport } from './routes/guide'
8
+ import { Route as IndexRouteImport } from './routes/index'
9
+ import { Route as AuthLoginRouteImport } from './routes/_auth/login'
10
+ import { Route as AuthLoginSsoRouteImport } from './routes/_auth/login/sso'
11
+ import { Route as AuthTwoFaRouteImport } from './routes/_auth/two-fa'
12
+ import { Route as AppPortalRouteImport } from './routes/_app/portal'
13
+
14
+ const UnauthorizedRoute = UnauthorizedRouteImport.update({
15
+ id: '/unauthorized',
16
+ path: '/unauthorized',
17
+ getParentRoute: () => rootRouteImport,
18
+ } as any)
19
+
20
+ const GuideRoute = GuideRouteImport.update({
21
+ id: '/guide',
22
+ path: '/guide',
23
+ getParentRoute: () => rootRouteImport,
24
+ } as any)
25
+
26
+ const IndexRoute = IndexRouteImport.update({
27
+ id: '/',
28
+ path: '/',
29
+ getParentRoute: () => rootRouteImport,
30
+ } as any)
31
+
32
+ const AuthLoginRoute = AuthLoginRouteImport.update({
33
+ id: '/_auth/login',
34
+ path: '/login',
35
+ getParentRoute: () => rootRouteImport,
36
+ } as any)
37
+
38
+ const AuthLoginSsoRoute = AuthLoginSsoRouteImport.update({
39
+ id: '/_auth/login/sso',
40
+ path: '/sso',
41
+ getParentRoute: () => AuthLoginRoute,
42
+ } as any)
43
+
44
+ const AuthTwoFaRoute = AuthTwoFaRouteImport.update({
45
+ id: '/_auth/two-fa',
46
+ path: '/two-fa',
47
+ getParentRoute: () => rootRouteImport,
48
+ } as any)
49
+
50
+ const AppPortalRoute = AppPortalRouteImport.update({
51
+ id: '/_app/portal',
52
+ path: '/portal',
53
+ getParentRoute: () => rootRouteImport,
54
+ } as any)
55
+
56
+ const AuthLoginRouteWithChildren = AuthLoginRoute._addFileChildren({
57
+ AuthLoginSsoRoute,
58
+ })
59
+
60
+ export interface FileRoutesByFullPath {
61
+ '/': typeof IndexRoute
62
+ '/guide': typeof GuideRoute
63
+ '/login': typeof AuthLoginRouteWithChildren
64
+ '/login/sso': typeof AuthLoginSsoRoute
65
+ '/two-fa': typeof AuthTwoFaRoute
66
+ '/portal': typeof AppPortalRoute
67
+ '/unauthorized': typeof UnauthorizedRoute
68
+ }
69
+
70
+ export interface FileRoutesByTo {
71
+ '/': typeof IndexRoute
72
+ '/guide': typeof GuideRoute
73
+ '/login': typeof AuthLoginRouteWithChildren
74
+ '/login/sso': typeof AuthLoginSsoRoute
75
+ '/two-fa': typeof AuthTwoFaRoute
76
+ '/portal': typeof AppPortalRoute
77
+ '/unauthorized': typeof UnauthorizedRoute
78
+ }
79
+
80
+ export interface FileRoutesById {
81
+ __root__: typeof rootRouteImport
82
+ '/': typeof IndexRoute
83
+ '/guide': typeof GuideRoute
84
+ '/_auth/login': typeof AuthLoginRouteWithChildren
85
+ '/_auth/login/sso': typeof AuthLoginSsoRoute
86
+ '/_auth/two-fa': typeof AuthTwoFaRoute
87
+ '/_app/portal': typeof AppPortalRoute
88
+ '/unauthorized': typeof UnauthorizedRoute
89
+ }
90
+
91
+ export interface FileRouteTypes {
92
+ fileRoutesByFullPath: FileRoutesByFullPath
93
+ fullPaths: '/' | '/guide' | '/login' | '/login/sso' | '/two-fa' | '/portal' | '/unauthorized'
94
+ fileRoutesByTo: FileRoutesByTo
95
+ to: '/' | '/guide' | '/login' | '/login/sso' | '/two-fa' | '/portal' | '/unauthorized'
96
+ id:
97
+ | '__root__'
98
+ | '/'
99
+ | '/guide'
100
+ | '/_auth/login'
101
+ | '/_auth/login/sso'
102
+ | '/_auth/two-fa'
103
+ | '/_app/portal'
104
+ | '/unauthorized'
105
+ fileRoutesById: FileRoutesById
106
+ }
107
+
108
+ export interface RootRouteChildren {
109
+ IndexRoute: typeof IndexRoute
110
+ GuideRoute: typeof GuideRoute
111
+ AuthLoginRoute: typeof AuthLoginRouteWithChildren
112
+ AuthTwoFaRoute: typeof AuthTwoFaRoute
113
+ AppPortalRoute: typeof AppPortalRoute
114
+ UnauthorizedRoute: typeof UnauthorizedRoute
115
+ }
116
+
117
+ declare module '@tanstack/react-router' {
118
+ interface FileRoutesByPath {
119
+ '/unauthorized': {
120
+ id: '/unauthorized'
121
+ path: '/unauthorized'
122
+ fullPath: '/unauthorized'
123
+ preLoaderRoute: typeof UnauthorizedRouteImport
124
+ parentRoute: typeof rootRouteImport
125
+ }
126
+ '/guide': {
127
+ id: '/guide'
128
+ path: '/guide'
129
+ fullPath: '/guide'
130
+ preLoaderRoute: typeof GuideRouteImport
131
+ parentRoute: typeof rootRouteImport
132
+ }
133
+ '/': {
134
+ id: '/'
135
+ path: '/'
136
+ fullPath: '/'
137
+ preLoaderRoute: typeof IndexRouteImport
138
+ parentRoute: typeof rootRouteImport
139
+ }
140
+ '/login': {
141
+ id: '/_auth/login'
142
+ path: '/login'
143
+ fullPath: '/login'
144
+ preLoaderRoute: typeof AuthLoginRouteImport
145
+ parentRoute: typeof rootRouteImport
146
+ }
147
+ '/login/sso': {
148
+ id: '/_auth/login/sso'
149
+ path: '/sso'
150
+ fullPath: '/login/sso'
151
+ preLoaderRoute: typeof AuthLoginSsoRouteImport
152
+ parentRoute: typeof AuthLoginRouteImport
153
+ }
154
+ '/two-fa': {
155
+ id: '/_auth/two-fa'
156
+ path: '/two-fa'
157
+ fullPath: '/two-fa'
158
+ preLoaderRoute: typeof AuthTwoFaRouteImport
159
+ parentRoute: typeof rootRouteImport
160
+ }
161
+ '/portal': {
162
+ id: '/_app/portal'
163
+ path: '/portal'
164
+ fullPath: '/portal'
165
+ preLoaderRoute: typeof AppPortalRouteImport
166
+ parentRoute: typeof rootRouteImport
167
+ }
168
+ }
169
+ }
170
+
171
+ const rootRouteChildren: RootRouteChildren = {
172
+ IndexRoute,
173
+ GuideRoute,
174
+ AuthLoginRoute: AuthLoginRouteWithChildren,
175
+ AuthTwoFaRoute,
176
+ AppPortalRoute,
177
+ UnauthorizedRoute,
178
+ }
179
+
180
+ export const routeTree = rootRouteImport
181
+ ._addFileChildren(rootRouteChildren)
182
+ ._addFileTypes<FileRouteTypes>()
@@ -0,0 +1,91 @@
1
+ import { createFileRoute, useRouter } from '@tanstack/react-router'
2
+ import { toast } from 'sonner'
3
+ import { Button } from '@/components/ui/Button'
4
+ import { Form, FormField } from '@/components/ui/Form'
5
+ import { Input } from '@/components/ui/Input'
6
+ import Loader from '@/components/ui/loader/loader'
7
+ import { handleAuthLoginResponse } from '@/features/auth/login-session-bridge'
8
+ import { useMfaLoginOtpFlow } from '@/features/auth/use-mfa-login-otp-flow'
9
+ import { clearMfaPendingLoginSession } from '@/features/auth/auth-session'
10
+ import { Routes } from '@/config/routes'
11
+
12
+ function TwoFaPage() {
13
+ const router = useRouter()
14
+ const {
15
+ otp,
16
+ setOtp,
17
+ destination,
18
+ isSending,
19
+ isVerifying,
20
+ resendSecondsLeft,
21
+ sendOtp,
22
+ verifyOtp,
23
+ } = useMfaLoginOtpFlow()
24
+
25
+ const onSubmit = async (event: React.FormEvent) => {
26
+ event.preventDefault()
27
+ const response = await verifyOtp()
28
+ if (!response) {
29
+ return
30
+ }
31
+ const result = await handleAuthLoginResponse(response, router)
32
+ if (result.success && !result.mfaRequired) {
33
+ toast.success('Signed in')
34
+ }
35
+ }
36
+
37
+ if (isSending && !destination) {
38
+ return <Loader text="Sending verification code…" />
39
+ }
40
+
41
+ return (
42
+ <div className="w-full max-w-md rounded-lg border border-gray-200 bg-white p-6 shadow-sm">
43
+ <h1 className="mb-2 text-xl font-semibold text-gray-900">Two-factor authentication</h1>
44
+ <p className="mb-6 text-sm text-gray-600">
45
+ Enter the code sent to {destination ?? 'your registered contact'}.
46
+ </p>
47
+ <Form onSubmit={onSubmit}>
48
+ <FormField label="Verification code">
49
+ <Input
50
+ inputMode="numeric"
51
+ autoComplete="one-time-code"
52
+ value={otp}
53
+ onChange={(e) => setOtp(e.target.value)}
54
+ placeholder="000000"
55
+ />
56
+ </FormField>
57
+ <Button type="submit" className="w-full" disabled={isVerifying}>
58
+ {isVerifying ? 'Verifying…' : 'Verify'}
59
+ </Button>
60
+ </Form>
61
+ <div className="mt-4 flex items-center justify-between text-sm">
62
+ <button
63
+ type="button"
64
+ className="text-orange-600 disabled:text-gray-400"
65
+ disabled={resendSecondsLeft > 0 || isSending}
66
+ onClick={() => void sendOtp()}
67
+ >
68
+ {resendSecondsLeft > 0 ? `Resend in ${resendSecondsLeft}s` : 'Resend code'}
69
+ </button>
70
+ <button
71
+ type="button"
72
+ className="text-gray-600"
73
+ onClick={() => {
74
+ clearMfaPendingLoginSession()
75
+ router.navigate({ to: Routes.login })
76
+ }}
77
+ >
78
+ Back to login
79
+ </button>
80
+ </div>
81
+ </div>
82
+ )
83
+ }
84
+
85
+ export const Route = createFileRoute('/_auth/two-fa')({
86
+ component: TwoFaPage,
87
+ beforeLoad: () => ({
88
+ layout: 'AuthLayout' as const,
89
+ requiresAuth: false,
90
+ }),
91
+ })
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react'
2
+
3
+ import { PortalSidebar } from '@/components/layout/portal-sidebar'
4
+
5
+ export default function MainLayout({ children }: { children?: ReactNode }) {
6
+ return <PortalSidebar>{children}</PortalSidebar>
7
+ }
@@ -0,0 +1,33 @@
1
+ import { Link } from '@/components/ui/link'
2
+ import { portalNavItems } from '@/config/portal-nav'
3
+
4
+ type PortalSidebarNavProps = {
5
+ collapsed?: boolean
6
+ onNavigate?: () => void
7
+ }
8
+
9
+ export function PortalSidebarNav({ collapsed = false, onNavigate }: PortalSidebarNavProps) {
10
+ return (
11
+ <nav className="flex flex-col gap-1 px-2 py-3">
12
+ {portalNavItems.map((item) => (
13
+ <Link
14
+ key={item.to}
15
+ to={item.to}
16
+ onClick={onNavigate}
17
+ title={collapsed ? item.label : undefined}
18
+ className={`rounded-md px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 ${
19
+ collapsed ? 'text-center' : ''
20
+ }`}
21
+ activeProps={{
22
+ className: `rounded-md bg-orange-50 px-3 py-2 text-sm font-medium text-orange-700 ${
23
+ collapsed ? 'text-center' : ''
24
+ }`,
25
+ }}
26
+ activeOptions={{ exact: true }}
27
+ >
28
+ {collapsed ? item.label.charAt(0) : item.label}
29
+ </Link>
30
+ ))}
31
+ </nav>
32
+ )
33
+ }
@@ -0,0 +1,139 @@
1
+ import { useCallback, useEffect, useState, type ReactNode } from 'react'
2
+ import { useRouter } from '@tanstack/react-router'
3
+
4
+ import { Button } from '@/components/ui/Button'
5
+ import { Routes } from '@/config/routes'
6
+ import { clearClientAuthSession } from '@/features/auth/clear-client-auth-session'
7
+ import { useSignedInEmail } from '@/features/auth/use-signed-in-email'
8
+ import { usePortalSession } from '@/features/auth/use-portal-session'
9
+ import { api } from '@/integrations/woodsportal-sdk'
10
+
11
+ import { PortalSidebarNav } from './portal-sidebar-nav'
12
+
13
+ type PortalSidebarProps = {
14
+ children: ReactNode
15
+ }
16
+
17
+ export function PortalSidebar({ children }: PortalSidebarProps) {
18
+ const [collapsed, setCollapsed] = useState(false)
19
+ const [mobileOpen, setMobileOpen] = useState(false)
20
+ const isAuthenticated = usePortalSession()
21
+ const { email, isLoading } = useSignedInEmail()
22
+ const router = useRouter()
23
+
24
+ const closeMobile = useCallback(() => setMobileOpen(false), [])
25
+
26
+ useEffect(() => {
27
+ if (!mobileOpen) {
28
+ return
29
+ }
30
+ const onKeyDown = (event: KeyboardEvent) => {
31
+ if (event.key === 'Escape') {
32
+ closeMobile()
33
+ }
34
+ }
35
+ window.addEventListener('keydown', onKeyDown)
36
+ return () => window.removeEventListener('keydown', onKeyDown)
37
+ }, [mobileOpen, closeMobile])
38
+
39
+ useEffect(() => {
40
+ if (!isAuthenticated) {
41
+ return
42
+ }
43
+ const { me } = api.auth.me({})
44
+ void me()
45
+ }, [isAuthenticated])
46
+
47
+ const handleLogout = async () => {
48
+ clearClientAuthSession()
49
+ try {
50
+ const { logout } = api.auth.logout({})
51
+ await logout()
52
+ } catch {
53
+ // local state already cleared
54
+ }
55
+ router.navigate({ to: Routes.login })
56
+ }
57
+
58
+ const signedInLabel = isLoading ? 'Loading…' : (email ?? 'Signed in')
59
+
60
+ const sidebarWidth = collapsed ? 'w-16' : 'w-60'
61
+ const motionClass = 'motion-reduce:transition-none transition-[width] duration-200 ease-in-out'
62
+
63
+ const sidebarPanel = (
64
+ <aside
65
+ className={`flex h-full shrink-0 flex-col border-r border-gray-200 bg-white ${sidebarWidth} ${motionClass}`}
66
+ >
67
+ <div className="flex items-center justify-between gap-2 border-b border-gray-200 px-3 py-4">
68
+ {!collapsed ? (
69
+ <span className="truncate text-sm font-semibold text-gray-900">WoodsPortal</span>
70
+ ) : (
71
+ <span className="w-full text-center text-sm font-semibold text-gray-900">W</span>
72
+ )}
73
+ <button
74
+ type="button"
75
+ className="hidden rounded-md p-1 text-gray-500 hover:bg-gray-100 md:inline-flex"
76
+ aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}
77
+ onClick={() => setCollapsed((value) => !value)}
78
+ >
79
+ {collapsed ? '»' : '«'}
80
+ </button>
81
+ </div>
82
+
83
+ <div className="flex-1 overflow-y-auto">
84
+ <PortalSidebarNav collapsed={collapsed} onNavigate={closeMobile} />
85
+ </div>
86
+
87
+ {isAuthenticated ? (
88
+ <div className="border-t border-gray-200 p-3">
89
+ {!collapsed ? (
90
+ <p className="mb-2 truncate text-xs text-gray-500" title={signedInLabel}>
91
+ {signedInLabel}
92
+ </p>
93
+ ) : null}
94
+ <Button
95
+ type="button"
96
+ variant="outline"
97
+ className={`w-full text-xs ${collapsed ? 'px-2' : ''}`}
98
+ onClick={() => void handleLogout()}
99
+ >
100
+ {collapsed ? 'Out' : 'Sign out'}
101
+ </Button>
102
+ </div>
103
+ ) : null}
104
+ </aside>
105
+ )
106
+
107
+ return (
108
+ <div className="flex min-h-screen bg-white">
109
+ <div className="hidden md:flex">{sidebarPanel}</div>
110
+
111
+ {mobileOpen ? (
112
+ <div className="fixed inset-0 z-40 flex md:hidden">
113
+ <button
114
+ type="button"
115
+ className="absolute inset-0 bg-black/40"
116
+ aria-label="Close navigation"
117
+ onClick={closeMobile}
118
+ />
119
+ <div className="relative z-50 flex h-full w-60 flex-col bg-white shadow-lg">{sidebarPanel}</div>
120
+ </div>
121
+ ) : null}
122
+
123
+ <div className="flex min-w-0 flex-1 flex-col">
124
+ <header className="flex items-center gap-3 border-b border-gray-200 px-4 py-3 md:hidden">
125
+ <button
126
+ type="button"
127
+ className="rounded-md border border-gray-200 px-2 py-1 text-sm text-gray-700"
128
+ aria-label="Open navigation"
129
+ onClick={() => setMobileOpen(true)}
130
+ >
131
+ Menu
132
+ </button>
133
+ <span className="text-sm font-semibold text-gray-900">WoodsPortal</span>
134
+ </header>
135
+ <main className="flex-1 p-6">{children}</main>
136
+ </div>
137
+ </div>
138
+ )
139
+ }
@@ -0,0 +1,42 @@
1
+ import type { ReactNode } from 'react'
2
+ import { useEffect } from 'react'
3
+
4
+ import { Link } from '@/components/ui/link'
5
+ import { portalNavItems } from '@/config/portal-nav'
6
+ import { usePortalSession } from '@/features/auth/use-portal-session'
7
+ import { api } from '@/integrations/woodsportal-sdk'
8
+
9
+ export default function MainLayout({ children }: { children?: ReactNode }) {
10
+ const isAuthenticated = usePortalSession()
11
+
12
+ useEffect(() => {
13
+ if (!isAuthenticated) {
14
+ return
15
+ }
16
+ const { me } = api.auth.me({})
17
+ void me()
18
+ }, [isAuthenticated])
19
+
20
+ return (
21
+ <div className="min-h-screen bg-white">
22
+ <header className="border-b border-gray-200 px-6 py-4">
23
+ <div className="flex items-center justify-between gap-4">
24
+ <span className="text-sm font-semibold text-gray-900">WoodsPortal</span>
25
+ <nav className="flex flex-wrap items-center gap-4 text-sm">
26
+ {portalNavItems.map((item) => (
27
+ <Link
28
+ key={item.to}
29
+ to={item.to}
30
+ activeProps={{ className: 'font-semibold text-gray-900 no-underline' }}
31
+ activeOptions={{ exact: true }}
32
+ >
33
+ {item.label}
34
+ </Link>
35
+ ))}
36
+ </nav>
37
+ </div>
38
+ </header>
39
+ <main className="p-6">{children}</main>
40
+ </div>
41
+ )
42
+ }