@tanqory/theme-kit 0.1.0 → 2.0.0-alpha.5

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 (204) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -10
  3. package/dist/abi/canvas-live.d.ts +49 -0
  4. package/dist/abi/canvas-live.js +88 -0
  5. package/dist/abi/cart.d.ts +48 -0
  6. package/dist/abi/cart.js +321 -0
  7. package/dist/abi/convert.d.ts +192 -0
  8. package/dist/abi/convert.js +670 -0
  9. package/dist/abi/data-api.d.ts +15 -0
  10. package/dist/abi/data-api.js +198 -0
  11. package/dist/abi/jcs.d.ts +6 -0
  12. package/dist/abi/jcs.js +28 -0
  13. package/dist/abi/page-data.d.ts +209 -0
  14. package/dist/abi/page-data.js +583 -0
  15. package/dist/abi/page.d.ts +23 -0
  16. package/dist/abi/page.js +46 -0
  17. package/dist/abi/referrals.d.ts +23 -0
  18. package/dist/abi/referrals.js +89 -0
  19. package/dist/abi/rewards.d.ts +27 -0
  20. package/dist/abi/rewards.js +82 -0
  21. package/dist/abi/seo.d.ts +47 -0
  22. package/dist/abi/seo.js +68 -0
  23. package/dist/abi/shell.d.ts +22 -0
  24. package/dist/abi/shell.js +10 -0
  25. package/dist/abi/wire.d.ts +38 -0
  26. package/dist/abi/wire.js +84 -0
  27. package/dist/build.d.ts +113 -0
  28. package/dist/build.js +294 -0
  29. package/dist/client.d.ts +19 -0
  30. package/dist/client.js +76 -0
  31. package/dist/contract.d.ts +6 -0
  32. package/dist/contract.js +6 -0
  33. package/dist/headless/ai.d.ts +132 -0
  34. package/dist/headless/ai.js +99 -0
  35. package/dist/headless/hooks.d.ts +273 -0
  36. package/dist/headless/hooks.js +533 -0
  37. package/dist/headless/i18n.d.ts +13 -0
  38. package/dist/headless/i18n.js +45 -0
  39. package/dist/headless/index.d.ts +36 -0
  40. package/dist/headless/index.js +38 -0
  41. package/dist/headless/money.d.ts +25 -0
  42. package/dist/headless/money.js +61 -0
  43. package/dist/headless/page.d.ts +43 -0
  44. package/dist/headless/page.js +53 -0
  45. package/dist/headless/platform.d.ts +55 -0
  46. package/dist/headless/platform.js +77 -0
  47. package/dist/headless/primitives/cart.d.ts +90 -0
  48. package/dist/headless/primitives/cart.js +153 -0
  49. package/dist/headless/primitives/collection.d.ts +68 -0
  50. package/dist/headless/primitives/collection.js +80 -0
  51. package/dist/headless/primitives/product.d.ts +101 -0
  52. package/dist/headless/primitives/product.js +117 -0
  53. package/dist/headless/primitives/storefront.d.ts +106 -0
  54. package/dist/headless/primitives/storefront.js +186 -0
  55. package/dist/headless/primitives/util.d.ts +19 -0
  56. package/dist/headless/primitives/util.js +42 -0
  57. package/dist/headless/strings.d.ts +9 -0
  58. package/dist/headless/strings.js +186 -0
  59. package/dist/headless/structured-data.d.ts +31 -0
  60. package/dist/headless/structured-data.js +57 -0
  61. package/dist/headless/theme.d.ts +99 -0
  62. package/dist/headless/theme.js +54 -0
  63. package/dist/index.d.ts +20 -0
  64. package/dist/index.js +18 -553
  65. package/dist/runtime/data/StoreProvider.d.ts +56 -0
  66. package/dist/runtime/data/StoreProvider.js +308 -0
  67. package/dist/runtime/data/handle.d.ts +14 -0
  68. package/dist/runtime/data/handle.js +16 -0
  69. package/dist/runtime/data/routes.d.ts +87 -0
  70. package/dist/runtime/data/routes.js +154 -0
  71. package/dist/runtime/data/to-ui.d.ts +258 -0
  72. package/dist/runtime/data/to-ui.js +820 -0
  73. package/dist/runtime/entries/register.d.ts +9 -0
  74. package/dist/runtime/entries/register.js +9 -0
  75. package/dist/runtime/entries/sections.d.ts +16 -0
  76. package/dist/runtime/entries/sections.js +19 -0
  77. package/dist/{types → runtime/kit}/SectionTree.d.ts +2 -1
  78. package/dist/runtime/kit/SectionTree.js +100 -0
  79. package/dist/runtime/kit/analytics.d.ts +63 -0
  80. package/dist/runtime/kit/analytics.js +233 -0
  81. package/dist/runtime/kit/cart.d.ts +186 -0
  82. package/dist/runtime/kit/cart.js +545 -0
  83. package/dist/{types → runtime/kit}/composition.d.ts +1 -1
  84. package/dist/runtime/kit/composition.js +3 -0
  85. package/dist/{types → runtime/kit}/config.d.ts +2 -2
  86. package/dist/runtime/kit/config.js +6 -0
  87. package/dist/runtime/kit/consent.d.ts +29 -0
  88. package/dist/runtime/kit/consent.js +159 -0
  89. package/dist/runtime/kit/contract/content.d.ts +164 -0
  90. package/dist/runtime/kit/contract/content.js +83 -0
  91. package/dist/runtime/kit/contract/field-types.d.ts +290 -0
  92. package/dist/runtime/kit/contract/field-types.js +129 -0
  93. package/dist/runtime/kit/contract/groups.d.ts +230 -0
  94. package/dist/runtime/kit/contract/groups.js +402 -0
  95. package/dist/runtime/kit/contract/index.d.ts +33 -0
  96. package/dist/runtime/kit/contract/index.js +33 -0
  97. package/dist/runtime/kit/contract/transform.d.ts +82 -0
  98. package/dist/runtime/kit/contract/transform.js +133 -0
  99. package/dist/runtime/kit/contract/validate.d.ts +67 -0
  100. package/dist/runtime/kit/contract/validate.js +388 -0
  101. package/dist/runtime/kit/data.d.ts +636 -0
  102. package/dist/runtime/kit/data.js +1117 -0
  103. package/dist/{types → runtime/kit}/defineSection.d.ts +1 -1
  104. package/dist/runtime/kit/defineSection.js +10 -0
  105. package/dist/{types → runtime/kit}/dynamic-source.d.ts +4 -4
  106. package/dist/runtime/kit/dynamic-source.js +143 -0
  107. package/dist/runtime/kit/index.d.ts +24 -0
  108. package/dist/runtime/kit/index.js +24 -0
  109. package/dist/{types → runtime/kit}/jsx-to-json.d.ts +1 -1
  110. package/dist/runtime/kit/jsx-to-json.js +28 -0
  111. package/dist/{types → runtime/kit}/mount.d.ts +25 -4
  112. package/dist/runtime/kit/mount.js +124 -0
  113. package/dist/{types → runtime/kit}/registry.d.ts +1 -1
  114. package/dist/runtime/kit/registry.js +12 -0
  115. package/dist/{types → runtime/kit}/ssg.d.ts +9 -3
  116. package/dist/runtime/kit/ssg.js +56 -0
  117. package/dist/runtime/kit/storefront.d.ts +566 -0
  118. package/dist/runtime/kit/storefront.js +723 -0
  119. package/dist/{types → runtime/kit}/theme-context.d.ts +8 -2
  120. package/dist/runtime/kit/theme-context.js +25 -0
  121. package/dist/runtime/kit/types.d.ts +142 -0
  122. package/dist/runtime/kit/types.js +1 -0
  123. package/dist/runtime/platform/TrackingPixels.d.ts +14 -0
  124. package/dist/runtime/platform/TrackingPixels.js +63 -0
  125. package/dist/runtime/platform/environment.d.ts +68 -0
  126. package/dist/runtime/platform/environment.js +85 -0
  127. package/dist/runtime/platform/locale.d.ts +27 -0
  128. package/dist/runtime/platform/locale.js +42 -0
  129. package/dist/runtime/platform/route-analytics.d.ts +15 -0
  130. package/dist/runtime/platform/route-analytics.js +72 -0
  131. package/dist/runtime/platform/safe-href.d.ts +25 -0
  132. package/dist/runtime/platform/safe-href.js +69 -0
  133. package/dist/runtime/platform/safe-values.d.ts +37 -0
  134. package/dist/runtime/platform/safe-values.js +140 -0
  135. package/dist/runtime/render/SectionRenderer.d.ts +4 -0
  136. package/dist/runtime/render/SectionRenderer.js +111 -0
  137. package/dist/runtime/render/listing-query.d.ts +47 -0
  138. package/dist/runtime/render/listing-query.js +114 -0
  139. package/dist/runtime/render/localized-copy.d.ts +86 -0
  140. package/dist/runtime/render/localized-copy.js +129 -0
  141. package/dist/runtime/render/product-listing.d.ts +11 -0
  142. package/dist/runtime/render/product-listing.js +240 -0
  143. package/dist/runtime/render/section-actions.d.ts +48 -0
  144. package/dist/runtime/render/section-actions.js +170 -0
  145. package/dist/runtime/render/starter.d.ts +11 -0
  146. package/dist/runtime/render/starter.js +81 -0
  147. package/dist/runtime/seo/head.d.ts +87 -0
  148. package/dist/runtime/seo/head.js +224 -0
  149. package/dist/runtime/seo/structured-data.d.ts +22 -0
  150. package/dist/runtime/seo/structured-data.js +115 -0
  151. package/dist/runtime/shell/PageShell.d.ts +18 -0
  152. package/dist/runtime/shell/PageShell.js +113 -0
  153. package/dist/runtime/shell/RuntimeBridge.d.ts +14 -0
  154. package/dist/runtime/shell/RuntimeBridge.js +85 -0
  155. package/dist/runtime/shell/overlay-state.d.ts +31 -0
  156. package/dist/runtime/shell/overlay-state.js +59 -0
  157. package/dist/runtime/shell/preview-mode.d.ts +2 -0
  158. package/dist/runtime/shell/preview-mode.js +11 -0
  159. package/dist/runtime/shell/spa-router.d.ts +14 -0
  160. package/dist/runtime/shell/spa-router.js +76 -0
  161. package/dist/runtime/shell/url-redirects.d.ts +6 -0
  162. package/dist/runtime/shell/url-redirects.js +37 -0
  163. package/dist/runtime/slots.d.ts +74 -0
  164. package/dist/runtime/slots.js +16 -0
  165. package/dist/runtime.d.ts +34 -0
  166. package/dist/runtime.js +40 -0
  167. package/dist/sdk/index.d.ts +24 -0
  168. package/dist/sdk/index.js +24 -0
  169. package/dist/sdk/referrals.d.ts +62 -0
  170. package/dist/sdk/referrals.js +20 -0
  171. package/dist/sdk/rewards.d.ts +85 -0
  172. package/dist/sdk/rewards.js +29 -0
  173. package/dist/sdk/runtime-context.d.ts +135 -0
  174. package/dist/sdk/runtime-context.js +73 -0
  175. package/dist/sdk/schema.d.ts +197 -0
  176. package/dist/sdk/schema.js +121 -0
  177. package/dist/sdk/server-render.d.ts +8 -0
  178. package/dist/sdk/server-render.js +12 -0
  179. package/dist/sdk/store-lookup.d.ts +27 -0
  180. package/dist/sdk/store-lookup.js +29 -0
  181. package/dist/sdk/store.d.ts +115 -0
  182. package/dist/sdk/store.js +1 -0
  183. package/dist/sdk/sx.d.ts +40 -0
  184. package/dist/sdk/sx.js +112 -0
  185. package/dist/sdk/theme.d.ts +152 -0
  186. package/dist/sdk/theme.js +10 -0
  187. package/dist/sdk/types.d.ts +470 -0
  188. package/dist/sdk/types.js +7 -0
  189. package/dist/server.d.ts +65 -0
  190. package/dist/server.js +370 -0
  191. package/docs/headless-api.md +220 -0
  192. package/package.json +77 -23
  193. package/dist/index.js.map +0 -1
  194. package/dist/ssg-BZ5FYTw7.js +0 -1802
  195. package/dist/ssg-BZ5FYTw7.js.map +0 -1
  196. package/dist/ssg.js +0 -8
  197. package/dist/ssg.js.map +0 -1
  198. package/dist/types/cart.d.ts +0 -86
  199. package/dist/types/data.d.ts +0 -357
  200. package/dist/types/editor.d.ts +0 -5
  201. package/dist/types/index.d.ts +0 -20
  202. package/dist/types/preview-bridge.d.ts +0 -9
  203. package/dist/types/storefront.d.ts +0 -333
  204. package/dist/types/types.d.ts +0 -44
