@simpleapps-com/augur-hooks 2026.11.4 → 2026.11.6
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/README.md +7 -1
- package/dist/checkout/create-checkout-provider.d.ts.map +1 -1
- package/dist/checkout/index.cjs +35 -22
- package/dist/checkout/index.cjs.map +1 -1
- package/dist/checkout/index.js +22 -9
- package/dist/checkout/index.js.map +1 -1
- package/dist/{chunk-WJ6VEQ6R.cjs → chunk-4PTXISXM.cjs} +67 -2
- package/dist/chunk-4PTXISXM.cjs.map +1 -0
- package/dist/{chunk-63ZJ4UTX.js → chunk-V3VBNWLM.js} +66 -1
- package/dist/chunk-V3VBNWLM.js.map +1 -0
- package/dist/hooks/use-cart-actions.d.ts +21 -8
- package/dist/hooks/use-cart-actions.d.ts.map +1 -1
- package/dist/hooks/use-cart-initialization.d.ts +7 -0
- package/dist/hooks/use-cart-initialization.d.ts.map +1 -1
- package/dist/hooks/use-cart-pricing.d.ts +30 -8
- package/dist/hooks/use-cart-pricing.d.ts.map +1 -1
- package/dist/hooks/use-format-price.d.ts.map +1 -1
- package/dist/hooks/use-modal-lifecycle.d.ts.map +1 -1
- package/dist/index.cjs +277 -130
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +251 -104
- package/dist/index.js.map +1 -1
- package/dist/rules.d.ts +99 -0
- package/dist/rules.d.ts.map +1 -1
- package/dist/stores/cart-store.d.ts +11 -1
- package/dist/stores/cart-store.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-63ZJ4UTX.js.map +0 -1
- package/dist/chunk-WJ6VEQ6R.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -31,7 +31,19 @@ var _chunkWJ4D5OCQcjs = require('./chunk-WJ4D5OCQ.cjs');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
var _chunk4PTXISXMcjs = require('./chunk-4PTXISXM.cjs');
|
|
35
47
|
|
|
36
48
|
// src/provider.tsx
|
|
37
49
|
var _react = require('react');
|
|
@@ -48,7 +60,7 @@ var AugurOptionsContext = _react.createContext.call(void 0, null);
|
|
|
48
60
|
var AugurSiteContext = _react.createContext.call(void 0, void 0);
|
|
49
61
|
function AugurHooksProvider({ api, auth, cache, site, children }) {
|
|
50
62
|
const proxyConfig = cache ? { cache: { static: cache.static, semiStatic: cache.semiStatic } } : void 0;
|
|
51
|
-
const proxyConfigRef =
|
|
63
|
+
const proxyConfigRef = _chunk4PTXISXMcjs.useLatest.call(void 0, proxyConfig);
|
|
52
64
|
const options = _react.useMemo.call(void 0, () => {
|
|
53
65
|
const config = proxyConfigRef.current;
|
|
54
66
|
if (api) return _augurcore.createOptionsProxy.call(void 0, api, config);
|
|
@@ -157,7 +169,7 @@ function useFormatPrice(optionsOrLocale, legacyCurrency) {
|
|
|
157
169
|
} = resolveFormatting(opts, _optionalChain([site, 'optionalAccess', _ => _.formatting]));
|
|
158
170
|
const formatPrice = (price, callOptions) => {
|
|
159
171
|
const effectiveValue = _augurutils.cleanMoney.call(void 0, price * (_nullishCoalesce(_optionalChain([callOptions, 'optionalAccess', _2 => _2.quantity]), () => ( 1))));
|
|
160
|
-
if (effectiveValue === 0
|
|
172
|
+
if (_chunk4PTXISXMcjs.zeroLabelShown.call(void 0, effectiveValue === 0, zeroLabel !== void 0)) {
|
|
161
173
|
return zeroLabel;
|
|
162
174
|
}
|
|
163
175
|
const precision = _nullishCoalesce(_optionalChain([callOptions, 'optionalAccess', _3 => _3.precision]), () => ( basePrecision));
|
|
@@ -182,9 +194,9 @@ function useStock(invMastUid, options = {}) {
|
|
|
182
194
|
const query = _reactquery.useQuery.call(void 0, {
|
|
183
195
|
...proxyOpts,
|
|
184
196
|
...resolvedQueryFn ? { queryFn: resolvedQueryFn } : {},
|
|
185
|
-
enabled:
|
|
197
|
+
enabled: _chunk4PTXISXMcjs.stockEnabled.call(void 0, options.enabled, !!invMastUid),
|
|
186
198
|
retry: 3,
|
|
187
|
-
retryDelay:
|
|
199
|
+
retryDelay: _chunk4PTXISXMcjs.stockRetryDelay
|
|
188
200
|
});
|
|
189
201
|
const stockData = _nullishCoalesce(query.data, () => ( null));
|
|
190
202
|
const resolved = _react.useMemo.call(void 0,
|
|
@@ -208,21 +220,25 @@ function useStock(invMastUid, options = {}) {
|
|
|
208
220
|
// src/hooks/use-cart-actions.ts
|
|
209
221
|
|
|
210
222
|
|
|
211
|
-
|
|
223
|
+
|
|
224
|
+
function cartUidOf(cartHdrUid) {
|
|
212
225
|
const num = typeof cartHdrUid === "string" ? Number(cartHdrUid) : cartHdrUid;
|
|
213
|
-
|
|
226
|
+
return num === void 0 || Number.isNaN(num) ? void 0 : num;
|
|
227
|
+
}
|
|
228
|
+
function requireCartUid(cartHdrUid) {
|
|
229
|
+
const uid = _chunk4PTXISXMcjs.requiredCartUid.call(void 0, cartUidOf(cartHdrUid));
|
|
214
230
|
if (uid === null) throw new Error("Cart UID is not set");
|
|
215
231
|
return uid;
|
|
216
232
|
}
|
|
217
233
|
function liveCart() {
|
|
218
|
-
const { cartHdrUid, cartLines } =
|
|
234
|
+
const { cartHdrUid, cartLines } = _chunk4PTXISXMcjs.useCartStore.getState();
|
|
219
235
|
return { uid: requireCartUid(cartHdrUid), lines: cartLines };
|
|
220
236
|
}
|
|
221
237
|
function buildOptimisticAdd(cartLines, item, cartHdrUid, itemId) {
|
|
222
|
-
const existingIndex =
|
|
238
|
+
const existingIndex = _chunk4PTXISXMcjs.indexOfUidFrom.call(void 0, uidsOf(cartLines), item.invMastUid, 0);
|
|
223
239
|
if (existingIndex >= 0) {
|
|
224
240
|
return cartLines.map(
|
|
225
|
-
(line, index) => index === existingIndex ? { ...line, quantity:
|
|
241
|
+
(line, index) => index === existingIndex ? { ...line, quantity: _chunk4PTXISXMcjs.qtyOrZero.call(void 0, line.quantity) + item.quantity } : line
|
|
226
242
|
);
|
|
227
243
|
}
|
|
228
244
|
return [
|
|
@@ -243,58 +259,99 @@ function buildOptimisticAdd(cartLines, item, cartHdrUid, itemId) {
|
|
|
243
259
|
];
|
|
244
260
|
}
|
|
245
261
|
function reverseAdd(cartLines, invMastUid, quantity) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
262
|
+
const index = _chunk4PTXISXMcjs.indexOfUidFrom.call(void 0, uidsOf(cartLines), invMastUid, 0);
|
|
263
|
+
if (index < 0) return cartLines;
|
|
264
|
+
const line = cartLines[index];
|
|
265
|
+
if (!_chunk4PTXISXMcjs.keepsAfterReverse.call(void 0, line.quantity, quantity)) {
|
|
266
|
+
return [...cartLines.slice(0, index), ...cartLines.slice(index + 1)];
|
|
267
|
+
}
|
|
268
|
+
return cartLines.map(
|
|
269
|
+
(l, i) => i === index ? { ...l, quantity: _chunk4PTXISXMcjs.qtyOrZero.call(void 0, l.quantity) - quantity } : l
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
function targetOf(cartLines, invMastUid, unitOfMeasure) {
|
|
273
|
+
const first = _chunk4PTXISXMcjs.indexOfUidFrom.call(void 0, uidsOf(cartLines), invMastUid, 0);
|
|
274
|
+
if (first < 0) return null;
|
|
275
|
+
const unit = _nullishCoalesce(unitOfMeasure, () => ( unitOf(cartLines[first])));
|
|
276
|
+
if (_chunk4PTXISXMcjs.indexOfUnitFrom.call(void 0, uidsOf(cartLines), unitsOf(cartLines), invMastUid, unit, 0) < 0) return null;
|
|
277
|
+
return { invMastUid, unit };
|
|
278
|
+
}
|
|
279
|
+
function isTarget(line, target) {
|
|
280
|
+
return _chunk4PTXISXMcjs.indexOfUnitFrom.call(void 0, [line.invMastUid], [unitOf(line)], target.invMastUid, target.unit, 0) === 0;
|
|
281
|
+
}
|
|
282
|
+
function targetLine(cartLines, target) {
|
|
283
|
+
const index = _chunk4PTXISXMcjs.indexOfUnitFrom.call(void 0,
|
|
284
|
+
uidsOf(cartLines),
|
|
285
|
+
unitsOf(cartLines),
|
|
286
|
+
target.invMastUid,
|
|
287
|
+
target.unit,
|
|
288
|
+
0
|
|
289
|
+
);
|
|
290
|
+
return cartLines[index];
|
|
250
291
|
}
|
|
251
|
-
function reverseQuantity(cartLines,
|
|
252
|
-
if (previousQuantity === void 0) return cartLines;
|
|
292
|
+
function reverseQuantity(cartLines, target, previousQuantity) {
|
|
253
293
|
return cartLines.map(
|
|
254
|
-
(line) => line
|
|
294
|
+
(line) => isTarget(line, target) ? { ...line, quantity: previousQuantity } : line
|
|
255
295
|
);
|
|
256
296
|
}
|
|
257
|
-
function restoreRemoved(cartLines,
|
|
258
|
-
if (
|
|
259
|
-
|
|
297
|
+
function restoreRemoved(cartLines, target, removedLine) {
|
|
298
|
+
if (_chunk4PTXISXMcjs.indexOfUnitFrom.call(void 0, uidsOf(cartLines), unitsOf(cartLines), target.invMastUid, target.unit, 0) >= 0) {
|
|
299
|
+
return cartLines;
|
|
300
|
+
}
|
|
260
301
|
return [...cartLines, removedLine];
|
|
261
302
|
}
|
|
262
303
|
function mergeRestore(cartLines, snapshot) {
|
|
263
304
|
const merged = [...cartLines];
|
|
264
305
|
for (const line of snapshot) {
|
|
265
|
-
if (!
|
|
306
|
+
if (!_chunk4PTXISXMcjs.hasNumberFrom.call(void 0, uidsOf(merged), line.invMastUid, 0)) merged.push(line);
|
|
266
307
|
}
|
|
267
308
|
return merged;
|
|
268
309
|
}
|
|
310
|
+
function sentLine(line, quantity) {
|
|
311
|
+
const { unitPrice, ...rest } = line;
|
|
312
|
+
const sent = { ...rest, quantity, lineNo: 0 };
|
|
313
|
+
if (_chunk4PTXISXMcjs.sendsPrice.call(void 0, unitPrice)) sent.unitPrice = unitPrice;
|
|
314
|
+
return sent;
|
|
315
|
+
}
|
|
269
316
|
function uidsOf(cartLines) {
|
|
270
317
|
return cartLines.map((line) => line.invMastUid);
|
|
271
318
|
}
|
|
319
|
+
function unitOf(line) {
|
|
320
|
+
return _nullishCoalesce(line.unitOfMeasure, () => ( ""));
|
|
321
|
+
}
|
|
322
|
+
function unitsOf(cartLines) {
|
|
323
|
+
return cartLines.map(unitOf);
|
|
324
|
+
}
|
|
272
325
|
function sendToast(notify, kind, showToast, message) {
|
|
273
|
-
if (showToast
|
|
326
|
+
if (_chunk4PTXISXMcjs.toastShown.call(void 0, showToast, message !== void 0)) _optionalChain([notify, 'optionalAccess', _4 => _4[kind], 'optionalCall', _5 => _5(message)]);
|
|
274
327
|
}
|
|
275
328
|
async function settleCartOp(op, options, notify, invalidate) {
|
|
329
|
+
const { endCartOp } = _chunk4PTXISXMcjs.useCartStore.getState();
|
|
276
330
|
try {
|
|
277
331
|
const success = await op.call();
|
|
278
332
|
if (!success) throw new Error(op.failure);
|
|
279
|
-
invalidate();
|
|
280
|
-
sendToast(notify, "info", op.showToast, op.infoMessage);
|
|
281
|
-
_optionalChain([options, 'access', _6 => _6.onSuccess, 'optionalCall', _7 => _7()]);
|
|
282
|
-
return true;
|
|
283
333
|
} catch (error) {
|
|
284
|
-
op.rollback();
|
|
334
|
+
if (_chunk4PTXISXMcjs.rollsBack.call(void 0, cartUidOf(_chunk4PTXISXMcjs.useCartStore.getState().cartHdrUid), op.cartUid)) op.rollback();
|
|
335
|
+
endCartOp();
|
|
336
|
+
invalidate();
|
|
285
337
|
sendToast(notify, "error", op.showToast, op.errorMessage);
|
|
286
|
-
_optionalChain([options, 'access',
|
|
338
|
+
_optionalChain([options, 'access', _6 => _6.onError, 'optionalCall', _7 => _7(error)]);
|
|
287
339
|
return false;
|
|
288
340
|
}
|
|
341
|
+
endCartOp();
|
|
342
|
+
invalidate();
|
|
343
|
+
sendToast(notify, "info", op.showToast, op.infoMessage);
|
|
344
|
+
_optionalChain([options, 'access', _8 => _8.onSuccess, 'optionalCall', _9 => _9()]);
|
|
345
|
+
return true;
|
|
289
346
|
}
|
|
290
347
|
function useCartActions(callbacks) {
|
|
291
348
|
const queryClient = _reactquery.useQueryClient.call(void 0, );
|
|
292
|
-
const cartHdrUid =
|
|
293
|
-
const cartLines =
|
|
294
|
-
const setCartLines =
|
|
349
|
+
const cartHdrUid = _chunk4PTXISXMcjs.useCartHdrUid.call(void 0, );
|
|
350
|
+
const cartLines = _chunk4PTXISXMcjs.useCartLines.call(void 0, );
|
|
351
|
+
const setCartLines = _chunk4PTXISXMcjs.useSetCartLines.call(void 0, );
|
|
295
352
|
const notify = callbacks.toast;
|
|
296
353
|
const invalidateCartCache = _react.useCallback.call(void 0, () => {
|
|
297
|
-
void queryClient.invalidateQueries({ queryKey: ["cartLines"
|
|
354
|
+
void queryClient.invalidateQueries({ queryKey: ["cartLines"] });
|
|
298
355
|
void queryClient.invalidateQueries({
|
|
299
356
|
queryKey: ["cart-also-bought", cartHdrUid]
|
|
300
357
|
});
|
|
@@ -302,10 +359,18 @@ function useCartActions(callbacks) {
|
|
|
302
359
|
const addToCart = _react.useCallback.call(void 0,
|
|
303
360
|
async (item, options = {}) => {
|
|
304
361
|
const { showToast = true, itemId = "" } = options;
|
|
362
|
+
const quantity = Number.isFinite(item.quantity) ? item.quantity : null;
|
|
363
|
+
if (!_chunk4PTXISXMcjs.addAccepted.call(void 0, item.unitOfMeasure, quantity)) {
|
|
364
|
+
sendToast(notify, "error", showToast, "Choose a quantity and a unit of measure.");
|
|
365
|
+
_optionalChain([options, 'access', _10 => _10.onError, 'optionalCall', _11 => _11(new Error("Quantity and unit of measure are required"))]);
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
305
368
|
const { uid, lines: liveLines } = liveCart();
|
|
369
|
+
_chunk4PTXISXMcjs.useCartStore.getState().beginCartOp();
|
|
306
370
|
setCartLines(buildOptimisticAdd(liveLines, item, uid, itemId));
|
|
307
371
|
return settleCartOp(
|
|
308
372
|
{
|
|
373
|
+
cartUid: uid,
|
|
309
374
|
call: () => callbacks.addToCart(uid, [
|
|
310
375
|
{
|
|
311
376
|
cartHdrUid: uid,
|
|
@@ -319,7 +384,7 @@ function useCartActions(callbacks) {
|
|
|
319
384
|
errorMessage: "Failed to add item to cart. Please try again.",
|
|
320
385
|
showToast,
|
|
321
386
|
rollback: () => setCartLines(
|
|
322
|
-
reverseAdd(
|
|
387
|
+
reverseAdd(_chunk4PTXISXMcjs.useCartStore.getState().cartLines, item.invMastUid, item.quantity)
|
|
323
388
|
)
|
|
324
389
|
},
|
|
325
390
|
options,
|
|
@@ -331,21 +396,30 @@ function useCartActions(callbacks) {
|
|
|
331
396
|
);
|
|
332
397
|
const updateQuantity = _react.useCallback.call(void 0,
|
|
333
398
|
async (invMastUid, newQuantity, options = {}) => {
|
|
334
|
-
const { showToast = false } = options;
|
|
399
|
+
const { showToast = false, unitOfMeasure } = options;
|
|
400
|
+
if (!_augurutils.lineHasQuantity.call(void 0, Number.isFinite(newQuantity) ? newQuantity : null)) {
|
|
401
|
+
sendToast(notify, "error", showToast, "Choose a quantity.");
|
|
402
|
+
_optionalChain([options, 'access', _12 => _12.onError, 'optionalCall', _13 => _13(new Error("Quantity is required"))]);
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
335
405
|
const { uid, lines: liveLines } = liveCart();
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
|
|
406
|
+
const target = targetOf(liveLines, invMastUid, unitOfMeasure);
|
|
407
|
+
if (target === null) return true;
|
|
408
|
+
const line = targetLine(liveLines, target);
|
|
409
|
+
const previousQuantity = line.quantity;
|
|
410
|
+
_chunk4PTXISXMcjs.useCartStore.getState().beginCartOp();
|
|
411
|
+
setCartLines(
|
|
412
|
+
liveLines.map((l) => isTarget(l, target) ? { ...l, quantity: newQuantity } : l)
|
|
339
413
|
);
|
|
340
|
-
setCartLines(updatedLines);
|
|
341
414
|
return settleCartOp(
|
|
342
415
|
{
|
|
343
|
-
|
|
416
|
+
cartUid: uid,
|
|
417
|
+
call: () => callbacks.updateCartLines(uid, [sentLine(line, newQuantity)]),
|
|
344
418
|
failure: "Failed to update quantity",
|
|
345
419
|
errorMessage: "Failed to update quantity. Please try again.",
|
|
346
420
|
showToast,
|
|
347
421
|
rollback: () => setCartLines(
|
|
348
|
-
reverseQuantity(
|
|
422
|
+
reverseQuantity(_chunk4PTXISXMcjs.useCartStore.getState().cartLines, target, previousQuantity)
|
|
349
423
|
)
|
|
350
424
|
},
|
|
351
425
|
options,
|
|
@@ -357,23 +431,22 @@ function useCartActions(callbacks) {
|
|
|
357
431
|
);
|
|
358
432
|
const removeFromCart = _react.useCallback.call(void 0,
|
|
359
433
|
async (invMastUid, options = {}) => {
|
|
360
|
-
const { showToast = true, itemId = "" } = options;
|
|
434
|
+
const { showToast = true, itemId = "", unitOfMeasure } = options;
|
|
361
435
|
const { uid, lines: liveLines } = liveCart();
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
);
|
|
436
|
+
const target = targetOf(liveLines, invMastUid, unitOfMeasure);
|
|
437
|
+
if (target === null) return true;
|
|
438
|
+
const removedLine = targetLine(liveLines, target);
|
|
439
|
+
_chunk4PTXISXMcjs.useCartStore.getState().beginCartOp();
|
|
440
|
+
setCartLines(liveLines.filter((l) => !isTarget(l, target)));
|
|
367
441
|
return settleCartOp(
|
|
368
442
|
{
|
|
369
|
-
|
|
443
|
+
cartUid: uid,
|
|
444
|
+
call: () => callbacks.updateCartLines(uid, [sentLine(removedLine, 0)]),
|
|
370
445
|
failure: "Failed to remove item",
|
|
371
446
|
infoMessage: `${itemId || "Item"} removed from cart`,
|
|
372
447
|
errorMessage: "Failed to remove item. Please try again.",
|
|
373
448
|
showToast,
|
|
374
|
-
rollback: () => setCartLines(
|
|
375
|
-
restoreRemoved(_chunkWJ6VEQ6Rcjs.useCartStore.getState().cartLines, invMastUid, removedLine)
|
|
376
|
-
)
|
|
449
|
+
rollback: () => setCartLines(restoreRemoved(_chunk4PTXISXMcjs.useCartStore.getState().cartLines, target, removedLine))
|
|
377
450
|
},
|
|
378
451
|
options,
|
|
379
452
|
notify,
|
|
@@ -386,15 +459,17 @@ function useCartActions(callbacks) {
|
|
|
386
459
|
async (options = {}) => {
|
|
387
460
|
const { showToast = true } = options;
|
|
388
461
|
const { uid, lines: snapshot } = liveCart();
|
|
462
|
+
_chunk4PTXISXMcjs.useCartStore.getState().beginCartOp();
|
|
389
463
|
setCartLines([]);
|
|
390
464
|
return settleCartOp(
|
|
391
465
|
{
|
|
466
|
+
cartUid: uid,
|
|
392
467
|
call: () => callbacks.deleteItemsFromCart(uid),
|
|
393
468
|
failure: "Failed to clear cart",
|
|
394
469
|
infoMessage: "Cart cleared",
|
|
395
470
|
errorMessage: "Failed to clear cart. Please try again.",
|
|
396
471
|
showToast,
|
|
397
|
-
rollback: () => setCartLines(mergeRestore(
|
|
472
|
+
rollback: () => setCartLines(mergeRestore(_chunk4PTXISXMcjs.useCartStore.getState().cartLines, snapshot))
|
|
398
473
|
},
|
|
399
474
|
options,
|
|
400
475
|
notify,
|
|
@@ -411,7 +486,7 @@ function useCartActions(callbacks) {
|
|
|
411
486
|
);
|
|
412
487
|
const getItemQuantity = _react.useCallback.call(void 0,
|
|
413
488
|
(invMastUid) => {
|
|
414
|
-
return _nullishCoalesce(_optionalChain([cartLines, 'access',
|
|
489
|
+
return _nullishCoalesce(_optionalChain([cartLines, 'access', _14 => _14.find, 'call', _15 => _15((line) => line.invMastUid === invMastUid), 'optionalAccess', _16 => _16.quantity]), () => ( 0));
|
|
415
490
|
},
|
|
416
491
|
[cartLines]
|
|
417
492
|
);
|
|
@@ -436,14 +511,14 @@ function useModalLifecycle(isOpen, onClose) {
|
|
|
436
511
|
setIsClient(true);
|
|
437
512
|
}, []);
|
|
438
513
|
_react.useEffect.call(void 0, () => {
|
|
439
|
-
document.body.style.overflow =
|
|
514
|
+
document.body.style.overflow = _chunk4PTXISXMcjs.bodyOverflow.call(void 0, isOpen);
|
|
440
515
|
return () => {
|
|
441
516
|
document.body.style.overflow = "auto";
|
|
442
517
|
};
|
|
443
518
|
}, [isOpen]);
|
|
444
519
|
_react.useEffect.call(void 0, () => {
|
|
445
520
|
const handleEscape = (e) => {
|
|
446
|
-
if (e.key
|
|
521
|
+
if (_chunk4PTXISXMcjs.closesOnKey.call(void 0, e.key, isOpen)) onClose();
|
|
447
522
|
};
|
|
448
523
|
document.addEventListener("keydown", handleEscape);
|
|
449
524
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
@@ -456,6 +531,7 @@ function useModalLifecycle(isOpen, onClose) {
|
|
|
456
531
|
|
|
457
532
|
var MAX_RETRY_ATTEMPTS = 7;
|
|
458
533
|
var RETRY_DELAY_MS = 1e3;
|
|
534
|
+
var LOOKUP_RESTART_MS = 3e4;
|
|
459
535
|
async function waitBeforeRetry(attempt) {
|
|
460
536
|
if (attempt >= MAX_RETRY_ATTEMPTS) return;
|
|
461
537
|
const delay = Math.min(RETRY_DELAY_MS * Math.pow(1.5, attempt), 1e4);
|
|
@@ -464,19 +540,22 @@ async function waitBeforeRetry(attempt) {
|
|
|
464
540
|
var defaultGetCartToken = () => localStorage.getItem("cartToken");
|
|
465
541
|
var defaultSaveCartToken = (token) => localStorage.setItem("cartToken", token);
|
|
466
542
|
var defaultGenerateCartToken = () => crypto.randomUUID();
|
|
543
|
+
function cartKey(uid) {
|
|
544
|
+
return uid === void 0 ? void 0 : String(uid);
|
|
545
|
+
}
|
|
467
546
|
function useCartInitialization(session, callbacks) {
|
|
468
547
|
const getCartToken = _nullishCoalesce(callbacks.getCartToken, () => ( defaultGetCartToken));
|
|
469
548
|
const saveCartToken = _nullishCoalesce(callbacks.saveCartToken, () => ( defaultSaveCartToken));
|
|
470
549
|
const generateCartToken = _nullishCoalesce(callbacks.generateCartToken, () => ( defaultGenerateCartToken));
|
|
471
550
|
const auth = useAugurAuth();
|
|
472
|
-
const cartHdrUid =
|
|
473
|
-
const setCartHdrUid =
|
|
474
|
-
const setCartLines =
|
|
475
|
-
const clearCart =
|
|
551
|
+
const cartHdrUid = _chunk4PTXISXMcjs.useCartHdrUid.call(void 0, );
|
|
552
|
+
const setCartHdrUid = _chunk4PTXISXMcjs.useSetCartHdrUid.call(void 0, );
|
|
553
|
+
const setCartLines = _chunk4PTXISXMcjs.useSetCartLines.call(void 0, );
|
|
554
|
+
const clearCart = _chunk4PTXISXMcjs.useClearCart.call(void 0, );
|
|
476
555
|
const queryClient = _reactquery.useQueryClient.call(void 0, );
|
|
477
556
|
const effectiveStatus = session.status;
|
|
478
|
-
const effectiveUserId = _nullishCoalesce(session.userId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
479
|
-
const effectiveCartHdrUid = _nullishCoalesce(session.cartHdrUid, () => ( _optionalChain([auth, 'optionalAccess',
|
|
557
|
+
const effectiveUserId = _nullishCoalesce(session.userId, () => ( _optionalChain([auth, 'optionalAccess', _17 => _17.userId])));
|
|
558
|
+
const effectiveCartHdrUid = _nullishCoalesce(session.cartHdrUid, () => ( _optionalChain([auth, 'optionalAccess', _18 => _18.cartHdrUid])));
|
|
480
559
|
const effectiveSession = _react.useMemo.call(void 0,
|
|
481
560
|
() => ({ status: effectiveStatus, userId: effectiveUserId, cartHdrUid: effectiveCartHdrUid }),
|
|
482
561
|
[effectiveStatus, effectiveUserId, effectiveCartHdrUid]
|
|
@@ -484,6 +563,11 @@ function useCartInitialization(session, callbacks) {
|
|
|
484
563
|
const retryCountRef = _react.useRef.call(void 0, 0);
|
|
485
564
|
const isInitializingRef = _react.useRef.call(void 0, false);
|
|
486
565
|
const prevStatusRef = _react.useRef.call(void 0, effectiveSession.status);
|
|
566
|
+
const statusRef = _react.useRef.call(void 0, effectiveSession.status);
|
|
567
|
+
statusRef.current = effectiveSession.status;
|
|
568
|
+
const [lookupRound, setLookupRound] = _react.useState.call(void 0, 0);
|
|
569
|
+
const restartTimerRef = _react.useRef.call(void 0, void 0);
|
|
570
|
+
_react.useEffect.call(void 0, () => () => clearTimeout(restartTimerRef.current), []);
|
|
487
571
|
_react.useEffect.call(void 0, () => {
|
|
488
572
|
const prevStatus = prevStatusRef.current;
|
|
489
573
|
prevStatusRef.current = effectiveSession.status;
|
|
@@ -494,40 +578,57 @@ function useCartInitialization(session, callbacks) {
|
|
|
494
578
|
}
|
|
495
579
|
}, [effectiveSession.status, clearCart, queryClient]);
|
|
496
580
|
_react.useEffect.call(void 0, () => {
|
|
497
|
-
|
|
498
|
-
|
|
581
|
+
const step = _chunk4PTXISXMcjs.initStepOf.call(void 0,
|
|
582
|
+
effectiveSession.status === "loading",
|
|
583
|
+
effectiveSession.status === "authenticated",
|
|
584
|
+
!!effectiveSession.cartHdrUid,
|
|
585
|
+
cartKey(cartHdrUid) === cartKey(effectiveSession.cartHdrUid),
|
|
586
|
+
!!cartHdrUid,
|
|
587
|
+
effectiveSession.userId !== void 0,
|
|
588
|
+
isInitializingRef.current
|
|
589
|
+
);
|
|
590
|
+
if (step.kind === "stay") return;
|
|
591
|
+
if (step.kind === "session") {
|
|
499
592
|
setCartHdrUid(effectiveSession.cartHdrUid);
|
|
500
593
|
return;
|
|
501
594
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
595
|
+
const forUser = step.kind === "user";
|
|
596
|
+
const lookupUserId = forUser ? effectiveSession.userId : "0";
|
|
597
|
+
isInitializingRef.current = true;
|
|
598
|
+
retryCountRef.current = 0;
|
|
599
|
+
const lookUpCart = async () => {
|
|
600
|
+
const existingToken = getCartToken();
|
|
601
|
+
const cartToken = existingToken && typeof existingToken === "string" ? existingToken : generateCartToken();
|
|
602
|
+
let lastError;
|
|
603
|
+
while (retryCountRef.current < MAX_RETRY_ATTEMPTS) {
|
|
604
|
+
try {
|
|
605
|
+
const cartHdr = await callbacks.cartHdrLookup(lookupUserId, cartToken);
|
|
606
|
+
if (cartHdr && cartHdr.cartHdrUid !== 0) {
|
|
607
|
+
const stillApplies = _chunk4PTXISXMcjs.acceptsLookup.call(void 0,
|
|
608
|
+
forUser,
|
|
609
|
+
statusRef.current === "authenticated",
|
|
610
|
+
!!_chunk4PTXISXMcjs.useCartStore.getState().cartHdrUid
|
|
611
|
+
);
|
|
612
|
+
if (stillApplies) {
|
|
513
613
|
saveCartToken(cartToken);
|
|
514
614
|
setCartHdrUid(cartHdr.cartHdrUid);
|
|
515
|
-
isInitializingRef.current = false;
|
|
516
|
-
return;
|
|
517
615
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
} catch (error) {
|
|
521
|
-
lastError = error;
|
|
522
|
-
retryCountRef.current++;
|
|
523
|
-
await waitBeforeRetry(retryCountRef.current);
|
|
616
|
+
isInitializingRef.current = false;
|
|
617
|
+
return;
|
|
524
618
|
}
|
|
619
|
+
retryCountRef.current++;
|
|
620
|
+
await waitBeforeRetry(retryCountRef.current);
|
|
621
|
+
} catch (error) {
|
|
622
|
+
lastError = error;
|
|
623
|
+
retryCountRef.current++;
|
|
624
|
+
await waitBeforeRetry(retryCountRef.current);
|
|
525
625
|
}
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
626
|
+
}
|
|
627
|
+
console.error(`Cart initialization failed after ${MAX_RETRY_ATTEMPTS} attempts`, lastError);
|
|
628
|
+
isInitializingRef.current = false;
|
|
629
|
+
restartTimerRef.current = setTimeout(() => setLookupRound((n) => n + 1), LOOKUP_RESTART_MS);
|
|
630
|
+
};
|
|
631
|
+
void lookUpCart();
|
|
531
632
|
}, [
|
|
532
633
|
effectiveSession,
|
|
533
634
|
cartHdrUid,
|
|
@@ -535,15 +636,17 @@ function useCartInitialization(session, callbacks) {
|
|
|
535
636
|
callbacks,
|
|
536
637
|
getCartToken,
|
|
537
638
|
saveCartToken,
|
|
538
|
-
generateCartToken
|
|
639
|
+
generateCartToken,
|
|
640
|
+
lookupRound
|
|
539
641
|
]);
|
|
540
642
|
const { data: cartLinesData } = _reactquery.useQuery.call(void 0, {
|
|
541
643
|
queryKey: ["cartLines", cartHdrUid],
|
|
542
644
|
queryFn: async () => await _asyncNullishCoalesce(await callbacks.getCartLines(Number(cartHdrUid)), async () => ( [])),
|
|
543
|
-
enabled: !!cartHdrUid
|
|
645
|
+
enabled: !!cartHdrUid,
|
|
646
|
+
structuralSharing: false
|
|
544
647
|
});
|
|
545
648
|
_react.useEffect.call(void 0, () => {
|
|
546
|
-
if (cartLinesData) {
|
|
649
|
+
if (cartLinesData && _chunk4PTXISXMcjs.cartIdle.call(void 0, _chunk4PTXISXMcjs.useCartStore.getState().pendingCartOps)) {
|
|
547
650
|
setCartLines(cartLinesData);
|
|
548
651
|
}
|
|
549
652
|
}, [cartLinesData, setCartLines]);
|
|
@@ -558,16 +661,28 @@ function useCartInitialization(session, callbacks) {
|
|
|
558
661
|
|
|
559
662
|
|
|
560
663
|
|
|
561
|
-
|
|
562
|
-
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
function derivedOrRefused(priceData, quantity) {
|
|
563
673
|
try {
|
|
564
|
-
|
|
565
|
-
return derived.state === "priced" ? derived.unitPrice : 0;
|
|
674
|
+
return _augurutils.derivePrice.call(void 0, { priceData, quantity });
|
|
566
675
|
} catch (error) {
|
|
567
|
-
if (error instanceof RangeError) return
|
|
676
|
+
if (error instanceof RangeError) return null;
|
|
568
677
|
throw error;
|
|
569
678
|
}
|
|
570
679
|
}
|
|
680
|
+
function deriveLineUnitPrice(priceData, quantity) {
|
|
681
|
+
const hasQuantity = typeof quantity === "number" && Number.isFinite(quantity);
|
|
682
|
+
const derived = hasQuantity ? derivedOrRefused(priceData, quantity) : null;
|
|
683
|
+
const priced = _optionalChain([derived, 'optionalAccess', _19 => _19.state]) === "priced";
|
|
684
|
+
return _chunk4PTXISXMcjs.lineUnitPrice.call(void 0, hasQuantity, priced, priced ? derived.unitPrice : 0);
|
|
685
|
+
}
|
|
571
686
|
function lineTotal(unitPrice, quantity) {
|
|
572
687
|
return Number.isFinite(quantity) ? _augurutils.cleanMoney.call(void 0, unitPrice * quantity) : 0;
|
|
573
688
|
}
|
|
@@ -575,54 +690,69 @@ function useCartPricing(options = {}) {
|
|
|
575
690
|
const proxy = useAugurOptions();
|
|
576
691
|
const auth = useAugurAuth();
|
|
577
692
|
const site = useAugurSite();
|
|
578
|
-
const cartLines =
|
|
579
|
-
const customerId = _nullishCoalesce(_nullishCoalesce(options.customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
693
|
+
const cartLines = _chunk4PTXISXMcjs.useCartLines.call(void 0, );
|
|
694
|
+
const customerId = _nullishCoalesce(_nullishCoalesce(options.customerId, () => ( _optionalChain([auth, 'optionalAccess', _20 => _20.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _21 => _21.defaults, 'optionalAccess', _22 => _22.customerId])));
|
|
580
695
|
const priceFn = options.queryFn;
|
|
696
|
+
const runs = cartLines.map((line) => _augurutils.priceQueryRuns.call(void 0, !!customerId, !!line.itemId, line.quantity));
|
|
581
697
|
const priceQueries = _reactquery.useQueries.call(void 0, {
|
|
582
|
-
queries: cartLines.map((line) => {
|
|
583
|
-
const quantity = _nullishCoalesce(line.quantity, () => (
|
|
698
|
+
queries: cartLines.map((line, index) => {
|
|
699
|
+
const quantity = _nullishCoalesce(line.quantity, () => ( 0));
|
|
700
|
+
const enabled = runs[index] === true;
|
|
701
|
+
const unitOfMeasure = _nullishCoalesce(_augurutils.priceQueryUnit.call(void 0, line.unitOfMeasure), () => ( void 0));
|
|
584
702
|
if (priceFn) {
|
|
585
703
|
return {
|
|
586
|
-
queryKey: [
|
|
587
|
-
|
|
704
|
+
queryKey: [
|
|
705
|
+
"price",
|
|
706
|
+
_optionalChain([line, 'access', _23 => _23.itemId, 'optionalAccess', _24 => _24.toUpperCase, 'call', _25 => _25()]) || "",
|
|
707
|
+
customerId,
|
|
708
|
+
quantity,
|
|
709
|
+
_nullishCoalesce(unitOfMeasure, () => ( ""))
|
|
710
|
+
],
|
|
711
|
+
queryFn: () => priceFn(line.itemId, customerId, quantity, unitOfMeasure),
|
|
588
712
|
refetchOnReconnect: true,
|
|
589
713
|
refetchOnWindowFocus: false,
|
|
590
714
|
meta: { persist: true },
|
|
591
|
-
enabled
|
|
715
|
+
enabled
|
|
592
716
|
};
|
|
593
717
|
}
|
|
594
718
|
const proxyOpts = proxy.pricing.priceEngine.list({
|
|
595
|
-
itemId: _optionalChain([line, 'access',
|
|
719
|
+
itemId: _optionalChain([line, 'access', _26 => _26.itemId, 'optionalAccess', _27 => _27.toUpperCase, 'call', _28 => _28()]) || "",
|
|
596
720
|
customerId: Number(customerId),
|
|
597
|
-
quantity
|
|
721
|
+
quantity,
|
|
722
|
+
unitOfMeasure
|
|
598
723
|
});
|
|
599
724
|
return {
|
|
600
725
|
...proxyOpts,
|
|
601
|
-
enabled
|
|
726
|
+
enabled,
|
|
602
727
|
refetchOnReconnect: true,
|
|
603
728
|
refetchOnWindowFocus: false,
|
|
604
729
|
meta: { persist: true }
|
|
605
730
|
};
|
|
606
731
|
})
|
|
607
732
|
});
|
|
733
|
+
const linePrices = _react.useMemo.call(void 0,
|
|
734
|
+
() => cartLines.map((line, index) => {
|
|
735
|
+
const priceData = _optionalChain([priceQueries, 'access', _29 => _29[index], 'optionalAccess', _30 => _30.data]);
|
|
736
|
+
if (!priceData) return null;
|
|
737
|
+
return {
|
|
738
|
+
unitPrice: deriveLineUnitPrice(priceData, line.quantity),
|
|
739
|
+
priceData
|
|
740
|
+
};
|
|
741
|
+
}),
|
|
742
|
+
[cartLines, priceQueries]
|
|
743
|
+
);
|
|
744
|
+
const lineUnitPrices = _react.useMemo.call(void 0, () => linePrices.map((p) => _nullishCoalesce(_optionalChain([p, 'optionalAccess', _31 => _31.unitPrice]), () => ( 0))), [linePrices]);
|
|
608
745
|
const prices = _react.useMemo.call(void 0, () => {
|
|
609
746
|
const map = {};
|
|
610
747
|
cartLines.forEach((line, index) => {
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
if (priceData) {
|
|
614
|
-
const unitPrice = deriveLineUnitPrice(priceData, line.quantity);
|
|
615
|
-
map[line.itemId.toUpperCase()] = {
|
|
616
|
-
unitPrice,
|
|
617
|
-
priceData
|
|
618
|
-
};
|
|
619
|
-
}
|
|
748
|
+
const linePrice = linePrices[index];
|
|
749
|
+
if (linePrice) map[line.itemId.toUpperCase()] = linePrice;
|
|
620
750
|
});
|
|
621
751
|
return map;
|
|
622
|
-
}, [cartLines,
|
|
752
|
+
}, [cartLines, linePrices]);
|
|
623
753
|
const getUnitPrice = _react.useMemo.call(void 0, () => {
|
|
624
754
|
return (itemId) => {
|
|
625
|
-
return _nullishCoalesce(_optionalChain([prices, 'access',
|
|
755
|
+
return _nullishCoalesce(_optionalChain([prices, 'access', _32 => _32[_optionalChain([itemId, 'optionalAccess', _33 => _33.toUpperCase, 'call', _34 => _34()])], 'optionalAccess', _35 => _35.unitPrice]), () => ( 0));
|
|
626
756
|
};
|
|
627
757
|
}, [prices]);
|
|
628
758
|
const getItemTotal = _react.useMemo.call(void 0, () => {
|
|
@@ -630,19 +760,36 @@ function useCartPricing(options = {}) {
|
|
|
630
760
|
return lineTotal(getUnitPrice(itemId), quantity);
|
|
631
761
|
};
|
|
632
762
|
}, [getUnitPrice]);
|
|
763
|
+
const getLineUnitPrice = _react.useMemo.call(void 0, () => {
|
|
764
|
+
return (index) => _augurutils.linePriceAt.call(void 0, lineUnitPrices, index);
|
|
765
|
+
}, [lineUnitPrices]);
|
|
766
|
+
const getLineTotal = _react.useMemo.call(void 0, () => {
|
|
767
|
+
return (index) => lineTotal(_augurutils.linePriceAt.call(void 0, lineUnitPrices, index), _nullishCoalesce(_optionalChain([cartLines, 'access', _36 => _36[index], 'optionalAccess', _37 => _37.quantity]), () => ( null)));
|
|
768
|
+
}, [cartLines, lineUnitPrices]);
|
|
633
769
|
const subtotal = _react.useMemo.call(void 0, () => {
|
|
634
|
-
return cartLines.reduce(
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}, [cartLines,
|
|
639
|
-
const isLoading =
|
|
640
|
-
|
|
770
|
+
return cartLines.reduce(
|
|
771
|
+
(sum, line, index) => _augurutils.cleanMoney.call(void 0, sum + lineTotal(_augurutils.linePriceAt.call(void 0, lineUnitPrices, index), line.quantity)),
|
|
772
|
+
0
|
|
773
|
+
);
|
|
774
|
+
}, [cartLines, lineUnitPrices]);
|
|
775
|
+
const isLoading = _augurutils.pricingLoadingFrom.call(void 0,
|
|
776
|
+
priceQueries.map((q) => q.isLoading),
|
|
777
|
+
runs,
|
|
778
|
+
0
|
|
779
|
+
);
|
|
780
|
+
const isSuccess = _augurutils.pricingSettledFrom.call(void 0,
|
|
781
|
+
priceQueries.map((q) => q.isSuccess),
|
|
782
|
+
runs,
|
|
783
|
+
0
|
|
784
|
+
);
|
|
641
785
|
const isError = priceQueries.some((q) => q.isError);
|
|
642
786
|
return {
|
|
643
787
|
prices,
|
|
788
|
+
linePrices,
|
|
644
789
|
getUnitPrice,
|
|
645
790
|
getItemTotal,
|
|
791
|
+
getLineUnitPrice,
|
|
792
|
+
getLineTotal,
|
|
646
793
|
subtotal,
|
|
647
794
|
isLoading,
|
|
648
795
|
isSuccess,
|
|
@@ -710,7 +857,7 @@ function deserialize(data) {
|
|
|
710
857
|
|
|
711
858
|
// src/persistence/apply-limits.ts
|
|
712
859
|
function applyLimits(data, limits) {
|
|
713
|
-
const queries = _optionalChain([data, 'access',
|
|
860
|
+
const queries = _optionalChain([data, 'access', _38 => _38.clientState, 'optionalAccess', _39 => _39.queries]);
|
|
714
861
|
if (!queries || Object.keys(limits).length === 0) return data;
|
|
715
862
|
const entries = queries;
|
|
716
863
|
const unlimited = [];
|
|
@@ -794,7 +941,7 @@ function createPersister(config) {
|
|
|
794
941
|
var CHECK_INTERVAL = _augurutils.toMillis.call(void 0, _augurutils.minutes.call(void 0, 5));
|
|
795
942
|
function useStorageMonitor(config) {
|
|
796
943
|
const { key, limits = {}, maxStorageMB = 3 } = config;
|
|
797
|
-
const limitKeysRef =
|
|
944
|
+
const limitKeysRef = _chunk4PTXISXMcjs.useLatest.call(void 0, Object.keys(limits));
|
|
798
945
|
const limitCount = limitKeysRef.current.length;
|
|
799
946
|
_react.useEffect.call(void 0, () => {
|
|
800
947
|
const limitKeys = limitKeysRef.current;
|
|
@@ -812,7 +959,7 @@ function useStorageMonitor(config) {
|
|
|
812
959
|
const raw = storage.getItem(key);
|
|
813
960
|
if (!raw) return;
|
|
814
961
|
const parsed = JSON.parse(raw);
|
|
815
|
-
if (!_optionalChain([parsed, 'access',
|
|
962
|
+
if (!_optionalChain([parsed, 'access', _40 => _40.clientState, 'optionalAccess', _41 => _41.queries])) return;
|
|
816
963
|
parsed.clientState.queries = parsed.clientState.queries.filter(
|
|
817
964
|
(q) => {
|
|
818
965
|
if (!Array.isArray(q.queryKey)) return true;
|
|
@@ -840,14 +987,14 @@ function useAugurPersistence(config) {
|
|
|
840
987
|
setIsMounted(true);
|
|
841
988
|
}, []);
|
|
842
989
|
useStorageMonitor(config);
|
|
843
|
-
const isDev = typeof process !== "undefined" && _optionalChain([process, 'access',
|
|
990
|
+
const isDev = typeof process !== "undefined" && _optionalChain([process, 'access', _42 => _42.env, 'optionalAccess', _43 => _43["NODE_ENV"]]) === "development";
|
|
844
991
|
const { persistableKeys } = config;
|
|
845
992
|
const dehydrateOptions = _react.useMemo.call(void 0,
|
|
846
993
|
() => ({
|
|
847
994
|
shouldDehydrateQuery: (query) => {
|
|
848
995
|
const key = query.queryKey;
|
|
849
996
|
const hasHead = Array.isArray(key) && key.length > 0;
|
|
850
|
-
return
|
|
997
|
+
return _chunk4PTXISXMcjs.shouldPersistOf.call(void 0,
|
|
851
998
|
hasHead,
|
|
852
999
|
query.state.status === "success",
|
|
853
1000
|
hasHead && persistableKeys.includes(key[0])
|
|
@@ -868,11 +1015,11 @@ function useAugurPersistence(config) {
|
|
|
868
1015
|
|
|
869
1016
|
function keyPathOf(key) {
|
|
870
1017
|
const segments = _nullishCoalesce(key, () => ( []));
|
|
871
|
-
const n =
|
|
1018
|
+
const n = _chunk4PTXISXMcjs.leadingTextsFrom.call(void 0,
|
|
872
1019
|
segments.map((s) => typeof s === "string"),
|
|
873
1020
|
0
|
|
874
1021
|
);
|
|
875
|
-
return
|
|
1022
|
+
return _chunk4PTXISXMcjs.keyPathFrom.call(void 0, segments, n);
|
|
876
1023
|
}
|
|
877
1024
|
function clearUserReadsOnWrite(queryClient, mutationKey) {
|
|
878
1025
|
const writePath = keyPathOf(mutationKey);
|
|
@@ -925,5 +1072,5 @@ function userWriteClearing(getQueryClient) {
|
|
|
925
1072
|
|
|
926
1073
|
|
|
927
1074
|
|
|
928
|
-
exports.AugurHooksProvider = AugurHooksProvider; exports.clearCheckoutPersistence =
|
|
1075
|
+
exports.AugurHooksProvider = AugurHooksProvider; exports.clearCheckoutPersistence = _chunk4PTXISXMcjs.clearCheckoutPersistence; exports.clearFromSession = _chunk4PTXISXMcjs.clearFromSession; exports.clearUserReadsOnWrite = clearUserReadsOnWrite; exports.determineOrderReadiness = _chunk4PTXISXMcjs.determineOrderReadiness; exports.executeBatchQuery = _chunkWJ4D5OCQcjs.executeBatchQuery; exports.getRegisteredQueryAction = _chunkWJ4D5OCQcjs.getRegisteredQueryAction; exports.keyPathOf = keyPathOf; exports.loadFromSession = _chunk4PTXISXMcjs.loadFromSession; exports.registerQueryAction = _chunkWJ4D5OCQcjs.registerQueryAction; exports.saveToSession = _chunk4PTXISXMcjs.saveToSession; exports.useAugurApi = useAugurApi; exports.useAugurApiOptional = useAugurApiOptional; exports.useAugurAuth = useAugurAuth; exports.useAugurCache = useAugurCache; exports.useAugurOptions = useAugurOptions; exports.useAugurPersistence = useAugurPersistence; exports.useAugurSite = useAugurSite; exports.useCartActions = useCartActions; exports.useCartHdrUid = _chunk4PTXISXMcjs.useCartHdrUid; exports.useCartInitialization = useCartInitialization; exports.useCartLineCount = _chunk4PTXISXMcjs.useCartLineCount; exports.useCartLines = _chunk4PTXISXMcjs.useCartLines; exports.useCartPricing = useCartPricing; exports.useCartQuantityTotal = _chunk4PTXISXMcjs.useCartQuantityTotal; exports.useCartStore = _chunk4PTXISXMcjs.useCartStore; exports.useCheckoutPersistence = _chunk4PTXISXMcjs.useCheckoutPersistence; exports.useClearCart = _chunk4PTXISXMcjs.useClearCart; exports.useDebounce = useDebounce; exports.useFormatPrice = useFormatPrice; exports.useItemFiltersStore = useItemFiltersStore; exports.useModalLifecycle = useModalLifecycle; exports.useOrderReadiness = _chunk4PTXISXMcjs.useOrderReadiness; exports.usePaginationPrefetch = usePaginationPrefetch; exports.usePaymentFlow = _chunk4PTXISXMcjs.usePaymentFlow; exports.useSetCartHdrUid = _chunk4PTXISXMcjs.useSetCartHdrUid; exports.useSetCartLines = _chunk4PTXISXMcjs.useSetCartLines; exports.useStock = useStock; exports.userWriteClearing = userWriteClearing;
|
|
929
1076
|
//# sourceMappingURL=index.cjs.map
|