@usethrottle/storefront-react 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +67 -0
- package/README.md +119 -2
- package/dist/StorefrontProvider-Br4wUHui.d.cts +559 -0
- package/dist/StorefrontProvider-DLEPEjg6.d.ts +559 -0
- package/dist/account/index.cjs +69 -0
- package/dist/account/index.cjs.map +1 -0
- package/dist/account/index.d.cts +23 -0
- package/dist/account/index.d.ts +23 -0
- package/dist/account/index.js +68 -0
- package/dist/account/index.js.map +1 -0
- package/dist/chunk-2LCPIY2P.cjs +16 -0
- package/dist/chunk-2LCPIY2P.cjs.map +1 -0
- package/dist/chunk-3A72UY6T.js +2126 -0
- package/dist/chunk-3A72UY6T.js.map +1 -0
- package/dist/chunk-3JMIVAHN.js +185 -0
- package/dist/chunk-3JMIVAHN.js.map +1 -0
- package/dist/chunk-4J6AGWNC.cjs +24 -0
- package/dist/chunk-4J6AGWNC.cjs.map +1 -0
- package/dist/chunk-4U6MYDZV.js +17 -0
- package/dist/chunk-4U6MYDZV.js.map +1 -0
- package/dist/chunk-66HDJVPS.js +22 -0
- package/dist/chunk-66HDJVPS.js.map +1 -0
- package/dist/chunk-6X2OZSNV.cjs +83 -0
- package/dist/chunk-6X2OZSNV.cjs.map +1 -0
- package/dist/chunk-6ZMMZ245.cjs +2127 -0
- package/dist/chunk-6ZMMZ245.cjs.map +1 -0
- package/dist/chunk-7R37CVAB.cjs +23 -0
- package/dist/chunk-7R37CVAB.cjs.map +1 -0
- package/dist/chunk-A3IFWQUV.js +368 -0
- package/dist/chunk-A3IFWQUV.js.map +1 -0
- package/dist/chunk-AYC2YK4E.cjs +95 -0
- package/dist/chunk-AYC2YK4E.cjs.map +1 -0
- package/dist/chunk-AZV5U7YB.cjs +18 -0
- package/dist/chunk-AZV5U7YB.cjs.map +1 -0
- package/dist/chunk-CE2SKNQP.cjs +71 -0
- package/dist/chunk-CE2SKNQP.cjs.map +1 -0
- package/dist/chunk-D76CRI4X.js +2175 -0
- package/dist/chunk-D76CRI4X.js.map +1 -0
- package/dist/chunk-DOAII637.cjs +186 -0
- package/dist/chunk-DOAII637.cjs.map +1 -0
- package/dist/chunk-DYHHAOMG.cjs +17 -0
- package/dist/chunk-DYHHAOMG.cjs.map +1 -0
- package/dist/chunk-EYSVU5SJ.js +196 -0
- package/dist/chunk-EYSVU5SJ.js.map +1 -0
- package/dist/chunk-HSUUDZWS.js +37 -0
- package/dist/chunk-HSUUDZWS.js.map +1 -0
- package/dist/chunk-HZ6VEN6Q.cjs +101 -0
- package/dist/chunk-HZ6VEN6Q.cjs.map +1 -0
- package/dist/chunk-IJOTLGPT.js +16 -0
- package/dist/chunk-IJOTLGPT.js.map +1 -0
- package/dist/chunk-ISDATHVC.js +219 -0
- package/dist/chunk-ISDATHVC.js.map +1 -0
- package/dist/chunk-LW2A6USV.js +100 -0
- package/dist/chunk-LW2A6USV.js.map +1 -0
- package/dist/chunk-M4YXSLRG.cjs +369 -0
- package/dist/chunk-M4YXSLRG.cjs.map +1 -0
- package/dist/chunk-NDUEJJLP.cjs +2176 -0
- package/dist/chunk-NDUEJJLP.cjs.map +1 -0
- package/dist/chunk-NNE4FYRT.js +820 -0
- package/dist/chunk-NNE4FYRT.js.map +1 -0
- package/dist/chunk-NW3EFHY2.js +15 -0
- package/dist/chunk-NW3EFHY2.js.map +1 -0
- package/dist/chunk-NZRUQUN5.js +167 -0
- package/dist/chunk-NZRUQUN5.js.map +1 -0
- package/dist/chunk-P6HHE57S.cjs +38 -0
- package/dist/chunk-P6HHE57S.cjs.map +1 -0
- package/dist/chunk-PHY7AY27.cjs +197 -0
- package/dist/chunk-PHY7AY27.cjs.map +1 -0
- package/dist/chunk-PNJOFFTL.cjs +128 -0
- package/dist/chunk-PNJOFFTL.cjs.map +1 -0
- package/dist/chunk-PXZQ4ONA.js +127 -0
- package/dist/chunk-PXZQ4ONA.js.map +1 -0
- package/dist/chunk-Q3VTUBPP.js +82 -0
- package/dist/chunk-Q3VTUBPP.js.map +1 -0
- package/dist/chunk-Q3XFD5UI.js +45 -0
- package/dist/chunk-Q3XFD5UI.js.map +1 -0
- package/dist/chunk-QM7KTT7F.js +94 -0
- package/dist/chunk-QM7KTT7F.js.map +1 -0
- package/dist/chunk-RLWZOLXL.js +70 -0
- package/dist/chunk-RLWZOLXL.js.map +1 -0
- package/dist/chunk-SV53BRP2.js +23 -0
- package/dist/chunk-SV53BRP2.js.map +1 -0
- package/dist/chunk-VWXJO427.cjs +821 -0
- package/dist/chunk-VWXJO427.cjs.map +1 -0
- package/dist/chunk-WIIOJDHR.cjs +220 -0
- package/dist/chunk-WIIOJDHR.cjs.map +1 -0
- package/dist/chunk-XQHGFWLG.cjs +46 -0
- package/dist/chunk-XQHGFWLG.cjs.map +1 -0
- package/dist/chunk-ZHCXI2ZZ.cjs +168 -0
- package/dist/chunk-ZHCXI2ZZ.cjs.map +1 -0
- package/dist/index-RSj2Rg62.d.cts +8 -0
- package/dist/index-RSj2Rg62.d.ts +8 -0
- package/dist/index.cjs +2829 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1718 -0
- package/dist/index.d.ts +1718 -0
- package/dist/index.js +2828 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata-QhKw-tvz.d.cts +188 -0
- package/dist/metadata-QhKw-tvz.d.ts +188 -0
- package/dist/next/client.cjs +84 -0
- package/dist/next/client.cjs.map +1 -0
- package/dist/next/client.d.cts +40 -0
- package/dist/next/client.d.ts +40 -0
- package/dist/next/client.js +83 -0
- package/dist/next/client.js.map +1 -0
- package/dist/next/index.cjs +1090 -0
- package/dist/next/index.cjs.map +1 -0
- package/dist/next/index.d.cts +218 -0
- package/dist/next/index.d.ts +218 -0
- package/dist/next/index.js +1049 -0
- package/dist/next/index.js.map +1 -0
- package/dist/server/index.cjs +994 -0
- package/dist/server/index.cjs.map +1 -0
- package/dist/server/index.d.cts +229 -0
- package/dist/server/index.d.ts +229 -0
- package/dist/server/index.js +951 -0
- package/dist/server/index.js.map +1 -0
- package/dist/styles.css +2111 -0
- package/dist/use-part-DCfFk7kf.d.ts +24 -0
- package/dist/use-part-DgjPBL_O.d.cts +24 -0
- package/package.json +121 -3
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2829 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunk6ZMMZ245cjs = require('./chunk-6ZMMZ245.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunk4J6AGWNCcjs = require('./chunk-4J6AGWNC.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkPHY7AY27cjs = require('./chunk-PHY7AY27.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunkAYC2YK4Ecjs = require('./chunk-AYC2YK4E.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var _chunk2LCPIY2Pcjs = require('./chunk-2LCPIY2P.cjs');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
var _chunkNDUEJJLPcjs = require('./chunk-NDUEJJLP.cjs');
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
var _chunkM4YXSLRGcjs = require('./chunk-M4YXSLRG.cjs');
|
|
82
|
+
require('./chunk-7R37CVAB.cjs');
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
var _chunkPNJOFFTLcjs = require('./chunk-PNJOFFTL.cjs');
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
var _chunkDOAII637cjs = require('./chunk-DOAII637.cjs');
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
var _chunkHZ6VEN6Qcjs = require('./chunk-HZ6VEN6Q.cjs');
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
var _chunkDYHHAOMGcjs = require('./chunk-DYHHAOMG.cjs');
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
var _chunkP6HHE57Scjs = require('./chunk-P6HHE57S.cjs');
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
var _chunkXQHGFWLGcjs = require('./chunk-XQHGFWLG.cjs');
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
var _chunkVWXJO427cjs = require('./chunk-VWXJO427.cjs');
|
|
123
|
+
|
|
124
|
+
// src/analytics/ga.ts
|
|
125
|
+
var noopAnalytics = { track() {
|
|
126
|
+
} };
|
|
127
|
+
function gaAnalytics(o = {}) {
|
|
128
|
+
return {
|
|
129
|
+
track(event, payload) {
|
|
130
|
+
if (typeof window === "undefined") return;
|
|
131
|
+
const w = window;
|
|
132
|
+
if (o.target === "gtag") _optionalChain([w, 'access', _2 => _2.gtag, 'optionalCall', _3 => _3("event", event, payload)]);
|
|
133
|
+
else {
|
|
134
|
+
const layer = w.dataLayer ??= [];
|
|
135
|
+
layer.push({ ecommerce: null });
|
|
136
|
+
layer.push({ event, ecommerce: payload });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// src/analytics/scripts.ts
|
|
143
|
+
var THROTTLE_EVENTS = {
|
|
144
|
+
view_item: "product.viewed",
|
|
145
|
+
view_item_list: "collection.viewed",
|
|
146
|
+
add_to_cart: "cart.item_added",
|
|
147
|
+
remove_from_cart: "cart.item_removed",
|
|
148
|
+
view_cart: "cart.viewed",
|
|
149
|
+
begin_checkout: "cart.checkout_started",
|
|
150
|
+
select_item: "custom.select_item"
|
|
151
|
+
};
|
|
152
|
+
function throttleScriptsAnalytics(scripts) {
|
|
153
|
+
return {
|
|
154
|
+
track(event, payload) {
|
|
155
|
+
if (typeof window === "undefined") return;
|
|
156
|
+
scripts.track(THROTTLE_EVENTS[event], payload);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// src/analytics/types.ts
|
|
162
|
+
var GA4_EVENTS = [
|
|
163
|
+
"view_item_list",
|
|
164
|
+
"select_item",
|
|
165
|
+
"view_item",
|
|
166
|
+
"add_to_cart",
|
|
167
|
+
"remove_from_cart",
|
|
168
|
+
"view_cart",
|
|
169
|
+
"begin_checkout"
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
// src/pieces/Link.tsx
|
|
173
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
174
|
+
function Link({ classNames, unstyled, className, ...anchor }) {
|
|
175
|
+
const { Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
176
|
+
const part = _chunkVWXJO427cjs.usePart.call(void 0, "link", { classNames, className, unstyled });
|
|
177
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...anchor, ...part });
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// src/shop/ShopAll.tsx
|
|
181
|
+
var _react = require('react');
|
|
182
|
+
|
|
183
|
+
// src/shop/ActiveFilters.tsx
|
|
184
|
+
var _ui = require('@usethrottle/ui');
|
|
185
|
+
|
|
186
|
+
// src/shop/use-shop-all.ts
|
|
187
|
+
var _react3 = require('@usethrottle/catalog/react');
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
// src/shop/scroll-restore.ts
|
|
199
|
+
|
|
200
|
+
var PREFIX = "tsf-shop-scroll:";
|
|
201
|
+
var TRAVERSAL_WINDOW_MS = 2e3;
|
|
202
|
+
var HISTORY_LOAD_WINDOW_MS = 1e4;
|
|
203
|
+
var lastTraversalAt = Number.NEGATIVE_INFINITY;
|
|
204
|
+
var historyLoad = null;
|
|
205
|
+
if (typeof window !== "undefined") {
|
|
206
|
+
window.addEventListener("popstate", () => {
|
|
207
|
+
lastTraversalAt = Date.now();
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function takeHistoryLoad() {
|
|
211
|
+
if (historyLoad === null) {
|
|
212
|
+
const entry = typeof performance !== "undefined" ? _optionalChain([performance, 'access', _4 => _4.getEntriesByType, 'optionalCall', _5 => _5("navigation"), 'optionalAccess', _6 => _6[0]]) : void 0;
|
|
213
|
+
historyLoad = _optionalChain([entry, 'optionalAccess', _7 => _7.type]) === "back_forward" && performance.now() < HISTORY_LOAD_WINDOW_MS;
|
|
214
|
+
}
|
|
215
|
+
const taken = historyLoad;
|
|
216
|
+
historyLoad = false;
|
|
217
|
+
return taken;
|
|
218
|
+
}
|
|
219
|
+
var read = (key) => {
|
|
220
|
+
try {
|
|
221
|
+
return window.sessionStorage.getItem(key);
|
|
222
|
+
} catch (e2) {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
function rememberScroll() {
|
|
227
|
+
if (typeof window === "undefined") return;
|
|
228
|
+
try {
|
|
229
|
+
window.sessionStorage.setItem(PREFIX + window.location.href, String(Math.round(window.scrollY)));
|
|
230
|
+
} catch (e3) {
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function useScrollRestore(ready) {
|
|
234
|
+
const pending = _react.useRef.call(void 0, false);
|
|
235
|
+
const [wake, bump] = _react.useReducer.call(void 0, (n) => n + 1, 0);
|
|
236
|
+
_react.useEffect.call(void 0, () => {
|
|
237
|
+
const byHistory = takeHistoryLoad();
|
|
238
|
+
if (byHistory || Date.now() - lastTraversalAt < TRAVERSAL_WINDOW_MS) {
|
|
239
|
+
pending.current = true;
|
|
240
|
+
bump();
|
|
241
|
+
}
|
|
242
|
+
const onPop = () => {
|
|
243
|
+
pending.current = true;
|
|
244
|
+
bump();
|
|
245
|
+
};
|
|
246
|
+
window.addEventListener("popstate", onPop);
|
|
247
|
+
return () => window.removeEventListener("popstate", onPop);
|
|
248
|
+
}, []);
|
|
249
|
+
_react.useEffect.call(void 0, () => {
|
|
250
|
+
if (!ready || !pending.current) return;
|
|
251
|
+
const saved = read(PREFIX + window.location.href);
|
|
252
|
+
const y = saved === null ? Number.NaN : Number(saved);
|
|
253
|
+
if (!Number.isFinite(y)) {
|
|
254
|
+
pending.current = false;
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
window.scrollTo(0, y);
|
|
258
|
+
const again = () => {
|
|
259
|
+
pending.current = false;
|
|
260
|
+
if (Math.abs(window.scrollY - y) > 1) window.scrollTo(0, y);
|
|
261
|
+
};
|
|
262
|
+
if (typeof requestAnimationFrame !== "function") {
|
|
263
|
+
const timer = window.setTimeout(again, 0);
|
|
264
|
+
return () => window.clearTimeout(timer);
|
|
265
|
+
}
|
|
266
|
+
const frame = requestAnimationFrame(again);
|
|
267
|
+
return () => cancelAnimationFrame(frame);
|
|
268
|
+
}, [ready, wake]);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// src/shop/use-shop-all.ts
|
|
272
|
+
var MAX_CHUNK_PAGES = 5;
|
|
273
|
+
var CATALOG_MAX_LIMIT = 100;
|
|
274
|
+
var ShopAllContext = _react.createContext.call(void 0, null);
|
|
275
|
+
function useShopAll() {
|
|
276
|
+
const value = _react.useContext.call(void 0, ShopAllContext);
|
|
277
|
+
if (!value) throw new Error("useShopAll() was called outside <ShopAll.Root>.");
|
|
278
|
+
return value;
|
|
279
|
+
}
|
|
280
|
+
var NO_CRUMBS = [];
|
|
281
|
+
var rangeKeysOf = (facets) => facets && facets.length > 0 ? facets.filter((f) => f.display === "range").map((f) => f.key) : void 0;
|
|
282
|
+
var withoutKey = (record, key) => {
|
|
283
|
+
const { [key]: _removed, ...rest } = record;
|
|
284
|
+
return rest;
|
|
285
|
+
};
|
|
286
|
+
var currencyOf = (answer) => _nullishCoalesce(answer.currency, () => ( _optionalChain([answer, 'access', _8 => _8.products, 'access', _9 => _9.find, 'call', _10 => _10((p) => p.priceRange), 'optionalAccess', _11 => _11.priceRange, 'optionalAccess', _12 => _12.currency])));
|
|
287
|
+
function listNameOf(source) {
|
|
288
|
+
if (source.kind === "all") return "shop";
|
|
289
|
+
if (source.kind === "search") return "search";
|
|
290
|
+
return `${source.kind}:${source.handle}`;
|
|
291
|
+
}
|
|
292
|
+
function useShopAllState({
|
|
293
|
+
source,
|
|
294
|
+
initialData,
|
|
295
|
+
pagination
|
|
296
|
+
}) {
|
|
297
|
+
const { router, settings } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
298
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
299
|
+
const track = _chunkDYHHAOMGcjs.useTrack.call(void 0, );
|
|
300
|
+
const topRef = _react.useRef.call(void 0, null);
|
|
301
|
+
const [mounted, setMounted] = _react.useState.call(void 0, false);
|
|
302
|
+
_react.useEffect.call(void 0, () => setMounted(true), []);
|
|
303
|
+
const facetsRef = _react.useRef.call(void 0, _optionalChain([initialData, 'optionalAccess', _13 => _13.facets]));
|
|
304
|
+
const rangeKeys = rangeKeysOf(facetsRef.current);
|
|
305
|
+
const search = router.searchParams.toString();
|
|
306
|
+
const sourceKey = JSON.stringify(source);
|
|
307
|
+
const query = _react.useMemo.call(void 0, () => {
|
|
308
|
+
const parsed = !mounted && initialData ? initialData.query : _chunkNDUEJJLPcjs.parseShopQuery.call(void 0, new URLSearchParams(search), settings, rangeKeys);
|
|
309
|
+
return source.kind === "search" ? { ...parsed, q: source.q } : parsed;
|
|
310
|
+
}, [mounted, initialData, search, settings, _optionalChain([rangeKeys, 'optionalAccess', _14 => _14.join, 'call', _15 => _15("\0")]), sourceKey]);
|
|
311
|
+
const manualCollection = _optionalChain([initialData, 'optionalAccess', _16 => _16.collectionKind]) === "manual";
|
|
312
|
+
const fields = _react.useMemo.call(void 0, () => _chunkDOAII637cjs.cardFields.call(void 0, settings), [settings]);
|
|
313
|
+
const pageSize = settings.listing.pageSize;
|
|
314
|
+
const selectionKey = JSON.stringify([query.filters, query.ranges, query.sort, _nullishCoalesce(query.q, () => ( null))]);
|
|
315
|
+
const loadMode = pagination !== "numbered";
|
|
316
|
+
const seedFor = (page) => initialData && initialData.query.page === page && selectionKey === JSON.stringify([initialData.query.filters, initialData.query.ranges, initialData.query.sort, _nullishCoalesce(initialData.query.q, () => ( null))]) ? initialData.list : void 0;
|
|
317
|
+
const anchorKey = `${sourceKey}\0${selectionKey}`;
|
|
318
|
+
const chunkCap = Math.max(1, Math.min(MAX_CHUNK_PAGES, Math.floor(CATALOG_MAX_LIMIT / pageSize)));
|
|
319
|
+
const anchorRef = _react.useRef.call(void 0, null);
|
|
320
|
+
let anchor = anchorRef.current;
|
|
321
|
+
if (!anchor || anchor.key !== anchorKey || query.page < anchor.first + anchor.span - 1) {
|
|
322
|
+
const cold = loadMode && seedFor(query.page) === void 0 && query.page <= chunkCap;
|
|
323
|
+
anchor = { key: anchorKey, first: cold ? 1 : query.page, span: cold ? query.page : 1 };
|
|
324
|
+
anchorRef.current = anchor;
|
|
325
|
+
}
|
|
326
|
+
const segments = _react.useMemo.call(void 0, () => {
|
|
327
|
+
const make = (from, to) => {
|
|
328
|
+
const base = _chunkDOAII637cjs.shopListQuery.call(void 0, { ...query, page: from }, source, settings, { fields, manualCollection });
|
|
329
|
+
const listed = to > from ? { ...base, limit: (to - from + 1) * pageSize } : base;
|
|
330
|
+
const seed = to === from ? seedFor(from) : void 0;
|
|
331
|
+
return { key: JSON.stringify(listed), from, to, query: listed, ...seed ? { seed } : {} };
|
|
332
|
+
};
|
|
333
|
+
if (!loadMode) return [make(query.page, query.page)];
|
|
334
|
+
const end = anchor.first + anchor.span - 1;
|
|
335
|
+
const list = [];
|
|
336
|
+
if (loadMode && anchor.first > 1 && anchor.first - 1 <= chunkCap) list.push(make(1, anchor.first - 1));
|
|
337
|
+
list.push(make(anchor.first, end));
|
|
338
|
+
for (let page = end + 1; page <= query.page; page += 1) list.push(make(page, page));
|
|
339
|
+
return list;
|
|
340
|
+
}, [query, sourceKey, settings, fields, manualCollection, pageSize, loadMode, chunkCap, anchor.first, anchor.span, initialData, selectionKey]);
|
|
341
|
+
const primary = segments[segments.length - 1];
|
|
342
|
+
const earlier = _react.useMemo.call(void 0, () => segments.slice(0, -1), [segments]);
|
|
343
|
+
const listQuery = primary.query;
|
|
344
|
+
const result = _react3.useProducts.call(void 0, listQuery, { initialData: primary.seed, keepPreviousData: true });
|
|
345
|
+
const data = result.data;
|
|
346
|
+
const isPrevious = result.isPreviousData;
|
|
347
|
+
const status = data && !isPrevious ? "ready" : result.error ? "error" : "loading";
|
|
348
|
+
const facets = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _17 => _17.filters]), () => ( _optionalChain([initialData, 'optionalAccess', _18 => _18.facets]))), () => ( []));
|
|
349
|
+
facetsRef.current = _nullishCoalesce(_optionalChain([data, 'optionalAccess', _19 => _19.filters]), () => ( facetsRef.current));
|
|
350
|
+
const total = _nullishCoalesce(_optionalChain([data, 'optionalAccess', _20 => _20.page, 'access', _21 => _21.total]), () => ( void 0));
|
|
351
|
+
const pageCount = Math.max(1, total !== void 0 ? Math.ceil(total / pageSize) : _nullishCoalesce(_optionalChain([data, 'optionalAccess', _22 => _22.page, 'access', _23 => _23.pageCount]), () => ( 1)));
|
|
352
|
+
const [readySegments, setReadySegments] = _react.useState.call(void 0, () => /* @__PURE__ */ new Set());
|
|
353
|
+
const reportReady = _react.useCallback.call(void 0,
|
|
354
|
+
(key) => setReadySegments((seen) => seen.has(key) ? seen : new Set(seen).add(key)),
|
|
355
|
+
[]
|
|
356
|
+
);
|
|
357
|
+
const earlierReady = earlier.every((segment) => readySegments.has(segment.key));
|
|
358
|
+
const hrefFor = _react.useCallback.call(void 0,
|
|
359
|
+
(next) => {
|
|
360
|
+
const queryString = _chunkNDUEJJLPcjs.shopQueryToSearch.call(void 0, next, settings);
|
|
361
|
+
return `${router.pathname}${queryString ? `?${queryString}` : ""}`;
|
|
362
|
+
},
|
|
363
|
+
[router.pathname, settings]
|
|
364
|
+
);
|
|
365
|
+
const go = _react.useCallback.call(void 0,
|
|
366
|
+
(next, mode = "push") => router[mode](hrefFor(next), { scroll: false }),
|
|
367
|
+
[router, hrefFor]
|
|
368
|
+
);
|
|
369
|
+
const setValues = _react.useCallback.call(void 0,
|
|
370
|
+
(key, values) => {
|
|
371
|
+
const filters = values.length > 0 ? { ...query.filters, [key]: values } : withoutKey(query.filters, key);
|
|
372
|
+
go({ ...query, filters, ranges: withoutKey(query.ranges, key), page: 1 });
|
|
373
|
+
},
|
|
374
|
+
[query, go]
|
|
375
|
+
);
|
|
376
|
+
const toggleValue = _react.useCallback.call(void 0,
|
|
377
|
+
(key, value) => {
|
|
378
|
+
const current = _nullishCoalesce(query.filters[key], () => ( []));
|
|
379
|
+
setValues(key, current.includes(value) ? current.filter((v) => v !== value) : [...current, value]);
|
|
380
|
+
},
|
|
381
|
+
[query, setValues]
|
|
382
|
+
);
|
|
383
|
+
const setRange = _react.useCallback.call(void 0,
|
|
384
|
+
(key, range) => {
|
|
385
|
+
const set = range !== null && (range.min !== void 0 || range.max !== void 0);
|
|
386
|
+
go({
|
|
387
|
+
...query,
|
|
388
|
+
filters: withoutKey(query.filters, key),
|
|
389
|
+
ranges: set ? { ...query.ranges, [key]: range } : withoutKey(query.ranges, key),
|
|
390
|
+
page: 1
|
|
391
|
+
});
|
|
392
|
+
},
|
|
393
|
+
[query, go]
|
|
394
|
+
);
|
|
395
|
+
const clear = _react.useCallback.call(void 0,
|
|
396
|
+
(key) => go(
|
|
397
|
+
key === void 0 ? { ...query, filters: {}, ranges: {}, page: 1 } : { ...query, filters: withoutKey(query.filters, key), ranges: withoutKey(query.ranges, key), page: 1 }
|
|
398
|
+
),
|
|
399
|
+
[query, go]
|
|
400
|
+
);
|
|
401
|
+
const setSort = _react.useCallback.call(void 0, (sort) => go({ ...query, sort, page: 1 }), [query, go]);
|
|
402
|
+
const setPage = _react.useCallback.call(void 0,
|
|
403
|
+
(page) => {
|
|
404
|
+
go({ ...query, page });
|
|
405
|
+
_optionalChain([topRef, 'access', _24 => _24.current, 'optionalAccess', _25 => _25.scrollIntoView, 'optionalCall', _26 => _26({ block: "start" })]);
|
|
406
|
+
},
|
|
407
|
+
[query, go]
|
|
408
|
+
);
|
|
409
|
+
const loadMore = _react.useCallback.call(void 0, () => go({ ...query, page: query.page + 1 }, "replace"), [query, go]);
|
|
410
|
+
const listName = listNameOf(source);
|
|
411
|
+
const selectProduct = _react.useCallback.call(void 0,
|
|
412
|
+
(product, index) => {
|
|
413
|
+
rememberScroll();
|
|
414
|
+
const currency = data ? currencyOf(data) : void 0;
|
|
415
|
+
if (currency) {
|
|
416
|
+
track("select_item", { currency, item_list_name: listName, items: [_chunkHZ6VEN6Qcjs.toGa4Item.call(void 0, product, { index, listName })] });
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
[data, track, listName]
|
|
420
|
+
);
|
|
421
|
+
const listKey = `${sourceKey}\0${JSON.stringify(listQuery)}`;
|
|
422
|
+
const reported = _react.useRef.call(void 0, null);
|
|
423
|
+
_react.useEffect.call(void 0, () => {
|
|
424
|
+
if (status !== "ready" || !data || reported.current === listKey) return;
|
|
425
|
+
reported.current = listKey;
|
|
426
|
+
const currency = currencyOf(data);
|
|
427
|
+
if (!currency) return;
|
|
428
|
+
const offset = (data.page.number - 1) * data.page.limit;
|
|
429
|
+
track("view_item_list", {
|
|
430
|
+
currency,
|
|
431
|
+
item_list_name: listName,
|
|
432
|
+
items: data.products.map((p, i) => _chunkHZ6VEN6Qcjs.toGa4Item.call(void 0, p, { index: offset + i, listName }))
|
|
433
|
+
});
|
|
434
|
+
}, [status, data, listKey, listName, track]);
|
|
435
|
+
useScrollRestore(status === "ready" && earlierReady);
|
|
436
|
+
const fallbackTitle = source.kind === "all" ? t("shop.title") : source.kind === "search" ? t("search.results", { q: source.q }) : source.handle;
|
|
437
|
+
const [shownAt] = _react.useState.call(void 0, () => (/* @__PURE__ */ new Date()).toISOString());
|
|
438
|
+
const refetch = _react.useCallback.call(void 0, () => void result.refetch(), [result.refetch]);
|
|
439
|
+
const selectedCount = Object.values(query.filters).reduce((n, values) => n + values.length, 0) + Object.keys(query.ranges).length;
|
|
440
|
+
const title = _nullishCoalesce(_optionalChain([initialData, 'optionalAccess', _27 => _27.title]), () => ( fallbackTitle));
|
|
441
|
+
const description = _optionalChain([initialData, 'optionalAccess', _28 => _28.description]);
|
|
442
|
+
const breadcrumbs = _nullishCoalesce(_optionalChain([initialData, 'optionalAccess', _29 => _29.breadcrumbs]), () => ( NO_CRUMBS));
|
|
443
|
+
const generatedAt = _nullishCoalesce(_optionalChain([initialData, 'optionalAccess', _30 => _30.generatedAt]), () => ( shownAt));
|
|
444
|
+
const reviewsOnLists = _optionalChain([initialData, 'optionalAccess', _31 => _31.reviewsOnLists]);
|
|
445
|
+
return _react.useMemo.call(void 0, () => ({
|
|
446
|
+
source,
|
|
447
|
+
query,
|
|
448
|
+
data,
|
|
449
|
+
status,
|
|
450
|
+
isPrevious,
|
|
451
|
+
facets,
|
|
452
|
+
total,
|
|
453
|
+
pageCount,
|
|
454
|
+
listQuery,
|
|
455
|
+
earlier,
|
|
456
|
+
firstLoadedPage: segments[0].from,
|
|
457
|
+
reportReady,
|
|
458
|
+
hrefFor,
|
|
459
|
+
toggleValue,
|
|
460
|
+
setValues,
|
|
461
|
+
setRange,
|
|
462
|
+
clear,
|
|
463
|
+
setSort,
|
|
464
|
+
setPage,
|
|
465
|
+
loadMore,
|
|
466
|
+
refetch,
|
|
467
|
+
selectedCount,
|
|
468
|
+
announceKey: selectionKey,
|
|
469
|
+
title,
|
|
470
|
+
...description ? { description } : {},
|
|
471
|
+
breadcrumbs,
|
|
472
|
+
listName,
|
|
473
|
+
generatedAt,
|
|
474
|
+
...reviewsOnLists !== void 0 ? { reviewsOnLists } : {},
|
|
475
|
+
manualCollection,
|
|
476
|
+
selectProduct,
|
|
477
|
+
topRef
|
|
478
|
+
}), [
|
|
479
|
+
source,
|
|
480
|
+
query,
|
|
481
|
+
data,
|
|
482
|
+
status,
|
|
483
|
+
isPrevious,
|
|
484
|
+
facets,
|
|
485
|
+
total,
|
|
486
|
+
pageCount,
|
|
487
|
+
listQuery,
|
|
488
|
+
earlier,
|
|
489
|
+
segments,
|
|
490
|
+
reportReady,
|
|
491
|
+
hrefFor,
|
|
492
|
+
toggleValue,
|
|
493
|
+
setValues,
|
|
494
|
+
setRange,
|
|
495
|
+
clear,
|
|
496
|
+
setSort,
|
|
497
|
+
setPage,
|
|
498
|
+
loadMore,
|
|
499
|
+
refetch,
|
|
500
|
+
selectedCount,
|
|
501
|
+
selectionKey,
|
|
502
|
+
title,
|
|
503
|
+
description,
|
|
504
|
+
breadcrumbs,
|
|
505
|
+
listName,
|
|
506
|
+
generatedAt,
|
|
507
|
+
reviewsOnLists,
|
|
508
|
+
manualCollection,
|
|
509
|
+
selectProduct
|
|
510
|
+
]);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// src/shop/ActiveFilters.tsx
|
|
514
|
+
|
|
515
|
+
function ActiveFilters(local) {
|
|
516
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "active-filters", local);
|
|
517
|
+
const item = _chunkVWXJO427cjs.usePart.call(void 0, "active-filter", local);
|
|
518
|
+
const remove = _chunkVWXJO427cjs.usePart.call(void 0, "active-filter-remove", local);
|
|
519
|
+
const clearAll = _chunkVWXJO427cjs.usePart.call(void 0, "active-filters-clear", local);
|
|
520
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
521
|
+
const { query, facets, toggleValue, setRange, clear, selectedCount } = useShopAll();
|
|
522
|
+
if (selectedCount === 0) return null;
|
|
523
|
+
const rangeText = ({ min, max }) => min !== void 0 && max !== void 0 ? t("shop.rangeBetween", { min, max }) : min !== void 0 ? t("shop.rangeFrom", { min }) : t("shop.rangeUpTo", { max: _nullishCoalesce(max, () => ( "")) });
|
|
524
|
+
const chips = [];
|
|
525
|
+
for (const [key, values] of Object.entries(query.filters)) {
|
|
526
|
+
const facet = facets.find((f) => f.key === key);
|
|
527
|
+
for (const value of values) {
|
|
528
|
+
const label = _nullishCoalesce(_optionalChain([facet, 'optionalAccess', _32 => _32.values, 'access', _33 => _33.find, 'call', _34 => _34((v) => v.value === value), 'optionalAccess', _35 => _35.label]), () => ( value));
|
|
529
|
+
chips.push({ id: `${key}\0${value}`, label, name: `${_nullishCoalesce(_optionalChain([facet, 'optionalAccess', _36 => _36.label]), () => ( key))}: ${label}`, remove: () => toggleValue(key, value) });
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
for (const [key, range] of Object.entries(query.ranges)) {
|
|
533
|
+
const name = _nullishCoalesce(_optionalChain([facets, 'access', _37 => _37.find, 'call', _38 => _38((f) => f.key === key), 'optionalAccess', _39 => _39.label]), () => ( key));
|
|
534
|
+
chips.push({ id: `${key}\0range`, label: rangeText(range), name: `${name}: ${rangeText(range)}`, remove: () => setRange(key, null) });
|
|
535
|
+
}
|
|
536
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "ul", { ...root, "aria-label": t("filters.title"), children: [
|
|
537
|
+
chips.map((chip) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...item, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { ...remove, type: "button", "aria-label": t("shop.removeFilter", { label: chip.name }), onClick: chip.remove, children: [
|
|
538
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: chip.label }),
|
|
539
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "close", size: 14 })
|
|
540
|
+
] }) }, chip.id)),
|
|
541
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ...clearAll, type: "button", onClick: () => clear(), children: t("filters.clearAll") }) })
|
|
542
|
+
] });
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// src/shop/FilterBar.tsx
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
// src/shop/FacetGroup.tsx
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
var FACET_VALUE_LIMIT = 10;
|
|
554
|
+
function visibleFacets(facets, query) {
|
|
555
|
+
return facets.filter(
|
|
556
|
+
(f) => (f.display === "range" ? f.range !== void 0 : f.values.length > 0) || (_nullishCoalesce(_optionalChain([query, 'access', _40 => _40.filters, 'access', _41 => _41[f.key], 'optionalAccess', _42 => _42.length]), () => ( 0))) > 0 || query.ranges[f.key] !== void 0
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
function withSelected(values, selected) {
|
|
560
|
+
const missing = selected.filter((s) => !values.some((v) => v.value === s));
|
|
561
|
+
return [...values, ...missing.map((value) => ({ value, label: value, count: 0, selected: true }))];
|
|
562
|
+
}
|
|
563
|
+
function OptionList({ facet, local }) {
|
|
564
|
+
const fieldset = _chunkVWXJO427cjs.usePart.call(void 0, "facet-fieldset", local);
|
|
565
|
+
const legend = _chunkVWXJO427cjs.usePart.call(void 0, "facet-legend", local);
|
|
566
|
+
const options = _chunkVWXJO427cjs.usePart.call(void 0, "facet-options", local);
|
|
567
|
+
const option = _chunkVWXJO427cjs.usePart.call(void 0, "facet-option", local);
|
|
568
|
+
const optionLabel = _chunkVWXJO427cjs.usePart.call(void 0, "facet-option-label", local);
|
|
569
|
+
const input = _chunkVWXJO427cjs.usePart.call(void 0, "facet-option-input", local);
|
|
570
|
+
const text = _chunkVWXJO427cjs.usePart.call(void 0, "facet-option-text", local);
|
|
571
|
+
const count = _chunkVWXJO427cjs.usePart.call(void 0, "facet-option-count", local);
|
|
572
|
+
const search = _chunkVWXJO427cjs.usePart.call(void 0, "facet-search", local);
|
|
573
|
+
const showAll = _chunkVWXJO427cjs.usePart.call(void 0, "facet-show-all", local);
|
|
574
|
+
const empty = _chunkVWXJO427cjs.usePart.call(void 0, "facet-empty", local);
|
|
575
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
576
|
+
const { query, toggleValue, listQuery } = useShopAll();
|
|
577
|
+
const selected = _nullishCoalesce(query.filters[facet.key], () => ( []));
|
|
578
|
+
const [expanded, setExpanded] = _react.useState.call(void 0, false);
|
|
579
|
+
const [needle, setNeedle] = _react.useState.call(void 0, "");
|
|
580
|
+
const full = _react3.useFilterValues.call(void 0, expanded && facet.more ? facet.key : null, listQuery);
|
|
581
|
+
const values = withSelected(_nullishCoalesce(_optionalChain([full, 'access', _43 => _43.data, 'optionalAccess', _44 => _44.values]), () => ( facet.values)), selected);
|
|
582
|
+
const long = values.length > FACET_VALUE_LIMIT || facet.more;
|
|
583
|
+
const q = needle.trim().toLowerCase();
|
|
584
|
+
const shown = q ? values.filter((v) => v.label.toLowerCase().includes(q)) : expanded || !long ? values : [...values.slice(0, FACET_VALUE_LIMIT), ...values.slice(FACET_VALUE_LIMIT).filter((v) => selected.includes(v.value))];
|
|
585
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
586
|
+
long ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
587
|
+
"input",
|
|
588
|
+
{
|
|
589
|
+
...search,
|
|
590
|
+
type: "search",
|
|
591
|
+
value: needle,
|
|
592
|
+
placeholder: t("shop.searchFacet", { name: facet.label }),
|
|
593
|
+
"aria-label": t("shop.searchFacet", { name: facet.label }),
|
|
594
|
+
onChange: (event) => setNeedle(event.target.value)
|
|
595
|
+
}
|
|
596
|
+
) : null,
|
|
597
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "fieldset", { ...fieldset, children: [
|
|
598
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "legend", { ...legend, children: facet.label }),
|
|
599
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { ...options, children: shown.map((v) => {
|
|
600
|
+
const checked = selected.includes(v.value);
|
|
601
|
+
const swatch = facet.display === "swatch" ? v.swatch : void 0;
|
|
602
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...option, "data-empty": v.count === 0 && !checked ? "" : void 0, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { ...optionLabel, children: [
|
|
603
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
604
|
+
"input",
|
|
605
|
+
{
|
|
606
|
+
...input,
|
|
607
|
+
type: "checkbox",
|
|
608
|
+
value: v.value,
|
|
609
|
+
checked,
|
|
610
|
+
disabled: v.count === 0 && !checked,
|
|
611
|
+
onChange: () => toggleValue(facet.key, v.value)
|
|
612
|
+
}
|
|
613
|
+
),
|
|
614
|
+
swatch ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
615
|
+
_chunkNDUEJJLPcjs.Swatch,
|
|
616
|
+
{
|
|
617
|
+
...local,
|
|
618
|
+
value: v.label,
|
|
619
|
+
hex: "color" in swatch ? swatch.color : void 0,
|
|
620
|
+
image: "url" in swatch ? swatch.url : void 0,
|
|
621
|
+
selected: checked
|
|
622
|
+
}
|
|
623
|
+
) : null,
|
|
624
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...text, children: v.label }),
|
|
625
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...count, "aria-hidden": "true", children: v.count }),
|
|
626
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.VisuallyHidden, { children: t("shop.valueCount", { count: v.count }) })
|
|
627
|
+
] }) }, v.value);
|
|
628
|
+
}) })
|
|
629
|
+
] }),
|
|
630
|
+
q && shown.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...empty, children: t("shop.noFacetMatch") }) : null,
|
|
631
|
+
long && !q ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ...showAll, type: "button", "aria-expanded": expanded, onClick: () => setExpanded(!expanded), children: expanded ? t("shop.showFewer") : t("shop.showAll", { count: values.length }) }) : null
|
|
632
|
+
] });
|
|
633
|
+
}
|
|
634
|
+
function SelectControl({ facet, local }) {
|
|
635
|
+
const select = _chunkVWXJO427cjs.usePart.call(void 0, "facet-select", local);
|
|
636
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
637
|
+
const { query, setValues } = useShopAll();
|
|
638
|
+
const selected = _nullishCoalesce(query.filters[facet.key], () => ( []));
|
|
639
|
+
const values = withSelected(facet.values, selected);
|
|
640
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
641
|
+
"select",
|
|
642
|
+
{
|
|
643
|
+
...select,
|
|
644
|
+
"aria-label": facet.label,
|
|
645
|
+
value: _nullishCoalesce(selected[0], () => ( "")),
|
|
646
|
+
onChange: (event) => setValues(facet.key, event.target.value ? [event.target.value] : []),
|
|
647
|
+
children: [
|
|
648
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "", children: t("shop.any") }),
|
|
649
|
+
values.map((v) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "option", { value: v.value, disabled: v.count === 0 && !selected.includes(v.value), children: [
|
|
650
|
+
v.label,
|
|
651
|
+
" (",
|
|
652
|
+
v.count,
|
|
653
|
+
")"
|
|
654
|
+
] }, v.value))
|
|
655
|
+
]
|
|
656
|
+
}
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
function BooleanControl({ facet, local }) {
|
|
660
|
+
const group = _chunkVWXJO427cjs.usePart.call(void 0, "facet-boolean", local);
|
|
661
|
+
const optionLabel = _chunkVWXJO427cjs.usePart.call(void 0, "facet-option-label", local);
|
|
662
|
+
const input = _chunkVWXJO427cjs.usePart.call(void 0, "facet-option-input", local);
|
|
663
|
+
const text = _chunkVWXJO427cjs.usePart.call(void 0, "facet-option-text", local);
|
|
664
|
+
const count = _chunkVWXJO427cjs.usePart.call(void 0, "facet-option-count", local);
|
|
665
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
666
|
+
const { query, setValues } = useShopAll();
|
|
667
|
+
const name = _react.useId.call(void 0, );
|
|
668
|
+
const current = _nullishCoalesce(_optionalChain([query, 'access', _45 => _45.filters, 'access', _46 => _46[facet.key], 'optionalAccess', _47 => _47[0]]), () => ( ""));
|
|
669
|
+
const countOf = (value) => _optionalChain([facet, 'access', _48 => _48.values, 'access', _49 => _49.find, 'call', _50 => _50((v) => v.value === value), 'optionalAccess', _51 => _51.count]);
|
|
670
|
+
const choices = [
|
|
671
|
+
{ value: "", label: t("shop.any"), count: void 0 },
|
|
672
|
+
{ value: "true", label: t("boolean.yes"), count: countOf("true") },
|
|
673
|
+
{ value: "false", label: t("boolean.no"), count: countOf("false") }
|
|
674
|
+
];
|
|
675
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...group, role: "radiogroup", "aria-label": facet.label, children: choices.map((c) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { ...optionLabel, children: [
|
|
676
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
677
|
+
"input",
|
|
678
|
+
{
|
|
679
|
+
...input,
|
|
680
|
+
type: "radio",
|
|
681
|
+
name,
|
|
682
|
+
value: c.value,
|
|
683
|
+
checked: current === c.value,
|
|
684
|
+
disabled: c.count === 0 && current !== c.value,
|
|
685
|
+
onChange: () => setValues(facet.key, c.value ? [c.value] : [])
|
|
686
|
+
}
|
|
687
|
+
),
|
|
688
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...text, children: c.label }),
|
|
689
|
+
c.count !== void 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...count, "aria-hidden": "true", children: c.count }) : null
|
|
690
|
+
] }, c.value)) });
|
|
691
|
+
}
|
|
692
|
+
function RangeControl({ facet, local }) {
|
|
693
|
+
const form = _chunkVWXJO427cjs.usePart.call(void 0, "facet-range", local);
|
|
694
|
+
const fields = _chunkVWXJO427cjs.usePart.call(void 0, "facet-range-fields", local);
|
|
695
|
+
const field = _chunkVWXJO427cjs.usePart.call(void 0, "facet-range-field", local);
|
|
696
|
+
const input = _chunkVWXJO427cjs.usePart.call(void 0, "facet-range-input", local);
|
|
697
|
+
const error = _chunkVWXJO427cjs.usePart.call(void 0, "facet-range-error", local);
|
|
698
|
+
const hint = _chunkVWXJO427cjs.usePart.call(void 0, "facet-range-hint", local);
|
|
699
|
+
const actions = _chunkVWXJO427cjs.usePart.call(void 0, "facet-range-actions", local);
|
|
700
|
+
const apply = _chunkVWXJO427cjs.usePart.call(void 0, "facet-range-apply", local);
|
|
701
|
+
const clearPart = _chunkVWXJO427cjs.usePart.call(void 0, "facet-range-clear", local);
|
|
702
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
703
|
+
const { query, setRange } = useShopAll();
|
|
704
|
+
const id = _react.useId.call(void 0, );
|
|
705
|
+
const current = query.ranges[facet.key];
|
|
706
|
+
const [min, setMin] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([current, 'optionalAccess', _52 => _52.min, 'optionalAccess', _53 => _53.toString, 'call', _54 => _54()]), () => ( "")));
|
|
707
|
+
const [max, setMax] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([current, 'optionalAccess', _55 => _55.max, 'optionalAccess', _56 => _56.toString, 'call', _57 => _57()]), () => ( "")));
|
|
708
|
+
const [invalid, setInvalid] = _react.useState.call(void 0, false);
|
|
709
|
+
const minRef = _react.useRef.call(void 0, null);
|
|
710
|
+
const maxRef = _react.useRef.call(void 0, null);
|
|
711
|
+
_react.useEffect.call(void 0, () => {
|
|
712
|
+
setMin(_nullishCoalesce(_optionalChain([current, 'optionalAccess', _58 => _58.min, 'optionalAccess', _59 => _59.toString, 'call', _60 => _60()]), () => ( "")));
|
|
713
|
+
setMax(_nullishCoalesce(_optionalChain([current, 'optionalAccess', _61 => _61.max, 'optionalAccess', _62 => _62.toString, 'call', _63 => _63()]), () => ( "")));
|
|
714
|
+
}, [_optionalChain([current, 'optionalAccess', _64 => _64.min]), _optionalChain([current, 'optionalAccess', _65 => _65.max])]);
|
|
715
|
+
const submit = (event) => {
|
|
716
|
+
event.preventDefault();
|
|
717
|
+
if (_optionalChain([minRef, 'access', _66 => _66.current, 'optionalAccess', _67 => _67.validity, 'access', _68 => _68.badInput]) || _optionalChain([maxRef, 'access', _69 => _69.current, 'optionalAccess', _70 => _70.validity, 'access', _71 => _71.badInput])) {
|
|
718
|
+
setInvalid(true);
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
setInvalid(false);
|
|
722
|
+
const lo = min.trim() === "" ? void 0 : Number(min);
|
|
723
|
+
const hi = max.trim() === "" ? void 0 : Number(max);
|
|
724
|
+
if (lo !== void 0 && hi !== void 0 && lo > hi) setRange(facet.key, { min: hi, max: lo });
|
|
725
|
+
else setRange(facet.key, { ...lo !== void 0 ? { min: lo } : {}, ...hi !== void 0 ? { max: hi } : {} });
|
|
726
|
+
};
|
|
727
|
+
const bounds = facet.range;
|
|
728
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { ...form, onSubmit: submit, noValidate: true, children: [
|
|
729
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...fields, children: [
|
|
730
|
+
["min", min, setMin, minRef, "shop.rangeMin", _optionalChain([bounds, 'optionalAccess', _72 => _72.min])],
|
|
731
|
+
["max", max, setMax, maxRef, "shop.rangeMax", _optionalChain([bounds, 'optionalAccess', _73 => _73.max])]
|
|
732
|
+
].map(([name, value, set, ref, key, placeholder]) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { ...field, htmlFor: `${id}-${name}`, children: [
|
|
733
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t(key) }),
|
|
734
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
735
|
+
"input",
|
|
736
|
+
{
|
|
737
|
+
...input,
|
|
738
|
+
ref,
|
|
739
|
+
id: `${id}-${name}`,
|
|
740
|
+
"aria-label": `${facet.label}: ${t(key)}`,
|
|
741
|
+
type: "number",
|
|
742
|
+
inputMode: "numeric",
|
|
743
|
+
placeholder: placeholder === void 0 ? void 0 : String(placeholder),
|
|
744
|
+
value,
|
|
745
|
+
"aria-invalid": invalid || void 0,
|
|
746
|
+
"aria-describedby": invalid ? `${id}-error` : void 0,
|
|
747
|
+
onChange: (event) => set(event.target.value)
|
|
748
|
+
}
|
|
749
|
+
)
|
|
750
|
+
] }, name)) }),
|
|
751
|
+
invalid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...error, id: `${id}-error`, role: "alert", children: t("shop.rangeInvalid") }) : null,
|
|
752
|
+
bounds ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...hint, children: t("shop.rangeBetween", { min: bounds.min, max: bounds.max }) }) : null,
|
|
753
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...actions, children: [
|
|
754
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ...apply, type: "submit", children: t("filters.apply") }),
|
|
755
|
+
current ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ...clearPart, type: "button", onClick: () => setRange(facet.key, null), children: t("shop.rangeClear") }) : null
|
|
756
|
+
] })
|
|
757
|
+
] });
|
|
758
|
+
}
|
|
759
|
+
function FacetBody({ facet, local }) {
|
|
760
|
+
switch (facet.display) {
|
|
761
|
+
case "range":
|
|
762
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RangeControl, { facet, local });
|
|
763
|
+
case "boolean":
|
|
764
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BooleanControl, { facet, local });
|
|
765
|
+
case "dropdown":
|
|
766
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectControl, { facet, local });
|
|
767
|
+
default:
|
|
768
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, OptionList, { facet, local });
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
function DropdownFacet({ facet, local, name }) {
|
|
772
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "facet", local);
|
|
773
|
+
const trigger = _chunkVWXJO427cjs.usePart.call(void 0, "facet-trigger", local);
|
|
774
|
+
const panel = _chunkVWXJO427cjs.usePart.call(void 0, "facet-panel", local);
|
|
775
|
+
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
776
|
+
const rootRef = _react.useRef.call(void 0, null);
|
|
777
|
+
const triggerRef = _react.useRef.call(void 0, null);
|
|
778
|
+
const panelId = _react.useId.call(void 0, );
|
|
779
|
+
_react.useEffect.call(void 0, () => {
|
|
780
|
+
if (!open) return;
|
|
781
|
+
const onDown = (event) => {
|
|
782
|
+
if (rootRef.current && !rootRef.current.contains(event.target)) setOpen(false);
|
|
783
|
+
};
|
|
784
|
+
const onKey = (event) => {
|
|
785
|
+
if (event.key !== "Escape") return;
|
|
786
|
+
setOpen(false);
|
|
787
|
+
_optionalChain([triggerRef, 'access', _74 => _74.current, 'optionalAccess', _75 => _75.focus, 'call', _76 => _76()]);
|
|
788
|
+
};
|
|
789
|
+
document.addEventListener("mousedown", onDown);
|
|
790
|
+
document.addEventListener("keydown", onKey);
|
|
791
|
+
return () => {
|
|
792
|
+
document.removeEventListener("mousedown", onDown);
|
|
793
|
+
document.removeEventListener("keydown", onKey);
|
|
794
|
+
};
|
|
795
|
+
}, [open]);
|
|
796
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...root, ref: rootRef, "data-filter-key": facet.key, "data-filter-display": facet.display, "data-presentation": "dropdown", children: [
|
|
797
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
798
|
+
"button",
|
|
799
|
+
{
|
|
800
|
+
...trigger,
|
|
801
|
+
ref: triggerRef,
|
|
802
|
+
type: "button",
|
|
803
|
+
"aria-expanded": open,
|
|
804
|
+
"aria-controls": open ? panelId : void 0,
|
|
805
|
+
onClick: () => setOpen(!open),
|
|
806
|
+
children: [
|
|
807
|
+
name,
|
|
808
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: open ? "chevron-up" : "chevron-down", size: 16 })
|
|
809
|
+
]
|
|
810
|
+
}
|
|
811
|
+
),
|
|
812
|
+
open ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...panel, id: panelId, role: "group", "aria-label": facet.label, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FacetBody, { facet, local }) }) : null
|
|
813
|
+
] });
|
|
814
|
+
}
|
|
815
|
+
function FacetGroup({ facet, presentation = "section", classNames, unstyled }) {
|
|
816
|
+
const local = { classNames, unstyled };
|
|
817
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "facet", local);
|
|
818
|
+
const heading = _chunkVWXJO427cjs.usePart.call(void 0, "facet-heading", local);
|
|
819
|
+
const toggle = _chunkVWXJO427cjs.usePart.call(void 0, "facet-toggle", local);
|
|
820
|
+
const label = _chunkVWXJO427cjs.usePart.call(void 0, "facet-label", local);
|
|
821
|
+
const badge = _chunkVWXJO427cjs.usePart.call(void 0, "facet-selected", local);
|
|
822
|
+
const body = _chunkVWXJO427cjs.usePart.call(void 0, "facet-body", local);
|
|
823
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
824
|
+
const { query } = useShopAll();
|
|
825
|
+
const [open, setOpen] = _react.useState.call(void 0, true);
|
|
826
|
+
const bodyId = _react.useId.call(void 0, );
|
|
827
|
+
const selectedCount = (_nullishCoalesce(_optionalChain([query, 'access', _77 => _77.filters, 'access', _78 => _78[facet.key], 'optionalAccess', _79 => _79.length]), () => ( 0))) + (query.ranges[facet.key] ? 1 : 0);
|
|
828
|
+
const name = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
829
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...label, "data-filter-label": "", children: facet.label }),
|
|
830
|
+
selectedCount > 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { ...badge, children: [
|
|
831
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "aria-hidden": "true", children: selectedCount }),
|
|
832
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.VisuallyHidden, { children: t("shop.selectedCount", { count: selectedCount }) })
|
|
833
|
+
] }) : null
|
|
834
|
+
] });
|
|
835
|
+
if (presentation === "dropdown") {
|
|
836
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownFacet, { facet, local, name });
|
|
837
|
+
}
|
|
838
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { ...root, "data-filter-key": facet.key, "data-filter-display": facet.display, "data-presentation": "section", children: [
|
|
839
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { ...heading, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { ...toggle, type: "button", "aria-expanded": open, "aria-controls": bodyId, onClick: () => setOpen(!open), children: [
|
|
840
|
+
name,
|
|
841
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: open ? "chevron-up" : "chevron-down", size: 16 })
|
|
842
|
+
] }) }),
|
|
843
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...body, id: bodyId, hidden: !open, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FacetBody, { facet, local }) })
|
|
844
|
+
] });
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
// src/shop/FilterDrawer.tsx
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
function FilterPanel({
|
|
852
|
+
open,
|
|
853
|
+
onClose,
|
|
854
|
+
facets,
|
|
855
|
+
title,
|
|
856
|
+
restoreFocusTo,
|
|
857
|
+
container,
|
|
858
|
+
...local
|
|
859
|
+
}) {
|
|
860
|
+
const head = _chunkVWXJO427cjs.usePart.call(void 0, "filter-drawer-head", local);
|
|
861
|
+
const titlePart = _chunkVWXJO427cjs.usePart.call(void 0, "filter-drawer-title", local);
|
|
862
|
+
const close = _chunkVWXJO427cjs.usePart.call(void 0, "filter-drawer-close", local);
|
|
863
|
+
const body = _chunkVWXJO427cjs.usePart.call(void 0, "filter-drawer-body", local);
|
|
864
|
+
const foot = _chunkVWXJO427cjs.usePart.call(void 0, "filter-drawer-foot", local);
|
|
865
|
+
const apply = _chunkVWXJO427cjs.usePart.call(void 0, "filter-drawer-apply", local);
|
|
866
|
+
const clearPart = _chunkVWXJO427cjs.usePart.call(void 0, "filter-clear", local);
|
|
867
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
868
|
+
const { status, total, selectedCount, clear } = useShopAll();
|
|
869
|
+
const titleId = _react.useId.call(void 0, );
|
|
870
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _ui.Drawer, { open, onClose, labelledBy: titleId, restoreFocusTo, container, children: [
|
|
871
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...head, children: [
|
|
872
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { ...titlePart, id: titleId, children: title }),
|
|
873
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ...close, type: "button", "aria-label": t("shop.closeFilters"), onClick: onClose, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "close", size: 20 }) })
|
|
874
|
+
] }),
|
|
875
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...body, children: facets.map((facet) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FacetGroup, { facet, ...local }, facet.key)) }),
|
|
876
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...foot, children: [
|
|
877
|
+
selectedCount > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ...clearPart, type: "button", onClick: () => clear(), children: t("filters.clearAll") }) : null,
|
|
878
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ...apply, type: "button", onClick: onClose, children: status === "ready" && total !== void 0 ? t("shop.showResults", { count: total }) : t("shop.showResultsLoading") })
|
|
879
|
+
] })
|
|
880
|
+
] });
|
|
881
|
+
}
|
|
882
|
+
function FilterDrawer(local) {
|
|
883
|
+
const trigger = _chunkVWXJO427cjs.usePart.call(void 0, "filter-drawer-trigger", local);
|
|
884
|
+
const count = _chunkVWXJO427cjs.usePart.call(void 0, "filter-drawer-count", local);
|
|
885
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
886
|
+
const { facets, query, selectedCount, filterLayout } = useShopAll();
|
|
887
|
+
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
888
|
+
const [container, setContainer] = _react.useState.call(void 0, null);
|
|
889
|
+
const opener = _react.useRef.call(void 0, null);
|
|
890
|
+
const shown = visibleFacets(facets, query);
|
|
891
|
+
if (shown.length === 0) return null;
|
|
892
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
893
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
894
|
+
"button",
|
|
895
|
+
{
|
|
896
|
+
...trigger,
|
|
897
|
+
ref: opener,
|
|
898
|
+
type: "button",
|
|
899
|
+
"aria-haspopup": "dialog",
|
|
900
|
+
"data-phone-only": filterLayout === "drawer" ? void 0 : "",
|
|
901
|
+
onClick: () => {
|
|
902
|
+
setContainer(_nullishCoalesce(_optionalChain([opener, 'access', _80 => _80.current, 'optionalAccess', _81 => _81.closest, 'call', _82 => _82(".tsf-root")]), () => ( null)));
|
|
903
|
+
setOpen(true);
|
|
904
|
+
},
|
|
905
|
+
children: [
|
|
906
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "filter", size: 18 }),
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("filters.title") }),
|
|
908
|
+
selectedCount > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...count, children: selectedCount }) : null
|
|
909
|
+
]
|
|
910
|
+
}
|
|
911
|
+
),
|
|
912
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
913
|
+
FilterPanel,
|
|
914
|
+
{
|
|
915
|
+
open,
|
|
916
|
+
onClose: () => setOpen(false),
|
|
917
|
+
container,
|
|
918
|
+
restoreFocusTo: opener.current,
|
|
919
|
+
facets: shown,
|
|
920
|
+
title: t("filters.title"),
|
|
921
|
+
classNames: local.classNames,
|
|
922
|
+
unstyled: local.unstyled
|
|
923
|
+
}
|
|
924
|
+
)
|
|
925
|
+
] });
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
// src/shop/FilterBar.tsx
|
|
929
|
+
|
|
930
|
+
var FILTER_BAR_INLINE = 4;
|
|
931
|
+
function FilterBar(local) {
|
|
932
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "filter-bar", local);
|
|
933
|
+
const more = _chunkVWXJO427cjs.usePart.call(void 0, "filter-bar-more", local);
|
|
934
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
935
|
+
const { facets, query } = useShopAll();
|
|
936
|
+
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
937
|
+
const [container, setContainer] = _react.useState.call(void 0, null);
|
|
938
|
+
const opener = _react.useRef.call(void 0, null);
|
|
939
|
+
const shown = visibleFacets(facets, query);
|
|
940
|
+
if (shown.length === 0) return null;
|
|
941
|
+
const inline = shown.slice(0, FILTER_BAR_INLINE);
|
|
942
|
+
const rest = shown.slice(FILTER_BAR_INLINE);
|
|
943
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...root, role: "group", "aria-label": t("filters.title"), children: [
|
|
944
|
+
inline.map((facet) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FacetGroup, { facet, presentation: "dropdown", classNames: local.classNames, unstyled: local.unstyled }, facet.key)),
|
|
945
|
+
rest.length > 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
946
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
947
|
+
"button",
|
|
948
|
+
{
|
|
949
|
+
...more,
|
|
950
|
+
ref: opener,
|
|
951
|
+
type: "button",
|
|
952
|
+
"aria-haspopup": "dialog",
|
|
953
|
+
onClick: () => {
|
|
954
|
+
setContainer(_nullishCoalesce(_optionalChain([opener, 'access', _83 => _83.current, 'optionalAccess', _84 => _84.closest, 'call', _85 => _85(".tsf-root")]), () => ( null)));
|
|
955
|
+
setOpen(true);
|
|
956
|
+
},
|
|
957
|
+
children: t("shop.moreFilters")
|
|
958
|
+
}
|
|
959
|
+
),
|
|
960
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
961
|
+
FilterPanel,
|
|
962
|
+
{
|
|
963
|
+
open,
|
|
964
|
+
onClose: () => setOpen(false),
|
|
965
|
+
container,
|
|
966
|
+
restoreFocusTo: opener.current,
|
|
967
|
+
facets: rest,
|
|
968
|
+
title: t("shop.moreFilters"),
|
|
969
|
+
classNames: local.classNames,
|
|
970
|
+
unstyled: local.unstyled
|
|
971
|
+
}
|
|
972
|
+
)
|
|
973
|
+
] }) : null
|
|
974
|
+
] });
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
// src/shop/FilterSidebar.tsx
|
|
978
|
+
|
|
979
|
+
function FilterSidebar(local) {
|
|
980
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "filter-sidebar", local);
|
|
981
|
+
const head = _chunkVWXJO427cjs.usePart.call(void 0, "filter-sidebar-head", local);
|
|
982
|
+
const title = _chunkVWXJO427cjs.usePart.call(void 0, "filter-sidebar-title", local);
|
|
983
|
+
const clearPart = _chunkVWXJO427cjs.usePart.call(void 0, "filter-clear", local);
|
|
984
|
+
const { t, keyAttr } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
985
|
+
const { facets, query, selectedCount, clear } = useShopAll();
|
|
986
|
+
const shown = visibleFacets(facets, query);
|
|
987
|
+
if (shown.length === 0) return null;
|
|
988
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "aside", { ...root, "aria-label": t("filters.title"), children: [
|
|
989
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...head, children: [
|
|
990
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { ...title, ...keyAttr("filters.title"), children: t("filters.title") }),
|
|
991
|
+
selectedCount > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ...clearPart, type: "button", onClick: () => clear(), children: t("filters.clearAll") }) : null
|
|
992
|
+
] }),
|
|
993
|
+
shown.map((facet) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FacetGroup, { facet, classNames: local.classNames, unstyled: local.unstyled }, facet.key))
|
|
994
|
+
] });
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
// src/shop/LiveRegion.tsx
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
function LiveRegion(local) {
|
|
1001
|
+
const part = _chunkVWXJO427cjs.usePart.call(void 0, "live-region", local);
|
|
1002
|
+
const { status, total, data, announceKey } = useShopAll();
|
|
1003
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1004
|
+
const [message, setMessage] = _react.useState.call(void 0, "");
|
|
1005
|
+
const seen = _react.useRef.call(void 0, null);
|
|
1006
|
+
const count = _nullishCoalesce(_nullishCoalesce(total, () => ( _optionalChain([data, 'optionalAccess', _86 => _86.products, 'access', _87 => _87.length]))), () => ( 0));
|
|
1007
|
+
_react.useEffect.call(void 0, () => {
|
|
1008
|
+
if (status !== "ready" || seen.current === announceKey) return;
|
|
1009
|
+
const first = seen.current === null;
|
|
1010
|
+
seen.current = announceKey;
|
|
1011
|
+
if (!first) setMessage(t("shop.resultsAnnounce", { count }));
|
|
1012
|
+
}, [status, announceKey, count, t]);
|
|
1013
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...part, role: "status", "aria-live": "polite", "aria-atomic": "true", children: message });
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
// src/shop/Pagination.tsx
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
var plainClick = (event) => !(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0);
|
|
1021
|
+
function Numbered(local) {
|
|
1022
|
+
const nav = _chunkVWXJO427cjs.usePart.call(void 0, "pagination", local);
|
|
1023
|
+
const list = _chunkVWXJO427cjs.usePart.call(void 0, "pagination-list", local);
|
|
1024
|
+
const item = _chunkVWXJO427cjs.usePart.call(void 0, "pagination-item", local);
|
|
1025
|
+
const link = _chunkVWXJO427cjs.usePart.call(void 0, "pagination-link", local);
|
|
1026
|
+
const step = _chunkVWXJO427cjs.usePart.call(void 0, "pagination-step", local);
|
|
1027
|
+
const gap = _chunkVWXJO427cjs.usePart.call(void 0, "pagination-gap", local);
|
|
1028
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1029
|
+
const { query, pageCount, hrefFor, setPage } = useShopAll();
|
|
1030
|
+
if (pageCount <= 1) return null;
|
|
1031
|
+
const current = Math.min(query.page, pageCount);
|
|
1032
|
+
const follow = (page) => (event) => {
|
|
1033
|
+
if (!plainClick(event)) return;
|
|
1034
|
+
event.preventDefault();
|
|
1035
|
+
setPage(page);
|
|
1036
|
+
};
|
|
1037
|
+
const stepLink = (page, rel) => {
|
|
1038
|
+
const label = rel === "prev" ? t("listing.previous") : t("listing.next");
|
|
1039
|
+
const icon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: rel === "prev" ? "chevron-left" : "chevron-right", size: 18 });
|
|
1040
|
+
return page >= 1 && page <= pageCount ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { ...step, href: hrefFor({ ...query, page }), rel, "aria-label": label, onClick: follow(page), children: icon }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...step, "aria-hidden": "true", "data-disabled": "", children: icon });
|
|
1041
|
+
};
|
|
1042
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "nav", { ...nav, "aria-label": t("shop.paginationLabel"), "data-style": "numbered", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "ol", { ...list, children: [
|
|
1043
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...item, children: stepLink(current - 1, "prev") }),
|
|
1044
|
+
_chunkNDUEJJLPcjs.pageWindow.call(void 0, current, pageCount).map(
|
|
1045
|
+
(page, index) => page === null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...item, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...gap, "aria-hidden": "true", children: "\u2026" }) }, `gap-${index}`) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...item, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1046
|
+
"a",
|
|
1047
|
+
{
|
|
1048
|
+
...link,
|
|
1049
|
+
href: hrefFor({ ...query, page }),
|
|
1050
|
+
"aria-label": t("shop.pageLabel", { page }),
|
|
1051
|
+
"aria-current": page === current ? "page" : void 0,
|
|
1052
|
+
onClick: follow(page),
|
|
1053
|
+
children: page
|
|
1054
|
+
}
|
|
1055
|
+
) }, page)
|
|
1056
|
+
),
|
|
1057
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...item, children: stepLink(current + 1, "next") })
|
|
1058
|
+
] }) });
|
|
1059
|
+
}
|
|
1060
|
+
function More(local) {
|
|
1061
|
+
const nav = _chunkVWXJO427cjs.usePart.call(void 0, "pagination", local);
|
|
1062
|
+
const link = _chunkVWXJO427cjs.usePart.call(void 0, "pagination-link", local);
|
|
1063
|
+
const more = _chunkVWXJO427cjs.usePart.call(void 0, "pagination-more", local);
|
|
1064
|
+
const crawl = _chunkVWXJO427cjs.usePart.call(void 0, "pagination-crawl", local);
|
|
1065
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1066
|
+
const { query, pageCount, hrefFor, loadMore, status, pagination, firstLoadedPage: first } = useShopAll();
|
|
1067
|
+
const sentinel = _react.useRef.call(void 0, null);
|
|
1068
|
+
const asked = _react.useRef.call(void 0, null);
|
|
1069
|
+
const hasNext = query.page < pageCount;
|
|
1070
|
+
const infinite = pagination === "infinite";
|
|
1071
|
+
_react.useEffect.call(void 0, () => {
|
|
1072
|
+
const node = sentinel.current;
|
|
1073
|
+
if (!infinite || !hasNext || status !== "ready" || !node || typeof IntersectionObserver === "undefined") return;
|
|
1074
|
+
const observer = new IntersectionObserver(
|
|
1075
|
+
(entries) => {
|
|
1076
|
+
if (!entries.some((e) => e.isIntersecting) || asked.current === query.page) return;
|
|
1077
|
+
asked.current = query.page;
|
|
1078
|
+
loadMore();
|
|
1079
|
+
},
|
|
1080
|
+
{ rootMargin: "400px" }
|
|
1081
|
+
);
|
|
1082
|
+
observer.observe(node);
|
|
1083
|
+
return () => observer.disconnect();
|
|
1084
|
+
}, [infinite, hasNext, status, query.page, loadMore]);
|
|
1085
|
+
if (!hasNext && first === 1) return null;
|
|
1086
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "nav", { ...nav, "aria-label": t("shop.paginationLabel"), "data-style": pagination, children: [
|
|
1087
|
+
first > 1 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { ...link, rel: "prev", href: hrefFor({ ...query, page: first - 1 }), children: t("listing.previous") }) : null,
|
|
1088
|
+
hasNext && !infinite ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ...more, type: "button", "aria-disabled": status !== "ready" || void 0, onClick: () => status === "ready" && loadMore(), children: status === "ready" ? t("listing.loadMore") : t("listing.loading") }) : null,
|
|
1089
|
+
hasNext && infinite ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: sentinel, "aria-hidden": "true", "data-sentinel": "" }) : null,
|
|
1090
|
+
hasNext ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { ...crawl, rel: "next", href: hrefFor({ ...query, page: query.page + 1 }), tabIndex: -1, "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.VisuallyHidden, { children: t("listing.next") }) }) : null
|
|
1091
|
+
] });
|
|
1092
|
+
}
|
|
1093
|
+
function Pagination(local) {
|
|
1094
|
+
const { pagination } = useShopAll();
|
|
1095
|
+
return pagination === "numbered" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Numbered, { ...local }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, More, { ...local });
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
// src/shop/ProductGrid.tsx
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
function useColumns() {
|
|
1104
|
+
const { columns } = useShopAll();
|
|
1105
|
+
return { "--tsf-cols-desktop": columns.desktop, "--tsf-cols-mobile": columns.mobile };
|
|
1106
|
+
}
|
|
1107
|
+
function Cards({ answer, previous, local }) {
|
|
1108
|
+
const grid = _chunkVWXJO427cjs.usePart.call(void 0, "product-grid", local);
|
|
1109
|
+
const item = _chunkVWXJO427cjs.usePart.call(void 0, "product-grid-item", local);
|
|
1110
|
+
const { cardVariant, cardMeta, listName, generatedAt, reviewsOnLists, selectProduct } = useShopAll();
|
|
1111
|
+
const style = useColumns();
|
|
1112
|
+
const offset = (answer.page.number - 1) * answer.page.limit;
|
|
1113
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { ...grid, style, "data-page": answer.page.number, "data-previous": previous ? "" : void 0, "aria-busy": previous || void 0, children: answer.products.map((product, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...item, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1114
|
+
_chunkNDUEJJLPcjs.ProductCard,
|
|
1115
|
+
{
|
|
1116
|
+
...local,
|
|
1117
|
+
product,
|
|
1118
|
+
variant: cardVariant,
|
|
1119
|
+
meta: cardMeta,
|
|
1120
|
+
position: offset + i,
|
|
1121
|
+
listName,
|
|
1122
|
+
generatedAt,
|
|
1123
|
+
priceContext: answer.priceContext,
|
|
1124
|
+
reviewsOnLists,
|
|
1125
|
+
onSelect: (p) => selectProduct(p, offset + i)
|
|
1126
|
+
}
|
|
1127
|
+
) }, `${answer.page.number}:${product.handle}:${i}`)) });
|
|
1128
|
+
}
|
|
1129
|
+
function Skeleton({ count, local }) {
|
|
1130
|
+
const grid = _chunkVWXJO427cjs.usePart.call(void 0, "product-grid-skeleton", local);
|
|
1131
|
+
const item = _chunkVWXJO427cjs.usePart.call(void 0, "product-grid-skeleton-item", local);
|
|
1132
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1133
|
+
const style = useColumns();
|
|
1134
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1135
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { ...grid, style, "aria-hidden": "true", children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...item }, i)) }),
|
|
1136
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.VisuallyHidden, { children: t("shop.loadingProducts") })
|
|
1137
|
+
] });
|
|
1138
|
+
}
|
|
1139
|
+
function EarlierSegment({ segment, local }) {
|
|
1140
|
+
const { settings } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1141
|
+
const { reportReady } = useShopAll();
|
|
1142
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1143
|
+
const error = _chunkVWXJO427cjs.usePart.call(void 0, "product-grid-error", local);
|
|
1144
|
+
const retry = _chunkVWXJO427cjs.usePart.call(void 0, "product-grid-retry", local);
|
|
1145
|
+
const result = _react3.useProducts.call(void 0, segment.query, { initialData: segment.seed });
|
|
1146
|
+
const settled = result.data !== void 0 || result.error !== void 0;
|
|
1147
|
+
_react.useEffect.call(void 0, () => {
|
|
1148
|
+
if (settled) reportReady(segment.key);
|
|
1149
|
+
}, [settled, reportReady, segment.key]);
|
|
1150
|
+
if (result.data) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Cards, { answer: result.data, local });
|
|
1151
|
+
if (result.error) {
|
|
1152
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...error, role: "alert", children: [
|
|
1153
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: t("shop.errorLoading") }),
|
|
1154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ...retry, type: "button", onClick: () => void result.refetch(), children: t("shop.retry") })
|
|
1155
|
+
] });
|
|
1156
|
+
}
|
|
1157
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { count: Math.min(settings.listing.pageSize, 8), local });
|
|
1158
|
+
}
|
|
1159
|
+
function ProductGrid(local) {
|
|
1160
|
+
const pages = _chunkVWXJO427cjs.usePart.call(void 0, "product-grid-pages", local);
|
|
1161
|
+
const empty = _chunkVWXJO427cjs.usePart.call(void 0, "product-grid-empty", local);
|
|
1162
|
+
const error = _chunkVWXJO427cjs.usePart.call(void 0, "product-grid-error", local);
|
|
1163
|
+
const retry = _chunkVWXJO427cjs.usePart.call(void 0, "product-grid-retry", local);
|
|
1164
|
+
const clearPart = _chunkVWXJO427cjs.usePart.call(void 0, "filter-clear", local);
|
|
1165
|
+
const { settings } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1166
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1167
|
+
const { status, data, isPrevious, pagination, source, selectedCount, total, clear, refetch, earlier } = useShopAll();
|
|
1168
|
+
const sub = { classNames: local.classNames, unstyled: local.unstyled };
|
|
1169
|
+
const loadMode = pagination !== "numbered";
|
|
1170
|
+
if (!data && status === "error") {
|
|
1171
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...error, role: "alert", children: [
|
|
1172
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: t("shop.errorLoading") }),
|
|
1173
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ...retry, type: "button", onClick: refetch, children: t("shop.retry") })
|
|
1174
|
+
] });
|
|
1175
|
+
}
|
|
1176
|
+
const skeleton = Math.min(settings.listing.pageSize, 8);
|
|
1177
|
+
const current = data && !(loadMode && isPrevious) ? data : void 0;
|
|
1178
|
+
if (!current && earlier.length === 0) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { count: skeleton, local: sub });
|
|
1179
|
+
if (data && !isPrevious && data.products.length === 0 && earlier.length === 0) {
|
|
1180
|
+
const pastEnd = (_nullishCoalesce(total, () => ( 0))) > 0;
|
|
1181
|
+
const message = pastEnd ? t("shop.pastEnd") : selectedCount > 0 ? t("empty.listing") : source.kind === "collection" ? t("empty.collection") : source.kind === "category" ? t("empty.category") : source.kind === "search" ? t("empty.search") : t("empty.listing");
|
|
1182
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...empty, children: [
|
|
1183
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: message }),
|
|
1184
|
+
selectedCount > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ...clearPart, type: "button", onClick: () => clear(), children: t("filters.clearAll") }) : null
|
|
1185
|
+
] });
|
|
1186
|
+
}
|
|
1187
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...pages, "data-pagination": pagination, children: [
|
|
1188
|
+
earlier.map((segment) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EarlierSegment, { segment, local: sub }, segment.key)),
|
|
1189
|
+
current ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Cards, { answer: current, previous: isPrevious, local: sub }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { count: skeleton, local: sub })
|
|
1190
|
+
] });
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
// src/shop/ResultCount.tsx
|
|
1194
|
+
|
|
1195
|
+
function ResultCount(local) {
|
|
1196
|
+
const part = _chunkVWXJO427cjs.usePart.call(void 0, "result-count", local);
|
|
1197
|
+
const { total } = useShopAll();
|
|
1198
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1199
|
+
if (total === void 0) return null;
|
|
1200
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...part, children: total === 1 ? t("shop.countOne", { count: total }) : t("listing.count", { count: total }) });
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
// src/shop/SortSelect.tsx
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
function SortSelect(local) {
|
|
1207
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "sort-select", local);
|
|
1208
|
+
const label = _chunkVWXJO427cjs.usePart.call(void 0, "sort-select-label", local);
|
|
1209
|
+
const input = _chunkVWXJO427cjs.usePart.call(void 0, "sort-select-input", local);
|
|
1210
|
+
const id = _react.useId.call(void 0, );
|
|
1211
|
+
const { settings } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1212
|
+
const { t, keyAttr } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1213
|
+
const { query, data, isPrevious, setSort, manualCollection } = useShopAll();
|
|
1214
|
+
const options = settings.listing.sorts.filter(
|
|
1215
|
+
(s) => s.enabled && (s.key !== "relevance" || Boolean(query.q)) && (s.key !== "manual" || manualCollection)
|
|
1216
|
+
);
|
|
1217
|
+
if (options.length === 0) return null;
|
|
1218
|
+
const applied = query.sort !== settings.listing.defaultSort ? query.sort : !isPrevious && data ? data.sort : query.sort;
|
|
1219
|
+
const value = options.some((o) => o.key === applied) ? applied : options[0].key;
|
|
1220
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...root, children: [
|
|
1221
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { ...label, ...keyAttr("sort.label"), htmlFor: id, children: t("sort.label") }),
|
|
1222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "select", { ...input, id, value, onChange: (event) => setSort(event.target.value), children: options.map((o) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: o.key, "data-sort-option": o.key, children: o.label || o.key }, o.key)) })
|
|
1223
|
+
] });
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
// src/shop/ShopAll.tsx
|
|
1227
|
+
|
|
1228
|
+
function Root({ children, className, classNames, unstyled, ...options }) {
|
|
1229
|
+
const { settings } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1230
|
+
const filterLayout = _nullishCoalesce(options.filterLayout, () => ( settings.listing.filterLayout));
|
|
1231
|
+
const pagination = _nullishCoalesce(options.pagination, () => ( settings.listing.pagination));
|
|
1232
|
+
const columns = _nullishCoalesce(options.columns, () => ( settings.listing.columns));
|
|
1233
|
+
const state = useShopAllState({ source: options.source, initialData: options.initialData, pagination });
|
|
1234
|
+
const part = _chunkVWXJO427cjs.usePart.call(void 0, "shop-all", { classNames, className, unstyled });
|
|
1235
|
+
const { cardVariant, cardMeta, baseUrl = "", jsonLd = true } = options;
|
|
1236
|
+
const value = _react.useMemo.call(void 0,
|
|
1237
|
+
() => ({
|
|
1238
|
+
...state,
|
|
1239
|
+
filterLayout,
|
|
1240
|
+
pagination,
|
|
1241
|
+
columns: { desktop: columns.desktop, mobile: columns.mobile },
|
|
1242
|
+
...cardVariant ? { cardVariant } : {},
|
|
1243
|
+
...cardMeta ? { cardMeta } : {},
|
|
1244
|
+
baseUrl,
|
|
1245
|
+
jsonLd
|
|
1246
|
+
}),
|
|
1247
|
+
[state, filterLayout, pagination, columns.desktop, columns.mobile, cardVariant, cardMeta, baseUrl, jsonLd]
|
|
1248
|
+
);
|
|
1249
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ShopAllContext.Provider, { value, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1250
|
+
"div",
|
|
1251
|
+
{
|
|
1252
|
+
...part,
|
|
1253
|
+
ref: state.topRef,
|
|
1254
|
+
"data-listing": "",
|
|
1255
|
+
"data-listing-page-size": settings.listing.pageSize,
|
|
1256
|
+
"data-filter-layout": filterLayout,
|
|
1257
|
+
"data-pagination": pagination,
|
|
1258
|
+
"data-source": options.source.kind,
|
|
1259
|
+
children: [
|
|
1260
|
+
children,
|
|
1261
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LiveRegion, { classNames, unstyled }),
|
|
1262
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ShopJsonLd, {})
|
|
1263
|
+
]
|
|
1264
|
+
}
|
|
1265
|
+
) });
|
|
1266
|
+
}
|
|
1267
|
+
function useListingContext() {
|
|
1268
|
+
const { source, total, query } = useShopAll();
|
|
1269
|
+
return {
|
|
1270
|
+
kind: "listing",
|
|
1271
|
+
listing: { source, total: _nullishCoalesce(total, () => ( 0)), filters: query.filters, sort: query.sort, page: query.page }
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
function SlotAbove() {
|
|
1275
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNDUEJJLPcjs.SlotOutlet, { name: "shop.above", context: useListingContext() });
|
|
1276
|
+
}
|
|
1277
|
+
function SlotBelow() {
|
|
1278
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNDUEJJLPcjs.SlotOutlet, { name: "shop.below", context: useListingContext() });
|
|
1279
|
+
}
|
|
1280
|
+
function ShopJsonLd() {
|
|
1281
|
+
const { settings } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1282
|
+
const { jsonLd, baseUrl, data, isPrevious, query, breadcrumbs } = useShopAll();
|
|
1283
|
+
if (!jsonLd) return null;
|
|
1284
|
+
const origin = baseUrl.replace(/\/+$/u, "");
|
|
1285
|
+
const products = data && !isPrevious ? data.products : [];
|
|
1286
|
+
const first = ((_nullishCoalesce(_optionalChain([data, 'optionalAccess', _88 => _88.page, 'access', _89 => _89.number]), () => ( query.page))) - 1) * (_nullishCoalesce(_optionalChain([data, 'optionalAccess', _90 => _90.page, 'access', _91 => _91.limit]), () => ( settings.listing.pageSize))) + 1;
|
|
1287
|
+
const list = _chunkNDUEJJLPcjs.itemListJsonLd.call(void 0, products, { baseUrl, settings });
|
|
1288
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1289
|
+
products.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNDUEJJLPcjs.JsonLd, { data: { ...list, itemListElement: list.itemListElement.map((e, i) => ({ ...e, position: first + i })) } }) : null,
|
|
1290
|
+
breadcrumbs.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNDUEJJLPcjs.JsonLd, { data: _chunkNDUEJJLPcjs.breadcrumbJsonLd.call(void 0, breadcrumbs.map((c) => ({ name: c.name, url: `${origin}${c.href}` }))) }) : null
|
|
1291
|
+
] });
|
|
1292
|
+
}
|
|
1293
|
+
function Breadcrumbs2(local) {
|
|
1294
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "shop-all-breadcrumbs", local);
|
|
1295
|
+
const list = _chunkVWXJO427cjs.usePart.call(void 0, "shop-all-breadcrumb-list", local);
|
|
1296
|
+
const item = _chunkVWXJO427cjs.usePart.call(void 0, "shop-all-breadcrumb", local);
|
|
1297
|
+
const link = _chunkVWXJO427cjs.usePart.call(void 0, "shop-all-breadcrumb-link", local);
|
|
1298
|
+
const { Link: Link2 } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1299
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1300
|
+
const { breadcrumbs } = useShopAll();
|
|
1301
|
+
if (breadcrumbs.length === 0) return null;
|
|
1302
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "nav", { ...root, "aria-label": t("shop.breadcrumbs"), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ol", { ...list, children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...item, children: i === breadcrumbs.length - 1 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "aria-current": "page", children: crumb.name }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Link2, { ...link, href: crumb.href, children: crumb.name }) }, crumb.href)) }) });
|
|
1303
|
+
}
|
|
1304
|
+
function Heading(local) {
|
|
1305
|
+
const heading = _chunkVWXJO427cjs.usePart.call(void 0, "shop-all-heading", local);
|
|
1306
|
+
const description = _chunkVWXJO427cjs.usePart.call(void 0, "shop-all-description", local);
|
|
1307
|
+
const { t, keyAttr } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1308
|
+
const { source, title, description: text } = useShopAll();
|
|
1309
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1310
|
+
source.kind === "all" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { ...heading, ...keyAttr("shop.title"), children: t("shop.title") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { ...heading, "data-collection-title": source.kind === "collection" ? "" : void 0, children: title }),
|
|
1311
|
+
text ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...description, children: text }) : null
|
|
1312
|
+
] });
|
|
1313
|
+
}
|
|
1314
|
+
function DefaultLayout(local) {
|
|
1315
|
+
const controls = _chunkVWXJO427cjs.usePart.call(void 0, "shop-all-controls", local);
|
|
1316
|
+
const tools = _chunkVWXJO427cjs.usePart.call(void 0, "shop-all-tools", local);
|
|
1317
|
+
const body = _chunkVWXJO427cjs.usePart.call(void 0, "shop-all-body", local);
|
|
1318
|
+
const main = _chunkVWXJO427cjs.usePart.call(void 0, "shop-all-main", local);
|
|
1319
|
+
const { filterLayout } = useShopAll();
|
|
1320
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Breadcrumbs2, { ...local }),
|
|
1322
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Heading, { ...local }),
|
|
1323
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SlotAbove, {}),
|
|
1324
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...controls, children: [
|
|
1325
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ResultCount, { ...local }),
|
|
1326
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...tools, children: [
|
|
1327
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, FilterDrawer, { ...local }),
|
|
1328
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SortSelect, { ...local })
|
|
1329
|
+
] })
|
|
1330
|
+
] }),
|
|
1331
|
+
filterLayout === "topbar" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FilterBar, { ...local }) : null,
|
|
1332
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ActiveFilters, { ...local }),
|
|
1333
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...body, "data-layout": filterLayout, children: [
|
|
1334
|
+
filterLayout === "sidebar" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FilterSidebar, { ...local }) : null,
|
|
1335
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...main, children: [
|
|
1336
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductGrid, { ...local }),
|
|
1337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Pagination, { ...local })
|
|
1338
|
+
] })
|
|
1339
|
+
] }),
|
|
1340
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SlotBelow, {})
|
|
1341
|
+
] });
|
|
1342
|
+
}
|
|
1343
|
+
function ShopAllPage({ children, ...props }) {
|
|
1344
|
+
const local = { classNames: props.classNames, unstyled: props.unstyled };
|
|
1345
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ...props, children: _nullishCoalesce(children, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultLayout, { ...local }))) });
|
|
1346
|
+
}
|
|
1347
|
+
var ShopAll = Object.assign(ShopAllPage, {
|
|
1348
|
+
Root,
|
|
1349
|
+
Heading,
|
|
1350
|
+
Breadcrumbs: Breadcrumbs2,
|
|
1351
|
+
FilterSidebar,
|
|
1352
|
+
FilterBar,
|
|
1353
|
+
FilterDrawer,
|
|
1354
|
+
ActiveFilters,
|
|
1355
|
+
SortSelect,
|
|
1356
|
+
ResultCount,
|
|
1357
|
+
ProductGrid,
|
|
1358
|
+
Pagination,
|
|
1359
|
+
SlotAbove,
|
|
1360
|
+
SlotBelow
|
|
1361
|
+
});
|
|
1362
|
+
|
|
1363
|
+
// src/shopper/CartDrawer.tsx
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
var CartPanel = _react.lazy.call(void 0, () => Promise.resolve().then(() => _interopRequireWildcard(require("./chunk-WIIOJDHR.cjs"))).then((m) => ({ default: m.CartDrawerBody })));
|
|
1367
|
+
function CartDrawer({ inline, ...local }) {
|
|
1368
|
+
const { open } = _chunk2LCPIY2Pcjs.useCartDrawer.call(void 0, );
|
|
1369
|
+
const [wanted, setWanted] = _react.useState.call(void 0, false);
|
|
1370
|
+
if (open && !wanted) setWanted(true);
|
|
1371
|
+
if (!inline && !wanted) return null;
|
|
1372
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Suspense, { fallback: null, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CartPanel, { inline, ...local }) });
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
// src/frame/AnnouncementBar.tsx
|
|
1376
|
+
|
|
1377
|
+
|
|
1378
|
+
|
|
1379
|
+
// src/frame/menu.ts
|
|
1380
|
+
var KINDS = /* @__PURE__ */ new Set(["category", "collection", "product", "page", "search", "url"]);
|
|
1381
|
+
var SAFE_SCHEME = /^(https?|mailto|tel):/i;
|
|
1382
|
+
var ANY_SCHEME = /^[a-z][a-z0-9+.-]*:/i;
|
|
1383
|
+
var MAX_DEPTH = 4;
|
|
1384
|
+
function safeHref(href) {
|
|
1385
|
+
if (typeof href !== "string") return null;
|
|
1386
|
+
const bare = href.replace(/[\p{Cc}\s]/gu, "");
|
|
1387
|
+
if (bare === "") return null;
|
|
1388
|
+
if (SAFE_SCHEME.test(bare)) return href.trim();
|
|
1389
|
+
if (ANY_SCHEME.test(bare)) return null;
|
|
1390
|
+
return href.trim();
|
|
1391
|
+
}
|
|
1392
|
+
function cleanMenuItems(items, depth = 0) {
|
|
1393
|
+
if (!Array.isArray(items) || depth >= MAX_DEPTH) return [];
|
|
1394
|
+
return items.flatMap((item) => {
|
|
1395
|
+
if (typeof item !== "object" || item === null) return [];
|
|
1396
|
+
const { label, href, kind, handle, children } = item;
|
|
1397
|
+
if (typeof label !== "string" || label.trim() === "") return [];
|
|
1398
|
+
const link = safeHref(href);
|
|
1399
|
+
if (link === null) return [];
|
|
1400
|
+
if (children !== void 0 && !Array.isArray(children)) return [];
|
|
1401
|
+
const out = { label, href: link };
|
|
1402
|
+
if (typeof kind === "string" && KINDS.has(kind)) out.kind = kind;
|
|
1403
|
+
if (typeof handle === "string") out.handle = handle;
|
|
1404
|
+
const nested = cleanMenuItems(children, depth + 1);
|
|
1405
|
+
if (nested.length > 0) out.children = nested;
|
|
1406
|
+
return [out];
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
// src/frame/AnnouncementBar.tsx
|
|
1411
|
+
|
|
1412
|
+
var STORAGE_KEY = "throttle-storefront-announcement-dismissed";
|
|
1413
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
1414
|
+
function hashOf(text) {
|
|
1415
|
+
let hash = 5381;
|
|
1416
|
+
for (let i = 0; i < text.length; i++) hash = (hash << 5) + hash + text.charCodeAt(i) | 0;
|
|
1417
|
+
return (hash >>> 0).toString(36);
|
|
1418
|
+
}
|
|
1419
|
+
function readDismissed() {
|
|
1420
|
+
try {
|
|
1421
|
+
return window.localStorage.getItem(STORAGE_KEY);
|
|
1422
|
+
} catch (e4) {
|
|
1423
|
+
return null;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
function subscribe(listener) {
|
|
1427
|
+
listeners.add(listener);
|
|
1428
|
+
window.addEventListener("storage", listener);
|
|
1429
|
+
return () => {
|
|
1430
|
+
listeners.delete(listener);
|
|
1431
|
+
window.removeEventListener("storage", listener);
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
function moveFocusAway() {
|
|
1435
|
+
const target = document.querySelector('[data-throttle-part="header"], main');
|
|
1436
|
+
_optionalChain([target, 'optionalAccess', _92 => _92.focus, 'call', _93 => _93()]);
|
|
1437
|
+
}
|
|
1438
|
+
function dismiss(hash) {
|
|
1439
|
+
moveFocusAway();
|
|
1440
|
+
try {
|
|
1441
|
+
window.localStorage.setItem(STORAGE_KEY, hash);
|
|
1442
|
+
} catch (e5) {
|
|
1443
|
+
}
|
|
1444
|
+
listeners.forEach((l) => l());
|
|
1445
|
+
}
|
|
1446
|
+
function AnnouncementBar(props) {
|
|
1447
|
+
const { site, Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1448
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1449
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "announcement-bar", props);
|
|
1450
|
+
const text = _chunkVWXJO427cjs.usePart.call(void 0, "announcement-bar-text", props);
|
|
1451
|
+
const close = _chunkVWXJO427cjs.usePart.call(void 0, "announcement-bar-dismiss", props);
|
|
1452
|
+
const announcement = site.announcement;
|
|
1453
|
+
const hash = announcement ? hashOf(`${announcement.message}
|
|
1454
|
+
${_nullishCoalesce(announcement.href, () => ( ""))}`) : "";
|
|
1455
|
+
const dismissed = _react.useSyncExternalStore.call(void 0, subscribe, readDismissed, () => null) === hash;
|
|
1456
|
+
if (!announcement || announcement.message.trim() === "" || dismissed) return null;
|
|
1457
|
+
const href = safeHref(announcement.href);
|
|
1458
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...root, role: "region", "aria-label": t("frame.announcement.label"), children: [
|
|
1459
|
+
href ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...text, href, "data-throttle-setting": "announcement", children: announcement.message }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...text, "data-throttle-setting": "announcement", children: announcement.message }),
|
|
1460
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", ...close, "aria-label": t("frame.announcement.dismiss"), onClick: () => dismiss(hash), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "close", size: 16 }) })
|
|
1461
|
+
] });
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
// src/frame/Footer.tsx
|
|
1465
|
+
|
|
1466
|
+
function FooterList({ items, nested, local }) {
|
|
1467
|
+
const { Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1468
|
+
const list = _chunkVWXJO427cjs.usePart.call(void 0, nested ? "footer-sublist" : "footer-list", local);
|
|
1469
|
+
const item = _chunkVWXJO427cjs.usePart.call(void 0, "footer-item", local);
|
|
1470
|
+
const link = _chunkVWXJO427cjs.usePart.call(void 0, "footer-link", local);
|
|
1471
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { ...list, children: items.map((entry) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { ...item, children: [
|
|
1472
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...link, href: entry.href, children: entry.label }),
|
|
1473
|
+
entry.children ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FooterList, { items: entry.children, nested: true, local }) : null
|
|
1474
|
+
] }, `${entry.href}|${entry.label}`)) });
|
|
1475
|
+
}
|
|
1476
|
+
function Footer({ year, brand, children, ...local }) {
|
|
1477
|
+
const { site } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1478
|
+
const { t, keyAttr } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1479
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "footer", local);
|
|
1480
|
+
const brandPart = _chunkVWXJO427cjs.usePart.call(void 0, "footer-brand", local);
|
|
1481
|
+
const extra = _chunkVWXJO427cjs.usePart.call(void 0, "footer-extra", local);
|
|
1482
|
+
const nav = _chunkVWXJO427cjs.usePart.call(void 0, "footer-nav", local);
|
|
1483
|
+
const copyright = _chunkVWXJO427cjs.usePart.call(void 0, "footer-copyright", local);
|
|
1484
|
+
const items = cleanMenuItems(site.menus.footer);
|
|
1485
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "footer", { ...root, children: [
|
|
1486
|
+
brand ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...brandPart, children: brand }) : null,
|
|
1487
|
+
items.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "nav", { ...nav, "aria-label": t("frame.footer.label"), "data-menu": "footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FooterList, { items, local }) }) : null,
|
|
1488
|
+
children ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...extra, children }) : null,
|
|
1489
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...copyright, ...keyAttr("footer.copyright"), suppressHydrationWarning: true, children: t("footer.copyright", { year: _nullishCoalesce(year, () => ( (/* @__PURE__ */ new Date()).getFullYear())), store: site.brand.storeName }) })
|
|
1490
|
+
] });
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
// src/frame/Header.tsx
|
|
1494
|
+
|
|
1495
|
+
|
|
1496
|
+
|
|
1497
|
+
|
|
1498
|
+
// src/frame/AccountButton.tsx
|
|
1499
|
+
|
|
1500
|
+
|
|
1501
|
+
function AccountButton({ href = "/account", ...local }) {
|
|
1502
|
+
const { Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1503
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1504
|
+
const part = _chunkVWXJO427cjs.usePart.call(void 0, "account-button", local);
|
|
1505
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...part, href, "aria-label": t("nav.account"), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "user", size: 22 }) });
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
// src/frame/CartButton.tsx
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
|
|
1512
|
+
function CartButton(props) {
|
|
1513
|
+
const { currency } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1514
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1515
|
+
const drawer = _chunk2LCPIY2Pcjs.useCartDrawer.call(void 0, );
|
|
1516
|
+
const cart = _react3.useCart.call(void 0, currency ? { currency } : void 0);
|
|
1517
|
+
const count = _nullishCoalesce(_optionalChain([cart, 'access', _94 => _94.cart, 'optionalAccess', _95 => _95.unitCount]), () => ( 0));
|
|
1518
|
+
const part = _chunkVWXJO427cjs.usePart.call(void 0, "cart-button", props);
|
|
1519
|
+
const badge = _chunkVWXJO427cjs.usePart.call(void 0, "cart-button-count", props);
|
|
1520
|
+
const label = count === 1 ? t("frame.cart.labelOne") : t("frame.cart.label", { count });
|
|
1521
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1522
|
+
"button",
|
|
1523
|
+
{
|
|
1524
|
+
type: "button",
|
|
1525
|
+
...part,
|
|
1526
|
+
"aria-label": label,
|
|
1527
|
+
"aria-haspopup": "dialog",
|
|
1528
|
+
"aria-expanded": drawer.open,
|
|
1529
|
+
onClick: () => drawer.setOpen(true),
|
|
1530
|
+
children: [
|
|
1531
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "cart", size: 22 }),
|
|
1532
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...badge, "aria-hidden": "true", "data-cart-count": count, "data-empty": count === 0 ? "" : void 0, children: count })
|
|
1533
|
+
]
|
|
1534
|
+
}
|
|
1535
|
+
);
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
// src/frame/CategoryNav.tsx
|
|
1539
|
+
|
|
1540
|
+
|
|
1541
|
+
|
|
1542
|
+
function CategoryNav(props) {
|
|
1543
|
+
const { items, source, stacked = false } = props;
|
|
1544
|
+
const { dir } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1545
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1546
|
+
const id = _react.useId.call(void 0, );
|
|
1547
|
+
const [open, setOpen] = _react.useState.call(void 0, null);
|
|
1548
|
+
const enterList = _react.useRef.call(void 0, null);
|
|
1549
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "category-nav", props);
|
|
1550
|
+
const list = _chunkVWXJO427cjs.usePart.call(void 0, "category-nav-list", props);
|
|
1551
|
+
const item = _chunkVWXJO427cjs.usePart.call(void 0, "category-nav-item", props);
|
|
1552
|
+
const link = _chunkVWXJO427cjs.usePart.call(void 0, "category-nav-link", props);
|
|
1553
|
+
const toggle = _chunkVWXJO427cjs.usePart.call(void 0, "category-nav-toggle", props);
|
|
1554
|
+
const panel = _chunkVWXJO427cjs.usePart.call(void 0, "category-nav-panel", props);
|
|
1555
|
+
const child = _chunkVWXJO427cjs.usePart.call(void 0, "category-nav-child", props);
|
|
1556
|
+
const listRef = _react.useRef.call(void 0, null);
|
|
1557
|
+
_react.useEffect.call(void 0, () => {
|
|
1558
|
+
if (enterList.current === null) return;
|
|
1559
|
+
const at = enterList.current;
|
|
1560
|
+
enterList.current = null;
|
|
1561
|
+
const entry = _optionalChain([listRef, 'access', _96 => _96.current, 'optionalAccess', _97 => _97.querySelectorAll, 'call', _98 => _98(":scope > li"), 'access', _99 => _99[at]]);
|
|
1562
|
+
_optionalChain([entry, 'optionalAccess', _100 => _100.querySelector, 'call', _101 => _101("[data-nav-panel] a"), 'optionalAccess', _102 => _102.focus, 'call', _103 => _103()]);
|
|
1563
|
+
}, [open]);
|
|
1564
|
+
const tops = () => [..._nullishCoalesce(_optionalChain([listRef, 'access', _104 => _104.current, 'optionalAccess', _105 => _105.querySelectorAll, 'call', _106 => _106(":scope > li > a")]), () => ( []))];
|
|
1565
|
+
const onKeyDown = (event) => {
|
|
1566
|
+
const target = event.target;
|
|
1567
|
+
const entry = target.closest("li[data-nav-top]");
|
|
1568
|
+
const index = entry ? [..._nullishCoalesce(_optionalChain([listRef, 'access', _107 => _107.current, 'optionalAccess', _108 => _108.children]), () => ( []))].indexOf(entry) : -1;
|
|
1569
|
+
if (event.key === "Escape" && open !== null) {
|
|
1570
|
+
event.preventDefault();
|
|
1571
|
+
setOpen(null);
|
|
1572
|
+
_optionalChain([tops, 'call', _109 => _109(), 'access', _110 => _110[open], 'optionalAccess', _111 => _111.focus, 'call', _112 => _112()]);
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
const inPanel = target.closest("[data-nav-panel]");
|
|
1576
|
+
if (inPanel) {
|
|
1577
|
+
const links = [...inPanel.querySelectorAll("a")];
|
|
1578
|
+
const at2 = links.indexOf(target);
|
|
1579
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
1580
|
+
event.preventDefault();
|
|
1581
|
+
const step = event.key === "ArrowDown" ? 1 : -1;
|
|
1582
|
+
_optionalChain([links, 'access', _113 => _113[(at2 + step + links.length) % links.length], 'optionalAccess', _114 => _114.focus, 'call', _115 => _115()]);
|
|
1583
|
+
}
|
|
1584
|
+
return;
|
|
1585
|
+
}
|
|
1586
|
+
const all = tops();
|
|
1587
|
+
const at = all.indexOf(target);
|
|
1588
|
+
if (at < 0) return;
|
|
1589
|
+
const forward = dir === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
1590
|
+
const back = dir === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
1591
|
+
if (event.key === forward || event.key === back) {
|
|
1592
|
+
event.preventDefault();
|
|
1593
|
+
const step = event.key === forward ? 1 : -1;
|
|
1594
|
+
_optionalChain([all, 'access', _116 => _116[(at + step + all.length) % all.length], 'optionalAccess', _117 => _117.focus, 'call', _118 => _118()]);
|
|
1595
|
+
} else if (event.key === "Home" || event.key === "End") {
|
|
1596
|
+
event.preventDefault();
|
|
1597
|
+
_optionalChain([all, 'access', _119 => _119[event.key === "Home" ? 0 : all.length - 1], 'optionalAccess', _120 => _120.focus, 'call', _121 => _121()]);
|
|
1598
|
+
} else if (event.key === "ArrowDown" && _optionalChain([items, 'access', _122 => _122[index], 'optionalAccess', _123 => _123.children])) {
|
|
1599
|
+
event.preventDefault();
|
|
1600
|
+
if (stacked || open === index) {
|
|
1601
|
+
_optionalChain([target, 'access', _124 => _124.closest, 'call', _125 => _125("li"), 'optionalAccess', _126 => _126.querySelector, 'call', _127 => _127("[data-nav-panel] a"), 'optionalAccess', _128 => _128.focus, 'call', _129 => _129()]);
|
|
1602
|
+
} else {
|
|
1603
|
+
enterList.current = index;
|
|
1604
|
+
setOpen(index);
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
};
|
|
1608
|
+
const onBlur = (event, index) => {
|
|
1609
|
+
if (open === index && !event.currentTarget.contains(event.relatedTarget)) setOpen(null);
|
|
1610
|
+
};
|
|
1611
|
+
const label = _nullishCoalesce(props.label, () => ( t(source === "menu" ? "frame.header.mainNav" : "frame.header.categoriesNav")));
|
|
1612
|
+
const parentOf = (entry, parent) => source === "categories" && entry.kind === "category" && entry.handle !== void 0 ? { "data-category-handle": entry.handle, "data-category-parent": parent } : entry.kind === "category" && entry.handle !== void 0 ? { "data-category-handle": entry.handle } : {};
|
|
1613
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "nav", { ...root, "aria-label": label, "data-menu": source === "menu" ? "header" : void 0, onKeyDown, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { ...list, ref: listRef, "data-stacked": stacked ? "true" : void 0, children: items.map((entry, index) => {
|
|
1614
|
+
const children = entry.children;
|
|
1615
|
+
const shown = children !== void 0 && (stacked || open === index);
|
|
1616
|
+
const panelId = `${id}-${index}`;
|
|
1617
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1618
|
+
"li",
|
|
1619
|
+
{
|
|
1620
|
+
...item,
|
|
1621
|
+
"data-nav-top": "",
|
|
1622
|
+
"data-stacked": stacked ? "true" : void 0,
|
|
1623
|
+
"data-open": shown ? "" : void 0,
|
|
1624
|
+
...parentOf(entry, ""),
|
|
1625
|
+
onMouseEnter: children && !stacked ? () => setOpen(index) : void 0,
|
|
1626
|
+
onMouseLeave: children && !stacked ? () => setOpen((v) => v === index ? null : v) : void 0,
|
|
1627
|
+
onBlur: (event) => onBlur(event, index),
|
|
1628
|
+
children: [
|
|
1629
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, NavLink, { entry, part: link }),
|
|
1630
|
+
children && !stacked ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1631
|
+
"button",
|
|
1632
|
+
{
|
|
1633
|
+
type: "button",
|
|
1634
|
+
...toggle,
|
|
1635
|
+
"aria-expanded": shown,
|
|
1636
|
+
"aria-controls": panelId,
|
|
1637
|
+
"aria-label": t("frame.nav.submenu", { name: entry.label }),
|
|
1638
|
+
onClick: () => setOpen(shown ? null : index),
|
|
1639
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "chevron-down", size: 14 })
|
|
1640
|
+
}
|
|
1641
|
+
) : null,
|
|
1642
|
+
children ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { ...panel, id: panelId, "data-nav-panel": "", "data-stacked": stacked ? "true" : void 0, hidden: !shown, children: children.map((sub) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...child, ...parentOf(sub, _nullishCoalesce(entry.handle, () => ( ""))), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NavLink, { entry: sub, part: link }) }, `${sub.href}|${sub.label}`)) }) : null
|
|
1643
|
+
]
|
|
1644
|
+
},
|
|
1645
|
+
`${entry.href}|${entry.label}`
|
|
1646
|
+
);
|
|
1647
|
+
}) }) });
|
|
1648
|
+
}
|
|
1649
|
+
function NavLink({ entry, part }) {
|
|
1650
|
+
const { Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1651
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...part, href: entry.href, children: entry.label });
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
// src/frame/CurrencySwitch.tsx
|
|
1655
|
+
|
|
1656
|
+
|
|
1657
|
+
|
|
1658
|
+
function CurrencySwitch(props) {
|
|
1659
|
+
const { onChange } = props;
|
|
1660
|
+
const { currency } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1661
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1662
|
+
const id = _react.useId.call(void 0, );
|
|
1663
|
+
const [busy, setBusy] = _react.useState.call(void 0, false);
|
|
1664
|
+
const config = _react3.useConfig.call(void 0, { enabled: props.currencies === void 0 });
|
|
1665
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "currency-switch", props);
|
|
1666
|
+
const label = _chunkVWXJO427cjs.usePart.call(void 0, "currency-switch-label", props);
|
|
1667
|
+
const select = _chunkVWXJO427cjs.usePart.call(void 0, "currency-switch-select", props);
|
|
1668
|
+
const offered = _nullishCoalesce(_nullishCoalesce(props.currencies, () => ( _optionalChain([config, 'access', _130 => _130.data, 'optionalAccess', _131 => _131.currencies]))), () => ( []));
|
|
1669
|
+
if (!onChange || offered.length < 2) return null;
|
|
1670
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...root, children: [
|
|
1671
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { ...label, htmlFor: id, children: t("frame.currency.label") }),
|
|
1672
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1673
|
+
"select",
|
|
1674
|
+
{
|
|
1675
|
+
...select,
|
|
1676
|
+
id,
|
|
1677
|
+
value: currency !== void 0 && offered.includes(currency) ? currency : offered[0],
|
|
1678
|
+
"aria-busy": busy || void 0,
|
|
1679
|
+
onChange: async (e) => {
|
|
1680
|
+
if (busy) return;
|
|
1681
|
+
setBusy(true);
|
|
1682
|
+
try {
|
|
1683
|
+
await onChange(e.target.value);
|
|
1684
|
+
} finally {
|
|
1685
|
+
setBusy(false);
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1688
|
+
children: offered.map((code) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: code, "data-currency-option": code, children: code }, code))
|
|
1689
|
+
}
|
|
1690
|
+
)
|
|
1691
|
+
] });
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
// src/frame/LocaleSwitch.tsx
|
|
1695
|
+
|
|
1696
|
+
|
|
1697
|
+
|
|
1698
|
+
function nativeName(locale) {
|
|
1699
|
+
try {
|
|
1700
|
+
const name = new Intl.DisplayNames([locale], { type: "language" }).of(locale);
|
|
1701
|
+
return name ? name.charAt(0).toLocaleUpperCase(locale) + name.slice(1) : locale;
|
|
1702
|
+
} catch (e6) {
|
|
1703
|
+
return locale;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
function LocaleSwitch(props) {
|
|
1707
|
+
const { onChange } = props;
|
|
1708
|
+
const { locale } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1709
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1710
|
+
const id = _react.useId.call(void 0, );
|
|
1711
|
+
const config = _react3.useConfig.call(void 0, { enabled: props.locales === void 0 });
|
|
1712
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "locale-switch", props);
|
|
1713
|
+
const label = _chunkVWXJO427cjs.usePart.call(void 0, "locale-switch-label", props);
|
|
1714
|
+
const select = _chunkVWXJO427cjs.usePart.call(void 0, "locale-switch-select", props);
|
|
1715
|
+
const offered = _nullishCoalesce(_nullishCoalesce(props.locales, () => ( _optionalChain([config, 'access', _132 => _132.data, 'optionalAccess', _133 => _133.locales]))), () => ( []));
|
|
1716
|
+
if (!onChange || offered.length < 2) return null;
|
|
1717
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...root, children: [
|
|
1718
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { ...label, htmlFor: id, children: t("frame.locale.label") }),
|
|
1719
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "select", { ...select, id, value: offered.includes(locale) ? locale : offered[0], onChange: (e) => onChange(e.target.value), children: offered.map((code) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: code, lang: code, "data-locale-option": code, children: nativeName(code) }, code)) })
|
|
1720
|
+
] });
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
// src/frame/SearchBox.tsx
|
|
1724
|
+
|
|
1725
|
+
|
|
1726
|
+
|
|
1727
|
+
|
|
1728
|
+
var DEBOUNCE_MS = 150;
|
|
1729
|
+
var LIMIT = 8;
|
|
1730
|
+
var MIN_CHARS = 2;
|
|
1731
|
+
var END = Number.POSITIVE_INFINITY;
|
|
1732
|
+
function groupsOf(answer, href) {
|
|
1733
|
+
const groups = [
|
|
1734
|
+
{
|
|
1735
|
+
name: "products",
|
|
1736
|
+
options: answer.products.map((p) => ({
|
|
1737
|
+
kind: "product",
|
|
1738
|
+
key: p.handle,
|
|
1739
|
+
href: href("product", p.handle),
|
|
1740
|
+
label: _nullishCoalesce(p.title, () => ( p.handle)),
|
|
1741
|
+
product: p
|
|
1742
|
+
}))
|
|
1743
|
+
},
|
|
1744
|
+
{
|
|
1745
|
+
name: "categories",
|
|
1746
|
+
options: answer.categories.map((c) => ({
|
|
1747
|
+
kind: "category",
|
|
1748
|
+
key: c.handle,
|
|
1749
|
+
href: href("category", c.handle),
|
|
1750
|
+
label: c.name,
|
|
1751
|
+
count: c.productCount
|
|
1752
|
+
}))
|
|
1753
|
+
},
|
|
1754
|
+
{
|
|
1755
|
+
name: "brands",
|
|
1756
|
+
options: answer.brands.map((b) => ({
|
|
1757
|
+
kind: "brand",
|
|
1758
|
+
key: b.name,
|
|
1759
|
+
href: href("search", b.name),
|
|
1760
|
+
label: b.name,
|
|
1761
|
+
count: b.productCount
|
|
1762
|
+
}))
|
|
1763
|
+
},
|
|
1764
|
+
{
|
|
1765
|
+
name: "tags",
|
|
1766
|
+
options: answer.tags.map((x) => ({
|
|
1767
|
+
kind: "tag",
|
|
1768
|
+
key: x.tag,
|
|
1769
|
+
href: href("tag", x.tag),
|
|
1770
|
+
label: x.tag,
|
|
1771
|
+
count: x.productCount
|
|
1772
|
+
}))
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
name: "collections",
|
|
1776
|
+
options: answer.collections.map((c) => ({
|
|
1777
|
+
kind: "collection",
|
|
1778
|
+
key: c.handle,
|
|
1779
|
+
href: href("collection", c.handle),
|
|
1780
|
+
label: c.title,
|
|
1781
|
+
count: c.productCount
|
|
1782
|
+
}))
|
|
1783
|
+
}
|
|
1784
|
+
];
|
|
1785
|
+
return groups.filter((g) => g.options.length > 0);
|
|
1786
|
+
}
|
|
1787
|
+
function searchForm(pattern) {
|
|
1788
|
+
const [path = "/search", query = ""] = pattern.split("?");
|
|
1789
|
+
const named = /(?:^|&)([^=&]+)=\{q\}/.exec(query);
|
|
1790
|
+
return { action: path.replace(/\/?\{q\}$/, "") || "/", name: _nullishCoalesce(_optionalChain([named, 'optionalAccess', _134 => _134[1]]), () => ( "q")) };
|
|
1791
|
+
}
|
|
1792
|
+
function SearchBox(props) {
|
|
1793
|
+
const { settings, site, router, Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
1794
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
1795
|
+
const id = _react.useId.call(void 0, );
|
|
1796
|
+
const listId = `${id}-list`;
|
|
1797
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "search-box", props);
|
|
1798
|
+
const inputPart = _chunkVWXJO427cjs.usePart.call(void 0, "search-box-input", props);
|
|
1799
|
+
const panel = _chunkVWXJO427cjs.usePart.call(void 0, "search-box-panel", props);
|
|
1800
|
+
const listPart = _chunkVWXJO427cjs.usePart.call(void 0, "search-box-list", props);
|
|
1801
|
+
const groupPart = _chunkVWXJO427cjs.usePart.call(void 0, "search-box-group", props);
|
|
1802
|
+
const groupLabel = _chunkVWXJO427cjs.usePart.call(void 0, "search-box-group-label", props);
|
|
1803
|
+
const optionPart = _chunkVWXJO427cjs.usePart.call(void 0, "search-box-option", props);
|
|
1804
|
+
const thumb = _chunkVWXJO427cjs.usePart.call(void 0, "search-box-thumb", props);
|
|
1805
|
+
const optionName = _chunkVWXJO427cjs.usePart.call(void 0, "search-box-option-name", props);
|
|
1806
|
+
const optionMeta = _chunkVWXJO427cjs.usePart.call(void 0, "search-box-option-meta", props);
|
|
1807
|
+
const allPart = _chunkVWXJO427cjs.usePart.call(void 0, "search-box-all", props);
|
|
1808
|
+
const nonePart = _chunkVWXJO427cjs.usePart.call(void 0, "search-box-none", props);
|
|
1809
|
+
const status = _chunkVWXJO427cjs.usePart.call(void 0, "search-box-status", props);
|
|
1810
|
+
const form = searchForm(settings.routes.search);
|
|
1811
|
+
const href = (kind, value2) => _chunkHZ6VEN6Qcjs.routeHref.call(void 0, settings, kind, value2, site);
|
|
1812
|
+
const urlQuery = router.pathname === form.action ? _nullishCoalesce(router.searchParams.get(form.name), () => ( "")) : "";
|
|
1813
|
+
const [value, setValue] = _react.useState.call(void 0, urlQuery);
|
|
1814
|
+
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
1815
|
+
const [active, setActive] = _react.useState.call(void 0, -1);
|
|
1816
|
+
const inputRef = _react.useRef.call(void 0, null);
|
|
1817
|
+
const write = (next) => {
|
|
1818
|
+
setValue(next);
|
|
1819
|
+
if (inputRef.current && inputRef.current.value !== next) inputRef.current.value = next;
|
|
1820
|
+
};
|
|
1821
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
1822
|
+
const input = inputRef.current;
|
|
1823
|
+
if (!input || input.value === urlQuery) return;
|
|
1824
|
+
setValue(input.value);
|
|
1825
|
+
if (document.activeElement === input) setOpen(true);
|
|
1826
|
+
}, []);
|
|
1827
|
+
const seen = _react.useRef.call(void 0, { pathname: router.pathname, urlQuery });
|
|
1828
|
+
_react.useEffect.call(void 0, () => {
|
|
1829
|
+
const before = seen.current;
|
|
1830
|
+
if (before.pathname === router.pathname && before.urlQuery === urlQuery) return;
|
|
1831
|
+
seen.current = { pathname: router.pathname, urlQuery };
|
|
1832
|
+
if (before.urlQuery !== urlQuery) write(urlQuery);
|
|
1833
|
+
setOpen(false);
|
|
1834
|
+
setActive(-1);
|
|
1835
|
+
}, [router.pathname, urlQuery]);
|
|
1836
|
+
const term = value.trim();
|
|
1837
|
+
const { data, isLoading } = _react3.useSuggest.call(void 0, value, {
|
|
1838
|
+
debounceMs: DEBOUNCE_MS,
|
|
1839
|
+
limit: LIMIT,
|
|
1840
|
+
enabled: open,
|
|
1841
|
+
keepPreviousData: true
|
|
1842
|
+
});
|
|
1843
|
+
const lastAnswer = _react.useRef.call(void 0, void 0);
|
|
1844
|
+
_react.useEffect.call(void 0, () => {
|
|
1845
|
+
if (!data) return;
|
|
1846
|
+
if (data !== lastAnswer.current) setActive(-1);
|
|
1847
|
+
lastAnswer.current = data;
|
|
1848
|
+
}, [data]);
|
|
1849
|
+
const groups = data ? groupsOf(data, href) : [];
|
|
1850
|
+
const searchHref = href("search", term);
|
|
1851
|
+
const options = [...groups.flatMap((g) => g.options), { href: searchHref }];
|
|
1852
|
+
const visible = open && term.length >= MIN_CHARS && data !== void 0;
|
|
1853
|
+
const optionId = (index2) => `${id}-opt-${index2}`;
|
|
1854
|
+
const at = active === END ? options.length - 1 : active;
|
|
1855
|
+
const activeId = visible && at >= 0 && at < options.length ? optionId(at) : void 0;
|
|
1856
|
+
const total = groups.reduce((n, g) => n + g.options.length, 0);
|
|
1857
|
+
const close = () => {
|
|
1858
|
+
setOpen(false);
|
|
1859
|
+
setActive(-1);
|
|
1860
|
+
};
|
|
1861
|
+
const leave = () => {
|
|
1862
|
+
close();
|
|
1863
|
+
_optionalChain([inputRef, 'access', _135 => _135.current, 'optionalAccess', _136 => _136.blur, 'call', _137 => _137()]);
|
|
1864
|
+
};
|
|
1865
|
+
const onKeyDown = (event) => {
|
|
1866
|
+
if (event.nativeEvent.isComposing) return;
|
|
1867
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
1868
|
+
event.preventDefault();
|
|
1869
|
+
if (!visible) {
|
|
1870
|
+
setOpen(true);
|
|
1871
|
+
setActive(event.key === "ArrowDown" ? 0 : END);
|
|
1872
|
+
return;
|
|
1873
|
+
}
|
|
1874
|
+
const n = options.length;
|
|
1875
|
+
setActive(event.key === "ArrowDown" ? (at + 1) % n : at <= 0 ? n - 1 : at - 1);
|
|
1876
|
+
} else if (event.key === "Escape") {
|
|
1877
|
+
if (visible) {
|
|
1878
|
+
event.preventDefault();
|
|
1879
|
+
close();
|
|
1880
|
+
} else if (value) {
|
|
1881
|
+
event.preventDefault();
|
|
1882
|
+
write("");
|
|
1883
|
+
}
|
|
1884
|
+
} else if (event.key === "Enter") {
|
|
1885
|
+
if (activeId) {
|
|
1886
|
+
event.preventDefault();
|
|
1887
|
+
router.push(options[at].href);
|
|
1888
|
+
leave();
|
|
1889
|
+
} else {
|
|
1890
|
+
close();
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1894
|
+
const onSubmit = (event) => {
|
|
1895
|
+
const query = (_nullishCoalesce(_optionalChain([inputRef, 'access', _138 => _138.current, 'optionalAccess', _139 => _139.value]), () => ( value))).trim();
|
|
1896
|
+
event.preventDefault();
|
|
1897
|
+
if (query === "") return;
|
|
1898
|
+
router.push(href("search", query));
|
|
1899
|
+
leave();
|
|
1900
|
+
};
|
|
1901
|
+
const announce = !visible || isLoading ? "" : total === 0 ? t("frame.search.announceNone") : total === 1 ? t("frame.search.announceOne") : t("frame.search.announceMany", { count: total });
|
|
1902
|
+
let index = -1;
|
|
1903
|
+
const optionLink = (o) => {
|
|
1904
|
+
index += 1;
|
|
1905
|
+
const i = index;
|
|
1906
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1907
|
+
Anchor,
|
|
1908
|
+
{
|
|
1909
|
+
...optionPart,
|
|
1910
|
+
id: optionId(i),
|
|
1911
|
+
href: o.href,
|
|
1912
|
+
role: "option",
|
|
1913
|
+
"aria-selected": i === at,
|
|
1914
|
+
tabIndex: -1,
|
|
1915
|
+
prefetch: false,
|
|
1916
|
+
"data-kind": o.kind,
|
|
1917
|
+
"data-handle": o.kind === "product" ? o.key : void 0,
|
|
1918
|
+
onClick: leave,
|
|
1919
|
+
onMouseMove: () => setActive(i),
|
|
1920
|
+
children: o.product ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1921
|
+
o.product.images[0] ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...thumb, "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkP6HHE57Scjs.Image, { src: o.product.images[0].url, alt: "", aspectRatio: 1, sizes: "40px" }) }) : null,
|
|
1922
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...optionName, children: o.label }),
|
|
1923
|
+
o.product.availability !== "out_of_stock" && o.product.priceRange ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { ...optionMeta, children: [
|
|
1924
|
+
o.product.priceRange.minMinor !== o.product.priceRange.maxMinor ? `${t("pieces.price.from")} ` : null,
|
|
1925
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1926
|
+
_chunkHZ6VEN6Qcjs.Price,
|
|
1927
|
+
{
|
|
1928
|
+
minor: o.product.priceRange.minMinor,
|
|
1929
|
+
currency: o.product.priceRange.currency,
|
|
1930
|
+
priceContext: _optionalChain([data, 'optionalAccess', _140 => _140.priceContext])
|
|
1931
|
+
}
|
|
1932
|
+
)
|
|
1933
|
+
] }) : null
|
|
1934
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1935
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...optionName, children: o.label }),
|
|
1936
|
+
o.count !== void 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...optionMeta, children: o.count === 1 ? t("frame.search.productCountOne") : t("frame.search.productCount", { count: o.count }) }) : null
|
|
1937
|
+
] })
|
|
1938
|
+
},
|
|
1939
|
+
`${o.kind}:${o.key}`
|
|
1940
|
+
);
|
|
1941
|
+
};
|
|
1942
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1943
|
+
"form",
|
|
1944
|
+
{
|
|
1945
|
+
...root,
|
|
1946
|
+
role: "search",
|
|
1947
|
+
action: form.action,
|
|
1948
|
+
method: "get",
|
|
1949
|
+
onSubmit,
|
|
1950
|
+
onBlur: (event) => {
|
|
1951
|
+
if (!event.currentTarget.contains(event.relatedTarget)) close();
|
|
1952
|
+
},
|
|
1953
|
+
children: [
|
|
1954
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "search", size: 18 }),
|
|
1955
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1956
|
+
"input",
|
|
1957
|
+
{
|
|
1958
|
+
...inputPart,
|
|
1959
|
+
ref: inputRef,
|
|
1960
|
+
type: "search",
|
|
1961
|
+
name: form.name,
|
|
1962
|
+
defaultValue: urlQuery,
|
|
1963
|
+
placeholder: t("search.placeholder"),
|
|
1964
|
+
"aria-label": t("frame.search.label"),
|
|
1965
|
+
autoComplete: "off",
|
|
1966
|
+
enterKeyHint: "search",
|
|
1967
|
+
role: "combobox",
|
|
1968
|
+
"aria-autocomplete": "list",
|
|
1969
|
+
"aria-expanded": visible,
|
|
1970
|
+
"aria-controls": listId,
|
|
1971
|
+
"aria-activedescendant": activeId,
|
|
1972
|
+
onChange: (event) => {
|
|
1973
|
+
setValue(event.target.value);
|
|
1974
|
+
setOpen(true);
|
|
1975
|
+
setActive(-1);
|
|
1976
|
+
},
|
|
1977
|
+
onFocus: () => setOpen(true),
|
|
1978
|
+
onClick: () => setOpen(true),
|
|
1979
|
+
onKeyDown
|
|
1980
|
+
}
|
|
1981
|
+
),
|
|
1982
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1983
|
+
"div",
|
|
1984
|
+
{
|
|
1985
|
+
...panel,
|
|
1986
|
+
hidden: !visible,
|
|
1987
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1988
|
+
children: [
|
|
1989
|
+
total === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...nonePart, children: t("frame.search.none", { q: term }) }) : null,
|
|
1990
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { id: listId, ...listPart, role: "listbox", "aria-label": t("frame.search.suggestions"), children: [
|
|
1991
|
+
groups.map((g) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...groupPart, role: "group", "aria-labelledby": `${id}-${g.name}`, "data-group": g.name, children: [
|
|
1992
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { id: `${id}-${g.name}`, ...groupLabel, role: "presentation", children: t(`frame.search.${g.name}`) }),
|
|
1993
|
+
g.options.map(optionLink)
|
|
1994
|
+
] }, g.name)),
|
|
1995
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1996
|
+
Anchor,
|
|
1997
|
+
{
|
|
1998
|
+
...allPart,
|
|
1999
|
+
id: optionId(options.length - 1),
|
|
2000
|
+
href: searchHref,
|
|
2001
|
+
role: "option",
|
|
2002
|
+
"aria-selected": at === options.length - 1,
|
|
2003
|
+
tabIndex: -1,
|
|
2004
|
+
prefetch: false,
|
|
2005
|
+
onClick: leave,
|
|
2006
|
+
onMouseMove: () => setActive(options.length - 1),
|
|
2007
|
+
children: t("frame.search.searchFor", { q: term })
|
|
2008
|
+
}
|
|
2009
|
+
)
|
|
2010
|
+
] })
|
|
2011
|
+
]
|
|
2012
|
+
}
|
|
2013
|
+
),
|
|
2014
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...status, role: "status", "aria-live": "polite", children: announce })
|
|
2015
|
+
]
|
|
2016
|
+
}
|
|
2017
|
+
);
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2020
|
+
// src/frame/Header.tsx
|
|
2021
|
+
|
|
2022
|
+
var DRAWER_QUERY = "(max-width: 959px)";
|
|
2023
|
+
var DEFAULT_SLOTS = { SearchBox, AccountButton, CartButton, CategoryNav, LocaleSwitch, CurrencySwitch };
|
|
2024
|
+
function useNavItems(enabled) {
|
|
2025
|
+
const { site, settings } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
2026
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
2027
|
+
const menu = cleanMenuItems(site.menus.header);
|
|
2028
|
+
const tree = _react3.useCategories.call(void 0, { depth: 2, enabled: enabled && menu.length === 0 });
|
|
2029
|
+
if (menu.length > 0) return { items: menu, source: "menu" };
|
|
2030
|
+
const categories = (_nullishCoalesce(_optionalChain([tree, 'access', _141 => _141.data, 'optionalAccess', _142 => _142.categories]), () => ( []))).map((root) => {
|
|
2031
|
+
const entry = {
|
|
2032
|
+
label: root.name,
|
|
2033
|
+
href: _chunkHZ6VEN6Qcjs.routeHref.call(void 0, settings, "category", root.handle, site),
|
|
2034
|
+
kind: "category",
|
|
2035
|
+
handle: root.handle
|
|
2036
|
+
};
|
|
2037
|
+
if (root.children.length > 0) {
|
|
2038
|
+
entry.children = root.children.map((c) => ({
|
|
2039
|
+
label: c.name,
|
|
2040
|
+
href: _chunkHZ6VEN6Qcjs.routeHref.call(void 0, settings, "category", c.handle, site),
|
|
2041
|
+
kind: "category",
|
|
2042
|
+
handle: c.handle
|
|
2043
|
+
}));
|
|
2044
|
+
}
|
|
2045
|
+
return entry;
|
|
2046
|
+
});
|
|
2047
|
+
const all = { label: t("home.shopAll"), href: settings.routes.shop };
|
|
2048
|
+
return { items: categories.length > 0 ? [all, ...categories] : [], source: "categories" };
|
|
2049
|
+
}
|
|
2050
|
+
function Header(props) {
|
|
2051
|
+
const { showCategoryNav = true, accountHref, onLocaleChange, onCurrencyChange } = props;
|
|
2052
|
+
const { site, Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
2053
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
2054
|
+
const slots = { ...DEFAULT_SLOTS, ...props.slots };
|
|
2055
|
+
const local = { classNames: props.classNames, unstyled: props.unstyled };
|
|
2056
|
+
const isDrawer = _chunk4J6AGWNCcjs.useMediaQuery.call(void 0, DRAWER_QUERY);
|
|
2057
|
+
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
2058
|
+
const [container, setContainer] = _react.useState.call(void 0, null);
|
|
2059
|
+
const titleId = _react.useId.call(void 0, );
|
|
2060
|
+
const opener = _react.useRef.call(void 0, null);
|
|
2061
|
+
if (!isDrawer && open) setOpen(false);
|
|
2062
|
+
const { items, source } = useNavItems(showCategoryNav);
|
|
2063
|
+
const hasNav = showCategoryNav && items.length > 0;
|
|
2064
|
+
const hasMenu = hasNav || onLocaleChange !== void 0 || onCurrencyChange !== void 0;
|
|
2065
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "header", props);
|
|
2066
|
+
const bar = _chunkVWXJO427cjs.usePart.call(void 0, "header-bar", local);
|
|
2067
|
+
const menuButton = _chunkVWXJO427cjs.usePart.call(void 0, "header-menu-button", local);
|
|
2068
|
+
const brand = _chunkVWXJO427cjs.usePart.call(void 0, "header-brand", local);
|
|
2069
|
+
const logoPart = _chunkVWXJO427cjs.usePart.call(void 0, "header-logo", local);
|
|
2070
|
+
const namePart = _chunkVWXJO427cjs.usePart.call(void 0, "header-store-name", local);
|
|
2071
|
+
const searchPart = _chunkVWXJO427cjs.usePart.call(void 0, "header-search", local);
|
|
2072
|
+
const actions = _chunkVWXJO427cjs.usePart.call(void 0, "header-actions", local);
|
|
2073
|
+
const navRow = _chunkVWXJO427cjs.usePart.call(void 0, "header-nav-row", local);
|
|
2074
|
+
const prefs = _chunkVWXJO427cjs.usePart.call(void 0, "header-prefs", local);
|
|
2075
|
+
const drawerTop = _chunkVWXJO427cjs.usePart.call(void 0, "header-drawer-top", local);
|
|
2076
|
+
const drawerTitle = _chunkVWXJO427cjs.usePart.call(void 0, "header-drawer-title", local);
|
|
2077
|
+
const drawerClose = _chunkVWXJO427cjs.usePart.call(void 0, "header-drawer-close", local);
|
|
2078
|
+
const { storeName, logo } = site.brand;
|
|
2079
|
+
const logoLight = logo ? site.scheme === "dark" ? _nullishCoalesce(logo.dark, () => ( logo.light)) : _nullishCoalesce(logo.light, () => ( logo.dark)) : void 0;
|
|
2080
|
+
const logoDark = logo && site.scheme === "auto" ? logo.dark : void 0;
|
|
2081
|
+
const close = () => setOpen(false);
|
|
2082
|
+
const switchesIn = (drawer) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...prefs, "data-in-drawer": drawer ? "" : void 0, children: [
|
|
2083
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, slots.CurrencySwitch, { onChange: onCurrencyChange, ...local }),
|
|
2084
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, slots.LocaleSwitch, { onChange: onLocaleChange, ...local })
|
|
2085
|
+
] });
|
|
2086
|
+
const nav = hasNav ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, slots.CategoryNav, { items, source, stacked: isDrawer, ...local }) : null;
|
|
2087
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "header", { ...root, tabIndex: -1, children: [
|
|
2088
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...bar, children: [
|
|
2089
|
+
hasMenu ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2090
|
+
"button",
|
|
2091
|
+
{
|
|
2092
|
+
ref: opener,
|
|
2093
|
+
type: "button",
|
|
2094
|
+
...menuButton,
|
|
2095
|
+
"aria-haspopup": "dialog",
|
|
2096
|
+
"aria-expanded": open && isDrawer,
|
|
2097
|
+
"aria-label": t("nav.menu"),
|
|
2098
|
+
onClick: () => {
|
|
2099
|
+
setContainer(_nullishCoalesce(_optionalChain([opener, 'access', _143 => _143.current, 'optionalAccess', _144 => _144.closest, 'call', _145 => _145(".tsf-root")]), () => ( null)));
|
|
2100
|
+
setOpen(true);
|
|
2101
|
+
},
|
|
2102
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "menu", size: 22 })
|
|
2103
|
+
}
|
|
2104
|
+
) : null,
|
|
2105
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2106
|
+
Anchor,
|
|
2107
|
+
{
|
|
2108
|
+
...brand,
|
|
2109
|
+
href: "/",
|
|
2110
|
+
"aria-label": storeName ? t("frame.header.home", { store: storeName }) : t("frame.header.homeNoName"),
|
|
2111
|
+
children: [
|
|
2112
|
+
logoLight ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "picture", { children: [
|
|
2113
|
+
logoDark ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "source", { media: "(prefers-color-scheme: dark)", srcSet: logoDark }) : null,
|
|
2114
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { ...logoPart, src: logoLight, alt: "" })
|
|
2115
|
+
] }) : null,
|
|
2116
|
+
storeName || !logoLight ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...namePart, "data-has-logo": logoLight ? "" : void 0, "data-throttle-setting": "store-name", children: storeName }) : null
|
|
2117
|
+
]
|
|
2118
|
+
}
|
|
2119
|
+
),
|
|
2120
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...searchPart, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, slots.SearchBox, { ...local }) }),
|
|
2121
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...actions, children: [
|
|
2122
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, slots.AccountButton, { href: accountHref, ...local }),
|
|
2123
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, slots.CartButton, { ...local })
|
|
2124
|
+
] })
|
|
2125
|
+
] }),
|
|
2126
|
+
!isDrawer && hasMenu ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...navRow, children: [
|
|
2127
|
+
nav,
|
|
2128
|
+
switchesIn(false)
|
|
2129
|
+
] }) : null,
|
|
2130
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _ui.Drawer, { open: open && isDrawer, onClose: close, labelledBy: titleId, side: "start", restoreFocusTo: opener.current, container, children: [
|
|
2131
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...drawerTop, children: [
|
|
2132
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { id: titleId, ...drawerTitle, children: t("nav.menu") }),
|
|
2133
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", ...drawerClose, "aria-label": t("frame.header.closeMenu"), onClick: close, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "close", size: 22 }) })
|
|
2134
|
+
] }),
|
|
2135
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { onClick: (event) => event.target.closest("a") && close(), children: [
|
|
2136
|
+
nav,
|
|
2137
|
+
switchesIn(true)
|
|
2138
|
+
] })
|
|
2139
|
+
] })
|
|
2140
|
+
] });
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
// src/frame/in-frame.ts
|
|
2144
|
+
|
|
2145
|
+
var InFrameContext = _react.createContext.call(void 0, false);
|
|
2146
|
+
var useInFrame = () => _react.useContext.call(void 0, InFrameContext);
|
|
2147
|
+
|
|
2148
|
+
// src/frame/StoreFrame.tsx
|
|
2149
|
+
|
|
2150
|
+
function StoreFrame({ children, header, footer, mainId = "main-content", ...local }) {
|
|
2151
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
2152
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "store-frame", local);
|
|
2153
|
+
const skip = _chunkVWXJO427cjs.usePart.call(void 0, "skip-link", local);
|
|
2154
|
+
const main = _chunkVWXJO427cjs.usePart.call(void 0, "store-frame-main", local);
|
|
2155
|
+
const parts = { classNames: local.classNames, unstyled: local.unstyled };
|
|
2156
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InFrameContext.Provider, { value: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...root, children: [
|
|
2157
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { ...skip, href: `#${mainId}`, children: t("frame.skipLink") }),
|
|
2158
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AnnouncementBar, { ...parts }),
|
|
2159
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Header, { ...parts, ...header }),
|
|
2160
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "main", { ...main, id: mainId, tabIndex: -1, children }),
|
|
2161
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Footer, { ...parts, ...footer }),
|
|
2162
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CartDrawer, { ...parts })
|
|
2163
|
+
] }) });
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
// src/merch/ProductCarousel.tsx
|
|
2167
|
+
|
|
2168
|
+
|
|
2169
|
+
|
|
2170
|
+
// src/merch/skeleton.tsx
|
|
2171
|
+
|
|
2172
|
+
function MerchSkeleton({ count, classNames, unstyled }) {
|
|
2173
|
+
const list = _chunkVWXJO427cjs.usePart.call(void 0, "merch-skeleton", { classNames, unstyled });
|
|
2174
|
+
const item = _chunkVWXJO427cjs.usePart.call(void 0, "merch-skeleton-item", { classNames, unstyled });
|
|
2175
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...list, "aria-hidden": "true", children: Array.from({ length: Math.min(count, 8) }, (_, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...item }, i)) });
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
// src/merch/ProductCarousel.tsx
|
|
2179
|
+
|
|
2180
|
+
var DEFAULT_LIMIT = 8;
|
|
2181
|
+
function stepOf(track) {
|
|
2182
|
+
const [a, b] = Array.from(track.children);
|
|
2183
|
+
if (a && b) return Math.abs(b.offsetLeft - a.offsetLeft);
|
|
2184
|
+
return _nullishCoalesce(_optionalChain([a, 'optionalAccess', _146 => _146.offsetWidth]), () => ( track.clientWidth));
|
|
2185
|
+
}
|
|
2186
|
+
function Carousel(props) {
|
|
2187
|
+
const { products, label, heading, eyebrow, trailing, generatedAt, priceContext, cardVariant, cardMeta, embedded, classNames, unstyled, className } = props;
|
|
2188
|
+
const { dir } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
2189
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
2190
|
+
const local = { classNames, unstyled };
|
|
2191
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "product-carousel", { ...local, className });
|
|
2192
|
+
const header = _chunkVWXJO427cjs.usePart.call(void 0, "product-carousel-header", local);
|
|
2193
|
+
const eyebrowPart = _chunkVWXJO427cjs.usePart.call(void 0, "product-carousel-eyebrow", local);
|
|
2194
|
+
const titlePart = _chunkVWXJO427cjs.usePart.call(void 0, "product-carousel-title", local);
|
|
2195
|
+
const controls = _chunkVWXJO427cjs.usePart.call(void 0, "product-carousel-controls", local);
|
|
2196
|
+
const prevPart = _chunkVWXJO427cjs.usePart.call(void 0, "product-carousel-prev", local);
|
|
2197
|
+
const nextPart = _chunkVWXJO427cjs.usePart.call(void 0, "product-carousel-next", local);
|
|
2198
|
+
const trackPart = _chunkVWXJO427cjs.usePart.call(void 0, "product-carousel-track", local);
|
|
2199
|
+
const itemPart = _chunkVWXJO427cjs.usePart.call(void 0, "product-carousel-item", local);
|
|
2200
|
+
const trackId = _react.useId.call(void 0, );
|
|
2201
|
+
const track = _react.useRef.call(void 0, null);
|
|
2202
|
+
const [edge, setEdge] = _react.useState.call(void 0, { start: true, end: false });
|
|
2203
|
+
const onSelect = _chunkDOAII637cjs.useListAnalytics.call(void 0, label, products);
|
|
2204
|
+
const measure = _react.useCallback.call(void 0, () => {
|
|
2205
|
+
const el = track.current;
|
|
2206
|
+
if (!el) return;
|
|
2207
|
+
const offset = Math.abs(el.scrollLeft);
|
|
2208
|
+
const next = { start: offset <= 1, end: offset >= el.scrollWidth - el.clientWidth - 1 };
|
|
2209
|
+
setEdge((prev) => prev.start === next.start && prev.end === next.end ? prev : next);
|
|
2210
|
+
}, []);
|
|
2211
|
+
_react.useEffect.call(void 0, () => {
|
|
2212
|
+
measure();
|
|
2213
|
+
const el = track.current;
|
|
2214
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
2215
|
+
const observer = new ResizeObserver(measure);
|
|
2216
|
+
observer.observe(el);
|
|
2217
|
+
return () => observer.disconnect();
|
|
2218
|
+
}, [measure, products.length]);
|
|
2219
|
+
const move = (toward) => {
|
|
2220
|
+
const el = track.current;
|
|
2221
|
+
if (!el) return;
|
|
2222
|
+
const left = toward * (dir === "rtl" ? -1 : 1) * stepOf(el);
|
|
2223
|
+
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2224
|
+
if (typeof el.scrollBy === "function") el.scrollBy({ left, behavior: reduce ? "auto" : "smooth" });
|
|
2225
|
+
else el.scrollLeft += left;
|
|
2226
|
+
};
|
|
2227
|
+
const onKeyDown = (event) => {
|
|
2228
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
|
|
2229
|
+
if (event.key !== "ArrowRight" && event.key !== "ArrowLeft") return;
|
|
2230
|
+
const target = event.target;
|
|
2231
|
+
if (target.closest('input, textarea, select, [contenteditable="true"]')) return;
|
|
2232
|
+
event.preventDefault();
|
|
2233
|
+
const toward = event.key === "ArrowRight" === (dir !== "rtl") ? 1 : -1;
|
|
2234
|
+
move(toward);
|
|
2235
|
+
const items = Array.from(_nullishCoalesce(_optionalChain([track, 'access', _147 => _147.current, 'optionalAccess', _148 => _148.children]), () => ( [])));
|
|
2236
|
+
const from = items.findIndex((li) => li.contains(target));
|
|
2237
|
+
if (from >= 0) _optionalChain([items, 'access', _149 => _149[from + toward], 'optionalAccess', _150 => _150.querySelector, 'call', _151 => _151('a:not([tabindex="-1"]), button'), 'optionalAccess', _152 => _152.focus, 'call', _153 => _153({ preventScroll: true })]);
|
|
2238
|
+
};
|
|
2239
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2240
|
+
"section",
|
|
2241
|
+
{
|
|
2242
|
+
...root,
|
|
2243
|
+
role: "region",
|
|
2244
|
+
"aria-roledescription": "carousel",
|
|
2245
|
+
"aria-label": label,
|
|
2246
|
+
"data-section": embedded ? void 0 : "product-carousel",
|
|
2247
|
+
"data-section-title": embedded ? void 0 : label,
|
|
2248
|
+
onKeyDown,
|
|
2249
|
+
children: [
|
|
2250
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...header, children: [
|
|
2251
|
+
heading && _optionalChain([eyebrow, 'optionalAccess', _154 => _154.trim, 'call', _155 => _155()]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...eyebrowPart, children: eyebrow }) : null,
|
|
2252
|
+
heading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { ...titlePart, children: heading }) : null,
|
|
2253
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...controls, children: [
|
|
2254
|
+
trailing,
|
|
2255
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2256
|
+
"button",
|
|
2257
|
+
{
|
|
2258
|
+
...prevPart,
|
|
2259
|
+
type: "button",
|
|
2260
|
+
"aria-label": t("merch.carousel.previous"),
|
|
2261
|
+
"aria-controls": trackId,
|
|
2262
|
+
disabled: edge.start,
|
|
2263
|
+
onClick: () => move(-1),
|
|
2264
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "chevron-left", size: 20 })
|
|
2265
|
+
}
|
|
2266
|
+
),
|
|
2267
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2268
|
+
"button",
|
|
2269
|
+
{
|
|
2270
|
+
...nextPart,
|
|
2271
|
+
type: "button",
|
|
2272
|
+
"aria-label": t("merch.carousel.next"),
|
|
2273
|
+
"aria-controls": trackId,
|
|
2274
|
+
disabled: edge.end,
|
|
2275
|
+
onClick: () => move(1),
|
|
2276
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "chevron-right", size: 20 })
|
|
2277
|
+
}
|
|
2278
|
+
)
|
|
2279
|
+
] })
|
|
2280
|
+
] }),
|
|
2281
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...trackPart, ref: track, id: trackId, onScroll: measure, children: products.map((product, position) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2282
|
+
"div",
|
|
2283
|
+
{
|
|
2284
|
+
...itemPart,
|
|
2285
|
+
role: "group",
|
|
2286
|
+
"aria-roledescription": "slide",
|
|
2287
|
+
"aria-label": t("merch.carousel.slide", { n: position + 1, total: products.length }),
|
|
2288
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2289
|
+
_chunkNDUEJJLPcjs.ProductCard,
|
|
2290
|
+
{
|
|
2291
|
+
product,
|
|
2292
|
+
variant: cardVariant,
|
|
2293
|
+
meta: cardMeta,
|
|
2294
|
+
position,
|
|
2295
|
+
listName: label,
|
|
2296
|
+
generatedAt,
|
|
2297
|
+
priceContext,
|
|
2298
|
+
onSelect,
|
|
2299
|
+
...local
|
|
2300
|
+
}
|
|
2301
|
+
)
|
|
2302
|
+
},
|
|
2303
|
+
product.handle
|
|
2304
|
+
)) })
|
|
2305
|
+
]
|
|
2306
|
+
}
|
|
2307
|
+
);
|
|
2308
|
+
}
|
|
2309
|
+
function ProductCarousel(props) {
|
|
2310
|
+
const { source, title, eyebrow, limit = DEFAULT_LIMIT, cardVariant, cardMeta, initialData, classNames, unstyled, className } = props;
|
|
2311
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
2312
|
+
const data = _chunkDOAII637cjs.useMerchProducts.call(void 0, source, { limit, initialData });
|
|
2313
|
+
const label = _optionalChain([title, 'optionalAccess', _156 => _156.trim, 'call', _157 => _157()]) || t("merch.carousel.label");
|
|
2314
|
+
if (_chunkDOAII637cjs.isEmptySource.call(void 0, source) || data.status === "error") return null;
|
|
2315
|
+
if (data.status === "loading") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MerchSkeleton, { count: 4, classNames, unstyled });
|
|
2316
|
+
if (data.products.length === 0) return null;
|
|
2317
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2318
|
+
Carousel,
|
|
2319
|
+
{
|
|
2320
|
+
products: data.products,
|
|
2321
|
+
label,
|
|
2322
|
+
heading: _optionalChain([title, 'optionalAccess', _158 => _158.trim, 'call', _159 => _159()]) || void 0,
|
|
2323
|
+
eyebrow,
|
|
2324
|
+
generatedAt: data.generatedAt,
|
|
2325
|
+
priceContext: data.priceContext,
|
|
2326
|
+
cardVariant,
|
|
2327
|
+
cardMeta,
|
|
2328
|
+
classNames,
|
|
2329
|
+
unstyled,
|
|
2330
|
+
className
|
|
2331
|
+
}
|
|
2332
|
+
);
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
// src/merch/CollectionShelf.tsx
|
|
2336
|
+
|
|
2337
|
+
var DEFAULT_LIMIT2 = 4;
|
|
2338
|
+
function CollectionShelf(props) {
|
|
2339
|
+
const { handle, title, eyebrow, limit = DEFAULT_LIMIT2, layout = "grid", columns, showViewAll = true, cardVariant, cardMeta, initialData, classNames, unstyled, className } = props;
|
|
2340
|
+
const { settings } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
2341
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
2342
|
+
const local = { classNames, unstyled };
|
|
2343
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "collection-shelf", { ...local, className });
|
|
2344
|
+
const header = _chunkVWXJO427cjs.usePart.call(void 0, "collection-shelf-header", local);
|
|
2345
|
+
const eyebrowPart = _chunkVWXJO427cjs.usePart.call(void 0, "collection-shelf-eyebrow", local);
|
|
2346
|
+
const heading = _chunkVWXJO427cjs.usePart.call(void 0, "collection-shelf-title", local);
|
|
2347
|
+
const viewAll = _chunkVWXJO427cjs.usePart.call(void 0, "collection-shelf-link", local);
|
|
2348
|
+
const grid = _chunkVWXJO427cjs.usePart.call(void 0, "collection-shelf-grid", local);
|
|
2349
|
+
const item = _chunkVWXJO427cjs.usePart.call(void 0, "collection-shelf-item", local);
|
|
2350
|
+
const data = _chunkDOAII637cjs.useMerchProducts.call(void 0, { kind: "collection", handle }, { limit, initialData, withTitle: !_optionalChain([title, 'optionalAccess', _160 => _160.trim, 'call', _161 => _161()]) });
|
|
2351
|
+
const label = _optionalChain([title, 'optionalAccess', _162 => _162.trim, 'call', _163 => _163()]) || data.title || "";
|
|
2352
|
+
const onSelect = _chunkDOAII637cjs.useListAnalytics.call(void 0, label || handle, layout === "grid" ? data.products : []);
|
|
2353
|
+
const { Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
2354
|
+
if (data.status === "error") return null;
|
|
2355
|
+
if (data.status === "loading") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MerchSkeleton, { count: limit, ...local });
|
|
2356
|
+
if (data.products.length === 0) return null;
|
|
2357
|
+
const cols = _nullishCoalesce(columns, () => ( settings.listing.columns));
|
|
2358
|
+
const style = { "--tsf-columns-desktop": cols.desktop, "--tsf-columns-mobile": cols.mobile };
|
|
2359
|
+
const link = showViewAll ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2360
|
+
Anchor,
|
|
2361
|
+
{
|
|
2362
|
+
...viewAll,
|
|
2363
|
+
href: _chunkHZ6VEN6Qcjs.routeHref.call(void 0, settings, "collection", handle),
|
|
2364
|
+
"aria-label": label ? t("merch.viewAllNamed", { title: label }) : void 0,
|
|
2365
|
+
children: t("merch.viewAll")
|
|
2366
|
+
}
|
|
2367
|
+
) : null;
|
|
2368
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { ...root, "data-section": "collection-shelf", "data-section-title": label || void 0, "data-collection-handle": handle, "data-layout": layout, children: [
|
|
2369
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...header, children: [
|
|
2370
|
+
_optionalChain([eyebrow, 'optionalAccess', _164 => _164.trim, 'call', _165 => _165()]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...eyebrowPart, children: eyebrow }) : null,
|
|
2371
|
+
label ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { ...heading, children: label }) : null,
|
|
2372
|
+
layout === "grid" ? link : null
|
|
2373
|
+
] }),
|
|
2374
|
+
layout === "carousel" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2375
|
+
Carousel,
|
|
2376
|
+
{
|
|
2377
|
+
products: data.products,
|
|
2378
|
+
label: label || t("merch.carousel.label"),
|
|
2379
|
+
trailing: link,
|
|
2380
|
+
generatedAt: data.generatedAt,
|
|
2381
|
+
priceContext: data.priceContext,
|
|
2382
|
+
cardVariant,
|
|
2383
|
+
cardMeta,
|
|
2384
|
+
embedded: true,
|
|
2385
|
+
...local
|
|
2386
|
+
}
|
|
2387
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { ...grid, style, children: data.products.map((product, position) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...item, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2388
|
+
_chunkNDUEJJLPcjs.ProductCard,
|
|
2389
|
+
{
|
|
2390
|
+
product,
|
|
2391
|
+
variant: cardVariant,
|
|
2392
|
+
meta: cardMeta,
|
|
2393
|
+
position,
|
|
2394
|
+
listName: label || handle,
|
|
2395
|
+
generatedAt: data.generatedAt,
|
|
2396
|
+
priceContext: data.priceContext,
|
|
2397
|
+
onSelect,
|
|
2398
|
+
...local
|
|
2399
|
+
}
|
|
2400
|
+
) }, product.handle)) })
|
|
2401
|
+
] });
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
// src/merch/FeaturedProduct.tsx
|
|
2405
|
+
|
|
2406
|
+
|
|
2407
|
+
|
|
2408
|
+
function priceOf(product) {
|
|
2409
|
+
const range = product.priceRange;
|
|
2410
|
+
if (!range) return null;
|
|
2411
|
+
const priced = product.variants.filter((v) => v.priceMinor !== null && v.currency === range.currency);
|
|
2412
|
+
const cheapest = priced.reduce(
|
|
2413
|
+
(best, v) => !best || (_nullishCoalesce(v.salePriceMinor, () => ( v.priceMinor))) < (_nullishCoalesce(best.salePriceMinor, () => ( best.priceMinor))) ? v : best,
|
|
2414
|
+
void 0
|
|
2415
|
+
);
|
|
2416
|
+
const compare = _nullishCoalesce(_optionalChain([cheapest, 'optionalAccess', _166 => _166.compareAtPriceMinor]), () => ( (_optionalChain([cheapest, 'optionalAccess', _167 => _167.salePriceMinor]) != null ? cheapest.priceMinor : null)));
|
|
2417
|
+
return {
|
|
2418
|
+
minor: range.minMinor,
|
|
2419
|
+
currency: range.currency,
|
|
2420
|
+
...compare != null && compare > range.minMinor ? { compareAtMinor: compare } : {},
|
|
2421
|
+
from: range.minMinor !== range.maxMinor
|
|
2422
|
+
};
|
|
2423
|
+
}
|
|
2424
|
+
var EXCERPT_LENGTH = 240;
|
|
2425
|
+
function excerptOf(text) {
|
|
2426
|
+
if (text.length <= EXCERPT_LENGTH) return text;
|
|
2427
|
+
const cut = text.slice(0, EXCERPT_LENGTH);
|
|
2428
|
+
const space = cut.lastIndexOf(" ");
|
|
2429
|
+
return `${(space > EXCERPT_LENGTH / 2 ? cut.slice(0, space) : cut).trimEnd()}\u2026`;
|
|
2430
|
+
}
|
|
2431
|
+
function FeaturedProduct(props) {
|
|
2432
|
+
const { handle, layout = "image-left", showDescription = true, initialData, classNames, unstyled, className } = props;
|
|
2433
|
+
const { settings, reviewsOnLists, Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
2434
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
2435
|
+
const local = { classNames, unstyled };
|
|
2436
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "featured-product", { ...local, className });
|
|
2437
|
+
const media = _chunkVWXJO427cjs.usePart.call(void 0, "featured-product-media", local);
|
|
2438
|
+
const mediaLink = _chunkVWXJO427cjs.usePart.call(void 0, "featured-product-media-link", local);
|
|
2439
|
+
const placeholder = _chunkVWXJO427cjs.usePart.call(void 0, "featured-product-placeholder", local);
|
|
2440
|
+
const body = _chunkVWXJO427cjs.usePart.call(void 0, "featured-product-body", local);
|
|
2441
|
+
const titlePart = _chunkVWXJO427cjs.usePart.call(void 0, "featured-product-title", local);
|
|
2442
|
+
const ratingPart = _chunkVWXJO427cjs.usePart.call(void 0, "featured-product-rating", local);
|
|
2443
|
+
const pricePart = _chunkVWXJO427cjs.usePart.call(void 0, "featured-product-price", local);
|
|
2444
|
+
const from = _chunkVWXJO427cjs.usePart.call(void 0, "featured-product-from", local);
|
|
2445
|
+
const description = _chunkVWXJO427cjs.usePart.call(void 0, "featured-product-description", local);
|
|
2446
|
+
const link = _chunkVWXJO427cjs.usePart.call(void 0, "featured-product-link", local);
|
|
2447
|
+
const seed = _react.useMemo.call(void 0, () => initialData ? { product: initialData.product } : void 0, [initialData]);
|
|
2448
|
+
const query = _react3.useProduct.call(void 0, handle.trim() === "" ? null : handle, { initialData: seed, staleTimeMs: _chunkDOAII637cjs.MERCH_STALE_MS });
|
|
2449
|
+
const answer = query.data && "product" in query.data ? query.data : void 0;
|
|
2450
|
+
if (!answer) return null;
|
|
2451
|
+
const { product } = answer;
|
|
2452
|
+
const priceContext = answer.priceContext;
|
|
2453
|
+
const title = _nullishCoalesce(product.title, () => ( product.handle));
|
|
2454
|
+
const href = _chunkHZ6VEN6Qcjs.routeHref.call(void 0, settings, "product", product.handle);
|
|
2455
|
+
const price = priceOf(product);
|
|
2456
|
+
const image = product.images[0];
|
|
2457
|
+
const rating = product.rating;
|
|
2458
|
+
const showRating = settings.card.showRating && reviewsOnLists && rating && rating.count > 0 && rating.average !== null;
|
|
2459
|
+
const plain = (product.shortDescription || product.description || "").trim();
|
|
2460
|
+
const html = plain ? "" : _nullishCoalesce(product.descriptionHtml, () => ( ""));
|
|
2461
|
+
const ratio = _optionalChain([image, 'optionalAccess', _168 => _168.width]) && image.height ? image.width / image.height : 0.8;
|
|
2462
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { ...root, "data-section": "featured-product", "data-section-title": title, "data-product-handle": product.handle, "data-layout": layout, children: [
|
|
2463
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...media, "data-layout": layout, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...mediaLink, href, tabIndex: -1, "aria-hidden": "true", children: image ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkP6HHE57Scjs.Image, { src: image.url, alt: "", aspectRatio: ratio, sizes: "(min-width: 768px) 50vw, 100vw", ...local }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...placeholder, style: { aspectRatio: 0.8 } }) }) }),
|
|
2464
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...body, children: [
|
|
2465
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { ...titlePart, children: title }),
|
|
2466
|
+
showRating ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...ratingPart, "data-card-rating": "", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHZ6VEN6Qcjs.StarRating, { value: rating.average, count: rating.count, ...local }) }) : null,
|
|
2467
|
+
price ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { ...pricePart, children: [
|
|
2468
|
+
price.from ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { ...from, children: [
|
|
2469
|
+
t("pieces.price.from"),
|
|
2470
|
+
" "
|
|
2471
|
+
] }) : null,
|
|
2472
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHZ6VEN6Qcjs.Price, { minor: price.minor, currency: price.currency, compareAtMinor: settings.card.showCompareAt ? price.compareAtMinor : void 0, priceContext, ...local })
|
|
2473
|
+
] }) : null,
|
|
2474
|
+
showDescription && (plain || html) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...description, children: plain ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: excerptOf(plain) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNDUEJJLPcjs.RichText, { html, ...local }) }) : null,
|
|
2475
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...link, href, children: t("merch.viewProduct") })
|
|
2476
|
+
] })
|
|
2477
|
+
] });
|
|
2478
|
+
}
|
|
2479
|
+
|
|
2480
|
+
// src/merch/CategoryDirectory.tsx
|
|
2481
|
+
|
|
2482
|
+
|
|
2483
|
+
function find(nodes, handle) {
|
|
2484
|
+
for (const node of nodes) {
|
|
2485
|
+
if (node.handle === handle) return node;
|
|
2486
|
+
const inside = find(node.children, handle);
|
|
2487
|
+
if (inside) return inside;
|
|
2488
|
+
}
|
|
2489
|
+
return void 0;
|
|
2490
|
+
}
|
|
2491
|
+
function CategoryDirectory(props) {
|
|
2492
|
+
const { parent, depth = 1, layout = "grid", showImages = false, showCounts = false, initialData, classNames, unstyled, className } = props;
|
|
2493
|
+
const { settings, Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
2494
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
2495
|
+
const local = { classNames, unstyled };
|
|
2496
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "category-directory", { ...local, className });
|
|
2497
|
+
const list = _chunkVWXJO427cjs.usePart.call(void 0, "category-directory-list", local);
|
|
2498
|
+
const item = _chunkVWXJO427cjs.usePart.call(void 0, "category-directory-item", local);
|
|
2499
|
+
const link = _chunkVWXJO427cjs.usePart.call(void 0, "category-directory-link", local);
|
|
2500
|
+
const imagePart = _chunkVWXJO427cjs.usePart.call(void 0, "category-directory-image", local);
|
|
2501
|
+
const name = _chunkVWXJO427cjs.usePart.call(void 0, "category-directory-name", local);
|
|
2502
|
+
const count = _chunkVWXJO427cjs.usePart.call(void 0, "category-directory-count", local);
|
|
2503
|
+
const children = _chunkVWXJO427cjs.usePart.call(void 0, "category-directory-children", local);
|
|
2504
|
+
const tree = _react3.useCategories.call(void 0, { depth: parent ? 10 : depth, initialData, staleTimeMs: _chunkDOAII637cjs.MERCH_STALE_MS });
|
|
2505
|
+
if (!tree.data) return null;
|
|
2506
|
+
const top = parent ? _optionalChain([find, 'call', _169 => _169(tree.data.categories, parent), 'optionalAccess', _170 => _170.children]) : tree.data.categories;
|
|
2507
|
+
if (!top || top.length === 0) return null;
|
|
2508
|
+
const entry = (node, parentHandle, level) => {
|
|
2509
|
+
const image = showImages ? node.image : void 0;
|
|
2510
|
+
const productCount = node.productCount;
|
|
2511
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { ...item, "data-category-handle": node.handle, "data-category-parent": parentHandle, children: [
|
|
2512
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Anchor, { ...link, href: _chunkHZ6VEN6Qcjs.routeHref.call(void 0, settings, "category", node.handle), children: [
|
|
2513
|
+
_optionalChain([image, 'optionalAccess', _171 => _171.url]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkP6HHE57Scjs.Image, { src: image.url, alt: "", aspectRatio: 4 / 3, className: imagePart.className, ...local }) : null,
|
|
2514
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...name, children: node.name }),
|
|
2515
|
+
showCounts ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...count, children: t(productCount === 1 ? "merch.categories.countOne" : "merch.categories.count", { count: productCount }) }) : null
|
|
2516
|
+
] }),
|
|
2517
|
+
level === 1 && depth === 2 && node.children.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { ...children, children: node.children.map((child) => entry(child, node.handle, 2)) }) : null
|
|
2518
|
+
] }, node.id);
|
|
2519
|
+
};
|
|
2520
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "nav", { ...root, "aria-label": t("merch.categories.label"), "data-section": "category-directory", "data-layout": layout, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { ...list, "data-layout": layout, children: top.map((node) => entry(node, parent, 1)) }) });
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
// src/merch/ReviewsList.tsx
|
|
2524
|
+
|
|
2525
|
+
|
|
2526
|
+
var DEFAULT_LIMIT3 = 5;
|
|
2527
|
+
function dateOf(iso, locale) {
|
|
2528
|
+
const time = Date.parse(iso);
|
|
2529
|
+
if (Number.isNaN(time)) return null;
|
|
2530
|
+
try {
|
|
2531
|
+
return new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeZone: "UTC" }).format(time);
|
|
2532
|
+
} catch (e7) {
|
|
2533
|
+
return null;
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
function ReviewsList(props) {
|
|
2537
|
+
const { productHandle, reviews, limit = DEFAULT_LIMIT3, showProduct = false, classNames, unstyled, className } = props;
|
|
2538
|
+
const { settings, locale, Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
2539
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
2540
|
+
const local = { classNames, unstyled };
|
|
2541
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "reviews-list", { ...local, className });
|
|
2542
|
+
const items = _chunkVWXJO427cjs.usePart.call(void 0, "reviews-list-items", local);
|
|
2543
|
+
const itemPart = _chunkVWXJO427cjs.usePart.call(void 0, "reviews-list-item", local);
|
|
2544
|
+
const head = _chunkVWXJO427cjs.usePart.call(void 0, "reviews-list-head", local);
|
|
2545
|
+
const titlePart = _chunkVWXJO427cjs.usePart.call(void 0, "reviews-list-title", local);
|
|
2546
|
+
const bodyPart = _chunkVWXJO427cjs.usePart.call(void 0, "reviews-list-body", local);
|
|
2547
|
+
const meta = _chunkVWXJO427cjs.usePart.call(void 0, "reviews-list-meta", local);
|
|
2548
|
+
const author = _chunkVWXJO427cjs.usePart.call(void 0, "reviews-list-author", local);
|
|
2549
|
+
const verified = _chunkVWXJO427cjs.usePart.call(void 0, "reviews-list-verified", local);
|
|
2550
|
+
const datePart = _chunkVWXJO427cjs.usePart.call(void 0, "reviews-list-date", local);
|
|
2551
|
+
const productPart = _chunkVWXJO427cjs.usePart.call(void 0, "reviews-list-product", local);
|
|
2552
|
+
const reply = _chunkVWXJO427cjs.usePart.call(void 0, "reviews-list-reply", local);
|
|
2553
|
+
const handle = !reviews && _optionalChain([productHandle, 'optionalAccess', _172 => _172.trim, 'call', _173 => _173()]) ? productHandle : null;
|
|
2554
|
+
const query = _react3.useReviews.call(void 0, handle, { sort: "newest", limit, staleTimeMs: _chunkDOAII637cjs.MERCH_STALE_MS });
|
|
2555
|
+
const given = _nullishCoalesce(reviews, () => ( (query.data && "reviews" in query.data ? query.data.reviews : void 0)));
|
|
2556
|
+
const shown = _optionalChain([given, 'optionalAccess', _174 => _174.slice, 'call', _175 => _175(0, Math.max(0, limit))]);
|
|
2557
|
+
if (!shown || shown.length === 0) return null;
|
|
2558
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "section", { ...root, "aria-label": t("merch.reviews.label"), "data-section": "reviews-list", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { ...items, children: shown.map((review) => {
|
|
2559
|
+
const when = dateOf(review.createdAt, locale);
|
|
2560
|
+
const about = showProduct && review.productHandle ? _nullishCoalesce(review.productTitle, () => ( review.productHandle)) : null;
|
|
2561
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { ...itemPart, "data-review-id": review.id, "data-rating": review.rating, children: [
|
|
2562
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...head, children: [
|
|
2563
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHZ6VEN6Qcjs.StarRating, { value: review.rating, size: "sm", ...local }),
|
|
2564
|
+
review.title ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { ...titlePart, children: review.title }) : null
|
|
2565
|
+
] }),
|
|
2566
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...bodyPart, children: review.body }),
|
|
2567
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { ...meta, children: [
|
|
2568
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...author, children: review.displayName }),
|
|
2569
|
+
review.verified ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...verified, children: t("merch.reviews.verified") }) : null,
|
|
2570
|
+
when ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "time", { ...datePart, dateTime: review.createdAt, children: when }) : null,
|
|
2571
|
+
about && review.productHandle ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...productPart, href: _chunkHZ6VEN6Qcjs.routeHref.call(void 0, settings, "product", review.productHandle), children: t("merch.reviews.forProduct", { product: about }) }) : null
|
|
2572
|
+
] }),
|
|
2573
|
+
review.reply ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...reply, children: [
|
|
2574
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: t("merch.reviews.reply") }),
|
|
2575
|
+
" ",
|
|
2576
|
+
review.reply.body
|
|
2577
|
+
] }) : null
|
|
2578
|
+
] }, review.id);
|
|
2579
|
+
}) }) });
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
// src/shopper/QuickView.tsx
|
|
2583
|
+
|
|
2584
|
+
|
|
2585
|
+
var QuickViewBody = _react.lazy.call(void 0, () => Promise.resolve().then(() => _interopRequireWildcard(require("./chunk-6X2OZSNV.cjs"))).then((m) => ({ default: m.QuickViewBody })));
|
|
2586
|
+
function QuickView({ handle, open, onOpenChange, ...local }) {
|
|
2587
|
+
const opener = _react.useRef.call(void 0, null);
|
|
2588
|
+
_react.useEffect.call(void 0, () => {
|
|
2589
|
+
if (open) opener.current = document.activeElement;
|
|
2590
|
+
}, [open]);
|
|
2591
|
+
if (!open || !handle) return null;
|
|
2592
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Suspense, { fallback: null, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QuickViewBody, { handle, onOpenChange, openerRef: opener, ...local }) });
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2595
|
+
// src/shopper/RecentlyViewed.tsx
|
|
2596
|
+
|
|
2597
|
+
|
|
2598
|
+
var RECENT_KEY = "throttle:sf:recent";
|
|
2599
|
+
var RECENT_MAX = 12;
|
|
2600
|
+
var recentList = _chunkPNJOFFTLcjs.createStoredList.call(void 0, RECENT_KEY, RECENT_MAX);
|
|
2601
|
+
function useRecentlyViewed() {
|
|
2602
|
+
const handles = recentList.useIds();
|
|
2603
|
+
const push = _react.useCallback.call(void 0, (handle) => {
|
|
2604
|
+
const clean = handle.trim();
|
|
2605
|
+
if (clean === "") return;
|
|
2606
|
+
const now = recentList.read();
|
|
2607
|
+
if (now[0] === clean) return;
|
|
2608
|
+
recentList.write([clean, ...now.filter((h) => h !== clean)]);
|
|
2609
|
+
}, []);
|
|
2610
|
+
return { handles, push };
|
|
2611
|
+
}
|
|
2612
|
+
function RecentlyViewed(props) {
|
|
2613
|
+
const { limit = RECENT_MAX, current, cardVariant, cardMeta, title, classNames, unstyled, className } = props;
|
|
2614
|
+
const local = { classNames, unstyled };
|
|
2615
|
+
const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
2616
|
+
const { handles, push } = useRecentlyViewed();
|
|
2617
|
+
_react.useEffect.call(void 0, () => {
|
|
2618
|
+
if (current) push(current);
|
|
2619
|
+
}, [current, push]);
|
|
2620
|
+
const shown = handles.filter((h) => h !== current).slice(0, Math.min(Math.max(1, Math.floor(limit)), RECENT_MAX));
|
|
2621
|
+
const data = _chunkDOAII637cjs.useMerchProducts.call(void 0, { kind: "manual", handles: shown }, { limit: Math.max(1, shown.length) });
|
|
2622
|
+
const label = _optionalChain([title, 'optionalAccess', _176 => _176.trim, 'call', _177 => _177()]) || t("shopper.recent.title");
|
|
2623
|
+
const onSelect = _chunkDOAII637cjs.useListAnalytics.call(void 0, label, data.products);
|
|
2624
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "recently-viewed", { ...local, className });
|
|
2625
|
+
const heading = _chunkVWXJO427cjs.usePart.call(void 0, "recently-viewed-title", local);
|
|
2626
|
+
const list = _chunkVWXJO427cjs.usePart.call(void 0, "recently-viewed-list", local);
|
|
2627
|
+
const item = _chunkVWXJO427cjs.usePart.call(void 0, "recently-viewed-item", local);
|
|
2628
|
+
if (shown.length === 0 || data.status === "error") return null;
|
|
2629
|
+
if (data.status === "loading") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MerchSkeleton, { count: Math.min(shown.length, 4), ...local });
|
|
2630
|
+
if (data.products.length === 0) return null;
|
|
2631
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { ...root, "aria-label": label, "data-section": "recently-viewed", "data-section-title": label, children: [
|
|
2632
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { ...heading, children: label }),
|
|
2633
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { ...list, children: data.products.map((product, position) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...item, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2634
|
+
_chunkNDUEJJLPcjs.ProductCard,
|
|
2635
|
+
{
|
|
2636
|
+
product,
|
|
2637
|
+
variant: cardVariant,
|
|
2638
|
+
meta: cardMeta,
|
|
2639
|
+
position,
|
|
2640
|
+
listName: label,
|
|
2641
|
+
generatedAt: data.generatedAt,
|
|
2642
|
+
priceContext: data.priceContext,
|
|
2643
|
+
onSelect,
|
|
2644
|
+
...local
|
|
2645
|
+
}
|
|
2646
|
+
) }, product.handle)) })
|
|
2647
|
+
] });
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
// src/shopper/Compare.tsx
|
|
2651
|
+
|
|
2652
|
+
|
|
2653
|
+
var CompareTable = _react.lazy.call(void 0, () => Promise.resolve().then(() => _interopRequireWildcard(require("./chunk-ZHCXI2ZZ.cjs"))).then((m) => ({ default: m.CompareTable })));
|
|
2654
|
+
function Compare(props) {
|
|
2655
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Suspense, { fallback: null, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CompareTable, { ...props }) });
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
// src/pages/NotFound.tsx
|
|
2659
|
+
|
|
2660
|
+
|
|
2661
|
+
function NotFound(props) {
|
|
2662
|
+
const { settings, Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
|
|
2663
|
+
const { t, keyAttr } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
2664
|
+
const inFrame = useInFrame();
|
|
2665
|
+
const titleId = _react.useId.call(void 0, );
|
|
2666
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "not-found", props);
|
|
2667
|
+
const code = _chunkVWXJO427cjs.usePart.call(void 0, "not-found-code", props);
|
|
2668
|
+
const title = _chunkVWXJO427cjs.usePart.call(void 0, "not-found-title", props);
|
|
2669
|
+
const body = _chunkVWXJO427cjs.usePart.call(void 0, "not-found-body", props);
|
|
2670
|
+
const actions = _chunkVWXJO427cjs.usePart.call(void 0, "not-found-actions", props);
|
|
2671
|
+
const link = _chunkVWXJO427cjs.usePart.call(void 0, "not-found-link", props);
|
|
2672
|
+
const Wrapper = inFrame ? "section" : "main";
|
|
2673
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Wrapper, { ...root, "aria-labelledby": titleId, children: [
|
|
2674
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...code, "aria-hidden": "true", children: t("pages.notFound.code") }),
|
|
2675
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { ...title, id: titleId, ...keyAttr("error.notFound"), children: t("error.notFound") }),
|
|
2676
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...body, children: t("pages.notFound.body") }),
|
|
2677
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { ...actions, children: [
|
|
2678
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...link, href: settings.routes.shop, children: t("pages.notFound.shop") }),
|
|
2679
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...link, href: "/", children: t("pages.notFound.home") })
|
|
2680
|
+
] })
|
|
2681
|
+
] });
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
// src/pages/SearchResults.tsx
|
|
2685
|
+
|
|
2686
|
+
function SearchResults(props) {
|
|
2687
|
+
const { q, initialData } = props;
|
|
2688
|
+
const { t, keyAttr } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
|
|
2689
|
+
const root = _chunkVWXJO427cjs.usePart.call(void 0, "search-results", props);
|
|
2690
|
+
const title = _chunkVWXJO427cjs.usePart.call(void 0, "search-results-title", props);
|
|
2691
|
+
const prompt = _chunkVWXJO427cjs.usePart.call(void 0, "search-results-prompt", props);
|
|
2692
|
+
const term = q.trim();
|
|
2693
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "section", { ...root, children: term === "" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2694
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { ...title, ...keyAttr("search.title"), children: t("search.title") }),
|
|
2695
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...prompt, children: t("pages.search.prompt") })
|
|
2696
|
+
] }) : (
|
|
2697
|
+
// `ShopAll` draws the `search.results` heading for a search source.
|
|
2698
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ShopAll, { source: { kind: "search", q: term }, initialData })
|
|
2699
|
+
) });
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2702
|
+
|
|
2703
|
+
|
|
2704
|
+
|
|
2705
|
+
|
|
2706
|
+
|
|
2707
|
+
|
|
2708
|
+
|
|
2709
|
+
|
|
2710
|
+
|
|
2711
|
+
|
|
2712
|
+
|
|
2713
|
+
|
|
2714
|
+
|
|
2715
|
+
|
|
2716
|
+
|
|
2717
|
+
|
|
2718
|
+
|
|
2719
|
+
|
|
2720
|
+
|
|
2721
|
+
|
|
2722
|
+
|
|
2723
|
+
|
|
2724
|
+
|
|
2725
|
+
|
|
2726
|
+
|
|
2727
|
+
|
|
2728
|
+
|
|
2729
|
+
|
|
2730
|
+
|
|
2731
|
+
|
|
2732
|
+
|
|
2733
|
+
|
|
2734
|
+
|
|
2735
|
+
|
|
2736
|
+
|
|
2737
|
+
|
|
2738
|
+
|
|
2739
|
+
|
|
2740
|
+
|
|
2741
|
+
|
|
2742
|
+
|
|
2743
|
+
|
|
2744
|
+
|
|
2745
|
+
|
|
2746
|
+
|
|
2747
|
+
|
|
2748
|
+
|
|
2749
|
+
|
|
2750
|
+
|
|
2751
|
+
|
|
2752
|
+
|
|
2753
|
+
|
|
2754
|
+
|
|
2755
|
+
|
|
2756
|
+
|
|
2757
|
+
|
|
2758
|
+
|
|
2759
|
+
|
|
2760
|
+
|
|
2761
|
+
|
|
2762
|
+
|
|
2763
|
+
|
|
2764
|
+
|
|
2765
|
+
|
|
2766
|
+
|
|
2767
|
+
|
|
2768
|
+
|
|
2769
|
+
|
|
2770
|
+
|
|
2771
|
+
|
|
2772
|
+
|
|
2773
|
+
|
|
2774
|
+
|
|
2775
|
+
|
|
2776
|
+
|
|
2777
|
+
|
|
2778
|
+
|
|
2779
|
+
|
|
2780
|
+
|
|
2781
|
+
|
|
2782
|
+
|
|
2783
|
+
|
|
2784
|
+
|
|
2785
|
+
|
|
2786
|
+
|
|
2787
|
+
|
|
2788
|
+
|
|
2789
|
+
|
|
2790
|
+
|
|
2791
|
+
|
|
2792
|
+
|
|
2793
|
+
|
|
2794
|
+
|
|
2795
|
+
|
|
2796
|
+
|
|
2797
|
+
|
|
2798
|
+
|
|
2799
|
+
|
|
2800
|
+
|
|
2801
|
+
|
|
2802
|
+
|
|
2803
|
+
|
|
2804
|
+
|
|
2805
|
+
|
|
2806
|
+
|
|
2807
|
+
|
|
2808
|
+
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
|
|
2812
|
+
|
|
2813
|
+
|
|
2814
|
+
|
|
2815
|
+
|
|
2816
|
+
|
|
2817
|
+
|
|
2818
|
+
|
|
2819
|
+
|
|
2820
|
+
|
|
2821
|
+
|
|
2822
|
+
|
|
2823
|
+
|
|
2824
|
+
|
|
2825
|
+
|
|
2826
|
+
|
|
2827
|
+
|
|
2828
|
+
exports.AccountButton = AccountButton; exports.ActiveFilters = ActiveFilters; exports.AddToCart = _chunkNDUEJJLPcjs.AddToCart; exports.AnnouncementBar = AnnouncementBar; exports.BackInStock = _chunkNDUEJJLPcjs.BackInStock; exports.Badge = _chunkNDUEJJLPcjs.Badge; exports.Breadcrumbs = _chunkNDUEJJLPcjs.Breadcrumbs; exports.BuyBox = _chunkNDUEJJLPcjs.BuyBox; exports.CartButton = CartButton; exports.CartDrawer = CartDrawer; exports.CartLine = _chunkAYC2YK4Ecjs.CartLine; exports.CategoryDirectory = CategoryDirectory; exports.CategoryList = _chunkNDUEJJLPcjs.CategoryList; exports.CategoryNav = CategoryNav; exports.CollectionShelf = CollectionShelf; exports.Compare = Compare; exports.CompareButton = _chunkPNJOFFTLcjs.CompareButton; exports.CurrencySwitch = CurrencySwitch; exports.DefaultLink = _chunk6ZMMZ245cjs.DefaultLink; exports.FacetGroup = FacetGroup; exports.FeaturedProduct = FeaturedProduct; exports.FilterBar = FilterBar; exports.FilterDrawer = FilterDrawer; exports.FilterSidebar = FilterSidebar; exports.Footer = Footer; exports.FrequentlyBoughtTogether = _chunkNDUEJJLPcjs.FrequentlyBoughtTogether; exports.GA4_EVENTS = GA4_EVENTS; exports.Gallery = _chunkNDUEJJLPcjs.Gallery; exports.Header = Header; exports.Image = _chunkP6HHE57Scjs.Image; exports.JsonLd = _chunkNDUEJJLPcjs.JsonLd; exports.Link = Link; exports.LiveRegion = LiveRegion; exports.LocaleSwitch = LocaleSwitch; exports.Money = _chunkHZ6VEN6Qcjs.Money; exports.NotFound = NotFound; exports.Pagination = Pagination; exports.Price = _chunkHZ6VEN6Qcjs.Price; exports.ProductCard = _chunkNDUEJJLPcjs.ProductCard; exports.ProductCarousel = ProductCarousel; exports.ProductGrid = ProductGrid; exports.ProductPage = _chunkNDUEJJLPcjs.ProductPage; exports.ProductSections = _chunkNDUEJJLPcjs.ProductSections; exports.QuantityInput = _chunkNDUEJJLPcjs.QuantityInput; exports.QuestionsAndAnswers = _chunkNDUEJJLPcjs.QuestionsAndAnswers; exports.QuickAdd = _chunkPHY7AY27cjs.QuickAdd; exports.QuickView = QuickView; exports.RecentlyViewed = RecentlyViewed; exports.RelatedProducts = _chunkNDUEJJLPcjs.RelatedProducts; exports.ResultCount = ResultCount; exports.ReviewForm = _chunkNDUEJJLPcjs.ReviewForm; exports.ReviewPhotos = _chunkNDUEJJLPcjs.ReviewPhotos; exports.ReviewVotes = _chunkNDUEJJLPcjs.ReviewVotes; exports.Reviews = _chunkNDUEJJLPcjs.Reviews; exports.ReviewsList = ReviewsList; exports.RichText = _chunkNDUEJJLPcjs.RichText; exports.SF_STRINGS_EN = _chunkVWXJO427cjs.SF_STRINGS_EN; exports.STOREFRONT_LAYER_ORDER_ID = _chunk6ZMMZ245cjs.STOREFRONT_LAYER_ORDER_ID; exports.STOREFRONT_PART_KEYS = _chunkVWXJO427cjs.STOREFRONT_PART_KEYS; exports.STOREFRONT_STYLES = _chunk6ZMMZ245cjs.STOREFRONT_STYLES; exports.STOREFRONT_STYLE_ID = _chunk6ZMMZ245cjs.STOREFRONT_STYLE_ID; exports.SYNC_ATTRIBUTES = _chunkVWXJO427cjs.SYNC_ATTRIBUTES; exports.SearchBox = SearchBox; exports.SearchResults = SearchResults; exports.ShippingSection = _chunkNDUEJJLPcjs.ShippingSection; exports.ShopAll = ShopAll; exports.SlotOutlet = _chunkNDUEJJLPcjs.SlotOutlet; exports.SortSelect = SortSelect; exports.StarRating = _chunkHZ6VEN6Qcjs.StarRating; exports.StickyAddToCart = _chunkNDUEJJLPcjs.StickyAddToCart; exports.StockStatus = _chunkNDUEJJLPcjs.StockStatus; exports.StoreFrame = StoreFrame; exports.StorefrontProvider = _chunk6ZMMZ245cjs.StorefrontProvider; exports.Swatch = _chunkNDUEJJLPcjs.Swatch; exports.TagList = _chunkNDUEJJLPcjs.TagList; exports.Unstyled = _chunkVWXJO427cjs.Unstyled; exports.UnstyledContext = _chunkVWXJO427cjs.UnstyledContext; exports.VariantPicker = _chunkNDUEJJLPcjs.VariantPicker; exports.WishlistButton = _chunkNDUEJJLPcjs.WishlistButton; exports.breadcrumbJsonLd = _chunkNDUEJJLPcjs.breadcrumbJsonLd; exports.canonicalForShopQuery = _chunkNDUEJJLPcjs.canonicalForShopQuery; exports.cardBadges = _chunkNDUEJJLPcjs.cardBadges; exports.cardFields = _chunkDOAII637cjs.cardFields; exports.catalogSiteDesign = _chunkM4YXSLRGcjs.catalogSiteDesign; exports.createStoredList = _chunkPNJOFFTLcjs.createStoredList; exports.gaAnalytics = gaAnalytics; exports.itemListJsonLd = _chunkNDUEJJLPcjs.itemListJsonLd; exports.menuHref = _chunkM4YXSLRGcjs.menuHref; exports.menuItems = _chunkM4YXSLRGcjs.menuItems; exports.noopAnalytics = noopAnalytics; exports.normalizeSettings = _chunk6ZMMZ245cjs.normalizeSettings; exports.pageWindow = _chunkNDUEJJLPcjs.pageWindow; exports.parseShopQuery = _chunkNDUEJJLPcjs.parseShopQuery; exports.pickerKind = _chunkNDUEJJLPcjs.pickerKind; exports.productCrumbs = _chunkNDUEJJLPcjs.productCrumbs; exports.productJsonLd = _chunkNDUEJJLPcjs.productJsonLd; exports.productMetadata = _chunkNDUEJJLPcjs.productMetadata; exports.productSourceQuery = _chunkDOAII637cjs.productSourceQuery; exports.rememberScroll = rememberScroll; exports.resolveSiteDesign = _chunkM4YXSLRGcjs.resolveSiteDesign; exports.robotsForShopQuery = _chunkNDUEJJLPcjs.robotsForShopQuery; exports.sanitizeHtml = _chunkNDUEJJLPcjs.sanitizeHtml; exports.searchMetadata = _chunkNDUEJJLPcjs.searchMetadata; exports.selectOption = _chunkNDUEJJLPcjs.selectOption; exports.shopAllMetadata = _chunkNDUEJJLPcjs.shopAllMetadata; exports.shopListQuery = _chunkDOAII637cjs.shopListQuery; exports.shopQueryToSearch = _chunkNDUEJJLPcjs.shopQueryToSearch; exports.stockWord = _chunkNDUEJJLPcjs.stockWord; exports.themeToVariables = _chunk6ZMMZ245cjs.themeToVariables; exports.throttleScriptsAnalytics = throttleScriptsAnalytics; exports.toGa4Item = _chunkHZ6VEN6Qcjs.toGa4Item; exports.useCartDrawer = _chunk2LCPIY2Pcjs.useCartDrawer; exports.useCompare = _chunkPNJOFFTLcjs.useCompare; exports.useHistoryRouter = _chunk6ZMMZ245cjs.useHistoryRouter; exports.useMerchProducts = _chunkDOAII637cjs.useMerchProducts; exports.usePart = _chunkVWXJO427cjs.usePart; exports.useProductPage = _chunkNDUEJJLPcjs.useProductPage; exports.useRecentlyViewed = useRecentlyViewed; exports.useRelatedProducts = _chunkNDUEJJLPcjs.useRelatedProducts; exports.useShippingContent = _chunkNDUEJJLPcjs.useShippingContent; exports.useShopAll = useShopAll; exports.useStorefront = _chunkVWXJO427cjs.useStorefront; exports.useStrings = _chunkXQHGFWLGcjs.useStrings; exports.useTrack = _chunkDYHHAOMGcjs.useTrack; exports.useUnstyled = _chunkVWXJO427cjs.useUnstyled; exports.variantFromSearch = _chunkNDUEJJLPcjs.variantFromSearch;
|
|
2829
|
+
//# sourceMappingURL=index.cjs.map
|