@simpleapps-com/augur-hooks 1.0.6 → 1.0.8

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/index.cjs CHANGED
@@ -59,11 +59,13 @@ var AugurAuthReactContext = _react.createContext.call(void 0,
59
59
  );
60
60
  var AugurCacheContext = _react.createContext.call(void 0, void 0);
61
61
  var AugurOptionsContext = _react.createContext.call(void 0, null);
62
+ var AugurSiteContext = _react.createContext.call(void 0, void 0);
62
63
  function AugurHooksProvider({
63
64
  api,
64
65
  callbacks,
65
66
  auth,
66
67
  cache,
68
+ site,
67
69
  children
68
70
  }) {
69
71
  if (process.env.NODE_ENV === "development" && !api && !callbacks) {
@@ -77,7 +79,7 @@ function AugurHooksProvider({
77
79
  // eslint-disable-next-line react-hooks/exhaustive-deps
78
80
  [api]
79
81
  );
80
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurApiContext.Provider, { value: _nullishCoalesce(api, () => ( null)), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurCallbacksContext.Provider, { value: callbacks, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurAuthReactContext.Provider, { value: auth, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurCacheContext.Provider, { value: cache, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurOptionsContext.Provider, { value: options, children }) }) }) }) });
82
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurApiContext.Provider, { value: _nullishCoalesce(api, () => ( null)), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurCallbacksContext.Provider, { value: callbacks, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurAuthReactContext.Provider, { value: auth, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurCacheContext.Provider, { value: cache, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurSiteContext.Provider, { value: site, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurOptionsContext.Provider, { value: options, children }) }) }) }) }) });
81
83
  }
82
84
  function useAugurOptions() {
83
85
  const options = _react.useContext.call(void 0, AugurOptionsContext);
@@ -109,6 +111,9 @@ function useAugurAuth() {
109
111
  function useAugurCache() {
110
112
  return _react.useContext.call(void 0, AugurCacheContext);
111
113
  }
114
+ function useAugurSite() {
115
+ return _react.useContext.call(void 0, AugurSiteContext);
116
+ }
112
117
 
113
118
  // src/stores/cart-store.ts
114
119
  var _zustand = require('zustand');
@@ -187,12 +192,17 @@ function useDebounce(value, delay = 500) {
187
192
  }
188
193
 
189
194
  // src/hooks/use-format-price.ts
190
- function useFormatPrice(locale = "en-US", currency = "USD") {
195
+ function useFormatPrice(locale, currency) {
196
+ const site = useAugurSite();
197
+ const effectiveLocale = _nullishCoalesce(_nullishCoalesce(locale, () => ( _optionalChain([site, 'optionalAccess', _ => _.formatting, 'optionalAccess', _2 => _2.locale]))), () => ( "en-US"));
198
+ const effectiveCurrency = _nullishCoalesce(_nullishCoalesce(currency, () => ( _optionalChain([site, 'optionalAccess', _3 => _3.formatting, 'optionalAccess', _4 => _4.currency]))), () => ( "USD"));
199
+ const precision = _nullishCoalesce(_optionalChain([site, 'optionalAccess', _5 => _5.formatting, 'optionalAccess', _6 => _6.precision]), () => ( 2));
191
200
  const formatPrice = (price) => {
192
- return new Intl.NumberFormat(locale, {
201
+ return new Intl.NumberFormat(effectiveLocale, {
193
202
  style: "currency",
194
- currency,
195
- minimumFractionDigits: 2
203
+ currency: effectiveCurrency,
204
+ minimumFractionDigits: precision,
205
+ maximumFractionDigits: precision
196
206
  }).format(price);
197
207
  };
198
208
  return { formatPrice };
@@ -207,9 +217,10 @@ function useItemPrice(itemId, customerId, quantity = 1, options = {}) {
207
217
  const callbacks = useAugurCallbacks();
208
218
  const auth = useAugurAuth();
209
219
  const cache = useAugurCache();
210
- const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _ => _.customerId])));
220
+ const site = useAugurSite();
221
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _7 => _7.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _8 => _8.defaults, 'optionalAccess', _9 => _9.customerId])));
211
222
  const defaultOptions = _chunkC7JC34SMcjs.getItemPriceOptions.call(void 0, api, itemId, effectiveCustomerId, quantity, cache);
212
- const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _2 => _2.getItemPrice]) ? () => callbacks.getItemPrice(itemId, effectiveCustomerId, quantity) : void 0)));
223
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _10 => _10.getItemPrice]) ? () => callbacks.getItemPrice(itemId, effectiveCustomerId, quantity) : void 0)));
213
224
  const query = _reactquery.useQuery.call(void 0, {
214
225
  ...defaultOptions,
215
226
  ...resolvedQueryFn ? { queryFn: resolvedQueryFn } : {},
@@ -238,7 +249,7 @@ function useInvMastDoc(invMastUid, itemId, options = {}) {
238
249
  );
239
250
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
240
251
  ...queryOpts,
241
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _3 => _3.getInvMastDoc]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMastDoc(invMastUid, itemId, _nullishCoalesce(options.includePricing, () => ( "N")))))) } : {},
252
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _11 => _11.getInvMastDoc]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMastDoc(invMastUid, itemId, _nullishCoalesce(options.includePricing, () => ( "N")))))) } : {},
242
253
  enabled: _nullishCoalesce(options.enabled, () => ( true)),
243
254
  initialData: options.initialData
244
255
  });
@@ -259,7 +270,7 @@ function useItemCategory(itemCategoryUid, options = {}) {
259
270
  );
260
271
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
261
272
  ...queryOpts,
262
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _4 => _4.getItemCategory]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getItemCategory(itemCategoryUid, options.apiOptions)))) } : {},
273
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _12 => _12.getItemCategory]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getItemCategory(itemCategoryUid, options.apiOptions)))) } : {},
263
274
  enabled: _nullishCoalesce(options.enabled, () => ( true))
264
275
  });
265
276
  return { category: data, isLoading, error };
