@simpleapps-com/augur-hooks 2.0.20 → 2.0.22

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
@@ -735,6 +735,166 @@ function useCartActions(callbacks) {
735
735
  };
736
736
  }
737
737
 
738
+ // src/hooks/use-payment-flow.ts
739
+
740
+ function usePaymentFlow({
741
+ callbacks,
742
+ customerId,
743
+ billingAddress,
744
+ paymentMethod,
745
+ shippingAccepted
746
+ }) {
747
+ const [isOpen, setIsOpen] = _react.useState.call(void 0, false);
748
+ const [unified, setUnified] = _react.useState.call(void 0, null);
749
+ const [unifiedCc, setUnifiedCc] = _react.useState.call(void 0, null);
750
+ const [unifiedResponse, setUnifiedResponse] = _react.useState.call(void 0, false);
751
+ const [unifiedBilling, setUnifiedBilling] = _react.useState.call(void 0, false);
752
+ const [unifiedPayment, setUnifiedPayment] = _react.useState.call(void 0, null);
753
+ const [capturedBin, setCapturedBin] = _react.useState.call(void 0, null);
754
+ const [editCc, setEditCc] = _react.useState.call(void 0, false);
755
+ const handleBinCapture = _react.useCallback.call(void 0, (bin) => {
756
+ setCapturedBin(bin);
757
+ }, []);
758
+ const postUnified = _react.useCallback.call(void 0, async () => {
759
+ if (!customerId) return;
760
+ try {
761
+ const result = await callbacks.transactionSetup({ customerId: String(customerId) });
762
+ if (!result) {
763
+ _optionalChain([callbacks, 'access', _55 => _55.toast, 'optionalAccess', _56 => _56.error, 'optionalCall', _57 => _57("Unable to initialize payment. Please try again.")]);
764
+ return;
765
+ }
766
+ setUnified(result);
767
+ } catch (error) {
768
+ console.error("transactionSetup failed:", error);
769
+ _optionalChain([callbacks, 'access', _58 => _58.toast, 'optionalAccess', _59 => _59.error, 'optionalCall', _60 => _60("Unable to initialize payment. Please try again.")]);
770
+ }
771
+ }, [customerId, callbacks]);
772
+ const getCardInfo = _react.useCallback.call(void 0, async () => {
773
+ if (!_optionalChain([unified, 'optionalAccess', _61 => _61.transactionSetupId])) return;
774
+ try {
775
+ const result = await callbacks.cardInfo({ transactionSetupId: unified.transactionSetupId });
776
+ if (!result) {
777
+ _optionalChain([callbacks, 'access', _62 => _62.toast, 'optionalAccess', _63 => _63.error, 'optionalCall', _64 => _64("Unable to verify card details. Please try again.")]);
778
+ return;
779
+ }
780
+ setUnifiedCc(result);
781
+ } catch (error) {
782
+ console.error("cardInfo failed:", error);
783
+ _optionalChain([callbacks, 'access', _65 => _65.toast, 'optionalAccess', _66 => _66.error, 'optionalCall', _67 => _67("Unable to verify card details. Please try again.")]);
784
+ }
785
+ }, [unified, callbacks]);
786
+ const verifyUnified = _react.useCallback.call(void 0, async () => {
787
+ if (!_optionalChain([unified, 'optionalAccess', _68 => _68.transactionSetupId]) || !customerId) return;
788
+ try {
789
+ const result = await callbacks.validatePayment({
790
+ transactionSetupId: unified.transactionSetupId,
791
+ customerId: String(customerId)
792
+ });
793
+ if (!result) {
794
+ _optionalChain([callbacks, 'access', _69 => _69.toast, 'optionalAccess', _70 => _70.error, 'optionalCall', _71 => _71("Payment verification failed. Please try again.")]);
795
+ return;
796
+ }
797
+ setUnifiedResponse(result.valid);
798
+ if (result.valid) {
799
+ await getCardInfo();
800
+ }
801
+ } catch (error) {
802
+ console.error("validatePayment failed:", error);
803
+ _optionalChain([callbacks, 'access', _72 => _72.toast, 'optionalAccess', _73 => _73.error, 'optionalCall', _74 => _74("Payment verification failed. Please try again.")]);
804
+ }
805
+ }, [unified, customerId, getCardInfo, callbacks]);
806
+ const getUnifiedPayment = _react.useCallback.call(void 0, async () => {
807
+ if (!_optionalChain([unified, 'optionalAccess', _75 => _75.transactionSetupId]) || !customerId) return;
808
+ try {
809
+ const result = await callbacks.accountQuery({
810
+ transactionSetupId: unified.transactionSetupId,
811
+ customerId: String(customerId)
812
+ });
813
+ if (!result) {
814
+ _optionalChain([callbacks, 'access', _76 => _76.toast, 'optionalAccess', _77 => _77.error, 'optionalCall', _78 => _78("Unable to retrieve payment account. Please try again.")]);
815
+ return;
816
+ }
817
+ const payment = capturedBin && !result.Bin ? { ...result, Bin: capturedBin } : result;
818
+ setUnifiedPayment(payment);
819
+ } catch (error) {
820
+ console.error("accountQuery failed:", error);
821
+ _optionalChain([callbacks, 'access', _79 => _79.toast, 'optionalAccess', _80 => _80.error, 'optionalCall', _81 => _81("Unable to retrieve payment account. Please try again.")]);
822
+ }
823
+ }, [unified, customerId, capturedBin, callbacks]);
824
+ const updateUnifiedBilling = _react.useCallback.call(void 0, async () => {
825
+ if (!_optionalChain([unified, 'optionalAccess', _82 => _82.transactionSetupId]) || !billingAddress) return;
826
+ try {
827
+ const result = await callbacks.billingUpdate({
828
+ transactionSetupId: unified.transactionSetupId,
829
+ address1: billingAddress.address1,
830
+ address2: billingAddress.address2,
831
+ city: billingAddress.city,
832
+ state: billingAddress.state,
833
+ zip: billingAddress.postalCode
834
+ });
835
+ if (!result) {
836
+ _optionalChain([callbacks, 'access', _83 => _83.toast, 'optionalAccess', _84 => _84.error, 'optionalCall', _85 => _85("Billing update failed. Please try again.")]);
837
+ return;
838
+ }
839
+ setUnifiedBilling(true);
840
+ void getUnifiedPayment();
841
+ } catch (error) {
842
+ console.error("billingUpdate failed:", error);
843
+ _optionalChain([callbacks, 'access', _86 => _86.toast, 'optionalAccess', _87 => _87.error, 'optionalCall', _88 => _88("Billing update failed. Please try again.")]);
844
+ }
845
+ }, [unified, billingAddress, getUnifiedPayment, callbacks]);
846
+ _react.useEffect.call(void 0, () => {
847
+ if (isOpen && (!shippingAccepted || paymentMethod !== "credit-card")) {
848
+ setIsOpen(false);
849
+ }
850
+ }, [isOpen, shippingAccepted, paymentMethod]);
851
+ _react.useEffect.call(void 0, () => {
852
+ if (isOpen && shippingAccepted && paymentMethod === "credit-card" && unified === null) {
853
+ void postUnified();
854
+ }
855
+ }, [isOpen, shippingAccepted, paymentMethod, unified, postUnified]);
856
+ _react.useEffect.call(void 0, () => {
857
+ if (!isOpen && unified !== null && shippingAccepted && paymentMethod === "credit-card") {
858
+ void verifyUnified();
859
+ }
860
+ }, [isOpen, unified, shippingAccepted, paymentMethod, verifyUnified]);
861
+ _react.useEffect.call(void 0, () => {
862
+ if (unifiedResponse && billingAddress !== void 0 && _optionalChain([unifiedCc, 'optionalAccess', _89 => _89.transactionSetupId]) && paymentMethod === "credit-card") {
863
+ void updateUnifiedBilling();
864
+ }
865
+ }, [
866
+ unifiedResponse,
867
+ billingAddress,
868
+ _optionalChain([unifiedCc, 'optionalAccess', _90 => _90.transactionSetupId]),
869
+ updateUnifiedBilling,
870
+ paymentMethod
871
+ ]);
872
+ _react.useEffect.call(void 0, () => {
873
+ if (editCc) {
874
+ setIsOpen(true);
875
+ setUnified(null);
876
+ setUnifiedCc(null);
877
+ setUnifiedPayment(null);
878
+ setUnifiedBilling(false);
879
+ setUnifiedResponse(false);
880
+ setCapturedBin(null);
881
+ }
882
+ }, [editCc]);
883
+ return {
884
+ isOpen,
885
+ setIsOpen,
886
+ editCc,
887
+ setEditCc,
888
+ unified,
889
+ unifiedCc,
890
+ unifiedResponse,
891
+ unifiedBilling,
892
+ unifiedPayment,
893
+ capturedBin,
894
+ handleBinCapture
895
+ };
896
+ }
897
+
738
898
  // src/hooks/use-cart-initialization.ts
