@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.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-ZOZAJG6T.mjs";
|
|
5
5
|
import {
|
|
6
6
|
BehioStorefront
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-O7HDB5R4.mjs";
|
|
8
8
|
|
|
9
9
|
// src/react/provider.tsx
|
|
10
10
|
import { useRef, useEffect, useMemo, useState, useCallback } from "react";
|
|
@@ -872,6 +872,54 @@ function useAddressAutocomplete(options) {
|
|
|
872
872
|
};
|
|
873
873
|
}
|
|
874
874
|
|
|
875
|
+
// src/react/hooks/use-loyalty.ts
|
|
876
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
877
|
+
var LOYALTY_KEY = ["behio", "loyalty"];
|
|
878
|
+
function useLoyalty(options) {
|
|
879
|
+
const { client } = useBehio();
|
|
880
|
+
const { data, isLoading, error, refetch } = useQuery14({
|
|
881
|
+
queryKey: [...LOYALTY_KEY],
|
|
882
|
+
queryFn: () => unwrap(client.customer.getLoyalty()),
|
|
883
|
+
enabled: options?.enabled !== false && !!client.getAccessToken()
|
|
884
|
+
});
|
|
885
|
+
return { loyalty: data, isLoading, error, refetch };
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
// src/react/hooks/use-pickup-points.ts
|
|
889
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
890
|
+
function usePickupPoints(input) {
|
|
891
|
+
const { client } = useBehio();
|
|
892
|
+
const { methodId, query, country, limit, enabled } = input;
|
|
893
|
+
const { data, isLoading, error, refetch } = useQuery15({
|
|
894
|
+
queryKey: ["behio", "pickup-points", methodId, query ?? "", country ?? "", 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: data?.items ?? [], isLoading, error, refetch };
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
// src/react/hooks/use-newsletter.ts
|
|
909
|
+
import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
910
|
+
function useNewsletterSubscribe() {
|
|
911
|
+
const { client } = useBehio();
|
|
912
|
+
return useMutation5({
|
|
913
|
+
mutationFn: (input) => unwrap(client.newsletter.subscribe(input))
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
function useNewsletterUnsubscribe() {
|
|
917
|
+
const { client } = useBehio();
|
|
918
|
+
return useMutation5({
|
|
919
|
+
mutationFn: (email) => unwrap(client.newsletter.unsubscribe(email))
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
|
|
875
923
|
// src/react/hooks/use-orders.ts
|
|
876
924
|
import { useCallback as useCallback8, useMemo as useMemo3, useState as useState5 } from "react";
|
|
877
925
|
import { useInfiniteQuery as useInfiniteQuery2 } from "@tanstack/react-query";
|
|
@@ -925,7 +973,7 @@ function useOrders(options) {
|
|
|
925
973
|
|
|
926
974
|
// src/react/hooks/use-order.ts
|
|
927
975
|
import { useCallback as useCallback9 } from "react";
|
|
928
|
-
import { useQuery as
|
|
976
|
+
import { useQuery as useQuery16, useMutation as useMutation6, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
929
977
|
function useOrder(orderNumber, options) {
|
|
930
978
|
const { client } = useBehio();
|
|
931
979
|
const queryClient = useQueryClient7();
|
|
@@ -933,12 +981,12 @@ function useOrder(orderNumber, options) {
|
|
|
933
981
|
data,
|
|
934
982
|
isLoading,
|
|
935
983
|
error
|
|
936
|
-
} =
|
|
984
|
+
} = useQuery16({
|
|
937
985
|
queryKey: ["behio", "order", orderNumber],
|
|
938
986
|
queryFn: () => unwrap(client.orders.get(orderNumber)),
|
|
939
987
|
enabled: options?.enabled !== false && !!orderNumber && !!client.getAccessToken()
|
|
940
988
|
});
|
|
941
|
-
const cancelMutation =
|
|
989
|
+
const cancelMutation = useMutation6({
|
|
942
990
|
mutationFn: () => unwrap(client.orders.cancel(orderNumber)),
|
|
943
991
|
onSuccess: (updated) => {
|
|
944
992
|
queryClient.setQueryData(["behio", "order", orderNumber], updated);
|
|
@@ -960,21 +1008,21 @@ function useOrder(orderNumber, options) {
|
|
|
960
1008
|
|
|
961
1009
|
// src/react/hooks/use-order-access.ts
|
|
962
1010
|
import { useCallback as useCallback10, useState as useState6 } from "react";
|
|
963
|
-
import { useMutation as
|
|
1011
|
+
import { useMutation as useMutation7 } from "@tanstack/react-query";
|
|
964
1012
|
function useOrderAccess() {
|
|
965
1013
|
const { client } = useBehio();
|
|
966
1014
|
const [orderNumber, setOrderNumber] = useState6(null);
|
|
967
1015
|
const [email, setEmail] = useState6(null);
|
|
968
1016
|
const [order, setOrder] = useState6(null);
|
|
969
1017
|
const [accessToken, setAccessToken] = useState6(null);
|
|
970
|
-
const requestMutation =
|
|
1018
|
+
const requestMutation = useMutation7({
|
|
971
1019
|
mutationFn: (input) => unwrap(client.orders.requestAccessCode(input.orderNumber, input.email)),
|
|
972
1020
|
onSuccess: (_data, input) => {
|
|
973
1021
|
setOrderNumber(input.orderNumber);
|
|
974
1022
|
setEmail(input.email);
|
|
975
1023
|
}
|
|
976
1024
|
});
|
|
977
|
-
const verifyMutation =
|
|
1025
|
+
const verifyMutation = useMutation7({
|
|
978
1026
|
mutationFn: (code) => {
|
|
979
1027
|
if (!orderNumber || !email) {
|
|
980
1028
|
throw new Error("Request a code before verifying");
|
|
@@ -1020,12 +1068,12 @@ function useOrderAccess() {
|
|
|
1020
1068
|
|
|
1021
1069
|
// src/react/hooks/use-checkout.ts
|
|
1022
1070
|
import { useState as useState7, useCallback as useCallback11 } from "react";
|
|
1023
|
-
import { useMutation as
|
|
1071
|
+
import { useMutation as useMutation8, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
1024
1072
|
function useCheckout() {
|
|
1025
1073
|
const { client, storage } = useBehio();
|
|
1026
1074
|
const queryClient = useQueryClient8();
|
|
1027
1075
|
const [order, setOrder] = useState7(null);
|
|
1028
|
-
const mutation =
|
|
1076
|
+
const mutation = useMutation8({
|
|
1029
1077
|
mutationFn: (input) => unwrap(client.checkout.createOrder(input)),
|
|
1030
1078
|
onSuccess: (result) => {
|
|
1031
1079
|
setOrder(result);
|
|
@@ -1052,10 +1100,10 @@ function useCheckout() {
|
|
|
1052
1100
|
}
|
|
1053
1101
|
|
|
1054
1102
|
// src/react/hooks/use-pages.ts
|
|
1055
|
-
import { useQuery as
|
|
1103
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
1056
1104
|
function usePages(locale, options) {
|
|
1057
1105
|
const { client } = useBehio();
|
|
1058
|
-
return
|
|
1106
|
+
return useQuery17({
|
|
1059
1107
|
queryKey: ["behio", "pages", locale],
|
|
1060
1108
|
queryFn: async () => {
|
|
1061
1109
|
const result = await unwrap(client.pages.list(locale));
|
|
@@ -1066,7 +1114,7 @@ function usePages(locale, options) {
|
|
|
1066
1114
|
}
|
|
1067
1115
|
function usePage(slug, locale, options) {
|
|
1068
1116
|
const { client } = useBehio();
|
|
1069
|
-
return
|
|
1117
|
+
return useQuery17({
|
|
1070
1118
|
queryKey: ["behio", "page", slug, locale],
|
|
1071
1119
|
queryFn: () => unwrap(client.pages.get(slug, locale)),
|
|
1072
1120
|
enabled: options?.enabled !== false && !!slug
|
|
@@ -1074,10 +1122,10 @@ function usePage(slug, locale, options) {
|
|
|
1074
1122
|
}
|
|
1075
1123
|
|
|
1076
1124
|
// src/react/hooks/use-shop-info.ts
|
|
1077
|
-
import { useQuery as
|
|
1125
|
+
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
1078
1126
|
function useShopInfo(options) {
|
|
1079
1127
|
const { client } = useBehio();
|
|
1080
|
-
return
|
|
1128
|
+
return useQuery18({
|
|
1081
1129
|
queryKey: ["behio", "shop-info"],
|
|
1082
1130
|
queryFn: () => unwrap(client.getShopInfo()),
|
|
1083
1131
|
enabled: options?.enabled !== false
|
|
@@ -1085,10 +1133,10 @@ function useShopInfo(options) {
|
|
|
1085
1133
|
}
|
|
1086
1134
|
|
|
1087
1135
|
// src/react/hooks/use-shop-scripts.ts
|
|
1088
|
-
import { useQuery as
|
|
1136
|
+
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
1089
1137
|
function useShopScripts(options) {
|
|
1090
1138
|
const { client } = useBehio();
|
|
1091
|
-
return
|
|
1139
|
+
return useQuery19({
|
|
1092
1140
|
queryKey: ["behio", "shop-scripts"],
|
|
1093
1141
|
queryFn: () => unwrap(client.getShopScripts()),
|
|
1094
1142
|
enabled: options?.enabled !== false
|
|
@@ -1096,11 +1144,11 @@ function useShopScripts(options) {
|
|
|
1096
1144
|
}
|
|
1097
1145
|
|
|
1098
1146
|
// src/react/hooks/use-shop-seo.ts
|
|
1099
|
-
import { useQuery as
|
|
1147
|
+
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
1100
1148
|
function useShopSeo(options) {
|
|
1101
1149
|
const { client } = useBehio();
|
|
1102
1150
|
const { locale, initialData, enabled = true } = options ?? {};
|
|
1103
|
-
return
|
|
1151
|
+
return useQuery20({
|
|
1104
1152
|
queryKey: ["behio", "shop-seo", locale ?? "_default"],
|
|
1105
1153
|
queryFn: () => unwrap(client.getShopSeo(locale)),
|
|
1106
1154
|
initialData,
|
|
@@ -1163,20 +1211,20 @@ function CurrencySwitcher({
|
|
|
1163
1211
|
import { useEffect as useEffect4, useMemo as useMemo4, useState as useState8 } from "react";
|
|
1164
1212
|
|
|
1165
1213
|
// src/react/hooks/use-consent.ts
|
|
1166
|
-
import { useQuery as
|
|
1214
|
+
import { useQuery as useQuery21, useMutation as useMutation9, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
1167
1215
|
function useCookieConsent(visitorId) {
|
|
1168
1216
|
const { client } = useBehio();
|
|
1169
1217
|
const qc = useQueryClient9();
|
|
1170
|
-
const query =
|
|
1218
|
+
const query = useQuery21({
|
|
1171
1219
|
queryKey: ["behio", "consent", visitorId],
|
|
1172
1220
|
queryFn: () => unwrap(client.consent.get(visitorId)),
|
|
1173
1221
|
enabled: Boolean(visitorId)
|
|
1174
1222
|
});
|
|
1175
|
-
const recordMutation =
|
|
1223
|
+
const recordMutation = useMutation9({
|
|
1176
1224
|
mutationFn: (input) => unwrap(client.consent.record(input)),
|
|
1177
1225
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "consent"] })
|
|
1178
1226
|
});
|
|
1179
|
-
const revokeMutation =
|
|
1227
|
+
const revokeMutation = useMutation9({
|
|
1180
1228
|
mutationFn: () => unwrap(client.consent.revoke(visitorId)),
|
|
1181
1229
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "consent"] })
|
|
1182
1230
|
});
|
|
@@ -1508,10 +1556,10 @@ function utmFromSearch(search) {
|
|
|
1508
1556
|
}
|
|
1509
1557
|
|
|
1510
1558
|
// src/react/hooks/use-bundles.ts
|
|
1511
|
-
import { useQuery as
|
|
1559
|
+
import { useQuery as useQuery22 } from "@tanstack/react-query";
|
|
1512
1560
|
function useBundles(options) {
|
|
1513
1561
|
const { client } = useBehio();
|
|
1514
|
-
return
|
|
1562
|
+
return useQuery22({
|
|
1515
1563
|
queryKey: ["behio", "bundles"],
|
|
1516
1564
|
queryFn: () => unwrap(client.catalog.getBundles()),
|
|
1517
1565
|
enabled: options?.enabled ?? true,
|
|
@@ -1520,7 +1568,7 @@ function useBundles(options) {
|
|
|
1520
1568
|
}
|
|
1521
1569
|
function useBundle(slug, options) {
|
|
1522
1570
|
const { client } = useBehio();
|
|
1523
|
-
return
|
|
1571
|
+
return useQuery22({
|
|
1524
1572
|
queryKey: ["behio", "bundle", slug],
|
|
1525
1573
|
queryFn: () => unwrap(client.catalog.getBundle(slug)),
|
|
1526
1574
|
enabled: Boolean(slug) && (options?.enabled ?? true),
|
|
@@ -1529,10 +1577,10 @@ function useBundle(slug, options) {
|
|
|
1529
1577
|
}
|
|
1530
1578
|
|
|
1531
1579
|
// src/react/hooks/use-product-group.ts
|
|
1532
|
-
import { useQuery as
|
|
1580
|
+
import { useQuery as useQuery23 } from "@tanstack/react-query";
|
|
1533
1581
|
function useProductGroup(slug, options) {
|
|
1534
1582
|
const { client } = useBehio();
|
|
1535
|
-
return
|
|
1583
|
+
return useQuery23({
|
|
1536
1584
|
queryKey: ["behio", "product-group", slug, options?.locale, options?.currency],
|
|
1537
1585
|
queryFn: () => unwrap(
|
|
1538
1586
|
client.catalog.getProductGroup(slug, {
|
|
@@ -1546,10 +1594,10 @@ function useProductGroup(slug, options) {
|
|
|
1546
1594
|
}
|
|
1547
1595
|
|
|
1548
1596
|
// src/react/hooks/use-cross-sell.ts
|
|
1549
|
-
import { useQuery as
|
|
1597
|
+
import { useQuery as useQuery24 } from "@tanstack/react-query";
|
|
1550
1598
|
function useCrossSell(productSlug, options) {
|
|
1551
1599
|
const { client } = useBehio();
|
|
1552
|
-
return
|
|
1600
|
+
return useQuery24({
|
|
1553
1601
|
queryKey: ["behio", "cross-sell", productSlug, options?.locale, options?.currency],
|
|
1554
1602
|
queryFn: () => unwrap(
|
|
1555
1603
|
client.catalog.getCrossSell(productSlug, {
|
|
@@ -1563,10 +1611,10 @@ function useCrossSell(productSlug, options) {
|
|
|
1563
1611
|
}
|
|
1564
1612
|
|
|
1565
1613
|
// src/react/hooks/use-product-promotions.ts
|
|
1566
|
-
import { useQuery as
|
|
1614
|
+
import { useQuery as useQuery25 } from "@tanstack/react-query";
|
|
1567
1615
|
function useProductPromotions(productSlug, options) {
|
|
1568
1616
|
const { client } = useBehio();
|
|
1569
|
-
return
|
|
1617
|
+
return useQuery25({
|
|
1570
1618
|
queryKey: ["behio", "product-promotions", productSlug],
|
|
1571
1619
|
queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
|
|
1572
1620
|
enabled: Boolean(productSlug) && (options?.enabled ?? true),
|
|
@@ -1575,11 +1623,11 @@ function useProductPromotions(productSlug, options) {
|
|
|
1575
1623
|
}
|
|
1576
1624
|
|
|
1577
1625
|
// src/react/hooks/use-gift-card.ts
|
|
1578
|
-
import { useQuery as
|
|
1626
|
+
import { useQuery as useQuery26 } from "@tanstack/react-query";
|
|
1579
1627
|
function useGiftCardBalance(code, options) {
|
|
1580
1628
|
const { client } = useBehio();
|
|
1581
1629
|
const trimmed = code?.trim();
|
|
1582
|
-
return
|
|
1630
|
+
return useQuery26({
|
|
1583
1631
|
queryKey: ["behio", "gift-card-balance", trimmed],
|
|
1584
1632
|
queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
|
|
1585
1633
|
enabled: Boolean(trimmed && trimmed.length >= 6) && (options?.enabled ?? true)
|
|
@@ -1587,20 +1635,20 @@ function useGiftCardBalance(code, options) {
|
|
|
1587
1635
|
}
|
|
1588
1636
|
|
|
1589
1637
|
// src/react/hooks/use-wishlist.ts
|
|
1590
|
-
import { useQuery as
|
|
1638
|
+
import { useQuery as useQuery27, useMutation as useMutation10, useQueryClient as useQueryClient10 } from "@tanstack/react-query";
|
|
1591
1639
|
function useWishlist(options) {
|
|
1592
1640
|
const { client } = useBehio();
|
|
1593
1641
|
const qc = useQueryClient10();
|
|
1594
|
-
const query =
|
|
1642
|
+
const query = useQuery27({
|
|
1595
1643
|
queryKey: ["behio", "wishlist"],
|
|
1596
1644
|
queryFn: () => unwrap(client.wishlist.get()),
|
|
1597
1645
|
enabled: options?.enabled ?? true
|
|
1598
1646
|
});
|
|
1599
|
-
const addMutation =
|
|
1647
|
+
const addMutation = useMutation10({
|
|
1600
1648
|
mutationFn: (productId) => unwrap(client.wishlist.add(productId)),
|
|
1601
1649
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
|
|
1602
1650
|
});
|
|
1603
|
-
const removeMutation =
|
|
1651
|
+
const removeMutation = useMutation10({
|
|
1604
1652
|
mutationFn: (productId) => unwrap(client.wishlist.remove(productId)),
|
|
1605
1653
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
|
|
1606
1654
|
});
|
|
@@ -1614,7 +1662,7 @@ function useWishlist(options) {
|
|
|
1614
1662
|
}
|
|
1615
1663
|
function useIsInWishlist(productId) {
|
|
1616
1664
|
const { client } = useBehio();
|
|
1617
|
-
return
|
|
1665
|
+
return useQuery27({
|
|
1618
1666
|
queryKey: ["behio", "wishlist-check", productId],
|
|
1619
1667
|
queryFn: () => unwrap(client.wishlist.isInWishlist(productId)),
|
|
1620
1668
|
enabled: Boolean(productId)
|
|
@@ -1622,10 +1670,10 @@ function useIsInWishlist(productId) {
|
|
|
1622
1670
|
}
|
|
1623
1671
|
|
|
1624
1672
|
// src/react/hooks/use-reviews.ts
|
|
1625
|
-
import { useQuery as
|
|
1673
|
+
import { useQuery as useQuery28, useMutation as useMutation11, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
|
|
1626
1674
|
function useProductReviews(productId, options) {
|
|
1627
1675
|
const { client } = useBehio();
|
|
1628
|
-
return
|
|
1676
|
+
return useQuery28({
|
|
1629
1677
|
queryKey: ["behio", "reviews", productId, options?.page ?? 1],
|
|
1630
1678
|
queryFn: () => unwrap(client.reviews.getProductReviews(productId, options?.page, options?.limit)),
|
|
1631
1679
|
enabled: Boolean(productId) && (options?.enabled ?? true)
|
|
@@ -1634,29 +1682,29 @@ function useProductReviews(productId, options) {
|
|
|
1634
1682
|
function useSubmitReview() {
|
|
1635
1683
|
const { client } = useBehio();
|
|
1636
1684
|
const qc = useQueryClient11();
|
|
1637
|
-
return
|
|
1685
|
+
return useMutation11({
|
|
1638
1686
|
mutationFn: (input) => unwrap(client.reviews.submit(input)),
|
|
1639
1687
|
onSuccess: (_, input) => qc.invalidateQueries({ queryKey: ["behio", "reviews", input.productId] })
|
|
1640
1688
|
});
|
|
1641
1689
|
}
|
|
1642
1690
|
|
|
1643
1691
|
// src/react/hooks/use-returns.ts
|
|
1644
|
-
import { useQuery as
|
|
1692
|
+
import { useQuery as useQuery29, useMutation as useMutation12 } from "@tanstack/react-query";
|
|
1645
1693
|
function useLookupReturnableOrder() {
|
|
1646
1694
|
const { client } = useBehio();
|
|
1647
|
-
return
|
|
1695
|
+
return useMutation12({
|
|
1648
1696
|
mutationFn: ({ orderNumber, email }) => unwrap(client.returns.lookupOrder(orderNumber, email))
|
|
1649
1697
|
});
|
|
1650
1698
|
}
|
|
1651
1699
|
function useSubmitReturn() {
|
|
1652
1700
|
const { client } = useBehio();
|
|
1653
|
-
return
|
|
1701
|
+
return useMutation12({
|
|
1654
1702
|
mutationFn: (input) => unwrap(client.returns.submit(input))
|
|
1655
1703
|
});
|
|
1656
1704
|
}
|
|
1657
1705
|
function useReturnStatus(returnId, email) {
|
|
1658
1706
|
const { client } = useBehio();
|
|
1659
|
-
return
|
|
1707
|
+
return useQuery29({
|
|
1660
1708
|
queryKey: ["behio", "return-status", returnId],
|
|
1661
1709
|
queryFn: () => unwrap(client.returns.getStatus(returnId, email)),
|
|
1662
1710
|
enabled: Boolean(returnId && email)
|
|
@@ -1664,16 +1712,16 @@ function useReturnStatus(returnId, email) {
|
|
|
1664
1712
|
}
|
|
1665
1713
|
|
|
1666
1714
|
// src/react/hooks/use-quotes.ts
|
|
1667
|
-
import { useMutation as
|
|
1715
|
+
import { useMutation as useMutation13, useQuery as useQuery30 } from "@tanstack/react-query";
|
|
1668
1716
|
function useSubmitQuote() {
|
|
1669
1717
|
const { client } = useBehio();
|
|
1670
|
-
return
|
|
1718
|
+
return useMutation13({
|
|
1671
1719
|
mutationFn: (input) => unwrap(client.quotes.submit(input))
|
|
1672
1720
|
});
|
|
1673
1721
|
}
|
|
1674
1722
|
function useQuoteStatus(quoteId, email) {
|
|
1675
1723
|
const { client } = useBehio();
|
|
1676
|
-
return
|
|
1724
|
+
return useQuery30({
|
|
1677
1725
|
queryKey: ["behio", "quote-status", quoteId],
|
|
1678
1726
|
queryFn: () => unwrap(client.quotes.getStatus(quoteId, email)),
|
|
1679
1727
|
enabled: Boolean(quoteId && email)
|
|
@@ -1681,10 +1729,10 @@ function useQuoteStatus(quoteId, email) {
|
|
|
1681
1729
|
}
|
|
1682
1730
|
|
|
1683
1731
|
// src/react/hooks/use-back-in-stock.ts
|
|
1684
|
-
import { useMutation as
|
|
1732
|
+
import { useMutation as useMutation14 } from "@tanstack/react-query";
|
|
1685
1733
|
function useNotifyWhenAvailable() {
|
|
1686
1734
|
const { client } = useBehio();
|
|
1687
|
-
return
|
|
1735
|
+
return useMutation14({
|
|
1688
1736
|
mutationFn: ({ productId, email }) => unwrap(client.catalog.notifyWhenAvailable(productId, email))
|
|
1689
1737
|
});
|
|
1690
1738
|
}
|
|
@@ -1722,13 +1770,17 @@ export {
|
|
|
1722
1770
|
useIsInWishlist,
|
|
1723
1771
|
useLabels,
|
|
1724
1772
|
useLookupReturnableOrder,
|
|
1773
|
+
useLoyalty,
|
|
1725
1774
|
useMenu,
|
|
1775
|
+
useNewsletterSubscribe,
|
|
1776
|
+
useNewsletterUnsubscribe,
|
|
1726
1777
|
useNotifyWhenAvailable,
|
|
1727
1778
|
useOrder,
|
|
1728
1779
|
useOrderAccess,
|
|
1729
1780
|
useOrders,
|
|
1730
1781
|
usePage,
|
|
1731
1782
|
usePages,
|
|
1783
|
+
usePickupPoints,
|
|
1732
1784
|
useProduct,
|
|
1733
1785
|
useProductGroup,
|
|
1734
1786
|
useProductPromotions,
|