@@ -274,7 +285,7 @@ function useInvMast(invMastUid, itemId, options = {}) {
274
285
  const queryOpts = _chunkC7JC34SMcjs.getInvMastOptions.call(void 0, api, invMastUid, itemId, cache);
275
286
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
276
287
  ...queryOpts,
277
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _5 => _5.getInvMast]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMast(invMastUid, itemId)))) } : {},
288
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _13 => _13.getInvMast]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMast(invMastUid, itemId)))) } : {},
278
289
  enabled: _nullishCoalesce(options.enabled, () => ( true))
279
290
  });
280
291
  return { item: data, isLoading, error };
@@ -289,7 +300,7 @@ function useInvMastStock(invMastUid, options = {}) {
289
300
  const queryOpts = _chunkC7JC34SMcjs.getInvMastStockOptions.call(void 0, api, invMastUid, cache);
290
301
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
291
302
  ...queryOpts,
292
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _6 => _6.getInvMastStock]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMastStock(invMastUid)))) } : {},
303
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _14 => _14.getInvMastStock]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMastStock(invMastUid)))) } : {},
293
304
  enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!invMastUid,
294
305
  retry: 3,
295
306
  /* v8 ignore start */
@@ -316,7 +327,7 @@ function useBatchInvMastDoc(params, options = {}) {
316
327
  if (options.queryFn) {
317
328
  return options.queryFn(uncached, includePricing);
318
329
  }
319
- if (_optionalChain([callbacks, 'optionalAccess', _7 => _7.batchGetInvMastDocs])) {
330
+ if (_optionalChain([callbacks, 'optionalAccess', _15 => _15.batchGetInvMastDocs])) {
320
331
  return callbacks.batchGetInvMastDocs(uncached, includePricing);
321
332
  }
322
333
  const fallbackOpts = _chunkC7JC34SMcjs.getBatchInvMastDocOptions.call(void 0, api, uncached, includePricing, cache);
@@ -343,10 +354,10 @@ function useBatchInvMastDoc(params, options = {}) {
343
354
 
344
355
  function resolveData(data) {
345
356
  return {
346
- childrenTotal: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _8 => _8.childrenTotal]), () => ( 0)),
347
- itemCategoryDesc: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _9 => _9.itemCategoryDesc]), () => ( "")),
348
- productCategories: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _10 => _10.children]), () => ( null)),
349
- productCategoryImage: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _11 => _11.categoryImage]), () => ( null))
357
+ childrenTotal: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _16 => _16.childrenTotal]), () => ( 0)),
358
+ itemCategoryDesc: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _17 => _17.itemCategoryDesc]), () => ( "")),
359
+ productCategories: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _18 => _18.children]), () => ( null)),
360
+ productCategoryImage: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _19 => _19.categoryImage]), () => ( null))
350
361
  };
351
362
  }
352
363
  function useProductCategory(itemCategoryUid, options = {}) {
@@ -358,7 +369,7 @@ function useProductCategory(itemCategoryUid, options = {}) {
358
369
  /* v8 ignore next */
359
370
  queryFn: () => Promise.reject()
360
371
  };
361
- const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _12 => _12.getProductCategory]) ? () => callbacks.getProductCategory(itemCategoryUid) : void 0)));
372
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _20 => _20.getProductCategory]) ? () => callbacks.getProductCategory(itemCategoryUid) : void 0)));
362
373
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
363
374
  ...baseOptions,
364
375
  ...resolvedQueryFn ? { queryFn: resolvedQueryFn } : {},
@@ -387,14 +398,14 @@ function useItemDetails(itemId, options = {}) {
387
398
  /* v8 ignore next */
388
399
  queryFn: () => Promise.reject()
389
400
  },
390
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _13 => _13.getItemDetails]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getItemDetails(itemId)))) } : {},
401
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _21 => _21.getItemDetails]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getItemDetails(itemId)))) } : {},
391
402
  enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!itemId,
392
403
  retry: 3,
393
404
  /* v8 ignore start */
394
405
  retryDelay: (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 1e4)
395
406
  /* v8 ignore stop */
396
407
  });
397
- const categoryList = _nullishCoalesce(_optionalChain([data, 'optionalAccess', _14 => _14.categoryList]), () => ( []));
408
+ const categoryList = _nullishCoalesce(_optionalChain([data, 'optionalAccess', _22 => _22.categoryList]), () => ( []));
398
409
  return {
399
410
  itemCategoryUid: categoryList.length > 0 ? categoryList[categoryList.length - 1] : null,
400
411
  itemDetails: _nullishCoalesce(data, () => ( null)),
@@ -415,7 +426,7 @@ function useItemAttributes(itemCategoryUid, options = {}) {
415
426
  /* v8 ignore next */
416
427
  queryFn: () => Promise.reject()
417
428
  },
418
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _15 => _15.getItemAttributes]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getItemAttributes(itemCategoryUid)))) } : {},
429
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _23 => _23.getItemAttributes]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getItemAttributes(itemCategoryUid)))) } : {},
419
430
  enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!itemCategoryUid,
420
431
  retry: 3,
421
432
  /* v8 ignore start */
@@ -423,7 +434,7 @@ function useItemAttributes(itemCategoryUid, options = {}) {
423
434
  /* v8 ignore stop */
424
435
  });
425
436
  return {
426
- attributes: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _16 => _16.attributes]), () => ( null)),
437
+ attributes: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _24 => _24.attributes]), () => ( null)),
427
438
  loading: isLoading,
428
439
  error
429
440
  };
@@ -438,15 +449,15 @@ function useProductSearch(pageData, options = {}) {
438
449
  const defaultOptions = _chunkC7JC34SMcjs.getProductSearchOptions.call(void 0, api, pageData, cache);
439
450
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
440
451
  ...defaultOptions,
441
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _17 => _17.getProductSearch]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getProductSearch(pageData)))) } : {},
452
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _25 => _25.getProductSearch]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getProductSearch(pageData)))) } : {},
442
453
  retry: 3,
443
454
  /* v8 ignore start */
444
455
  retryDelay: (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 1e4)
445
456
  /* v8 ignore stop */
446
457
  });
