@simpleapps-com/augur-hooks 0.3.1 → 0.4.1
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-AXCNTEAB.cjs +44 -0
- package/dist/chunk-AXCNTEAB.cjs.map +1 -0
- package/dist/{chunk-LCWJOWAC.js → chunk-CL3XM5B5.js} +33 -3
- package/dist/chunk-CL3XM5B5.js.map +1 -0
- package/dist/{chunk-QXDTBGFO.cjs → chunk-I3JHJMQ6.cjs} +32 -2
- package/dist/chunk-I3JHJMQ6.cjs.map +1 -0
- package/dist/chunk-LTBEP4MC.js +44 -0
- package/dist/chunk-LTBEP4MC.js.map +1 -0
- package/dist/{joomla-menu-doc-C0Dcq1eO.d.cts → customer-quotes-SdLKX_-8.d.cts} +31 -1
- package/dist/{joomla-menu-doc-C0Dcq1eO.d.ts → customer-quotes-SdLKX_-8.d.ts} +31 -1
- package/dist/index.cjs +177 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +86 -4
- package/dist/index.d.ts +86 -4
- package/dist/index.js +145 -3
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +14 -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 +13 -1
- package/dist/use-image-with-fallback-DgmtrGZU.d.cts +17 -0
- package/dist/use-image-with-fallback-DgmtrGZU.d.ts +17 -0
- package/dist/web.cjs +7 -2
- package/dist/web.cjs.map +1 -1
- package/dist/web.d.cts +2 -0
- package/dist/web.d.ts +2 -0
- package/dist/web.js +5 -0
- package/dist/web.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-LCWJOWAC.js.map +0 -1
- package/dist/chunk-QXDTBGFO.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -32,7 +32,16 @@
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
var _chunkI3JHJMQ6cjs = require('./chunk-I3JHJMQ6.cjs');
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
var _chunkAXCNTEABcjs = require('./chunk-AXCNTEAB.cjs');
|
|
36
45
|
|
|
37
46
|
// src/provider.tsx
|
|
38
47
|
var _react = require('react');
|
|
@@ -177,7 +186,7 @@ function useItemPrice(itemId, customerId, quantity = 1, options = {}) {
|
|
|
177
186
|
const auth = useAugurAuth();
|
|
178
187
|
const cache = useAugurCache();
|
|
179
188
|
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _ => _.customerId])));
|
|
180
|
-
const defaultOptions =
|
|
189
|
+
const defaultOptions = _chunkI3JHJMQ6cjs.getItemPriceOptions.call(void 0, api, itemId, effectiveCustomerId, quantity, cache);
|
|
181
190
|
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _2 => _2.getItemPrice]) ? () => callbacks.getItemPrice(itemId, effectiveCustomerId, quantity) : void 0)));
|
|
182
191
|
return _reactquery.useQuery.call(void 0, {
|
|
183
192
|
...defaultOptions,
|
|
@@ -193,7 +202,7 @@ function useInvMastDoc(invMastUid, itemId, options = {}) {
|
|
|
193
202
|
const api = useAugurApiOptional();
|
|
194
203
|
const callbacks = useAugurCallbacks();
|
|
195
204
|
const cache = useAugurCache();
|
|
196
|
-
const queryOpts =
|
|
205
|
+
const queryOpts = _chunkI3JHJMQ6cjs.getInvMastDocOptions.call(void 0,
|
|
197
206
|
api,
|
|
198
207
|
invMastUid,
|
|
199
208
|
itemId,
|
|
@@ -215,7 +224,7 @@ function useItemCategory(itemCategoryUid, options = {}) {
|
|
|
215
224
|
const api = useAugurApiOptional();
|
|
216
225
|
const callbacks = useAugurCallbacks();
|
|
217
226
|
const cache = useAugurCache();
|
|
218
|
-
const queryOpts =
|
|
227
|
+
const queryOpts = _chunkI3JHJMQ6cjs.getItemCategoryOptions.call(void 0,
|
|
219
228
|
api,
|
|
220
229
|
itemCategoryUid,
|
|
221
230
|
options.apiOptions,
|
|
@@ -235,7 +244,7 @@ function useInvMast(invMastUid, itemId, options = {}) {
|
|
|
235
244
|
const api = useAugurApiOptional();
|
|
236
245
|
const callbacks = useAugurCallbacks();
|
|
237
246
|
const cache = useAugurCache();
|
|
238
|
-
const queryOpts =
|
|
247
|
+
const queryOpts = _chunkI3JHJMQ6cjs.getInvMastOptions.call(void 0, api, invMastUid, itemId, cache);
|
|
239
248
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
240
249
|
...queryOpts,
|
|
241
250
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _5 => _5.getInvMast]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMast(invMastUid, itemId)))) } : {},
|
|
@@ -250,7 +259,7 @@ function useInvMastStock(invMastUid, options = {}) {
|
|
|
250
259
|
const api = useAugurApiOptional();
|
|
251
260
|
const callbacks = useAugurCallbacks();
|
|
252
261
|
const cache = useAugurCache();
|
|
253
|
-
const queryOpts =
|
|
262
|
+
const queryOpts = _chunkI3JHJMQ6cjs.getInvMastStockOptions.call(void 0, api, invMastUid, cache);
|
|
254
263
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
255
264
|
...queryOpts,
|
|
256
265
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _6 => _6.getInvMastStock]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMastStock(invMastUid)))) } : {},
|
|
@@ -281,8 +290,8 @@ function useProductCategory(itemCategoryUid, options = {}) {
|
|
|
281
290
|
const api = useAugurApiOptional();
|
|
282
291
|
const callbacks = useAugurCallbacks();
|
|
283
292
|
const cache = useAugurCache();
|
|
284
|
-
const baseOptions = itemCategoryUid ?
|
|
285
|
-
queryKey:
|
|
293
|
+
const baseOptions = itemCategoryUid ? _chunkI3JHJMQ6cjs.getProductCategoryOptions.call(void 0, api, itemCategoryUid, cache) : {
|
|
294
|
+
queryKey: _chunkI3JHJMQ6cjs.getProductCategoryKey.call(void 0, null),
|
|
286
295
|
/* v8 ignore next */
|
|
287
296
|
queryFn: () => Promise.reject()
|
|
288
297
|
};
|
|
@@ -310,8 +319,8 @@ function useItemDetails(itemId, options = {}) {
|
|
|
310
319
|
const callbacks = useAugurCallbacks();
|
|
311
320
|
const cache = useAugurCache();
|
|
312
321
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
313
|
-
...itemId ?
|
|
314
|
-
queryKey:
|
|
322
|
+
...itemId ? _chunkI3JHJMQ6cjs.getItemDetailsOptions.call(void 0, api, itemId, cache) : {
|
|
323
|
+
queryKey: _chunkI3JHJMQ6cjs.getItemDetailsKey.call(void 0, ""),
|
|
315
324
|
/* v8 ignore next */
|
|
316
325
|
queryFn: () => Promise.reject()
|
|
317
326
|
},
|
|
@@ -338,8 +347,8 @@ function useItemAttributes(itemCategoryUid, options = {}) {
|
|
|
338
347
|
const callbacks = useAugurCallbacks();
|
|
339
348
|
const cache = useAugurCache();
|
|
340
349
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
341
|
-
...itemCategoryUid ?
|
|
342
|
-
queryKey:
|
|
350
|
+
...itemCategoryUid ? _chunkI3JHJMQ6cjs.getItemAttributesOptions.call(void 0, api, itemCategoryUid, cache) : {
|
|
351
|
+
queryKey: _chunkI3JHJMQ6cjs.getItemAttributesKey.call(void 0, null),
|
|
343
352
|
/* v8 ignore next */
|
|
344
353
|
queryFn: () => Promise.reject()
|
|
345
354
|
},
|
|
@@ -363,7 +372,7 @@ function useProductSearch(pageData, options = {}) {
|
|
|
363
372
|
const api = useAugurApiOptional();
|
|
364
373
|
const callbacks = useAugurCallbacks();
|
|
365
374
|
const cache = useAugurCache();
|
|
366
|
-
const defaultOptions =
|
|
375
|
+
const defaultOptions = _chunkI3JHJMQ6cjs.getProductSearchOptions.call(void 0, api, pageData, cache);
|
|
367
376
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
368
377
|
...defaultOptions,
|
|
369
378
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _16 => _16.getProductSearch]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getProductSearch(pageData)))) } : {},
|
|
@@ -389,7 +398,7 @@ function useSearchSuggestions(query, options = {}) {
|
|
|
389
398
|
const limit = _nullishCoalesce(options.limit, () => ( 10));
|
|
390
399
|
const offset = _nullishCoalesce(options.offset, () => ( 0));
|
|
391
400
|
const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && query.trim().length > 0;
|
|
392
|
-
const defaultOptions =
|
|
401
|
+
const defaultOptions = _chunkI3JHJMQ6cjs.getSearchSuggestionsOptions.call(void 0, api, query, limit, offset, cache);
|
|
393
402
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
394
403
|
...defaultOptions,
|
|
395
404
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _19 => _19.getSearchSuggestions]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getSearchSuggestions(query, limit, offset)))) } : {},
|
|
@@ -700,12 +709,12 @@ function useCartPricing(options = {}) {
|
|
|
700
709
|
const priceQueries = _reactquery.useQueries.call(void 0, {
|
|
701
710
|
queries: cartLines.map((line) => {
|
|
702
711
|
const base = priceFn ? {
|
|
703
|
-
queryKey:
|
|
712
|
+
queryKey: _chunkI3JHJMQ6cjs.getItemPriceKey.call(void 0, line.itemId, customerId, line.quantity),
|
|
704
713
|
queryFn: () => priceFn(line.itemId, customerId, line.quantity),
|
|
705
714
|
refetchOnReconnect: true,
|
|
706
715
|
refetchOnWindowFocus: false,
|
|
707
716
|
meta: { persist: true }
|
|
708
|
-
} :
|
|
717
|
+
} : _chunkI3JHJMQ6cjs.getItemPriceOptions.call(void 0, api, line.itemId, customerId, line.quantity, cache);
|
|
709
718
|
return {
|
|
710
719
|
...base,
|
|
711
720
|
enabled: !!customerId && !!line.itemId
|
|
@@ -805,7 +814,7 @@ function useCategoryItemsInfinite(itemCategoryUid, itemsFilters, options = {}) {
|
|
|
805
814
|
const callbacks = useAugurCallbacks();
|
|
806
815
|
const cache = useAugurCache();
|
|
807
816
|
const { enabled = true } = options;
|
|
808
|
-
const defaultOptions =
|
|
817
|
+
const defaultOptions = _chunkI3JHJMQ6cjs.getCategoryItemsInfiniteOptions.call(void 0,
|
|
809
818
|
api,
|
|
810
819
|
itemCategoryUid,
|
|
811
820
|
itemsFilters,
|
|
@@ -832,7 +841,7 @@ function useItemSearchInfinite(itemsFilters, itemCategoryUid, options = {}) {
|
|
|
832
841
|
const callbacks = useAugurCallbacks();
|
|
833
842
|
const cache = useAugurCache();
|
|
834
843
|
const { enabled = true } = options;
|
|
835
|
-
const defaultOptions =
|
|
844
|
+
const defaultOptions = _chunkI3JHJMQ6cjs.getItemSearchInfiniteOptions.call(void 0,
|
|
836
845
|
api,
|
|
837
846
|
itemsFilters,
|
|
838
847
|
itemCategoryUid,
|
|
@@ -859,8 +868,8 @@ function useJoomlaContent(articleId, options = {}) {
|
|
|
859
868
|
const callbacks = useAugurCallbacks();
|
|
860
869
|
const cache = useAugurCache();
|
|
861
870
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
862
|
-
...articleId ?
|
|
863
|
-
queryKey:
|
|
871
|
+
...articleId ? _chunkI3JHJMQ6cjs.getJoomlaContentOptions.call(void 0, api, articleId, cache) : {
|
|
872
|
+
queryKey: _chunkI3JHJMQ6cjs.getJoomlaContentKey.call(void 0, ""),
|
|
864
873
|
/* v8 ignore next */
|
|
865
874
|
queryFn: () => Promise.reject()
|
|
866
875
|
},
|
|
@@ -881,8 +890,8 @@ function useJoomlaContentList(categoryId, options = {}) {
|
|
|
881
890
|
const callbacks = useAugurCallbacks();
|
|
882
891
|
const cache = useAugurCache();
|
|
883
892
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
884
|
-
...categoryId ?
|
|
885
|
-
queryKey:
|
|
893
|
+
...categoryId ? _chunkI3JHJMQ6cjs.getJoomlaContentListOptions.call(void 0, api, categoryId, options.filters, cache) : {
|
|
894
|
+
queryKey: _chunkI3JHJMQ6cjs.getJoomlaContentListKey.call(void 0, ""),
|
|
886
895
|
/* v8 ignore next */
|
|
887
896
|
queryFn: () => Promise.reject()
|
|
888
897
|
},
|
|
@@ -905,7 +914,7 @@ function useJoomlaMenu(options = {}) {
|
|
|
905
914
|
const callbacks = useAugurCallbacks();
|
|
906
915
|
const cache = useAugurCache();
|
|
907
916
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
908
|
-
...
|
|
917
|
+
..._chunkI3JHJMQ6cjs.getJoomlaMenuOptions.call(void 0, api, options.filters, cache),
|
|
909
918
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _55 => _55.getJoomlaMenu]))) ? {
|
|
910
919
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenu(options.filters))))
|
|
911
920
|
} : {},
|
|
@@ -925,8 +934,8 @@ function useJoomlaMenuDoc(menuId, options = {}) {
|
|
|
925
934
|
const callbacks = useAugurCallbacks();
|
|
926
935
|
const cache = useAugurCache();
|
|
927
936
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
928
|
-
...menuId ?
|
|
929
|
-
queryKey:
|
|
937
|
+
...menuId ? _chunkI3JHJMQ6cjs.getJoomlaMenuDocOptions.call(void 0, api, menuId, cache) : {
|
|
938
|
+
queryKey: _chunkI3JHJMQ6cjs.getJoomlaMenuDocKey.call(void 0, ""),
|
|
930
939
|
/* v8 ignore next */
|
|
931
940
|
queryFn: () => Promise.reject()
|
|
932
941
|
},
|
|
@@ -940,16 +949,121 @@ function useJoomlaMenuDoc(menuId, options = {}) {
|
|
|
940
949
|
};
|
|
941
950
|
}
|
|
942
951
|
|
|
952
|
+
// src/hooks/use-customer-orders.ts
|
|
953
|
+
|
|
954
|
+
function useCustomerOrders(customerId, params, options = {}) {
|
|
955
|
+
const callbacks = useAugurCallbacks();
|
|
956
|
+
const auth = useAugurAuth();
|
|
957
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _57 => _57.customerId])));
|
|
958
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
959
|
+
queryKey: _chunkI3JHJMQ6cjs.getCustomerOrdersKey.call(void 0, effectiveCustomerId, params),
|
|
960
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerOrders(effectiveCustomerId, params)))),
|
|
961
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _58 => _58.getCustomerOrders]))))
|
|
962
|
+
});
|
|
963
|
+
return {
|
|
964
|
+
orders: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _59 => _59.data]), () => ( [])),
|
|
965
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _60 => _60.total]), () => ( 0)),
|
|
966
|
+
isLoading,
|
|
967
|
+
error
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
function useOrderDetail(customerId, orderId, options = {}) {
|
|
971
|
+
const callbacks = useAugurCallbacks();
|
|
972
|
+
const auth = useAugurAuth();
|
|
973
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _61 => _61.customerId])));
|
|
974
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
975
|
+
queryKey: _chunkI3JHJMQ6cjs.getCustomerOrderDetailKey.call(void 0, effectiveCustomerId, orderId),
|
|
976
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerOrderDetail(effectiveCustomerId, orderId)))),
|
|
977
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!orderId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _62 => _62.getCustomerOrderDetail]))))
|
|
978
|
+
});
|
|
979
|
+
return {
|
|
980
|
+
order: _nullishCoalesce(data, () => ( null)),
|
|
981
|
+
isLoading,
|
|
982
|
+
error
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
// src/hooks/use-customer-invoices.ts
|
|
987
|
+
|
|
988
|
+
function useCustomerInvoices(customerId, params, options = {}) {
|
|
989
|
+
const callbacks = useAugurCallbacks();
|
|
990
|
+
const auth = useAugurAuth();
|
|
991
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _63 => _63.customerId])));
|
|
992
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
993
|
+
queryKey: _chunkI3JHJMQ6cjs.getCustomerInvoicesKey.call(void 0, effectiveCustomerId, params),
|
|
994
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerInvoices(effectiveCustomerId, params)))),
|
|
995
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _64 => _64.getCustomerInvoices]))))
|
|
996
|
+
});
|
|
997
|
+
return {
|
|
998
|
+
invoices: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _65 => _65.data]), () => ( [])),
|
|
999
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _66 => _66.total]), () => ( 0)),
|
|
1000
|
+
isLoading,
|
|
1001
|
+
error
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
function useInvoiceDetail(customerId, invoiceNo, options = {}) {
|
|
1005
|
+
const callbacks = useAugurCallbacks();
|
|
1006
|
+
const auth = useAugurAuth();
|
|
1007
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _67 => _67.customerId])));
|
|
1008
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1009
|
+
queryKey: _chunkI3JHJMQ6cjs.getCustomerInvoiceDetailKey.call(void 0, effectiveCustomerId, invoiceNo),
|
|
1010
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerInvoiceDetail(
|
|
1011
|
+
effectiveCustomerId,
|
|
1012
|
+
invoiceNo
|
|
1013
|
+
)))),
|
|
1014
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!invoiceNo && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _68 => _68.getCustomerInvoiceDetail]))))
|
|
1015
|
+
});
|
|
1016
|
+
return {
|
|
1017
|
+
invoice: _nullishCoalesce(data, () => ( null)),
|
|
1018
|
+
isLoading,
|
|
1019
|
+
error
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
// src/hooks/use-customer-quotes.ts
|
|
1024
|
+
|
|
1025
|
+
function useCustomerQuotes(customerId, params, options = {}) {
|
|
1026
|
+
const callbacks = useAugurCallbacks();
|
|
1027
|
+
const auth = useAugurAuth();
|
|
1028
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _69 => _69.customerId])));
|
|
1029
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1030
|
+
queryKey: _chunkI3JHJMQ6cjs.getCustomerQuotesKey.call(void 0, effectiveCustomerId, params),
|
|
1031
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerQuotes(effectiveCustomerId, params)))),
|
|
1032
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _70 => _70.getCustomerQuotes]))))
|
|
1033
|
+
});
|
|
1034
|
+
return {
|
|
1035
|
+
quotes: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _71 => _71.data]), () => ( [])),
|
|
1036
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _72 => _72.total]), () => ( 0)),
|
|
1037
|
+
isLoading,
|
|
1038
|
+
error
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
function useQuoteDetail(customerId, quoteNo, options = {}) {
|
|
1042
|
+
const callbacks = useAugurCallbacks();
|
|
1043
|
+
const auth = useAugurAuth();
|
|
1044
|
+
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _73 => _73.customerId])));
|
|
1045
|
+
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1046
|
+
queryKey: _chunkI3JHJMQ6cjs.getCustomerQuoteDetailKey.call(void 0, effectiveCustomerId, quoteNo),
|
|
1047
|
+
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerQuoteDetail(effectiveCustomerId, quoteNo)))),
|
|
1048
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!quoteNo && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _74 => _74.getCustomerQuoteDetail]))))
|
|
1049
|
+
});
|
|
1050
|
+
return {
|
|
1051
|
+
quote: _nullishCoalesce(data, () => ( null)),
|
|
1052
|
+
isLoading,
|
|
1053
|
+
error
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
|
|
943
1057
|
// src/create-site-hooks.ts
|
|
944
1058
|
|
|
945
1059
|
function createSiteHooks(config = {}) {
|
|
946
|
-
const { callbacks, defaultCustomerId, cache } = config;
|
|
1060
|
+
const { callbacks, defaultCustomerId, cache, imageConfig } = config;
|
|
947
1061
|
function Provider({ api, auth, children }) {
|
|
948
1062
|
const mergedAuth = {
|
|
949
|
-
status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess',
|
|
950
|
-
customerId: _nullishCoalesce(_optionalChain([auth, 'optionalAccess',
|
|
951
|
-
userId: _optionalChain([auth, 'optionalAccess',
|
|
952
|
-
cartHdrUid: _optionalChain([auth, 'optionalAccess',
|
|
1063
|
+
status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _75 => _75.status]), () => ( "unauthenticated")),
|
|
1064
|
+
customerId: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _76 => _76.customerId]), () => ( defaultCustomerId)),
|
|
1065
|
+
userId: _optionalChain([auth, 'optionalAccess', _77 => _77.userId]),
|
|
1066
|
+
cartHdrUid: _optionalChain([auth, 'optionalAccess', _78 => _78.cartHdrUid])
|
|
953
1067
|
};
|
|
954
1068
|
return _react.createElement.call(void 0, AugurHooksProvider, {
|
|
955
1069
|
api,
|
|
@@ -989,9 +1103,25 @@ function createSiteHooks(config = {}) {
|
|
|
989
1103
|
useJoomlaContentList,
|
|
990
1104
|
useJoomlaMenu,
|
|
991
1105
|
useJoomlaMenuDoc,
|
|
1106
|
+
// Hooks -- customer
|
|
1107
|
+
useCustomerOrders,
|
|
1108
|
+
useOrderDetail,
|
|
1109
|
+
useCustomerInvoices,
|
|
1110
|
+
useInvoiceDetail,
|
|
1111
|
+
useCustomerQuotes,
|
|
1112
|
+
useQuoteDetail,
|
|
992
1113
|
// Hooks -- utilities
|
|
993
1114
|
useDebounce,
|
|
994
|
-
useFormatPrice
|
|
1115
|
+
useFormatPrice,
|
|
1116
|
+
// Hooks -- images
|
|
1117
|
+
useImageWithFallback: (imagePath, options) => {
|
|
1118
|
+
if (!imageConfig) {
|
|
1119
|
+
throw new Error(
|
|
1120
|
+
"useImageWithFallback requires imageConfig in createSiteHooks config"
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
return _chunkAXCNTEABcjs.useImageWithFallback.call(void 0, imageConfig, imagePath, options);
|
|
1124
|
+
}
|
|
995
1125
|
};
|
|
996
1126
|
}
|
|
997
1127
|
|
|
@@ -1011,7 +1141,7 @@ function deserialize(data) {
|
|
|
1011
1141
|
|
|
1012
1142
|
// src/persistence/apply-limits.ts
|
|
1013
1143
|
function applyLimits(data, limits) {
|
|
1014
|
-
const queries = _optionalChain([data, 'access',
|
|
1144
|
+
const queries = _optionalChain([data, 'access', _79 => _79.clientState, 'optionalAccess', _80 => _80.queries]);
|
|
1015
1145
|
if (!queries || Object.keys(limits).length === 0) return data;
|
|
1016
1146
|
const entries = queries;
|
|
1017
1147
|
const unlimited = [];
|
|
@@ -1112,7 +1242,7 @@ function useStorageMonitor(config) {
|
|
|
1112
1242
|
const raw = storage.getItem(key);
|
|
1113
1243
|
if (!raw) return;
|
|
1114
1244
|
const parsed = JSON.parse(raw);
|
|
1115
|
-
if (!_optionalChain([parsed, 'access',
|
|
1245
|
+
if (!_optionalChain([parsed, 'access', _81 => _81.clientState, 'optionalAccess', _82 => _82.queries])) return;
|
|
1116
1246
|
parsed.clientState.queries = parsed.clientState.queries.filter(
|
|
1117
1247
|
(q) => {
|
|
1118
1248
|
if (!Array.isArray(q.queryKey)) return true;
|
|
@@ -1139,7 +1269,7 @@ function useAugurPersistence(config) {
|
|
|
1139
1269
|
setIsMounted(true);
|
|
1140
1270
|
}, []);
|
|
1141
1271
|
useStorageMonitor(config);
|
|
1142
|
-
const isDev = typeof process !== "undefined" && _optionalChain([process, 'access',
|
|
1272
|
+
const isDev = typeof process !== "undefined" && _optionalChain([process, 'access', _83 => _83.env, 'optionalAccess', _84 => _84.NODE_ENV]) === "development";
|
|
1143
1273
|
const { persistableKeys } = config;
|
|
1144
1274
|
const dehydrateOptions = _react.useMemo.call(void 0, () => ({
|
|
1145
1275
|
shouldDehydrateQuery: (query) => {
|
|
@@ -1228,5 +1358,17 @@ function useAugurPersistence(config) {
|
|
|
1228
1358
|
|
|
1229
1359
|
|
|
1230
1360
|
|
|
1231
|
-
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
|
|
1373
|
+
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;
|
|
1232
1374
|
//# sourceMappingURL=index.cjs.map
|