@behio/storefront-sdk 0.24.0 → 0.25.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-YS4RARKL.js → chunk-MUSTZBNR.js} +18 -7
- package/dist/{chunk-OFUECU3W.mjs → chunk-V5WU3XI4.mjs} +11 -0
- package/dist/{client-B2x8fUb3.d.mts → client-76vvJ0_n.d.mts} +52 -2
- package/dist/{client-B2x8fUb3.d.ts → client-76vvJ0_n.d.ts} +52 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/next.d.mts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +2 -2
- package/dist/next.mjs +1 -1
- package/dist/react.d.mts +15 -3
- package/dist/react.d.ts +15 -3
- package/dist/react.js +69 -57
- package/dist/react.mjs +64 -52
- package/package.json +3 -3
package/dist/react.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var _chunkJIAOZ5YWjs = require('./chunk-JIAOZ5YW.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkMUSTZBNRjs = require('./chunk-MUSTZBNR.js');
|
|
8
8
|
|
|
9
9
|
// src/react/provider.tsx
|
|
10
10
|
var _react = require('react');
|
|
@@ -134,7 +134,7 @@ function BehioProvider({
|
|
|
134
134
|
const [activeCurrency, setActiveCurrency] = _react.useState.call(void 0, resolveInitialCurrency);
|
|
135
135
|
const clientRef = _react.useRef.call(void 0, null);
|
|
136
136
|
if (!clientRef.current) {
|
|
137
|
-
clientRef.current = new (0,
|
|
137
|
+
clientRef.current = new (0, _chunkMUSTZBNRjs.BehioStorefront)({
|
|
138
138
|
apiKey,
|
|
139
139
|
baseUrl,
|
|
140
140
|
...shopDomain ? { shopDomain } : {},
|
|
@@ -334,6 +334,17 @@ function useCategory(slug, options) {
|
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
+
// src/react/hooks/use-menu.ts
|
|
338
|
+
|
|
339
|
+
function useMenu(handle, options) {
|
|
340
|
+
const { client } = useBehio();
|
|
341
|
+
return _reactquery.useQuery.call(void 0, {
|
|
342
|
+
queryKey: ["behio", "menu", handle, _optionalChain([options, 'optionalAccess', _27 => _27.locale])],
|
|
343
|
+
queryFn: () => unwrap(client.catalog.getMenu(handle, { locale: _optionalChain([options, 'optionalAccess', _28 => _28.locale]) })),
|
|
344
|
+
enabled: _optionalChain([options, 'optionalAccess', _29 => _29.enabled]) !== false && !!handle
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
|
|
337
348
|
// src/react/hooks/use-labels.ts
|
|
338
349
|
|
|
339
350
|
function useLabels(locale, options) {
|
|
@@ -344,7 +355,7 @@ function useLabels(locale, options) {
|
|
|
344
355
|
const result = await unwrap(client.catalog.getLabels(locale));
|
|
345
356
|
return result.labels;
|
|
346
357
|
},
|
|
347
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
358
|
+
enabled: _optionalChain([options, 'optionalAccess', _30 => _30.enabled]) !== false
|
|
348
359
|
});
|
|
349
360
|
}
|
|
350
361
|
|
|
@@ -353,13 +364,13 @@ function useLabels(locale, options) {
|
|
|
353
364
|
function useFeatured(options) {
|
|
354
365
|
const { client } = useBehio();
|
|
355
366
|
return _reactquery.useQuery.call(void 0, {
|
|
356
|
-
queryKey: ["behio", "featured", _optionalChain([options, 'optionalAccess',
|
|
367
|
+
queryKey: ["behio", "featured", _optionalChain([options, 'optionalAccess', _31 => _31.locale]), _optionalChain([options, 'optionalAccess', _32 => _32.currency])],
|
|
357
368
|
queryFn: () => unwrap(client.catalog.getFeatured({
|
|
358
|
-
locale: _optionalChain([options, 'optionalAccess',
|
|
359
|
-
currency: _optionalChain([options, 'optionalAccess',
|
|
369
|
+
locale: _optionalChain([options, 'optionalAccess', _33 => _33.locale]),
|
|
370
|
+
currency: _optionalChain([options, 'optionalAccess', _34 => _34.currency])
|
|
360
371
|
})),
|
|
361
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
362
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
372
|
+
initialData: _optionalChain([options, 'optionalAccess', _35 => _35.initialData]),
|
|
373
|
+
enabled: _optionalChain([options, 'optionalAccess', _36 => _36.enabled]) !== false
|
|
363
374
|
});
|
|
364
375
|
}
|
|
365
376
|
|
|
@@ -373,7 +384,7 @@ function useFilters(options) {
|
|
|
373
384
|
const result = await unwrap(client.catalog.getFilters());
|
|
374
385
|
return result.filters;
|
|
375
386
|
},
|
|
376
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
387
|
+
enabled: _optionalChain([options, 'optionalAccess', _37 => _37.enabled]) !== false
|
|
377
388
|
});
|
|
378
389
|
}
|
|
379
390
|
|
|
@@ -382,7 +393,7 @@ function useFilters(options) {
|
|
|
382
393
|
|
|
383
394
|
function useSearch(query, options) {
|
|
384
395
|
const { client } = useBehio();
|
|
385
|
-
const debounceMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
396
|
+
const debounceMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _38 => _38.debounceMs]), () => ( 300));
|
|
386
397
|
const [debouncedQuery, setDebouncedQuery] = _react.useState.call(void 0, query);
|
|
387
398
|
_react.useEffect.call(void 0, () => {
|
|
388
399
|
if (debounceMs <= 0) {
|
|
@@ -393,12 +404,12 @@ function useSearch(query, options) {
|
|
|
393
404
|
return () => clearTimeout(timer);
|
|
394
405
|
}, [query, debounceMs]);
|
|
395
406
|
return _reactquery.useQuery.call(void 0, {
|
|
396
|
-
queryKey: ["behio", "search", debouncedQuery, _optionalChain([options, 'optionalAccess',
|
|
407
|
+
queryKey: ["behio", "search", debouncedQuery, _optionalChain([options, 'optionalAccess', _39 => _39.page]), _optionalChain([options, 'optionalAccess', _40 => _40.limit])],
|
|
397
408
|
queryFn: () => unwrap(client.catalog.search(debouncedQuery, {
|
|
398
|
-
page: _optionalChain([options, 'optionalAccess',
|
|
399
|
-
limit: _optionalChain([options, 'optionalAccess',
|
|
409
|
+
page: _optionalChain([options, 'optionalAccess', _41 => _41.page]),
|
|
410
|
+
limit: _optionalChain([options, 'optionalAccess', _42 => _42.limit])
|
|
400
411
|
})),
|
|
401
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
412
|
+
enabled: _optionalChain([options, 'optionalAccess', _43 => _43.enabled]) !== false && debouncedQuery.length > 0
|
|
402
413
|
});
|
|
403
414
|
}
|
|
404
415
|
|
|
@@ -417,7 +428,7 @@ function useCart(options) {
|
|
|
417
428
|
queryKey: [...CART_KEY],
|
|
418
429
|
queryFn: () => unwrap(client.cart.get()),
|
|
419
430
|
// Only fetch if we have a cart session or are logged in
|
|
420
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
431
|
+
enabled: _optionalChain([options, 'optionalAccess', _44 => _44.enabled]) !== false && (!!client.getCartSession() || !!client.getAccessToken())
|
|
421
432
|
});
|
|
422
433
|
const addMutation = _reactquery.useMutation.call(void 0, {
|
|
423
434
|
mutationFn: async ({ productId, quantity }) => {
|
|
@@ -450,7 +461,7 @@ function useCart(options) {
|
|
|
450
461
|
return { previous };
|
|
451
462
|
},
|
|
452
463
|
onError: (_err, _vars, context) => {
|
|
453
|
-
if (_optionalChain([context, 'optionalAccess',
|
|
464
|
+
if (_optionalChain([context, 'optionalAccess', _45 => _45.previous])) {
|
|
454
465
|
queryClient.setQueryData([...CART_KEY], context.previous);
|
|
455
466
|
}
|
|
456
467
|
},
|
|
@@ -476,7 +487,7 @@ function useCart(options) {
|
|
|
476
487
|
return { previous };
|
|
477
488
|
},
|
|
478
489
|
onError: (_err, _vars, context) => {
|
|
479
|
-
if (_optionalChain([context, 'optionalAccess',
|
|
490
|
+
if (_optionalChain([context, 'optionalAccess', _46 => _46.previous])) {
|
|
480
491
|
queryClient.setQueryData([...CART_KEY], context.previous);
|
|
481
492
|
}
|
|
482
493
|
},
|
|
@@ -553,7 +564,7 @@ function useCart(options) {
|
|
|
553
564
|
removeDiscount,
|
|
554
565
|
merge,
|
|
555
566
|
// Computed
|
|
556
|
-
itemCount: _nullishCoalesce(_optionalChain([cart, 'optionalAccess',
|
|
567
|
+
itemCount: _nullishCoalesce(_optionalChain([cart, 'optionalAccess', _47 => _47.itemCount]), () => ( 0)),
|
|
557
568
|
isEmpty: !cart || cart.items.length === 0,
|
|
558
569
|
// Mutation states
|
|
559
570
|
isAdding: addMutation.isPending,
|
|
@@ -572,10 +583,10 @@ function useCartCount(options) {
|
|
|
572
583
|
const { data } = _reactquery.useQuery.call(void 0, {
|
|
573
584
|
queryKey: [...CART_KEY2],
|
|
574
585
|
queryFn: () => unwrap(client.cart.get()),
|
|
575
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
586
|
+
enabled: _optionalChain([options, 'optionalAccess', _48 => _48.enabled]) !== false && !cachedCart && (!!client.getCartSession() || !!client.getAccessToken())
|
|
576
587
|
});
|
|
577
588
|
const cart = _nullishCoalesce(cachedCart, () => ( data));
|
|
578
|
-
return _nullishCoalesce(_optionalChain([cart, 'optionalAccess',
|
|
589
|
+
return _nullishCoalesce(_optionalChain([cart, 'optionalAccess', _49 => _49.itemCount]), () => ( 0));
|
|
579
590
|
}
|
|
580
591
|
|
|
581
592
|
// src/react/hooks/use-auth.ts
|
|
@@ -715,7 +726,7 @@ function useCustomer(options) {
|
|
|
715
726
|
} = _reactquery.useQuery.call(void 0, {
|
|
716
727
|
queryKey: [...CUSTOMER_KEY2],
|
|
717
728
|
queryFn: () => unwrap(client.customer.getProfile()),
|
|
718
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
729
|
+
enabled: _optionalChain([options, 'optionalAccess', _50 => _50.enabled]) !== false && !!client.getAccessToken()
|
|
719
730
|
});
|
|
720
731
|
const updateMutation = _reactquery.useMutation.call(void 0, {
|
|
721
732
|
mutationFn: (data2) => unwrap(client.customer.updateProfile(data2)),
|
|
@@ -753,7 +764,7 @@ function useAddresses(options) {
|
|
|
753
764
|
const result = await unwrap(client.customer.getAddresses());
|
|
754
765
|
return result.items;
|
|
755
766
|
},
|
|
756
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
767
|
+
enabled: _optionalChain([options, 'optionalAccess', _51 => _51.enabled]) !== false && !!client.getAccessToken()
|
|
757
768
|
});
|
|
758
769
|
const createMutation = _reactquery.useMutation.call(void 0, {
|
|
759
770
|
mutationFn: (address) => unwrap(client.customer.createAddress(address)),
|
|
@@ -852,7 +863,7 @@ function useAddressAutocomplete(options) {
|
|
|
852
863
|
return {
|
|
853
864
|
query,
|
|
854
865
|
setQuery,
|
|
855
|
-
suggestions: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
866
|
+
suggestions: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _52 => _52.suggestions]), () => ( [])),
|
|
856
867
|
isLoading: isLoading && debouncedQuery.length >= minChars,
|
|
857
868
|
select,
|
|
858
869
|
selected,
|
|
@@ -877,10 +888,10 @@ function useOrders(options) {
|
|
|
877
888
|
enabled: enabled !== false && !!client.getAccessToken()
|
|
878
889
|
});
|
|
879
890
|
const items = _react.useMemo.call(void 0,
|
|
880
|
-
() => _nullishCoalesce(_optionalChain([infinite, 'access',
|
|
891
|
+
() => _nullishCoalesce(_optionalChain([infinite, 'access', _53 => _53.data, 'optionalAccess', _54 => _54.pages, 'access', _55 => _55.flatMap, 'call', _56 => _56((p) => p.items)]), () => ( [])),
|
|
881
892
|
[infinite.data]
|
|
882
893
|
);
|
|
883
|
-
const lastPage = _optionalChain([infinite, 'access',
|
|
894
|
+
const lastPage = _optionalChain([infinite, 'access', _57 => _57.data, 'optionalAccess', _58 => _58.pages, 'access', _59 => _59[infinite.data.pages.length - 1]]);
|
|
884
895
|
const loadMore = _react.useCallback.call(void 0, () => {
|
|
885
896
|
if (infinite.hasNextPage && !infinite.isFetchingNextPage) {
|
|
886
897
|
return infinite.fetchNextPage();
|
|
@@ -893,10 +904,10 @@ function useOrders(options) {
|
|
|
893
904
|
return {
|
|
894
905
|
items,
|
|
895
906
|
data: infinite.data,
|
|
896
|
-
total: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
897
|
-
totalPages: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
898
|
-
currentPage: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
899
|
-
limit: _nullishCoalesce(_nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
907
|
+
total: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _60 => _60.total]), () => ( 0)),
|
|
908
|
+
totalPages: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _61 => _61.totalPages]), () => ( 0)),
|
|
909
|
+
currentPage: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _62 => _62.page]), () => ( page)),
|
|
910
|
+
limit: _nullishCoalesce(_nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _63 => _63.limit]), () => ( limit)), () => ( 20)),
|
|
900
911
|
page,
|
|
901
912
|
setPage: goToPage,
|
|
902
913
|
loadMore,
|
|
@@ -925,7 +936,7 @@ function useOrder(orderNumber, options) {
|
|
|
925
936
|
} = _reactquery.useQuery.call(void 0, {
|
|
926
937
|
queryKey: ["behio", "order", orderNumber],
|
|
927
938
|
queryFn: () => unwrap(client.orders.get(orderNumber)),
|
|
928
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
939
|
+
enabled: _optionalChain([options, 'optionalAccess', _64 => _64.enabled]) !== false && !!orderNumber && !!client.getAccessToken()
|
|
929
940
|
});
|
|
930
941
|
const cancelMutation = _reactquery.useMutation.call(void 0, {
|
|
931
942
|
mutationFn: () => unwrap(client.orders.cancel(orderNumber)),
|
|
@@ -1050,7 +1061,7 @@ function usePages(locale, options) {
|
|
|
1050
1061
|
const result = await unwrap(client.pages.list(locale));
|
|
1051
1062
|
return result.pages;
|
|
1052
1063
|
},
|
|
1053
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
1064
|
+
enabled: _optionalChain([options, 'optionalAccess', _65 => _65.enabled]) !== false
|
|
1054
1065
|
});
|
|
1055
1066
|
}
|
|
1056
1067
|
function usePage(slug, locale, options) {
|
|
@@ -1058,7 +1069,7 @@ function usePage(slug, locale, options) {
|
|
|
1058
1069
|
return _reactquery.useQuery.call(void 0, {
|
|
1059
1070
|
queryKey: ["behio", "page", slug, locale],
|
|
1060
1071
|
queryFn: () => unwrap(client.pages.get(slug, locale)),
|
|
1061
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
1072
|
+
enabled: _optionalChain([options, 'optionalAccess', _66 => _66.enabled]) !== false && !!slug
|
|
1062
1073
|
});
|
|
1063
1074
|
}
|
|
1064
1075
|
|
|
@@ -1069,7 +1080,7 @@ function useShopInfo(options) {
|
|
|
1069
1080
|
return _reactquery.useQuery.call(void 0, {
|
|
1070
1081
|
queryKey: ["behio", "shop-info"],
|
|
1071
1082
|
queryFn: () => unwrap(client.getShopInfo()),
|
|
1072
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
1083
|
+
enabled: _optionalChain([options, 'optionalAccess', _67 => _67.enabled]) !== false
|
|
1073
1084
|
});
|
|
1074
1085
|
}
|
|
1075
1086
|
|
|
@@ -1080,7 +1091,7 @@ function useShopScripts(options) {
|
|
|
1080
1091
|
return _reactquery.useQuery.call(void 0, {
|
|
1081
1092
|
queryKey: ["behio", "shop-scripts"],
|
|
1082
1093
|
queryFn: () => unwrap(client.getShopScripts()),
|
|
1083
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
1094
|
+
enabled: _optionalChain([options, 'optionalAccess', _68 => _68.enabled]) !== false
|
|
1084
1095
|
});
|
|
1085
1096
|
}
|
|
1086
1097
|
|
|
@@ -1108,8 +1119,8 @@ function dedupe(values) {
|
|
|
1108
1119
|
function useCurrency() {
|
|
1109
1120
|
const { currency, setCurrency, configuredDefaultCurrency, configuredCurrencies } = useBehio();
|
|
1110
1121
|
const { data: shop, isLoading } = useShopInfo();
|
|
1111
|
-
const defaultCurrency = _nullishCoalesce(configuredDefaultCurrency, () => ( _optionalChain([shop, 'optionalAccess',
|
|
1112
|
-
const currencies = configuredCurrencies && configuredCurrencies.length > 0 ? dedupe(configuredCurrencies) : dedupe([defaultCurrency, ..._nullishCoalesce(_optionalChain([shop, 'optionalAccess',
|
|
1122
|
+
const defaultCurrency = _nullishCoalesce(configuredDefaultCurrency, () => ( _optionalChain([shop, 'optionalAccess', _69 => _69.defaultCurrency])));
|
|
1123
|
+
const currencies = configuredCurrencies && configuredCurrencies.length > 0 ? dedupe(configuredCurrencies) : dedupe([defaultCurrency, ..._nullishCoalesce(_optionalChain([shop, 'optionalAccess', _70 => _70.supportedCurrencies]), () => ( []))]);
|
|
1113
1124
|
return {
|
|
1114
1125
|
currency,
|
|
1115
1126
|
effectiveCurrency: _nullishCoalesce(currency, () => ( defaultCurrency)),
|
|
@@ -1132,7 +1143,7 @@ function CurrencySwitcher({
|
|
|
1132
1143
|
const { currencies, effectiveCurrency, setCurrency } = useCurrency();
|
|
1133
1144
|
if (currencies.length === 0) return null;
|
|
1134
1145
|
if (currencies.length <= 1 && !showWhenSingle) return null;
|
|
1135
|
-
const label = (code) => _nullishCoalesce(_optionalChain([labels, 'optionalAccess',
|
|
1146
|
+
const label = (code) => _nullishCoalesce(_optionalChain([labels, 'optionalAccess', _71 => _71[code]]), () => ( code));
|
|
1136
1147
|
if (children) {
|
|
1137
1148
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: children({ currencies, value: effectiveCurrency, setCurrency, label }) });
|
|
1138
1149
|
}
|
|
@@ -1249,9 +1260,9 @@ function StorefrontScripts({ visitorId: visitorIdProp } = {}) {
|
|
|
1249
1260
|
}
|
|
1250
1261
|
}, [visitorIdProp]);
|
|
1251
1262
|
const { data: consent } = useCookieConsent(visitorId || void 0);
|
|
1252
|
-
const analyticsOk = Boolean(_optionalChain([consent, 'optionalAccess',
|
|
1263
|
+
const analyticsOk = Boolean(_optionalChain([consent, 'optionalAccess', _72 => _72.analytics]));
|
|
1253
1264
|
const scripts = _react.useMemo.call(void 0,
|
|
1254
|
-
() => (_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
1265
|
+
() => (_nullishCoalesce(_optionalChain([data, 'optionalAccess', _73 => _73.scripts]), () => ( []))).filter((s) => !s.consentRequired || analyticsOk),
|
|
1255
1266
|
[data, analyticsOk]
|
|
1256
1267
|
);
|
|
1257
1268
|
const signature = _react.useMemo.call(void 0,
|
|
@@ -1316,7 +1327,7 @@ function initTracker(client) {
|
|
|
1316
1327
|
return;
|
|
1317
1328
|
}
|
|
1318
1329
|
const { data } = await client.consent.get(stored);
|
|
1319
|
-
const granted = Boolean(_optionalChain([data, 'optionalAccess',
|
|
1330
|
+
const granted = Boolean(_optionalChain([data, 'optionalAccess', _74 => _74.analytics]));
|
|
1320
1331
|
visitorId = granted ? stored : void 0;
|
|
1321
1332
|
client.setAnalyticsVisitorId(granted ? stored : null);
|
|
1322
1333
|
} catch (e7) {
|
|
@@ -1400,7 +1411,7 @@ function initTracker(client) {
|
|
|
1400
1411
|
};
|
|
1401
1412
|
const onClick = (ev) => {
|
|
1402
1413
|
const target = ev.target;
|
|
1403
|
-
const el = _optionalChain([target, 'optionalAccess',
|
|
1414
|
+
const el = _optionalChain([target, 'optionalAccess', _75 => _75.closest, 'optionalCall', _76 => _76("a,button,[role=button],[data-behio-event]")]);
|
|
1404
1415
|
if (!el) return;
|
|
1405
1416
|
const explicit = _nullishCoalesce(el.getAttribute("data-behio-event"), () => ( void 0));
|
|
1406
1417
|
const text = (_nullishCoalesce(el.textContent, () => ( ""))).trim().replace(/\s+/g, " ").slice(0, 80) || void 0;
|
|
@@ -1441,7 +1452,7 @@ function initTracker(client) {
|
|
|
1441
1452
|
items: payload.items.length,
|
|
1442
1453
|
// First item id = the product (view_item/add_to_cart are
|
|
1443
1454
|
// single-product in practice) - Behavioral Offers count on it.
|
|
1444
|
-
itemId: _optionalChain([payload, 'access',
|
|
1455
|
+
itemId: _optionalChain([payload, 'access', _77 => _77.items, 'access', _78 => _78[0], 'optionalAccess', _79 => _79.item_id])
|
|
1445
1456
|
}
|
|
1446
1457
|
} : {}
|
|
1447
1458
|
});
|
|
@@ -1503,8 +1514,8 @@ function useBundles(options) {
|
|
|
1503
1514
|
return _reactquery.useQuery.call(void 0, {
|
|
1504
1515
|
queryKey: ["behio", "bundles"],
|
|
1505
1516
|
queryFn: () => unwrap(client.catalog.getBundles()),
|
|
1506
|
-
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1507
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1517
|
+
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _80 => _80.enabled]), () => ( true)),
|
|
1518
|
+
initialData: _optionalChain([options, 'optionalAccess', _81 => _81.initialData])
|
|
1508
1519
|
});
|
|
1509
1520
|
}
|
|
1510
1521
|
function useBundle(slug, options) {
|
|
@@ -1512,8 +1523,8 @@ function useBundle(slug, options) {
|
|
|
1512
1523
|
return _reactquery.useQuery.call(void 0, {
|
|
1513
1524
|
queryKey: ["behio", "bundle", slug],
|
|
1514
1525
|
queryFn: () => unwrap(client.catalog.getBundle(slug)),
|
|
1515
|
-
enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1516
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1526
|
+
enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.enabled]), () => ( true))),
|
|
1527
|
+
initialData: _optionalChain([options, 'optionalAccess', _83 => _83.initialData])
|
|
1517
1528
|
});
|
|
1518
1529
|
}
|
|
1519
1530
|
|
|
@@ -1524,8 +1535,8 @@ function useCrossSell(productSlug, options) {
|
|
|
1524
1535
|
return _reactquery.useQuery.call(void 0, {
|
|
1525
1536
|
queryKey: ["behio", "cross-sell", productSlug],
|
|
1526
1537
|
queryFn: () => unwrap(client.catalog.getCrossSell(productSlug)),
|
|
1527
|
-
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1528
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1538
|
+
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _84 => _84.enabled]), () => ( true))),
|
|
1539
|
+
initialData: _optionalChain([options, 'optionalAccess', _85 => _85.initialData])
|
|
1529
1540
|
});
|
|
1530
1541
|
}
|
|
1531
1542
|
|
|
@@ -1536,8 +1547,8 @@ function useProductPromotions(productSlug, options) {
|
|
|
1536
1547
|
return _reactquery.useQuery.call(void 0, {
|
|
1537
1548
|
queryKey: ["behio", "product-promotions", productSlug],
|
|
1538
1549
|
queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
|
|
1539
|
-
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1540
|
-
refetchInterval: _optionalChain([options, 'optionalAccess',
|
|
1550
|
+
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _86 => _86.enabled]), () => ( true))),
|
|
1551
|
+
refetchInterval: _optionalChain([options, 'optionalAccess', _87 => _87.refetchIntervalMs])
|
|
1541
1552
|
});
|
|
1542
1553
|
}
|
|
1543
1554
|
|
|
@@ -1545,11 +1556,11 @@ function useProductPromotions(productSlug, options) {
|
|
|
1545
1556
|
|
|
1546
1557
|
function useGiftCardBalance(code, options) {
|
|
1547
1558
|
const { client } = useBehio();
|
|
1548
|
-
const trimmed = _optionalChain([code, 'optionalAccess',
|
|
1559
|
+
const trimmed = _optionalChain([code, 'optionalAccess', _88 => _88.trim, 'call', _89 => _89()]);
|
|
1549
1560
|
return _reactquery.useQuery.call(void 0, {
|
|
1550
1561
|
queryKey: ["behio", "gift-card-balance", trimmed],
|
|
1551
1562
|
queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
|
|
1552
|
-
enabled: Boolean(trimmed && trimmed.length >= 6) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1563
|
+
enabled: Boolean(trimmed && trimmed.length >= 6) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _90 => _90.enabled]), () => ( true)))
|
|
1553
1564
|
});
|
|
1554
1565
|
}
|
|
1555
1566
|
|
|
@@ -1561,7 +1572,7 @@ function useWishlist(options) {
|
|
|
1561
1572
|
const query = _reactquery.useQuery.call(void 0, {
|
|
1562
1573
|
queryKey: ["behio", "wishlist"],
|
|
1563
1574
|
queryFn: () => unwrap(client.wishlist.get()),
|
|
1564
|
-
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1575
|
+
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _91 => _91.enabled]), () => ( true))
|
|
1565
1576
|
});
|
|
1566
1577
|
const addMutation = _reactquery.useMutation.call(void 0, {
|
|
1567
1578
|
mutationFn: (productId) => unwrap(client.wishlist.add(productId)),
|
|
@@ -1593,9 +1604,9 @@ function useIsInWishlist(productId) {
|
|
|
1593
1604
|
function useProductReviews(productId, options) {
|
|
1594
1605
|
const { client } = useBehio();
|
|
1595
1606
|
return _reactquery.useQuery.call(void 0, {
|
|
1596
|
-
queryKey: ["behio", "reviews", productId, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1597
|
-
queryFn: () => unwrap(client.reviews.getProductReviews(productId, _optionalChain([options, 'optionalAccess',
|
|
1598
|
-
enabled: Boolean(productId) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1607
|
+
queryKey: ["behio", "reviews", productId, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _92 => _92.page]), () => ( 1))],
|
|
1608
|
+
queryFn: () => unwrap(client.reviews.getProductReviews(productId, _optionalChain([options, 'optionalAccess', _93 => _93.page]), _optionalChain([options, 'optionalAccess', _94 => _94.limit]))),
|
|
1609
|
+
enabled: Boolean(productId) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _95 => _95.enabled]), () => ( true)))
|
|
1599
1610
|
});
|
|
1600
1611
|
}
|
|
1601
1612
|
function useSubmitReview() {
|
|
@@ -1709,4 +1720,5 @@ function useNotifyWhenAvailable() {
|
|
|
1709
1720
|
|
|
1710
1721
|
|
|
1711
1722
|
|
|
1712
|
-
|
|
1723
|
+
|
|
1724
|
+
exports.BehioAnalyticsTracker = BehioAnalyticsTracker; exports.BehioProvider = BehioProvider; exports.CurrencySwitcher = CurrencySwitcher; exports.StorefrontScripts = StorefrontScripts; exports.cookieStorage = cookieStorage; exports.createMemoryStorage = createMemoryStorage; exports.detectStorage = detectStorage; exports.formatPrice = _chunkJIAOZ5YWjs.formatPrice; exports.localStorageAdapter = localStorageAdapter; exports.memoryStorage = memoryStorage; exports.trackEcommerceEvent = _chunkJIAOZ5YWjs.trackEcommerceEvent; exports.useAddressAutocomplete = useAddressAutocomplete; exports.useAddresses = useAddresses; exports.useAuth = useAuth; exports.useBehio = useBehio; exports.useBehioClient = useBehioClient; exports.useBundle = useBundle; exports.useBundles = useBundles; exports.useCart = useCart; exports.useCartCount = useCartCount; exports.useCategories = useCategories; exports.useCategory = useCategory; exports.useCheckout = useCheckout; exports.useCookieConsent = useCookieConsent; exports.useCrossSell = useCrossSell; exports.useCurrency = useCurrency; exports.useCustomer = useCustomer; exports.useFeatured = useFeatured; exports.useFilters = useFilters; exports.useGiftCardBalance = useGiftCardBalance; exports.useIsInWishlist = useIsInWishlist; exports.useLabels = useLabels; exports.useLookupReturnableOrder = useLookupReturnableOrder; exports.useMenu = useMenu; exports.useNotifyWhenAvailable = useNotifyWhenAvailable; exports.useOrder = useOrder; exports.useOrderAccess = useOrderAccess; exports.useOrders = useOrders; exports.usePage = usePage; exports.usePages = usePages; exports.useProduct = useProduct; exports.useProductPromotions = useProductPromotions; exports.useProductReviews = useProductReviews; exports.useProducts = useProducts; exports.useQuoteStatus = useQuoteStatus; exports.useReturnStatus = useReturnStatus; exports.useSearch = useSearch; exports.useShopInfo = useShopInfo; exports.useShopScripts = useShopScripts; exports.useShopSeo = useShopSeo; exports.useSubmitQuote = useSubmitQuote; exports.useSubmitReturn = useSubmitReturn; exports.useSubmitReview = useSubmitReview; exports.useWishlist = useWishlist;
|