447
458
  return {
448
- productItems: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _18 => _18.items]), () => ( null)),
449
- total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _19 => _19.totalResults]), () => ( 0)),
459
+ productItems: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _26 => _26.items]), () => ( null)),
460
+ total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _27 => _27.totalResults]), () => ( 0)),
450
461
  loading: isLoading,
451
462
  error
452
463
  };
@@ -464,12 +475,12 @@ function useSearchSuggestions(query, options = {}) {
464
475
  const defaultOptions = _chunkC7JC34SMcjs.getSearchSuggestionsOptions.call(void 0, api, query, limit, offset, cache);
465
476
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
466
477
  ...defaultOptions,
467
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _20 => _20.getSearchSuggestions]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getSearchSuggestions(query, limit, offset)))) } : {},
478
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _28 => _28.getSearchSuggestions]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getSearchSuggestions(query, limit, offset)))) } : {},
468
479
  enabled
469
480
  });
470
481
  return {
471
- suggestions: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _21 => _21.data]), () => ( [])),
472
- total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _22 => _22.total]), () => ( 0)),
482
+ suggestions: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _29 => _29.data]), () => ( [])),
483
+ total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _30 => _30.total]), () => ( 0)),
473
484
  isLoading,
474
485
  error
475
486
  };
@@ -536,17 +547,17 @@ function useCartActions(callbacks) {
536
547
  ]);
537
548
  if (!success) throw new Error("Failed to add item to cart");
538
549
  invalidateCartCache();
539
- if (showToast && _optionalChain([notify, 'optionalAccess', _23 => _23.info])) {
550
+ if (showToast && _optionalChain([notify, 'optionalAccess', _31 => _31.info])) {
540
551
  notify.info(`${item.quantity} x ${itemId || "Item"} added to cart`);
541
552
  }
542
- _optionalChain([onSuccess, 'optionalCall', _24 => _24()]);
553
+ _optionalChain([onSuccess, 'optionalCall', _32 => _32()]);
543
554
  return true;
544
555
  } catch (error) {
545
556
  setCartLines(previousCartLines);
546
- if (showToast && _optionalChain([notify, 'optionalAccess', _25 => _25.error])) {
557
+ if (showToast && _optionalChain([notify, 'optionalAccess', _33 => _33.error])) {
547
558
  notify.error("Failed to add item to cart. Please try again.");
548
559
  }
549
- _optionalChain([onError, 'optionalCall', _26 => _26(error)]);
560
+ _optionalChain([onError, 'optionalCall', _34 => _34(error)]);
550
561
  return false;
551
562
  }
552
563
  },
@@ -565,14 +576,14 @@ function useCartActions(callbacks) {
565
576
  const success = await callbacks.updateCartLines(uid, updatedLines);
566
577
  if (!success) throw new Error("Failed to update quantity");
567
578
  invalidateCartCache();
568
- _optionalChain([onSuccess, 'optionalCall', _27 => _27()]);
579
+ _optionalChain([onSuccess, 'optionalCall', _35 => _35()]);
569
580
  return true;
570
581
  } catch (error) {
571
582
  setCartLines(previousCartLines);
572
- if (showToast && _optionalChain([notify, 'optionalAccess', _28 => _28.error])) {
583
+ if (showToast && _optionalChain([notify, 'optionalAccess', _36 => _36.error])) {
573
584
  notify.error("Failed to update quantity. Please try again.");
574
585
  }
575
- _optionalChain([onError, 'optionalCall', _29 => _29(error)]);
586
+ _optionalChain([onError, 'optionalCall', _37 => _37(error)]);
576
587
  return false;
577
588
  }
578
589
  },
