@simpleapps-com/augur-hooks 1.0.8 → 1.0.10
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-CPPFLOLS.js → chunk-DDN6MAPI.js} +33 -1
- package/dist/chunk-DDN6MAPI.js.map +1 -0
- package/dist/{chunk-C7JC34SM.cjs → chunk-DYM6U3QO.cjs} +98 -66
- package/dist/chunk-DYM6U3QO.cjs.map +1 -0
- package/dist/{customer-quotes-Bdeo_I1q.d.cts → customer-quotes-DIpZNjT1.d.cts} +12 -2
- package/dist/{customer-quotes-Bdeo_I1q.d.ts → customer-quotes-DIpZNjT1.d.ts} +12 -2
- package/dist/index.cjs +175 -115
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +85 -15
- package/dist/index.d.ts +85 -15
- package/dist/index.js +111 -51
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +6 -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 +5 -1
- package/dist/server.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-C7JC34SM.cjs.map +0 -1
- package/dist/chunk-CPPFLOLS.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -41,7 +41,9 @@
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
var _chunkDYM6U3QOcjs = require('./chunk-DYM6U3QO.cjs');
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
var _chunkAXCNTEABcjs = require('./chunk-AXCNTEAB.cjs');
|
|
@@ -192,18 +194,36 @@ function useDebounce(value, delay = 500) {
|
|
|
192
194
|
}
|
|
193
195
|
|
|
194
196
|
// src/hooks/use-format-price.ts
|
|
195
|
-
function
|
|
197
|
+
function normaliseOptions(optionsOrLocale, legacyCurrency) {
|
|
198
|
+
if (typeof optionsOrLocale === "string") {
|
|
199
|
+
return { locale: optionsOrLocale, currency: legacyCurrency };
|
|
200
|
+
}
|
|
201
|
+
return _nullishCoalesce(optionsOrLocale, () => ( {}));
|
|
202
|
+
}
|
|
203
|
+
function resolveFormatting(opts, siteFormatting) {
|
|
204
|
+
return {
|
|
205
|
+
locale: _nullishCoalesce(_nullishCoalesce(opts.locale, () => ( _optionalChain([siteFormatting, 'optionalAccess', _ => _.locale]))), () => ( "en-US")),
|
|
206
|
+
currency: _nullishCoalesce(_nullishCoalesce(opts.currency, () => ( _optionalChain([siteFormatting, 'optionalAccess', _2 => _2.currency]))), () => ( "USD")),
|
|
207
|
+
precision: _nullishCoalesce(_nullishCoalesce(opts.precision, () => ( _optionalChain([siteFormatting, 'optionalAccess', _3 => _3.precision]))), () => ( 2)),
|
|
208
|
+
zeroLabel: _nullishCoalesce(opts.zeroLabel, () => ( _optionalChain([siteFormatting, 'optionalAccess', _4 => _4.zeroLabel])))
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function useFormatPrice(optionsOrLocale, legacyCurrency) {
|
|
196
212
|
const site = useAugurSite();
|
|
197
|
-
const
|
|
198
|
-
const
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
213
|
+
const opts = normaliseOptions(optionsOrLocale, legacyCurrency);
|
|
214
|
+
const { locale, currency, precision: basePrecision, zeroLabel } = resolveFormatting(opts, _optionalChain([site, 'optionalAccess', _5 => _5.formatting]));
|
|
215
|
+
const formatPrice = (price, callOptions) => {
|
|
216
|
+
const effectiveValue = price * (_nullishCoalesce(_optionalChain([callOptions, 'optionalAccess', _6 => _6.quantity]), () => ( 1)));
|
|
217
|
+
if (effectiveValue === 0 && zeroLabel !== void 0) {
|
|
218
|
+
return zeroLabel;
|
|
219
|
+
}
|
|
220
|
+
const precision = _nullishCoalesce(_optionalChain([callOptions, 'optionalAccess', _7 => _7.precision]), () => ( basePrecision));
|
|
221
|
+
return new Intl.NumberFormat(locale, {
|
|
202
222
|
style: "currency",
|
|
203
|
-
currency
|
|
223
|
+
currency,
|
|
204
224
|
minimumFractionDigits: precision,
|
|
205
225
|
maximumFractionDigits: precision
|
|
206
|
-
}).format(
|
|
226
|
+
}).format(effectiveValue);
|
|
207
227
|
};
|
|
208
228
|
return { formatPrice };
|
|
209
229
|
}
|
|
@@ -218,9 +238,9 @@ function useItemPrice(itemId, customerId, quantity = 1, options = {}) {
|
|
|
218
238
|
const auth = useAugurAuth();
|
|
219
239
|
const cache = useAugurCache();
|
|
220
240
|
const site = useAugurSite();
|
|
221
|
-
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
222
|
-
const defaultOptions =
|
|
223
|
-
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess',
|
|
241
|
+
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _8 => _8.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _9 => _9.defaults, 'optionalAccess', _10 => _10.customerId])));
|
|
242
|
+
const defaultOptions = _chunkDYM6U3QOcjs.getItemPriceOptions.call(void 0, api, itemId, effectiveCustomerId, quantity, cache);
|
|
243
|
+
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _11 => _11.getItemPrice]) ? () => callbacks.getItemPrice(itemId, effectiveCustomerId, quantity) : void 0)));
|
|
224
244
|
const query = _reactquery.useQuery.call(void 0, {
|
|
225
245
|
...defaultOptions,
|
|
226
246
|
...resolvedQueryFn ? { queryFn: resolvedQueryFn } : {},
|
|
@@ -240,7 +260,7 @@ function useInvMastDoc(invMastUid, itemId, options = {}) {
|
|
|
240
260
|
const api = useAugurApiOptional();
|
|
241
261
|
const callbacks = useAugurCallbacks();
|
|
242
262
|
const cache = useAugurCache();
|
|
243
|
-
const queryOpts =
|
|
263
|
+
const queryOpts = _chunkDYM6U3QOcjs.getInvMastDocOptions.call(void 0,
|
|
244
264
|
api,
|
|
245
265
|
invMastUid,
|
|
246
266
|
itemId,
|
|
@@ -249,7 +269,7 @@ function useInvMastDoc(invMastUid, itemId, options = {}) {
|
|
|
249
269
|
);
|
|
250
270
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
251
271
|
...queryOpts,
|
|
252
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
272
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _12 => _12.getInvMastDoc]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMastDoc(invMastUid, itemId, _nullishCoalesce(options.includePricing, () => ( "N")))))) } : {},
|
|
253
273
|
enabled: _nullishCoalesce(options.enabled, () => ( true)),
|
|
254
274
|
initialData: options.initialData
|
|
255
275
|
});
|
|
@@ -262,7 +282,7 @@ function useItemCategory(itemCategoryUid, options = {}) {
|
|
|
262
282
|
const api = useAugurApiOptional();
|
|
263
283
|
const callbacks = useAugurCallbacks();
|
|
264
284
|
const cache = useAugurCache();
|
|
265
|
-
const queryOpts =
|
|
285
|
+
const queryOpts = _chunkDYM6U3QOcjs.getItemCategoryOptions.call(void 0,
|
|
266
286
|
api,
|
|
267
287
|
itemCategoryUid,
|
|
268
288
|
options.apiOptions,
|
|
@@ -270,7 +290,7 @@ function useItemCategory(itemCategoryUid, options = {}) {
|
|
|
270
290
|
);
|
|
271
291
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
272
292
|
...queryOpts,
|
|
273
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
293
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _13 => _13.getItemCategory]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getItemCategory(itemCategoryUid, options.apiOptions)))) } : {},
|
|
274
294
|
enabled: _nullishCoalesce(options.enabled, () => ( true))
|
|
275
295
|
});
|
|
276
296
|
return { category: data, isLoading, error };
|
|
@@ -282,10 +302,10 @@ function useInvMast(invMastUid, itemId, options = {}) {
|
|
|
282
302
|
const api = useAugurApiOptional();
|
|
283
303
|
const callbacks = useAugurCallbacks();
|
|
284
304
|
const cache = useAugurCache();
|
|
285
|
-
const queryOpts =
|
|
305
|
+
const queryOpts = _chunkDYM6U3QOcjs.getInvMastOptions.call(void 0, api, invMastUid, itemId, cache);
|
|
286
306
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
287
307
|
...queryOpts,
|
|
288
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
308
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _14 => _14.getInvMast]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMast(invMastUid, itemId)))) } : {},
|
|
289
309
|
enabled: _nullishCoalesce(options.enabled, () => ( true))
|
|
290
310
|
});
|
|
291
311
|
return { item: data, isLoading, error };
|
|
@@ -297,10 +317,10 @@ function useInvMastStock(invMastUid, options = {}) {
|
|
|
297
317
|
const api = useAugurApiOptional();
|
|
298
318
|
const callbacks = useAugurCallbacks();
|
|
299
319
|
const cache = useAugurCache();
|
|
300
|
-
const queryOpts =
|
|
320
|
+
const queryOpts = _chunkDYM6U3QOcjs.getInvMastStockOptions.call(void 0, api, invMastUid, cache);
|
|
301
321
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
302
322
|
...queryOpts,
|
|
303
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
323
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _15 => _15.getInvMastStock]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMastStock(invMastUid)))) } : {},
|
|
304
324
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!invMastUid,
|
|
305
325
|
retry: 3,
|
|
306
326
|
/* v8 ignore start */
|
|
@@ -314,6 +334,43 @@ function useInvMastStock(invMastUid, options = {}) {
|
|
|
314
334
|
};
|
|
315
335
|
}
|
|
316
336
|
|
|
337
|
+
// src/hooks/use-stock.ts
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
function useStock(invMastUid, options = {}) {
|
|
342
|
+
const api = useAugurApiOptional();
|
|
343
|
+
const callbacks = useAugurCallbacks();
|
|
344
|
+
const cache = useAugurCache();
|
|
345
|
+
const queryOpts = _chunkDYM6U3QOcjs.getStockOptions.call(void 0, api, invMastUid, cache);
|
|
346
|
+
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _16 => _16.getStock]) ? () => callbacks.getStock(invMastUid) : void 0)));
|
|
347
|
+
const query = _reactquery.useQuery.call(void 0, {
|
|
348
|
+
...queryOpts,
|
|
349
|
+
...resolvedQueryFn ? { queryFn: resolvedQueryFn } : {},
|
|
350
|
+
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!invMastUid,
|
|
351
|
+
retry: 3,
|
|
352
|
+
/* v8 ignore start */
|
|
353
|
+
retryDelay: (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 1e4)
|
|
354
|
+
/* v8 ignore stop */
|
|
355
|
+
});
|
|
356
|
+
const resolved = _react.useMemo.call(void 0,
|
|
357
|
+
() => _augurutils.resolveStock.call(void 0, {
|
|
358
|
+
stock: _nullishCoalesce(query.data, () => ( null)),
|
|
359
|
+
companyKey: options.companyKey,
|
|
360
|
+
round: options.round,
|
|
361
|
+
lowStockThreshold: options.lowStockThreshold,
|
|
362
|
+
showQuantity: options.showQuantity
|
|
363
|
+
}),
|
|
364
|
+
[query.data, options.companyKey, options.round, options.lowStockThreshold, options.showQuantity]
|
|
365
|
+
);
|
|
366
|
+
return {
|
|
367
|
+
stock: _nullishCoalesce(query.data, () => ( null)),
|
|
368
|
+
resolved,
|
|
369
|
+
loading: query.isLoading,
|
|
370
|
+
error: query.error
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
317
374
|
// src/hooks/use-batch-inv-mast-doc.ts
|
|
318
375
|
|
|
319
376
|
function useBatchInvMastDoc(params, options = {}) {
|
|
@@ -322,26 +379,26 @@ function useBatchInvMastDoc(params, options = {}) {
|
|
|
322
379
|
const cache = useAugurCache();
|
|
323
380
|
const queryClient = _reactquery.useQueryClient.call(void 0, );
|
|
324
381
|
const includePricing = _nullishCoalesce(options.includePricing, () => ( "N"));
|
|
325
|
-
const batchOpts =
|
|
382
|
+
const batchOpts = _chunkDYM6U3QOcjs.getBatchInvMastDocOptions.call(void 0, api, params, includePricing, cache);
|
|
326
383
|
const resolveFetchItems = (uncached) => {
|
|
327
384
|
if (options.queryFn) {
|
|
328
385
|
return options.queryFn(uncached, includePricing);
|
|
329
386
|
}
|
|
330
|
-
if (_optionalChain([callbacks, 'optionalAccess',
|
|
387
|
+
if (_optionalChain([callbacks, 'optionalAccess', _17 => _17.batchGetInvMastDocs])) {
|
|
331
388
|
return callbacks.batchGetInvMastDocs(uncached, includePricing);
|
|
332
389
|
}
|
|
333
|
-
const fallbackOpts =
|
|
390
|
+
const fallbackOpts = _chunkDYM6U3QOcjs.getBatchInvMastDocOptions.call(void 0, api, uncached, includePricing, cache);
|
|
334
391
|
return fallbackOpts.queryFn();
|
|
335
392
|
};
|
|
336
393
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
337
394
|
queryKey: batchOpts.queryKey,
|
|
338
|
-
queryFn: () =>
|
|
395
|
+
queryFn: () => _chunkDYM6U3QOcjs.executeBatchQuery.call(void 0, {
|
|
339
396
|
params,
|
|
340
397
|
queryClient,
|
|
341
|
-
getItemKey: (p) =>
|
|
398
|
+
getItemKey: (p) => _chunkDYM6U3QOcjs.getInvMastDocKey.call(void 0, p.invMastUid, p.itemId, includePricing),
|
|
342
399
|
getResultKey: (p) => p.itemId.toUpperCase(),
|
|
343
400
|
fetchItems: resolveFetchItems,
|
|
344
|
-
getSeedKey: (_key, doc) =>
|
|
401
|
+
getSeedKey: (_key, doc) => _chunkDYM6U3QOcjs.getInvMastDocKey.call(void 0, doc.invMastUid, doc.itemId, includePricing)
|
|
345
402
|
}),
|
|
346
403
|
staleTime: batchOpts.staleTime,
|
|
347
404
|
gcTime: batchOpts.gcTime,
|
|
@@ -354,22 +411,22 @@ function useBatchInvMastDoc(params, options = {}) {
|
|
|
354
411
|
|
|
355
412
|
function resolveData(data) {
|
|
356
413
|
return {
|
|
357
|
-
childrenTotal: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
358
|
-
itemCategoryDesc: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
359
|
-
productCategories: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
360
|
-
productCategoryImage: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
414
|
+
childrenTotal: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _18 => _18.childrenTotal]), () => ( 0)),
|
|
415
|
+
itemCategoryDesc: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _19 => _19.itemCategoryDesc]), () => ( "")),
|
|
416
|
+
productCategories: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _20 => _20.children]), () => ( null)),
|
|
417
|
+
productCategoryImage: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _21 => _21.categoryImage]), () => ( null))
|
|
361
418
|
};
|
|
362
419
|
}
|
|
363
420
|
function useProductCategory(itemCategoryUid, options = {}) {
|
|
364
421
|
const api = useAugurApiOptional();
|
|
365
422
|
const callbacks = useAugurCallbacks();
|
|
366
423
|
const cache = useAugurCache();
|
|
367
|
-
const baseOptions = itemCategoryUid ?
|
|
368
|
-
queryKey:
|
|
424
|
+
const baseOptions = itemCategoryUid ? _chunkDYM6U3QOcjs.getProductCategoryOptions.call(void 0, api, itemCategoryUid, cache) : {
|
|
425
|
+
queryKey: _chunkDYM6U3QOcjs.getProductCategoryKey.call(void 0, null),
|
|
369
426
|
/* v8 ignore next */
|
|
370
427
|
queryFn: () => Promise.reject()
|
|
371
428
|
};
|
|
372
|
-
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess',
|
|
429
|
+
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _22 => _22.getProductCategory]) ? () => callbacks.getProductCategory(itemCategoryUid) : void 0)));
|
|
373
430
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
374
431
|
...baseOptions,
|
|
375
432
|
...resolvedQueryFn ? { queryFn: resolvedQueryFn } : {},
|
|
@@ -393,19 +450,19 @@ function useItemDetails(itemId, options = {}) {
|
|
|
393
450
|
const callbacks = useAugurCallbacks();
|
|
394
451
|
const cache = useAugurCache();
|
|
395
452
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
396
|
-
...itemId ?
|
|
397
|
-
queryKey:
|
|
453
|
+
...itemId ? _chunkDYM6U3QOcjs.getItemDetailsOptions.call(void 0, api, itemId, cache) : {
|
|
454
|
+
queryKey: _chunkDYM6U3QOcjs.getItemDetailsKey.call(void 0, ""),
|
|
398
455
|
/* v8 ignore next */
|
|
399
456
|
queryFn: () => Promise.reject()
|
|
400
457
|
},
|
|
401
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
458
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _23 => _23.getItemDetails]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getItemDetails(itemId)))) } : {},
|
|
402
459
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!itemId,
|
|
403
460
|
retry: 3,
|
|
404
461
|
/* v8 ignore start */
|
|
405
462
|
retryDelay: (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 1e4)
|
|
406
463
|
/* v8 ignore stop */
|
|
407
464
|
});
|
|
408
|
-
const categoryList = _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
465
|
+
const categoryList = _nullishCoalesce(_optionalChain([data, 'optionalAccess', _24 => _24.categoryList]), () => ( []));
|
|
409
466
|
return {
|
|
410
467
|
itemCategoryUid: categoryList.length > 0 ? categoryList[categoryList.length - 1] : null,
|
|
411
468
|
itemDetails: _nullishCoalesce(data, () => ( null)),
|
|
@@ -421,12 +478,12 @@ function useItemAttributes(itemCategoryUid, options = {}) {
|
|
|
421
478
|
const callbacks = useAugurCallbacks();
|
|
422
479
|
const cache = useAugurCache();
|
|
423
480
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
424
|
-
...itemCategoryUid ?
|
|
425
|
-
queryKey:
|
|
481
|
+
...itemCategoryUid ? _chunkDYM6U3QOcjs.getItemAttributesOptions.call(void 0, api, itemCategoryUid, cache) : {
|
|
482
|
+
queryKey: _chunkDYM6U3QOcjs.getItemAttributesKey.call(void 0, null),
|
|
426
483
|
/* v8 ignore next */
|
|
427
484
|
queryFn: () => Promise.reject()
|
|
428
485
|
},
|
|
429
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
486
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _25 => _25.getItemAttributes]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getItemAttributes(itemCategoryUid)))) } : {},
|
|
430
487
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!itemCategoryUid,
|
|
431
488
|
retry: 3,
|
|
432
489
|
/* v8 ignore start */
|
|
@@ -434,7 +491,7 @@ function useItemAttributes(itemCategoryUid, options = {}) {
|
|
|
434
491
|
/* v8 ignore stop */
|
|
435
492
|
});
|
|
436
493
|
return {
|
|
437
|
-
attributes: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
494
|
+
attributes: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _26 => _26.attributes]), () => ( null)),
|
|
438
495
|
loading: isLoading,
|
|
439
496
|
error
|
|
440
497
|
};
|
|
@@ -446,18 +503,18 @@ function useProductSearch(pageData, options = {}) {
|
|
|
446
503
|
const api = useAugurApiOptional();
|
|
447
504
|
const callbacks = useAugurCallbacks();
|
|
448
505
|
const cache = useAugurCache();
|
|
449
|
-
const defaultOptions =
|
|
506
|
+
const defaultOptions = _chunkDYM6U3QOcjs.getProductSearchOptions.call(void 0, api, pageData, cache);
|
|
450
507
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
451
508
|
...defaultOptions,
|
|
452
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
509
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _27 => _27.getProductSearch]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getProductSearch(pageData)))) } : {},
|
|
453
510
|
retry: 3,
|
|
454
511
|
/* v8 ignore start */
|
|
455
512
|
retryDelay: (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 1e4)
|
|
456
513
|
/* v8 ignore stop */
|
|
457
514
|
});
|
|
458
515
|
return {
|
|
459
|
-
productItems: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
460
|
-
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
516
|
+
productItems: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _28 => _28.items]), () => ( null)),
|
|
517
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _29 => _29.totalResults]), () => ( 0)),
|
|
461
518
|
loading: isLoading,
|
|
462
519
|
error
|
|
463
520
|
};
|
|
@@ -472,15 +529,15 @@ function useSearchSuggestions(query, options = {}) {
|
|
|
472
529
|
const limit = _nullishCoalesce(options.limit, () => ( 10));
|
|
473
530
|
const offset = _nullishCoalesce(options.offset, () => ( 0));
|
|
474
531
|
const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && query.trim().length > 0;
|
|
475
|
-
const defaultOptions =
|
|
532
|
+
const defaultOptions = _chunkDYM6U3QOcjs.getSearchSuggestionsOptions.call(void 0, api, query, limit, offset, cache);
|
|
476
533
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
477
534
|
...defaultOptions,
|
|
478
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
535
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _30 => _30.getSearchSuggestions]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getSearchSuggestions(query, limit, offset)))) } : {},
|
|
479
536
|
enabled
|
|
480
537
|
});
|
|
481
538
|
return {
|
|
482
|
-
suggestions: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
483
|
-
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
539
|
+
suggestions: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _31 => _31.data]), () => ( [])),
|
|
540
|
+
total: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _32 => _32.total]), () => ( 0)),
|
|
484
541
|
isLoading,
|
|
485
542
|
error
|
|
486
543
|
};
|
|
@@ -547,17 +604,17 @@ function useCartActions(callbacks) {
|
|
|
547
604
|
]);
|
|
548
605
|
if (!success) throw new Error("Failed to add item to cart");
|
|
549
606
|
invalidateCartCache();
|
|
550
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
607
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _33 => _33.info])) {
|
|
551
608
|
notify.info(`${item.quantity} x ${itemId || "Item"} added to cart`);
|
|
552
609
|
}
|
|
553
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
610
|
+
_optionalChain([onSuccess, 'optionalCall', _34 => _34()]);
|
|
554
611
|
return true;
|
|
555
612
|
} catch (error) {
|
|
556
613
|
setCartLines(previousCartLines);
|
|
557
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
614
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _35 => _35.error])) {
|
|
558
615
|
notify.error("Failed to add item to cart. Please try again.");
|
|
559
616
|
}
|
|
560
|
-
_optionalChain([onError, 'optionalCall',
|
|
617
|
+
_optionalChain([onError, 'optionalCall', _36 => _36(error)]);
|
|
561
618
|
return false;
|
|
562
619
|
}
|
|
563
620
|
},
|
|
@@ -576,14 +633,14 @@ function useCartActions(callbacks) {
|
|
|
576
633
|
const success = await callbacks.updateCartLines(uid, updatedLines);
|
|
577
634
|
if (!success) throw new Error("Failed to update quantity");
|
|
578
635
|
invalidateCartCache();
|
|
579
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
636
|
+
_optionalChain([onSuccess, 'optionalCall', _37 => _37()]);
|
|
580
637
|
return true;
|
|
581
638
|
} catch (error) {
|
|
582
639
|
setCartLines(previousCartLines);
|
|
583
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
640
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _38 => _38.error])) {
|
|
584
641
|
notify.error("Failed to update quantity. Please try again.");
|
|
585
642
|
}
|
|
586
|
-
_optionalChain([onError, 'optionalCall',
|
|
643
|
+
_optionalChain([onError, 'optionalCall', _39 => _39(error)]);
|
|
587
644
|
return false;
|
|
588
645
|
}
|
|
589
646
|
},
|
|
@@ -602,17 +659,17 @@ function useCartActions(callbacks) {
|
|
|
602
659
|
const success = await callbacks.updateCartLines(uid, zeroedLines);
|
|
603
660
|
if (!success) throw new Error("Failed to remove item");
|
|
604
661
|
invalidateCartCache();
|
|
605
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
662
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _40 => _40.info])) {
|
|
606
663
|
notify.info(`${itemId || "Item"} removed from cart`);
|
|
607
664
|
}
|
|
608
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
665
|
+
_optionalChain([onSuccess, 'optionalCall', _41 => _41()]);
|
|
609
666
|
return true;
|
|
610
667
|
} catch (error) {
|
|
611
668
|
setCartLines(previousCartLines);
|
|
612
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
669
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _42 => _42.error])) {
|
|
613
670
|
notify.error("Failed to remove item. Please try again.");
|
|
614
671
|
}
|
|
615
|
-
_optionalChain([onError, 'optionalCall',
|
|
672
|
+
_optionalChain([onError, 'optionalCall', _43 => _43(error)]);
|
|
616
673
|
return false;
|
|
617
674
|
}
|
|
618
675
|
},
|
|
@@ -628,17 +685,17 @@ function useCartActions(callbacks) {
|
|
|
628
685
|
const success = await callbacks.deleteItemsFromCart(uid);
|
|
629
686
|
if (!success) throw new Error("Failed to clear cart");
|
|
630
687
|
invalidateCartCache();
|
|
631
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
688
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _44 => _44.info])) {
|
|
632
689
|
notify.info("Cart cleared");
|
|
633
690
|
}
|
|
634
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
691
|
+
_optionalChain([onSuccess, 'optionalCall', _45 => _45()]);
|
|
635
692
|
return true;
|
|
636
693
|
} catch (error) {
|
|
637
694
|
setCartLines(previousCartLines);
|
|
638
|
-
if (showToast && _optionalChain([notify, 'optionalAccess',
|
|
695
|
+
if (showToast && _optionalChain([notify, 'optionalAccess', _46 => _46.error])) {
|
|
639
696
|
notify.error("Failed to clear cart. Please try again.");
|
|
640
697
|
}
|
|
641
|
-
_optionalChain([onError, 'optionalCall',
|
|
698
|
+
_optionalChain([onError, 'optionalCall', _47 => _47(error)]);
|
|
642
699
|
return false;
|
|
643
700
|
}
|
|
644
701
|
},
|
|
@@ -652,7 +709,7 @@ function useCartActions(callbacks) {
|
|
|
652
709
|
);
|
|
653
710
|
const getItemQuantity = _react.useCallback.call(void 0,
|
|
654
711
|
(invMastUid) => {
|
|
655
|
-
return _nullishCoalesce(_optionalChain([cartLines, 'access',
|
|
712
|
+
return _nullishCoalesce(_optionalChain([cartLines, 'access', _48 => _48.find, 'call', _49 => _49((line) => line.invMastUid === invMastUid), 'optionalAccess', _50 => _50.quantity]), () => ( 0));
|
|
656
713
|
},
|
|
657
714
|
[cartLines]
|
|
658
715
|
);
|
|
@@ -682,8 +739,8 @@ function useCartInitialization(session, callbacks) {
|
|
|
682
739
|
const clearCart = useClearCart();
|
|
683
740
|
const queryClient = _reactquery.useQueryClient.call(void 0, );
|
|
684
741
|
const effectiveStatus = session.status;
|
|
685
|
-
const effectiveUserId = _nullishCoalesce(session.userId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
686
|
-
const effectiveCartHdrUid = _nullishCoalesce(session.cartHdrUid, () => ( _optionalChain([auth, 'optionalAccess',
|
|
742
|
+
const effectiveUserId = _nullishCoalesce(session.userId, () => ( _optionalChain([auth, 'optionalAccess', _51 => _51.userId])));
|
|
743
|
+
const effectiveCartHdrUid = _nullishCoalesce(session.cartHdrUid, () => ( _optionalChain([auth, 'optionalAccess', _52 => _52.cartHdrUid])));
|
|
687
744
|
const effectiveSession = _react.useMemo.call(void 0,
|
|
688
745
|
() => ({ status: effectiveStatus, userId: effectiveUserId, cartHdrUid: effectiveCartHdrUid }),
|
|
689
746
|
[effectiveStatus, effectiveUserId, effectiveCartHdrUid]
|
|
@@ -780,17 +837,17 @@ function useCartPricing(options = {}) {
|
|
|
780
837
|
const cache = useAugurCache();
|
|
781
838
|
const site = useAugurSite();
|
|
782
839
|
const cartLines = useCartLines();
|
|
783
|
-
const customerId = _nullishCoalesce(_nullishCoalesce(options.customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
784
|
-
const priceFn = _nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
840
|
+
const customerId = _nullishCoalesce(_nullishCoalesce(options.customerId, () => ( _optionalChain([auth, 'optionalAccess', _53 => _53.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _54 => _54.defaults, 'optionalAccess', _55 => _55.customerId])));
|
|
841
|
+
const priceFn = _nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _56 => _56.getItemPrice])));
|
|
785
842
|
const priceQueries = _reactquery.useQueries.call(void 0, {
|
|
786
843
|
queries: cartLines.map((line) => {
|
|
787
844
|
const base = priceFn ? {
|
|
788
|
-
queryKey:
|
|
845
|
+
queryKey: _chunkDYM6U3QOcjs.getItemPriceKey.call(void 0, line.itemId, customerId, line.quantity),
|
|
789
846
|
queryFn: () => priceFn(line.itemId, customerId, line.quantity),
|
|
790
847
|
refetchOnReconnect: true,
|
|
791
848
|
refetchOnWindowFocus: false,
|
|
792
849
|
meta: { persist: true }
|
|
793
|
-
} :
|
|
850
|
+
} : _chunkDYM6U3QOcjs.getItemPriceOptions.call(void 0, api, line.itemId, customerId, line.quantity, cache);
|
|
794
851
|
return {
|
|
795
852
|
...base,
|
|
796
853
|
enabled: !!customerId && !!line.itemId
|
|
@@ -801,7 +858,7 @@ function useCartPricing(options = {}) {
|
|
|
801
858
|
const map = {};
|
|
802
859
|
cartLines.forEach((line, index) => {
|
|
803
860
|
const queryResult = priceQueries[index];
|
|
804
|
-
if (_optionalChain([queryResult, 'optionalAccess',
|
|
861
|
+
if (_optionalChain([queryResult, 'optionalAccess', _57 => _57.data])) {
|
|
805
862
|
const derived = _augurutils.derivePrice.call(void 0, { priceData: queryResult.data, quantity: line.quantity });
|
|
806
863
|
map[line.itemId.toUpperCase()] = {
|
|
807
864
|
unitPrice: derived.unitPrice,
|
|
@@ -813,7 +870,7 @@ function useCartPricing(options = {}) {
|
|
|
813
870
|
}, [cartLines, priceQueries]);
|
|
814
871
|
const getUnitPrice = _react.useMemo.call(void 0, () => {
|
|
815
872
|
return (itemId) => {
|
|
816
|
-
return _nullishCoalesce(_optionalChain([prices, 'access',
|
|
873
|
+
return _nullishCoalesce(_optionalChain([prices, 'access', _58 => _58[_optionalChain([itemId, 'optionalAccess', _59 => _59.toUpperCase, 'call', _60 => _60()])], 'optionalAccess', _61 => _61.unitPrice]), () => ( 0));
|
|
817
874
|
};
|
|
818
875
|
}, [prices]);
|
|
819
876
|
const getItemTotal = _react.useMemo.call(void 0, () => {
|
|
@@ -823,7 +880,7 @@ function useCartPricing(options = {}) {
|
|
|
823
880
|
}, [getUnitPrice]);
|
|
824
881
|
const subtotal = _react.useMemo.call(void 0, () => {
|
|
825
882
|
return cartLines.reduce((sum, line) => {
|
|
826
|
-
const unitPrice = _nullishCoalesce(_optionalChain([prices, 'access',
|
|
883
|
+
const unitPrice = _nullishCoalesce(_optionalChain([prices, 'access', _62 => _62[line.itemId.toUpperCase()], 'optionalAccess', _63 => _63.unitPrice]), () => ( 0));
|
|
827
884
|
return sum + unitPrice * line.quantity;
|
|
828
885
|
}, 0);
|
|
829
886
|
}, [cartLines, prices]);
|
|
@@ -891,13 +948,13 @@ function useCategoryItemsInfinite(itemCategoryUid, itemsFilters, options = {}) {
|
|
|
891
948
|
const callbacks = useAugurCallbacks();
|
|
892
949
|
const cache = useAugurCache();
|
|
893
950
|
const { enabled = true } = options;
|
|
894
|
-
const defaultOptions =
|
|
951
|
+
const defaultOptions = _chunkDYM6U3QOcjs.getCategoryItemsInfiniteOptions.call(void 0,
|
|
895
952
|
api,
|
|
896
953
|
itemCategoryUid,
|
|
897
954
|
itemsFilters,
|
|
898
955
|
cache
|
|
899
956
|
);
|
|
900
|
-
const cb = _optionalChain([callbacks, 'optionalAccess',
|
|
957
|
+
const cb = _optionalChain([callbacks, 'optionalAccess', _64 => _64.getCategoryItemsInfinite]);
|
|
901
958
|
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (cb ? ({ pageParam }) => cb({
|
|
902
959
|
itemCategoryUid,
|
|
903
960
|
itemsFilters,
|
|
@@ -918,13 +975,13 @@ function useItemSearchInfinite(itemsFilters, itemCategoryUid, options = {}) {
|
|
|
918
975
|
const callbacks = useAugurCallbacks();
|
|
919
976
|
const cache = useAugurCache();
|
|
920
977
|
const { enabled = true } = options;
|
|
921
|
-
const defaultOptions =
|
|
978
|
+
const defaultOptions = _chunkDYM6U3QOcjs.getItemSearchInfiniteOptions.call(void 0,
|
|
922
979
|
api,
|
|
923
980
|
itemsFilters,
|
|
924
981
|
itemCategoryUid,
|
|
925
982
|
cache
|
|
926
983
|
);
|
|
927
|
-
const cb = _optionalChain([callbacks, 'optionalAccess',
|
|
984
|
+
const cb = _optionalChain([callbacks, 'optionalAccess', _65 => _65.getItemSearchInfinite]);
|
|
928
985
|
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (cb ? ({ pageParam }) => cb({
|
|
929
986
|
itemsFilters,
|
|
930
987
|
itemCategoryUid,
|
|
@@ -945,12 +1002,12 @@ function useJoomlaContent(articleId, options = {}) {
|
|
|
945
1002
|
const callbacks = useAugurCallbacks();
|
|
946
1003
|
const cache = useAugurCache();
|
|
947
1004
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
948
|
-
...articleId ?
|
|
949
|
-
queryKey:
|
|
1005
|
+
...articleId ? _chunkDYM6U3QOcjs.getJoomlaContentOptions.call(void 0, api, articleId, cache) : {
|
|
1006
|
+
queryKey: _chunkDYM6U3QOcjs.getJoomlaContentKey.call(void 0, ""),
|
|
950
1007
|
/* v8 ignore next */
|
|
951
1008
|
queryFn: () => Promise.reject()
|
|
952
1009
|
},
|
|
953
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
1010
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _66 => _66.getJoomlaContent]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaContent(articleId)))) } : {},
|
|
954
1011
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!articleId
|
|
955
1012
|
});
|
|
956
1013
|
return {
|
|
@@ -967,12 +1024,12 @@ function useJoomlaContentList(categoryId, options = {}) {
|
|
|
967
1024
|
const callbacks = useAugurCallbacks();
|
|
968
1025
|
const cache = useAugurCache();
|
|
969
1026
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
970
|
-
...categoryId ?
|
|
971
|
-
queryKey:
|
|
1027
|
+
...categoryId ? _chunkDYM6U3QOcjs.getJoomlaContentListOptions.call(void 0, api, categoryId, options.filters, cache) : {
|
|
1028
|
+
queryKey: _chunkDYM6U3QOcjs.getJoomlaContentListKey.call(void 0, ""),
|
|
972
1029
|
/* v8 ignore next */
|
|
973
1030
|
queryFn: () => Promise.reject()
|
|
974
1031
|
},
|
|
975
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
1032
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _67 => _67.getJoomlaContentList]))) ? {
|
|
976
1033
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaContentList(categoryId, options.filters))))
|
|
977
1034
|
} : {},
|
|
978
1035
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!categoryId
|
|
@@ -991,8 +1048,8 @@ function useJoomlaMenu(options = {}) {
|
|
|
991
1048
|
const callbacks = useAugurCallbacks();
|
|
992
1049
|
const cache = useAugurCache();
|
|
993
1050
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
994
|
-
...
|
|
995
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
1051
|
+
..._chunkDYM6U3QOcjs.getJoomlaMenuOptions.call(void 0, api, options.filters, cache),
|
|
1052
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _68 => _68.getJoomlaMenu]))) ? {
|
|
996
1053
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenu(options.filters))))
|
|
997
1054
|
} : {},
|
|
998
1055
|
enabled: _nullishCoalesce(options.enabled, () => ( true))
|
|
@@ -1011,12 +1068,12 @@ function useJoomlaMenuDoc(menuId, options = {}) {
|
|
|
1011
1068
|
const callbacks = useAugurCallbacks();
|
|
1012
1069
|
const cache = useAugurCache();
|
|
1013
1070
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1014
|
-
...menuId ?
|
|
1015
|
-
queryKey:
|
|
1071
|
+
...menuId ? _chunkDYM6U3QOcjs.getJoomlaMenuDocOptions.call(void 0, api, menuId, cache) : {
|
|
1072
|
+
queryKey: _chunkDYM6U3QOcjs.getJoomlaMenuDocKey.call(void 0, ""),
|
|
1016
1073
|
/* v8 ignore next */
|
|
1017
1074
|
queryFn: () => Promise.reject()
|
|
1018
1075
|
},
|
|
1019
|
-
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess',
|
|
1076
|
+
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _69 => _69.getJoomlaMenuDoc]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenuDoc(menuId)))) } : {},
|
|
1020
1077
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!menuId
|
|
1021
1078
|
});
|
|
1022
1079
|
return {
|
|
@@ -1033,11 +1090,11 @@ function useCustomerOrders(customerId, params, options = {}) {
|
|
|
1033
1090
|
const callbacks = useAugurCallbacks();
|
|
1034
1091
|
const auth = useAugurAuth();
|
|
1035
1092
|
const site = useAugurSite();
|
|
1036
|
-
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
1037
|
-
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess',
|
|
1093
|
+
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _70 => _70.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _71 => _71.defaults, 'optionalAccess', _72 => _72.customerId])));
|
|
1094
|
+
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _73 => _73.getCustomerOrders]) ? () => callbacks.getCustomerOrders(effectiveCustomerId, params) : void 0)));
|
|
1038
1095
|
const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!resolvedQueryFn;
|
|
1039
1096
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1040
|
-
queryKey:
|
|
1097
|
+
queryKey: _chunkDYM6U3QOcjs.getCustomerOrdersKey.call(void 0, effectiveCustomerId, params),
|
|
1041
1098
|
queryFn: resolvedQueryFn,
|
|
1042
1099
|
enabled
|
|
1043
1100
|
});
|
|
@@ -1053,11 +1110,11 @@ function useOrderDetail(customerId, orderId, options = {}) {
|
|
|
1053
1110
|
const callbacks = useAugurCallbacks();
|
|
1054
1111
|
const auth = useAugurAuth();
|
|
1055
1112
|
const site = useAugurSite();
|
|
1056
|
-
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
1057
|
-
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess',
|
|
1113
|
+
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _74 => _74.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _75 => _75.defaults, 'optionalAccess', _76 => _76.customerId])));
|
|
1114
|
+
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _77 => _77.getCustomerOrderDetail]) ? () => callbacks.getCustomerOrderDetail(effectiveCustomerId, orderId) : void 0)));
|
|
1058
1115
|
const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!orderId && !!resolvedQueryFn;
|
|
1059
1116
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1060
|
-
queryKey:
|
|
1117
|
+
queryKey: _chunkDYM6U3QOcjs.getCustomerOrderDetailKey.call(void 0, effectiveCustomerId, orderId),
|
|
1061
1118
|
queryFn: resolvedQueryFn,
|
|
1062
1119
|
enabled
|
|
1063
1120
|
});
|
|
@@ -1075,11 +1132,11 @@ function useCustomerInvoices(customerId, params, options = {}) {
|
|
|
1075
1132
|
const callbacks = useAugurCallbacks();
|
|
1076
1133
|
const auth = useAugurAuth();
|
|
1077
1134
|
const site = useAugurSite();
|
|
1078
|
-
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
1079
|
-
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess',
|
|
1135
|
+
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _78 => _78.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _79 => _79.defaults, 'optionalAccess', _80 => _80.customerId])));
|
|
1136
|
+
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _81 => _81.getCustomerInvoices]) ? () => callbacks.getCustomerInvoices(effectiveCustomerId, params) : void 0)));
|
|
1080
1137
|
const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!resolvedQueryFn;
|
|
1081
1138
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1082
|
-
queryKey:
|
|
1139
|
+
queryKey: _chunkDYM6U3QOcjs.getCustomerInvoicesKey.call(void 0, effectiveCustomerId, params),
|
|
1083
1140
|
queryFn: resolvedQueryFn,
|
|
1084
1141
|
enabled
|
|
1085
1142
|
});
|
|
@@ -1095,11 +1152,11 @@ function useInvoiceDetail(customerId, invoiceNo, options = {}) {
|
|
|
1095
1152
|
const callbacks = useAugurCallbacks();
|
|
1096
1153
|
const auth = useAugurAuth();
|
|
1097
1154
|
const site = useAugurSite();
|
|
1098
|
-
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
1099
|
-
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess',
|
|
1155
|
+
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _82 => _82.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _83 => _83.defaults, 'optionalAccess', _84 => _84.customerId])));
|
|
1156
|
+
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _85 => _85.getCustomerInvoiceDetail]) ? () => callbacks.getCustomerInvoiceDetail(effectiveCustomerId, invoiceNo) : void 0)));
|
|
1100
1157
|
const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!invoiceNo && !!resolvedQueryFn;
|
|
1101
1158
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1102
|
-
queryKey:
|
|
1159
|
+
queryKey: _chunkDYM6U3QOcjs.getCustomerInvoiceDetailKey.call(void 0, effectiveCustomerId, invoiceNo),
|
|
1103
1160
|
queryFn: resolvedQueryFn,
|
|
1104
1161
|
enabled
|
|
1105
1162
|
});
|
|
@@ -1117,11 +1174,11 @@ function useCustomerQuotes(customerId, params, options = {}) {
|
|
|
1117
1174
|
const callbacks = useAugurCallbacks();
|
|
1118
1175
|
const auth = useAugurAuth();
|
|
1119
1176
|
const site = useAugurSite();
|
|
1120
|
-
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
1121
|
-
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess',
|
|
1177
|
+
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _86 => _86.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _87 => _87.defaults, 'optionalAccess', _88 => _88.customerId])));
|
|
1178
|
+
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _89 => _89.getCustomerQuotes]) ? () => callbacks.getCustomerQuotes(effectiveCustomerId, params) : void 0)));
|
|
1122
1179
|
const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!resolvedQueryFn;
|
|
1123
1180
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1124
|
-
queryKey:
|
|
1181
|
+
queryKey: _chunkDYM6U3QOcjs.getCustomerQuotesKey.call(void 0, effectiveCustomerId, params),
|
|
1125
1182
|
queryFn: resolvedQueryFn,
|
|
1126
1183
|
enabled
|
|
1127
1184
|
});
|
|
@@ -1137,11 +1194,11 @@ function useQuoteDetail(customerId, quoteNo, options = {}) {
|
|
|
1137
1194
|
const callbacks = useAugurCallbacks();
|
|
1138
1195
|
const auth = useAugurAuth();
|
|
1139
1196
|
const site = useAugurSite();
|
|
1140
|
-
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess',
|
|
1141
|
-
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess',
|
|
1197
|
+
const effectiveCustomerId = _nullishCoalesce(_nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _90 => _90.customerId]))), () => ( _optionalChain([site, 'optionalAccess', _91 => _91.defaults, 'optionalAccess', _92 => _92.customerId])));
|
|
1198
|
+
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _93 => _93.getCustomerQuoteDetail]) ? () => callbacks.getCustomerQuoteDetail(effectiveCustomerId, quoteNo) : void 0)));
|
|
1142
1199
|
const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!quoteNo && !!resolvedQueryFn;
|
|
1143
1200
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1144
|
-
queryKey:
|
|
1201
|
+
queryKey: _chunkDYM6U3QOcjs.getCustomerQuoteDetailKey.call(void 0, effectiveCustomerId, quoteNo),
|
|
1145
1202
|
queryFn: resolvedQueryFn,
|
|
1146
1203
|
enabled
|
|
1147
1204
|
});
|
|
@@ -1158,10 +1215,10 @@ function createSiteHooks(config = {}) {
|
|
|
1158
1215
|
const { callbacks, defaultCustomerId, cache, imageConfig } = config;
|
|
1159
1216
|
function Provider({ api, auth, children }) {
|
|
1160
1217
|
const mergedAuth = {
|
|
1161
|
-
status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess',
|
|
1162
|
-
customerId: _optionalChain([auth, 'optionalAccess',
|
|
1163
|
-
userId: _optionalChain([auth, 'optionalAccess',
|
|
1164
|
-
cartHdrUid: _optionalChain([auth, 'optionalAccess',
|
|
1218
|
+
status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _94 => _94.status]), () => ( "unauthenticated")),
|
|
1219
|
+
customerId: _optionalChain([auth, 'optionalAccess', _95 => _95.customerId]),
|
|
1220
|
+
userId: _optionalChain([auth, 'optionalAccess', _96 => _96.userId]),
|
|
1221
|
+
cartHdrUid: _optionalChain([auth, 'optionalAccess', _97 => _97.cartHdrUid])
|
|
1165
1222
|
};
|
|
1166
1223
|
return _react.createElement.call(void 0, AugurHooksProvider, {
|
|
1167
1224
|
api,
|
|
@@ -1241,7 +1298,7 @@ function deserialize(data) {
|
|
|
1241
1298
|
|
|
1242
1299
|
// src/persistence/apply-limits.ts
|
|
1243
1300
|
function applyLimits(data, limits) {
|
|
1244
|
-
const queries = _optionalChain([data, 'access',
|
|
1301
|
+
const queries = _optionalChain([data, 'access', _98 => _98.clientState, 'optionalAccess', _99 => _99.queries]);
|
|
1245
1302
|
if (!queries || Object.keys(limits).length === 0) return data;
|
|
1246
1303
|
const entries = queries;
|
|
1247
1304
|
const unlimited = [];
|
|
@@ -1342,7 +1399,7 @@ function useStorageMonitor(config) {
|
|
|
1342
1399
|
const raw = storage.getItem(key);
|
|
1343
1400
|
if (!raw) return;
|
|
1344
1401
|
const parsed = JSON.parse(raw);
|
|
1345
|
-
if (!_optionalChain([parsed, 'access',
|
|
1402
|
+
if (!_optionalChain([parsed, 'access', _100 => _100.clientState, 'optionalAccess', _101 => _101.queries])) return;
|
|
1346
1403
|
parsed.clientState.queries = parsed.clientState.queries.filter(
|
|
1347
1404
|
(q) => {
|
|
1348
1405
|
if (!Array.isArray(q.queryKey)) return true;
|
|
@@ -1369,7 +1426,7 @@ function useAugurPersistence(config) {
|
|
|
1369
1426
|
setIsMounted(true);
|
|
1370
1427
|
}, []);
|
|
1371
1428
|
useStorageMonitor(config);
|
|
1372
|
-
const isDev = typeof process !== "undefined" && _optionalChain([process, 'access',
|
|
1429
|
+
const isDev = typeof process !== "undefined" && _optionalChain([process, 'access', _102 => _102.env, 'optionalAccess', _103 => _103.NODE_ENV]) === "development";
|
|
1373
1430
|
const { persistableKeys } = config;
|
|
1374
1431
|
const dehydrateOptions = _react.useMemo.call(void 0, () => ({
|
|
1375
1432
|
shouldDehydrateQuery: (query) => {
|
|
@@ -1476,5 +1533,8 @@ function useAugurPersistence(config) {
|
|
|
1476
1533
|
|
|
1477
1534
|
|
|
1478
1535
|
|
|
1479
|
-
|
|
1536
|
+
|
|
1537
|
+
|
|
1538
|
+
|
|
1539
|
+
exports.AugurHooksProvider = AugurHooksProvider; exports.createSiteHooks = createSiteHooks; exports.executeBatchQuery = _chunkDYM6U3QOcjs.executeBatchQuery; exports.getBatchInvMastDocKey = _chunkDYM6U3QOcjs.getBatchInvMastDocKey; exports.getBatchInvMastDocOptions = _chunkDYM6U3QOcjs.getBatchInvMastDocOptions; exports.getCartPricingQueryOptions = _chunkDYM6U3QOcjs.getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = _chunkDYM6U3QOcjs.getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = _chunkDYM6U3QOcjs.getCategoryItemsInfiniteOptions; exports.getCustomerInvoiceDetailKey = _chunkDYM6U3QOcjs.getCustomerInvoiceDetailKey; exports.getCustomerInvoicesKey = _chunkDYM6U3QOcjs.getCustomerInvoicesKey; exports.getCustomerOrderDetailKey = _chunkDYM6U3QOcjs.getCustomerOrderDetailKey; exports.getCustomerOrdersKey = _chunkDYM6U3QOcjs.getCustomerOrdersKey; exports.getCustomerQuoteDetailKey = _chunkDYM6U3QOcjs.getCustomerQuoteDetailKey; exports.getCustomerQuotesKey = _chunkDYM6U3QOcjs.getCustomerQuotesKey; exports.getInvMastDocKey = _chunkDYM6U3QOcjs.getInvMastDocKey; exports.getInvMastDocOptions = _chunkDYM6U3QOcjs.getInvMastDocOptions; exports.getInvMastKey = _chunkDYM6U3QOcjs.getInvMastKey; exports.getInvMastOptions = _chunkDYM6U3QOcjs.getInvMastOptions; exports.getInvMastStockKey = _chunkDYM6U3QOcjs.getInvMastStockKey; exports.getInvMastStockOptions = _chunkDYM6U3QOcjs.getInvMastStockOptions; exports.getItemAttributesKey = _chunkDYM6U3QOcjs.getItemAttributesKey; exports.getItemAttributesOptions = _chunkDYM6U3QOcjs.getItemAttributesOptions; exports.getItemCategoryKey = _chunkDYM6U3QOcjs.getItemCategoryKey; exports.getItemCategoryOptions = _chunkDYM6U3QOcjs.getItemCategoryOptions; exports.getItemDetailsKey = _chunkDYM6U3QOcjs.getItemDetailsKey; exports.getItemDetailsOptions = _chunkDYM6U3QOcjs.getItemDetailsOptions; exports.getItemPriceKey = _chunkDYM6U3QOcjs.getItemPriceKey; exports.getItemPriceOptions = _chunkDYM6U3QOcjs.getItemPriceOptions; exports.getItemSearchInfiniteKey = _chunkDYM6U3QOcjs.getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = _chunkDYM6U3QOcjs.getItemSearchInfiniteOptions; exports.getJoomlaContentKey = _chunkDYM6U3QOcjs.getJoomlaContentKey; exports.getJoomlaContentListKey = _chunkDYM6U3QOcjs.getJoomlaContentListKey; exports.getJoomlaContentListOptions = _chunkDYM6U3QOcjs.getJoomlaContentListOptions; exports.getJoomlaContentOptions = _chunkDYM6U3QOcjs.getJoomlaContentOptions; exports.getJoomlaMenuDocKey = _chunkDYM6U3QOcjs.getJoomlaMenuDocKey; exports.getJoomlaMenuDocOptions = _chunkDYM6U3QOcjs.getJoomlaMenuDocOptions; exports.getJoomlaMenuKey = _chunkDYM6U3QOcjs.getJoomlaMenuKey; exports.getJoomlaMenuOptions = _chunkDYM6U3QOcjs.getJoomlaMenuOptions; exports.getProductCategoryKey = _chunkDYM6U3QOcjs.getProductCategoryKey; exports.getProductCategoryOptions = _chunkDYM6U3QOcjs.getProductCategoryOptions; exports.getProductSearchKey = _chunkDYM6U3QOcjs.getProductSearchKey; exports.getProductSearchOptions = _chunkDYM6U3QOcjs.getProductSearchOptions; exports.getSearchSuggestionsKey = _chunkDYM6U3QOcjs.getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = _chunkDYM6U3QOcjs.getSearchSuggestionsOptions; exports.getStockKey = _chunkDYM6U3QOcjs.getStockKey; exports.getStockOptions = _chunkDYM6U3QOcjs.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;
|
|
1480
1540
|
//# sourceMappingURL=index.cjs.map
|