739
899
 
740
900
 
@@ -754,8 +914,8 @@ function useCartInitialization(session, callbacks) {
754
914
  const clearCart = useClearCart();
755
915
  const queryClient = _reactquery.useQueryClient.call(void 0, );
756
916
  const effectiveStatus = session.status;
757
- const effectiveUserId = _nullishCoalesce(session.userId, () => ( _optionalChain([auth, 'optionalAccess', _55 => _55.userId])));
758
- const effectiveCartHdrUid = _nullishCoalesce(session.cartHdrUid, () => ( _optionalChain([auth, 'optionalAccess', _56 => _56.cartHdrUid])));
917
+ const effectiveUserId = _nullishCoalesce(session.userId, () => ( _optionalChain([auth, 'optionalAccess', _91 => _91.userId])));
918
+ const effectiveCartHdrUid = _nullishCoalesce(session.cartHdrUid, () => ( _optionalChain([auth, 'optionalAccess', _92 => _92.cartHdrUid])));
759
919
  const effectiveSession = _react.useMemo.call(void 0,
760
920
  () => ({ status: effectiveStatus, userId: effectiveUserId, cartHdrUid: effectiveCartHdrUid }),
761
921
  [effectiveStatus, effectiveUserId, effectiveCartHdrUid]
@@ -852,8 +1012,8 @@ function useCartPricing(options = {}) {
852
1012
  const cache = useAugurCache();
853
1013
  const site = useAugurSite();
854
1014
  const cartLines = useCartLines();
855
- const customerId = _nullishCoalesce(_nullishCoalesce(options.customerId, () => ( _optionalChain([auth, 'optionalAccess', _57 => _57.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _58 => _58.defaults, 'optionalAccess', _59 => _59.customerId])));
856
- const priceFn = _nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _60 => _60.getItemPrice])));
1015
+ const customerId = _nullishCoalesce(_nullishCoalesce(options.customerId, () => ( _optionalChain([auth, 'optionalAccess', _93 => _93.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _94 => _94.defaults, 'optionalAccess', _95 => _95.customerId])));
1016
+ const priceFn = _nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _96 => _96.getItemPrice])));
857
1017
  const priceQueries = _reactquery.useQueries.call(void 0, {
858
1018
  queries: cartLines.map((line) => {
859
1019
  const base = priceFn ? {
@@ -873,7 +1033,7 @@ function useCartPricing(options = {}) {
873
1033
  const map = {};
874
1034
  cartLines.forEach((line, index) => {
875
1035
  const queryResult = priceQueries[index];
876
- if (_optionalChain([queryResult, 'optionalAccess', _61 => _61.data])) {
1036
+ if (_optionalChain([queryResult, 'optionalAccess', _97 => _97.data])) {
877
1037
  const derived = _augurutils.derivePrice.call(void 0, { priceData: queryResult.data, quantity: line.quantity });
878
1038
  map[line.itemId.toUpperCase()] = {
879
1039
  unitPrice: derived.unitPrice,
@@ -885,7 +1045,7 @@ function useCartPricing(options = {}) {
885
1045
  }, [cartLines, priceQueries]);
886
1046
  const getUnitPrice = _react.useMemo.call(void 0, () => {
887
1047
  return (itemId) => {
888
- return _nullishCoalesce(_optionalChain([prices, 'access', _62 => _62[_optionalChain([itemId, 'optionalAccess', _63 => _63.toUpperCase, 'call', _64 => _64()])], 'optionalAccess', _65 => _65.unitPrice]), () => ( 0));
1048
+ return _nullishCoalesce(_optionalChain([prices, 'access', _98 => _98[_optionalChain([itemId, 'optionalAccess', _99 => _99.toUpperCase, 'call', _100 => _100()])], 'optionalAccess', _101 => _101.unitPrice]), () => ( 0));
889
1049
  };
890
1050
  }, [prices]);
891
1051
  const getItemTotal = _react.useMemo.call(void 0, () => {
@@ -895,7 +1055,7 @@ function useCartPricing(options = {}) {
895
1055
  }, [getUnitPrice]);
896
1056
  const subtotal = _react.useMemo.call(void 0, () => {
897
1057
  return cartLines.reduce((sum, line) => {
898
- const unitPrice = _nullishCoalesce(_optionalChain([prices, 'access', _66 => _66[line.itemId.toUpperCase()], 'optionalAccess', _67 => _67.unitPrice]), () => ( 0));
1058
+ const unitPrice = _nullishCoalesce(_optionalChain([prices, 'access', _102 => _102[line.itemId.toUpperCase()], 'optionalAccess', _103 => _103.unitPrice]), () => ( 0));
899
1059
  return sum + unitPrice * line.quantity;
900
1060
  }, 0);
901
1061
  }, [cartLines, prices]);
@@ -964,7 +1124,7 @@ function useCategoryItemsInfinite(itemCategoryUid, itemsFilters, options = {}) {
964
1124
  const cache = useAugurCache();
965
1125
  const { enabled = true } = options;
966
1126
  const defaultOptions = _chunkH7OXSAHPcjs.getCategoryItemsInfiniteOptions.call(void 0, api, itemCategoryUid, itemsFilters, cache);
967
- const cb = _optionalChain([callbacks, 'optionalAccess', _68 => _68.getCategoryItemsInfinite]);
1127
+ const cb = _optionalChain([callbacks, 'optionalAccess', _104 => _104.getCategoryItemsInfinite]);
968
1128
  const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (cb ? ({ pageParam }) => cb({
969
1129
  itemCategoryUid,
970
1130
  itemsFilters,
@@ -986,7 +1146,7 @@ function useItemSearchInfinite(itemsFilters, itemCategoryUid, options = {}) {
986
1146
  const cache = useAugurCache();
987
1147
  const { enabled = true } = options;
988
1148
  const defaultOptions = _chunkH7OXSAHPcjs.getItemSearchInfiniteOptions.call(void 0, api, itemsFilters, itemCategoryUid, cache);
989
- const cb = _optionalChain([callbacks, 'optionalAccess', _69 => _69.getItemSearchInfinite]);
1149
+ const cb = _optionalChain([callbacks, 'optionalAccess', _105 => _105.getItemSearchInfinite]);
990
1150
  const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (cb ? ({ pageParam }) => cb({
991
1151
  itemsFilters,
992
1152
  itemCategoryUid,
@@ -1012,7 +1172,7 @@ function useJoomlaContent(articleId, options = {}) {
1012
1172
  /* v8 ignore next */
1013
1173
  queryFn: () => Promise.reject()
1014
1174
  },
1015
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _70 => _70.getJoomlaContent]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaContent(articleId)))) } : {},
1175
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _106 => _106.getJoomlaContent]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaContent(articleId)))) } : {},
1016
1176
  enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!articleId
1017
1177
  });
1018
1178
  return {
@@ -1035,7 +1195,7 @@ function useJoomlaContentList(categoryId, options = {}) {
1035
1195
  /* v8 ignore next */
1036
1196
  queryFn: () => Promise.reject()
1037
1197
  },
1038
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _71 => _71.getJoomlaContentList]))) ? {
1198
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _107 => _107.getJoomlaContentList]))) ? {
1039
1199
  queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaContentList(categoryId, options.filters))))