@@ -591,17 +602,17 @@ function useCartActions(callbacks) {
591
602
  const success = await callbacks.updateCartLines(uid, zeroedLines);
592
603
  if (!success) throw new Error("Failed to remove item");
593
604
  invalidateCartCache();
594
- if (showToast && _optionalChain([notify, 'optionalAccess', _30 => _30.info])) {
605
+ if (showToast && _optionalChain([notify, 'optionalAccess', _38 => _38.info])) {
595
606
  notify.info(`${itemId || "Item"} removed from cart`);
596
607
  }
597
- _optionalChain([onSuccess, 'optionalCall', _31 => _31()]);
608
+ _optionalChain([onSuccess, 'optionalCall', _39 => _39()]);
598
609
  return true;
599
610
  } catch (error) {
600
611
  setCartLines(previousCartLines);
601
- if (showToast && _optionalChain([notify, 'optionalAccess', _32 => _32.error])) {
612
+ if (showToast && _optionalChain([notify, 'optionalAccess', _40 => _40.error])) {
602
613
  notify.error("Failed to remove item. Please try again.");
603
614
  }
604
- _optionalChain([onError, 'optionalCall', _33 => _33(error)]);
615
+ _optionalChain([onError, 'optionalCall', _41 => _41(error)]);
605
616
  return false;
606
617
  }
607
618
  },
@@ -617,17 +628,17 @@ function useCartActions(callbacks) {
617
628
  const success = await callbacks.deleteItemsFromCart(uid);
618
629
  if (!success) throw new Error("Failed to clear cart");
619
630
  invalidateCartCache();
620
- if (showToast && _optionalChain([notify, 'optionalAccess', _34 => _34.info])) {
631
+ if (showToast && _optionalChain([notify, 'optionalAccess', _42 => _42.info])) {
621
632
  notify.info("Cart cleared");
622
633
  }
623
- _optionalChain([onSuccess, 'optionalCall', _35 => _35()]);
634
+ _optionalChain([onSuccess, 'optionalCall', _43 => _43()]);
624
635
  return true;
625
636
  } catch (error) {
626
637
  setCartLines(previousCartLines);
627
- if (showToast && _optionalChain([notify, 'optionalAccess', _36 => _36.error])) {
638
+ if (showToast && _optionalChain([notify, 'optionalAccess', _44 => _44.error])) {
628
639
  notify.error("Failed to clear cart. Please try again.");
629
640
  }
630
- _optionalChain([onError, 'optionalCall', _37 => _37(error)]);
641
+ _optionalChain([onError, 'optionalCall', _45 => _45(error)]);
631
642
  return false;
632
643
  }
633
644
  },
@@ -641,7 +652,7 @@ function useCartActions(callbacks) {
641
652
  );
642
653
  const getItemQuantity = _react.useCallback.call(void 0,
643
654
  (invMastUid) => {
644
- return _nullishCoalesce(_optionalChain([cartLines, 'access', _38 => _38.find, 'call', _39 => _39((line) => line.invMastUid === invMastUid), 'optionalAccess', _40 => _40.quantity]), () => ( 0));
655
+ return _nullishCoalesce(_optionalChain([cartLines, 'access', _46 => _46.find, 'call', _47 => _47((line) => line.invMastUid === invMastUid), 'optionalAccess', _48 => _48.quantity]), () => ( 0));
645
656
  },
646
657
  [cartLines]
647
658
  );
@@ -671,8 +682,8 @@ function useCartInitialization(session, callbacks) {
671
682
  const clearCart = useClearCart();
672
683
  const queryClient = _reactquery.useQueryClient.call(void 0, );
673
684
  const effectiveStatus = session.status;
674
- const effectiveUserId = _nullishCoalesce(session.userId, () => ( _optionalChain([auth, 'optionalAccess', _41 => _41.userId])));
675
- const effectiveCartHdrUid = _nullishCoalesce(session.cartHdrUid, () => ( _optionalChain([auth, 'optionalAccess', _42 => _42.cartHdrUid])));
685
+ const effectiveUserId = _nullishCoalesce(session.userId, () => ( _optionalChain([auth, 'optionalAccess', _49 => _49.userId])));
686
+ const effectiveCartHdrUid = _nullishCoalesce(session.cartHdrUid, () => ( _optionalChain([auth, 'optionalAccess', _50 => _50.cartHdrUid])));
676
687
  const effectiveSession = _react.useMemo.call(void 0,
677
688
  () => ({ status: effectiveStatus, userId: effectiveUserId, cartHdrUid: effectiveCartHdrUid }),
678
689
  [effectiveStatus, effectiveUserId, effectiveCartHdrUid]
@@ -767,9 +778,10 @@ function useCartPricing(options = {}) {
767
778
  const callbacks = useAugurCallbacks();
768
779
  const auth = useAugurAuth();
769
780
  const cache = useAugurCache();
781
+ const site = useAugurSite();
770
782
  const cartLines = useCartLines();
771
- const customerId = _nullishCoalesce(options.customerId, () => ( _optionalChain([auth, 'optionalAccess', _43 => _43.customerId])));
772
- const priceFn = _nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _44 => _44.getItemPrice])));
783
+ const customerId = _nullishCoalesce(_nullishCoalesce(options.customerId, () => ( _optionalChain([auth, 'optionalAccess', _51 => _51.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _52 => _52.defaults, 'optionalAccess', _53 => _53.customerId])));
784
+ const priceFn = _nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _54 => _54.getItemPrice])));
773
785
  const priceQueries = _reactquery.useQueries.call(void 0, {
774
786
  queries: cartLines.map((line) => {
775
787
  const base = priceFn ? {
@@ -789,7 +801,7 @@ function useCartPricing(options = {}) {
789
801
  const map = {};
790
802
  cartLines.forEach((line, index) => {
791
803
  const queryResult = priceQueries[index];
792
- if (_optionalChain([queryResult, 'optionalAccess', _45 => _45.data])) {
804
+ if (_optionalChain([queryResult, 'optionalAccess', _55 => _55.data])) {
793
805
  const derived = _augurutils.derivePrice.call(void 0, { priceData: queryResult.data, quantity: line.quantity });
794
806
  map[line.itemId.toUpperCase()] = {
795
807
  unitPrice: derived.unitPrice,
@@ -801,7 +813,7 @@ function useCartPricing(options = {}) {
801
813
  }, [cartLines, priceQueries]);
802
814
  const getUnitPrice = _react.useMemo.call(void 0, () => {
803
815
  return (itemId) => {
804
- return _nullishCoalesce(_optionalChain([prices, 'access', _46 => _46[_optionalChain([itemId, 'optionalAccess', _47 => _47.toUpperCase, 'call', _48 => _48()])], 'optionalAccess', _49 => _49.unitPrice]), () => ( 0));
816
+ return _nullishCoalesce(_optionalChain([prices, 'access', _56 => _56[_optionalChain([itemId, 'optionalAccess', _57 => _57.toUpperCase, 'call', _58 => _58()])], 'optionalAccess', _59 => _59.unitPrice]), () => ( 0));
805
817
  };
806
818
  }, [prices]);
807
819
  const getItemTotal = _react.useMemo.call(void 0, () => {
@@ -811,7 +823,7 @@ function useCartPricing(options = {}) {
811
823
  }, [getUnitPrice]);
812
824
  const subtotal = _react.useMemo.call(void 0, () => {
813
825
  return cartLines.reduce((sum, line) => {
814
- const unitPrice = _nullishCoalesce(_optionalChain([prices, 'access', _50 => _50[line.itemId.toUpperCase()], 'optionalAccess', _51 => _51.unitPrice]), () => ( 0));
826
+ const unitPrice = _nullishCoalesce(_optionalChain([prices, 'access', _60 => _60[line.itemId.toUpperCase()], 'optionalAccess', _61 => _61.unitPrice]), () => ( 0));
815
827
  return sum + unitPrice * line.quantity;
816
828
  }, 0);
817
829
  }, [cartLines, prices]);
@@ -885,7 +897,7 @@ function useCategoryItemsInfinite(itemCategoryUid, itemsFilters, options = {}) {
885
897
  itemsFilters,
886
898
  cache
887
899
  );
888
- const cb = _optionalChain([callbacks, 'optionalAccess', _52 => _52.getCategoryItemsInfinite]);
900
+ const cb = _optionalChain([callbacks, 'optionalAccess', _62 => _62.getCategoryItemsInfinite]);
889
901
  const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (cb ? ({ pageParam }) => cb({
890
902
  itemCategoryUid,
891
903
  itemsFilters,
@@ -912,7 +924,7 @@ function useItemSearchInfinite(itemsFilters, itemCategoryUid, options = {}) {
912
924
  itemCategoryUid,
913
925
  cache
914
926
  );
915
- const cb = _optionalChain([callbacks, 'optionalAccess', _53 => _53.getItemSearchInfinite]);
927
+ const cb = _optionalChain([callbacks, 'optionalAccess', _63 => _63.getItemSearchInfinite]);
916
928
  const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (cb ? ({ pageParam }) => cb({
917
929
  itemsFilters,
918
930
  itemCategoryUid,
@@ -938,7 +950,7 @@ function useJoomlaContent(articleId, options = {}) {
938
950
  /* v8 ignore next */
939
951
  queryFn: () => Promise.reject()
940
952
  },
941
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _54 => _54.getJoomlaContent]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaContent(articleId)))) } : {},
953
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _64 => _64.getJoomlaContent]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaContent(articleId)))) } : {},
942
954
  enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!articleId
943
955
  });
944
956
  return {
@@ -960,7 +972,7 @@ function useJoomlaContentList(categoryId, options = {}) {
960
972
  /* v8 ignore next */
961
973
  queryFn: () => Promise.reject()
962
974
  },
963
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _55 => _55.getJoomlaContentList]))) ? {
975
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _65 => _65.getJoomlaContentList]))) ? {
964
976
  queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaContentList(categoryId, options.filters))))
