@behio/storefront-sdk 0.29.0 → 0.30.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-CXKZLKUY.js → chunk-NG46DR3A.js} +43 -0
- package/dist/{chunk-TN5C6CAB.mjs → chunk-O7HDB5R4.mjs} +43 -0
- package/dist/{client-BQroQWyY.d.mts → client-CJ_CoUIh.d.mts} +243 -1
- package/dist/{client-BQroQWyY.d.ts → client-CJ_CoUIh.d.ts} +243 -1
- 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 +45 -3
- package/dist/react.d.ts +45 -3
- package/dist/react.js +96 -44
- package/dist/react.mjs +102 -50
- package/package.json +1 -1
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 _chunkNG46DR3Ajs = require('./chunk-NG46DR3A.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, _chunkNG46DR3Ajs.BehioStorefront)({
|
|
138
138
|
apiKey,
|
|
139
139
|
baseUrl,
|
|
140
140
|
...shopDomain ? { shopDomain } : {},
|
|
@@ -872,6 +872,54 @@ function useAddressAutocomplete(options) {
|
|
|
872
872
|
};
|
|
873
873
|
}
|
|
874
874
|
|
|
875
|
+
// src/react/hooks/use-loyalty.ts
|
|
876
|
+
|
|
877
|
+
var LOYALTY_KEY = ["behio", "loyalty"];
|
|
878
|
+
function useLoyalty(options) {
|
|
879
|
+
const { client } = useBehio();
|
|
880
|
+
const { data, isLoading, error, refetch } = _reactquery.useQuery.call(void 0, {
|
|
881
|
+
queryKey: [...LOYALTY_KEY],
|
|
882
|
+
queryFn: () => unwrap(client.customer.getLoyalty()),
|
|
883
|
+
enabled: _optionalChain([options, 'optionalAccess', _53 => _53.enabled]) !== false && !!client.getAccessToken()
|
|
884
|
+
});
|
|
885
|
+
return { loyalty: data, isLoading, error, refetch };
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
// src/react/hooks/use-pickup-points.ts
|
|
889
|
+
|
|
890
|
+
function usePickupPoints(input) {
|
|
891
|
+
const { client } = useBehio();
|
|
892
|
+
const { methodId, query, country, limit, enabled } = input;
|
|
893
|
+
const { data, isLoading, error, refetch } = _reactquery.useQuery.call(void 0, {
|
|
894
|
+
queryKey: ["behio", "pickup-points", methodId, _nullishCoalesce(query, () => ( "")), _nullishCoalesce(country, () => ( "")), _nullishCoalesce(limit, () => ( 30))],
|
|
895
|
+
queryFn: () => unwrap(
|
|
896
|
+
client.shipping.getPickupPoints({
|
|
897
|
+
methodId,
|
|
898
|
+
query,
|
|
899
|
+
country,
|
|
900
|
+
limit
|
|
901
|
+
})
|
|
902
|
+
),
|
|
903
|
+
enabled: enabled !== false && !!methodId
|
|
904
|
+
});
|
|
905
|
+
return { pickupPoints: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _54 => _54.items]), () => ( [])), isLoading, error, refetch };
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
// src/react/hooks/use-newsletter.ts
|
|
909
|
+
|
|
910
|
+
function useNewsletterSubscribe() {
|
|
911
|
+
const { client } = useBehio();
|
|
912
|
+
return _reactquery.useMutation.call(void 0, {
|
|
913
|
+
mutationFn: (input) => unwrap(client.newsletter.subscribe(input))
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
function useNewsletterUnsubscribe() {
|
|
917
|
+
const { client } = useBehio();
|
|
918
|
+
return _reactquery.useMutation.call(void 0, {
|
|
919
|
+
mutationFn: (email) => unwrap(client.newsletter.unsubscribe(email))
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
|
|
875
923
|
// src/react/hooks/use-orders.ts
|
|
876
924
|
|
|
877
925
|
|
|
@@ -888,10 +936,10 @@ function useOrders(options) {
|
|
|
888
936
|
enabled: enabled !== false && !!client.getAccessToken()
|
|
889
937
|
});
|
|
890
938
|
const items = _react.useMemo.call(void 0,
|
|
891
|
-
() => _nullishCoalesce(_optionalChain([infinite, 'access',
|
|
939
|
+
() => _nullishCoalesce(_optionalChain([infinite, 'access', _55 => _55.data, 'optionalAccess', _56 => _56.pages, 'access', _57 => _57.flatMap, 'call', _58 => _58((p) => p.items)]), () => ( [])),
|
|
892
940
|
[infinite.data]
|
|
893
941
|
);
|
|
894
|
-
const lastPage = _optionalChain([infinite, 'access',
|
|
942
|
+
const lastPage = _optionalChain([infinite, 'access', _59 => _59.data, 'optionalAccess', _60 => _60.pages, 'access', _61 => _61[infinite.data.pages.length - 1]]);
|
|
895
943
|
const loadMore = _react.useCallback.call(void 0, () => {
|
|
896
944
|
if (infinite.hasNextPage && !infinite.isFetchingNextPage) {
|
|
897
945
|
return infinite.fetchNextPage();
|
|
@@ -904,10 +952,10 @@ function useOrders(options) {
|
|
|
904
952
|
return {
|
|
905
953
|
items,
|
|
906
954
|
data: infinite.data,
|
|
907
|
-
total: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
908
|
-
totalPages: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
909
|
-
currentPage: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
910
|
-
limit: _nullishCoalesce(_nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
955
|
+
total: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _62 => _62.total]), () => ( 0)),
|
|
956
|
+
totalPages: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _63 => _63.totalPages]), () => ( 0)),
|
|
957
|
+
currentPage: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _64 => _64.page]), () => ( page)),
|
|
958
|
+
limit: _nullishCoalesce(_nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _65 => _65.limit]), () => ( limit)), () => ( 20)),
|
|
911
959
|
page,
|
|
912
960
|
setPage: goToPage,
|
|
913
961
|
loadMore,
|
|
@@ -936,7 +984,7 @@ function useOrder(orderNumber, options) {
|
|
|
936
984
|
} = _reactquery.useQuery.call(void 0, {
|
|
937
985
|
queryKey: ["behio", "order", orderNumber],
|
|
938
986
|
queryFn: () => unwrap(client.orders.get(orderNumber)),
|
|
939
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
987
|
+
enabled: _optionalChain([options, 'optionalAccess', _66 => _66.enabled]) !== false && !!orderNumber && !!client.getAccessToken()
|
|
940
988
|
});
|
|
941
989
|
const cancelMutation = _reactquery.useMutation.call(void 0, {
|
|
942
990
|
mutationFn: () => unwrap(client.orders.cancel(orderNumber)),
|
|
@@ -1061,7 +1109,7 @@ function usePages(locale, options) {
|
|
|
1061
1109
|
const result = await unwrap(client.pages.list(locale));
|
|
1062
1110
|
return result.pages;
|
|
1063
1111
|
},
|
|
1064
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
1112
|
+
enabled: _optionalChain([options, 'optionalAccess', _67 => _67.enabled]) !== false
|
|
1065
1113
|
});
|
|
1066
1114
|
}
|
|
1067
1115
|
function usePage(slug, locale, options) {
|
|
@@ -1069,7 +1117,7 @@ function usePage(slug, locale, options) {
|
|
|
1069
1117
|
return _reactquery.useQuery.call(void 0, {
|
|
1070
1118
|
queryKey: ["behio", "page", slug, locale],
|
|
1071
1119
|
queryFn: () => unwrap(client.pages.get(slug, locale)),
|
|
1072
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
1120
|
+
enabled: _optionalChain([options, 'optionalAccess', _68 => _68.enabled]) !== false && !!slug
|
|
1073
1121
|
});
|
|
1074
1122
|
}
|
|
1075
1123
|
|
|
@@ -1080,7 +1128,7 @@ function useShopInfo(options) {
|
|
|
1080
1128
|
return _reactquery.useQuery.call(void 0, {
|
|
1081
1129
|
queryKey: ["behio", "shop-info"],
|
|
1082
1130
|
queryFn: () => unwrap(client.getShopInfo()),
|
|
1083
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
1131
|
+
enabled: _optionalChain([options, 'optionalAccess', _69 => _69.enabled]) !== false
|
|
1084
1132
|
});
|
|
1085
1133
|
}
|
|
1086
1134
|
|
|
@@ -1091,7 +1139,7 @@ function useShopScripts(options) {
|
|
|
1091
1139
|
return _reactquery.useQuery.call(void 0, {
|
|
1092
1140
|
queryKey: ["behio", "shop-scripts"],
|
|
1093
1141
|
queryFn: () => unwrap(client.getShopScripts()),
|
|
1094
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
1142
|
+
enabled: _optionalChain([options, 'optionalAccess', _70 => _70.enabled]) !== false
|
|
1095
1143
|
});
|
|
1096
1144
|
}
|
|
1097
1145
|
|
|
@@ -1119,8 +1167,8 @@ function dedupe(values) {
|
|
|
1119
1167
|
function useCurrency() {
|
|
1120
1168
|
const { currency, setCurrency, configuredDefaultCurrency, configuredCurrencies } = useBehio();
|
|
1121
1169
|
const { data: shop, isLoading } = useShopInfo();
|
|
1122
|
-
const defaultCurrency = _nullishCoalesce(configuredDefaultCurrency, () => ( _optionalChain([shop, 'optionalAccess',
|
|
1123
|
-
const currencies = configuredCurrencies && configuredCurrencies.length > 0 ? dedupe(configuredCurrencies) : dedupe([defaultCurrency, ..._nullishCoalesce(_optionalChain([shop, 'optionalAccess',
|
|
1170
|
+
const defaultCurrency = _nullishCoalesce(configuredDefaultCurrency, () => ( _optionalChain([shop, 'optionalAccess', _71 => _71.defaultCurrency])));
|
|
1171
|
+
const currencies = configuredCurrencies && configuredCurrencies.length > 0 ? dedupe(configuredCurrencies) : dedupe([defaultCurrency, ..._nullishCoalesce(_optionalChain([shop, 'optionalAccess', _72 => _72.supportedCurrencies]), () => ( []))]);
|
|
1124
1172
|
return {
|
|
1125
1173
|
currency,
|
|
1126
1174
|
effectiveCurrency: _nullishCoalesce(currency, () => ( defaultCurrency)),
|
|
@@ -1143,7 +1191,7 @@ function CurrencySwitcher({
|
|
|
1143
1191
|
const { currencies, effectiveCurrency, setCurrency } = useCurrency();
|
|
1144
1192
|
if (currencies.length === 0) return null;
|
|
1145
1193
|
if (currencies.length <= 1 && !showWhenSingle) return null;
|
|
1146
|
-
const label = (code) => _nullishCoalesce(_optionalChain([labels, 'optionalAccess',
|
|
1194
|
+
const label = (code) => _nullishCoalesce(_optionalChain([labels, 'optionalAccess', _73 => _73[code]]), () => ( code));
|
|
1147
1195
|
if (children) {
|
|
1148
1196
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: children({ currencies, value: effectiveCurrency, setCurrency, label }) });
|
|
1149
1197
|
}
|
|
@@ -1260,9 +1308,9 @@ function StorefrontScripts({ visitorId: visitorIdProp } = {}) {
|
|
|
1260
1308
|
}
|
|
1261
1309
|
}, [visitorIdProp]);
|
|
1262
1310
|
const { data: consent } = useCookieConsent(visitorId || void 0);
|
|
1263
|
-
const analyticsOk = Boolean(_optionalChain([consent, 'optionalAccess',
|
|
1311
|
+
const analyticsOk = Boolean(_optionalChain([consent, 'optionalAccess', _74 => _74.analytics]));
|
|
1264
1312
|
const scripts = _react.useMemo.call(void 0,
|
|
1265
|
-
() => (_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
1313
|
+
() => (_nullishCoalesce(_optionalChain([data, 'optionalAccess', _75 => _75.scripts]), () => ( []))).filter((s) => !s.consentRequired || analyticsOk),
|
|
1266
1314
|
[data, analyticsOk]
|
|
1267
1315
|
);
|
|
1268
1316
|
const signature = _react.useMemo.call(void 0,
|
|
@@ -1327,7 +1375,7 @@ function initTracker(client) {
|
|
|
1327
1375
|
return;
|
|
1328
1376
|
}
|
|
1329
1377
|
const { data } = await client.consent.get(stored);
|
|
1330
|
-
const granted = Boolean(_optionalChain([data, 'optionalAccess',
|
|
1378
|
+
const granted = Boolean(_optionalChain([data, 'optionalAccess', _76 => _76.analytics]));
|
|
1331
1379
|
visitorId = granted ? stored : void 0;
|
|
1332
1380
|
client.setAnalyticsVisitorId(granted ? stored : null);
|
|
1333
1381
|
} catch (e7) {
|
|
@@ -1411,7 +1459,7 @@ function initTracker(client) {
|
|
|
1411
1459
|
};
|
|
1412
1460
|
const onClick = (ev) => {
|
|
1413
1461
|
const target = ev.target;
|
|
1414
|
-
const el = _optionalChain([target, 'optionalAccess',
|
|
1462
|
+
const el = _optionalChain([target, 'optionalAccess', _77 => _77.closest, 'optionalCall', _78 => _78("a,button,[role=button],[data-behio-event]")]);
|
|
1415
1463
|
if (!el) return;
|
|
1416
1464
|
const explicit = _nullishCoalesce(el.getAttribute("data-behio-event"), () => ( void 0));
|
|
1417
1465
|
const text = (_nullishCoalesce(el.textContent, () => ( ""))).trim().replace(/\s+/g, " ").slice(0, 80) || void 0;
|
|
@@ -1452,7 +1500,7 @@ function initTracker(client) {
|
|
|
1452
1500
|
items: payload.items.length,
|
|
1453
1501
|
// First item id = the product (view_item/add_to_cart are
|
|
1454
1502
|
// single-product in practice) - Behavioral Offers count on it.
|
|
1455
|
-
itemId: _optionalChain([payload, 'access',
|
|
1503
|
+
itemId: _optionalChain([payload, 'access', _79 => _79.items, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.item_id])
|
|
1456
1504
|
}
|
|
1457
1505
|
} : {}
|
|
1458
1506
|
});
|
|
@@ -1514,8 +1562,8 @@ function useBundles(options) {
|
|
|
1514
1562
|
return _reactquery.useQuery.call(void 0, {
|
|
1515
1563
|
queryKey: ["behio", "bundles"],
|
|
1516
1564
|
queryFn: () => unwrap(client.catalog.getBundles()),
|
|
1517
|
-
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1518
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1565
|
+
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.enabled]), () => ( true)),
|
|
1566
|
+
initialData: _optionalChain([options, 'optionalAccess', _83 => _83.initialData])
|
|
1519
1567
|
});
|
|
1520
1568
|
}
|
|
1521
1569
|
function useBundle(slug, options) {
|
|
@@ -1523,8 +1571,8 @@ function useBundle(slug, options) {
|
|
|
1523
1571
|
return _reactquery.useQuery.call(void 0, {
|
|
1524
1572
|
queryKey: ["behio", "bundle", slug],
|
|
1525
1573
|
queryFn: () => unwrap(client.catalog.getBundle(slug)),
|
|
1526
|
-
enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1527
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1574
|
+
enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _84 => _84.enabled]), () => ( true))),
|
|
1575
|
+
initialData: _optionalChain([options, 'optionalAccess', _85 => _85.initialData])
|
|
1528
1576
|
});
|
|
1529
1577
|
}
|
|
1530
1578
|
|
|
@@ -1533,15 +1581,15 @@ function useBundle(slug, options) {
|
|
|
1533
1581
|
function useProductGroup(slug, options) {
|
|
1534
1582
|
const { client } = useBehio();
|
|
1535
1583
|
return _reactquery.useQuery.call(void 0, {
|
|
1536
|
-
queryKey: ["behio", "product-group", slug, _optionalChain([options, 'optionalAccess',
|
|
1584
|
+
queryKey: ["behio", "product-group", slug, _optionalChain([options, 'optionalAccess', _86 => _86.locale]), _optionalChain([options, 'optionalAccess', _87 => _87.currency])],
|
|
1537
1585
|
queryFn: () => unwrap(
|
|
1538
1586
|
client.catalog.getProductGroup(slug, {
|
|
1539
|
-
locale: _optionalChain([options, 'optionalAccess',
|
|
1540
|
-
currency: _optionalChain([options, 'optionalAccess',
|
|
1587
|
+
locale: _optionalChain([options, 'optionalAccess', _88 => _88.locale]),
|
|
1588
|
+
currency: _optionalChain([options, 'optionalAccess', _89 => _89.currency])
|
|
1541
1589
|
})
|
|
1542
1590
|
),
|
|
1543
|
-
enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1544
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1591
|
+
enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _90 => _90.enabled]), () => ( true))),
|
|
1592
|
+
initialData: _optionalChain([options, 'optionalAccess', _91 => _91.initialData])
|
|
1545
1593
|
});
|
|
1546
1594
|
}
|
|
1547
1595
|
|
|
@@ -1550,15 +1598,15 @@ function useProductGroup(slug, options) {
|
|
|
1550
1598
|
function useCrossSell(productSlug, options) {
|
|
1551
1599
|
const { client } = useBehio();
|
|
1552
1600
|
return _reactquery.useQuery.call(void 0, {
|
|
1553
|
-
queryKey: ["behio", "cross-sell", productSlug, _optionalChain([options, 'optionalAccess',
|
|
1601
|
+
queryKey: ["behio", "cross-sell", productSlug, _optionalChain([options, 'optionalAccess', _92 => _92.locale]), _optionalChain([options, 'optionalAccess', _93 => _93.currency])],
|
|
1554
1602
|
queryFn: () => unwrap(
|
|
1555
1603
|
client.catalog.getCrossSell(productSlug, {
|
|
1556
|
-
locale: _optionalChain([options, 'optionalAccess',
|
|
1557
|
-
currency: _optionalChain([options, 'optionalAccess',
|
|
1604
|
+
locale: _optionalChain([options, 'optionalAccess', _94 => _94.locale]),
|
|
1605
|
+
currency: _optionalChain([options, 'optionalAccess', _95 => _95.currency])
|
|
1558
1606
|
})
|
|
1559
1607
|
),
|
|
1560
|
-
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1561
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1608
|
+
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _96 => _96.enabled]), () => ( true))),
|
|
1609
|
+
initialData: _optionalChain([options, 'optionalAccess', _97 => _97.initialData])
|
|
1562
1610
|
});
|
|
1563
1611
|
}
|
|
1564
1612
|
|
|
@@ -1569,8 +1617,8 @@ function useProductPromotions(productSlug, options) {
|
|
|
1569
1617
|
return _reactquery.useQuery.call(void 0, {
|
|
1570
1618
|
queryKey: ["behio", "product-promotions", productSlug],
|
|
1571
1619
|
queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
|
|
1572
|
-
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1573
|
-
refetchInterval: _optionalChain([options, 'optionalAccess',
|
|
1620
|
+
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _98 => _98.enabled]), () => ( true))),
|
|
1621
|
+
refetchInterval: _optionalChain([options, 'optionalAccess', _99 => _99.refetchIntervalMs])
|
|
1574
1622
|
});
|
|
1575
1623
|
}
|
|
1576
1624
|
|
|
@@ -1578,11 +1626,11 @@ function useProductPromotions(productSlug, options) {
|
|
|
1578
1626
|
|
|
1579
1627
|
function useGiftCardBalance(code, options) {
|
|
1580
1628
|
const { client } = useBehio();
|
|
1581
|
-
const trimmed = _optionalChain([code, 'optionalAccess',
|
|
1629
|
+
const trimmed = _optionalChain([code, 'optionalAccess', _100 => _100.trim, 'call', _101 => _101()]);
|
|
1582
1630
|
return _reactquery.useQuery.call(void 0, {
|
|
1583
1631
|
queryKey: ["behio", "gift-card-balance", trimmed],
|
|
1584
1632
|
queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
|
|
1585
|
-
enabled: Boolean(trimmed && trimmed.length >= 6) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1633
|
+
enabled: Boolean(trimmed && trimmed.length >= 6) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _102 => _102.enabled]), () => ( true)))
|
|
1586
1634
|
});
|
|
1587
1635
|
}
|
|
1588
1636
|
|
|
@@ -1594,7 +1642,7 @@ function useWishlist(options) {
|
|
|
1594
1642
|
const query = _reactquery.useQuery.call(void 0, {
|
|
1595
1643
|
queryKey: ["behio", "wishlist"],
|
|
1596
1644
|
queryFn: () => unwrap(client.wishlist.get()),
|
|
1597
|
-
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1645
|
+
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _103 => _103.enabled]), () => ( true))
|
|
1598
1646
|
});
|
|
1599
1647
|
const addMutation = _reactquery.useMutation.call(void 0, {
|
|
1600
1648
|
mutationFn: (productId) => unwrap(client.wishlist.add(productId)),
|
|
@@ -1626,9 +1674,9 @@ function useIsInWishlist(productId) {
|
|
|
1626
1674
|
function useProductReviews(productId, options) {
|
|
1627
1675
|
const { client } = useBehio();
|
|
1628
1676
|
return _reactquery.useQuery.call(void 0, {
|
|
1629
|
-
queryKey: ["behio", "reviews", productId, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1630
|
-
queryFn: () => unwrap(client.reviews.getProductReviews(productId, _optionalChain([options, 'optionalAccess',
|
|
1631
|
-
enabled: Boolean(productId) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1677
|
+
queryKey: ["behio", "reviews", productId, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _104 => _104.page]), () => ( 1))],
|
|
1678
|
+
queryFn: () => unwrap(client.reviews.getProductReviews(productId, _optionalChain([options, 'optionalAccess', _105 => _105.page]), _optionalChain([options, 'optionalAccess', _106 => _106.limit]))),
|
|
1679
|
+
enabled: Boolean(productId) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _107 => _107.enabled]), () => ( true)))
|
|
1632
1680
|
});
|
|
1633
1681
|
}
|
|
1634
1682
|
function useSubmitReview() {
|
|
@@ -1744,4 +1792,8 @@ function useNotifyWhenAvailable() {
|
|
|
1744
1792
|
|
|
1745
1793
|
|
|
1746
1794
|
|
|
1747
|
-
|
|
1795
|
+
|
|
1796
|
+
|
|
1797
|
+
|
|
1798
|
+
|
|
1799
|
+
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.useLoyalty = useLoyalty; exports.useMenu = useMenu; exports.useNewsletterSubscribe = useNewsletterSubscribe; exports.useNewsletterUnsubscribe = useNewsletterUnsubscribe; exports.useNotifyWhenAvailable = useNotifyWhenAvailable; exports.useOrder = useOrder; exports.useOrderAccess = useOrderAccess; exports.useOrders = useOrders; exports.usePage = usePage; exports.usePages = usePages; exports.usePickupPoints = usePickupPoints; exports.useProduct = useProduct; exports.useProductGroup = useProductGroup; 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;
|