@simpleapps-com/augur-hooks 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-XPZVNYPR.js → chunk-CL3XM5B5.js} +94 -2
- package/dist/chunk-CL3XM5B5.js.map +1 -0
- package/dist/{chunk-IYEN7NGC.cjs → chunk-I3JHJMQ6.cjs} +94 -2
- package/dist/chunk-I3JHJMQ6.cjs.map +1 -0
- package/dist/{joomla-content-list-D-DV69o0.d.cts → customer-quotes-SdLKX_-8.d.cts} +52 -2
- package/dist/{joomla-content-list-D-DV69o0.d.ts → customer-quotes-SdLKX_-8.d.ts} +52 -2
- package/dist/index.cjs +214 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -4
- package/dist/index.d.ts +105 -4
- package/dist/index.js +185 -1
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +22 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +21 -1
- package/package.json +3 -3
- package/dist/chunk-IYEN7NGC.cjs.map +0 -1
- package/dist/chunk-XPZVNYPR.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -28,7 +28,17 @@
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
var _chunkI3JHJMQ6cjs = require('./chunk-I3JHJMQ6.cjs');
|
|
32
42
|
|
|
33
43
|
// src/provider.tsx
|
|
34
44
|
var _react = require('react');
|
|
@@ -173,7 +183,7 @@ function useItemPrice(itemId, customerId, quantity = 1, options = {}) {
|
|
|
173
183
|
const auth = useAugurAuth();
|
|
174
184
|
const cache = useAugurCache();
|
|
175
185
|
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _ => _.customerId])));
|
|
176
|
-
const defaultOptions =
|
|
186
|
+
const defaultOptions = _chunkI3JHJMQ6cjs.getItemPriceOptions.call(void 0, api, itemId, effectiveCustomerId, quantity, cache);
|
|
177
187
|
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _2 => _2.getItemPrice]) ? () => callbacks.getItemPrice(itemId, effectiveCustomerId, quantity) : void 0)));
|
|
178
188
|
return _reactquery.useQuery.call(void 0, {
|
|
179
189
|
...defaultOptions,
|
|
@@ -189,7 +199,7 @@ function useInvMastDoc(invMastUid, itemId, options = {}) {
|
|
|
189
199
|
const api = useAugurApiOptional();
|
|
190
200
|
const callbacks = useAugurCallbacks();
|
|
191
201
|
const cache = useAugurCache();
|
|
192
|
-
const queryOpts =
|
|
202
|
+
const queryOpts = _chunkI3JHJMQ6cjs.getInvMastDocOptions.call(void 0,
|
|
193
203
|
api,
|
|
194
204
|
invMastUid,
|
|
195
205
|
itemId,
|
|
@@ -211,7 +221,7 @@ function useItemCategory(itemCategoryUid, options = {}) {
|
|
|
211
221
|
const api = useAugurApiOptional();
|
|
212
222
|
const callbacks = useAugurCallbacks();
|
|
213
223
|
const cache = useAugurCache();
|
|
214
|
-
const queryOpts =
|
|
224
|
+
const queryOpts = _chunkI3JHJMQ6cjs.getItemCategoryOptions.call(void 0,
|
|
215
225
|
api,
|
|
216
226
|
itemCategoryUid,
|
|
217
227
|
options.apiOptions,
|
|
@@ -231,7 +241,7 @@ function useInvMast(invMastUid, itemId, options = {}) {
|
|
|
231
241
|
const api = useAugurApiOptional();
|
|
232
242
|
const callbacks = useAugurCallbacks();
|
|
233
243
|
const cache = useAugurCache();
|
|
234
|
-
const queryOpts =
|
|
244
|
+
const queryOpts = _chunkI3JHJMQ6cjs.getInvMastOptions.call(void 0, api, invMastUid, itemId, cache);
|
|
235
245
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
236
246
|
...queryOpts,
|
|
237
247
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _5 => _5.getInvMast]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMast(invMastUid, itemId)))) } : {},
|
|
@@ -246,7 +256,7 @@ function useInvMastStock(invMastUid, options = {}) {
|
|
|
246
256
|
const api = useAugurApiOptional();
|
|
247
257
|
const callbacks = useAugurCallbacks();
|
|
248
258
|
const cache = useAugurCache();
|
|
249
|
-
const queryOpts =
|
|
259
|
+
const queryOpts = _chunkI3JHJMQ6cjs.getInvMastStockOptions.call(void 0, api, invMastUid, cache);
|
|
250
260
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
251
261
|
...queryOpts,
|
|
252
262
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _6 => _6.getInvMastStock]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMastStock(invMastUid)))) } : {},
|
|
@@ -277,8 +287,8 @@ function useProductCategory(itemCategoryUid, options = {}) {
|
|
|
277
287
|
const api = useAugurApiOptional();
|
|
278
288
|
const callbacks = useAugurCallbacks();
|
|
279
289
|
const cache = useAugurCache();
|
|
280
|
-
const baseOptions = itemCategoryUid ?
|
|
281
|
-
queryKey:
|
|
290
|
+
const baseOptions = itemCategoryUid ? _chunkI3JHJMQ6cjs.getProductCategoryOptions.call(void 0, api, itemCategoryUid, cache) : {
|
|
291
|
+
queryKey: _chunkI3JHJMQ6cjs.getProductCategoryKey.call(void 0, null),
|
|
282
292
|
/* v8 ignore next */
|
|
283
293
|
queryFn: () => Promise.reject()
|
|
284
294
|
};
|
|
@@ -306,8 +316,8 @@ function useItemDetails(itemId, options = {}) {
|
|
|
306
316
|
const callbacks = useAugurCallbacks();
|
|
307
317
|
const cache = useAugurCache();
|
|
308
318
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
309
|
-
...itemId ?
|
|
310
|
-
queryKey:
|
|
319
|
+
...itemId ? _chunkI3JHJMQ6cjs.getItemDetailsOptions.call(void 0, api, itemId, cache) : {
|
|
320
|
+
queryKey: _chunkI3JHJMQ6cjs.getItemDetailsKey.call(void 0, ""),
|
|
311
321
|
/* v8 ignore next */
|
|
312
322
|
queryFn: () => Promise.reject()
|
|
313
323
|
},
|
|
@@ -334,8 +344,8 @@ function useItemAttributes(itemCategoryUid, options = {}) {
|
|
|
334
344
|
const callbacks = useAugurCallbacks();
|
|
335
345
|
const cache = useAugurCache();
|
|
336
346
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
337
|
-
...itemCategoryUid ?
|
|
338
|
-
queryKey:
|
|
347
|
+
...itemCategoryUid ? _chunkI3JHJMQ6cjs.getItemAttributesOptions.call(void 0, api, itemCategoryUid, cache) : {
|
|
348
|
+
queryKey: _chunkI3JHJMQ6cjs.getItemAttributesKey.call(void 0, null),
|
|
339
349
|
/* v8 ignore next */
|
|
340
350
|
queryFn: () => Promise.reject()
|
|
341
351
|
},
|
|
@@ -359,7 +369,7 @@ function useProductSearch(pageData, options = {}) {
|
|
|
359
369
|
const api = useAugurApiOptional();
|
|
360
370
|
const callbacks = useAugurCallbacks();
|
|
361
371
|
const cache = useAugurCache();
|
|
362
|
-
const defaultOptions =
|
|
372
|
+
const defaultOptions = _chunkI3JHJMQ6cjs.getProductSearchOptions.call(void 0, api, pageData, cache);
|
|
363
373
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
364
374
|
...defaultOptions,
|
|
365
375
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _16 => _16.getProductSearch]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getProductSearch(pageData)))) } : {},
|
|
@@ -385,7 +395,7 @@ function useSearchSuggestions(query, options = {}) {
|
|
|
385
395
|
const limit = _nullishCoalesce(options.limit, () => ( 10));
|
|
386
396
|
const offset = _nullishCoalesce(options.offset, () => ( 0));
|
|
387
397
|
const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && query.trim().length > 0;
|
|
388
|
-
const defaultOptions =
|
|
398
|
+
const defaultOptions = _chunkI3JHJMQ6cjs.getSearchSuggestionsOptions.call(void 0, api, query, limit, offset, cache);
|
|
389
399
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
390
400
|
...defaultOptions,
|
|
391
401
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _19 => _19.getSearchSuggestions]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getSearchSuggestions(query, limit, offset)))) } : {},
|
|
@@ -696,12 +706,12 @@ function useCartPricing(options = {}) {
|
|
|
696
706
|
const priceQueries = _reactquery.useQueries.call(void 0, {
|
|
697
707
|
queries: cartLines.map((line) => {
|
|
698
708
|
const base = priceFn ? {
|
|
699
|
-
queryKey:
|
|
709
|
+
queryKey: _chunkI3JHJMQ6cjs.getItemPriceKey.call(void 0, line.itemId, customerId, line.quantity),
|
|
700
710
|
queryFn: () => priceFn(line.itemId, customerId, line.quantity),
|
|
701
711
|
refetchOnReconnect: true,
|
|
702
712
|
refetchOnWindowFocus: false,
|
|
703
713
|
meta: { persist: true }
|
|
704
|
-
} :
|
|
714
|
+
} : _chunkI3JHJMQ6cjs.getItemPriceOptions.call(void 0, api, line.itemId, customerId, line.quantity, cache);
|
|
705
715
|
return {
|
|
706
716
|
...base,
|
|
707
717
|
enabled: !!customerId && !!line.itemId
|
|
@@ -801,7 +811,7 @@ function useCategoryItemsInfinite(itemCategoryUid, itemsFilters, options = {}) {
|
|
|
801
811
|
const callbacks = useAugurCallbacks();
|
|
802
812
|
const cache = useAugurCache();
|
|
803
813
|
const { enabled = true } = options;
|
|
804
|
-
const defaultOptions =
|
|
814
|
+
const defaultOptions = _chunkI3JHJMQ6cjs.getCategoryItemsInfiniteOptions.call(void 0,
|
|
805
815
|
api,
|
|
806
816
|
itemCategoryUid,
|
|
807
817
|
itemsFilters,
|
|
@@ -828,7 +838,7 @@ function useItemSearchInfinite(itemsFilters, itemCategoryUid, options = {}) {
|
|
|
828
838
|
const callbacks = useAugurCallbacks();
|
|
829
839
|
const cache = useAugurCache();
|
|
830
840
|
const { enabled = true } = options;
|
|
831
|
-
const defaultOptions =
|
|
841
|
+
const defaultOptions = _chunkI3JHJMQ6cjs.getItemSearchInfiniteOptions.call(void 0,
|
|
832
842
|
api,
|
|
833
843
|
itemsFilters,
|
|
834
844
|
itemCategoryUid,
|
|
@@ -855,8 +865,8 @@ function useJoomlaContent(articleId, options = {}) {
|
|
|
855
865
|
const callbacks = useAugurCallbacks();
|
|
856
866
|
const cache = useAugurCache();
|
|
857
867
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
858
|
-
...articleId ?
|
|
859
|
-
queryKey:
|
|
868
|
+
...articleId ? _chunkI3JHJMQ6cjs.getJoomlaContentOptions.call(void 0, api, articleId, cache) : {
|
|
869
|
+
queryKey: _chunkI3JHJMQ6cjs.getJoomlaContentKey.call(void 0, ""),
|
|
860
870
|
/* v8 ignore next */
|
|
861
871
|
queryFn: () => Promise.reject()
|
|
862
872
|
},
|
|
@@ -877,8 +887,8 @@ function useJoomlaContentList(categoryId, options = {}) {
|
|
|
877
887
|
const callbacks = useAugurCallbacks();
|
|
878
888
|
const cache = useAugurCache();
|
|
879
889
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
880
|
-
...categoryId ?
|
|
881
|
-
queryKey:
|
|
890
|
+
...categoryId ? _chunkI3JHJMQ6cjs.getJoomlaContentListOptions.call(void 0, api, categoryId, options.filters, cache) : {
|
|
891
|
+
queryKey: _chunkI3JHJMQ6cjs.getJoomlaContentListKey.call(void 0, ""),
|
|
882
892
|
/* v8 ignore next */
|
|
883
893
|
queryFn: () => Promise.reject()
|
|
884
894
|
},
|
|
@@ -894,16 +904,163 @@ function useJoomlaContentList(categoryId, options = {}) {
|
|
|
894
904
|
};
|
|
895
905
|
}
|
|
896
906
|
|
|
907
|
+
// src/hooks/use-joomla-menu.ts
|
|
908
|
+
|
|
909
|
+
function useJoomlaMenu(options = {}) {
|
|
910
|
+
const api = useAugurApiOptional();
|
|
911
|
+
const callbacks = useAugurCallbacks();
|
|
912
|
+
const cache = useAugurCache();
|
|
913
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
914
|
+
..._chunkI3JHJMQ6cjs.getJoomlaMenuOptions.call(void 0, api, options.filters, cache),
|
|
915
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _55 => _55.getJoomlaMenu]))) ? {
|
|
916
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenu(options.filters))))
|
|
917
|
+
} : {},
|
|
918
|
+
enabled: _nullishCoalesce(options.enabled, () => ( true))
|
|
919
|
+
});
|
|
920
|
+
return {
|
|
921
|
+
menuItems: _nullishCoalesce(data, () => ( [])),
|
|
922
|
+
isLoading,
|
|
923
|
+
error
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// src/hooks/use-joomla-menu-doc.ts
|
|
928
|
+
|
|
929
|
+
function useJoomlaMenuDoc(menuId, options = {}) {
|
|
930
|
+
const api = useAugurApiOptional();
|
|
931
|
+
const callbacks = useAugurCallbacks();
|
|
932
|
+
const cache = useAugurCache();
|
|
933
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
934
|
+
...menuId ? _chunkI3JHJMQ6cjs.getJoomlaMenuDocOptions.call(void 0, api, menuId, cache) : {
|
|
935
|
+
queryKey: _chunkI3JHJMQ6cjs.getJoomlaMenuDocKey.call(void 0, ""),
|
|
936
|
+
/* v8 ignore next */
|
|
937
|
+
queryFn: () => Promise.reject()
|
|
938
|
+
},
|
|
939
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _56 => _56.getJoomlaMenuDoc]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenuDoc(menuId)))) } : {},
|
|
940
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!menuId
|
|
941
|
+
});
|
|
942
|
+
return {
|
|
943
|
+
menuItem: _nullishCoalesce(data, () => ( null)),
|
|
944
|
+
isLoading,
|
|
945
|
+
error
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
// src/hooks/use-customer-orders.ts
|
|
950
|
+
|
|
951
|
+
function useCustomerOrders(customerId, params, options = {}) {
|
|
952
|
+
const callbacks = useAugurCallbacks();
|
|
953
|
+
const auth = useAugurAuth();
|
|
954
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _57 => _57.customerId])));
|
|
955
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
956
|
+
queryKey: _chunkI3JHJMQ6cjs.getCustomerOrdersKey.call(void 0, effectiveCustomerId, params),
|
|
957
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerOrders(effectiveCustomerId, params)))),
|
|
958
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _58 => _58.getCustomerOrders]))))
|
|
959
|
+
});
|
|
960
|
+
return {
|
|
961
|
+
orders: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _59 => _59.data]), () => ( [])),
|
|
962
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _60 => _60.total]), () => ( 0)),
|
|
963
|
+
isLoading,
|
|
964
|
+
error
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
function useOrderDetail(customerId, orderId, options = {}) {
|
|
968
|
+
const callbacks = useAugurCallbacks();
|
|
969
|
+
const auth = useAugurAuth();
|
|
970
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _61 => _61.customerId])));
|
|
971
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
972
|
+
queryKey: _chunkI3JHJMQ6cjs.getCustomerOrderDetailKey.call(void 0, effectiveCustomerId, orderId),
|
|
973
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerOrderDetail(effectiveCustomerId, orderId)))),
|
|
974
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!orderId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _62 => _62.getCustomerOrderDetail]))))
|
|
975
|
+
});
|
|
976
|
+
return {
|
|
977
|
+
order: _nullishCoalesce(data, () => ( null)),
|
|
978
|
+
isLoading,
|
|
979
|
+
error
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
// src/hooks/use-customer-invoices.ts
|
|
984
|
+
|
|
985
|
+
function useCustomerInvoices(customerId, params, options = {}) {
|
|
986
|
+
const callbacks = useAugurCallbacks();
|
|
987
|
+
const auth = useAugurAuth();
|
|
988
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _63 => _63.customerId])));
|
|
989
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
990
|
+
queryKey: _chunkI3JHJMQ6cjs.getCustomerInvoicesKey.call(void 0, effectiveCustomerId, params),
|
|
991
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerInvoices(effectiveCustomerId, params)))),
|
|
992
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _64 => _64.getCustomerInvoices]))))
|
|
993
|
+
});
|
|
994
|
+
return {
|
|
995
|
+
invoices: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _65 => _65.data]), () => ( [])),
|
|
996
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _66 => _66.total]), () => ( 0)),
|
|
997
|
+
isLoading,
|
|
998
|
+
error
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
function useInvoiceDetail(customerId, invoiceNo, options = {}) {
|
|
1002
|
+
const callbacks = useAugurCallbacks();
|
|
1003
|
+
const auth = useAugurAuth();
|
|
1004
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _67 => _67.customerId])));
|
|
1005
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1006
|
+
queryKey: _chunkI3JHJMQ6cjs.getCustomerInvoiceDetailKey.call(void 0, effectiveCustomerId, invoiceNo),
|
|
1007
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerInvoiceDetail(
|
|
1008
|
+
effectiveCustomerId,
|
|
1009
|
+
invoiceNo
|
|
1010
|
+
)))),
|
|
1011
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!invoiceNo && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _68 => _68.getCustomerInvoiceDetail]))))
|
|
1012
|
+
});
|
|
1013
|
+
return {
|
|
1014
|
+
invoice: _nullishCoalesce(data, () => ( null)),
|
|
1015
|
+
isLoading,
|
|
1016
|
+
error
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
// src/hooks/use-customer-quotes.ts
|
|
1021
|
+
|
|
1022
|
+
function useCustomerQuotes(customerId, params, options = {}) {
|
|
1023
|
+
const callbacks = useAugurCallbacks();
|
|
1024
|
+
const auth = useAugurAuth();
|
|
1025
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _69 => _69.customerId])));
|
|
1026
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1027
|
+
queryKey: _chunkI3JHJMQ6cjs.getCustomerQuotesKey.call(void 0, effectiveCustomerId, params),
|
|
1028
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerQuotes(effectiveCustomerId, params)))),
|
|
1029
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _70 => _70.getCustomerQuotes]))))
|
|
1030
|
+
});
|
|
1031
|
+
return {
|
|
1032
|
+
quotes: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _71 => _71.data]), () => ( [])),
|
|
1033
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _72 => _72.total]), () => ( 0)),
|
|
1034
|
+
isLoading,
|
|
1035
|
+
error
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
function useQuoteDetail(customerId, quoteNo, options = {}) {
|
|
1039
|
+
const callbacks = useAugurCallbacks();
|
|
1040
|
+
const auth = useAugurAuth();
|
|
1041
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _73 => _73.customerId])));
|
|
1042
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1043
|
+
queryKey: _chunkI3JHJMQ6cjs.getCustomerQuoteDetailKey.call(void 0, effectiveCustomerId, quoteNo),
|
|
1044
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerQuoteDetail(effectiveCustomerId, quoteNo)))),
|
|
1045
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!quoteNo && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _74 => _74.getCustomerQuoteDetail]))))
|
|
1046
|
+
});
|
|
1047
|
+
return {
|
|
1048
|
+
quote: _nullishCoalesce(data, () => ( null)),
|
|
1049
|
+
isLoading,
|
|
1050
|
+
error
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
|
|
897
1054
|
// src/create-site-hooks.ts
|
|
898
1055
|
|
|
899
1056
|
function createSiteHooks(config = {}) {
|
|
900
1057
|
const { callbacks, defaultCustomerId, cache } = config;
|
|
901
1058
|
function Provider({ api, auth, children }) {
|
|
902
1059
|
const mergedAuth = {
|
|
903
|
-
status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess',
|
|
904
|
-
customerId: _nullishCoalesce(_optionalChain([auth, 'optionalAccess',
|
|
905
|
-
userId: _optionalChain([auth, 'optionalAccess',
|
|
906
|
-
cartHdrUid: _optionalChain([auth, 'optionalAccess',
|
|
1060
|
+
status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _75 => _75.status]), () => ( "unauthenticated")),
|
|
1061
|
+
customerId: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _76 => _76.customerId]), () => ( defaultCustomerId)),
|
|
1062
|
+
userId: _optionalChain([auth, 'optionalAccess', _77 => _77.userId]),
|
|
1063
|
+
cartHdrUid: _optionalChain([auth, 'optionalAccess', _78 => _78.cartHdrUid])
|
|
907
1064
|
};
|
|
908
1065
|
return _react.createElement.call(void 0, AugurHooksProvider, {
|
|
909
1066
|
api,
|
|
@@ -941,6 +1098,15 @@ function createSiteHooks(config = {}) {
|
|
|
941
1098
|
// Hooks -- Joomla
|
|
942
1099
|
useJoomlaContent,
|
|
943
1100
|
useJoomlaContentList,
|
|
1101
|
+
useJoomlaMenu,
|
|
1102
|
+
useJoomlaMenuDoc,
|
|
1103
|
+
// Hooks -- customer
|
|
1104
|
+
useCustomerOrders,
|
|
1105
|
+
useOrderDetail,
|
|
1106
|
+
useCustomerInvoices,
|
|
1107
|
+
useInvoiceDetail,
|
|
1108
|
+
useCustomerQuotes,
|
|
1109
|
+
useQuoteDetail,
|
|
944
1110
|
// Hooks -- utilities
|
|
945
1111
|
useDebounce,
|
|
946
1112
|
useFormatPrice
|
|
@@ -963,7 +1129,7 @@ function deserialize(data) {
|
|
|
963
1129
|
|
|
964
1130
|
// src/persistence/apply-limits.ts
|
|
965
1131
|
function applyLimits(data, limits) {
|
|
966
|
-
const queries = _optionalChain([data, 'access',
|
|
1132
|
+
const queries = _optionalChain([data, 'access', _79 => _79.clientState, 'optionalAccess', _80 => _80.queries]);
|
|
967
1133
|
if (!queries || Object.keys(limits).length === 0) return data;
|
|
968
1134
|
const entries = queries;
|
|
969
1135
|
const unlimited = [];
|
|
@@ -1064,7 +1230,7 @@ function useStorageMonitor(config) {
|
|
|
1064
1230
|
const raw = storage.getItem(key);
|
|
1065
1231
|
if (!raw) return;
|
|
1066
1232
|
const parsed = JSON.parse(raw);
|
|
1067
|
-
if (!_optionalChain([parsed, 'access',
|
|
1233
|
+
if (!_optionalChain([parsed, 'access', _81 => _81.clientState, 'optionalAccess', _82 => _82.queries])) return;
|
|
1068
1234
|
parsed.clientState.queries = parsed.clientState.queries.filter(
|
|
1069
1235
|
(q) => {
|
|
1070
1236
|
if (!Array.isArray(q.queryKey)) return true;
|
|
@@ -1091,7 +1257,7 @@ function useAugurPersistence(config) {
|
|
|
1091
1257
|
setIsMounted(true);
|
|
1092
1258
|
}, []);
|
|
1093
1259
|
useStorageMonitor(config);
|
|
1094
|
-
const isDev = typeof process !== "undefined" && _optionalChain([process, 'access',
|
|
1260
|
+
const isDev = typeof process !== "undefined" && _optionalChain([process, 'access', _83 => _83.env, 'optionalAccess', _84 => _84.NODE_ENV]) === "development";
|
|
1095
1261
|
const { persistableKeys } = config;
|
|
1096
1262
|
const dehydrateOptions = _react.useMemo.call(void 0, () => ({
|
|
1097
1263
|
shouldDehydrateQuery: (query) => {
|
|
@@ -1174,5 +1340,23 @@ function useAugurPersistence(config) {
|
|
|
1174
1340
|
|
|
1175
1341
|
|
|
1176
1342
|
|
|
1177
|
-
|
|
1343
|
+
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
|
|
1351
|
+
|
|
1352
|
+
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
exports.AugurHooksProvider = AugurHooksProvider; exports.createSiteHooks = createSiteHooks; exports.getCartPricingQueryOptions = _chunkI3JHJMQ6cjs.getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = _chunkI3JHJMQ6cjs.getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = _chunkI3JHJMQ6cjs.getCategoryItemsInfiniteOptions; exports.getCustomerInvoiceDetailKey = _chunkI3JHJMQ6cjs.getCustomerInvoiceDetailKey; exports.getCustomerInvoicesKey = _chunkI3JHJMQ6cjs.getCustomerInvoicesKey; exports.getCustomerOrderDetailKey = _chunkI3JHJMQ6cjs.getCustomerOrderDetailKey; exports.getCustomerOrdersKey = _chunkI3JHJMQ6cjs.getCustomerOrdersKey; exports.getCustomerQuoteDetailKey = _chunkI3JHJMQ6cjs.getCustomerQuoteDetailKey; exports.getCustomerQuotesKey = _chunkI3JHJMQ6cjs.getCustomerQuotesKey; exports.getInvMastDocKey = _chunkI3JHJMQ6cjs.getInvMastDocKey; exports.getInvMastDocOptions = _chunkI3JHJMQ6cjs.getInvMastDocOptions; exports.getInvMastKey = _chunkI3JHJMQ6cjs.getInvMastKey; exports.getInvMastOptions = _chunkI3JHJMQ6cjs.getInvMastOptions; exports.getInvMastStockKey = _chunkI3JHJMQ6cjs.getInvMastStockKey; exports.getInvMastStockOptions = _chunkI3JHJMQ6cjs.getInvMastStockOptions; exports.getItemAttributesKey = _chunkI3JHJMQ6cjs.getItemAttributesKey; exports.getItemAttributesOptions = _chunkI3JHJMQ6cjs.getItemAttributesOptions; exports.getItemCategoryKey = _chunkI3JHJMQ6cjs.getItemCategoryKey; exports.getItemCategoryOptions = _chunkI3JHJMQ6cjs.getItemCategoryOptions; exports.getItemDetailsKey = _chunkI3JHJMQ6cjs.getItemDetailsKey; exports.getItemDetailsOptions = _chunkI3JHJMQ6cjs.getItemDetailsOptions; exports.getItemPriceKey = _chunkI3JHJMQ6cjs.getItemPriceKey; exports.getItemPriceOptions = _chunkI3JHJMQ6cjs.getItemPriceOptions; exports.getItemSearchInfiniteKey = _chunkI3JHJMQ6cjs.getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = _chunkI3JHJMQ6cjs.getItemSearchInfiniteOptions; exports.getJoomlaContentKey = _chunkI3JHJMQ6cjs.getJoomlaContentKey; exports.getJoomlaContentListKey = _chunkI3JHJMQ6cjs.getJoomlaContentListKey; exports.getJoomlaContentListOptions = _chunkI3JHJMQ6cjs.getJoomlaContentListOptions; exports.getJoomlaContentOptions = _chunkI3JHJMQ6cjs.getJoomlaContentOptions; exports.getJoomlaMenuDocKey = _chunkI3JHJMQ6cjs.getJoomlaMenuDocKey; exports.getJoomlaMenuDocOptions = _chunkI3JHJMQ6cjs.getJoomlaMenuDocOptions; exports.getJoomlaMenuKey = _chunkI3JHJMQ6cjs.getJoomlaMenuKey; exports.getJoomlaMenuOptions = _chunkI3JHJMQ6cjs.getJoomlaMenuOptions; exports.getProductCategoryKey = _chunkI3JHJMQ6cjs.getProductCategoryKey; exports.getProductCategoryOptions = _chunkI3JHJMQ6cjs.getProductCategoryOptions; exports.getProductSearchKey = _chunkI3JHJMQ6cjs.getProductSearchKey; exports.getProductSearchOptions = _chunkI3JHJMQ6cjs.getProductSearchOptions; exports.getSearchSuggestionsKey = _chunkI3JHJMQ6cjs.getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = _chunkI3JHJMQ6cjs.getSearchSuggestionsOptions; exports.useAugurApi = useAugurApi; exports.useAugurApiOptional = useAugurApiOptional; exports.useAugurAuth = useAugurAuth; exports.useAugurCache = useAugurCache; exports.useAugurPersistence = useAugurPersistence; 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;
|
|
1178
1362
|
//# sourceMappingURL=index.cjs.map
|