@behio/storefront-sdk 0.34.1 → 0.35.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-5KJDVDUM.mjs → chunk-LNYVY6ER.mjs} +34 -1
- package/dist/{chunk-Y4ZCK5HD.js → chunk-XEU3XH6H.js} +34 -1
- package/dist/{client-DNOo-M26.d.mts → client-Bf2bJGyN.d.mts} +85 -2
- package/dist/{client-DNOo-M26.d.ts → client-Bf2bJGyN.d.ts} +85 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- 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 +87 -75
- package/dist/react.mjs +74 -62
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-QUU76QUB.mjs";
|
|
9
9
|
import {
|
|
10
10
|
BehioStorefront
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LNYVY6ER.mjs";
|
|
12
12
|
|
|
13
13
|
// src/react/provider.tsx
|
|
14
14
|
import { useRef, useEffect, useMemo, useState, useCallback } from "react";
|
|
@@ -392,9 +392,20 @@ function useFilters(options) {
|
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
+
// src/react/hooks/use-facets.ts
|
|
396
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
397
|
+
function useFacets(query, options) {
|
|
398
|
+
const { client } = useBehio();
|
|
399
|
+
return useQuery7({
|
|
400
|
+
queryKey: ["behio", "facets", query ?? {}],
|
|
401
|
+
queryFn: async () => unwrap(client.catalog.getFacets(query)),
|
|
402
|
+
enabled: options?.enabled !== false
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
|
|
395
406
|
// src/react/hooks/use-search.ts
|
|
396
407
|
import { useState as useState3, useEffect as useEffect2 } from "react";
|
|
397
|
-
import { useQuery as
|
|
408
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
398
409
|
function useSearch(query, options) {
|
|
399
410
|
const { client } = useBehio();
|
|
400
411
|
const debounceMs = options?.debounceMs ?? 300;
|
|
@@ -407,7 +418,7 @@ function useSearch(query, options) {
|
|
|
407
418
|
const timer = setTimeout(() => setDebouncedQuery(query), debounceMs);
|
|
408
419
|
return () => clearTimeout(timer);
|
|
409
420
|
}, [query, debounceMs]);
|
|
410
|
-
return
|
|
421
|
+
return useQuery8({
|
|
411
422
|
queryKey: ["behio", "search", debouncedQuery, options?.page, options?.limit],
|
|
412
423
|
queryFn: () => unwrap(client.catalog.search(debouncedQuery, {
|
|
413
424
|
page: options?.page,
|
|
@@ -419,7 +430,7 @@ function useSearch(query, options) {
|
|
|
419
430
|
|
|
420
431
|
// src/react/hooks/use-cart.ts
|
|
421
432
|
import { useCallback as useCallback3 } from "react";
|
|
422
|
-
import { useQuery as
|
|
433
|
+
import { useQuery as useQuery9, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
423
434
|
var CART_KEY = ["behio", "cart"];
|
|
424
435
|
function useCart(options) {
|
|
425
436
|
const { client, storage } = useBehio();
|
|
@@ -428,7 +439,7 @@ function useCart(options) {
|
|
|
428
439
|
data: cart,
|
|
429
440
|
isLoading,
|
|
430
441
|
error
|
|
431
|
-
} =
|
|
442
|
+
} = useQuery9({
|
|
432
443
|
queryKey: [...CART_KEY],
|
|
433
444
|
queryFn: () => unwrap(client.cart.get()),
|
|
434
445
|
// Only fetch if we have a cart session or are logged in
|
|
@@ -578,13 +589,13 @@ function useCart(options) {
|
|
|
578
589
|
}
|
|
579
590
|
|
|
580
591
|
// src/react/hooks/use-cart-count.ts
|
|
581
|
-
import { useQuery as
|
|
592
|
+
import { useQuery as useQuery10, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
582
593
|
var CART_KEY2 = ["behio", "cart"];
|
|
583
594
|
function useCartCount(options) {
|
|
584
595
|
const { client } = useBehio();
|
|
585
596
|
const queryClient = useQueryClient2();
|
|
586
597
|
const cachedCart = queryClient.getQueryData([...CART_KEY2]);
|
|
587
|
-
const { data } =
|
|
598
|
+
const { data } = useQuery10({
|
|
588
599
|
queryKey: [...CART_KEY2],
|
|
589
600
|
queryFn: () => unwrap(client.cart.get()),
|
|
590
601
|
enabled: options?.enabled !== false && !cachedCart && (!!client.getCartSession() || !!client.getAccessToken())
|
|
@@ -595,7 +606,7 @@ function useCartCount(options) {
|
|
|
595
606
|
|
|
596
607
|
// src/react/hooks/use-auth.ts
|
|
597
608
|
import { useCallback as useCallback4 } from "react";
|
|
598
|
-
import { useQuery as
|
|
609
|
+
import { useQuery as useQuery11, useMutation as useMutation2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
599
610
|
var CUSTOMER_KEY = ["behio", "customer"];
|
|
600
611
|
var CART_KEY3 = ["behio", "cart"];
|
|
601
612
|
function useAuth() {
|
|
@@ -605,7 +616,7 @@ function useAuth() {
|
|
|
605
616
|
const {
|
|
606
617
|
data: customer,
|
|
607
618
|
isLoading
|
|
608
|
-
} =
|
|
619
|
+
} = useQuery11({
|
|
609
620
|
queryKey: [...CUSTOMER_KEY],
|
|
610
621
|
queryFn: () => unwrap(client.customer.getProfile()),
|
|
611
622
|
enabled: isLoggedIn
|
|
@@ -718,7 +729,7 @@ function useAuth() {
|
|
|
718
729
|
|
|
719
730
|
// src/react/hooks/use-customer.ts
|
|
720
731
|
import { useCallback as useCallback5 } from "react";
|
|
721
|
-
import { useQuery as
|
|
732
|
+
import { useQuery as useQuery12, useMutation as useMutation3, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
722
733
|
var CUSTOMER_KEY2 = ["behio", "customer"];
|
|
723
734
|
function useCustomer(options) {
|
|
724
735
|
const { client } = useBehio();
|
|
@@ -727,7 +738,7 @@ function useCustomer(options) {
|
|
|
727
738
|
data,
|
|
728
739
|
isLoading,
|
|
729
740
|
error
|
|
730
|
-
} =
|
|
741
|
+
} = useQuery12({
|
|
731
742
|
queryKey: [...CUSTOMER_KEY2],
|
|
732
743
|
queryFn: () => unwrap(client.customer.getProfile()),
|
|
733
744
|
enabled: options?.enabled !== false && !!client.getAccessToken()
|
|
@@ -753,7 +764,7 @@ function useCustomer(options) {
|
|
|
753
764
|
|
|
754
765
|
// src/react/hooks/use-addresses.ts
|
|
755
766
|
import { useCallback as useCallback6 } from "react";
|
|
756
|
-
import { useQuery as
|
|
767
|
+
import { useQuery as useQuery13, useMutation as useMutation4, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
757
768
|
var ADDRESSES_KEY = ["behio", "addresses"];
|
|
758
769
|
function useAddresses(options) {
|
|
759
770
|
const { client } = useBehio();
|
|
@@ -762,7 +773,7 @@ function useAddresses(options) {
|
|
|
762
773
|
data,
|
|
763
774
|
isLoading,
|
|
764
775
|
error
|
|
765
|
-
} =
|
|
776
|
+
} = useQuery13({
|
|
766
777
|
queryKey: [...ADDRESSES_KEY],
|
|
767
778
|
queryFn: async () => {
|
|
768
779
|
const result = await unwrap(client.customer.getAddresses());
|
|
@@ -814,7 +825,7 @@ function useAddresses(options) {
|
|
|
814
825
|
|
|
815
826
|
// src/react/hooks/use-address-autocomplete.ts
|
|
816
827
|
import { useState as useState4, useEffect as useEffect3, useRef as useRef2, useCallback as useCallback7 } from "react";
|
|
817
|
-
import { useQuery as
|
|
828
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
818
829
|
var AC_KEY = ["behio", "address-autocomplete"];
|
|
819
830
|
function useAddressAutocomplete(options) {
|
|
820
831
|
const { country, debounce = 300, minChars = 3, enabled = true } = options;
|
|
@@ -837,7 +848,7 @@ function useAddressAutocomplete(options) {
|
|
|
837
848
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
838
849
|
};
|
|
839
850
|
}, [query, debounce, minChars]);
|
|
840
|
-
const { data, isLoading } =
|
|
851
|
+
const { data, isLoading } = useQuery14({
|
|
841
852
|
queryKey: [...AC_KEY, debouncedQuery, country],
|
|
842
853
|
queryFn: () => unwrap(client.addresses.autocomplete(debouncedQuery, country)),
|
|
843
854
|
enabled: enabled && debouncedQuery.length >= minChars,
|
|
@@ -877,11 +888,11 @@ function useAddressAutocomplete(options) {
|
|
|
877
888
|
}
|
|
878
889
|
|
|
879
890
|
// src/react/hooks/use-loyalty.ts
|
|
880
|
-
import { useQuery as
|
|
891
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
881
892
|
var LOYALTY_KEY = ["behio", "loyalty"];
|
|
882
893
|
function useLoyalty(options) {
|
|
883
894
|
const { client } = useBehio();
|
|
884
|
-
const { data, isLoading, error, refetch } =
|
|
895
|
+
const { data, isLoading, error, refetch } = useQuery15({
|
|
885
896
|
queryKey: [...LOYALTY_KEY],
|
|
886
897
|
queryFn: () => unwrap(client.customer.getLoyalty()),
|
|
887
898
|
enabled: options?.enabled !== false && !!client.getAccessToken()
|
|
@@ -890,12 +901,12 @@ function useLoyalty(options) {
|
|
|
890
901
|
}
|
|
891
902
|
|
|
892
903
|
// src/react/hooks/use-subscriptions.ts
|
|
893
|
-
import { useQuery as
|
|
904
|
+
import { useQuery as useQuery16, useMutation as useMutation5, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
894
905
|
var SUBSCRIPTIONS_KEY = ["behio", "subscriptions"];
|
|
895
906
|
function useSubscriptions(options) {
|
|
896
907
|
const { client } = useBehio();
|
|
897
908
|
const qc = useQueryClient7();
|
|
898
|
-
const query =
|
|
909
|
+
const query = useQuery16({
|
|
899
910
|
queryKey: [...SUBSCRIPTIONS_KEY],
|
|
900
911
|
queryFn: () => unwrap(client.subscriptions.list()),
|
|
901
912
|
enabled: options?.enabled !== false && !!client.getAccessToken()
|
|
@@ -928,11 +939,11 @@ function useSubscriptions(options) {
|
|
|
928
939
|
}
|
|
929
940
|
|
|
930
941
|
// src/react/hooks/use-pickup-points.ts
|
|
931
|
-
import { useQuery as
|
|
942
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
932
943
|
function usePickupPoints(input) {
|
|
933
944
|
const { client } = useBehio();
|
|
934
945
|
const { methodId, query, country, limit, enabled } = input;
|
|
935
|
-
const { data, isLoading, error, refetch } =
|
|
946
|
+
const { data, isLoading, error, refetch } = useQuery17({
|
|
936
947
|
queryKey: ["behio", "pickup-points", methodId, query ?? "", country ?? "", limit ?? 30],
|
|
937
948
|
queryFn: () => unwrap(
|
|
938
949
|
client.shipping.getPickupPoints({
|
|
@@ -948,12 +959,12 @@ function usePickupPoints(input) {
|
|
|
948
959
|
}
|
|
949
960
|
|
|
950
961
|
// src/react/hooks/use-shipping-methods.ts
|
|
951
|
-
import { useQuery as
|
|
962
|
+
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
952
963
|
function useShippingMethods(options) {
|
|
953
964
|
const { client, currency: activeCurrency } = useBehio();
|
|
954
965
|
const currency = options?.currency ?? activeCurrency;
|
|
955
966
|
const { country, cartTotal, cartWeightKg } = options ?? {};
|
|
956
|
-
const { data, isLoading, error, refetch } =
|
|
967
|
+
const { data, isLoading, error, refetch } = useQuery18({
|
|
957
968
|
queryKey: [
|
|
958
969
|
"behio",
|
|
959
970
|
"shipping-methods",
|
|
@@ -969,12 +980,12 @@ function useShippingMethods(options) {
|
|
|
969
980
|
}
|
|
970
981
|
|
|
971
982
|
// src/react/hooks/use-shipping-quote.ts
|
|
972
|
-
import { useQuery as
|
|
983
|
+
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
973
984
|
function useShippingQuote(options) {
|
|
974
985
|
const { client, currency: activeCurrency } = useBehio();
|
|
975
986
|
const { destinationAddress, items, cartTotal, enabled } = options ?? {};
|
|
976
987
|
const currency = options?.currency ?? activeCurrency;
|
|
977
|
-
const { data, isLoading, error, refetch } =
|
|
988
|
+
const { data, isLoading, error, refetch } = useQuery19({
|
|
978
989
|
queryKey: [
|
|
979
990
|
"behio",
|
|
980
991
|
"shipping-quote",
|
|
@@ -997,11 +1008,11 @@ function useShippingQuote(options) {
|
|
|
997
1008
|
}
|
|
998
1009
|
|
|
999
1010
|
// src/react/hooks/use-payment-methods.ts
|
|
1000
|
-
import { useQuery as
|
|
1011
|
+
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
1001
1012
|
function usePaymentMethods(options) {
|
|
1002
1013
|
const { client, currency: activeCurrency } = useBehio();
|
|
1003
1014
|
const currency = options?.currency ?? activeCurrency;
|
|
1004
|
-
const { data, isLoading, error, refetch } =
|
|
1015
|
+
const { data, isLoading, error, refetch } = useQuery20({
|
|
1005
1016
|
queryKey: ["behio", "payment-methods", currency ?? ""],
|
|
1006
1017
|
queryFn: () => unwrap(client.catalog.listPaymentMethods({ currency })),
|
|
1007
1018
|
enabled: options?.enabled !== false
|
|
@@ -1011,7 +1022,7 @@ function usePaymentMethods(options) {
|
|
|
1011
1022
|
|
|
1012
1023
|
// src/react/hooks/use-personal-offers.ts
|
|
1013
1024
|
import { useCallback as useCallback8, useEffect as useEffect4, useState as useState5 } from "react";
|
|
1014
|
-
import { useMutation as useMutation6, useQuery as
|
|
1025
|
+
import { useMutation as useMutation6, useQuery as useQuery21, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
1015
1026
|
function usePersonalOffers(options) {
|
|
1016
1027
|
const { client } = useBehio();
|
|
1017
1028
|
const queryClient = useQueryClient8();
|
|
@@ -1032,7 +1043,7 @@ function usePersonalOffers(options) {
|
|
|
1032
1043
|
}, [client, explicitVid]);
|
|
1033
1044
|
const visitorId = explicitVid ?? polledVid;
|
|
1034
1045
|
const queryKey = ["behio", "personal-offers", visitorId ?? ""];
|
|
1035
|
-
const { data, isLoading, error, refetch } =
|
|
1046
|
+
const { data, isLoading, error, refetch } = useQuery21({
|
|
1036
1047
|
queryKey,
|
|
1037
1048
|
queryFn: () => unwrap(client.getPersonalOffers(visitorId)),
|
|
1038
1049
|
enabled: options?.enabled !== false && !!visitorId
|
|
@@ -1166,7 +1177,7 @@ function useOrders(options) {
|
|
|
1166
1177
|
|
|
1167
1178
|
// src/react/hooks/use-order.ts
|
|
1168
1179
|
import { useCallback as useCallback11 } from "react";
|
|
1169
|
-
import { useQuery as
|
|
1180
|
+
import { useQuery as useQuery22, useMutation as useMutation8, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
1170
1181
|
function useOrder(orderNumber, options) {
|
|
1171
1182
|
const { client } = useBehio();
|
|
1172
1183
|
const queryClient = useQueryClient9();
|
|
@@ -1174,7 +1185,7 @@ function useOrder(orderNumber, options) {
|
|
|
1174
1185
|
data,
|
|
1175
1186
|
isLoading,
|
|
1176
1187
|
error
|
|
1177
|
-
} =
|
|
1188
|
+
} = useQuery22({
|
|
1178
1189
|
queryKey: ["behio", "order", orderNumber],
|
|
1179
1190
|
queryFn: () => unwrap(client.orders.get(orderNumber)),
|
|
1180
1191
|
enabled: options?.enabled !== false && !!orderNumber && !!client.getAccessToken()
|
|
@@ -1293,10 +1304,10 @@ function useCheckout() {
|
|
|
1293
1304
|
}
|
|
1294
1305
|
|
|
1295
1306
|
// src/react/hooks/use-pages.ts
|
|
1296
|
-
import { useQuery as
|
|
1307
|
+
import { useQuery as useQuery23 } from "@tanstack/react-query";
|
|
1297
1308
|
function usePages(locale, options) {
|
|
1298
1309
|
const { client } = useBehio();
|
|
1299
|
-
return
|
|
1310
|
+
return useQuery23({
|
|
1300
1311
|
queryKey: ["behio", "pages", locale],
|
|
1301
1312
|
queryFn: async () => {
|
|
1302
1313
|
const result = await unwrap(client.pages.list(locale));
|
|
@@ -1307,7 +1318,7 @@ function usePages(locale, options) {
|
|
|
1307
1318
|
}
|
|
1308
1319
|
function usePage(slug, locale, options) {
|
|
1309
1320
|
const { client } = useBehio();
|
|
1310
|
-
return
|
|
1321
|
+
return useQuery23({
|
|
1311
1322
|
queryKey: ["behio", "page", slug, locale],
|
|
1312
1323
|
queryFn: () => unwrap(client.pages.get(slug, locale)),
|
|
1313
1324
|
enabled: options?.enabled !== false && !!slug
|
|
@@ -1315,10 +1326,10 @@ function usePage(slug, locale, options) {
|
|
|
1315
1326
|
}
|
|
1316
1327
|
|
|
1317
1328
|
// src/react/hooks/use-shop-info.ts
|
|
1318
|
-
import { useQuery as
|
|
1329
|
+
import { useQuery as useQuery24 } from "@tanstack/react-query";
|
|
1319
1330
|
function useShopInfo(options) {
|
|
1320
1331
|
const { client } = useBehio();
|
|
1321
|
-
return
|
|
1332
|
+
return useQuery24({
|
|
1322
1333
|
queryKey: ["behio", "shop-info"],
|
|
1323
1334
|
queryFn: () => unwrap(client.getShopInfo()),
|
|
1324
1335
|
enabled: options?.enabled !== false
|
|
@@ -1326,10 +1337,10 @@ function useShopInfo(options) {
|
|
|
1326
1337
|
}
|
|
1327
1338
|
|
|
1328
1339
|
// src/react/hooks/use-shop-scripts.ts
|
|
1329
|
-
import { useQuery as
|
|
1340
|
+
import { useQuery as useQuery25 } from "@tanstack/react-query";
|
|
1330
1341
|
function useShopScripts(options) {
|
|
1331
1342
|
const { client } = useBehio();
|
|
1332
|
-
return
|
|
1343
|
+
return useQuery25({
|
|
1333
1344
|
queryKey: ["behio", "shop-scripts"],
|
|
1334
1345
|
queryFn: () => unwrap(client.getShopScripts()),
|
|
1335
1346
|
enabled: options?.enabled !== false
|
|
@@ -1337,11 +1348,11 @@ function useShopScripts(options) {
|
|
|
1337
1348
|
}
|
|
1338
1349
|
|
|
1339
1350
|
// src/react/hooks/use-shop-seo.ts
|
|
1340
|
-
import { useQuery as
|
|
1351
|
+
import { useQuery as useQuery26 } from "@tanstack/react-query";
|
|
1341
1352
|
function useShopSeo(options) {
|
|
1342
1353
|
const { client } = useBehio();
|
|
1343
1354
|
const { locale, initialData, enabled = true } = options ?? {};
|
|
1344
|
-
return
|
|
1355
|
+
return useQuery26({
|
|
1345
1356
|
queryKey: ["behio", "shop-seo", locale ?? "_default"],
|
|
1346
1357
|
queryFn: () => unwrap(client.getShopSeo(locale)),
|
|
1347
1358
|
initialData,
|
|
@@ -1404,11 +1415,11 @@ function CurrencySwitcher({
|
|
|
1404
1415
|
import { useEffect as useEffect5, useMemo as useMemo4, useState as useState9 } from "react";
|
|
1405
1416
|
|
|
1406
1417
|
// src/react/hooks/use-consent.ts
|
|
1407
|
-
import { useQuery as
|
|
1418
|
+
import { useQuery as useQuery27, useMutation as useMutation11, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
|
|
1408
1419
|
function useCookieConsent(visitorId) {
|
|
1409
1420
|
const { client } = useBehio();
|
|
1410
1421
|
const qc = useQueryClient11();
|
|
1411
|
-
const query =
|
|
1422
|
+
const query = useQuery27({
|
|
1412
1423
|
queryKey: ["behio", "consent", visitorId],
|
|
1413
1424
|
queryFn: () => unwrap(client.consent.get(visitorId)),
|
|
1414
1425
|
enabled: Boolean(visitorId)
|
|
@@ -1776,10 +1787,10 @@ function utmFromSearch(search) {
|
|
|
1776
1787
|
}
|
|
1777
1788
|
|
|
1778
1789
|
// src/react/hooks/use-bundles.ts
|
|
1779
|
-
import { useQuery as
|
|
1790
|
+
import { useQuery as useQuery28 } from "@tanstack/react-query";
|
|
1780
1791
|
function useBundles(options) {
|
|
1781
1792
|
const { client } = useBehio();
|
|
1782
|
-
return
|
|
1793
|
+
return useQuery28({
|
|
1783
1794
|
queryKey: ["behio", "bundles"],
|
|
1784
1795
|
queryFn: () => unwrap(client.catalog.getBundles()),
|
|
1785
1796
|
enabled: options?.enabled ?? true,
|
|
@@ -1788,7 +1799,7 @@ function useBundles(options) {
|
|
|
1788
1799
|
}
|
|
1789
1800
|
function useBundle(slug, options) {
|
|
1790
1801
|
const { client } = useBehio();
|
|
1791
|
-
return
|
|
1802
|
+
return useQuery28({
|
|
1792
1803
|
queryKey: ["behio", "bundle", slug],
|
|
1793
1804
|
queryFn: () => unwrap(client.catalog.getBundle(slug)),
|
|
1794
1805
|
enabled: Boolean(slug) && (options?.enabled ?? true),
|
|
@@ -1797,10 +1808,10 @@ function useBundle(slug, options) {
|
|
|
1797
1808
|
}
|
|
1798
1809
|
|
|
1799
1810
|
// src/react/hooks/use-product-group.ts
|
|
1800
|
-
import { useQuery as
|
|
1811
|
+
import { useQuery as useQuery29 } from "@tanstack/react-query";
|
|
1801
1812
|
function useProductGroup(slug, options) {
|
|
1802
1813
|
const { client } = useBehio();
|
|
1803
|
-
return
|
|
1814
|
+
return useQuery29({
|
|
1804
1815
|
queryKey: ["behio", "product-group", slug, options?.locale, options?.currency],
|
|
1805
1816
|
queryFn: () => unwrap(
|
|
1806
1817
|
client.catalog.getProductGroup(slug, {
|
|
@@ -1814,10 +1825,10 @@ function useProductGroup(slug, options) {
|
|
|
1814
1825
|
}
|
|
1815
1826
|
|
|
1816
1827
|
// src/react/hooks/use-cross-sell.ts
|
|
1817
|
-
import { useQuery as
|
|
1828
|
+
import { useQuery as useQuery30 } from "@tanstack/react-query";
|
|
1818
1829
|
function useCrossSell(productSlug, options) {
|
|
1819
1830
|
const { client } = useBehio();
|
|
1820
|
-
return
|
|
1831
|
+
return useQuery30({
|
|
1821
1832
|
queryKey: ["behio", "cross-sell", productSlug, options?.locale, options?.currency],
|
|
1822
1833
|
queryFn: () => unwrap(
|
|
1823
1834
|
client.catalog.getCrossSell(productSlug, {
|
|
@@ -1831,10 +1842,10 @@ function useCrossSell(productSlug, options) {
|
|
|
1831
1842
|
}
|
|
1832
1843
|
|
|
1833
1844
|
// src/react/hooks/use-product-promotions.ts
|
|
1834
|
-
import { useQuery as
|
|
1845
|
+
import { useQuery as useQuery31 } from "@tanstack/react-query";
|
|
1835
1846
|
function useProductPromotions(productSlug, options) {
|
|
1836
1847
|
const { client } = useBehio();
|
|
1837
|
-
return
|
|
1848
|
+
return useQuery31({
|
|
1838
1849
|
queryKey: ["behio", "product-promotions", productSlug],
|
|
1839
1850
|
queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
|
|
1840
1851
|
enabled: Boolean(productSlug) && (options?.enabled ?? true),
|
|
@@ -1843,11 +1854,11 @@ function useProductPromotions(productSlug, options) {
|
|
|
1843
1854
|
}
|
|
1844
1855
|
|
|
1845
1856
|
// src/react/hooks/use-gift-card.ts
|
|
1846
|
-
import { useQuery as
|
|
1857
|
+
import { useQuery as useQuery32 } from "@tanstack/react-query";
|
|
1847
1858
|
function useGiftCardBalance(code, options) {
|
|
1848
1859
|
const { client } = useBehio();
|
|
1849
1860
|
const trimmed = code?.trim();
|
|
1850
|
-
return
|
|
1861
|
+
return useQuery32({
|
|
1851
1862
|
queryKey: ["behio", "gift-card-balance", trimmed],
|
|
1852
1863
|
queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
|
|
1853
1864
|
enabled: Boolean(trimmed && trimmed.length >= 6) && (options?.enabled ?? true)
|
|
@@ -1855,11 +1866,11 @@ function useGiftCardBalance(code, options) {
|
|
|
1855
1866
|
}
|
|
1856
1867
|
|
|
1857
1868
|
// src/react/hooks/use-wishlist.ts
|
|
1858
|
-
import { useQuery as
|
|
1869
|
+
import { useQuery as useQuery33, useMutation as useMutation12, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
|
|
1859
1870
|
function useWishlist(options) {
|
|
1860
1871
|
const { client } = useBehio();
|
|
1861
1872
|
const qc = useQueryClient12();
|
|
1862
|
-
const query =
|
|
1873
|
+
const query = useQuery33({
|
|
1863
1874
|
queryKey: ["behio", "wishlist"],
|
|
1864
1875
|
queryFn: () => unwrap(client.wishlist.get()),
|
|
1865
1876
|
enabled: options?.enabled ?? true
|
|
@@ -1882,7 +1893,7 @@ function useWishlist(options) {
|
|
|
1882
1893
|
}
|
|
1883
1894
|
function useIsInWishlist(productId) {
|
|
1884
1895
|
const { client } = useBehio();
|
|
1885
|
-
return
|
|
1896
|
+
return useQuery33({
|
|
1886
1897
|
queryKey: ["behio", "wishlist-check", productId],
|
|
1887
1898
|
queryFn: () => unwrap(client.wishlist.isInWishlist(productId)),
|
|
1888
1899
|
enabled: Boolean(productId)
|
|
@@ -1890,10 +1901,10 @@ function useIsInWishlist(productId) {
|
|
|
1890
1901
|
}
|
|
1891
1902
|
|
|
1892
1903
|
// src/react/hooks/use-reviews.ts
|
|
1893
|
-
import { useQuery as
|
|
1904
|
+
import { useQuery as useQuery34, useMutation as useMutation13, useQueryClient as useQueryClient13 } from "@tanstack/react-query";
|
|
1894
1905
|
function useProductReviews(productId, options) {
|
|
1895
1906
|
const { client } = useBehio();
|
|
1896
|
-
return
|
|
1907
|
+
return useQuery34({
|
|
1897
1908
|
queryKey: ["behio", "reviews", productId, options?.page ?? 1],
|
|
1898
1909
|
queryFn: () => unwrap(client.reviews.getProductReviews(productId, options?.page, options?.limit)),
|
|
1899
1910
|
enabled: Boolean(productId) && (options?.enabled ?? true)
|
|
@@ -1909,7 +1920,7 @@ function useSubmitReview() {
|
|
|
1909
1920
|
}
|
|
1910
1921
|
|
|
1911
1922
|
// src/react/hooks/use-returns.ts
|
|
1912
|
-
import { useQuery as
|
|
1923
|
+
import { useQuery as useQuery35, useMutation as useMutation14 } from "@tanstack/react-query";
|
|
1913
1924
|
function useLookupReturnableOrder() {
|
|
1914
1925
|
const { client } = useBehio();
|
|
1915
1926
|
return useMutation14({
|
|
@@ -1924,7 +1935,7 @@ function useSubmitReturn() {
|
|
|
1924
1935
|
}
|
|
1925
1936
|
function useReturnStatus(returnId, email) {
|
|
1926
1937
|
const { client } = useBehio();
|
|
1927
|
-
return
|
|
1938
|
+
return useQuery35({
|
|
1928
1939
|
queryKey: ["behio", "return-status", returnId],
|
|
1929
1940
|
queryFn: () => unwrap(client.returns.getStatus(returnId, email)),
|
|
1930
1941
|
enabled: Boolean(returnId && email)
|
|
@@ -1932,7 +1943,7 @@ function useReturnStatus(returnId, email) {
|
|
|
1932
1943
|
}
|
|
1933
1944
|
|
|
1934
1945
|
// src/react/hooks/use-quotes.ts
|
|
1935
|
-
import { useMutation as useMutation15, useQuery as
|
|
1946
|
+
import { useMutation as useMutation15, useQuery as useQuery36 } from "@tanstack/react-query";
|
|
1936
1947
|
function useSubmitQuote() {
|
|
1937
1948
|
const { client } = useBehio();
|
|
1938
1949
|
return useMutation15({
|
|
@@ -1941,7 +1952,7 @@ function useSubmitQuote() {
|
|
|
1941
1952
|
}
|
|
1942
1953
|
function useQuoteStatus(quoteId, email) {
|
|
1943
1954
|
const { client } = useBehio();
|
|
1944
|
-
return
|
|
1955
|
+
return useQuery36({
|
|
1945
1956
|
queryKey: ["behio", "quote-status", quoteId],
|
|
1946
1957
|
queryFn: () => unwrap(client.quotes.getStatus(quoteId, email)),
|
|
1947
1958
|
enabled: Boolean(quoteId && email)
|
|
@@ -1989,6 +2000,7 @@ export {
|
|
|
1989
2000
|
useCrossSell,
|
|
1990
2001
|
useCurrency,
|
|
1991
2002
|
useCustomer,
|
|
2003
|
+
useFacets,
|
|
1992
2004
|
useFeatured,
|
|
1993
2005
|
useFilters,
|
|
1994
2006
|
useGiftCardBalance,
|