@tanqory/theme-kit 2.0.0-alpha.3 → 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.
- package/dist/abi/cart.js +66 -1
- package/dist/abi/convert.d.ts +69 -3
- package/dist/abi/convert.js +179 -2
- package/dist/abi/data-api.d.ts +4 -0
- package/dist/abi/data-api.js +20 -0
- package/dist/abi/page-data.d.ts +12 -1
- package/dist/abi/page-data.js +8 -2
- package/dist/runtime/data/to-ui.d.ts +22 -1
- package/dist/runtime/data/to-ui.js +64 -3
- package/dist/runtime/kit/cart.d.ts +19 -0
- package/dist/runtime/kit/cart.js +1 -0
- package/dist/runtime/kit/data.d.ts +11 -1
- package/dist/runtime/kit/storefront.d.ts +34 -0
- package/dist/runtime/render/section-actions.d.ts +4 -0
- package/dist/runtime/render/section-actions.js +1 -0
- package/dist/runtime/shell/RuntimeBridge.js +3 -0
- package/dist/sdk/runtime-context.d.ts +15 -0
- package/dist/sdk/types.d.ts +75 -0
- package/package.json +2 -2
package/dist/abi/cart.js
CHANGED
|
@@ -47,6 +47,8 @@ export function refusalOf(raw) {
|
|
|
47
47
|
const max = raw.maxQuantity;
|
|
48
48
|
return typeof max === 'number' && Number.isSafeInteger(max) && max >= 1 ? { code: 'cart_limit_exceeded', maxQuantity: max } : { code: 'cart_limit_exceeded' };
|
|
49
49
|
}
|
|
50
|
+
/** Discount codes compare case-insensitively (store-api stores them upper-cased). */
|
|
51
|
+
const sameCode = (a, b) => a.localeCompare(b, undefined, { sensitivity: 'accent' }) === 0;
|
|
50
52
|
const UNSUPPORTED = 'unsupported';
|
|
51
53
|
const MAX_RETRY_MS = 5 * 60_000;
|
|
52
54
|
const MAX_BACKOFF_MS = 30_000;
|
|
@@ -80,12 +82,15 @@ export function AbiCartProvider({ initial, remote, children }) {
|
|
|
80
82
|
/** Why the latest write was refused, when the platform said (Cart-1). */
|
|
81
83
|
const refusalRef = useRef(null);
|
|
82
84
|
const lastRefusal = useCallback(() => refusalRef.current, []);
|
|
85
|
+
/** The wire code of the latest failed write (`invalid` = the store refused it), else null. */
|
|
86
|
+
const failRef = useRef(null);
|
|
83
87
|
const apply = useCallback((c) => {
|
|
84
88
|
cartRef.current = c;
|
|
85
89
|
loadedRef.current = true;
|
|
86
90
|
setState(stateOf(c, true));
|
|
87
91
|
}, []);
|
|
88
92
|
const fail = useCallback((message) => setState((s) => ({ ...s, loading: false, error: message })), []);
|
|
93
|
+
const failState = fail;
|
|
89
94
|
useEffect(() => {
|
|
90
95
|
if (!remote || loadedRef.current)
|
|
91
96
|
return;
|
|
@@ -121,7 +126,12 @@ export function AbiCartProvider({ initial, remote, children }) {
|
|
|
121
126
|
const mutate = useCallback(async (name, args) => {
|
|
122
127
|
if (!remote)
|
|
123
128
|
return false;
|
|
129
|
+
const fail = (code) => {
|
|
130
|
+
failRef.current = code;
|
|
131
|
+
failState(code);
|
|
132
|
+
};
|
|
124
133
|
const run = async () => {
|
|
134
|
+
failRef.current = null;
|
|
125
135
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
126
136
|
refusalRef.current = null;
|
|
127
137
|
const version = cartRef.current?.version ?? 0;
|
|
@@ -166,7 +176,7 @@ export function AbiCartProvider({ initial, remote, children }) {
|
|
|
166
176
|
fail(e.message);
|
|
167
177
|
return false;
|
|
168
178
|
}
|
|
169
|
-
}, [remote, apply,
|
|
179
|
+
}, [remote, apply, failState]);
|
|
170
180
|
const add = useCallback(async (input) => {
|
|
171
181
|
const quantity = input.quantity ?? 1;
|
|
172
182
|
refusalRef.current = null;
|
|
@@ -226,6 +236,59 @@ export function AbiCartProvider({ initial, remote, children }) {
|
|
|
226
236
|
if (!(await mutate('cart.applyDiscountCode', (v) => [code, v])))
|
|
227
237
|
return;
|
|
228
238
|
}, [mutate]);
|
|
239
|
+
/**
|
|
240
|
+
* One code on the cart (store-api holds one: `cartUpdateDiscountCodes` reads `codes[0]`, and the gateway's
|
|
241
|
+
* `cart.applyDiscountCode` sends the current codes first), so a new code first takes the old one off. A code the store
|
|
242
|
+
* keeps as not applicable is taken off again and the old code put back, so checkout never receives a code the
|
|
243
|
+
* shopper was told did not work. A gateway that answers that refusal as `invalid` (it drops the cart store-api sent
|
|
244
|
+
* with `DISCOUNT_INAPPLICABLE`) is read back with `cart.get`.
|
|
245
|
+
*/
|
|
246
|
+
const applyDiscountCode = useCallback(async (raw) => {
|
|
247
|
+
const code = raw.trim();
|
|
248
|
+
if (!code || code.length > 255 || !remote)
|
|
249
|
+
return code ? 'failed' : 'not_applicable';
|
|
250
|
+
const held = () => cartRef.current?.discountCodes ?? [];
|
|
251
|
+
const find = (c) => held().find((d) => sameCode(d.code, c));
|
|
252
|
+
if (find(code)?.applicable)
|
|
253
|
+
return 'applied';
|
|
254
|
+
const previous = held().find((d) => d.applicable)?.code ?? null;
|
|
255
|
+
for (const d of held())
|
|
256
|
+
if (!sameCode(d.code, code) && !(await mutate('cart.removeDiscountCode', (v) => [d.code, v])))
|
|
257
|
+
return 'failed';
|
|
258
|
+
const putBack = async () => {
|
|
259
|
+
if (previous && !find(previous))
|
|
260
|
+
await mutate('cart.applyDiscountCode', (v) => [previous, v]);
|
|
261
|
+
};
|
|
262
|
+
if (!(await mutate('cart.applyDiscountCode', (v) => [code, v]))) {
|
|
263
|
+
const refused = failRef.current === 'invalid';
|
|
264
|
+
try {
|
|
265
|
+
apply((await remote.data('cart.get', [])) ?? null);
|
|
266
|
+
}
|
|
267
|
+
catch {
|
|
268
|
+
/* keep what we have */
|
|
269
|
+
}
|
|
270
|
+
if (!find(code)) {
|
|
271
|
+
if (refused)
|
|
272
|
+
await putBack();
|
|
273
|
+
return refused ? 'not_applicable' : 'failed';
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const hit = find(code);
|
|
277
|
+
if (!hit)
|
|
278
|
+
return 'failed';
|
|
279
|
+
if (hit.applicable)
|
|
280
|
+
return 'applied';
|
|
281
|
+
await mutate('cart.removeDiscountCode', (v) => [hit.code, v]);
|
|
282
|
+
await putBack();
|
|
283
|
+
return 'not_applicable';
|
|
284
|
+
}, [remote, mutate, apply]);
|
|
285
|
+
const removeDiscountCode = useCallback(async (raw) => {
|
|
286
|
+
const code = raw.trim();
|
|
287
|
+
const hit = cartRef.current?.discountCodes.find((d) => sameCode(d.code, code));
|
|
288
|
+
if (!hit)
|
|
289
|
+
return true;
|
|
290
|
+
return mutate('cart.removeDiscountCode', (v) => [hit.code, v]);
|
|
291
|
+
}, [mutate]);
|
|
229
292
|
const updateNote = useCallback(async (note) => { await mutate('cart.updateNote', (v) => [note, v]); }, [mutate]);
|
|
230
293
|
const unsupported = useCallback(async () => fail(UNSUPPORTED), [fail]);
|
|
231
294
|
const reload = useCallback(async () => {
|
|
@@ -251,6 +314,8 @@ export function AbiCartProvider({ initial, remote, children }) {
|
|
|
251
314
|
updateAttributes: unsupported,
|
|
252
315
|
reload,
|
|
253
316
|
lastRefusal,
|
|
317
|
+
applyDiscountCode,
|
|
318
|
+
removeDiscountCode,
|
|
254
319
|
};
|
|
255
320
|
return _jsx(CartContext.Provider, { value: value, children: children });
|
|
256
321
|
}
|
package/dist/abi/convert.d.ts
CHANGED
|
@@ -16,14 +16,38 @@
|
|
|
16
16
|
* See MISMATCHES.md for each field that has no ABI source.
|
|
17
17
|
*/
|
|
18
18
|
import type { Filter as AbiFilter, Article as AbiArticle, Blog as AbiBlog, Cart as AbiCart, Collection as AbiCollection, Image as AbiImage, Menu as AbiMenu, Page as AbiPage, Policy as AbiPolicy, Product as AbiProduct, Shop as AbiShop, SearchResult as AbiSearchResult } from '@tanqory/theme-abi';
|
|
19
|
-
import type { Collection, ImageRef, Page, Product } from '../runtime/kit/data.js';
|
|
20
|
-
import type { Article, Blog, Filter, Menu, SearchResults, Shop, ShopPolicy } from '../runtime/kit/storefront.js';
|
|
19
|
+
import type { Collection, ImageRef, Page, Product, ProductMedia } from '../runtime/kit/data.js';
|
|
20
|
+
import type { Article, Blog, Filter, Menu, SearchResults, Shop, ShopAddress, ShopLocation, ShopPolicy } from '../runtime/kit/storefront.js';
|
|
21
21
|
export declare function image(i: AbiImage | null | undefined): ImageRef | null;
|
|
22
22
|
/** Plain text of an HTML body, for the surfaces that show text only (cards, meta description). */
|
|
23
23
|
export declare function plainText(html: string | null | undefined): string;
|
|
24
24
|
export declare function product(p: AbiProduct): Product;
|
|
25
|
+
/**
|
|
26
|
+
* `Product.media` (storefront-query rev 2.34, theme-abi alpha.17, QA NEW-PROD-2): the gallery in the merchant's order
|
|
27
|
+
* with each HOSTED video. The platform sends it only when the product has a video; images-only products have none and
|
|
28
|
+
* the gallery stays `images`. An item that is not whole (an image without a URL, a video without an https mp4 / webm /
|
|
29
|
+
* quicktime source) is left out; no video left ⇒ no `media`. Read as unknown: the kit builds against older ABI types.
|
|
30
|
+
*/
|
|
31
|
+
export declare function productMedia(raw: unknown): {
|
|
32
|
+
media?: ProductMedia[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* `Product.automaticDiscounts` (storefront-query rev 2.31, QA D8): the store's unconditional automatic discounts on
|
|
36
|
+
* this product. Each entry must be whole (a title, a known type, a positive value — a percentage at most 100 — and
|
|
37
|
+
* ISO dates with the end after the start) or it is left out: a guessed discount is worse than none.
|
|
38
|
+
*/
|
|
39
|
+
export declare function productAutomaticDiscounts(raw: unknown): {
|
|
40
|
+
automaticDiscounts?: Array<{
|
|
41
|
+
id: string;
|
|
42
|
+
title: string;
|
|
43
|
+
valueType: 'percentage' | 'fixed';
|
|
44
|
+
value: number;
|
|
45
|
+
startsAt: string;
|
|
46
|
+
endsAt?: string;
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
25
49
|
export declare function filters(list: readonly AbiFilter[] | undefined): Filter[];
|
|
26
|
-
/** The listing's filter objects (`{productVendor}`, `{available}`, `{price: {min, max}}`, …) → ABI `filters`. Unknown shapes are dropped. */
|
|
50
|
+
/** The listing's filter objects (`{productVendor}`, `{available}`, `{price: {min, max}}`, `{variantOption: {name, value}}`, …) → ABI `filters`. Unknown shapes are dropped. */
|
|
27
51
|
export declare function abiFilters(list: readonly Record<string, unknown>[] | undefined): {
|
|
28
52
|
key: string;
|
|
29
53
|
value: string;
|
|
@@ -35,6 +59,24 @@ export declare function blog(b: AbiBlog): Blog;
|
|
|
35
59
|
export declare function menu(m: AbiMenu): Menu;
|
|
36
60
|
export declare function policy(p: AbiPolicy): ShopPolicy;
|
|
37
61
|
export declare function shop(s: AbiShop, policies?: readonly AbiPolicy[], country?: string): Shop;
|
|
62
|
+
/**
|
|
63
|
+
* rev 2.34 `PostalAddress` (`Shop.contact.address`, `ShopLocation.address`) → each member that is a non-empty string
|
|
64
|
+
* of at most 255 characters with no control character; `countryCode` only when two upper-case letters. Null when none.
|
|
65
|
+
*/
|
|
66
|
+
export declare function shopAddress(raw: unknown): ShopAddress | null;
|
|
67
|
+
/** rev 2.34 `Shop.locations` → whole entries only (an id, a name, an address), in the platform's order, at most 50. */
|
|
68
|
+
export declare function shopLocations(raw: unknown): ShopLocation[];
|
|
69
|
+
/** One `{{amount…}}` token (the merchant's currency-format patterns). */
|
|
70
|
+
export declare const MONEY_FORMAT_TOKEN: RegExp;
|
|
71
|
+
/**
|
|
72
|
+
* rev 2.31 `Shop.moneyFormat` → the patterns a theme may format base-currency amounts with, each only when it is a
|
|
73
|
+
* string of at most 50 characters holding an amount token. Null when neither is usable: a pattern the theme cannot
|
|
74
|
+
* read must never replace the price.
|
|
75
|
+
*/
|
|
76
|
+
export declare function shopMoneyFormat(raw: unknown): {
|
|
77
|
+
withCurrency?: string;
|
|
78
|
+
withoutCurrency?: string;
|
|
79
|
+
} | null;
|
|
38
80
|
/** D-7 `Shop.contact` → the shop's public email / phone, each only when set. */
|
|
39
81
|
export declare function shopContact(raw: unknown): {
|
|
40
82
|
email?: string;
|
|
@@ -86,6 +128,14 @@ export declare function cartDiscount(c: AbiCart): {
|
|
|
86
128
|
} | null;
|
|
87
129
|
/** The ABI cart → the lines/totals CartProvider renders (lib/tanqory/cart.tsx CartState fields). */
|
|
88
130
|
export declare function cartState(c: AbiCart): {
|
|
131
|
+
discountAllocations?: Array<{
|
|
132
|
+
title: string | null;
|
|
133
|
+
code: string | null;
|
|
134
|
+
amount: {
|
|
135
|
+
amount: string;
|
|
136
|
+
currencyCode: string;
|
|
137
|
+
};
|
|
138
|
+
}>;
|
|
89
139
|
id: string;
|
|
90
140
|
version: number;
|
|
91
141
|
lines: {
|
|
@@ -124,3 +174,19 @@ export declare function cartState(c: AbiCart): {
|
|
|
124
174
|
currencyCode: string;
|
|
125
175
|
} | null;
|
|
126
176
|
};
|
|
177
|
+
/**
|
|
178
|
+
* The cart's order-level discounts by name, when the host sends them beside the ABI cart (storefront-edge reads
|
|
179
|
+
* store-api's `Cart.discountAllocations`; not yet in the Theme ABI `Cart`, so read as unknown). Each entry needs a
|
|
180
|
+
* name (a title or a code) and an amount in the cart's currency; anything else drops the whole list rather than
|
|
181
|
+
* show a partial one.
|
|
182
|
+
*/
|
|
183
|
+
export declare function cartDiscountAllocations(c: AbiCart): {
|
|
184
|
+
discountAllocations?: Array<{
|
|
185
|
+
title: string | null;
|
|
186
|
+
code: string | null;
|
|
187
|
+
amount: {
|
|
188
|
+
amount: string;
|
|
189
|
+
currencyCode: string;
|
|
190
|
+
};
|
|
191
|
+
}>;
|
|
192
|
+
};
|
package/dist/abi/convert.js
CHANGED
|
@@ -72,8 +72,72 @@ export function product(p) {
|
|
|
72
72
|
...(p.metafields ? { metafields: Object.fromEntries(Object.entries(p.metafields).map(([k, v]) => [k, v == null ? null : String(v)])) } : {}),
|
|
73
73
|
...(p.collections ? { collections: p.collections.map((c) => ({ handle: c.handle, title: c.title })) } : {}),
|
|
74
74
|
...lowStock(p.lowStockThreshold),
|
|
75
|
+
...productAutomaticDiscounts(p.automaticDiscounts),
|
|
76
|
+
...productMedia(p.media),
|
|
75
77
|
};
|
|
76
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
|
+
}
|
|
77
141
|
/** `Product.lowStockThreshold` (storefront-query rev 2.26): the product's own low-stock threshold, when the merchant set one (D-8). */
|
|
78
142
|
function lowStock(v) {
|
|
79
143
|
return typeof v === 'number' && Number.isInteger(v) && v >= 0 && v <= 9999 ? { lowStockThreshold: v } : {};
|
|
@@ -83,8 +147,24 @@ function lowStock(v) {
|
|
|
83
147
|
* `RawFilter`): `input` is the JSON of the filter object the listing hands back to
|
|
84
148
|
* `collectionProducts({ filters })`, which `abiFilters` turns into the ABI `{key, value}` entries.
|
|
85
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.
|
|
86
152
|
*/
|
|
87
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
|
+
}
|
|
88
168
|
export function filters(list) {
|
|
89
169
|
const out = [];
|
|
90
170
|
for (const f of list ?? []) {
|
|
@@ -101,7 +181,7 @@ export function filters(list) {
|
|
|
101
181
|
const values = [];
|
|
102
182
|
for (const v of f.values) {
|
|
103
183
|
const { key, value } = v.input;
|
|
104
|
-
const input = key
|
|
184
|
+
const input = filterInput(key, value);
|
|
105
185
|
if (input)
|
|
106
186
|
values.push({ id: v.id, label: v.label, count: v.count, input: JSON.stringify(input) });
|
|
107
187
|
}
|
|
@@ -116,7 +196,7 @@ function amount(n) {
|
|
|
116
196
|
return null;
|
|
117
197
|
return Number.isInteger(n) ? String(n) : n.toFixed(4).replace(/\.?0+$/, '');
|
|
118
198
|
}
|
|
119
|
-
/** The listing's filter objects (`{productVendor}`, `{available}`, `{price: {min, max}}`, …) → ABI `filters`. Unknown shapes are dropped. */
|
|
199
|
+
/** The listing's filter objects (`{productVendor}`, `{available}`, `{price: {min, max}}`, `{variantOption: {name, value}}`, …) → ABI `filters`. Unknown shapes are dropped. */
|
|
120
200
|
export function abiFilters(list) {
|
|
121
201
|
const out = [];
|
|
122
202
|
for (const f of list ?? []) {
|
|
@@ -128,6 +208,11 @@ export function abiFilters(list) {
|
|
|
128
208
|
out.push({ key: 'productType', value: f.productType });
|
|
129
209
|
else if (typeof f.tag === 'string')
|
|
130
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
|
+
}
|
|
131
216
|
else if (f.price && typeof f.price === 'object') {
|
|
132
217
|
const { min, max } = f.price;
|
|
133
218
|
const lo = amount(min);
|
|
@@ -233,6 +318,9 @@ export function shop(s, policies = [], country = '') {
|
|
|
233
318
|
const banner = cookieBanner(extra.cookieBanner);
|
|
234
319
|
const links = policyLinks(extra.policyLinks);
|
|
235
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);
|
|
236
324
|
return {
|
|
237
325
|
name: s.name,
|
|
238
326
|
description: s.description ?? null,
|
|
@@ -243,6 +331,9 @@ export function shop(s, policies = [], country = '') {
|
|
|
243
331
|
...(banner ? { consentBanner: banner } : {}),
|
|
244
332
|
...(extra.accounts && typeof extra.accounts === 'object' && extra.accounts.signInLinks === false ? { signInLinks: false } : {}),
|
|
245
333
|
...(links ? { policyLinks: links } : {}),
|
|
334
|
+
...(moneyFormat ? { moneyFormat } : {}),
|
|
335
|
+
...(address ? { address } : {}),
|
|
336
|
+
...(locations.length ? { locations } : {}),
|
|
246
337
|
brand: s.brand
|
|
247
338
|
? {
|
|
248
339
|
logo: image(s.brand.logo),
|
|
@@ -256,6 +347,65 @@ export function shop(s, policies = [], country = '') {
|
|
|
256
347
|
paymentSettings: { acceptedCardBrands: [...(s.paymentSettings.acceptedCardBrands ?? [])], supportedDigitalWallets: [], currencyCode: s.paymentSettings.currencyCode },
|
|
257
348
|
};
|
|
258
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
|
+
}
|
|
259
409
|
const text = (v, max = 2000) => (typeof v === 'string' && v.trim() ? v.trim().slice(0, max) : undefined);
|
|
260
410
|
/** D-7 `Shop.contact` → the shop's public email / phone, each only when set. */
|
|
261
411
|
export function shopContact(raw) {
|
|
@@ -489,5 +639,32 @@ export function cartState(c) {
|
|
|
489
639
|
checkoutUrl: c.checkoutUrl,
|
|
490
640
|
discountCodes: c.discountCodes.map((d) => ({ code: d.code, applicable: d.applicable })),
|
|
491
641
|
discountAmount: cartDiscount(c),
|
|
642
|
+
...cartDiscountAllocations(c),
|
|
492
643
|
};
|
|
493
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
|
+
}
|
package/dist/abi/data-api.d.ts
CHANGED
|
@@ -8,4 +8,8 @@ export declare function searchOrder(sort: string | null | undefined): {
|
|
|
8
8
|
} | null;
|
|
9
9
|
/** The resource-cache key of a search (platform/runtime/data/StoreProvider.tsx keys its loads the same way). */
|
|
10
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;
|
|
11
14
|
export declare function createDataApi(pd: PageData, remote: AbiRemote | null): DataApi;
|
|
15
|
+
export {};
|
package/dist/abi/data-api.js
CHANGED
|
@@ -36,6 +36,22 @@ export function searchOrder(sort) {
|
|
|
36
36
|
}
|
|
37
37
|
/** The resource-cache key of a search (platform/runtime/data/StoreProvider.tsx keys its loads the same way). */
|
|
38
38
|
export const searchKey = (query, sort) => (searchOrder(sort) ? `search:${query}|${sort}` : `search:${query}`);
|
|
39
|
+
/** rev 2.34 `Shop.locations` (converted by `convert.shop`) → `DataApi.locations`; a store without them answers `[]`. */
|
|
40
|
+
export function storeLocations(shop) {
|
|
41
|
+
return (shop?.locations ?? []).map((l) => ({
|
|
42
|
+
id: l.id,
|
|
43
|
+
name: l.name,
|
|
44
|
+
code: null,
|
|
45
|
+
address: {
|
|
46
|
+
country: l.address.country ?? l.address.countryCode ?? null,
|
|
47
|
+
address: [l.address.address1, l.address.address2].filter(Boolean).join(', ') || null,
|
|
48
|
+
city: l.address.city ?? null,
|
|
49
|
+
province: l.address.province ?? null,
|
|
50
|
+
postalCode: l.address.zip ?? null,
|
|
51
|
+
phone: l.phone ?? null,
|
|
52
|
+
},
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
39
55
|
export function createDataApi(pd, remote) {
|
|
40
56
|
const productBy = (h) => pd.products[h] ?? pd.products[decode(h)] ?? null;
|
|
41
57
|
const collectionBy = (h) => pd.collections[h] ?? pd.collections[decode(h)] ?? null;
|
|
@@ -56,6 +72,9 @@ export function createDataApi(pd, remote) {
|
|
|
56
72
|
preloaded[`article:${k}`] = a;
|
|
57
73
|
if (pd.search)
|
|
58
74
|
preloaded[searchKey(pd.search.query, pd.search.sort)] = pd.search.result;
|
|
75
|
+
// rev 2.34: the shop's pickup locations, in DataApi.locations' shape; the store-locator reads them on first render
|
|
76
|
+
const locations = storeLocations(pd.shop);
|
|
77
|
+
preloaded.locations = locations;
|
|
59
78
|
for (const [h, list] of Object.entries(pd.recommendations)) {
|
|
60
79
|
const id = pd.products[h]?.id;
|
|
61
80
|
if (id)
|
|
@@ -70,6 +89,7 @@ export function createDataApi(pd, remote) {
|
|
|
70
89
|
localization: pd.localization,
|
|
71
90
|
shop: pd.shop,
|
|
72
91
|
menu: menuBy,
|
|
92
|
+
locations: async () => locations,
|
|
73
93
|
...(pd.policyHandle ? { policyHandle: pd.policyHandle } : {}),
|
|
74
94
|
getSnapshot: () => pd,
|
|
75
95
|
blogSync: (h) => pd.blogs[h] ?? pd.blogs[decode(h)] ?? null,
|
package/dist/abi/page-data.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* call limit. A ref the budget cannot cover renders as "not found", the section's own
|
|
16
16
|
* empty state; it is logged, never retried.
|
|
17
17
|
*/
|
|
18
|
-
import type { RenderContext, Cart as AbiCart } from '@tanqory/theme-abi';
|
|
18
|
+
import type { RenderContext, Cart as AbiCart, Policy as AbiPolicy } from '@tanqory/theme-abi';
|
|
19
19
|
import type { ContentNode, SectionDef } from '../runtime/kit/types.js';
|
|
20
20
|
import type { Collection, Localization, Page, Product } from '../runtime/kit/data.js';
|
|
21
21
|
import type { Article, Blog, Menu, SearchResults, Shop } from '../runtime/kit/storefront.js';
|
|
@@ -195,4 +195,15 @@ listingQuery?: string,
|
|
|
195
195
|
* section conventions (`pageNeeds`), exactly as before.
|
|
196
196
|
*/
|
|
197
197
|
plan?: PagePlanOptions): Promise<PageData>;
|
|
198
|
+
/** An unknown (or not yet published) resource on a resource route is a real 404. Exported for tests. */
|
|
199
|
+
export declare function routeMissingOf(route: RenderContext['route'], found: {
|
|
200
|
+
products: Record<string, unknown>;
|
|
201
|
+
collections: Record<string, unknown>;
|
|
202
|
+
pages: Record<string, unknown>;
|
|
203
|
+
blogs: Record<string, unknown>;
|
|
204
|
+
articles: Record<string, {
|
|
205
|
+
handle?: string;
|
|
206
|
+
}>;
|
|
207
|
+
policies: readonly AbiPolicy[];
|
|
208
|
+
}): boolean;
|
|
198
209
|
export {};
|
package/dist/abi/page-data.js
CHANGED
|
@@ -558,10 +558,11 @@ plan) {
|
|
|
558
558
|
// A personalising input (§2): read only when the account menu renders; the caller varies on it.
|
|
559
559
|
signedIn: showsAccount ? ctx.request.isSignedIn : null,
|
|
560
560
|
unresolved,
|
|
561
|
-
routeMissing: routeMissingOf(ctx.route, { products, collections, pages, blogs, policies }),
|
|
561
|
+
routeMissing: routeMissingOf(ctx.route, { products, collections, pages, blogs, articles, policies }),
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
|
-
|
|
564
|
+
/** An unknown (or not yet published) resource on a resource route is a real 404. Exported for tests. */
|
|
565
|
+
export function routeMissingOf(route, found) {
|
|
565
566
|
const h = route.handle;
|
|
566
567
|
if (!h)
|
|
567
568
|
return false;
|
|
@@ -570,6 +571,11 @@ function routeMissingOf(route, found) {
|
|
|
570
571
|
case 'collection': return !found.collections[h];
|
|
571
572
|
case 'page': return !found.pages[h];
|
|
572
573
|
case 'blog': return !found.blogs[h];
|
|
574
|
+
// Articles are keyed `<blog>/<article>`; without the blog handle any article with this handle counts.
|
|
575
|
+
case 'article': {
|
|
576
|
+
const blog = route.blogHandle;
|
|
577
|
+
return blog ? !found.articles[`${blog}/${h}`] : !Object.values(found.articles).some((a) => a?.handle === h);
|
|
578
|
+
}
|
|
573
579
|
// The snapshot answers a policy route with the store's PUBLISHED policy for the handle, else null.
|
|
574
580
|
case 'policy': return found.policies.length === 0;
|
|
575
581
|
default: return false;
|
|
@@ -122,6 +122,24 @@ export declare function toSocial(links: S.Shop['socialLinks']): Pick<UI.Shop, 's
|
|
|
122
122
|
* `logo` setting, else Settings → Brand (the same precedence as
|
|
123
123
|
* app/platform/safe-values `resolveLogo`, which this reuses).
|
|
124
124
|
*/
|
|
125
|
+
/**
|
|
126
|
+
* The product's gallery with its hosted videos (Theme ABI `Product.media`, storefront-query rev 2.34). Only `image` and
|
|
127
|
+
* `video` items with a playable source map; YouTube / Vimeo / 3D never do (the storefront plays no third-party
|
|
128
|
+
* player). No video left ⇒ absent, and the gallery stays `images`.
|
|
129
|
+
*/
|
|
130
|
+
export declare function toProductMedia(list: R.Product['media'] | null | undefined): {
|
|
131
|
+
media?: UI.ProductMediaItem[];
|
|
132
|
+
};
|
|
133
|
+
/** A merchant-published postal address → display lines: street (address1, address2), "city province zip", country. */
|
|
134
|
+
export declare function addressLines(a: {
|
|
135
|
+
address1?: string;
|
|
136
|
+
address2?: string;
|
|
137
|
+
city?: string;
|
|
138
|
+
province?: string;
|
|
139
|
+
zip?: string;
|
|
140
|
+
country?: string;
|
|
141
|
+
countryCode?: string;
|
|
142
|
+
} | null | undefined): string[];
|
|
125
143
|
export declare function toShop(shop: S.Shop | null | undefined, settings?: {
|
|
126
144
|
shopName?: string;
|
|
127
145
|
logo?: string;
|
|
@@ -145,7 +163,10 @@ export declare function toCartSummary(cart: Pick<C.CartState, 'lines' | 'totalQu
|
|
|
145
163
|
* refuses unpurchasable merchandise at add/update time.
|
|
146
164
|
*/
|
|
147
165
|
export declare function toCartLine(line: C.CartLine): UI.CartLine;
|
|
148
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* The full cart (cart page). `discounts` is left out: the runtime keeps no per-code amount. The order-level
|
|
168
|
+
* discount is `discountTotal` (from the cart's own totals) and, when the host names them, `discountAllocations`.
|
|
169
|
+
*/
|
|
149
170
|
export declare function toCart(cart: C.CartState | null | undefined): UI.Cart;
|
|
150
171
|
/** A page → the UI's page-body shape (StoreContext.currentPage / pages). */
|
|
151
172
|
export declare function toPage(page: R.Page | null | undefined): {
|
|
@@ -142,6 +142,8 @@ export function toProduct(p) {
|
|
|
142
142
|
available,
|
|
143
143
|
...(p?.tags?.length ? { tags: [...p.tags] } : {}),
|
|
144
144
|
...(typeof p?.lowStockThreshold === 'number' ? { lowStockThreshold: p.lowStockThreshold } : {}),
|
|
145
|
+
...(p?.automaticDiscounts?.length ? { automaticDiscounts: p.automaticDiscounts.map((d) => ({ ...d })) } : {}),
|
|
146
|
+
...toProductMedia(p?.media),
|
|
145
147
|
// No source: the runtime has no merchant badge field and no reviews source.
|
|
146
148
|
badge: null,
|
|
147
149
|
rating: null,
|
|
@@ -368,6 +370,41 @@ export function toSocial(links) {
|
|
|
368
370
|
* `logo` setting, else Settings → Brand (the same precedence as
|
|
369
371
|
* app/platform/safe-values `resolveLogo`, which this reuses).
|
|
370
372
|
*/
|
|
373
|
+
/**
|
|
374
|
+
* The product's gallery with its hosted videos (Theme ABI `Product.media`, storefront-query rev 2.34). Only `image` and
|
|
375
|
+
* `video` items with a playable source map; YouTube / Vimeo / 3D never do (the storefront plays no third-party
|
|
376
|
+
* player). No video left ⇒ absent, and the gallery stays `images`.
|
|
377
|
+
*/
|
|
378
|
+
export function toProductMedia(list) {
|
|
379
|
+
const out = [];
|
|
380
|
+
for (const m of list ?? []) {
|
|
381
|
+
if (!m)
|
|
382
|
+
continue;
|
|
383
|
+
if (m.type === 'image') {
|
|
384
|
+
const image = toImage(m.image ?? null);
|
|
385
|
+
if (image)
|
|
386
|
+
out.push({ type: 'image', image: !image.alt && m.alt ? { ...image, alt: m.alt } : image });
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
if (m.type !== 'video')
|
|
390
|
+
continue;
|
|
391
|
+
const sources = (m.sources ?? []).filter((s) => s && typeof s.url === 'string' && s.url.startsWith('https://') && s.mimeType).map((s) => ({ src: s.url, type: s.mimeType }));
|
|
392
|
+
if (!sources.length)
|
|
393
|
+
continue;
|
|
394
|
+
const poster = toImage(m.previewImage ?? null);
|
|
395
|
+
const alt = str(m.alt ?? undefined);
|
|
396
|
+
out.push({ type: 'video', sources, ...(poster ? { poster } : {}), ...(alt ? { alt } : {}) });
|
|
397
|
+
}
|
|
398
|
+
return out.some((m) => m.type === 'video') ? { media: out } : {};
|
|
399
|
+
}
|
|
400
|
+
/** A merchant-published postal address → display lines: street (address1, address2), "city province zip", country. */
|
|
401
|
+
export function addressLines(a) {
|
|
402
|
+
if (!a)
|
|
403
|
+
return [];
|
|
404
|
+
const street = [a.address1, a.address2].filter((s) => Boolean(s && s.trim())).join(', ');
|
|
405
|
+
const cityLine = [a.city, a.province, a.zip].filter((s) => Boolean(s && s.trim())).join(' ');
|
|
406
|
+
return [street, cityLine, a.country ?? a.countryCode ?? ''].filter((s) => s.trim() !== '');
|
|
407
|
+
}
|
|
371
408
|
export function toShop(shop, settings = {}) {
|
|
372
409
|
const name = str(shop?.name)?.trim() ?? str(settings.shopName)?.trim() ?? '';
|
|
373
410
|
const resolved = resolveLogo({ logo: settings.logo ?? '' }, shop?.brand ?? null);
|
|
@@ -384,6 +421,7 @@ export function toShop(shop, settings = {}) {
|
|
|
384
421
|
const phone = str(shop?.phone ?? undefined);
|
|
385
422
|
const paymentMethods = toPaymentMethods(shop?.paymentSettings);
|
|
386
423
|
const freeShipping = toMoney(shop?.freeShippingThreshold ?? null);
|
|
424
|
+
const address = addressLines(shop?.address);
|
|
387
425
|
return {
|
|
388
426
|
name,
|
|
389
427
|
logo,
|
|
@@ -394,8 +432,13 @@ export function toShop(shop, settings = {}) {
|
|
|
394
432
|
...(shop?.signInLinks === false ? { signInLinks: false } : {}),
|
|
395
433
|
...(shop?.policyLinks ? { policyLinks: shop.policyLinks.map((p) => ({ handle: p.handle, title: p.title, url: p.url })) } : {}),
|
|
396
434
|
...(shop?.consentBanner ? { consentBanner: shop.consentBanner } : {}),
|
|
435
|
+
...(shop?.paymentSettings?.currencyCode ? { currencyCode: shop.paymentSettings.currencyCode } : {}),
|
|
436
|
+
...(shop?.moneyFormat && (shop.moneyFormat.withCurrency || shop.moneyFormat.withoutCurrency)
|
|
437
|
+
? { moneyFormat: { ...(shop.moneyFormat.withCurrency ? { withCurrency: shop.moneyFormat.withCurrency } : {}), ...(shop.moneyFormat.withoutCurrency ? { withoutCurrency: shop.moneyFormat.withoutCurrency } : {}) } }
|
|
438
|
+
: {}),
|
|
397
439
|
...toSocial(shop?.socialLinks),
|
|
398
440
|
...(shop?.paymentSettings ? { paymentMethods } : {}),
|
|
441
|
+
...(address.length ? { address } : {}),
|
|
399
442
|
};
|
|
400
443
|
}
|
|
401
444
|
// ── Localization ────────────────────────────────────────────────────────────
|
|
@@ -515,12 +558,26 @@ export function toCartLine(line) {
|
|
|
515
558
|
},
|
|
516
559
|
};
|
|
517
560
|
}
|
|
518
|
-
/**
|
|
561
|
+
/**
|
|
562
|
+
* The full cart (cart page). `discounts` is left out: the runtime keeps no per-code amount. The order-level
|
|
563
|
+
* discount is `discountTotal` (from the cart's own totals) and, when the host names them, `discountAllocations`.
|
|
564
|
+
*/
|
|
519
565
|
export function toCart(cart) {
|
|
520
566
|
const lines = (cart?.lines ?? []).filter(Boolean).map(toCartLine);
|
|
521
567
|
const subtotal = toMoney(cart?.subtotal);
|
|
522
568
|
const currency = subtotal?.currencyCode ?? lines[0]?.cost.total.currencyCode ?? '';
|
|
523
569
|
const note = str(cart?.note ?? undefined);
|
|
570
|
+
const off = toMoney(cart?.discountAmount ?? null);
|
|
571
|
+
const discountTotal = off && off.amount > 0 && off.currencyCode === currency ? off : null;
|
|
572
|
+
const codes = (cart?.discountCodes ?? []).filter((d) => d && typeof d.code === 'string' && d.code !== '').map((d) => ({ code: d.code, applicable: d.applicable === true }));
|
|
573
|
+
const allocations = (cart?.discountAllocations ?? [])
|
|
574
|
+
.map((a) => {
|
|
575
|
+
const amount = toMoney(a?.amount);
|
|
576
|
+
const title = str(a?.title ?? undefined);
|
|
577
|
+
const code = str(a?.code ?? undefined);
|
|
578
|
+
return amount && amount.amount > 0 && amount.currencyCode === currency && (title || code) ? { ...(title ? { title } : {}), ...(code ? { code } : {}), amount } : null;
|
|
579
|
+
})
|
|
580
|
+
.filter((a) => a !== null);
|
|
524
581
|
return {
|
|
525
582
|
id: cart?.id ?? '',
|
|
526
583
|
lines,
|
|
@@ -528,6 +585,9 @@ export function toCart(cart) {
|
|
|
528
585
|
itemCount: toCartSummary(cart).itemCount,
|
|
529
586
|
subtotal: requiredMoney(subtotal, currency),
|
|
530
587
|
total: requiredMoney(toMoney(cart?.total) ?? subtotal, currency),
|
|
588
|
+
...(codes.length ? { discountCodes: codes } : {}),
|
|
589
|
+
...(discountTotal ? { discountTotal } : {}),
|
|
590
|
+
...(allocations.length ? { discountAllocations: allocations } : {}),
|
|
531
591
|
};
|
|
532
592
|
}
|
|
533
593
|
// ── Content ─────────────────────────────────────────────────────────────────
|
|
@@ -587,8 +647,9 @@ export function toPolicy(p) {
|
|
|
587
647
|
/** Every published policy by handle, for StoreContext.policies. */
|
|
588
648
|
export function toPolicies(shop) {
|
|
589
649
|
const out = {};
|
|
590
|
-
|
|
591
|
-
|
|
650
|
+
// Every policy the payload carries, not only the five named slots: `convert.shop` keeps a handle outside them
|
|
651
|
+
// (e.g. storefront-query rev 2.33 `data-sharing-opt-out`) under its own handle, and PolicyPage looks it up here.
|
|
652
|
+
for (const p of Object.values(shop?.policies ?? {})) {
|
|
592
653
|
const mapped = toPolicy(p);
|
|
593
654
|
if (mapped)
|
|
594
655
|
out[mapped.handle] = mapped;
|
|
@@ -90,6 +90,15 @@ export interface CartState {
|
|
|
90
90
|
discountCodes: AppliedDiscountCode[];
|
|
91
91
|
/** Total savings across all discount allocations — null when nothing's discounted. */
|
|
92
92
|
discountAmount: Money | null;
|
|
93
|
+
/**
|
|
94
|
+
* The cart's order-level discounts by name (automatic: `title`; code: `code`), when the source sends them.
|
|
95
|
+
* Absent = not known (the Theme ABI cart carries only totals and codes).
|
|
96
|
+
*/
|
|
97
|
+
discountAllocations?: Array<{
|
|
98
|
+
title?: string | null;
|
|
99
|
+
code?: string | null;
|
|
100
|
+
amount: Money;
|
|
101
|
+
}>;
|
|
93
102
|
/** Gift cards applied to the cart. */
|
|
94
103
|
appliedGiftCards: AppliedGiftCard[];
|
|
95
104
|
/** True while a mutation/bootstrap is in flight. */
|
|
@@ -158,7 +167,17 @@ export interface CartApi extends CartState {
|
|
|
158
167
|
* state: read it right after `add` / `updateQuantity` resolves, before the next render.
|
|
159
168
|
*/
|
|
160
169
|
lastRefusal?: () => CartRefusal | null;
|
|
170
|
+
/**
|
|
171
|
+
* Put one discount code on the cart (it replaces the code there: the store holds one) and say how it went; never
|
|
172
|
+
* rejects. `not_applicable`: the store keeps the code but does not apply it — it is taken off again and the code the
|
|
173
|
+
* cart held before is put back. Absent where the source cannot tell (the GraphQL driver).
|
|
174
|
+
*/
|
|
175
|
+
applyDiscountCode?: (code: string) => Promise<DiscountCodeResult>;
|
|
176
|
+
/** Take a discount code off the cart; resolves true once it is gone. Present with `applyDiscountCode`. */
|
|
177
|
+
removeDiscountCode?: (code: string) => Promise<boolean>;
|
|
161
178
|
}
|
|
179
|
+
/** How applying a discount code went. */
|
|
180
|
+
export type DiscountCodeResult = 'applied' | 'not_applicable' | 'failed';
|
|
162
181
|
/** Exported so another cart driver (lib/abi/cart.tsx, Theme ABI v2) can provide the same `useCart()`. */
|
|
163
182
|
export declare const CartContext: import("react").Context<CartApi | null>;
|
|
164
183
|
export declare function CartProvider({ children }: {
|
package/dist/runtime/kit/cart.js
CHANGED
|
@@ -225,6 +225,7 @@ function normalizeCart(c) {
|
|
|
225
225
|
checkoutUrl: c.checkoutUrl ?? null,
|
|
226
226
|
discountCodes: (c.discountCodes ?? []).map((d) => ({ code: d.code, applicable: d.applicable })),
|
|
227
227
|
discountAmount,
|
|
228
|
+
...(allocations.length ? { discountAllocations: allocations.map((a) => ({ title: a.title ?? null, code: a.code ?? null, amount: a.discountedAmount })) } : {}),
|
|
228
229
|
appliedGiftCards: (c.appliedGiftCards ?? []).map((g) => ({
|
|
229
230
|
id: g.id,
|
|
230
231
|
lastCharacters: g.lastCharacters,
|
|
@@ -176,6 +176,12 @@ export interface Product {
|
|
|
176
176
|
availableForSale?: boolean;
|
|
177
177
|
/** The product's own low-stock threshold (Theme ABI `Product.lowStockThreshold`), when the merchant set one. */
|
|
178
178
|
lowStockThreshold?: number;
|
|
179
|
+
/**
|
|
180
|
+
* The store's automatic discounts that apply to this product without conditions (storefront-query rev 2.31
|
|
181
|
+
* `Product.automaticDiscounts`), active or scheduled: show one only while now ∈ [startsAt, endsAt). `value` is a
|
|
182
|
+
* percentage (0–100] or, for `fixed`, the amount off each item in the store's base currency. QA D8.
|
|
183
|
+
*/
|
|
184
|
+
automaticDiscounts?: import('../../sdk/types.js').ProductAutomaticDiscount[];
|
|
179
185
|
/** Catalog facets (card badges / filtering). Present from boot. */
|
|
180
186
|
vendor?: string | null;
|
|
181
187
|
productType?: string | null;
|
|
@@ -218,7 +224,11 @@ export interface Product {
|
|
|
218
224
|
/** SEO override — only after `fetchProduct()`. */
|
|
219
225
|
seo?: Seo | null;
|
|
220
226
|
}
|
|
221
|
-
/**
|
|
227
|
+
/**
|
|
228
|
+
* A product media node — image, video, 3D model, or external (YouTube/Vimeo) video. On the Theme ABI path
|
|
229
|
+
* (storefront-query rev 2.34 `Product.media`) only `image` and hosted `video` (mp4 / webm / quicktime files in the
|
|
230
|
+
* store's own media library) ever appear, and `media` is present only when the product has at least one video.
|
|
231
|
+
*/
|
|
222
232
|
export interface ProductMedia {
|
|
223
233
|
id: string;
|
|
224
234
|
type: 'image' | 'video' | 'model_3d' | 'external_video';
|
|
@@ -216,6 +216,8 @@ export interface Shop {
|
|
|
216
216
|
termsOfService?: ShopPolicy | null;
|
|
217
217
|
shipping?: ShopPolicy | null;
|
|
218
218
|
subscription?: ShopPolicy | null;
|
|
219
|
+
/** Any other published policy, under its own handle (e.g. `data-sharing-opt-out`). */
|
|
220
|
+
[handle: string]: ShopPolicy | null | undefined;
|
|
219
221
|
};
|
|
220
222
|
/** Settings › Taxes › prices include tax, for the shopper's market (Theme ABI `Shop.taxesIncluded`). */
|
|
221
223
|
taxesIncluded?: boolean;
|
|
@@ -230,6 +232,21 @@ export interface Shop {
|
|
|
230
232
|
policyLinks?: ShopPolicy[];
|
|
231
233
|
/** Settings › Customer privacy › Cookie banner, as the platform sends it (Theme ABI `Shop.cookieBanner`). */
|
|
232
234
|
consentBanner?: ConsentBannerConfig | null;
|
|
235
|
+
/** Settings › Markets › Currency formatting, when the merchant set it (storefront-query rev 2.31 `shop.moneyFormat`). */
|
|
236
|
+
moneyFormat?: {
|
|
237
|
+
withCurrency?: string;
|
|
238
|
+
withoutCurrency?: string;
|
|
239
|
+
} | null;
|
|
240
|
+
/**
|
|
241
|
+
* Settings › Brand › Business details › Location — the business address the merchant published (storefront-query
|
|
242
|
+
* rev 2.34 `shop.contact.address`). Never the billing address. Each member only when set.
|
|
243
|
+
*/
|
|
244
|
+
address?: ShopAddress;
|
|
245
|
+
/**
|
|
246
|
+
* Settings › Locations — the active locations that offer local pickup, default first (storefront-query rev 2.34
|
|
247
|
+
* `shop.locations`, at most 50). No opening hours exist per location.
|
|
248
|
+
*/
|
|
249
|
+
locations?: ShopLocation[];
|
|
233
250
|
/** Cookie-consent banner config (Settings → Customer privacy). */
|
|
234
251
|
cookieBanner?: {
|
|
235
252
|
/** EFFECTIVE requirement for THIS shopper (jurisdiction ∨ merchant toggle). */
|
|
@@ -278,6 +295,23 @@ export interface Shop {
|
|
|
278
295
|
currencyCode?: string | null;
|
|
279
296
|
} | null;
|
|
280
297
|
}
|
|
298
|
+
/** A postal address the merchant published (rev 2.34 `PostalAddress`). `countryCode` is ISO 3166-1 alpha-2. */
|
|
299
|
+
export interface ShopAddress {
|
|
300
|
+
address1?: string;
|
|
301
|
+
address2?: string;
|
|
302
|
+
city?: string;
|
|
303
|
+
province?: string;
|
|
304
|
+
zip?: string;
|
|
305
|
+
country?: string;
|
|
306
|
+
countryCode?: string;
|
|
307
|
+
}
|
|
308
|
+
/** One store location (rev 2.34 `ShopLocation`). */
|
|
309
|
+
export interface ShopLocation {
|
|
310
|
+
id: string;
|
|
311
|
+
name: string;
|
|
312
|
+
address: ShopAddress;
|
|
313
|
+
phone?: string;
|
|
314
|
+
}
|
|
281
315
|
export interface CustomerAddress {
|
|
282
316
|
id: string;
|
|
283
317
|
firstName?: string | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CartRefusal } from '../kit/cart.js';
|
|
2
|
+
import type { DiscountCodeResult } from '../../sdk/runtime-context.js';
|
|
2
3
|
/**
|
|
3
4
|
* The shopper-facing words for a refusal, in the page's language (locales/*.json): the merchant's
|
|
4
5
|
* limit when it is known, else that the most has been reached.
|
|
@@ -15,6 +16,9 @@ export interface CartActions {
|
|
|
15
16
|
/** Failed lines the store said why for (Cart-1). */
|
|
16
17
|
refusedLines: ReadonlyMap<string, CartRefusal>;
|
|
17
18
|
setNote: (note: string) => Promise<void>;
|
|
19
|
+
/** Absent when the cart source cannot tell whether a code applied (`CartApi.applyDiscountCode`). */
|
|
20
|
+
applyDiscountCode?: (code: string) => Promise<DiscountCodeResult>;
|
|
21
|
+
removeDiscountCode?: (code: string) => Promise<boolean>;
|
|
18
22
|
}
|
|
19
23
|
export declare function useCartActions(): CartActions;
|
|
20
24
|
/** Go to a storefront URL through the SPA router when it is on (a real click), else a full load. */
|
|
@@ -97,6 +97,7 @@ export function useCartActions() {
|
|
|
97
97
|
failedLines: failed,
|
|
98
98
|
refusedLines: refused,
|
|
99
99
|
setNote: (note) => cart.updateNote(note),
|
|
100
|
+
...(cart.applyDiscountCode && cart.removeDiscountCode ? { applyDiscountCode: cart.applyDiscountCode, removeDiscountCode: cart.removeDiscountCode } : {}),
|
|
100
101
|
}), [addToCart, withLine, cart, busy, failed, refused]);
|
|
101
102
|
}
|
|
102
103
|
/** Go to a storefront URL through the SPA router when it is on (a real click), else a full load. */
|
|
@@ -28,6 +28,9 @@ export function RuntimeBridge({ mode, locale, settings, children }) {
|
|
|
28
28
|
setQuantity: cartActions.setQuantity,
|
|
29
29
|
remove: cartActions.removeLine,
|
|
30
30
|
setNote: cartActions.setNote,
|
|
31
|
+
...(cartActions.applyDiscountCode && cartActions.removeDiscountCode
|
|
32
|
+
? { applyDiscountCode: cartActions.applyDiscountCode, removeDiscountCode: cartActions.removeDiscountCode }
|
|
33
|
+
: {}),
|
|
31
34
|
open: () => (settings.enableCartDrawer === false ? navigate('/cart') : overlays.show('cart')),
|
|
32
35
|
},
|
|
33
36
|
search: {
|
|
@@ -42,6 +42,11 @@ export interface ThemeContextValue {
|
|
|
42
42
|
/** The shop as sections see it (name, cookie banner, taxes, free-shipping threshold); absent outside a store. */
|
|
43
43
|
shop?: Shop;
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* How applying a discount code went (`ThemeActions.cart.applyDiscountCode`). Kept equal to the runtime's
|
|
47
|
+
* `DiscountCodeResult` (runtime/kit/cart.tsx).
|
|
48
|
+
*/
|
|
49
|
+
export type DiscountCodeResult = 'applied' | 'not_applicable' | 'failed';
|
|
45
50
|
export interface ConsentDecision {
|
|
46
51
|
analytics: boolean;
|
|
47
52
|
marketing: boolean;
|
|
@@ -54,6 +59,16 @@ export interface ThemeActions {
|
|
|
54
59
|
remove(lineId: string): Promise<void>;
|
|
55
60
|
setNote(note: string): Promise<void>;
|
|
56
61
|
open(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Put a discount code on the cart; resolves how it went, never rejects. The store holds one code, so it replaces
|
|
64
|
+
* the code there. `applied`: the store applies it (the cart's totals already show it); `not_applicable`: the store
|
|
65
|
+
* does not apply it to this cart (unknown, expired, a minimum not met, does not combine) — it was taken off again
|
|
66
|
+
* and the earlier code put back; `failed`: the request did not go through.
|
|
67
|
+
* Optional: absent on hosts without cart discount codes — a theme must check before offering a code field.
|
|
68
|
+
*/
|
|
69
|
+
applyDiscountCode?(code: string): Promise<DiscountCodeResult>;
|
|
70
|
+
/** Take a discount code off the cart. Resolves true once it is gone; never rejects. Present with `applyDiscountCode`. */
|
|
71
|
+
removeDiscountCode?(code: string): Promise<boolean>;
|
|
57
72
|
};
|
|
58
73
|
search: {
|
|
59
74
|
open(): void;
|
package/dist/sdk/types.d.ts
CHANGED
|
@@ -78,6 +78,22 @@ export interface Shop {
|
|
|
78
78
|
}[];
|
|
79
79
|
/** Settings › Customer privacy › Cookie banner. Absent = the theme's own banner. */
|
|
80
80
|
consentBanner?: ConsentBannerConfig;
|
|
81
|
+
/** The store's base currency (Settings › General › Store currency), when the platform sent it. */
|
|
82
|
+
currencyCode?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Settings › Markets › Currency formatting, when the merchant set it: patterns holding one `{{amount…}}` token
|
|
85
|
+
* (`฿{{amount}}`, `{{amount_no_decimals}} บาท`). They apply ONLY to amounts in `currencyCode`; any other currency
|
|
86
|
+
* keeps the locale's formatting. The text may hold HTML the merchant typed — render it as text, tags stripped.
|
|
87
|
+
*/
|
|
88
|
+
moneyFormat?: {
|
|
89
|
+
withCurrency?: string;
|
|
90
|
+
withoutCurrency?: string;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Settings › Brand › Business details › Location — the business address the merchant published, as display lines
|
|
94
|
+
* (street, city line, country), when set. Never the billing address.
|
|
95
|
+
*/
|
|
96
|
+
address?: string[];
|
|
81
97
|
}
|
|
82
98
|
/** The merchant's cookie banner (Settings › Customer privacy). Text members are present only when typed. */
|
|
83
99
|
export interface ConsentBannerConfig {
|
|
@@ -166,6 +182,18 @@ export interface Product {
|
|
|
166
182
|
tags?: string[];
|
|
167
183
|
/** The product's own low-stock threshold (Products › inventory), which overrides the theme's. */
|
|
168
184
|
lowStockThreshold?: number;
|
|
185
|
+
/**
|
|
186
|
+
* The store's automatic discounts that apply to this product without conditions (storefront-query rev 2.31
|
|
187
|
+
* `Product.automaticDiscounts`), active or scheduled: show one only while now ∈ [startsAt, endsAt). `value` is a
|
|
188
|
+
* percentage (0–100] or, for `fixed`, the amount off each item in the store's base currency. QA D8.
|
|
189
|
+
*/
|
|
190
|
+
automaticDiscounts?: ProductAutomaticDiscount[];
|
|
191
|
+
/**
|
|
192
|
+
* The gallery in the merchant's order when it holds a hosted video (images and videos interleaved). Absent ⇒ the
|
|
193
|
+
* gallery is `images`. Only videos uploaded to the store's own media library appear (mp4 / webm / mov); never
|
|
194
|
+
* YouTube, Vimeo or 3D.
|
|
195
|
+
*/
|
|
196
|
+
media?: ProductMediaItem[];
|
|
169
197
|
/** Merchant-set badge text; the card shows at most one badge. */
|
|
170
198
|
badge?: string | null;
|
|
171
199
|
rating?: {
|
|
@@ -218,6 +246,31 @@ export interface CartLine {
|
|
|
218
246
|
compareAtTotal?: Money | null;
|
|
219
247
|
};
|
|
220
248
|
}
|
|
249
|
+
/** One gallery item of `Product.media`: an image, or a hosted video with its files and poster frame. */
|
|
250
|
+
export type ProductMediaItem = {
|
|
251
|
+
type: 'image';
|
|
252
|
+
image: Image;
|
|
253
|
+
} | {
|
|
254
|
+
type: 'video';
|
|
255
|
+
sources: {
|
|
256
|
+
src: string;
|
|
257
|
+
type: string;
|
|
258
|
+
}[];
|
|
259
|
+
poster?: Image;
|
|
260
|
+
alt?: string;
|
|
261
|
+
};
|
|
262
|
+
/** An automatic discount on a product (see `Product.automaticDiscounts`). */
|
|
263
|
+
export interface ProductAutomaticDiscount {
|
|
264
|
+
id: string;
|
|
265
|
+
title: string;
|
|
266
|
+
valueType: 'percentage' | 'fixed';
|
|
267
|
+
/** Percentage (0–100], or the fixed amount off each item in the store's base currency. */
|
|
268
|
+
value: number;
|
|
269
|
+
/** ISO 8601. */
|
|
270
|
+
startsAt: string;
|
|
271
|
+
/** ISO 8601; absent = no end. */
|
|
272
|
+
endsAt?: string;
|
|
273
|
+
}
|
|
221
274
|
export interface Cart {
|
|
222
275
|
id: string;
|
|
223
276
|
lines: CartLine[];
|
|
@@ -229,6 +282,28 @@ export interface Cart {
|
|
|
229
282
|
code: string;
|
|
230
283
|
amount: Money;
|
|
231
284
|
}[];
|
|
285
|
+
/**
|
|
286
|
+
* The discount codes the shopper entered, in the order applied. `applicable: false` = the store kept the code but
|
|
287
|
+
* it does not apply to this cart (yet: a minimum not met, or it does not combine). Absent on older hosts.
|
|
288
|
+
*/
|
|
289
|
+
discountCodes?: {
|
|
290
|
+
code: string;
|
|
291
|
+
applicable: boolean;
|
|
292
|
+
}[];
|
|
293
|
+
/**
|
|
294
|
+
* What the cart's discounts (automatic ones and codes) take off the order, from the cart's own totals
|
|
295
|
+
* (`subtotal + tax − total`). Absent when nothing is taken off or it cannot be told.
|
|
296
|
+
*/
|
|
297
|
+
discountTotal?: Money;
|
|
298
|
+
/**
|
|
299
|
+
* The cart's order-level discounts by name, when the platform sends them: `title` for an automatic discount,
|
|
300
|
+
* `code` for a code. Absent on hosts that do not send them — show `discountTotal` under a generic label then.
|
|
301
|
+
*/
|
|
302
|
+
discountAllocations?: {
|
|
303
|
+
title?: string;
|
|
304
|
+
code?: string;
|
|
305
|
+
amount: Money;
|
|
306
|
+
}[];
|
|
232
307
|
}
|
|
233
308
|
export interface Article {
|
|
234
309
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanqory/theme-kit",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.5",
|
|
4
4
|
"description": "Tanqory theme kit for Theme ABI v2: the headless storefront API (data hooks, accessible commerce primitives, SEO, i18n, live edit), the runtime behind it (data plan, cart, wire client) and the render/hydrate entry factories a theme builds on.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Tanqory",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"vite": "^5.4.10",
|
|
94
94
|
"vitest": "^3.2.4"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "aaa218c6582742086959e60fca8deaecf5f19059"
|
|
97
97
|
}
|