1040
1200
  } : {},
1041
1201
  enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!categoryId
@@ -1064,7 +1224,7 @@ function useJoomlaMenu(options = {}) {
1064
1224
  const cache = useAugurCache();
1065
1225
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1066
1226
  ..._chunkH7OXSAHPcjs.getJoomlaMenuOptions.call(void 0, api, options.filters, cache),
1067
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _72 => _72.getJoomlaMenu]))) ? {
1227
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _108 => _108.getJoomlaMenu]))) ? {
1068
1228
  queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenu(options.filters))))
1069
1229
  } : {},
1070
1230
  enabled: _nullishCoalesce(options.enabled, () => ( true))
@@ -1096,7 +1256,7 @@ function useJoomlaMenuDoc(menuId, options = {}) {
1096
1256
  /* v8 ignore next */
1097
1257
  queryFn: () => Promise.reject()
1098
1258
  },
1099
- ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _73 => _73.getJoomlaMenuDoc]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenuDoc(menuId)))) } : {},
1259
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _109 => _109.getJoomlaMenuDoc]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenuDoc(menuId)))) } : {},
1100
1260
  enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!menuId
1101
1261
  });
1102
1262
  return {
@@ -1113,8 +1273,8 @@ function useCustomerOrders(customerId, params, options = {}) {
1113
1273
  const callbacks = useAugurCallbacks();
1114
1274
  const auth = useAugurAuth();
1115
1275
  const site = useAugurSite();
1116
- const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _74 => _74.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _75 => _75.defaults, 'optionalAccess', _76 => _76.customerId])));
1117
- const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _77 => _77.getCustomerOrders]) ? () => callbacks.getCustomerOrders(effectiveCustomerId, params) : void 0)));
1276
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _110 => _110.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _111 => _111.defaults, 'optionalAccess', _112 => _112.customerId])));
1277
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _113 => _113.getCustomerOrders]) ? () => callbacks.getCustomerOrders(effectiveCustomerId, params) : void 0)));
1118
1278
  const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!resolvedQueryFn;