965
977
  } : {},
966
978
  enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!categoryId
@@ -980,7 +992,7 @@ function useJoomlaMenu(options = {}) {
980
992
  const cache = useAugurCache();
981
993
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
982
994
  ..._chunkC7JC34SMcjs.getJoomlaMenuOptions.call(void 0, api, options.filters, cache),
983
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _56 => _56.getJoomlaMenu]))) ? {
995
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _66 => _66.getJoomlaMenu]))) ? {
984
996
  queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenu(options.filters))))
985
997
  } : {},
986
998
  enabled: _nullishCoalesce(options.enabled, () => ( true))
@@ -1004,7 +1016,7 @@ function useJoomlaMenuDoc(menuId, options = {}) {
1004
1016
  /* v8 ignore next */
1005
1017
  queryFn: () => Promise.reject()
1006
1018
  },
1007
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _57 => _57.getJoomlaMenuDoc]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenuDoc(menuId)))) } : {},
1019
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _67 => _67.getJoomlaMenuDoc]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenuDoc(menuId)))) } : {},
1008
1020
  enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!menuId
1009
1021
  });
1010
1022
  return {
@@ -1016,18 +1028,23 @@ function useJoomlaMenuDoc(menuId, options = {}) {
1016
1028
 
1017
1029
  // src/hooks/use-customer-orders.ts
1018
1030
 
1031
+ var EMPTY_LIST = { data: [], total: 0 };
1019
1032
  function useCustomerOrders(customerId, params, options = {}) {
1020
1033
  const callbacks = useAugurCallbacks();
1021
1034
  const auth = useAugurAuth();
1022
- const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _58 => _58.customerId])));
1035
+ const site = useAugurSite();
1036
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _68 => _68.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _69 => _69.defaults, 'optionalAccess', _70 => _70.customerId])));
1037
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _71 => _71.getCustomerOrders]) ? () => callbacks.getCustomerOrders(effectiveCustomerId, params) : void 0)));
1038
+ const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!resolvedQueryFn;
1023
1039
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1024
1040
  queryKey: _chunkC7JC34SMcjs.getCustomerOrdersKey.call(void 0, effectiveCustomerId, params),
1025
- queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerOrders(effectiveCustomerId, params)))),
1026
- enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _59 => _59.getCustomerOrders]))))
1041
+ queryFn: resolvedQueryFn,
1042
+ enabled
1027
1043
  });
1044
+ const result = data || EMPTY_LIST;
1028
1045
  return {
1029
- orders: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _60 => _60.data]), () => ( [])),
1030
- total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _61 => _61.total]), () => ( 0)),
1046
+ orders: result.data,
1047
+ total: result.total,
1031
1048
  isLoading,
1032
1049
  error
1033
1050
  };
@@ -1035,14 +1052,17 @@ function useCustomerOrders(customerId, params, options = {}) {
1035
1052
  function useOrderDetail(customerId, orderId, options = {}) {
1036
1053
  const callbacks = useAugurCallbacks();
1037
1054
  const auth = useAugurAuth();
1038
- const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _62 => _62.customerId])));
1055
+ const site = useAugurSite();
1056
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _72 => _72.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _73 => _73.defaults, 'optionalAccess', _74 => _74.customerId])));
1057
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _75 => _75.getCustomerOrderDetail]) ? () => callbacks.getCustomerOrderDetail(effectiveCustomerId, orderId) : void 0)));
1058
+ const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!orderId && !!resolvedQueryFn;
1039
1059
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1040
1060
  queryKey: _chunkC7JC34SMcjs.getCustomerOrderDetailKey.call(void 0, effectiveCustomerId, orderId),
1041
- queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerOrderDetail(effectiveCustomerId, orderId)))),
1042
- enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!orderId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _63 => _63.getCustomerOrderDetail]))))
1061
+ queryFn: resolvedQueryFn,
1062
+ enabled
1043
1063
  });
1044
1064
  return {
1045
- order: _nullishCoalesce(data, () => ( null)),
1065
+ order: data || null,
1046
1066
  isLoading,
1047
1067
  error
1048
1068
  };
@@ -1050,18 +1070,23 @@ function useOrderDetail(customerId, orderId, options = {}) {
1050
1070
 
1051
1071
  // src/hooks/use-customer-invoices.ts
1052
1072
 
1073
+ var EMPTY_LIST2 = { data: [], total: 0 };
1053
1074
  function useCustomerInvoices(customerId, params, options = {}) {
1054
1075
  const callbacks = useAugurCallbacks();
1055
1076
  const auth = useAugurAuth();
1056
- const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _64 => _64.customerId])));
1077
+ const site = useAugurSite();
1078
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _76 => _76.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _77 => _77.defaults, 'optionalAccess', _78 => _78.customerId])));
1079
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _79 => _79.getCustomerInvoices]) ? () => callbacks.getCustomerInvoices(effectiveCustomerId, params) : void 0)));
1080
+ const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!resolvedQueryFn;
1057
1081
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1058
1082
  queryKey: _chunkC7JC34SMcjs.getCustomerInvoicesKey.call(void 0, effectiveCustomerId, params),
