@woodsportal/hubspot-kit 1.0.4 → 1.0.26

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 (217) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +4 -2
  3. package/dist/{chunk-JDGIAYHX.js → chunk-GTTIJVAR.js} +43 -3
  4. package/dist/chunk-GTTIJVAR.js.map +1 -0
  5. package/dist/cli.js +1400 -338
  6. package/dist/cli.js.map +1 -1
  7. package/dist/exec-U2OJATR3.js +12 -0
  8. package/dist/index.d.ts +20 -0
  9. package/dist/index.js +8 -1
  10. package/dist/index.js.map +1 -1
  11. package/examples/greenfield/module-hybrid-cdn/README.md +40 -3
  12. package/examples/greenfield/module-hybrid-cdn/public/fields.json +44 -1
  13. package/examples/greenfield/module-hybrid-cdn/src/app.tsx +8 -0
  14. package/examples/greenfield/module-hybrid-cdn/src/assets/css/main.dev.css +6 -1
  15. package/examples/greenfield/module-hybrid-cdn/src/cdn/app-entry.ts +32 -0
  16. package/examples/greenfield/module-hybrid-cdn/src/cdn/vendor-entry.ts +28 -0
  17. package/examples/greenfield/module-hybrid-cdn/src/components/layout/section-card.tsx +20 -0
  18. package/examples/greenfield/module-hybrid-cdn/src/components/layout/starter-nav.tsx +28 -0
  19. package/examples/greenfield/module-hybrid-cdn/src/components/layout/starter-shell.tsx +18 -0
  20. package/examples/greenfield/module-hybrid-cdn/src/config/router.ts +4 -0
  21. package/examples/greenfield/module-hybrid-cdn/src/config/routes.ts +5 -0
  22. package/examples/greenfield/module-hybrid-cdn/src/defaultData.ts +2 -7
  23. package/examples/greenfield/module-hybrid-cdn/src/features/starter/components/starter-guide-page.tsx +93 -0
  24. package/examples/greenfield/module-hybrid-cdn/src/features/starter/components/starter-home-page.tsx +21 -0
  25. package/examples/greenfield/module-hybrid-cdn/src/features/starter/components/starter-home.tsx +52 -0
  26. package/examples/greenfield/module-hybrid-cdn/src/features/starter/components/starter-single-page.tsx +17 -0
  27. package/examples/greenfield/module-hybrid-cdn/src/features/starter/content/woodscli-guide-content.ts +86 -0
  28. package/examples/greenfield/module-hybrid-cdn/src/features/starter/hooks/use-starter-preview.ts +47 -0
  29. package/examples/greenfield/module-hybrid-cdn/src/features/starter/index.ts +6 -0
  30. package/examples/greenfield/module-hybrid-cdn/src/hubspot/bootstrap.ts +10 -0
  31. package/examples/greenfield/module-hybrid-cdn/src/hubspot/default-data.ts +7 -0
  32. package/examples/greenfield/module-hybrid-cdn/src/integrations/tanstack-router/router.tsx +25 -0
  33. package/examples/greenfield/module-hybrid-cdn/src/main.tsx +4 -3
  34. package/examples/greenfield/module-hybrid-cdn/src/portal/mount-dev-preview.tsx +8 -0
  35. package/examples/greenfield/module-hybrid-cdn/src/portal/mount-portal.tsx +12 -0
  36. package/examples/greenfield/module-hybrid-cdn/src/routeTree.gen.ts +77 -0
  37. package/examples/greenfield/module-hybrid-cdn/src/routes/__root.tsx +15 -0
  38. package/examples/greenfield/module-hybrid-cdn/src/routes/guide.tsx +7 -0
  39. package/examples/greenfield/module-hybrid-cdn/src/routes/index.tsx +7 -0
  40. package/examples/greenfield/module-hybrid-cdn/tsconfig.json +20 -0
  41. package/examples/greenfield/module-monolith/public/fields.json +44 -1
  42. package/examples/greenfield/module-monolith/src/app.tsx +8 -0
  43. package/examples/greenfield/module-monolith/src/assets/css/main.dev.css +8 -0
  44. package/examples/greenfield/module-monolith/src/components/layout/section-card.tsx +20 -0
  45. package/examples/greenfield/module-monolith/src/components/layout/starter-nav.tsx +28 -0
  46. package/examples/greenfield/module-monolith/src/components/layout/starter-shell.tsx +18 -0
  47. package/examples/greenfield/module-monolith/src/config/router.ts +4 -0
  48. package/examples/greenfield/module-monolith/src/config/routes.ts +5 -0
  49. package/examples/greenfield/module-monolith/src/defaultData.ts +2 -7
  50. package/examples/greenfield/module-monolith/src/features/starter/components/starter-guide-page.tsx +93 -0
  51. package/examples/greenfield/module-monolith/src/features/starter/components/starter-home-page.tsx +21 -0
  52. package/examples/greenfield/module-monolith/src/features/starter/components/starter-home.tsx +52 -0
  53. package/examples/greenfield/module-monolith/src/features/starter/components/starter-single-page.tsx +17 -0
  54. package/examples/greenfield/module-monolith/src/features/starter/content/woodscli-guide-content.ts +86 -0
  55. package/examples/greenfield/module-monolith/src/features/starter/hooks/use-starter-preview.ts +47 -0
  56. package/examples/greenfield/module-monolith/src/features/starter/index.ts +6 -0
  57. package/examples/greenfield/module-monolith/src/hubspot/default-data.ts +7 -0
  58. package/examples/greenfield/module-monolith/src/hubspot/types.ts +17 -0
  59. package/examples/greenfield/module-monolith/src/integrations/tanstack-router/router.tsx +25 -0
  60. package/examples/greenfield/module-monolith/src/main.tsx +5 -0
  61. package/examples/greenfield/module-monolith/src/portal/mount-dev-preview.tsx +8 -0
  62. package/examples/greenfield/module-monolith/src/portal/mount-portal.tsx +12 -0
  63. package/examples/greenfield/module-monolith/src/routeTree.gen.ts +77 -0
  64. package/examples/greenfield/module-monolith/src/routes/__root.tsx +15 -0
  65. package/examples/greenfield/module-monolith/src/routes/guide.tsx +7 -0
  66. package/examples/greenfield/module-monolith/src/routes/index.tsx +7 -0
  67. package/examples/greenfield/module-monolith/tsconfig.json +20 -0
  68. package/package.json +4 -1
  69. package/scripts/check-hubspot-bundle-size.mjs +5 -2
  70. package/scripts/ensure-wphs-workspace.mjs +2 -1
  71. package/scripts/hubspot-module-postbuild.mjs +1 -1
  72. package/scripts/read-woodsportal-config.mjs +4 -1
  73. package/scripts/run-hubspot-module-postbuild.mjs +9 -4
  74. package/scripts/vite/bootstrap-shim-resolver.js +47 -0
  75. package/scripts/vite/ensure-dev-kit-shims.js +7 -1
  76. package/scripts/vite/react-dev-plugin-options.js +2 -1
  77. package/scripts/watch-hubspot.mjs +107 -17
  78. package/scripts/wphs-paths.mjs +1 -0
  79. package/scripts/write-audit-artifacts.mjs +2 -1
  80. package/src/dev/bootstrap-greenfield.tsx +59 -0
  81. package/src/dev/bootstrap.tsx +46 -0
  82. package/src/dev-module-config/__tests__/fixtures/fields.json +3014 -0
  83. package/src/dev-module-config/__tests__/fixtures/golden-module.fixture.ts +102 -0
  84. package/src/dev-module-config/__tests__/module-config-storage.test.ts +40 -0
  85. package/src/dev-module-config/__tests__/module-config-transform.test.ts +55 -0
  86. package/src/dev-module-config/__tests__/normalize-repeater-items.test.ts +46 -0
  87. package/src/dev-module-config/dev-module-display-name.ts +5 -0
  88. package/src/dev-module-config/runtime/module-config-bridge.ts +27 -0
  89. package/src/dev-module-config/runtime/module-config-runtime.ts +185 -0
  90. package/src/dev-module-config/schema/build-default-item.ts +7 -0
  91. package/src/dev-module-config/schema/deep-merge.ts +27 -0
  92. package/src/dev-module-config/schema/extract-defaults.ts +62 -0
  93. package/src/dev-module-config/schema/normalize-choices.ts +18 -0
  94. package/src/dev-module-config/schema/normalize-repeater-items.ts +31 -0
  95. package/src/dev-module-config/schema/parse-fields-json.ts +2 -0
  96. package/src/dev-module-config/schema/types.ts +75 -0
  97. package/src/dev-module-config/schema/validate-module-config.ts +81 -0
  98. package/src/dev-module-config/schema/visibility.ts +130 -0
  99. package/src/dev-module-config/storage/config-json.ts +46 -0
  100. package/src/dev-module-config/storage/workspace-store.ts +139 -0
  101. package/src/dev-module-config/transform/build-hubspot-data.ts +409 -0
  102. package/src/dev-module-config/ui/FieldRenderer.tsx +353 -0
  103. package/src/dev-module-config/ui/ModuleConfigAnimatedPresence.tsx +72 -0
  104. package/src/dev-module-config/ui/ModuleConfigCollapsible.tsx +43 -0
  105. package/src/dev-module-config/ui/ModuleConfigDockSideIcon.tsx +27 -0
  106. package/src/dev-module-config/ui/ModuleConfigOverlay.tsx +134 -0
  107. package/src/dev-module-config/ui/ModuleConfigPersistenceStatus.tsx +89 -0
  108. package/src/dev-module-config/ui/ModuleConfigShell.tsx +355 -0
  109. package/src/dev-module-config/ui/ModuleConfigThemeToggle.tsx +32 -0
  110. package/src/dev-module-config/ui/ModuleConfigUiContext.tsx +65 -0
  111. package/src/dev-module-config/ui/editors/DeveloperOptionsEditor.tsx +61 -0
  112. package/src/dev-module-config/ui/editors/MenuOptionsEditor.tsx +103 -0
  113. package/src/dev-module-config/ui/hubspot/HsColorField.tsx +106 -0
  114. package/src/dev-module-config/ui/hubspot/HsColorPickerPopover.tsx +210 -0
  115. package/src/dev-module-config/ui/hubspot/HsFieldLabel.tsx +24 -0
  116. package/src/dev-module-config/ui/hubspot/HsFieldWidgets.tsx +248 -0
  117. package/src/dev-module-config/ui/hubspot/HsImageField.tsx +112 -0
  118. package/src/dev-module-config/ui/hubspot/HsOccurrenceGroupEditor.tsx +243 -0
  119. package/src/dev-module-config/ui/hubspot/HsRepeaterList.tsx +178 -0
  120. package/src/dev-module-config/ui/hubspot/HsSectionHeader.tsx +20 -0
  121. package/src/dev-module-config/ui/hubspot/HsToggle.tsx +39 -0
  122. package/src/dev-module-config/ui/hubspot/HsToggleRow.tsx +30 -0
  123. package/src/dev-module-config/ui/hubspot/hs-color-palette.ts +11 -0
  124. package/src/dev-module-config/ui/hubspot/module-config-typography.ts +26 -0
  125. package/src/dev-module-config/ui/module-config-motion.css +134 -0
  126. package/src/dev-module-config/ui/module-config-motion.ts +28 -0
  127. package/src/dev-module-config/ui/module-config-overlay-side.ts +29 -0
  128. package/src/dev-module-config/ui/module-config-surfaces.ts +27 -0
  129. package/src/dev-module-config/ui/module-config-theme.css +489 -0
  130. package/src/dev-module-config/ui/module-config-toolbar-theme.ts +35 -0
  131. package/src/dev-module-config/ui/navigation/ModuleConfigNavContext.tsx +194 -0
  132. package/src/dev-module-config/ui/use-dev-module-config-live-revision.ts +22 -0
  133. package/src/dev-module-config/ui/use-hubspot-live-exports.ts +27 -0
  134. package/src/dev-module-config/ui/use-module-config.ts +124 -0
  135. package/src/routing/build-api-routes.ts +37 -0
  136. package/src/routing/route-format.ts +19 -0
  137. package/templates/module-hybrid-cdn/README.md +53 -3
  138. package/templates/module-hybrid-cdn/index.html +12 -1
  139. package/templates/module-hybrid-cdn/package.json +6 -2
  140. package/templates/module-hybrid-cdn/public/fields.json +44 -1
  141. package/templates/module-hybrid-cdn/src/app.tsx +8 -0
  142. package/templates/module-hybrid-cdn/src/assets/css/main.dev.css +6 -1
  143. package/templates/module-hybrid-cdn/src/cdn/app-entry.ts +32 -0
  144. package/templates/module-hybrid-cdn/src/cdn/vendor-entry.ts +28 -0
  145. package/templates/module-hybrid-cdn/src/components/layout/section-card.tsx +20 -0
  146. package/templates/module-hybrid-cdn/src/components/layout/starter-nav.tsx +28 -0
  147. package/templates/module-hybrid-cdn/src/components/layout/starter-shell.tsx +18 -0
  148. package/templates/module-hybrid-cdn/src/config/router.ts +4 -0
  149. package/templates/module-hybrid-cdn/src/config/routes.ts +5 -0
  150. package/templates/module-hybrid-cdn/src/defaultData.ts +2 -7
  151. package/templates/module-hybrid-cdn/src/features/starter/components/starter-guide-page.tsx +93 -0
  152. package/templates/module-hybrid-cdn/src/features/starter/components/starter-home-page.tsx +21 -0
  153. package/templates/module-hybrid-cdn/src/features/starter/components/starter-home.tsx +52 -0
  154. package/templates/module-hybrid-cdn/src/features/starter/components/starter-single-page.tsx +17 -0
  155. package/templates/module-hybrid-cdn/src/features/starter/content/woodscli-guide-content.ts +86 -0
  156. package/templates/module-hybrid-cdn/src/features/starter/hooks/starter-preview-values.ts +42 -0
  157. package/templates/module-hybrid-cdn/src/features/starter/hooks/use-starter-preview.dev.ts +17 -0
  158. package/templates/module-hybrid-cdn/src/features/starter/hooks/use-starter-preview.ts +30 -0
  159. package/templates/module-hybrid-cdn/src/features/starter/index.ts +6 -0
  160. package/templates/module-hybrid-cdn/src/hubspot/bootstrap.ts +10 -0
  161. package/templates/module-hybrid-cdn/src/hubspot/default-data.ts +7 -0
  162. package/templates/module-hybrid-cdn/src/hubspot/module-entry.tsx +9 -0
  163. package/templates/module-hybrid-cdn/src/integrations/tanstack-router/router.tsx +25 -0
  164. package/templates/module-hybrid-cdn/src/main.tsx +4 -3
  165. package/templates/module-hybrid-cdn/src/portal/mount-dev-preview.tsx +8 -0
  166. package/templates/module-hybrid-cdn/src/portal/mount-portal.tsx +12 -0
  167. package/templates/module-hybrid-cdn/src/routeTree.gen.ts +77 -0
  168. package/templates/module-hybrid-cdn/src/routes/__root.tsx +15 -0
  169. package/templates/module-hybrid-cdn/src/routes/guide.tsx +7 -0
  170. package/templates/module-hybrid-cdn/src/routes/index.tsx +7 -0
  171. package/templates/module-hybrid-cdn/tsconfig.json +20 -0
  172. package/templates/module-hybrid-cdn/vite.config.monolith.mjs +8 -0
  173. package/templates/module-monolith/README.md +59 -0
  174. package/templates/module-monolith/index.html +12 -0
  175. package/templates/module-monolith/package.json +10 -3
  176. package/templates/module-monolith/public/fields.json +44 -1
  177. package/templates/module-monolith/public/module.html +1 -0
  178. package/templates/module-monolith/src/app.tsx +8 -0
  179. package/templates/module-monolith/src/assets/css/main.dev.css +6 -1
  180. package/templates/module-monolith/src/components/layout/section-card.tsx +20 -0
  181. package/templates/module-monolith/src/components/layout/starter-nav.tsx +28 -0
  182. package/templates/module-monolith/src/components/layout/starter-shell.tsx +18 -0
  183. package/templates/module-monolith/src/config/router.ts +4 -0
  184. package/templates/module-monolith/src/config/routes.ts +5 -0
  185. package/templates/module-monolith/src/defaultData.ts +2 -7
  186. package/templates/module-monolith/src/features/starter/components/starter-guide-page.tsx +93 -0
  187. package/templates/module-monolith/src/features/starter/components/starter-home-page.tsx +21 -0
  188. package/templates/module-monolith/src/features/starter/components/starter-home.tsx +52 -0
  189. package/templates/module-monolith/src/features/starter/components/starter-single-page.tsx +17 -0
  190. package/templates/module-monolith/src/features/starter/content/woodscli-guide-content.ts +86 -0
  191. package/templates/module-monolith/src/features/starter/hooks/starter-preview-values.ts +42 -0
  192. package/templates/module-monolith/src/features/starter/hooks/use-starter-preview.dev.ts +17 -0
  193. package/templates/module-monolith/src/features/starter/hooks/use-starter-preview.ts +30 -0
  194. package/templates/module-monolith/src/features/starter/index.ts +6 -0
  195. package/templates/module-monolith/src/hubspot/default-data.ts +7 -0
  196. package/templates/module-monolith/src/hubspot/module-entry.tsx +9 -0
  197. package/templates/module-monolith/src/integrations/tanstack-router/router.tsx +25 -0
  198. package/templates/module-monolith/src/main.tsx +4 -3
  199. package/templates/module-monolith/src/portal/mount-dev-preview.tsx +8 -0
  200. package/templates/module-monolith/src/portal/mount-portal.tsx +12 -0
  201. package/templates/module-monolith/src/routeTree.gen.ts +77 -0
  202. package/templates/module-monolith/src/routes/__root.tsx +15 -0
  203. package/templates/module-monolith/src/routes/guide.tsx +7 -0
  204. package/templates/module-monolith/src/routes/index.tsx +7 -0
  205. package/templates/module-monolith/tsconfig.json +20 -0
  206. package/templates/module-monolith/vite.config.monolith.mjs +8 -0
  207. package/templates/module-monolith/woodscli.json +1 -0
  208. package/templates/shared/.env.dev.example +5 -0
  209. package/templates/shared/.env.prod.example +5 -0
  210. package/templates/shared/.env.stg.example +3 -0
  211. package/templates/shared/portal.cdn.json.example +8 -0
  212. package/templates/theme-starter/package.json +5 -2
  213. package/vite/vite.config.dev.mjs +9 -1
  214. package/vite/vite.config.monolith.mjs +22 -17
  215. package/dist/chunk-JDGIAYHX.js.map +0 -1
  216. package/dist/exec-K5C6LZP4.js +0 -10
  217. /package/dist/{exec-K5C6LZP4.js.map → exec-U2OJATR3.js.map} +0 -0