1119
1279
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1120
1280
  queryKey: _chunkH7OXSAHPcjs.getCustomerOrdersKey.call(void 0, effectiveCustomerId, params),
@@ -1138,8 +1298,8 @@ function useOrderDetail(customerId, orderId, options = {}) {
1138
1298
  const callbacks = useAugurCallbacks();
1139
1299
  const auth = useAugurAuth();
1140
1300
  const site = useAugurSite();
1141
- const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _78 => _78.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _79 => _79.defaults, 'optionalAccess', _80 => _80.customerId])));
1142
- const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _81 => _81.getCustomerOrderDetail]) ? () => callbacks.getCustomerOrderDetail(effectiveCustomerId, orderId) : void 0)));
1301
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _114 => _114.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _115 => _115.defaults, 'optionalAccess', _116 => _116.customerId])));
1302
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _117 => _117.getCustomerOrderDetail]) ? () => callbacks.getCustomerOrderDetail(effectiveCustomerId, orderId) : void 0)));
1143
1303
  const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!orderId && !!resolvedQueryFn;
1144
1304
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1145
1305
  queryKey: _chunkH7OXSAHPcjs.getCustomerOrderDetailKey.call(void 0, effectiveCustomerId, orderId),
@@ -1160,8 +1320,8 @@ function useCustomerInvoices(customerId, params, options = {}) {
1160
1320
  const callbacks = useAugurCallbacks();
1161
1321
  const auth = useAugurAuth();
1162
1322
  const site = useAugurSite();
1163
- const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _82 => _82.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _83 => _83.defaults, 'optionalAccess', _84 => _84.customerId])));
1164
- const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _85 => _85.getCustomerInvoices]) ? () => callbacks.getCustomerInvoices(effectiveCustomerId, params) : void 0)));
1323
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _118 => _118.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _119 => _119.defaults, 'optionalAccess', _120 => _120.customerId])));
1324
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _121 => _121.getCustomerInvoices]) ? () => callbacks.getCustomerInvoices(effectiveCustomerId, params) : void 0)));
1165
1325
  const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!resolvedQueryFn;