1059
- queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerInvoices(effectiveCustomerId, params)))),
1060
- enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _65 => _65.getCustomerInvoices]))))
1083
+ queryFn: resolvedQueryFn,
1084
+ enabled
1061
1085
  });
1086
+ const result = data || EMPTY_LIST2;
1062
1087
  return {
1063
- invoices: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _66 => _66.data]), () => ( [])),
1064
- total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _67 => _67.total]), () => ( 0)),
1088
+ invoices: result.data,
1089
+ total: result.total,
1065
1090
  isLoading,
1066
1091
  error
1067
1092
  };
@@ -1069,17 +1094,17 @@ function useCustomerInvoices(customerId, params, options = {}) {
1069
1094
  function useInvoiceDetail(customerId, invoiceNo, options = {}) {
1070
1095
  const callbacks = useAugurCallbacks();
1071
1096
  const auth = useAugurAuth();
1072
- const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _68 => _68.customerId])));
1097
+ const site = useAugurSite();
1098
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _80 => _80.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _81 => _81.defaults, 'optionalAccess', _82 => _82.customerId])));
1099
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _83 => _83.getCustomerInvoiceDetail]) ? () => callbacks.getCustomerInvoiceDetail(effectiveCustomerId, invoiceNo) : void 0)));
1100
+ const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!invoiceNo && !!resolvedQueryFn;
1073
1101
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1074
1102
  queryKey: _chunkC7JC34SMcjs.getCustomerInvoiceDetailKey.call(void 0, effectiveCustomerId, invoiceNo),
1075
- queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerInvoiceDetail(
1076
- effectiveCustomerId,
1077
- invoiceNo
1078
- )))),
1079
- enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!invoiceNo && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _69 => _69.getCustomerInvoiceDetail]))))
1103
+ queryFn: resolvedQueryFn,
1104
+ enabled
1080
1105
  });
1081
1106
  return {
1082
- invoice: _nullishCoalesce(data, () => ( null)),
1107
+ invoice: data || null,
1083
1108
  isLoading,
1084
1109
  error
1085
1110
  };
@@ -1087,18 +1112,23 @@ function useInvoiceDetail(customerId, invoiceNo, options = {}) {
1087
1112
 
1088
1113
  // src/hooks/use-customer-quotes.ts
1089
1114
 
1115
+ var EMPTY_LIST3 = { data: [], total: 0 };
1090
1116
  function useCustomerQuotes(customerId, params, options = {}) {
1091
1117
  const callbacks = useAugurCallbacks();
1092
1118
  const auth = useAugurAuth();
1093
- const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _70 => _70.customerId])));
1119
+ const site = useAugurSite();
1120
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _84 => _84.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _85 => _85.defaults, 'optionalAccess', _86 => _86.customerId])));
1121
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _87 => _87.getCustomerQuotes]) ? () => callbacks.getCustomerQuotes(effectiveCustomerId, params) : void 0)));
1122
+ const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!resolvedQueryFn;
1094
1123
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1095
1124
  queryKey: _chunkC7JC34SMcjs.getCustomerQuotesKey.call(void 0, effectiveCustomerId, params),
1096
- queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerQuotes(effectiveCustomerId, params)))),
1097
- enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _71 => _71.getCustomerQuotes]))))
1125
+ queryFn: resolvedQueryFn,
1126
+ enabled
1098
1127
  });
1128
+ const result = data || EMPTY_LIST3;
1099
1129
  return {
1100
- quotes: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _72 => _72.data]), () => ( [])),
1101
- total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _73 => _73.total]), () => ( 0)),
1130
+ quotes: result.data,
1131
+ total: result.total,
1102
1132
  isLoading,
1103
1133
  error
1104
1134
  };
@@ -1106,14 +1136,17 @@ function useCustomerQuotes(customerId, params, options = {}) {
1106
1136
  function useQuoteDetail(customerId, quoteNo, options = {}) {
1107
1137
  const callbacks = useAugurCallbacks();
1108
1138
  const auth = useAugurAuth();
1109
- const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _74 => _74.customerId])));
1139
+ const site = useAugurSite();
1140
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _88 => _88.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _89 => _89.defaults, 'optionalAccess', _90 => _90.customerId])));
1141
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _91 => _91.getCustomerQuoteDetail]) ? () => callbacks.getCustomerQuoteDetail(effectiveCustomerId, quoteNo) : void 0)));
1142
+ const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!quoteNo && !!resolvedQueryFn;
1110
1143
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1111
1144
  queryKey: _chunkC7JC34SMcjs.getCustomerQuoteDetailKey.call(void 0, effectiveCustomerId, quoteNo),
1112
- queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerQuoteDetail(effectiveCustomerId, quoteNo)))),
1113
- enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!quoteNo && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _75 => _75.getCustomerQuoteDetail]))))
1145
+ queryFn: resolvedQueryFn,
1146
+ enabled
1114
1147
  });
1115
1148
  return {
1116
- quote: _nullishCoalesce(data, () => ( null)),
1149
+ quote: data || null,
1117
1150
  isLoading,
1118
1151
  error
1119
1152
  };
@@ -1125,16 +1158,17 @@ function createSiteHooks(config = {}) {
1125
1158
  const { callbacks, defaultCustomerId, cache, imageConfig } = config;
1126
1159
  function Provider({ api, auth, children }) {
1127
1160
  const mergedAuth = {
1128
- status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _76 => _76.status]), () => ( "unauthenticated")),
1129
- customerId: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _77 => _77.customerId]), () => ( defaultCustomerId)),
1130
- userId: _optionalChain([auth, 'optionalAccess', _78 => _78.userId]),
1131
- cartHdrUid: _optionalChain([auth, 'optionalAccess', _79 => _79.cartHdrUid])
1161
+ status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _92 => _92.status]), () => ( "unauthenticated")),
1162
+ customerId: _optionalChain([auth, 'optionalAccess', _93 => _93.customerId]),
1163
+ userId: _optionalChain([auth, 'optionalAccess', _94 => _94.userId]),
1164
+ cartHdrUid: _optionalChain([auth, 'optionalAccess', _95 => _95.cartHdrUid])
1132
1165
  };