@@ -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'
@@ -0,0 +1,6 @@
1
+ export { StarterHomePage } from './components/starter-home-page'
2
+ export { StarterGuidePage } from './components/starter-guide-page'
3
+ export { StarterSinglePage } from './components/starter-single-page'
4
+ export { StarterHome } from './components/starter-home'
5
+ export { useStarterPreview } from './hooks/use-starter-preview'
6
+ export type { StarterPreviewValues } from './hooks/starter-preview-values'
@@ -0,0 +1,7 @@
1
+ /** Local dev fixtures merged by the module-config runtime in `wp dev`. */
2
+ export const devDefaultData = {
3
+ dataSourceSet: [],
4
+ hubId: 'dev',
5
+ userData: {},
6
+ objectList: [] as unknown[],
7
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Monolith production entry — single IIFE `module.js` (wp build).
3
+ * Dev overlay uses `src/main.tsx` instead.
4
+ */
5
+ import '@/assets/css/main.dev.css'
6
+
7
+ import { mountPortal } from '@/portal/mount-portal'
8
+
9
+ void mountPortal()
@@ -0,0 +1,25 @@
1
+ import {
2
+ createBrowserHistory,
3
+ createHashHistory,
4
+ createRouter,
5
+ } from '@tanstack/react-router'
6
+
7
+ import { ROUTER_HISTORY } from '@/config/router'
8
+ import { routeTree } from '@/routeTree.gen'
9
+
10
+ const history = ROUTER_HISTORY === 'hash' ? createHashHistory() : createBrowserHistory()
11
+
12
+ export const router = createRouter({
13
+ routeTree,
14
+ history,
15
+ defaultPreload: 'intent',
16
+ scrollRestoration: true,
17
+ defaultStructuralSharing: true,
18
+ defaultPreloadStaleTime: 0,
19
+ })
20
+
21
+ declare module '@tanstack/react-router' {
22
+ interface Register {
23
+ router: typeof router
24
+ }
25
+ }
@@ -1,4 +1,5 @@
1
- import './assets/css/main.dev.css'
2
- import { mountGreenfieldDev } from '@woodsportal/hubspot-kit/dev/bootstrap-greenfield'
1
+ import '@/assets/css/main.dev.css'
3
2
 
4
- void mountGreenfieldDev()
3
+ import { mountDevPreview } from '@/portal/mount-dev-preview'
4
+
5
+ void mountDevPreview()
@@ -0,0 +1,8 @@
1
+ import { mountGreenfieldDev } from '../../.wphs/.kit-bootstrap-greenfield.tsx'
2
+
3
+ import { App } from '@/app'
4
+
5
+ /** Local dev: module-config overlay + routed starter preview. */
6
+ export async function mountDevPreview() {
7
+ await mountGreenfieldDev({ preview: <App /> })
8
+ }
@@ -0,0 +1,12 @@
1
+ import ReactDOM from 'react-dom/client'
2
+
3
+ import { App } from '@/app'
4
+
5
+ /** Production mount — same App shell as woodsportal-client-frontend CDN app chunk. */
6
+ export async function mountPortal() {
7
+ const root = document.getElementById('app')
8
+ if (!root) {
9
+ return
10
+ }
11
+ ReactDOM.createRoot(root).render(<App />)
12
+ }
@@ -0,0 +1,77 @@
1
+ /* eslint-disable */
2
+
3
+ // @ts-nocheck
4
+
5
+ // noinspection JSUnusedGlobalSymbols
6
+
7
+ // This file was automatically generated by TanStack Router.
8
+ // You should NOT make any changes in this file as it will be overwritten.
9
+ // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
10
+
11
+ import { Route as rootRouteImport } from './routes/__root'
12
+ import { Route as GuideRouteImport } from './routes/guide'
13
+ import { Route as IndexRouteImport } from './routes/index'
14
+
15
+ const GuideRoute = GuideRouteImport.update({
16
+ id: '/guide',
17
+ path: '/guide',
18
+ getParentRoute: () => rootRouteImport,
19
+ } as any)
20
+ const IndexRoute = IndexRouteImport.update({
21
+ id: '/',
22
+ path: '/',
23
+ getParentRoute: () => rootRouteImport,
24
+ } as any)
25
+
26
+ export interface FileRoutesByFullPath {
27
+ '/': typeof IndexRoute
28
+ '/guide': typeof GuideRoute
29
+ }
30
+ export interface FileRoutesByTo {
31
+ '/': typeof IndexRoute
32
+ '/guide': typeof GuideRoute
33
+ }
34
+ export interface FileRoutesById {
35
+ __root__: typeof rootRouteImport
36
+ '/': typeof IndexRoute
37
+ '/guide': typeof GuideRoute
38
+ }
39
+ export interface FileRouteTypes {
40
+ fileRoutesByFullPath: FileRoutesByFullPath
41
+ fullPaths: '/' | '/guide'
42
+ fileRoutesByTo: FileRoutesByTo
43
+ to: '/' | '/guide'
44
+ id: '__root__' | '/' | '/guide'
45
+ fileRoutesById: FileRoutesById
46
+ }
47
+ export interface RootRouteChildren {
48
+ IndexRoute: typeof IndexRoute
49
+ GuideRoute: typeof GuideRoute
50
+ }
51
+
52
+ declare module '@tanstack/react-router' {
53
+ interface FileRoutesByPath {
54
+ '/guide': {
55
+ id: '/guide'
56
+ path: '/guide'
57
+ fullPath: '/guide'
58
+ preLoaderRoute: typeof GuideRouteImport
59
+ parentRoute: typeof rootRouteImport
60
+ }
61
+ '/': {
62
+ id: '/'
63
+ path: '/'
64
+ fullPath: '/'
65
+ preLoaderRoute: typeof IndexRouteImport
66
+ parentRoute: typeof rootRouteImport
67
+ }
68
+ }
69
+ }
70
+
71
+ const rootRouteChildren: RootRouteChildren = {
72
+ IndexRoute: IndexRoute,
73
+ GuideRoute: GuideRoute,
74
+ }
75
+ export const routeTree = rootRouteImport
76
+ ._addFileChildren(rootRouteChildren)
77
+ ._addFileTypes<FileRouteTypes>()
@@ -0,0 +1,15 @@
1
+ import { Outlet, createRootRoute } from '@tanstack/react-router'
2
+
3
+ import { StarterShell } from '@/components/layout/starter-shell'
4
+
5
+ function RootLayout() {
6
+ return (
7
+ <StarterShell>
8
+ <Outlet />
9
+ </StarterShell>
10
+ )
11
+ }
12
+
13
+ export const Route = createRootRoute({
14
+ component: RootLayout,
15
+ })
@@ -0,0 +1,7 @@
1
+ import { createFileRoute } from '@tanstack/react-router'
2
+
3
+ import { StarterGuidePage } from '@/features/starter'
4
+
5
+ export const Route = createFileRoute('/guide')({
6
+ component: StarterGuidePage,
7
+ })
@@ -0,0 +1,7 @@
1
+ import { createFileRoute } from '@tanstack/react-router'
2
+
3
+ import { StarterHomePage } from '@/features/starter'
4
+
5
+ export const Route = createFileRoute('/')({
6
+ component: StarterHomePage,
7
+ })
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "jsx": "react-jsx",
5
+ "module": "ESNext",
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "types": ["vite/client"],
8
+ "moduleResolution": "bundler",
9
+ "allowImportingTsExtensions": true,
10
+ "verbatimModuleSyntax": true,
11
+ "noEmit": true,
12
+ "skipLibCheck": true,
13
+ "strict": true,
14
+ "baseUrl": ".",
15
+ "paths": {
16
+ "@/*": ["./src/*"]
17
+ }
18
+ },
19
+ "include": ["src/**/*.ts", "src/**/*.tsx", "wphs.adapter.ts"]
20
+ }
@@ -1 +1,9 @@
1
+ import { dirname, resolve } from 'node:path'
2
+ import { fileURLToPath } from 'node:url'
3
+
4
+ // Kit preset must read woodscli.json from this project — not from kit/vite/__dirname.
5
+ if (!process.env.WP_HS_PROJECT_ROOT?.trim()) {
6
+ process.env.WP_HS_PROJECT_ROOT = resolve(dirname(fileURLToPath(import.meta.url)))
7
+ }
8
+
1
9
  export { default } from '@woodsportal/hubspot-kit/vite/vite.config.monolith.mjs'