1166
1326
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1167
1327
  queryKey: _chunkH7OXSAHPcjs.getCustomerInvoicesKey.call(void 0, effectiveCustomerId, params),
@@ -1185,8 +1345,8 @@ function useInvoiceDetail(customerId, invoiceNo, options = {}) {
1185
1345
  const callbacks = useAugurCallbacks();
1186
1346
  const auth = useAugurAuth();
1187
1347
  const site = useAugurSite();
1188
- const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _86 => _86.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _87 => _87.defaults, 'optionalAccess', _88 => _88.customerId])));
1189
- const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _89 => _89.getCustomerInvoiceDetail]) ? () => callbacks.getCustomerInvoiceDetail(effectiveCustomerId, invoiceNo) : void 0)));
1348
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _122 => _122.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _123 => _123.defaults, 'optionalAccess', _124 => _124.customerId])));
1349
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _125 => _125.getCustomerInvoiceDetail]) ? () => callbacks.getCustomerInvoiceDetail(effectiveCustomerId, invoiceNo) : void 0)));
1190
1350
  const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!invoiceNo && !!resolvedQueryFn;
1191
1351
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1192
1352
  queryKey: _chunkH7OXSAHPcjs.getCustomerInvoiceDetailKey.call(void 0, effectiveCustomerId, invoiceNo),
@@ -1207,8 +1367,8 @@ function useCustomerQuotes(customerId, params, options = {}) {
1207
1367
  const callbacks = useAugurCallbacks();
1208
1368
  const auth = useAugurAuth();
1209
1369
  const site = useAugurSite();
1210
- const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _90 => _90.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _91 => _91.defaults, 'optionalAccess', _92 => _92.customerId])));
1211
- const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _93 => _93.getCustomerQuotes]) ? () => callbacks.getCustomerQuotes(effectiveCustomerId, params) : void 0)));
1370
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _126 => _126.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _127 => _127.defaults, 'optionalAccess', _128 => _128.customerId])));
1371
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _129 => _129.getCustomerQuotes]) ? () => callbacks.getCustomerQuotes(effectiveCustomerId, params) : void 0)));
1212
1372
  const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!resolvedQueryFn;
1213
1373
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1214
1374
  queryKey: _chunkH7OXSAHPcjs.getCustomerQuotesKey.call(void 0, effectiveCustomerId, params),