@@ -0,0 +1,670 @@
1
+ const MENU_TYPES = new Set([
2
+ 'FRONTPAGE', 'COLLECTION', 'COLLECTIONS', 'PRODUCT', 'CATALOG', 'PAGE', 'BLOG', 'ARTICLE', 'SEARCH', 'SHOP_POLICY', 'HTTP',
3
+ ]);
4
+ export function image(i) {
5
+ if (!i?.url)
6
+ return null;
7
+ return {
8
+ url: i.url,
9
+ ...(i.altText ? { altText: i.altText } : {}),
10
+ ...(typeof i.width === 'number' ? { width: i.width } : {}),
11
+ ...(typeof i.height === 'number' ? { height: i.height } : {}),
12
+ ...(i.width && i.height ? { aspectRatio: i.width / i.height } : {}),
13
+ };
14
+ }
15
+ /** Plain text of an HTML body, for the surfaces that show text only (cards, meta description). */
16
+ export function plainText(html) {
17
+ return String(html ?? '')
18
+ .replace(/<[^>]*>/g, ' ')
19
+ .replace(/&nbsp;/g, ' ')
20
+ .replace(/&amp;/g, '&')
21
+ .replace(/&lt;/g, '<')
22
+ .replace(/&gt;/g, '>')
23
+ .replace(/&quot;/g, '"')
24
+ .replace(/&#39;/g, "'")
25
+ .replace(/\s+/g, ' ')
26
+ .trim();
27
+ }
28
+ /** `quantityAvailable` when the platform sent a usable one (an integer 0–999), else undefined. */
29
+ function stock(v) {
30
+ const q = v.quantityAvailable;
31
+ return typeof q === 'number' && Number.isInteger(q) && q >= 0 && q <= 999 ? q : undefined;
32
+ }
33
+ function variant(v) {
34
+ const q = stock(v);
35
+ return {
36
+ id: v.id,
37
+ title: v.title,
38
+ price: v.price,
39
+ compareAtPrice: v.compareAtPrice ?? null,
40
+ availableForSale: v.availableForSale,
41
+ selectedOptions: v.selectedOptions.map((o) => ({ name: o.name, value: o.value })),
42
+ image: image(v.image),
43
+ sku: v.sku ?? null,
44
+ // The platform sends a count only for a variant that stops selling at zero — DENY.
45
+ ...(q !== undefined ? { inventoryQuantity: q, inventoryPolicy: 'DENY' } : {}),
46
+ };
47
+ }
48
+ export function product(p) {
49
+ const variants = p.variants?.nodes ?? [];
50
+ const first = variants.find((v) => v.availableForSale) ?? variants[0];
51
+ const min = p.priceRange.minVariantPrice;
52
+ const was = p.compareAtPriceRange?.maxVariantPrice;
53
+ return {
54
+ id: p.id,
55
+ handle: p.handle,
56
+ title: p.title,
57
+ templateSuffix: p.templateSuffix ?? null,
58
+ price: min,
59
+ compareAtPrice: was && Number(was.amount) > Number(min.amount) ? was : null,
60
+ featuredImage: image(p.featuredImage),
61
+ ...(first ? { variantId: first.id } : {}),
62
+ availableForSale: p.availableForSale,
63
+ vendor: p.vendor ?? null,
64
+ productType: p.productType ?? null,
65
+ tags: [...p.tags],
66
+ description: plainText(p.descriptionHtml),
67
+ descriptionHtml: p.descriptionHtml,
68
+ images: p.images.map(image).filter((i) => i !== null),
69
+ options: p.options.map((o) => ({ name: o.name, values: [...o.values] })),
70
+ variants: variants.map(variant),
71
+ seo: { title: p.seo?.title ?? null, description: p.seo?.description ?? null },
72
+ ...(p.metafields ? { metafields: Object.fromEntries(Object.entries(p.metafields).map(([k, v]) => [k, v == null ? null : String(v)])) } : {}),
73
+ ...(p.collections ? { collections: p.collections.map((c) => ({ handle: c.handle, title: c.title })) } : {}),
74
+ ...lowStock(p.lowStockThreshold),
75
+ ...productAutomaticDiscounts(p.automaticDiscounts),
76
+ ...productMedia(p.media),
77
+ };
78
+ }
79
+ const VIDEO_TYPES = new Set(['video/mp4', 'video/webm', 'video/quicktime']);
80
+ const HTTPS = /^https:\/\/\S+$/;
81
+ /**
82
+ * `Product.media` (storefront-query rev 2.34, theme-abi alpha.17, QA NEW-PROD-2): the gallery in the merchant's order
83
+ * with each HOSTED video. The platform sends it only when the product has a video; images-only products have none and
84
+ * the gallery stays `images`. An item that is not whole (an image without a URL, a video without an https mp4 / webm /
85
+ * quicktime source) is left out; no video left ⇒ no `media`. Read as unknown: the kit builds against older ABI types.
86
+ */
87
+ export function productMedia(raw) {
88
+ if (!Array.isArray(raw))
89
+ return {};
90
+ const out = [];
91
+ for (const [i, m] of raw.slice(0, 250).entries()) {
92
+ if (!m || typeof m !== 'object')
93
+ continue;
94
+ const r = m;
95
+ const alt = typeof r.alt === 'string' && r.alt.trim() ? r.alt.trim() : null;
96
+ if (r.mediaContentType === 'IMAGE') {
97
+ const img = image(r.image);
98
+ if (img)
99
+ out.push({ id: `media-${i}`, type: 'image', alt: alt ?? img.altText ?? null, image: img });
100
+ continue;
101
+ }
102
+ if (r.mediaContentType !== 'VIDEO' || !Array.isArray(r.sources))
103
+ continue;
104
+ const sources = r.sources
105
+ .filter((s) => Boolean(s) && typeof s.url === 'string' && HTTPS.test(s.url) && VIDEO_TYPES.has(String(s.mimeType)))
106
+ .map((s) => ({ url: s.url, mimeType: s.mimeType }));
107
+ if (!sources.length)
108
+ continue;
109
+ const poster = image(r.previewImage);
110
+ out.push({ id: `media-${i}`, type: 'video', alt, previewImage: poster && HTTPS.test(poster.url) ? poster : null, sources });
111
+ }
112
+ return out.some((m) => m.type === 'video') ? { media: out } : {};
113
+ }
114
+ const ISO = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})$/;
115
+ /**
116
+ * `Product.automaticDiscounts` (storefront-query rev 2.31, QA D8): the store's unconditional automatic discounts on
117
+ * this product. Each entry must be whole (a title, a known type, a positive value — a percentage at most 100 — and
118
+ * ISO dates with the end after the start) or it is left out: a guessed discount is worse than none.
119
+ */
120
+ export function productAutomaticDiscounts(raw) {
121
+ if (!Array.isArray(raw))
122
+ return {};
123
+ const out = [];
124
+ for (const d of raw.slice(0, 50)) {
125
+ if (!d || typeof d !== 'object')
126
+ continue;
127
+ const r = d;
128
+ const value = typeof r.value === 'string' && /^\d{1,15}(\.\d{1,4})?$/.test(r.value) ? Number(r.value) : NaN;
129
+ const type = r.valueType === 'percentage' || r.valueType === 'fixed' ? r.valueType : null;
130
+ const title = typeof r.title === 'string' ? r.title.trim() : '';
131
+ const starts = typeof r.startsAt === 'string' && ISO.test(r.startsAt) ? r.startsAt : null;
132
+ const ends = r.endsAt === undefined || r.endsAt === null ? undefined : typeof r.endsAt === 'string' && ISO.test(r.endsAt) ? r.endsAt : null;
133
+ if (typeof r.id !== 'string' || !r.id || !title || !type || !(value > 0) || (type === 'percentage' && value > 100) || !starts || ends === null)
134
+ continue;
135
+ if (ends !== undefined && Date.parse(ends) <= Date.parse(starts))
136
+ continue;
137
+ out.push({ id: r.id, title: title.slice(0, 255), valueType: type, value, startsAt: starts, ...(ends ? { endsAt: ends } : {}) });
138
+ }
139
+ return out.length ? { automaticDiscounts: out } : {};
140
+ }
141
+ /** `Product.lowStockThreshold` (storefront-query rev 2.26): the product's own low-stock threshold, when the merchant set one (D-8). */
142
+ function lowStock(v) {
143
+ return typeof v === 'number' && Number.isInteger(v) && v >= 0 && v <= 9999 ? { lowStockThreshold: v } : {};
144
+ }
145
+ /**
146
+ * ABI facet → the storefront filter Nova's listing reads (`platform/runtime/render/product-listing.ts`
147
+ * `RawFilter`): `input` is the JSON of the filter object the listing hands back to
148
+ * `collectionProducts({ filters })`, which `abiFilters` turns into the ABI `{key, value}` entries.
149
+ * A PRICE_RANGE facet becomes one value whose input carries the store's bounds (`{price: {min, max}}`).
150
+ * A variant-option value (storefront-query rev 2.35, facet `filter.v.option.<name>`, ABI key `option.<name>`) becomes
151
+ * `{variantOption: {name, value}}` — Shopify's ProductFilter shape; the option name is kept exactly as the merchant wrote it.
152
+ */
153
+ const FILTER_INPUT_KEY = { vendor: 'productVendor', productType: 'productType', tag: 'tag' };
154
+ /** The ABI filter key prefix of a variant option (storefront-query rev 2.35). */
155
+ const OPTION_KEY = 'option.';
156
+ const OPTION_NAME_MAX = 255;
157
+ const optionName = (n) => typeof n === 'string' && n.length > 0 && n.length <= OPTION_NAME_MAX;
158
+ /** One ABI facet value's `{key, value}` → the listing's filter object, or null for a key the kit does not know. */
159
+ function filterInput(key, value) {
160
+ if (key === 'available')
161
+ return { available: value === 'true' };
162
+ if (FILTER_INPUT_KEY[key])
163
+ return { [FILTER_INPUT_KEY[key]]: value };
164
+ if (key.startsWith(OPTION_KEY) && optionName(key.slice(OPTION_KEY.length)))
165
+ return { variantOption: { name: key.slice(OPTION_KEY.length), value } };
166
+ return null;
167
+ }
168
+ export function filters(list) {
169
+ const out = [];
170
+ for (const f of list ?? []) {
171
+ if (f.type === 'PRICE_RANGE') {
172
+ if (!f.range)
173
+ continue;
174
+ const min = Number(f.range.min.amount);
175
+ const max = Number(f.range.max.amount);
176
+ if (!Number.isFinite(min) || !Number.isFinite(max))
177
+ continue;
178
+ out.push({ id: f.id, label: f.label, type: 'PRICE_RANGE', values: [{ id: f.id, label: f.label, count: 0, input: JSON.stringify({ price: { min, max } }) }] });
179
+ continue;
180
+ }
181
+ const values = [];
182
+ for (const v of f.values) {
183
+ const { key, value } = v.input;
184
+ const input = filterInput(key, value);
185
+ if (input)
186
+ values.push({ id: v.id, label: v.label, count: v.count, input: JSON.stringify(input) });
187
+ }
188
+ if (values.length)
189
+ out.push({ id: f.id, label: f.label, type: f.type, values });
190
+ }
191
+ return out;
192
+ }
193
+ /** A decimal amount the data plane accepts (`^(0|[1-9][0-9]{0,14})(\.[0-9]{1,4})?$`), or null. */
194
+ function amount(n) {
195
+ if (typeof n !== 'number' || !Number.isFinite(n) || n < 0 || n >= 1e15)
196
+ return null;
197
+ return Number.isInteger(n) ? String(n) : n.toFixed(4).replace(/\.?0+$/, '');
198
+ }
199
+ /** The listing's filter objects (`{productVendor}`, `{available}`, `{price: {min, max}}`, `{variantOption: {name, value}}`, …) → ABI `filters`. Unknown shapes are dropped. */
200
+ export function abiFilters(list) {
201
+ const out = [];
202
+ for (const f of list ?? []) {
203
+ if (typeof f.available === 'boolean')
204
+ out.push({ key: 'available', value: String(f.available) });
205
+ else if (typeof f.productVendor === 'string')
206
+ out.push({ key: 'vendor', value: f.productVendor });
207
+ else if (typeof f.productType === 'string')
208
+ out.push({ key: 'productType', value: f.productType });
209
+ else if (typeof f.tag === 'string')
210
+ out.push({ key: 'tag', value: f.tag });
211
+ else if (f.variantOption && typeof f.variantOption === 'object') {
212
+ const { name, value } = f.variantOption;
213
+ if (optionName(name) && typeof value === 'string')
214
+ out.push({ key: `${OPTION_KEY}${name}`, value });
215
+ }
216
+ else if (f.price && typeof f.price === 'object') {
217
+ const { min, max } = f.price;
218
+ const lo = amount(min);
219
+ const hi = amount(max);
220
+ if (lo !== null)
221
+ out.push({ key: 'price.min', value: lo });
222
+ if (hi !== null)
223
+ out.push({ key: 'price.max', value: hi });
224
+ }
225
+ }
226
+ return out;
227
+ }
228
+ export function collection(c) {
229
+ return {
230
+ id: c.id,
231
+ handle: c.handle,
232
+ title: c.title,
233
+ templateSuffix: c.templateSuffix ?? null,
234
+ // Nova renders a collection description as text (CollectionBanner, MainCollection).
235
+ description: plainText(c.descriptionHtml) || null,
236
+ image: c.image?.url ? { url: c.image.url, ...(c.image.altText ? { altText: c.image.altText } : {}) } : null,
237
+ products: (c.products?.nodes ?? []).map(product),
238
+ ...(typeof c.products?.totalCount === 'number' ? { productsCount: c.products.totalCount } : {}),
239
+ seo: { title: c.seo?.title ?? null, description: c.seo?.description ?? null },
240
+ ...(c.filters ? { filters: filters(c.filters) } : {}),
241
+ };
242
+ }
243
+ export function page(p) {
244
+ return {
245
+ handle: p.handle,
246
+ title: p.title,
247
+ body: p.body,
248
+ bodySummary: plainText(p.body).slice(0, 160),
249
+ templateSuffix: p.templateSuffix ?? null,
250
+ seo: { title: p.seo?.title ?? null, description: p.seo?.description ?? null },
251
+ };
252
+ }
253
+ export function article(a) {
254
+ return {
255
+ id: a.id,
256
+ handle: a.handle,
257
+ title: a.title,
258
+ excerpt: a.excerpt ?? null,
259
+ contentHtml: a.contentHtml,
260
+ image: image(a.image),
261
+ author: a.author?.name ?? null,
262
+ publishedAt: a.publishedAt,
263
+ tags: [...a.tags],
264
+ blogHandle: a.blog?.handle,
265
+ seo: { title: a.seo?.title ?? null, description: a.seo?.description ?? null },
266
+ };
267
+ }
268
+ export function blog(b) {
269
+ return {
270
+ id: b.id,
271
+ handle: b.handle,
272
+ title: b.title,
273
+ articles: (b.articles?.nodes ?? []).map((a) => ({ ...article(a), blogHandle: a.blog?.handle ?? b.handle })),
274
+ seo: { title: b.seo?.title ?? null, description: b.seo?.description ?? null },
275
+ };
276
+ }
277
+ function menuItem(i) {
278
+ return {
279
+ id: i.id,
280
+ title: i.title,
281
+ url: i.url,
282
+ type: (MENU_TYPES.has(i.type) ? i.type : 'HTTP'),
283
+ items: i.items.map(menuItem),
284
+ };
285
+ }
286
+ export function menu(m) {
287
+ return { id: `menu:${m.handle}`, handle: m.handle, title: m.title, items: m.items.map(menuItem) };
288
+ }
289
+ /** Nova's `shop.policies` slots, keyed by the policy handles the platform uses. */
290
+ const POLICY_SLOT = {
291
+ 'privacy-policy': 'privacy',
292
+ 'refund-policy': 'refund',
293
+ 'terms-of-service': 'termsOfService',
294
+ 'shipping-policy': 'shipping',
295
+ 'subscription-policy': 'subscription',
296
+ };
297
+ export function policy(p) {
298
+ return { handle: p.handle, title: p.title, url: p.url, body: p.body };
299
+ }
300
+ export function shop(s, policies = [], country = '') {
301
+ const slots = {};
302
+ for (const p of policies) {
303
+ const slot = POLICY_SLOT[p.handle];
304
+ slots[slot ?? p.handle] = policy(p);
305
+ }
306
+ const primary = s.brand?.colors?.primary;
307
+ const social = socialLinks(s.socialLinks);
308
+ let host = '';
309
+ try {
310
+ host = new URL(s.primaryDomain.url).host;
311
+ }
312
+ catch {
313
+ host = '';
314
+ }
315
+ const seo = shopSeo(s.seo);
316
+ const extra = s;
317
+ const contact = shopContact(extra.contact);
318
+ const banner = cookieBanner(extra.cookieBanner);
319
+ const links = policyLinks(extra.policyLinks);
320
+ const freeShipping = freeShippingFor(extra.freeShipping, country);
321
+ const moneyFormat = shopMoneyFormat(extra.moneyFormat);
322
+ const address = shopAddress(extra.contact?.address);
323
+ const locations = shopLocations(extra.locations);
324
+ return {
325
+ name: s.name,
326
+ description: s.description ?? null,
327
+ ...(seo ? { seo } : {}),
328
+ ...contact,
329
+ ...(extra.taxesIncluded === true ? { taxesIncluded: true } : {}),
330
+ ...(freeShipping ? { freeShippingThreshold: freeShipping } : {}),
331
+ ...(banner ? { consentBanner: banner } : {}),
332
+ ...(extra.accounts && typeof extra.accounts === 'object' && extra.accounts.signInLinks === false ? { signInLinks: false } : {}),
333
+ ...(links ? { policyLinks: links } : {}),
334
+ ...(moneyFormat ? { moneyFormat } : {}),
335
+ ...(address ? { address } : {}),
336
+ ...(locations.length ? { locations } : {}),
337
+ brand: s.brand
338
+ ? {
339
+ logo: image(s.brand.logo),
340
+ squareLogo: image(s.brand.squareLogo),
341
+ ...(primary ? { colors: { primary: [{ background: primary }], secondary: [] } } : {}),
342
+ }
343
+ : null,
344
+ policies: slots,
345
+ primaryDomain: { host, url: s.primaryDomain.url, sslEnabled: s.primaryDomain.url.startsWith('https:') },
346
+ ...(social.length ? { socialLinks: social } : {}),
347
+ paymentSettings: { acceptedCardBrands: [...(s.paymentSettings.acceptedCardBrands ?? [])], supportedDigitalWallets: [], currencyCode: s.paymentSettings.currencyCode },
348
+ };
349
+ }
350
+ const ADDRESS_KEYS = ['address1', 'address2', 'city', 'province', 'zip', 'country'];
351
+ /**
352
+ * rev 2.34 `PostalAddress` (`Shop.contact.address`, `ShopLocation.address`) → each member that is a non-empty string
353
+ * of at most 255 characters with no control character; `countryCode` only when two upper-case letters. Null when none.
354
+ */
355
+ export function shopAddress(raw) {
356
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw))
357
+ return null;
358
+ const r = raw;
359
+ const out = {};
360
+ for (const k of ADDRESS_KEYS) {
361
+ const v = text(r[k], 255);
362
+ if (v && !CONTROL.test(v))
363
+ out[k] = v;
364
+ }
365
+ if (typeof r.countryCode === 'string' && /^[A-Z]{2}$/.test(r.countryCode))
366
+ out.countryCode = r.countryCode;
367
+ return Object.keys(out).length ? out : null;
368
+ }
369
+ /** rev 2.34 `Shop.locations` → whole entries only (an id, a name, an address), in the platform's order, at most 50. */
370
+ export function shopLocations(raw) {
371
+ if (!Array.isArray(raw))
372
+ return [];
373
+ const out = [];
374
+ for (const l of raw.slice(0, 50)) {
375
+ if (!l || typeof l !== 'object')
376
+ continue;
377
+ const r = l;
378
+ const id = text(r.id, 128);
379
+ const name = text(r.name, 255);
380
+ const address = shopAddress(r.address);
381
+ if (!id || !name || !address)
382
+ continue;
383
+ const phone = text(r.phone, 50);
384
+ out.push({ id, name, address, ...(phone && /^[0-9+()\-. ]+$/.test(phone) ? { phone } : {}) });
385
+ }
386
+ return out;
387
+ }
388
+ /** One `{{amount…}}` token (the merchant's currency-format patterns). */
389
+ export const MONEY_FORMAT_TOKEN = /\{\{\s*(amount|amount_no_decimals|amount_with_comma_separator|amount_no_decimals_with_comma_separator|amount_with_apostrophe_separator|amount_no_decimals_with_space_separator|amount_with_space_separator|amount_with_period_and_space_separator)\s*\}\}/;
390
+ // eslint-disable-next-line no-control-regex
391
+ const CONTROL = /[\u0000-\u001f\u007f]/;
392
+ /**
393
+ * rev 2.31 `Shop.moneyFormat` → the patterns a theme may format base-currency amounts with, each only when it is a
394
+ * string of at most 50 characters holding an amount token. Null when neither is usable: a pattern the theme cannot
395
+ * read must never replace the price.
396
+ */
397
+ export function shopMoneyFormat(raw) {
398
+ if (!raw || typeof raw !== 'object')
399
+ return null;
400
+ const r = raw;
401
+ const ok = (v) => typeof v === 'string' && v.length > 0 && v.length <= 50 && !CONTROL.test(v) && MONEY_FORMAT_TOKEN.test(v);
402
+ const out = {};
403
+ if (ok(r.withCurrency))
404
+ out.withCurrency = r.withCurrency;
405
+ if (ok(r.withoutCurrency))
406
+ out.withoutCurrency = r.withoutCurrency;
407
+ return out.withCurrency || out.withoutCurrency ? out : null;
408
+ }
409
+ const text = (v, max = 2000) => (typeof v === 'string' && v.trim() ? v.trim().slice(0, max) : undefined);
410
+ /** D-7 `Shop.contact` → the shop's public email / phone, each only when set. */
411
+ export function shopContact(raw) {
412
+ if (!raw || typeof raw !== 'object')
413
+ return {};
414
+ const r = raw;
415
+ const email = text(r.email, 255);
416
+ const phone = text(r.phone, 50);
417
+ return {
418
+ ...(email && /^[^\s@<>"]+@[^\s@<>"]+\.[^\s@<>"]+$/.test(email) ? { email } : {}),
419
+ ...(phone && /^[0-9+()\-. ]+$/.test(phone) ? { phone } : {}),
420
+ };
421
+ }
422
+ /** A link target the banner may use: a site path or an absolute https URL. */
423
+ function safeHref(v) {
424
+ const t = text(v, 2048);
425
+ if (!t)
426
+ return undefined;
427
+ if (t.startsWith('/') && !t.startsWith('//'))
428
+ return t;
429
+ try {
430
+ const u = new URL(t);
431
+ return u.protocol === 'https:' && u.hostname ? u.href : undefined;
432
+ }
433
+ catch {
434
+ return undefined;
435
+ }
436
+ }
437
+ const POSITIONS = new Set(['bottom', 'bottom-left', 'bottom-right', 'bottom-center', 'center']);
438
+ const BANNER_TEXT = ['title', 'body', 'privacyLinkLabel', 'acceptLabel', 'declineLabel', 'manageLabel'];
439
+ const PREFS_TEXT = [
440
+ 'title', 'introTitle', 'introBody', 'acceptAllLabel', 'declineAllLabel', 'saveLabel', 'bulletTitle',
441
+ 'requiredTitle', 'requiredDescription', 'personalizationTitle', 'personalizationDescription',
442
+ 'marketingTitle', 'marketingDescription', 'analyticsTitle', 'analyticsDescription',
443
+ ];
444
+ function texts(raw, keys) {
445
+ const out = {};
446
+ if (!raw || typeof raw !== 'object')
447
+ return out;
448
+ for (const k of keys) {
449
+ const v = text(raw[k]);
450
+ if (v)
451
+ out[k] = v;
452
+ }
453
+ return out;
454
+ }
455
+ /** D-2 `Shop.cookieBanner` → the banner config Nova renders. Null when absent or not an object (old data = today's banner). */
456
+ export function cookieBanner(raw) {
457
+ if (!raw || typeof raw !== 'object')
458
+ return null;
459
+ const r = raw;
460
+ const position = typeof r.position === 'string' && POSITIONS.has(r.position) ? r.position : 'bottom';
461
+ const colorTheme = r.colorTheme === 'dark' || r.colorTheme === 'custom' ? r.colorTheme : 'light';
462
+ const regions = Array.isArray(r.regions) ? r.regions.filter((x) => typeof x === 'string' && /^[A-Z]{2}(-[A-Z0-9]{1,3})?$/.test(x)) : [];
463
+ const privacyLinkUrl = safeHref(r.privacyLinkUrl);
464
+ const t = texts(r.text, BANNER_TEXT);
465
+ const p = texts(r.preferences, PREFS_TEXT);
466
+ const prefs = r.preferences && typeof r.preferences === 'object' ? r.preferences : null;
467
+ const bullets = prefs?.bulletsEnabled === true && Array.isArray(prefs.bullets) ? prefs.bullets.map((b) => text(b, 500)).filter((b) => Boolean(b)).slice(0, 3) : [];
468
+ return {
469
+ enabled: r.enabled === true,
470
+ // "Use automated settings" — never saved means on (contract rev 2).
471
+ automated: r.automated !== false,
472
+ position,
473
+ colorTheme,
474
+ regions,
475
+ ...(privacyLinkUrl ? { privacyLinkUrl } : {}),
476
+ text: t,
477
+ preferences: { ...p, ...(bullets.length ? { bullets } : {}) },
478
+ };
479
+ }
480
+ /** D-6 `Shop.policyLinks` → the store's published policies (title + site path). Null when absent. */
481
+ export function policyLinks(raw) {
482
+ if (!Array.isArray(raw))
483
+ return null;
484
+ const out = [];
485
+ for (const l of raw) {
486
+ const handle = typeof l?.handle === 'string' && /^[a-z0-9][a-z0-9-]{0,63}$/.test(l.handle) ? l.handle : '';
487
+ const title = text(l?.title, 200);
488
+ if (!handle || !title || out.some((o) => o.handle === handle))
489
+ continue;
490
+ out.push({ handle, title, url: `/policies/${handle}` });
491
+ }
492
+ return out;
493
+ }
494
+ /**
495
+ * D-5 `Shop.freeShipping` → the lowest "free over" threshold for the shopper's country, or null when the
496
+ * country's zone has none (or the platform sent nothing). The amount is already in the market's currency.
497
+ */
498
+ export function freeShippingFor(raw, country) {
499
+ if (!Array.isArray(raw) || !country)
500
+ return null;
501
+ const c = country.toUpperCase();
502
+ for (const e of raw) {
503
+ if (!e || !Array.isArray(e.countries) || !e.countries.includes(c))
504
+ continue;
505
+ const m = e.minimumSubtotal;
506
+ if (m && typeof m.amount === 'string' && /^\d{1,15}(\.\d{1,4})?$/.test(m.amount) && typeof m.currencyCode === 'string' && /^[A-Z]{3}$/.test(m.currencyCode)) {
507
+ return { amount: m.amount, currencyCode: m.currencyCode };
508
+ }
509
+ return null;
510
+ }
511
+ return null;
512
+ }
513
+ /**
514
+ * `Shop.seo` (the home page's title, meta description and social image — an optional ABI field the
515
+ * platform may not send yet), read defensively: trimmed non-empty text, an absolute `https:` image
516
+ * URL, positive integer sizes. Anything else is "not set". Null when nothing is set.
517
+ */
518
+ export function shopSeo(raw) {
519
+ if (!raw || typeof raw !== 'object')
520
+ return null;
521
+ const r = raw;
522
+ const text = (v, max) => (typeof v === 'string' && v.trim() ? v.trim().slice(0, max) : undefined);
523
+ const size = (v) => (typeof v === 'number' && Number.isInteger(v) && v > 0 ? v : undefined);
524
+ const title = text(r.title, 300);
525
+ const description = text(r.description, 1000);
526
+ let image;
527
+ const img = r.image;
528
+ if (img && typeof img === 'object' && typeof img.url === 'string') {
529
+ try {
530
+ const u = new URL(img.url);
531
+ if (u.protocol === 'https:' && u.hostname) {
532
+ const alt = text(img.altText, 500);
533
+ const width = size(img.width);
534
+ const height = size(img.height);
535
+ image = { url: u.href, ...(alt ? { altText: alt } : {}), ...(width ? { width } : {}), ...(height ? { height } : {}) };
536
+ }
537
+ }
538
+ catch {
539
+ /* not a URL */
540
+ }
541
+ }
542
+ if (!title && !description && !image)
543
+ return null;
544
+ return { ...(title ? { title } : {}), ...(description ? { description } : {}), ...(image ? { image } : {}) };
545
+ }
546
+ /**
547
+ * `Shop.socialLinks` → Nova's: only absolute `https:` URLs with a network slug, one link per network
548
+ * (the first wins). Anything else is dropped — a footer link must never point somewhere unsafe.
549
+ */
550
+ export function socialLinks(list) {
551
+ const out = [];
552
+ for (const l of list ?? []) {
553
+ const platform = typeof l?.platform === 'string' ? l.platform.trim().toLowerCase() : '';
554
+ if (!/^[a-z0-9][a-z0-9_-]{0,31}$/.test(platform) || out.some((o) => o.platform === platform))
555
+ continue;
556
+ let url;
557
+ try {
558
+ url = new URL(String(l.url));
559
+ }
560
+ catch {
561
+ continue;
562
+ }
563
+ if (url.protocol !== 'https:' || !url.hostname)
564
+ continue;
565
+ out.push({ platform, url: url.href });
566
+ }
567
+ return out;
568
+ }
569
+ export function searchResults(r) {
570
+ return {
571
+ totalCount: (r.products.totalCount ?? r.products.nodes.length) + (r.pages.totalCount ?? r.pages.nodes.length) + (r.articles.totalCount ?? r.articles.nodes.length),
572
+ products: r.products.nodes.map(product),
573
+ pages: r.pages.nodes.map((p) => ({ handle: p.handle, title: p.title })),
574
+ articles: r.articles.nodes.map(article),
575
+ filters: [],
576
+ pageInfo: {
577
+ hasNextPage: r.products.pageInfo.hasNextPage,
578
+ hasPreviousPage: false,
579
+ startCursor: null,
580
+ endCursor: r.products.pageInfo.endCursor ?? null,
581
+ },
582
+ };
583
+ }
584
+ /**
585
+ * The cart-level amount taken off between the subtotal and the total.
586
+ *
587
+ * The ABI cart has no discount allocations, only `cost.subtotalAmount`, `cost.totalTaxAmount` and
588
+ * `cost.totalAmount`. Before checkout those are related by
589
+ * `total = subtotal − cart discount + tax`, so the discount is what reconciles the three figures
590
+ * the summary prints. Without it the cart showed "Subtotal $64.00 · Tax $0.00 · Estimated total
591
+ * $60.80" with nothing explaining the $3.20.
592
+ *
593
+ * Computed in minor units at the subtotal's own precision (never `toFixed(2)` — JPY has none, KWD
594
+ * three). Null when nothing was taken off, when the figures are not one currency, or when an
595
+ * amount is not a number: a guessed discount is worse than none.
596
+ */
597
+ export function cartDiscount(c) {
598
+ const { subtotalAmount: sub, totalAmount: total } = c.cost;
599
+ const tax = c.cost.totalTaxAmount ?? null;
600
+ if (!sub || !total || sub.currencyCode !== total.currencyCode)
601
+ return null;
602
+ if (tax && tax.currencyCode !== sub.currencyCode)
603
+ return null;
604
+ const decimals = Math.max(...[sub, total, ...(tax ? [tax] : [])].map((m) => (m.amount.split('.')[1] ?? '').length));
605
+ const scale = 10 ** decimals;
606
+ const minor = (m) => Math.round(Number(m.amount) * scale);
607
+ const off = minor(sub) + (tax ? minor(tax) : 0) - minor(total);
608
+ if (!Number.isFinite(off) || off <= 0)
609
+ return null;
610
+ return { amount: (off / scale).toFixed(decimals), currencyCode: sub.currencyCode };
611
+ }
612
+ /** The ABI cart → the lines/totals CartProvider renders (lib/tanqory/cart.tsx CartState fields). */
613
+ export function cartState(c) {
614
+ return {
615
+ id: c.id,
616
+ version: c.version,
617
+ lines: c.lines.map((l) => ({
618
+ id: l.id,
619
+ variantId: l.merchandise.id,
620
+ quantity: l.quantity,
621
+ title: l.merchandise.product.title,
622
+ ...(l.merchandise.title && l.merchandise.title !== 'Default Title' ? { variantTitle: l.merchandise.title } : {}),
623
+ image: image(l.merchandise.image ?? l.merchandise.product.featuredImage),
624
+ price: l.merchandise.price,
625
+ // The merchandise is a whole ProductVariant: its options, compare-at and availability are the
626
+ // line's (the cart shows "Queen · Oat", the struck compare-at and "No longer available").
627
+ selectedOptions: (l.merchandise.selectedOptions ?? []).map((o) => ({ name: o.name, value: o.value })),
628
+ ...(l.merchandise.compareAtPrice ? { compareAtPrice: l.merchandise.compareAtPrice } : {}),
629
+ ...(typeof l.merchandise.availableForSale === 'boolean' ? { availableForSale: l.merchandise.availableForSale } : {}),
630
+ lineSubtotal: l.cost.subtotalAmount,
631
+ productHandle: l.merchandise.product.handle,
632
+ attributes: Object.entries(l.attributes).map(([key, value]) => ({ key, value })),
633
+ })),
634
+ subtotal: c.cost.subtotalAmount,
635
+ total: c.cost.totalAmount,
636
+ tax: c.cost.totalTaxAmount ?? null,
637
+ note: c.note ?? null,
638
+ totalQuantity: c.totalQuantity,
639
+ checkoutUrl: c.checkoutUrl,
640
+ discountCodes: c.discountCodes.map((d) => ({ code: d.code, applicable: d.applicable })),
641
+ discountAmount: cartDiscount(c),
642
+ ...cartDiscountAllocations(c),
643
+ };
644
+ }
645
+ /**
646
+ * The cart's order-level discounts by name, when the host sends them beside the ABI cart (storefront-edge reads
647
+ * store-api's `Cart.discountAllocations`; not yet in the Theme ABI `Cart`, so read as unknown). Each entry needs a
648
+ * name (a title or a code) and an amount in the cart's currency; anything else drops the whole list rather than
649
+ * show a partial one.
650
+ */
651
+ export function cartDiscountAllocations(c) {
652
+ const raw = c.discountAllocations;
653
+ if (!Array.isArray(raw) || raw.length === 0)
654
+ return {};
655
+ const currency = c.cost.subtotalAmount?.currencyCode;
656
+ const out = [];
657
+ for (const a of raw) {
658
+ if (!a || typeof a !== 'object')
659
+ return {};
660
+ const r = a;
661
+ const title = typeof r.title === 'string' && r.title.trim() ? r.title.trim().slice(0, 255) : null;
662
+ const code = typeof r.code === 'string' && r.code.trim() ? r.code.trim().slice(0, 255) : null;
663
+ const m = r.amount;
664
+ if ((!title && !code) || !m || typeof m.amount !== 'string' || !/^\d{1,15}(\.\d{1,4})?$/.test(m.amount) || m.currencyCode !== currency)
665
+ return {};
666
+ if (Number(m.amount) > 0)
667
+ out.push({ title, code, amount: { amount: m.amount, currencyCode: m.currencyCode } });
668
+ }
669
+ return out.length ? { discountAllocations: out } : {};
670
+ }
@@ -0,0 +1,15 @@
1
+ import type { DataApi } from '../runtime/kit/data.js';
2
+ import type { PageData } from './page-data.js';
3
+ import type { AbiRemote } from './wire.js';
4
+ export declare const SEARCH_SORTS: readonly ["relevance", ...string[]];
5
+ export declare function searchOrder(sort: string | null | undefined): {
6
+ sortKey: 'PRICE' | 'TITLE' | 'CREATED_AT';
7
+ reverse: boolean;
8
+ } | null;
9
+ /** The resource-cache key of a search (platform/runtime/data/StoreProvider.tsx keys its loads the same way). */
10
+ export declare const searchKey: (query: string, sort?: string | null) => string;
11
+ type StoreLocations = Awaited<ReturnType<NonNullable<DataApi['locations']>>>;
12
+ /** rev 2.34 `Shop.locations` (converted by `convert.shop`) → `DataApi.locations`; a store without them answers `[]`. */
13
+ export declare function storeLocations(shop: PageData['shop'] | null | undefined): StoreLocations;
14
+ export declare function createDataApi(pd: PageData, remote: AbiRemote | null): DataApi;
15
+ export {};