@@ -15,6 +15,7 @@
15
15
  "app": "src/cdn/app-entry.ts",
16
16
  "vendor": "src/cdn/vendor-entry.ts",
17
17
  "hubspotBootstrap": "src/hubspot/bootstrap.ts",
18
+ "module": "src/hubspot/module-entry.tsx",
18
19
  "localDev": "src/main.tsx"
19
20
  },
20
21
  "dev": {
@@ -0,0 +1,5 @@
1
+ # Local dev — copy to .env.dev (or run wp setup)
2
+ VITE_DEV_MODE=live
3
+ VITE_PUBLIC_REST_API_ENDPOINT=https://api.dev.woodsportal.com
4
+ # VITE_DEV_PORTAL_ID=1
5
+ # VITE_DEV_HUB_ID=12345678
@@ -0,0 +1,5 @@
1
+ # Production CDN build — copy to .env.prod (or run wp setup)
2
+ VITE_NODE_ENV=prod
3
+ VITE_PORTAL_EMBED_MODE=cdn
4
+ VITE_PUBLIC_REST_API_ENDPOINT=https://api.woodsportal.com
5
+ # PORTAL_CDN_PUBLISH_TOKEN=ghp_... # export in shell for wp publish — never commit
@@ -0,0 +1,3 @@
1
+ # Staging CDN build — copy to .env.stg (or run wp setup)
2
+ VITE_NODE_ENV=stg
3
+ VITE_PUBLIC_REST_API_ENDPOINT=https://api.dev.woodsportal.com
@@ -0,0 +1,8 @@
1
+ {
2
+ "publishMode": "jsdelivr",
3
+ "github": "your-org/your-portal-cdn-mirror",
4
+ "gitRemote": "https://github.com/your-org/your-portal-cdn-mirror.git",
5
+ "cdnPathInRepo": "dist/cdn",
6
+ "defaultBranch": "main",
7
+ "_note": "Forks: point github/gitRemote at your jsDelivr mirror repo, or set cdn.mode custom in woodscli.json."
8
+ }
@@ -9,11 +9,14 @@
9
9
  "deploy:prod": "wp deploy --tier prod"
10
10
  },