@@ -1232,8 +1392,8 @@ function useQuoteDetail(customerId, quoteNo, options = {}) {
1232
1392
  const callbacks = useAugurCallbacks();
1233
1393
  const auth = useAugurAuth();
1234
1394
  const site = useAugurSite();
1235
- const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _94 => _94.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _95 => _95.defaults, 'optionalAccess', _96 => _96.customerId])));
1236
- const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _97 => _97.getCustomerQuoteDetail]) ? () => callbacks.getCustomerQuoteDetail(effectiveCustomerId, quoteNo) : void 0)));
1395
+ const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _130 => _130.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _131 => _131.defaults, 'optionalAccess', _132 => _132.customerId])));
1396
+ const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _133 => _133.getCustomerQuoteDetail]) ? () => callbacks.getCustomerQuoteDetail(effectiveCustomerId, quoteNo) : void 0)));
1237
1397
  const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!quoteNo && !!resolvedQueryFn;
1238
1398
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
1239
1399
  queryKey: _chunkH7OXSAHPcjs.getCustomerQuoteDetailKey.call(void 0, effectiveCustomerId, quoteNo),
@@ -1253,10 +1413,10 @@ function createSiteHooks(config = {}) {
1253
1413
  const { callbacks, defaultCustomerId, cache, imageConfig } = config;
1254
1414
  function Provider({ api, auth, children }) {
1255
1415
  const mergedAuth = {
1256
- status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _98 => _98.status]), () => ( "unauthenticated")),
1257
- customerId: _optionalChain([auth, 'optionalAccess', _99 => _99.customerId]),
1258
- userId: _optionalChain([auth, 'optionalAccess', _100 => _100.userId]),
1259
- cartHdrUid: _optionalChain([auth, 'optionalAccess', _101 => _101.cartHdrUid])
1416
+ status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _134 => _134.status]), () => ( "unauthenticated")),
1417
+ customerId: _optionalChain([auth, 'optionalAccess', _135 => _135.customerId]),
1418
+ userId: _optionalChain([auth, 'optionalAccess', _136 => _136.userId]),
1419
+ cartHdrUid: _optionalChain([auth, 'optionalAccess', _137 => _137.cartHdrUid])
1260
1420
  };
