@weaverse/hydrogen 5.17.0 → 5.18.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 (70) hide show
  1. package/dist/index.js +83 -1
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +83 -1
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/types/WeaverseHydrogenRoot.d.ts +218 -0
  6. package/dist/types/WeaverseHydrogenRoot.d.ts.map +1 -0
  7. package/dist/types/components/index.d.ts +4 -0
  8. package/dist/types/components/index.d.ts.map +1 -0
  9. package/dist/types/components/main.d.ts +7 -0
  10. package/dist/types/components/main.d.ts.map +1 -0
  11. package/dist/types/hooks/theme-text-context.d.ts +2 -0
  12. package/dist/types/hooks/theme-text-context.d.ts.map +1 -0
  13. package/dist/types/hooks/translation-context.d.ts +138 -0
  14. package/dist/types/hooks/translation-context.d.ts.map +1 -0
  15. package/dist/types/hooks/use-weaverse-data-context.d.ts +29 -0
  16. package/dist/types/hooks/use-weaverse-data-context.d.ts.map +1 -0
  17. package/dist/types/index.d.ts +99 -0
  18. package/dist/types/index.d.ts.map +1 -0
  19. package/dist/types/seo.d.ts +43 -0
  20. package/dist/types/seo.d.ts.map +1 -0
  21. package/dist/types/types.d.ts +826 -0
  22. package/dist/types/types.d.ts.map +1 -0
  23. package/dist/types/utils/index.d.ts +44 -0
  24. package/dist/types/utils/index.d.ts.map +1 -0
  25. package/dist/types/utils/normalize-page-url.d.ts +16 -0
  26. package/dist/types/utils/normalize-page-url.d.ts.map +1 -0
  27. package/dist/types/utils/pick-weaverse-data.d.ts +44 -0
  28. package/dist/types/utils/pick-weaverse-data.d.ts.map +1 -0
  29. package/dist/types/utils/pixel.d.ts +16 -0
  30. package/dist/types/utils/pixel.d.ts.map +1 -0
  31. package/dist/types/utils/studio-request-info.d.ts +17 -0
  32. package/dist/types/utils/studio-request-info.d.ts.map +1 -0
  33. package/dist/types/utils/studio-script-src.d.ts +78 -0
  34. package/dist/types/utils/studio-script-src.d.ts.map +1 -0
  35. package/dist/types/utils/sync-reused-instance.d.ts +21 -0
  36. package/dist/types/utils/sync-reused-instance.d.ts.map +1 -0
  37. package/dist/types/utils/theme-text-store.d.ts +2 -0
  38. package/dist/types/utils/theme-text-store.d.ts.map +1 -0
  39. package/dist/types/utils/translation-store.d.ts +40 -0
  40. package/dist/types/utils/translation-store.d.ts.map +1 -0
  41. package/dist/types/utils/use-studio.d.ts +33 -0
  42. package/dist/types/utils/use-studio.d.ts.map +1 -0
  43. package/dist/types/utils/use-theme-settings-store.d.ts +39 -0
  44. package/dist/types/utils/use-theme-settings-store.d.ts.map +1 -0
  45. package/dist/types/weaverse-client.d.ts +227 -0
  46. package/dist/types/weaverse-client.d.ts.map +1 -0
  47. package/package.json +7 -6
  48. package/src/WeaverseHydrogenRoot.tsx +649 -0
  49. package/src/components/index.ts +10 -0
  50. package/src/components/main.tsx +28 -0
  51. package/src/hooks/theme-text-context.tsx +14 -0
  52. package/src/hooks/translation-context.tsx +275 -0
  53. package/src/hooks/use-weaverse-data-context.ts +69 -0
  54. package/src/index.ts +179 -0
  55. package/src/seo.ts +125 -0
  56. package/src/types.ts +1020 -0
  57. package/src/utils/index.ts +351 -0
  58. package/src/utils/normalize-page-url.ts +44 -0
  59. package/src/utils/pick-weaverse-data.ts +89 -0
  60. package/src/utils/pixel.ts +71 -0
  61. package/src/utils/studio-request-info.ts +66 -0
  62. package/src/utils/studio-script-src.ts +162 -0
  63. package/src/utils/sync-reused-instance.ts +57 -0
  64. package/src/utils/theme-text-store.ts +1 -0
  65. package/src/utils/translation-store.ts +65 -0
  66. package/src/utils/use-studio.ts +168 -0
  67. package/src/utils/use-theme-settings-store.ts +160 -0
  68. package/src/weaverse-client.ts +1179 -0
  69. package/dist/index.d.mts +0 -1269
  70. package/dist/index.d.ts +0 -1269
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA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AAM,MAAM,cAAc,GAAG;IAC3B,gEAAgE;IAChE,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAAA;CACvC,CAAA;AAED,oDAAoD;AACpD,MAAM,WAAW,gBAAgB;IAC/B,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAA;IACX,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAA;IACrB,kCAAkC;IAClC,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,iEAAiE;AACjE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAA;IAClB,wDAAwD;IACxD,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAC5B,CAAA"}
@@ -0,0 +1,44 @@
1
+ import type { HydrogenEnv } from '@shopify/hydrogen';
2
+ import type { HydrogenComponent, HydrogenComponentSchema, HydrogenThemeSchema, WeaverseLoaderData, WeaverseProjectConfigs } from '../types';
3
+ /** Options for extracting query parameters from a request URL. */
4
+ export interface RequestQueryOptions {
5
+ /** Query parameter names to include; all parameters are included when omitted. */
6
+ allowedKeys?: string[];
7
+ }
8
+ /**
9
+ * Extract and parse query parameters from a request URL.
10
+ * Supports optional allowlist for security-sensitive applications.
11
+ *
12
+ * @param request - The incoming request
13
+ * @param options - Optional configuration
14
+ * @param options.allowedKeys - If provided, only these keys will be extracted
15
+ * @returns Parsed query parameters with type coercion for booleans
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // Extract all params
20
+ * const queries = getRequestQueries(request)
21
+ *
22
+ * // Extract only allowed params (security-sensitive)
23
+ * const queries = getRequestQueries(request, {
24
+ * allowedKeys: ['weaverseProjectId', 'weaverseHost']
25
+ * })
26
+ * ```
27
+ */
28
+ export declare function getRequestQueries<T = Record<string, string | boolean>>(request: Request, options?: RequestQueryOptions): T;
29
+ /**
30
+ * Resolves project, endpoint, and Studio mode configuration for a request.
31
+ * URL-provided Studio values take precedence over environment defaults.
32
+ */
33
+ export declare function getWeaverseConfigs(request: Request, env: HydrogenEnv): WeaverseProjectConfigs;
34
+ /**
35
+ * Generate default data from component or theme schema.
36
+ * Results are memoized using WeakMap for performance.
37
+ *
38
+ * @param schema - Component or theme schema
39
+ * @returns Default data object extracted from schema inputs
40
+ */
41
+ export declare function generateDataFromSchema(schema: HydrogenComponentSchema | HydrogenThemeSchema): Record<string, any>;
42
+ /** Creates synthetic loader data for previewing one registered component type. */
43
+ export declare function getPreviewData(type: string, components: HydrogenComponent[], weaverseHost: string): WeaverseLoaderData;
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,UAAU,CAAA;AAqCjB,kEAAkE;AAClE,MAAM,WAAW,mBAAmB;IAClC,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CACvB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACpE,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,CAAC,CAqBH;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,WAAW,GACf,sBAAsB,CAuExB;AAWD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,uBAAuB,GAAG,mBAAmB,uBAmFtD;AA+BD,kFAAkF;AAClF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,iBAAiB,EAAE,EAC/B,YAAY,EAAE,MAAM,GAqCJ,kBAAkB,CACnC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Normalize the storefront URL sent in the Builder page API request body.
3
+ *
4
+ * The POST body participates in the `withCache` cache key, so a raw
5
+ * `request.url` fragments the cache by every marketing/tracking param:
6
+ * each distinct `?utm_…`/`fbclid` URL is a guaranteed Builder round-trip
7
+ * even when the resolved page is identical — precisely the paid/social
8
+ * traffic that needs the cache most (builder#2450).
9
+ *
10
+ * The Builder reads only the pathname (locale/type/handle fallback) and
11
+ * the params matched above from this URL, so keep exactly those. Params
12
+ * are sorted for a stable cache key regardless of their order in the
13
+ * incoming URL.
14
+ */
15
+ export declare function normalizePageUrl(url: string): string;
16
+ //# sourceMappingURL=normalize-page-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-page-url.d.ts","sourceRoot":"","sources":["../../../src/utils/normalize-page-url.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAuBpD"}
@@ -0,0 +1,44 @@
1
+ import type { UIMatch } from 'react-router';
2
+ import type { WeaverseLoaderData } from '../types';
3
+ /**
4
+ * Weaverse page data accepted by {@link WeaverseHydrogenRoot}, including
5
+ * deferred React Router loader results and an explicit no-render value.
6
+ */
7
+ export type WeaverseDataValue = WeaverseLoaderData | Promise<WeaverseLoaderData> | null;
8
+ /**
9
+ * Resolve the `weaverseData` payload for a `<WeaverseHydrogenRoot>` instance.
10
+ *
11
+ * Resolution order (first match wins):
12
+ *
13
+ * 1. **Explicit prop** — the caller passed `data` directly. Used as-is,
14
+ * including when it is a `Promise` (handled upstream via `<Await>`) or
15
+ * an explicit `null` (suppresses rendering).
16
+ * 2. **Own route's loader data** — the loader data for the route that
17
+ * rendered this component, obtained via `useLoaderData()`. This is
18
+ * React Router's route-scoped primitive and is what makes nested
19
+ * layout + child Weaverse pages work: each `<WeaverseContent />`
20
+ * resolves to *its own* route's `weaverseData` regardless of siblings.
21
+ * 3. **Ancestor match fallback** — walk `useMatches()` from leaf to root
22
+ * and return the first ancestor whose `loaderData` exposes a
23
+ * `weaverseData` key. This preserves the long-standing behaviour where
24
+ * a child route with no loader (e.g. an `index.tsx` that omits
25
+ * `weaverseData`) still renders its layout's Weaverse page.
26
+ *
27
+ * The helper is intentionally pure (no hook calls) so it can be unit-tested
28
+ * without a React Router context. Hook calls happen in the component.
29
+ *
30
+ * ## Back-compat contract
31
+ *
32
+ * Themes that pre-date the `data` prop addition pass `dataProp === undefined`,
33
+ * so resolution starts at Tier 2. For the canonical single-instance pattern
34
+ * (one `<WeaverseContent />` inside a route whose loader returns
35
+ * `{ weaverseData }`), Tier 2 returns the same value the old `useMatches()`
36
+ * walk did. For the index-without-loader pattern (leaf route exposes no
37
+ * `weaverseData`, layout does), Tier 3's leaf→root walk produces an
38
+ * identical result to the pre-fix code. The only intentional behaviour
39
+ * change is the issue #451 case: two `<WeaverseContent />` instances on the
40
+ * same URL (layout + child, both with their own `weaverseData`) now each
41
+ * render their own page instead of both rendering the deepest one.
42
+ */
43
+ export declare function pickWeaverseData(dataProp: WeaverseDataValue | undefined, ownLoaderData: unknown, matches: ReadonlyArray<Pick<UIMatch, 'loaderData'>>): WeaverseDataValue;
44
+ //# sourceMappingURL=pick-weaverse-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pick-weaverse-data.d.ts","sourceRoot":"","sources":["../../../src/utils/pick-weaverse-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAElD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB,kBAAkB,GAClB,OAAO,CAAC,kBAAkB,CAAC,GAC3B,IAAI,CAAA;AAER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,iBAAiB,GAAG,SAAS,EACvC,aAAa,EAAE,OAAO,EACtB,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,GAClD,iBAAiB,CAoBnB"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Record the navigation key seen by a mounted instance. A change of key is a
3
+ * real navigation and forgets the previous navigation's fired pages; an
4
+ * unchanged key (an in-place remount / suppress-restore on the same history
5
+ * entry) leaves them intact, so the page is not double-counted.
6
+ */
7
+ export declare function observeNavigation(navigationKey: string): void;
8
+ export declare function shouldFirePixel(navigationKey: string, pageId: string): boolean;
9
+ /**
10
+ * Track a mounted Weaverse instance; returns the unmount cleanup. When the
11
+ * last instance unmounts, the navigation state is forgotten so a Back that
12
+ * restores the same history entry counts again even if no instance survived
13
+ * to observe the detour.
14
+ */
15
+ export declare function registerPixelInstance(): () => void;
16
+ //# sourceMappingURL=pixel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixel.d.ts","sourceRoot":"","sources":["../../../src/utils/pixel.ts"],"names":[],"mappings":"AA8BA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAK7D;AAED,wBAAgB,eAAe,CAC7B,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAOT;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,IAAI,CASlD"}
@@ -0,0 +1,17 @@
1
+ import type { WeaverseHydrogenParams } from '../types';
2
+ interface BrowserLocationLike {
3
+ pathname: string;
4
+ search: string;
5
+ }
6
+ /**
7
+ * React Router v7 single-fetch revalidation can render client data returned
8
+ * from a `*.data` request while the browser is still on the canonical URL.
9
+ * Instance identity must follow the browser URL, not the transient data
10
+ * endpoint, otherwise the SDK creates a fresh Weaverse instance mid-session:
11
+ * in design mode that drops the existing Studio bridge/interactions, and in
12
+ * the live theme it resets every section's runtime state after any
13
+ * revalidation (cart mutations, locale switches, `revalidate()`). See #451.
14
+ */
15
+ export declare function normalizeRequestInfo(params: WeaverseHydrogenParams, browserLocation?: BrowserLocationLike | undefined): WeaverseHydrogenParams;
16
+ export {};
17
+ //# sourceMappingURL=studio-request-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-request-info.d.ts","sourceRoot":"","sources":["../../../src/utils/studio-request-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEtD,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf;AA0BD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,sBAAsB,EAC9B,eAAe,GAAE,mBAAmB,GAAG,SAAgC,GACtE,sBAAsB,CAsBxB"}
@@ -0,0 +1,78 @@
1
+ /** Rendering mode and host details used to select a Studio bridge script. */
2
+ export interface StudioMode {
3
+ /** Whether the storefront is running inside the visual editor. */
4
+ isDesignMode?: boolean;
5
+ /** Whether a component preview is being rendered. */
6
+ isPreviewMode?: boolean;
7
+ /** Whether a saved page revision is being previewed. */
8
+ isRevisionPreview?: boolean;
9
+ /** Trusted origin serving Studio bridge assets. */
10
+ weaverseHost: string;
11
+ /** Studio asset version appended to the script URL. */
12
+ weaverseVersion: string;
13
+ }
14
+ export interface TrustedStudioHostOptions {
15
+ /**
16
+ * Also trust loopback hosts (`localhost` / `127.0.0.1` / `*.localhost`) over
17
+ * http or https.
18
+ *
19
+ * Only safe when the **storefront itself** is loopback (genuine local-builder
20
+ * dev). A production https page can still load a loopback script — loopback is
21
+ * a "potentially trustworthy" origin and is not blocked as mixed content — so
22
+ * honoring a query-supplied loopback host on a public storefront would let a
23
+ * crafted link run whatever a visitor's local service serves inside the
24
+ * storefront origin. MUST stay off on the server, where it is an SSRF vector
25
+ * for page/theme fetches.
26
+ */
27
+ allowLoopback?: boolean;
28
+ }
29
+ /**
30
+ * Whether `host` is an origin we trust to serve the Studio bridge script (or,
31
+ * server-side, to resolve page/theme data).
32
+ *
33
+ * The bridge executes inside the storefront document and the host can drive
34
+ * server-side fetches, so a host taken from an attacker-controllable source —
35
+ * e.g. a crafted `?weaverseHost=` query — is both an XSS and an SSRF vector.
36
+ * Callers MUST reject untrusted hosts before acting on them. Trusts
37
+ * `weaverse.io`/`weaverse.dev` and their subdomains over https; loopback is
38
+ * opt-in (see {@link TrustedStudioHostOptions.allowLoopback}).
39
+ */
40
+ export declare function isTrustedStudioHost(host: string, options?: TrustedStudioHostOptions): boolean;
41
+ /**
42
+ * Build the Studio bridge script URL for the current mode, or `null` when the
43
+ * storefront is not being previewed inside Weaverse Studio.
44
+ *
45
+ * This is the single gate that keeps the bridge off production storefronts:
46
+ * a normal visitor's URL carries none of the design/preview markers, so the
47
+ * result is `null` and no script is ever requested.
48
+ *
49
+ * Shared by the page-scoped `useStudio` (which also binds the page for
50
+ * editing) and the root-level `useStudioConnect` (which only needs the script
51
+ * to load so Studio's `checkWeaversePage()` handshake can answer on routes
52
+ * with no Weaverse content).
53
+ */
54
+ export declare function getStudioScriptSrc(mode: StudioMode): string | null;
55
+ /**
56
+ * Resolve the Studio bridge script URL from a URL query string — the markers
57
+ * Studio attaches when it drives the preview iframe (`isDesignMode`,
58
+ * `isPreviewMode`, `__revisionId`, `weaverseHost`, `weaverseVersion`) — or
59
+ * `null` outside Studio.
60
+ *
61
+ * `storefrontHostname` is the document's own hostname: a loopback Studio host
62
+ * is only honored when the storefront itself is loopback (genuine local-builder
63
+ * dev), so a crafted public link can't load a script from a visitor's loopback
64
+ * service into the storefront origin.
65
+ *
66
+ * The `weaverseHost` query is attacker-controllable, so a host that is not a
67
+ * {@link isTrustedStudioHost trusted origin} resolves to `null` (no bridge) —
68
+ * it is never silently replaced with production Studio, which would otherwise
69
+ * inject the wrong bridge for self-hosted/staging deployments. Such deployments
70
+ * (a non-`weaverse.io` `WEAVERSE_HOST`) therefore don't load the root bridge on
71
+ * content-less routes; the page-scoped {@link getStudioScriptSrc} via
72
+ * `useStudio` still uses the configured host on content routes.
73
+ *
74
+ * Pure (no DOM) so the root-level connect's production gate stays unit-testable
75
+ * and needs no loader data.
76
+ */
77
+ export declare function resolveStudioScriptSrc(search: string, storefrontHostname?: string): string | null;
78
+ //# sourceMappingURL=studio-script-src.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-script-src.d.ts","sourceRoot":"","sources":["../../../src/utils/studio-script-src.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,MAAM,WAAW,UAAU;IACzB,kEAAkE;IAClE,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,qDAAqD;IACrD,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,wDAAwD;IACxD,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAA;IACpB,uDAAuD;IACvD,eAAe,EAAE,MAAM,CAAA;CACxB;AAkBD,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAqBT;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAiBlE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,kBAAkB,SAAK,GACtB,MAAM,GAAG,IAAI,CAqBf"}
@@ -0,0 +1,21 @@
1
+ import type { WeaverseHydrogenParams } from '../types';
2
+ import type { WeaverseHydrogen } from '../WeaverseHydrogenRoot';
3
+ /**
4
+ * Apply a fresh loader payload to a reused Weaverse instance.
5
+ *
6
+ * With requestInfo normalized to the browser URL, same-URL revalidations
7
+ * (cart mutations, `useRevalidator()`, locale-neutral re-fetches) reuse the
8
+ * cached `window.__weaverses[pageId]` instance instead of constructing a new
9
+ * one — which preserves section state, but would silently drop the fresh
10
+ * `data`/`dataContext` the loaders just returned. Sync them here.
11
+ *
12
+ * Design mode is excluded by the caller: Studio owns the instance data there
13
+ * (unsaved drafts must not be clobbered) and applies updates via
14
+ * `refreshStudio` instead.
15
+ *
16
+ * Change detection uses JSON comparison — loader payloads are
17
+ * wire-serialized, so key order is stable between runs; a false mismatch
18
+ * only costs one extra re-render.
19
+ */
20
+ export declare function syncReusedInstance(weaverse: WeaverseHydrogen, params: WeaverseHydrogenParams): void;
21
+ //# sourceMappingURL=sync-reused-instance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-reused-instance.d.ts","sourceRoot":"","sources":["../../../src/utils/sync-reused-instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE/D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,sBAAsB,QAkC/B"}
@@ -0,0 +1,2 @@
1
+ export { ThemeTextStore, TranslationStore } from './translation-store';
2
+ //# sourceMappingURL=theme-text-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-text-store.d.ts","sourceRoot":"","sources":["../../../src/utils/theme-text-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Minimal mutable store for design-mode static text overrides.
3
+ *
4
+ * useSyncExternalStore-compatible. Passed into TranslationProvider which
5
+ * subscribes internally and merges overrides into merchantOverrides.
6
+ * The studio bridge calls updateOverrides() via weaverse.internal.translationStore
7
+ * (also exposed as the deprecated weaverse.internal.themeTextStore alias).
8
+ *
9
+ * Shape: flat Record<string, string> — dot-notation keys map to values
10
+ * (e.g. "cart.title" → "Shopping Cart").
11
+ */
12
+ export declare class TranslationStore {
13
+ /** Current flat translation overrides keyed by dot-path. */
14
+ overrides: Record<string, string>;
15
+ private listeners;
16
+ /** Replaces all overrides and notifies subscribers. */
17
+ setOverrides: (overrides: Record<string, string>) => void;
18
+ /** Merges changed overrides and notifies subscribers. */
19
+ updateOverrides: (newOverrides: Record<string, string>) => void;
20
+ /** Returns the current client snapshot for `useSyncExternalStore`. */
21
+ getSnapshot: () => Record<string, string>;
22
+ /** Returns the current server snapshot for `useSyncExternalStore`. */
23
+ getServerSnapshot: () => Record<string, string>;
24
+ /** Subscribes to override changes and returns an unsubscribe callback. */
25
+ subscribe: (callback: () => void) => () => void;
26
+ private emit;
27
+ }
28
+ /**
29
+ * Legacy constructor alias retained for existing theme text integrations.
30
+ * @deprecated Use {@link TranslationStore} instead. This alias remains available
31
+ * for backward compatibility.
32
+ */
33
+ export declare const ThemeTextStore: typeof TranslationStore;
34
+ /**
35
+ * Legacy type alias retained for existing theme text integrations.
36
+ * @deprecated Use {@link TranslationStore} instead. This alias remains available
37
+ * for backward compatibility.
38
+ */
39
+ export type ThemeTextStore = TranslationStore;
40
+ //# sourceMappingURL=translation-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translation-store.d.ts","sourceRoot":"","sources":["../../../src/utils/translation-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,qBAAa,gBAAgB;IAC3B,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAK;IACtC,OAAO,CAAC,SAAS,CAA6B;IAE9C,uDAAuD;IACvD,YAAY,GAAI,WAAW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAGhD;IAED,yDAAyD;IACzD,eAAe,GAAI,cAAc,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAGtD;IAED,sEAAsE;IACtE,WAAW,+BAAuB;IAElC,sEAAsE;IACtE,iBAAiB,+BAAuB;IAExC,0EAA0E;IAC1E,SAAS,GAAI,UAAU,MAAM,IAAI,gBAKhC;IAED,OAAO,CAAC,IAAI,CAQX;CACF;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,yBAAmB,CAAA;AAC9C;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAA"}
@@ -0,0 +1,33 @@
1
+ import type { WeaverseHydrogen } from '../index';
2
+ /**
3
+ * Load the Studio bridge script on every design/preview render so Studio's
4
+ * `checkWeaversePage()` handshake is answered instead of timing out — crucially
5
+ * on routes where the page-scoped {@link useStudio} never mounts: 404s, error
6
+ * boundaries, and non-Weaverse routes. The bridge registers its RPC endpoint
7
+ * and `window.weaverseStudio` the moment the script executes, independent of any
8
+ * page binding. Without this, a content-less route never loads the script and
9
+ * Studio reports a false "Connection lost" instead of "this page has no Weaverse
10
+ * content set up".
11
+ *
12
+ * `loadScript` is idempotent, so on content routes this coexists with the
13
+ * page-scoped {@link useStudio} (same src) — that hook still binds the page via
14
+ * `init`. Gating this on whether a route "has Weaverse data" is deliberately
15
+ * avoided: route matches can't tell whether the page-scoped bridge actually
16
+ * mounts (an `ErrorBoundary` replacing a data route, or data passed via the
17
+ * `data` prop), and suppressing the script there would reintroduce the timeout
18
+ * this fixes. Loading the script is harmless; it only registers the responder.
19
+ *
20
+ * Known limitation: on a route whose `weaverseData` is a deferred Promise, the
21
+ * script can load before the page streams in, so `checkWeaversePage()` may
22
+ * briefly observe `NOT_WEAVERSE_PAGE`. The complete fix is a "loading" state in
23
+ * `checkWeaversePage` so the handshake retries rather than latching — that lives
24
+ * in the Studio script, not here. Tracked in Weaverse/builder#2515.
25
+ *
26
+ * Mounted via {@link withWeaverse}, which must be the root route's `Layout`
27
+ * export so the bridge renders even when a route's `ErrorBoundary` replaces the
28
+ * page. Outside Studio (no design/preview params) it is a no-op.
29
+ */
30
+ export declare function useStudioConnect(): void;
31
+ export declare function useStudio(weaverse: WeaverseHydrogen): void;
32
+ export declare function usePixel(context: WeaverseHydrogen): void;
33
+ //# sourceMappingURL=use-studio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-studio.d.ts","sourceRoot":"","sources":["../../../src/utils/use-studio.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAoChD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gBAAgB,SAW/B;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,gBAAgB,QAkDnD;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,QA6BjD"}
@@ -0,0 +1,39 @@
1
+ import type { HydrogenThemeSchema, HydrogenThemeSettings, PublicEnv } from '../types';
2
+ /** Root-loader theme data used to initialize a {@link ThemeSettingsStore}. */
3
+ export interface WeaverseThemeData {
4
+ /** Storefront-safe environment values, when available. */
5
+ publicEnv?: PublicEnv;
6
+ /** Theme schema exposed to Studio, when available. */
7
+ schema?: HydrogenThemeSchema;
8
+ /** Published theme setting values. */
9
+ theme: HydrogenThemeSettings;
10
+ }
11
+ /** Mutable, subscribable store for theme settings received from the root loader. */
12
+ export declare class ThemeSettingsStore {
13
+ /** Current merged theme setting values. */
14
+ settings: HydrogenThemeSettings;
15
+ /** Theme schema exposed to Studio, when available. */
16
+ schema?: HydrogenThemeSchema;
17
+ /** Storefront-safe environment values, when available. */
18
+ publicEnv?: PublicEnv;
19
+ private listeners;
20
+ private hasWarnedListenerCount;
21
+ private isDestroyed;
22
+ /** Creates a theme settings store from root-loader theme data. */
23
+ constructor(data: WeaverseThemeData);
24
+ /** Merges setting changes into the current snapshot and notifies subscribers. */
25
+ updateThemeSettings: (newSettings: HydrogenThemeSettings) => void;
26
+ /** Returns the current client snapshot for `useSyncExternalStore`. */
27
+ getSnapshot: () => HydrogenThemeSettings;
28
+ /** Returns the current server snapshot for `useSyncExternalStore`. */
29
+ getServerSnapshot: () => HydrogenThemeSettings;
30
+ /** Subscribes to setting changes and returns an unsubscribe callback. */
31
+ subscribe: (callback: () => void) => () => void;
32
+ private emit;
33
+ /** Clears subscribers and detaches the browser-global store reference. */
34
+ destroy: () => void;
35
+ }
36
+ export declare const ThemeSettingsStoreContext: import("react").Context<ThemeSettingsStore | null>;
37
+ export declare function useCreateThemeSettingsStore(): ThemeSettingsStore;
38
+ export declare function useThemeSettingsStore(): ThemeSettingsStore;
39
+ //# sourceMappingURL=use-theme-settings-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-theme-settings-store.d.ts","sourceRoot":"","sources":["../../../src/utils/use-theme-settings-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,SAAS,EACV,MAAM,UAAU,CAAA;AAEjB,8EAA8E;AAC9E,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,sDAAsD;IACtD,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B,sCAAsC;IACtC,KAAK,EAAE,qBAAqB,CAAA;CAC7B;AAED,oFAAoF;AACpF,qBAAa,kBAAkB;IAC7B,2CAA2C;IAC3C,QAAQ,EAAE,qBAAqB,CAAK;IACpC,sDAAsD;IACtD,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B,0DAA0D;IAC1D,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,OAAO,CAAC,SAAS,CAA6B;IAC9C,OAAO,CAAC,sBAAsB,CAAQ;IACtC,OAAO,CAAC,WAAW,CAAQ;IAE3B,kEAAkE;gBACtD,IAAI,EAAE,iBAAiB;IAUnC,iFAAiF;IACjF,mBAAmB,GAAI,aAAa,qBAAqB,UAWxD;IAED,sEAAsE;IACtE,WAAW,8BAAsB;IAEjC,sEAAsE;IACtE,iBAAiB,8BAAsB;IAEvC,yEAAyE;IACzE,SAAS,GAAI,UAAU,MAAM,IAAI,gBAmBhC;IAED,OAAO,CAAC,IAAI,CAcX;IAED,0EAA0E;IAC1E,OAAO,aAWN;CACF;AAED,eAAO,MAAM,yBAAyB,oDACU,CAAA;AAGhD,wBAAgB,2BAA2B,IAAI,kBAAkB,CAkBhE;AAED,wBAAgB,qBAAqB,IAAI,kBAAkB,CAoB1D"}