11
11
  "devDependencies": {
12
- "@woodsportal/hubspot-kit": "^1.0.4",
12
+ "@woodsportal/hubspot-kit": "^1.0.11",
13
+ "@dnd-kit/core": "^6.3.1",
14
+ "@dnd-kit/sortable": "^10.0.0",
15
+ "@dnd-kit/utilities": "^3.2.2",
13
16
  "@tailwindcss/vite": "^4.0.6",
14
17
  "@tanstack/router-plugin": "^1.121.2",
15
18
  "@vitejs/plugin-react": "^4.3.4",
16
- "babel-plugin-react-compiler": "^1.0.0",
19
+ "babel-plugin-react-compiler": "^1.0.11",
17
20
  "react": "^19.0.0",
18
21
  "react-dom": "^19.0.0",
19
22
  "tailwindcss": "^4.0.6",
@@ -11,6 +11,7 @@ import TailwindContentPlugin from '../scripts/tailwind/tailwind-content-plugin.j
11
11
  import sdkLogBridge from '../scripts/vite/sdk-log-bridge.js'
12
12
  import moduleConfigStore from '../scripts/vite/module-config-store.js'
13
13
  import resolveFromProjectRoot from '../scripts/vite/resolve-from-project-root.js'
14
+ import bootstrapShimResolver from '../scripts/vite/bootstrap-shim-resolver.js'
14
15
  import { createDevReactPluginOptions } from '../scripts/vite/react-dev-plugin-options.js'
15
16
  import { ensureDevKitShims } from '../scripts/vite/ensure-dev-kit-shims.js'
16
17
  import isPrefix from '../scripts/tailwind/prefix.env.js'
@@ -19,7 +20,7 @@ import { readWoodsportalConfig } from '../scripts/read-woodsportal-config.mjs'
19
20
 
20
21
  const kitRoot = getKitRoot()
21
22
  const projectRoot = findProjectRoot()
22
- const { moduleConfigRoot, bootstrapShim } = ensureDevKitShims(projectRoot, kitRoot)
23
+ const { moduleConfigRoot, bootstrapShim, bootstrapGreenfieldShim } = ensureDevKitShims(projectRoot, kitRoot)
23
24
  const { config } = readWoodsportalConfig(projectRoot)
24
25
  const routesDir = resolve(projectRoot, 'src/routes')
25
26
  const hasTanStackRoutes = existsSync(routesDir)
@@ -28,6 +29,7 @@ export default defineConfig(({ mode, command }) => {
28
29
  return {
29
30
  root: projectRoot,
30
31
  plugins: [
32
+ bootstrapShimResolver({ bootstrapShim, bootstrapGreenfieldShim, kitRoot }),
31
33
  resolveFromProjectRoot(projectRoot, kitRoot),
32
34
  ...(command === 'serve' && mode === 'dev'
33
35
  ? [sdkLogBridge(), moduleConfigStore(projectRoot)]
@@ -41,7 +43,10 @@ export default defineConfig(({ mode, command }) => {
41
43
  preserveSymlinks: true,
42
44
  alias: {
43
45
  '@/dev/module-config': moduleConfigRoot,
46
+ '@wphs/bootstrap': bootstrapShim,
47
+ '@wphs/bootstrap-greenfield': bootstrapGreenfieldShim,
44
48
  '@woodsportal/hubspot-kit/dev/bootstrap': bootstrapShim,
49
+ '@woodsportal/hubspot-kit/dev/bootstrap-greenfield': bootstrapGreenfieldShim,
45
50
  '@wphs/adapter': resolve(projectRoot, config?.dev?.adapter ?? './wphs.adapter.ts'),
46
51
  '@': resolve(projectRoot, './src'),
47
52
  },
@@ -54,6 +59,9 @@ export default defineConfig(({ mode, command }) => {
54
59
  ],
55
60
  },
56
61
  define: {
62
+ 'import.meta.env.VITE_WPHS_MODULE_NAME': JSON.stringify(
63
+ config?.module?.name ?? config?.theme?.name ?? 'module',
64
+ ),
57
65
  'process.env.NODE_ENV': JSON.stringify(mode === 'dev' ? 'development' : 'production'),
58
66
  'process.env': {},
59
67
  process: JSON.stringify({ env: {} }),
@@ -5,29 +5,34 @@
5
5
  import { defineConfig } from 'vite'
6
6
  import react from '@vitejs/plugin-react'
7
7
  import tailwindcss from '@tailwindcss/vite'
8
- import { dirname, resolve } from 'node:path'
9
- import { fileURLToPath } from 'node:url'
10
- import { createRequire } from 'node:module'
8
+ import { resolve } from 'node:path'
11
9
 
10
+ import { findProjectRoot, getKitRoot } from '../scripts/project-root.mjs'
12
11
  import { readWoodsportalConfig } from '../scripts/read-woodsportal-config.mjs'
13
12
 
14
- const require = createRequire(import.meta.url)
15
- const kitRoot = dirname(require.resolve('@woodsportal/hubspot-kit/package.json'))
16
- const __dirname = dirname(fileURLToPath(import.meta.url))
17
-
18
- const { root, config } = readWoodsportalConfig(__dirname)
13
+ const kitRoot = getKitRoot()
14
+ const projectRoot = findProjectRoot()
15
+ const { config } = readWoodsportalConfig(projectRoot)
19
16
  const outDir = config?.module?.outDir ?? 'dist/HubSpot.Module'
20
- const entry = config?.entries?.localDev ?? 'src/main.tsx'
17
+ const entry =
18
+ config?.entries?.module ?? config?.entries?.localDev ?? 'src/hubspot/module-entry.tsx'
21
19
 
22
20
  export default defineConfig({
21
+ root: projectRoot,
23
22
  plugins: [react(), tailwindcss()],
24
23
  resolve: {
25
- alias: {
26
- '@': resolve(root, 'src'),
27
- '@wphs/adapter': resolve(root, config?.dev?.adapter ?? './wphs.adapter.ts'),
28
- '@/dev/module-config': resolve(kitRoot, 'src/dev-module-config'),
29
- '@woodsportal/hubspot-kit/dev/bootstrap': resolve(kitRoot, 'src/dev/bootstrap.tsx'),
30
- },
24
+ alias: [
25
+ { find: '@/dev/module-config', replacement: resolve(kitRoot, 'src/dev-module-config') },
26
+ {
27
+ find: '@woodsportal/hubspot-kit/dev/bootstrap',
28
+ replacement: resolve(kitRoot, 'src/dev/bootstrap.tsx'),
29
+ },
30
+ {
31
+ find: '@wphs/adapter',
32
+ replacement: resolve(projectRoot, config?.dev?.adapter ?? './wphs.adapter.ts'),
33
+ },
34
+ { find: '@', replacement: resolve(projectRoot, 'src') },
35
+ ],
31
36
  },
32
37
  define: {
33
38
  'process.env.NODE_ENV': JSON.stringify('production'),
@@ -35,11 +40,11 @@ export default defineConfig({
35
40
  process: JSON.stringify({ env: {} }),
36
41
  },
37
42
  build: {
38
- outDir: resolve(root, outDir),
43
+ outDir: resolve(projectRoot, outDir),
39
44
  copyPublicDir: false,
40
45
  cssCodeSplit: false,
41
46
  lib: {
42
- entry: resolve(root, entry),
47
+ entry: resolve(projectRoot, entry),
43
48
  name: 'HubSpotModule',
44
49
  fileName: () => 'module.js',
45
50
  formats: ['iife'],
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/exec.ts","../src/lib/errors.ts"],"sourcesContent":["import { spawnSync, type SpawnSyncOptions } from 'node:child_process'\n\nimport { WpHsError, ExitCode } from './errors.js'\nimport type { Logger } from './logger.js'\n\nconst SECRET_PATTERN = /(token|secret|password|pat|key)=/i\n\nfunction maskEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {\n const masked: NodeJS.ProcessEnv = { ...env }\n for (const key of Object.keys(masked)) {\n if (/token|secret|password|pat|auth/i.test(key) && masked[key]) {\n masked[key] = '[redacted]'\n }\n }\n return masked\n}\n\nexport type RunOptions = {\n cwd: string\n env?: NodeJS.ProcessEnv\n logger?: Logger\n dryRun?: boolean\n timeoutMs?: number\n /** Expected exit code on success (default 0) */\n okCodes?: number[]\n}\n\nexport function runCommand(\n command: string,\n args: string[],\n options: RunOptions,\n): { status: number; stdout: string; stderr: string } {\n const { cwd, env = process.env, logger, dryRun = false, okCodes = [0] } = options\n\n if (dryRun) {\n logger?.info(`[dry-run] ${command} ${args.join(' ')}`, { cwd })\n return { status: 0, stdout: '', stderr: '' }\n }\n\n logger?.debug(`exec: ${command} ${args.join(' ')}`, {\n cwd,\n env: logger ? maskEnv(env) : undefined,\n })\n\n const spawnOpts: SpawnSyncOptions = {\n cwd,\n env,\n encoding: 'utf8',\n stdio: ['inherit', 'pipe', 'pipe'],\n }\n\n const result = spawnSync(command, args, spawnOpts)\n const status = result.status ?? 1\n const stdout = typeof result.stdout === 'string' ? result.stdout : ''\n const stderr = typeof result.stderr === 'string' ? result.stderr : ''\n\n if (!okCodes.includes(status)) {\n const detail = stderr.trim() || stdout.trim() || `exit ${status}`\n if (SECRET_PATTERN.test(detail)) {\n throw new WpHsError(`Command failed: ${command}`, {\n exitCode: ExitCode.USER_ERROR,\n remediation: 'Re-run with --verbose for details (secrets are never logged).',\n })\n }\n throw new WpHsError(`Command failed: ${command} ${args.join(' ')}\\n${detail}`, {\n exitCode: ExitCode.USER_ERROR,\n })\n }\n\n return { status, stdout, stderr }\n}\n\nexport function runNodeScript(\n scriptPath: string,\n args: string[],\n options: RunOptions,\n): void {\n runCommand(process.execPath, [scriptPath, ...args], options)\n}\n","export const ExitCode = {\n SUCCESS: 0,\n USER_ERROR: 1,\n PREREQUISITE: 2,\n BUILD_FAILED: 3,\n PUBLISH_FAILED: 4,\n AUDIT_FAILED: 5,\n INTERNAL: 10,\n} as const\n\nexport type ExitCodeValue = (typeof ExitCode)[keyof typeof ExitCode]\n\nexport class WpHsError extends Error {\n readonly exitCode: ExitCodeValue\n readonly remediation?: string\n\n constructor(\n message: string,\n options: { exitCode?: ExitCodeValue; remediation?: string; cause?: unknown } = {},\n ) {\n super(message, { cause: options.cause })\n this.name = 'WpHsError'\n this.exitCode = options.exitCode ?? ExitCode.USER_ERROR\n this.remediation = options.remediation\n }\n}\n\nexport function isWpHsError(error: unknown): error is WpHsError {\n return error instanceof WpHsError\n}\n"],"mappings":";;;AAAA,SAAS,iBAAwC;;;ACA1C,IAAM,WAAW;AAAA,EACtB,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,UAAU;AACZ;AAIO,IAAM,YAAN,cAAwB,MAAM;AAAA,EAC1B;AAAA,EACA;AAAA,EAET,YACE,SACA,UAA+E,CAAC,GAChF;AACA,UAAM,SAAS,EAAE,OAAO,QAAQ,MAAM,CAAC;AACvC,SAAK,OAAO;AACZ,SAAK,WAAW,QAAQ,YAAY,SAAS;AAC7C,SAAK,cAAc,QAAQ;AAAA,EAC7B;AACF;AAEO,SAAS,YAAY,OAAoC;AAC9D,SAAO,iBAAiB;AAC1B;;;ADxBA,IAAM,iBAAiB;AAEvB,SAAS,QAAQ,KAA2C;AAC1D,QAAM,SAA4B,EAAE,GAAG,IAAI;AAC3C,aAAW,OAAO,OAAO,KAAK,MAAM,GAAG;AACrC,QAAI,kCAAkC,KAAK,GAAG,KAAK,OAAO,GAAG,GAAG;AAC9D,aAAO,GAAG,IAAI;AAAA,IAChB;AAAA,EACF;AACA,SAAO;AACT;AAYO,SAAS,WACd,SACA,MACA,SACoD;AACpD,QAAM,EAAE,KAAK,MAAM,QAAQ,KAAK,QAAQ,SAAS,OAAO,UAAU,CAAC,CAAC,EAAE,IAAI;AAE1E,MAAI,QAAQ;AACV,YAAQ,KAAK,aAAa,OAAO,IAAI,KAAK,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;AAC9D,WAAO,EAAE,QAAQ,GAAG,QAAQ,IAAI,QAAQ,GAAG;AAAA,EAC7C;AAEA,UAAQ,MAAM,SAAS,OAAO,IAAI,KAAK,KAAK,GAAG,CAAC,IAAI;AAAA,IAClD;AAAA,IACA,KAAK,SAAS,QAAQ,GAAG,IAAI;AAAA,EAC/B,CAAC;AAED,QAAM,YAA8B;AAAA,IAClC;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,OAAO,CAAC,WAAW,QAAQ,MAAM;AAAA,EACnC;AAEA,QAAM,SAAS,UAAU,SAAS,MAAM,SAAS;AACjD,QAAM,SAAS,OAAO,UAAU;AAChC,QAAM,SAAS,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS;AACnE,QAAM,SAAS,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS;AAEnE,MAAI,CAAC,QAAQ,SAAS,MAAM,GAAG;AAC7B,UAAM,SAAS,OAAO,KAAK,KAAK,OAAO,KAAK,KAAK,QAAQ,MAAM;AAC/D,QAAI,eAAe,KAAK,MAAM,GAAG;AAC/B,YAAM,IAAI,UAAU,mBAAmB,OAAO,IAAI;AAAA,QAChD,UAAU,SAAS;AAAA,QACnB,aAAa;AAAA,MACf,CAAC;AAAA,IACH;AACA,UAAM,IAAI,UAAU,mBAAmB,OAAO,IAAI,KAAK,KAAK,GAAG,CAAC;AAAA,EAAK,MAAM,IAAI;AAAA,MAC7E,UAAU,SAAS;AAAA,IACrB,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,QAAQ,QAAQ,OAAO;AAClC;AAEO,SAAS,cACd,YACA,MACA,SACM;AACN,aAAW,QAAQ,UAAU,CAAC,YAAY,GAAG,IAAI,GAAG,OAAO;AAC7D;","names":[]}
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- runCommand,
4
- runNodeScript
5
- } from "./chunk-JDGIAYHX.js";
6
- export {
7
- runCommand,
8
- runNodeScript
9
- };
10
- //# sourceMappingURL=exec-K5C6LZP4.js.map