@simpleapps-com/augur-hooks 0.4.3 → 0.5.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/dist/{chunk-I3JHJMQ6.cjs → chunk-FKM6A6QW.cjs} +134 -63
- package/dist/chunk-FKM6A6QW.cjs.map +1 -0
- package/dist/{chunk-CL3XM5B5.js → chunk-PZK7QARW.js} +72 -1
- package/dist/chunk-PZK7QARW.js.map +1 -0
- package/dist/{customer-quotes-SdLKX_-8.d.cts → customer-quotes-DjCgi3z3.d.cts} +52 -1
- package/dist/{customer-quotes-SdLKX_-8.d.ts → customer-quotes-DjCgi3z3.d.ts} +52 -1
- package/dist/index.cjs +145 -101
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +79 -35
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +23 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +12 -2
- package/dist/server.d.ts +12 -2
- package/dist/server.js +22 -1
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-CL3XM5B5.js.map +0 -1
- package/dist/chunk-I3JHJMQ6.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,10 @@
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
var _chunkFKM6A6QWcjs = require('./chunk-FKM6A6QW.cjs');
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
var _chunkAXCNTEABcjs = require('./chunk-AXCNTEAB.cjs');
|
|
@@ -186,7 +189,7 @@ function useItemPrice(itemId, customerId, quantity = 1, options = {}) {
|
|
|
186
189
|
const auth = useAugurAuth();
|
|
187
190
|
const cache = useAugurCache();
|
|
188
191
|
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _ => _.customerId])));
|
|
189
|
-
const defaultOptions =
|
|
192
|
+
const defaultOptions = _chunkFKM6A6QWcjs.getItemPriceOptions.call(void 0, api, itemId, effectiveCustomerId, quantity, cache);
|
|
190
193
|
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _2 => _2.getItemPrice]) ? () => callbacks.getItemPrice(itemId, effectiveCustomerId, quantity) : void 0)));
|
|
191
194
|
return _reactquery.useQuery.call(void 0, {
|
|
192
195
|
...defaultOptions,
|
|
@@ -202,7 +205,7 @@ function useInvMastDoc(invMastUid, itemId, options = {}) {
|
|
|
202
205
|
const api = useAugurApiOptional();
|
|
203
206
|
const callbacks = useAugurCallbacks();
|
|
204
207
|
const cache = useAugurCache();
|
|
205
|
-
const queryOpts =
|
|
208
|
+
const queryOpts = _chunkFKM6A6QWcjs.getInvMastDocOptions.call(void 0,
|
|
206
209
|
api,
|
|
207
210
|
invMastUid,
|
|
208
211
|
itemId,
|
|
@@ -224,7 +227,7 @@ function useItemCategory(itemCategoryUid, options = {}) {
|
|
|
224
227
|
const api = useAugurApiOptional();
|
|
225
228
|
const callbacks = useAugurCallbacks();
|
|
226
229
|
const cache = useAugurCache();
|
|
227
|
-
const queryOpts =
|
|
230
|
+
const queryOpts = _chunkFKM6A6QWcjs.getItemCategoryOptions.call(void 0,
|
|
228
231
|
api,
|
|
229
232
|
itemCategoryUid,
|
|
230
233
|
options.apiOptions,
|
|
@@ -244,7 +247,7 @@ function useInvMast(invMastUid, itemId, options = {}) {
|
|
|
244
247
|
const api = useAugurApiOptional();
|
|
245
248
|
const callbacks = useAugurCallbacks();
|
|
246
249
|
const cache = useAugurCache();
|
|
247
|
-
const queryOpts =
|
|
250
|
+
const queryOpts = _chunkFKM6A6QWcjs.getInvMastOptions.call(void 0, api, invMastUid, itemId, cache);
|
|
248
251
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
249
252
|
...queryOpts,
|
|
250
253
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _5 => _5.getInvMast]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMast(invMastUid, itemId)))) } : {},
|
|
@@ -259,7 +262,7 @@ function useInvMastStock(invMastUid, options = {}) {
|
|
|
259
262
|
const api = useAugurApiOptional();
|
|
260
263
|
const callbacks = useAugurCallbacks();
|
|
261
264
|
const cache = useAugurCache();
|
|
262
|
-
const queryOpts =
|
|
265
|
+
const queryOpts = _chunkFKM6A6QWcjs.getInvMastStockOptions.call(void 0, api, invMastUid, cache);
|
|
263
266
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
264
267
|
...queryOpts,
|
|
265
268
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _6 => _6.getInvMastStock]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMastStock(invMastUid)))) } : {},
|
|
@@ -276,26 +279,62 @@ function useInvMastStock(invMastUid, options = {}) {
|
|
|
276
279
|
};
|
|
277
280
|
}
|
|
278
281
|
|
|
282
|
+
// src/hooks/use-batch-inv-mast-doc.ts
|
|
283
|
+
|
|
284
|
+
function useBatchInvMastDoc(params, options = {}) {
|
|
285
|
+
const api = useAugurApiOptional();
|
|
286
|
+
const callbacks = useAugurCallbacks();
|
|
287
|
+
const cache = useAugurCache();
|
|
288
|
+
const queryClient = _reactquery.useQueryClient.call(void 0, );
|
|
289
|
+
const includePricing = _nullishCoalesce(options.includePricing, () => ( "N"));
|
|
290
|
+
const batchOpts = _chunkFKM6A6QWcjs.getBatchInvMastDocOptions.call(void 0, api, params, includePricing, cache);
|
|
291
|
+
const resolveFetchItems = (uncached) => {
|
|
292
|
+
if (options.queryFn) {
|
|
293
|
+
return options.queryFn(uncached, includePricing);
|
|
294
|
+
}
|
|
295
|
+
if (_optionalChain([callbacks, 'optionalAccess', _7 => _7.batchGetInvMastDocs])) {
|
|
296
|
+
return callbacks.batchGetInvMastDocs(uncached, includePricing);
|
|
297
|
+
}
|
|
298
|
+
const fallbackOpts = _chunkFKM6A6QWcjs.getBatchInvMastDocOptions.call(void 0, api, uncached, includePricing, cache);
|
|
299
|
+
return fallbackOpts.queryFn();
|
|
300
|
+
};
|
|
301
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
302
|
+
queryKey: batchOpts.queryKey,
|
|
303
|
+
queryFn: () => _chunkFKM6A6QWcjs.executeBatchQuery.call(void 0, {
|
|
304
|
+
params,
|
|
305
|
+
queryClient,
|
|
306
|
+
getItemKey: (p) => _chunkFKM6A6QWcjs.getInvMastDocKey.call(void 0, p.invMastUid, p.itemId, includePricing),
|
|
307
|
+
getResultKey: (p) => p.itemId.toUpperCase(),
|
|
308
|
+
fetchItems: resolveFetchItems,
|
|
309
|
+
getSeedKey: (_key, doc) => _chunkFKM6A6QWcjs.getInvMastDocKey.call(void 0, doc.invMastUid, doc.itemId, includePricing)
|
|
310
|
+
}),
|
|
311
|
+
staleTime: batchOpts.staleTime,
|
|
312
|
+
gcTime: batchOpts.gcTime,
|
|
313
|
+
enabled: params.length > 0 && (_nullishCoalesce(options.enabled, () => ( true)))
|
|
314
|
+
});
|
|
315
|
+
return { items: _nullishCoalesce(data, () => ( {})), isLoading, error: _nullishCoalesce(error, () => ( null)) };
|
|
316
|
+
}
|
|
317
|
+
|
|
279
318
|
// src/hooks/use-product-category.ts
|
|
280
319
|
|
|
281
320
|
function resolveData(data) {
|
|
282
321
|
return {
|
|
283
|
-
childrenTotal: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
284
|
-
itemCategoryDesc: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
285
|
-
productCategories: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
286
|
-
productCategoryImage: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
322
|
+
childrenTotal: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _8 => _8.childrenTotal]), () => ( 0)),
|
|
323
|
+
itemCategoryDesc: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _9 => _9.itemCategoryDesc]), () => ( "")),
|
|
324
|
+
productCategories: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _10 => _10.children]), () => ( null)),
|
|
325
|
+
productCategoryImage: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _11 => _11.categoryImage]), () => ( null))
|
|
287
326
|
};
|
|
288
327
|
}
|
|
289
328
|
function useProductCategory(itemCategoryUid, options = {}) {
|
|
290
329
|
const api = useAugurApiOptional();
|
|
291
330
|
const callbacks = useAugurCallbacks();
|
|
292
331
|
const cache = useAugurCache();
|
|
293
|
-
const baseOptions = itemCategoryUid ?
|
|
294
|
-
queryKey:
|
|
332
|
+
const baseOptions = itemCategoryUid ? _chunkFKM6A6QWcjs.getProductCategoryOptions.call(void 0, api, itemCategoryUid, cache) : {
|
|
333
|
+
queryKey: _chunkFKM6A6QWcjs.getProductCategoryKey.call(void 0, null),
|
|
295
334
|
/* v8 ignore next */
|
|
296
335
|
queryFn: () => Promise.reject()
|
|
297
336
|
};
|
|
298
|
-
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess',
|
|
337
|
+
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _12 => _12.getProductCategory]) ? () => callbacks.getProductCategory(itemCategoryUid) : void 0)));
|
|
299
338
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
300
339
|
...baseOptions,
|
|
301
340
|
...resolvedQueryFn ? { queryFn: resolvedQueryFn } : {},
|
|
@@ -319,19 +358,19 @@ function useItemDetails(itemId, options = {}) {
|
|
|
319
358
|
const callbacks = useAugurCallbacks();
|
|
320
359
|
const cache = useAugurCache();
|
|
321
360
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
322
|
-
...itemId ?
|
|
323
|
-
queryKey:
|
|
361
|
+
...itemId ? _chunkFKM6A6QWcjs.getItemDetailsOptions.call(void 0, api, itemId, cache) : {
|
|
362
|
+
queryKey: _chunkFKM6A6QWcjs.getItemDetailsKey.call(void 0, ""),
|
|
324
363
|
/* v8 ignore next */
|
|
325
364
|
queryFn: () => Promise.reject()
|
|
326
365
|
},
|
|
327
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
366
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _13 => _13.getItemDetails]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getItemDetails(itemId)))) } : {},
|
|
328
367
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!itemId,
|
|
329
368
|
retry: 3,
|
|
330
369
|
/* v8 ignore start */
|
|
331
370
|
retryDelay: (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 1e4)
|
|
332
371
|
/* v8 ignore stop */
|
|
333
372
|
});
|
|
334
|
-
const categoryList = _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
373
|
+
const categoryList = _nullishCoalesce(_optionalChain([data, 'optionalAccess', _14 => _14.categoryList]), () => ( []));
|
|
335
374
|
return {
|
|
336
375
|
itemCategoryUid: categoryList.length > 0 ? categoryList[categoryList.length - 1] : null,
|
|
337
376
|
itemDetails: _nullishCoalesce(data, () => ( null)),
|
|
@@ -347,12 +386,12 @@ function useItemAttributes(itemCategoryUid, options = {}) {
|
|
|
347
386
|
const callbacks = useAugurCallbacks();
|
|
348
387
|
const cache = useAugurCache();
|
|
349
388
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
350
|
-
...itemCategoryUid ?
|
|
351
|
-
queryKey:
|
|
389
|
+
...itemCategoryUid ? _chunkFKM6A6QWcjs.getItemAttributesOptions.call(void 0, api, itemCategoryUid, cache) : {
|
|
390
|
+
queryKey: _chunkFKM6A6QWcjs.getItemAttributesKey.call(void 0, null),
|
|
352
391
|
/* v8 ignore next */
|
|
353
392
|
queryFn: () => Promise.reject()
|
|
354
393
|
},
|
|
355
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
394
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _15 => _15.getItemAttributes]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getItemAttributes(itemCategoryUid)))) } : {},
|
|
356
395
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!itemCategoryUid,
|
|
357
396
|
retry: 3,
|
|
358
397
|
/* v8 ignore start */
|
|
@@ -360,7 +399,7 @@ function useItemAttributes(itemCategoryUid, options = {}) {
|
|
|
360
399
|
/* v8 ignore stop */
|
|
361
400
|
});
|
|
362
401
|
return {
|
|
363
|
-
attributes: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
402
|
+
attributes: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _16 => _16.attributes]), () => ( null)),
|
|
364
403
|
loading: isLoading,
|
|
365
404
|
error
|
|
366
405
|
};
|
|
@@ -372,18 +411,18 @@ function useProductSearch(pageData, options = {}) {
|
|
|
372
411
|
const api = useAugurApiOptional();
|
|
373
412
|
const callbacks = useAugurCallbacks();
|
|
374
413
|
const cache = useAugurCache();
|
|
375
|
-
const defaultOptions =
|
|
414
|
+
const defaultOptions = _chunkFKM6A6QWcjs.getProductSearchOptions.call(void 0, api, pageData, cache);
|
|
376
415
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
377
416
|
...defaultOptions,
|
|
378
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
417
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _17 => _17.getProductSearch]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getProductSearch(pageData)))) } : {},
|
|
379
418
|
retry: 3,
|
|
380
419
|
/* v8 ignore start */
|
|
381
420
|
retryDelay: (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 1e4)
|
|
382
421
|
/* v8 ignore stop */
|
|
383
422
|
});
|
|
384
423
|
return {
|
|
385
|
-
productItems: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
386
|
-
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
424
|
+
productItems: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _18 => _18.items]), () => ( null)),
|
|
425
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _19 => _19.totalResults]), () => ( 0)),
|
|
387
426
|
loading: isLoading,
|
|
388
427
|
error
|
|
389
428
|
};
|
|
@@ -398,15 +437,15 @@ function useSearchSuggestions(query, options = {}) {
|
|
|
398
437
|
const limit = _nullishCoalesce(options.limit, () => ( 10));
|
|
399
438
|
const offset = _nullishCoalesce(options.offset, () => ( 0));
|
|
400
439
|
const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && query.trim().length > 0;
|
|
401
|
-
const defaultOptions =
|
|
440
|
+
const defaultOptions = _chunkFKM6A6QWcjs.getSearchSuggestionsOptions.call(void 0, api, query, limit, offset, cache);
|
|
402
441
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
403
442
|
...defaultOptions,
|
|
404
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
443
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _20 => _20.getSearchSuggestions]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getSearchSuggestions(query, limit, offset)))) } : {},
|
|
405
444
|
enabled
|
|
406
445
|
});
|
|
407
446
|
return {
|
|
408
|
-
suggestions: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
409
|
-
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
447
|
+
suggestions: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _21 => _21.data]), () => ( [])),
|
|
448
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _22 => _22.total]), () => ( 0)),
|
|
410
449
|
isLoading,
|
|
411
450
|
error
|
|
412
451
|
};
|
|
@@ -473,17 +512,17 @@ function useCartActions(callbacks) {
|
|
|
473
512
|
]);
|
|
474
513
|
if (!success) throw new Error("Failed to add item to cart");
|
|
475
514
|
invalidateCartCache();
|
|
476
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
515
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _23 => _23.info])) {
|
|
477
516
|
notify.info(`${item.quantity} x ${itemId || "Item"} added to cart`);
|
|
478
517
|
}
|
|
479
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
518
|
+
_optionalChain([onSuccess, 'optionalCall', _24 => _24()]);
|
|
480
519
|
return true;
|
|
481
520
|
} catch (error) {
|
|
482
521
|
setCartLines(previousCartLines);
|
|
483
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
522
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _25 => _25.error])) {
|
|
484
523
|
notify.error("Failed to add item to cart. Please try again.");
|
|
485
524
|
}
|
|
486
|
-
_optionalChain([onError, 'optionalCall',
|
|
525
|
+
_optionalChain([onError, 'optionalCall', _26 => _26(error)]);
|
|
487
526
|
return false;
|
|
488
527
|
}
|
|
489
528
|
},
|
|
@@ -502,14 +541,14 @@ function useCartActions(callbacks) {
|
|
|
502
541
|
const success = await callbacks.updateCartLines(uid, updatedLines);
|
|
503
542
|
if (!success) throw new Error("Failed to update quantity");
|
|
504
543
|
invalidateCartCache();
|
|
505
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
544
|
+
_optionalChain([onSuccess, 'optionalCall', _27 => _27()]);
|
|
506
545
|
return true;
|
|
507
546
|
} catch (error) {
|
|
508
547
|
setCartLines(previousCartLines);
|
|
509
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
548
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _28 => _28.error])) {
|
|
510
549
|
notify.error("Failed to update quantity. Please try again.");
|
|
511
550
|
}
|
|
512
|
-
_optionalChain([onError, 'optionalCall',
|
|
551
|
+
_optionalChain([onError, 'optionalCall', _29 => _29(error)]);
|
|
513
552
|
return false;
|
|
514
553
|
}
|
|
515
554
|
},
|
|
@@ -528,17 +567,17 @@ function useCartActions(callbacks) {
|
|
|
528
567
|
const success = await callbacks.updateCartLines(uid, zeroedLines);
|
|
529
568
|
if (!success) throw new Error("Failed to remove item");
|
|
530
569
|
invalidateCartCache();
|
|
531
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
570
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _30 => _30.info])) {
|
|
532
571
|
notify.info(`${itemId || "Item"} removed from cart`);
|
|
533
572
|
}
|
|
534
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
573
|
+
_optionalChain([onSuccess, 'optionalCall', _31 => _31()]);
|
|
535
574
|
return true;
|
|
536
575
|
} catch (error) {
|
|
537
576
|
setCartLines(previousCartLines);
|
|
538
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
577
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _32 => _32.error])) {
|
|
539
578
|
notify.error("Failed to remove item. Please try again.");
|
|
540
579
|
}
|
|
541
|
-
_optionalChain([onError, 'optionalCall',
|
|
580
|
+
_optionalChain([onError, 'optionalCall', _33 => _33(error)]);
|
|
542
581
|
return false;
|
|
543
582
|
}
|
|
544
583
|
},
|
|
@@ -554,17 +593,17 @@ function useCartActions(callbacks) {
|
|
|
554
593
|
const success = await callbacks.deleteItemsFromCart(uid);
|
|
555
594
|
if (!success) throw new Error("Failed to clear cart");
|
|
556
595
|
invalidateCartCache();
|
|
557
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
596
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _34 => _34.info])) {
|
|
558
597
|
notify.info("Cart cleared");
|
|
559
598
|
}
|
|
560
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
599
|
+
_optionalChain([onSuccess, 'optionalCall', _35 => _35()]);
|
|
561
600
|
return true;
|
|
562
601
|
} catch (error) {
|
|
563
602
|
setCartLines(previousCartLines);
|
|
564
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
603
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _36 => _36.error])) {
|
|
565
604
|
notify.error("Failed to clear cart. Please try again.");
|
|
566
605
|
}
|
|
567
|
-
_optionalChain([onError, 'optionalCall',
|
|
606
|
+
_optionalChain([onError, 'optionalCall', _37 => _37(error)]);
|
|
568
607
|
return false;
|
|
569
608
|
}
|
|
570
609
|
},
|
|
@@ -578,7 +617,7 @@ function useCartActions(callbacks) {
|
|
|
578
617
|
);
|
|
579
618
|
const getItemQuantity = _react.useCallback.call(void 0,
|
|
580
619
|
(invMastUid) => {
|
|
581
|
-
return _nullishCoalesce(_optionalChain([cartLines, 'access',
|
|
620
|
+
return _nullishCoalesce(_optionalChain([cartLines, 'access', _38 => _38.find, 'call', _39 => _39((line) => line.invMastUid === invMastUid), 'optionalAccess', _40 => _40.quantity]), () => ( 0));
|
|
582
621
|
},
|
|
583
622
|
[cartLines]
|
|
584
623
|
);
|
|
@@ -608,8 +647,8 @@ function useCartInitialization(session, callbacks) {
|
|
|
608
647
|
const clearCart = useClearCart();
|
|
609
648
|
const queryClient = _reactquery.useQueryClient.call(void 0, );
|
|
610
649
|
const effectiveStatus = session.status;
|
|
611
|
-
const effectiveUserId = _nullishCoalesce(session.userId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
612
|
-
const effectiveCartHdrUid = _nullishCoalesce(session.cartHdrUid, () => ( _optionalChain([auth, 'optionalAccess',
|
|
650
|
+
const effectiveUserId = _nullishCoalesce(session.userId, () => ( _optionalChain([auth, 'optionalAccess', _41 => _41.userId])));
|
|
651
|
+
const effectiveCartHdrUid = _nullishCoalesce(session.cartHdrUid, () => ( _optionalChain([auth, 'optionalAccess', _42 => _42.cartHdrUid])));
|
|
613
652
|
const effectiveSession = _react.useMemo.call(void 0,
|
|
614
653
|
() => ({ status: effectiveStatus, userId: effectiveUserId, cartHdrUid: effectiveCartHdrUid }),
|
|
615
654
|
[effectiveStatus, effectiveUserId, effectiveCartHdrUid]
|
|
@@ -704,17 +743,17 @@ function useCartPricing(options = {}) {
|
|
|
704
743
|
const auth = useAugurAuth();
|
|
705
744
|
const cache = useAugurCache();
|
|
706
745
|
const cartLines = useCartLines();
|
|
707
|
-
const customerId = _nullishCoalesce(options.customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
708
|
-
const priceFn = _nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
746
|
+
const customerId = _nullishCoalesce(options.customerId, () => ( _optionalChain([auth, 'optionalAccess', _43 => _43.customerId])));
|
|
747
|
+
const priceFn = _nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _44 => _44.getItemPrice])));
|
|
709
748
|
const priceQueries = _reactquery.useQueries.call(void 0, {
|
|
710
749
|
queries: cartLines.map((line) => {
|
|
711
750
|
const base = priceFn ? {
|
|
712
|
-
queryKey:
|
|
751
|
+
queryKey: _chunkFKM6A6QWcjs.getItemPriceKey.call(void 0, line.itemId, customerId, line.quantity),
|
|
713
752
|
queryFn: () => priceFn(line.itemId, customerId, line.quantity),
|
|
714
753
|
refetchOnReconnect: true,
|
|
715
754
|
refetchOnWindowFocus: false,
|
|
716
755
|
meta: { persist: true }
|
|
717
|
-
} :
|
|
756
|
+
} : _chunkFKM6A6QWcjs.getItemPriceOptions.call(void 0, api, line.itemId, customerId, line.quantity, cache);
|
|
718
757
|
return {
|
|
719
758
|
...base,
|
|
720
759
|
enabled: !!customerId && !!line.itemId
|
|
@@ -725,7 +764,7 @@ function useCartPricing(options = {}) {
|
|
|
725
764
|
const map = {};
|
|
726
765
|
cartLines.forEach((line, index) => {
|
|
727
766
|
const queryResult = priceQueries[index];
|
|
728
|
-
if (_optionalChain([queryResult, 'optionalAccess',
|
|
767
|
+
if (_optionalChain([queryResult, 'optionalAccess', _45 => _45.data])) {
|
|
729
768
|
map[line.itemId.toUpperCase()] = {
|
|
730
769
|
unitPrice: _nullishCoalesce(queryResult.data.unitPrice, () => ( 0)),
|
|
731
770
|
priceData: queryResult.data
|
|
@@ -736,7 +775,7 @@ function useCartPricing(options = {}) {
|
|
|
736
775
|
}, [cartLines, priceQueries]);
|
|
737
776
|
const getUnitPrice = _react.useMemo.call(void 0, () => {
|
|
738
777
|
return (itemId) => {
|
|
739
|
-
return _nullishCoalesce(_optionalChain([prices, 'access',
|
|
778
|
+
return _nullishCoalesce(_optionalChain([prices, 'access', _46 => _46[_optionalChain([itemId, 'optionalAccess', _47 => _47.toUpperCase, 'call', _48 => _48()])], 'optionalAccess', _49 => _49.unitPrice]), () => ( 0));
|
|
740
779
|
};
|
|
741
780
|
}, [prices]);
|
|
742
781
|
const getItemTotal = _react.useMemo.call(void 0, () => {
|
|
@@ -746,7 +785,7 @@ function useCartPricing(options = {}) {
|
|
|
746
785
|
}, [getUnitPrice]);
|
|
747
786
|
const subtotal = _react.useMemo.call(void 0, () => {
|
|
748
787
|
return cartLines.reduce((sum, line) => {
|
|
749
|
-
const unitPrice = _nullishCoalesce(_optionalChain([prices, 'access',
|
|
788
|
+
const unitPrice = _nullishCoalesce(_optionalChain([prices, 'access', _50 => _50[line.itemId.toUpperCase()], 'optionalAccess', _51 => _51.unitPrice]), () => ( 0));
|
|
750
789
|
return sum + unitPrice * line.quantity;
|
|
751
790
|
}, 0);
|
|
752
791
|
}, [cartLines, prices]);
|
|
@@ -814,13 +853,13 @@ function useCategoryItemsInfinite(itemCategoryUid, itemsFilters, options = {}) {
|
|
|
814
853
|
const callbacks = useAugurCallbacks();
|
|
815
854
|
const cache = useAugurCache();
|
|
816
855
|
const { enabled = true } = options;
|
|
817
|
-
const defaultOptions =
|
|
856
|
+
const defaultOptions = _chunkFKM6A6QWcjs.getCategoryItemsInfiniteOptions.call(void 0,
|
|
818
857
|
api,
|
|
819
858
|
itemCategoryUid,
|
|
820
859
|
itemsFilters,
|
|
821
860
|
cache
|
|
822
861
|
);
|
|
823
|
-
const cb = _optionalChain([callbacks, 'optionalAccess',
|
|
862
|
+
const cb = _optionalChain([callbacks, 'optionalAccess', _52 => _52.getCategoryItemsInfinite]);
|
|
824
863
|
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (cb ? ({ pageParam }) => cb({
|
|
825
864
|
itemCategoryUid,
|
|
826
865
|
itemsFilters,
|
|
@@ -841,13 +880,13 @@ function useItemSearchInfinite(itemsFilters, itemCategoryUid, options = {}) {
|
|
|
841
880
|
const callbacks = useAugurCallbacks();
|
|
842
881
|
const cache = useAugurCache();
|
|
843
882
|
const { enabled = true } = options;
|
|
844
|
-
const defaultOptions =
|
|
883
|
+
const defaultOptions = _chunkFKM6A6QWcjs.getItemSearchInfiniteOptions.call(void 0,
|
|
845
884
|
api,
|
|
846
885
|
itemsFilters,
|
|
847
886
|
itemCategoryUid,
|
|
848
887
|
cache
|
|
849
888
|
);
|
|
850
|
-
const cb = _optionalChain([callbacks, 'optionalAccess',
|
|
889
|
+
const cb = _optionalChain([callbacks, 'optionalAccess', _53 => _53.getItemSearchInfinite]);
|
|
851
890
|
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (cb ? ({ pageParam }) => cb({
|
|
852
891
|
itemsFilters,
|
|
853
892
|
itemCategoryUid,
|
|
@@ -868,12 +907,12 @@ function useJoomlaContent(articleId, options = {}) {
|
|
|
868
907
|
const callbacks = useAugurCallbacks();
|
|
869
908
|
const cache = useAugurCache();
|
|
870
909
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
871
|
-
...articleId ?
|
|
872
|
-
queryKey:
|
|
910
|
+
...articleId ? _chunkFKM6A6QWcjs.getJoomlaContentOptions.call(void 0, api, articleId, cache) : {
|
|
911
|
+
queryKey: _chunkFKM6A6QWcjs.getJoomlaContentKey.call(void 0, ""),
|
|
873
912
|
/* v8 ignore next */
|
|
874
913
|
queryFn: () => Promise.reject()
|
|
875
914
|
},
|
|
876
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
915
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _54 => _54.getJoomlaContent]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaContent(articleId)))) } : {},
|
|
877
916
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!articleId
|
|
878
917
|
});
|
|
879
918
|
return {
|
|
@@ -890,12 +929,12 @@ function useJoomlaContentList(categoryId, options = {}) {
|
|
|
890
929
|
const callbacks = useAugurCallbacks();
|
|
891
930
|
const cache = useAugurCache();
|
|
892
931
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
893
|
-
...categoryId ?
|
|
894
|
-
queryKey:
|
|
932
|
+
...categoryId ? _chunkFKM6A6QWcjs.getJoomlaContentListOptions.call(void 0, api, categoryId, options.filters, cache) : {
|
|
933
|
+
queryKey: _chunkFKM6A6QWcjs.getJoomlaContentListKey.call(void 0, ""),
|
|
895
934
|
/* v8 ignore next */
|
|
896
935
|
queryFn: () => Promise.reject()
|
|
897
936
|
},
|
|
898
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
937
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _55 => _55.getJoomlaContentList]))) ? {
|
|
899
938
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaContentList(categoryId, options.filters))))
|
|
900
939
|
} : {},
|
|
901
940
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!categoryId
|
|
@@ -914,8 +953,8 @@ function useJoomlaMenu(options = {}) {
|
|
|
914
953
|
const callbacks = useAugurCallbacks();
|
|
915
954
|
const cache = useAugurCache();
|
|
916
955
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
917
|
-
...
|
|
918
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
956
|
+
..._chunkFKM6A6QWcjs.getJoomlaMenuOptions.call(void 0, api, options.filters, cache),
|
|
957
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _56 => _56.getJoomlaMenu]))) ? {
|
|
919
958
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenu(options.filters))))
|
|
920
959
|
} : {},
|
|
921
960
|
enabled: _nullishCoalesce(options.enabled, () => ( true))
|
|
@@ -934,12 +973,12 @@ function useJoomlaMenuDoc(menuId, options = {}) {
|
|
|
934
973
|
const callbacks = useAugurCallbacks();
|
|
935
974
|
const cache = useAugurCache();
|
|
936
975
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
937
|
-
...menuId ?
|
|
938
|
-
queryKey:
|
|
976
|
+
...menuId ? _chunkFKM6A6QWcjs.getJoomlaMenuDocOptions.call(void 0, api, menuId, cache) : {
|
|
977
|
+
queryKey: _chunkFKM6A6QWcjs.getJoomlaMenuDocKey.call(void 0, ""),
|
|
939
978
|
/* v8 ignore next */
|
|
940
979
|
queryFn: () => Promise.reject()
|
|
941
980
|
},
|
|
942
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
981
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _57 => _57.getJoomlaMenuDoc]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenuDoc(menuId)))) } : {},
|
|
943
982
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!menuId
|
|
944
983
|
});
|
|
945
984
|
return {
|
|
@@ -954,15 +993,15 @@ function useJoomlaMenuDoc(menuId, options = {}) {
|
|
|
954
993
|
function useCustomerOrders(customerId, params, options = {}) {
|
|
955
994
|
const callbacks = useAugurCallbacks();
|
|
956
995
|
const auth = useAugurAuth();
|
|
957
|
-
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
996
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _58 => _58.customerId])));
|
|
958
997
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
959
|
-
queryKey:
|
|
998
|
+
queryKey: _chunkFKM6A6QWcjs.getCustomerOrdersKey.call(void 0, effectiveCustomerId, params),
|
|
960
999
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerOrders(effectiveCustomerId, params)))),
|
|
961
|
-
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
1000
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _59 => _59.getCustomerOrders]))))
|
|
962
1001
|
});
|
|
963
1002
|
return {
|
|
964
|
-
orders: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
965
|
-
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
1003
|
+
orders: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _60 => _60.data]), () => ( [])),
|
|
1004
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _61 => _61.total]), () => ( 0)),
|
|
966
1005
|
isLoading,
|
|
967
1006
|
error
|
|
968
1007
|
};
|
|
@@ -970,11 +1009,11 @@ function useCustomerOrders(customerId, params, options = {}) {
|
|
|
970
1009
|
function useOrderDetail(customerId, orderId, options = {}) {
|
|
971
1010
|
const callbacks = useAugurCallbacks();
|
|
972
1011
|
const auth = useAugurAuth();
|
|
973
|
-
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
1012
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _62 => _62.customerId])));
|
|
974
1013
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
975
|
-
queryKey:
|
|
1014
|
+
queryKey: _chunkFKM6A6QWcjs.getCustomerOrderDetailKey.call(void 0, effectiveCustomerId, orderId),
|
|
976
1015
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerOrderDetail(effectiveCustomerId, orderId)))),
|
|
977
|
-
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!orderId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
1016
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!orderId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _63 => _63.getCustomerOrderDetail]))))
|
|
978
1017
|
});
|
|
979
1018
|
return {
|
|
980
1019
|
order: _nullishCoalesce(data, () => ( null)),
|
|
@@ -988,15 +1027,15 @@ function useOrderDetail(customerId, orderId, options = {}) {
|
|
|
988
1027
|
function useCustomerInvoices(customerId, params, options = {}) {
|
|
989
1028
|
const callbacks = useAugurCallbacks();
|
|
990
1029
|
const auth = useAugurAuth();
|
|
991
|
-
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
1030
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _64 => _64.customerId])));
|
|
992
1031
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
993
|
-
queryKey:
|
|
1032
|
+
queryKey: _chunkFKM6A6QWcjs.getCustomerInvoicesKey.call(void 0, effectiveCustomerId, params),
|
|
994
1033
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerInvoices(effectiveCustomerId, params)))),
|
|
995
|
-
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
1034
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _65 => _65.getCustomerInvoices]))))
|
|
996
1035
|
});
|
|
997
1036
|
return {
|
|
998
|
-
invoices: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
999
|
-
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
1037
|
+
invoices: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _66 => _66.data]), () => ( [])),
|
|
1038
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _67 => _67.total]), () => ( 0)),
|
|
1000
1039
|
isLoading,
|
|
1001
1040
|
error
|
|
1002
1041
|
};
|
|
@@ -1004,14 +1043,14 @@ function useCustomerInvoices(customerId, params, options = {}) {
|
|
|
1004
1043
|
function useInvoiceDetail(customerId, invoiceNo, options = {}) {
|
|
1005
1044
|
const callbacks = useAugurCallbacks();
|
|
1006
1045
|
const auth = useAugurAuth();
|
|
1007
|
-
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
1046
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _68 => _68.customerId])));
|
|
1008
1047
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1009
|
-
queryKey:
|
|
1048
|
+
queryKey: _chunkFKM6A6QWcjs.getCustomerInvoiceDetailKey.call(void 0, effectiveCustomerId, invoiceNo),
|
|
1010
1049
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerInvoiceDetail(
|
|
1011
1050
|
effectiveCustomerId,
|
|
1012
1051
|
invoiceNo
|
|
1013
1052
|
)))),
|
|
1014
|
-
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!invoiceNo && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
1053
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!invoiceNo && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _69 => _69.getCustomerInvoiceDetail]))))
|
|
1015
1054
|
});
|
|
1016
1055
|
return {
|
|
1017
1056
|
invoice: _nullishCoalesce(data, () => ( null)),
|
|
@@ -1025,15 +1064,15 @@ function useInvoiceDetail(customerId, invoiceNo, options = {}) {
|
|
|
1025
1064
|
function useCustomerQuotes(customerId, params, options = {}) {
|
|
1026
1065
|
const callbacks = useAugurCallbacks();
|
|
1027
1066
|
const auth = useAugurAuth();
|
|
1028
|
-
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
1067
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _70 => _70.customerId])));
|
|
1029
1068
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1030
|
-
queryKey:
|
|
1069
|
+
queryKey: _chunkFKM6A6QWcjs.getCustomerQuotesKey.call(void 0, effectiveCustomerId, params),
|
|
1031
1070
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerQuotes(effectiveCustomerId, params)))),
|
|
1032
|
-
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
1071
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _71 => _71.getCustomerQuotes]))))
|
|
1033
1072
|
});
|
|
1034
1073
|
return {
|
|
1035
|
-
quotes: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
1036
|
-
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
1074
|
+
quotes: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _72 => _72.data]), () => ( [])),
|
|
1075
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _73 => _73.total]), () => ( 0)),
|
|
1037
1076
|
isLoading,
|
|
1038
1077
|
error
|
|
1039
1078
|
};
|
|
@@ -1041,11 +1080,11 @@ function useCustomerQuotes(customerId, params, options = {}) {
|
|
|
1041
1080
|
function useQuoteDetail(customerId, quoteNo, options = {}) {
|
|
1042
1081
|
const callbacks = useAugurCallbacks();
|
|
1043
1082
|
const auth = useAugurAuth();
|
|
1044
|
-
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
1083
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _74 => _74.customerId])));
|
|
1045
1084
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1046
|
-
queryKey:
|
|
1085
|
+
queryKey: _chunkFKM6A6QWcjs.getCustomerQuoteDetailKey.call(void 0, effectiveCustomerId, quoteNo),
|
|
1047
1086
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerQuoteDetail(effectiveCustomerId, quoteNo)))),
|
|
1048
|
-
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!quoteNo && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
1087
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!quoteNo && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _75 => _75.getCustomerQuoteDetail]))))
|
|
1049
1088
|
});
|
|
1050
1089
|
return {
|
|
1051
1090
|
quote: _nullishCoalesce(data, () => ( null)),
|
|
@@ -1060,10 +1099,10 @@ function createSiteHooks(config = {}) {
|
|
|
1060
1099
|
const { callbacks, defaultCustomerId, cache, imageConfig } = config;
|
|
1061
1100
|
function Provider({ api, auth, children }) {
|
|
1062
1101
|
const mergedAuth = {
|
|
1063
|
-
status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess',
|
|
1064
|
-
customerId: _nullishCoalesce(_optionalChain([auth, 'optionalAccess',
|
|
1065
|
-
userId: _optionalChain([auth, 'optionalAccess',
|
|
1066
|
-
cartHdrUid: _optionalChain([auth, 'optionalAccess',
|
|
1102
|
+
status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _76 => _76.status]), () => ( "unauthenticated")),
|
|
1103
|
+
customerId: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _77 => _77.customerId]), () => ( defaultCustomerId)),
|
|
1104
|
+
userId: _optionalChain([auth, 'optionalAccess', _78 => _78.userId]),
|
|
1105
|
+
cartHdrUid: _optionalChain([auth, 'optionalAccess', _79 => _79.cartHdrUid])
|
|
1067
1106
|
};
|
|
1068
1107
|
return _react.createElement.call(void 0, AugurHooksProvider, {
|
|
1069
1108
|
api,
|
|
@@ -1082,6 +1121,7 @@ function createSiteHooks(config = {}) {
|
|
|
1082
1121
|
// Hooks -- inventory
|
|
1083
1122
|
useInvMast,
|
|
1084
1123
|
useInvMastDoc,
|
|
1124
|
+
useBatchInvMastDoc,
|
|
1085
1125
|
useInvMastStock,
|
|
1086
1126
|
// Hooks -- items & categories
|
|
1087
1127
|
useItemCategory,
|
|
@@ -1141,7 +1181,7 @@ function deserialize(data) {
|
|
|
1141
1181
|
|
|
1142
1182
|
// src/persistence/apply-limits.ts
|
|
1143
1183
|
function applyLimits(data, limits) {
|
|
1144
|
-
const queries = _optionalChain([data, 'access',
|
|
1184
|
+
const queries = _optionalChain([data, 'access', _80 => _80.clientState, 'optionalAccess', _81 => _81.queries]);
|
|
1145
1185
|
if (!queries || Object.keys(limits).length === 0) return data;
|
|
1146
1186
|
const entries = queries;
|
|
1147
1187
|
const unlimited = [];
|
|
@@ -1242,7 +1282,7 @@ function useStorageMonitor(config) {
|
|
|
1242
1282
|
const raw = storage.getItem(key);
|
|
1243
1283
|
if (!raw) return;
|
|
1244
1284
|
const parsed = JSON.parse(raw);
|
|
1245
|
-
if (!_optionalChain([parsed, 'access',
|
|
1285
|
+
if (!_optionalChain([parsed, 'access', _82 => _82.clientState, 'optionalAccess', _83 => _83.queries])) return;
|
|
1246
1286
|
parsed.clientState.queries = parsed.clientState.queries.filter(
|
|
1247
1287
|
(q) => {
|
|
1248
1288
|
if (!Array.isArray(q.queryKey)) return true;
|
|
@@ -1269,7 +1309,7 @@ function useAugurPersistence(config) {
|
|
|
1269
1309
|
setIsMounted(true);
|
|
1270
1310
|
}, []);
|
|
1271
1311
|
useStorageMonitor(config);
|
|
1272
|
-
const isDev = typeof process !== "undefined" && _optionalChain([process, 'access',
|
|
1312
|
+
const isDev = typeof process !== "undefined" && _optionalChain([process, 'access', _84 => _84.env, 'optionalAccess', _85 => _85.NODE_ENV]) === "development";
|
|
1273
1313
|
const { persistableKeys } = config;
|
|
1274
1314
|
const dehydrateOptions = _react.useMemo.call(void 0, () => ({
|
|
1275
1315
|
shouldDehydrateQuery: (query) => {
|
|
@@ -1370,5 +1410,9 @@ function useAugurPersistence(config) {
|
|
|
1370
1410
|
|
|
1371
1411
|
|
|
1372
1412
|
|
|
1373
|
-
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
exports.AugurHooksProvider = AugurHooksProvider; exports.createSiteHooks = createSiteHooks; exports.executeBatchQuery = _chunkFKM6A6QWcjs.executeBatchQuery; exports.getBatchInvMastDocKey = _chunkFKM6A6QWcjs.getBatchInvMastDocKey; exports.getBatchInvMastDocOptions = _chunkFKM6A6QWcjs.getBatchInvMastDocOptions; exports.getCartPricingQueryOptions = _chunkFKM6A6QWcjs.getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = _chunkFKM6A6QWcjs.getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = _chunkFKM6A6QWcjs.getCategoryItemsInfiniteOptions; exports.getCustomerInvoiceDetailKey = _chunkFKM6A6QWcjs.getCustomerInvoiceDetailKey; exports.getCustomerInvoicesKey = _chunkFKM6A6QWcjs.getCustomerInvoicesKey; exports.getCustomerOrderDetailKey = _chunkFKM6A6QWcjs.getCustomerOrderDetailKey; exports.getCustomerOrdersKey = _chunkFKM6A6QWcjs.getCustomerOrdersKey; exports.getCustomerQuoteDetailKey = _chunkFKM6A6QWcjs.getCustomerQuoteDetailKey; exports.getCustomerQuotesKey = _chunkFKM6A6QWcjs.getCustomerQuotesKey; exports.getInvMastDocKey = _chunkFKM6A6QWcjs.getInvMastDocKey; exports.getInvMastDocOptions = _chunkFKM6A6QWcjs.getInvMastDocOptions; exports.getInvMastKey = _chunkFKM6A6QWcjs.getInvMastKey; exports.getInvMastOptions = _chunkFKM6A6QWcjs.getInvMastOptions; exports.getInvMastStockKey = _chunkFKM6A6QWcjs.getInvMastStockKey; exports.getInvMastStockOptions = _chunkFKM6A6QWcjs.getInvMastStockOptions; exports.getItemAttributesKey = _chunkFKM6A6QWcjs.getItemAttributesKey; exports.getItemAttributesOptions = _chunkFKM6A6QWcjs.getItemAttributesOptions; exports.getItemCategoryKey = _chunkFKM6A6QWcjs.getItemCategoryKey; exports.getItemCategoryOptions = _chunkFKM6A6QWcjs.getItemCategoryOptions; exports.getItemDetailsKey = _chunkFKM6A6QWcjs.getItemDetailsKey; exports.getItemDetailsOptions = _chunkFKM6A6QWcjs.getItemDetailsOptions; exports.getItemPriceKey = _chunkFKM6A6QWcjs.getItemPriceKey; exports.getItemPriceOptions = _chunkFKM6A6QWcjs.getItemPriceOptions; exports.getItemSearchInfiniteKey = _chunkFKM6A6QWcjs.getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = _chunkFKM6A6QWcjs.getItemSearchInfiniteOptions; exports.getJoomlaContentKey = _chunkFKM6A6QWcjs.getJoomlaContentKey; exports.getJoomlaContentListKey = _chunkFKM6A6QWcjs.getJoomlaContentListKey; exports.getJoomlaContentListOptions = _chunkFKM6A6QWcjs.getJoomlaContentListOptions; exports.getJoomlaContentOptions = _chunkFKM6A6QWcjs.getJoomlaContentOptions; exports.getJoomlaMenuDocKey = _chunkFKM6A6QWcjs.getJoomlaMenuDocKey; exports.getJoomlaMenuDocOptions = _chunkFKM6A6QWcjs.getJoomlaMenuDocOptions; exports.getJoomlaMenuKey = _chunkFKM6A6QWcjs.getJoomlaMenuKey; exports.getJoomlaMenuOptions = _chunkFKM6A6QWcjs.getJoomlaMenuOptions; exports.getProductCategoryKey = _chunkFKM6A6QWcjs.getProductCategoryKey; exports.getProductCategoryOptions = _chunkFKM6A6QWcjs.getProductCategoryOptions; exports.getProductSearchKey = _chunkFKM6A6QWcjs.getProductSearchKey; exports.getProductSearchOptions = _chunkFKM6A6QWcjs.getProductSearchOptions; exports.getSearchSuggestionsKey = _chunkFKM6A6QWcjs.getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = _chunkFKM6A6QWcjs.getSearchSuggestionsOptions; exports.useAugurApi = useAugurApi; exports.useAugurApiOptional = useAugurApiOptional; exports.useAugurAuth = useAugurAuth; exports.useAugurCache = useAugurCache; exports.useAugurPersistence = useAugurPersistence; exports.useBatchInvMastDoc = useBatchInvMastDoc; exports.useCartActions = useCartActions; exports.useCartHdrUid = useCartHdrUid; exports.useCartInitialization = useCartInitialization; exports.useCartLineCount = useCartLineCount; exports.useCartLines = useCartLines; exports.useCartPricing = useCartPricing; exports.useCartQuantityTotal = useCartQuantityTotal; exports.useCartStore = useCartStore; exports.useCategoryItemsInfinite = useCategoryItemsInfinite; exports.useClearCart = useClearCart; exports.useCustomerInvoices = useCustomerInvoices; exports.useCustomerOrders = useCustomerOrders; exports.useCustomerQuotes = useCustomerQuotes; exports.useDebounce = useDebounce; exports.useFormatPrice = useFormatPrice; exports.useInvMast = useInvMast; exports.useInvMastDoc = useInvMastDoc; exports.useInvMastStock = useInvMastStock; exports.useInvoiceDetail = useInvoiceDetail; exports.useItemAttributes = useItemAttributes; exports.useItemCategory = useItemCategory; exports.useItemDetails = useItemDetails; exports.useItemFiltersStore = useItemFiltersStore; exports.useItemPrice = useItemPrice; exports.useItemSearchInfinite = useItemSearchInfinite; exports.useJoomlaContent = useJoomlaContent; exports.useJoomlaContentList = useJoomlaContentList; exports.useJoomlaMenu = useJoomlaMenu; exports.useJoomlaMenuDoc = useJoomlaMenuDoc; exports.useOrderDetail = useOrderDetail; exports.usePaginationPrefetch = usePaginationPrefetch; exports.useProductCategory = useProductCategory; exports.useProductSearch = useProductSearch; exports.useQuoteDetail = useQuoteDetail; exports.useSearchSuggestions = useSearchSuggestions; exports.useSetCartHdrUid = useSetCartHdrUid; exports.useSetCartLines = useSetCartLines;
|
|
1374
1418
|
//# sourceMappingURL=index.cjs.map
|