1133
1166
  return _react.createElement.call(void 0, AugurHooksProvider, {
1134
1167
  api,
1135
1168
  callbacks,
1136
1169
  auth: mergedAuth,
1137
1170
  cache,
1171
+ site: defaultCustomerId ? { name: "", defaults: { customerId: defaultCustomerId } } : void 0,
1138
1172
  children
1139
1173
  });
1140
1174
  }
@@ -1207,7 +1241,7 @@ function deserialize(data) {
1207
1241
 
1208
1242
  // src/persistence/apply-limits.ts
1209
1243
  function applyLimits(data, limits) {
1210
- const queries = _optionalChain([data, 'access', _80 => _80.clientState, 'optionalAccess', _81 => _81.queries]);
1244
+ const queries = _optionalChain([data, 'access', _96 => _96.clientState, 'optionalAccess', _97 => _97.queries]);
1211
1245
  if (!queries || Object.keys(limits).length === 0) return data;
1212
1246
  const entries = queries;
1213
1247
  const unlimited = [];
@@ -1308,7 +1342,7 @@ function useStorageMonitor(config) {
1308
1342
  const raw = storage.getItem(key);
1309
1343
  if (!raw) return;
1310
1344
  const parsed = JSON.parse(raw);
1311
- if (!_optionalChain([parsed, 'access', _82 => _82.clientState, 'optionalAccess', _83 => _83.queries])) return;
1345
+ if (!_optionalChain([parsed, 'access', _98 => _98.clientState, 'optionalAccess', _99 => _99.queries])) return;
1312
1346
  parsed.clientState.queries = parsed.clientState.queries.filter(
1313
1347
  (q) => {
1314
1348
  if (!Array.isArray(q.queryKey)) return true;
@@ -1335,7 +1369,7 @@ function useAugurPersistence(config) {
1335
1369
  setIsMounted(true);
1336
1370
  }, []);
1337
1371
  useStorageMonitor(config);
1338
- const isDev = typeof process !== "undefined" && _optionalChain([process, 'access', _84 => _84.env, 'optionalAccess', _85 => _85.NODE_ENV]) === "development";
1372
+ const isDev = typeof process !== "undefined" && _optionalChain([process, 'access', _100 => _100.env, 'optionalAccess', _101 => _101.NODE_ENV]) === "development";
1339
1373
  const { persistableKeys } = config;
1340
1374
  const dehydrateOptions = _react.useMemo.call(void 0, () => ({
1341
1375
  shouldDehydrateQuery: (query) => {
@@ -1441,5 +1475,6 @@ function useAugurPersistence(config) {
1441
1475
 
1442
1476
 
1443
1477
 
1444
- exports.AugurHooksProvider = AugurHooksProvider; exports.createSiteHooks = createSiteHooks; exports.executeBatchQuery = _chunkC7JC34SMcjs.executeBatchQuery; exports.getBatchInvMastDocKey = _chunkC7JC34SMcjs.getBatchInvMastDocKey; exports.getBatchInvMastDocOptions = _chunkC7JC34SMcjs.getBatchInvMastDocOptions; exports.getCartPricingQueryOptions = _chunkC7JC34SMcjs.getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = _chunkC7JC34SMcjs.getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = _chunkC7JC34SMcjs.getCategoryItemsInfiniteOptions; exports.getCustomerInvoiceDetailKey = _chunkC7JC34SMcjs.getCustomerInvoiceDetailKey; exports.getCustomerInvoicesKey = _chunkC7JC34SMcjs.getCustomerInvoicesKey; exports.getCustomerOrderDetailKey = _chunkC7JC34SMcjs.getCustomerOrderDetailKey; exports.getCustomerOrdersKey = _chunkC7JC34SMcjs.getCustomerOrdersKey; exports.getCustomerQuoteDetailKey = _chunkC7JC34SMcjs.getCustomerQuoteDetailKey; exports.getCustomerQuotesKey = _chunkC7JC34SMcjs.getCustomerQuotesKey; exports.getInvMastDocKey = _chunkC7JC34SMcjs.getInvMastDocKey; exports.getInvMastDocOptions = _chunkC7JC34SMcjs.getInvMastDocOptions; exports.getInvMastKey = _chunkC7JC34SMcjs.getInvMastKey; exports.getInvMastOptions = _chunkC7JC34SMcjs.getInvMastOptions; exports.getInvMastStockKey = _chunkC7JC34SMcjs.getInvMastStockKey; exports.getInvMastStockOptions = _chunkC7JC34SMcjs.getInvMastStockOptions; exports.getItemAttributesKey = _chunkC7JC34SMcjs.getItemAttributesKey; exports.getItemAttributesOptions = _chunkC7JC34SMcjs.getItemAttributesOptions; exports.getItemCategoryKey = _chunkC7JC34SMcjs.getItemCategoryKey; exports.getItemCategoryOptions = _chunkC7JC34SMcjs.getItemCategoryOptions; exports.getItemDetailsKey = _chunkC7JC34SMcjs.getItemDetailsKey; exports.getItemDetailsOptions = _chunkC7JC34SMcjs.getItemDetailsOptions; exports.getItemPriceKey = _chunkC7JC34SMcjs.getItemPriceKey; exports.getItemPriceOptions = _chunkC7JC34SMcjs.getItemPriceOptions; exports.getItemSearchInfiniteKey = _chunkC7JC34SMcjs.getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = _chunkC7JC34SMcjs.getItemSearchInfiniteOptions; exports.getJoomlaContentKey = _chunkC7JC34SMcjs.getJoomlaContentKey; exports.getJoomlaContentListKey = _chunkC7JC34SMcjs.getJoomlaContentListKey; exports.getJoomlaContentListOptions = _chunkC7JC34SMcjs.getJoomlaContentListOptions; exports.getJoomlaContentOptions = _chunkC7JC34SMcjs.getJoomlaContentOptions; exports.getJoomlaMenuDocKey = _chunkC7JC34SMcjs.getJoomlaMenuDocKey; exports.getJoomlaMenuDocOptions = _chunkC7JC34SMcjs.getJoomlaMenuDocOptions; exports.getJoomlaMenuKey = _chunkC7JC34SMcjs.getJoomlaMenuKey; exports.getJoomlaMenuOptions = _chunkC7JC34SMcjs.getJoomlaMenuOptions; exports.getProductCategoryKey = _chunkC7JC34SMcjs.getProductCategoryKey; exports.getProductCategoryOptions = _chunkC7JC34SMcjs.getProductCategoryOptions; exports.getProductSearchKey = _chunkC7JC34SMcjs.getProductSearchKey; exports.getProductSearchOptions = _chunkC7JC34SMcjs.getProductSearchOptions; exports.getSearchSuggestionsKey = _chunkC7JC34SMcjs.getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = _chunkC7JC34SMcjs.getSearchSuggestionsOptions; exports.useAugurApi = useAugurApi; exports.useAugurApiOptional = useAugurApiOptional; exports.useAugurAuth = useAugurAuth; exports.useAugurCache = useAugurCache; exports.useAugurOptions = useAugurOptions; 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;
1478
+
1479
+ exports.AugurHooksProvider = AugurHooksProvider; exports.createSiteHooks = createSiteHooks; exports.executeBatchQuery = _chunkC7JC34SMcjs.executeBatchQuery; exports.getBatchInvMastDocKey = _chunkC7JC34SMcjs.getBatchInvMastDocKey; exports.getBatchInvMastDocOptions = _chunkC7JC34SMcjs.getBatchInvMastDocOptions; exports.getCartPricingQueryOptions = _chunkC7JC34SMcjs.getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = _chunkC7JC34SMcjs.getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = _chunkC7JC34SMcjs.getCategoryItemsInfiniteOptions; exports.getCustomerInvoiceDetailKey = _chunkC7JC34SMcjs.getCustomerInvoiceDetailKey; exports.getCustomerInvoicesKey = _chunkC7JC34SMcjs.getCustomerInvoicesKey; exports.getCustomerOrderDetailKey = _chunkC7JC34SMcjs.getCustomerOrderDetailKey; exports.getCustomerOrdersKey = _chunkC7JC34SMcjs.getCustomerOrdersKey; exports.getCustomerQuoteDetailKey = _chunkC7JC34SMcjs.getCustomerQuoteDetailKey; exports.getCustomerQuotesKey = _chunkC7JC34SMcjs.getCustomerQuotesKey; exports.getInvMastDocKey = _chunkC7JC34SMcjs.getInvMastDocKey; exports.getInvMastDocOptions = _chunkC7JC34SMcjs.getInvMastDocOptions; exports.getInvMastKey = _chunkC7JC34SMcjs.getInvMastKey; exports.getInvMastOptions = _chunkC7JC34SMcjs.getInvMastOptions; exports.getInvMastStockKey = _chunkC7JC34SMcjs.getInvMastStockKey; exports.getInvMastStockOptions = _chunkC7JC34SMcjs.getInvMastStockOptions; exports.getItemAttributesKey = _chunkC7JC34SMcjs.getItemAttributesKey; exports.getItemAttributesOptions = _chunkC7JC34SMcjs.getItemAttributesOptions; exports.getItemCategoryKey = _chunkC7JC34SMcjs.getItemCategoryKey; exports.getItemCategoryOptions = _chunkC7JC34SMcjs.getItemCategoryOptions; exports.getItemDetailsKey = _chunkC7JC34SMcjs.getItemDetailsKey; exports.getItemDetailsOptions = _chunkC7JC34SMcjs.getItemDetailsOptions; exports.getItemPriceKey = _chunkC7JC34SMcjs.getItemPriceKey; exports.getItemPriceOptions = _chunkC7JC34SMcjs.getItemPriceOptions; exports.getItemSearchInfiniteKey = _chunkC7JC34SMcjs.getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = _chunkC7JC34SMcjs.getItemSearchInfiniteOptions; exports.getJoomlaContentKey = _chunkC7JC34SMcjs.getJoomlaContentKey; exports.getJoomlaContentListKey = _chunkC7JC34SMcjs.getJoomlaContentListKey; exports.getJoomlaContentListOptions = _chunkC7JC34SMcjs.getJoomlaContentListOptions; exports.getJoomlaContentOptions = _chunkC7JC34SMcjs.getJoomlaContentOptions; exports.getJoomlaMenuDocKey = _chunkC7JC34SMcjs.getJoomlaMenuDocKey; exports.getJoomlaMenuDocOptions = _chunkC7JC34SMcjs.getJoomlaMenuDocOptions; exports.getJoomlaMenuKey = _chunkC7JC34SMcjs.getJoomlaMenuKey; exports.getJoomlaMenuOptions = _chunkC7JC34SMcjs.getJoomlaMenuOptions; exports.getProductCategoryKey = _chunkC7JC34SMcjs.getProductCategoryKey; exports.getProductCategoryOptions = _chunkC7JC34SMcjs.getProductCategoryOptions; exports.getProductSearchKey = _chunkC7JC34SMcjs.getProductSearchKey; exports.getProductSearchOptions = _chunkC7JC34SMcjs.getProductSearchOptions; exports.getSearchSuggestionsKey = _chunkC7JC34SMcjs.getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = _chunkC7JC34SMcjs.getSearchSuggestionsOptions; exports.useAugurApi = useAugurApi; exports.useAugurApiOptional = useAugurApiOptional; exports.useAugurAuth = useAugurAuth; exports.useAugurCache = useAugurCache; exports.useAugurOptions = useAugurOptions; exports.useAugurPersistence = useAugurPersistence; exports.useAugurSite = useAugurSite; 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;
1445
1480
  //# sourceMappingURL=index.cjs.map