1261
1421
  return _react.createElement.call(void 0, AugurHooksProvider, {
1262
1422
  api,
@@ -1334,7 +1494,7 @@ function deserialize(data) {
1334
1494
 
1335
1495
  // src/persistence/apply-limits.ts
1336
1496
  function applyLimits(data, limits) {
1337
- const queries = _optionalChain([data, 'access', _102 => _102.clientState, 'optionalAccess', _103 => _103.queries]);
1497
+ const queries = _optionalChain([data, 'access', _138 => _138.clientState, 'optionalAccess', _139 => _139.queries]);
1338
1498
  if (!queries || Object.keys(limits).length === 0) return data;
1339
1499
  const entries = queries;
1340
1500
  const unlimited = [];
@@ -1435,7 +1595,7 @@ function useStorageMonitor(config) {
1435
1595
  const raw = storage.getItem(key);
1436
1596
  if (!raw) return;
1437
1597
  const parsed = JSON.parse(raw);
1438
- if (!_optionalChain([parsed, 'access', _104 => _104.clientState, 'optionalAccess', _105 => _105.queries])) return;
1598
+ if (!_optionalChain([parsed, 'access', _140 => _140.clientState, 'optionalAccess', _141 => _141.queries])) return;
1439
1599
  parsed.clientState.queries = parsed.clientState.queries.filter(
1440
1600
  (q) => {
1441
1601
  if (!Array.isArray(q.queryKey)) return true;
@@ -1462,7 +1622,7 @@ function useAugurPersistence(config) {
1462
1622
  setIsMounted(true);
1463
1623
  }, []);
1464
1624
  useStorageMonitor(config);
1465
- const isDev = typeof process !== "undefined" && _optionalChain([process, 'access', _106 => _106.env, 'optionalAccess', _107 => _107["NODE_ENV"]]) === "development";
1625
+ const isDev = typeof process !== "undefined" && _optionalChain([process, 'access', _142 => _142.env, 'optionalAccess', _143 => _143["NODE_ENV"]]) === "development";
1466
1626
  const { persistableKeys } = config;
1467
1627
  const dehydrateOptions = _react.useMemo.call(void 0,
1468
1628
  () => ({
@@ -1575,5 +1735,6 @@ function useAugurPersistence(config) {
1575
1735
 
1576
1736
 
1577
1737
 
1578
- exports.AugurHooksProvider = AugurHooksProvider; exports.createSiteHooks = createSiteHooks; exports.executeBatchQuery = _chunkH7OXSAHPcjs.executeBatchQuery; exports.getBatchInvMastDocKey = _chunkH7OXSAHPcjs.getBatchInvMastDocKey; exports.getBatchInvMastDocOptions = _chunkH7OXSAHPcjs.getBatchInvMastDocOptions; exports.getCartPricingQueryOptions = _chunkH7OXSAHPcjs.getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = _chunkH7OXSAHPcjs.getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = _chunkH7OXSAHPcjs.getCategoryItemsInfiniteOptions; exports.getCustomerInvoiceDetailKey = _chunkH7OXSAHPcjs.getCustomerInvoiceDetailKey; exports.getCustomerInvoicesKey = _chunkH7OXSAHPcjs.getCustomerInvoicesKey; exports.getCustomerOrderDetailKey = _chunkH7OXSAHPcjs.getCustomerOrderDetailKey; exports.getCustomerOrdersKey = _chunkH7OXSAHPcjs.getCustomerOrdersKey; exports.getCustomerQuoteDetailKey = _chunkH7OXSAHPcjs.getCustomerQuoteDetailKey; exports.getCustomerQuotesKey = _chunkH7OXSAHPcjs.getCustomerQuotesKey; exports.getInvMastDocKey = _chunkH7OXSAHPcjs.getInvMastDocKey; exports.getInvMastDocOptions = _chunkH7OXSAHPcjs.getInvMastDocOptions; exports.getInvMastKey = _chunkH7OXSAHPcjs.getInvMastKey; exports.getInvMastOptions = _chunkH7OXSAHPcjs.getInvMastOptions; exports.getInvMastStockKey = _chunkH7OXSAHPcjs.getInvMastStockKey; exports.getInvMastStockOptions = _chunkH7OXSAHPcjs.getInvMastStockOptions; exports.getItemAttributesKey = _chunkH7OXSAHPcjs.getItemAttributesKey; exports.getItemAttributesOptions = _chunkH7OXSAHPcjs.getItemAttributesOptions; exports.getItemCategoryKey = _chunkH7OXSAHPcjs.getItemCategoryKey; exports.getItemCategoryOptions = _chunkH7OXSAHPcjs.getItemCategoryOptions; exports.getItemDetailsKey = _chunkH7OXSAHPcjs.getItemDetailsKey; exports.getItemDetailsOptions = _chunkH7OXSAHPcjs.getItemDetailsOptions; exports.getItemPriceKey = _chunkH7OXSAHPcjs.getItemPriceKey; exports.getItemPriceOptions = _chunkH7OXSAHPcjs.getItemPriceOptions; exports.getItemSearchInfiniteKey = _chunkH7OXSAHPcjs.getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = _chunkH7OXSAHPcjs.getItemSearchInfiniteOptions; exports.getJoomlaContentKey = _chunkH7OXSAHPcjs.getJoomlaContentKey; exports.getJoomlaContentListKey = _chunkH7OXSAHPcjs.getJoomlaContentListKey; exports.getJoomlaContentListOptions = _chunkH7OXSAHPcjs.getJoomlaContentListOptions; exports.getJoomlaContentOptions = _chunkH7OXSAHPcjs.getJoomlaContentOptions; exports.getJoomlaMenuDocKey = _chunkH7OXSAHPcjs.getJoomlaMenuDocKey; exports.getJoomlaMenuDocOptions = _chunkH7OXSAHPcjs.getJoomlaMenuDocOptions; exports.getJoomlaMenuKey = _chunkH7OXSAHPcjs.getJoomlaMenuKey; exports.getJoomlaMenuOptions = _chunkH7OXSAHPcjs.getJoomlaMenuOptions; exports.getProductCategoryKey = _chunkH7OXSAHPcjs.getProductCategoryKey; exports.getProductCategoryOptions = _chunkH7OXSAHPcjs.getProductCategoryOptions; exports.getProductSearchKey = _chunkH7OXSAHPcjs.getProductSearchKey; exports.getProductSearchOptions = _chunkH7OXSAHPcjs.getProductSearchOptions; exports.getSearchSuggestionsKey = _chunkH7OXSAHPcjs.getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = _chunkH7OXSAHPcjs.getSearchSuggestionsOptions; exports.getStockKey = _chunkH7OXSAHPcjs.getStockKey; exports.getStockOptions = _chunkH7OXSAHPcjs.getStockOptions; 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; exports.useStock = useStock;
1738
+
1739
+ exports.AugurHooksProvider = AugurHooksProvider; exports.createSiteHooks = createSiteHooks; exports.executeBatchQuery = _chunkH7OXSAHPcjs.executeBatchQuery; exports.getBatchInvMastDocKey = _chunkH7OXSAHPcjs.getBatchInvMastDocKey; exports.getBatchInvMastDocOptions = _chunkH7OXSAHPcjs.getBatchInvMastDocOptions; exports.getCartPricingQueryOptions = _chunkH7OXSAHPcjs.getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = _chunkH7OXSAHPcjs.getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = _chunkH7OXSAHPcjs.getCategoryItemsInfiniteOptions; exports.getCustomerInvoiceDetailKey = _chunkH7OXSAHPcjs.getCustomerInvoiceDetailKey; exports.getCustomerInvoicesKey = _chunkH7OXSAHPcjs.getCustomerInvoicesKey; exports.getCustomerOrderDetailKey = _chunkH7OXSAHPcjs.getCustomerOrderDetailKey; exports.getCustomerOrdersKey = _chunkH7OXSAHPcjs.getCustomerOrdersKey; exports.getCustomerQuoteDetailKey = _chunkH7OXSAHPcjs.getCustomerQuoteDetailKey; exports.getCustomerQuotesKey = _chunkH7OXSAHPcjs.getCustomerQuotesKey; exports.getInvMastDocKey = _chunkH7OXSAHPcjs.getInvMastDocKey; exports.getInvMastDocOptions = _chunkH7OXSAHPcjs.getInvMastDocOptions; exports.getInvMastKey = _chunkH7OXSAHPcjs.getInvMastKey; exports.getInvMastOptions = _chunkH7OXSAHPcjs.getInvMastOptions; exports.getInvMastStockKey = _chunkH7OXSAHPcjs.getInvMastStockKey; exports.getInvMastStockOptions = _chunkH7OXSAHPcjs.getInvMastStockOptions; exports.getItemAttributesKey = _chunkH7OXSAHPcjs.getItemAttributesKey; exports.getItemAttributesOptions = _chunkH7OXSAHPcjs.getItemAttributesOptions; exports.getItemCategoryKey = _chunkH7OXSAHPcjs.getItemCategoryKey; exports.getItemCategoryOptions = _chunkH7OXSAHPcjs.getItemCategoryOptions; exports.getItemDetailsKey = _chunkH7OXSAHPcjs.getItemDetailsKey; exports.getItemDetailsOptions = _chunkH7OXSAHPcjs.getItemDetailsOptions; exports.getItemPriceKey = _chunkH7OXSAHPcjs.getItemPriceKey; exports.getItemPriceOptions = _chunkH7OXSAHPcjs.getItemPriceOptions; exports.getItemSearchInfiniteKey = _chunkH7OXSAHPcjs.getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = _chunkH7OXSAHPcjs.getItemSearchInfiniteOptions; exports.getJoomlaContentKey = _chunkH7OXSAHPcjs.getJoomlaContentKey; exports.getJoomlaContentListKey = _chunkH7OXSAHPcjs.getJoomlaContentListKey; exports.getJoomlaContentListOptions = _chunkH7OXSAHPcjs.getJoomlaContentListOptions; exports.getJoomlaContentOptions = _chunkH7OXSAHPcjs.getJoomlaContentOptions; exports.getJoomlaMenuDocKey = _chunkH7OXSAHPcjs.getJoomlaMenuDocKey; exports.getJoomlaMenuDocOptions = _chunkH7OXSAHPcjs.getJoomlaMenuDocOptions; exports.getJoomlaMenuKey = _chunkH7OXSAHPcjs.getJoomlaMenuKey; exports.getJoomlaMenuOptions = _chunkH7OXSAHPcjs.getJoomlaMenuOptions; exports.getProductCategoryKey = _chunkH7OXSAHPcjs.getProductCategoryKey; exports.getProductCategoryOptions = _chunkH7OXSAHPcjs.getProductCategoryOptions; exports.getProductSearchKey = _chunkH7OXSAHPcjs.getProductSearchKey; exports.getProductSearchOptions = _chunkH7OXSAHPcjs.getProductSearchOptions; exports.getSearchSuggestionsKey = _chunkH7OXSAHPcjs.getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = _chunkH7OXSAHPcjs.getSearchSuggestionsOptions; exports.getStockKey = _chunkH7OXSAHPcjs.getStockKey; exports.getStockOptions = _chunkH7OXSAHPcjs.getStockOptions; 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.usePaymentFlow = usePaymentFlow; exports.useProductCategory = useProductCategory; exports.useProductSearch = useProductSearch; exports.useQuoteDetail = useQuoteDetail; exports.useSearchSuggestions = useSearchSuggestions; exports.useSetCartHdrUid = useSetCartHdrUid; exports.useSetCartLines = useSetCartLines; exports.useStock = useStock;
1579
1740
  //# sourceMappingURL=index.cjs.map