@wocart/storefront 1.15.0 → 1.16.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ follows [semantic versioning](https://semver.org/): breaking changes ship only
5
5
  in a new major version, and an export is marked `@deprecated` for at least one
6
6
  minor release before a major removes it.
7
7
 
8
+ ## 1.16.0 — 2026-10-18
9
+
10
+ ### Changed
11
+
12
+ - `pageData.get(surface)` reads the document the store composed for the
13
+ client's theme: a client created with `theme` sends it
14
+ (`/store/page-documents/{surface}?theme=`), so a store keeps one document
15
+ per theme and switching themes never shows another theme's page. Without
16
+ `theme`, the server answers the most recently saved document for the
17
+ surface, as before.
18
+
8
19
  ## 1.15.0 — 2026-10-18
9
20
 
10
21
  ### Added
package/USAGE.md CHANGED
@@ -884,8 +884,9 @@ Do not invent tracking events from a landing-page slug.
884
884
  const saved = await store.pageData.get("home"); // null = never saved / failed
885
885
  ~~~
886
886
 
887
- One document per surface ("home" today), owned by the store and written by
888
- the platform's page editor — a storefront never writes it. `null` means the store has never saved one (or the read
887
+ One document per theme and surface ("home" today), owned by the store and
888
+ written by the platform's page editor — a storefront never writes it. A
889
+ client created with `theme` reads the document composed for that theme. `null` means the store has never saved one (or the read
889
890
  failed): render the theme's shipped default document. The payload is
890
891
  **transport-checked only** (`version`, `surface`, `sections`) and fetched
891
892
  fresh on every call, so a save reaches the next render.
@@ -2,8 +2,10 @@
2
2
  * Page Data Namespace — the store's saved composition document.
3
3
  *
4
4
  * Deep module: hides URL construction and transport behind one call. The
5
- * document belongs to the store (one per surface — "home" today) and is
6
- * written by the platform's editor; this namespace is the theme's read side.
5
+ * document belongs to the store (one per theme and surface — "home" today)
6
+ * and is written by the platform's editor; this namespace is the theme's
7
+ * read side. A client created with `theme` reads that theme's document;
8
+ * without it, the server answers the most recently saved one for the surface.
7
9
  *
8
10
  * Transport semantics (NOT the document contract): the payload is validated
9
11
  * as `{ version, surface, sections }` and returns `null` for "no saved
@@ -2,8 +2,10 @@
2
2
  * Page Data Namespace — the store's saved composition document.
3
3
  *
4
4
  * Deep module: hides URL construction and transport behind one call. The
5
- * document belongs to the store (one per surface — "home" today) and is
6
- * written by the platform's editor; this namespace is the theme's read side.
5
+ * document belongs to the store (one per theme and surface — "home" today)
6
+ * and is written by the platform's editor; this namespace is the theme's
7
+ * read side. A client created with `theme` reads that theme's document;
8
+ * without it, the server answers the most recently saved one for the surface.
7
9
  *
8
10
  * Transport semantics (NOT the document contract): the payload is validated
9
11
  * as `{ version, surface, sections }` and returns `null` for "no saved
@@ -24,7 +26,9 @@ export function createPageDataNamespace(core) {
24
26
  return {
25
27
  async get(surface) {
26
28
  try {
27
- const document = await core.get(`/store/page-documents/${encodeURIComponent(surface)}`, PageDocumentPayloadSchema.nullable(), { operation: STOREFRONT_OPERATIONS.pageDataGet });
29
+ const path = `/store/page-documents/${encodeURIComponent(surface)}`;
30
+ const theme = core.config.theme;
31
+ const document = await core.get(theme === undefined ? path : `${path}?${new URLSearchParams({ theme })}`, PageDocumentPayloadSchema.nullable(), { operation: STOREFRONT_OPERATIONS.pageDataGet });
28
32
  return document ?? null;
29
33
  }
30
34
  catch (error) {
package/dist/domain.d.ts CHANGED
@@ -12,7 +12,8 @@ export interface StoreScope {
12
12
  * The key of the theme this client renders (`defineTheme({ key })` in
13
13
  * `@wocart/theme`). The store's edits to that theme's text arrive as
14
14
  * `StoreConfig.contentOverrides`; without it there are none, because edits
15
- * belong to the theme that declares their keys. The server owns the key
15
+ * belong to the theme that declares their keys. `pageData.get` reads the
16
+ * documents the store composed for that theme. The server owns the key
16
17
  * format and refuses a malformed one.
17
18
  */
18
19
  readonly theme?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wocart/storefront",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "Typed, validated SDK for Wocart cash-on-delivery storefronts: catalog reads, basket, checkout, OTP and order tracking, with Astro adapters.",
5
5
  "keywords": [
6
6
  "wocart",