@behio/storefront-sdk 0.27.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-HOL6WRHR.js → chunk-NG46DR3A.js} +59 -9
- package/dist/{chunk-O5UHKZPG.mjs → chunk-O7HDB5R4.mjs} +53 -3
- package/dist/{client-DL533jvY.d.mts → client-CJ_CoUIh.d.mts} +286 -3
- package/dist/{client-DL533jvY.d.ts → client-CJ_CoUIh.d.ts} +286 -3
- 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 +47 -3
- package/dist/react.d.ts +47 -3
- package/dist/react.js +100 -43
- package/dist/react.mjs +109 -52
- package/package.json +3 -3
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,22 +1594,27 @@ 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
|
|
1553
|
-
queryKey: ["behio", "cross-sell", productSlug],
|
|
1554
|
-
queryFn: () => unwrap(
|
|
1600
|
+
return useQuery24({
|
|
1601
|
+
queryKey: ["behio", "cross-sell", productSlug, options?.locale, options?.currency],
|
|
1602
|
+
queryFn: () => unwrap(
|
|
1603
|
+
client.catalog.getCrossSell(productSlug, {
|
|
1604
|
+
locale: options?.locale,
|
|
1605
|
+
currency: options?.currency
|
|
1606
|
+
})
|
|
1607
|
+
),
|
|
1555
1608
|
enabled: Boolean(productSlug) && (options?.enabled ?? true),
|
|
1556
1609
|
initialData: options?.initialData
|
|
1557
1610
|
});
|
|
1558
1611
|
}
|
|
1559
1612
|
|
|
1560
1613
|
// src/react/hooks/use-product-promotions.ts
|
|
1561
|
-
import { useQuery as
|
|
1614
|
+
import { useQuery as useQuery25 } from "@tanstack/react-query";
|
|
1562
1615
|
function useProductPromotions(productSlug, options) {
|
|
1563
1616
|
const { client } = useBehio();
|
|
1564
|
-
return
|
|
1617
|
+
return useQuery25({
|
|
1565
1618
|
queryKey: ["behio", "product-promotions", productSlug],
|
|
1566
1619
|
queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
|
|
1567
1620
|
enabled: Boolean(productSlug) && (options?.enabled ?? true),
|
|
@@ -1570,11 +1623,11 @@ function useProductPromotions(productSlug, options) {
|
|
|
1570
1623
|
}
|
|
1571
1624
|
|
|
1572
1625
|
// src/react/hooks/use-gift-card.ts
|
|
1573
|
-
import { useQuery as
|
|
1626
|
+
import { useQuery as useQuery26 } from "@tanstack/react-query";
|
|
1574
1627
|
function useGiftCardBalance(code, options) {
|
|
1575
1628
|
const { client } = useBehio();
|
|
1576
1629
|
const trimmed = code?.trim();
|
|
1577
|
-
return
|
|
1630
|
+
return useQuery26({
|
|
1578
1631
|
queryKey: ["behio", "gift-card-balance", trimmed],
|
|
1579
1632
|
queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
|
|
1580
1633
|
enabled: Boolean(trimmed && trimmed.length >= 6) && (options?.enabled ?? true)
|
|
@@ -1582,20 +1635,20 @@ function useGiftCardBalance(code, options) {
|
|
|
1582
1635
|
}
|
|
1583
1636
|
|
|
1584
1637
|
// src/react/hooks/use-wishlist.ts
|
|
1585
|
-
import { useQuery as
|
|
1638
|
+
import { useQuery as useQuery27, useMutation as useMutation10, useQueryClient as useQueryClient10 } from "@tanstack/react-query";
|
|
1586
1639
|
function useWishlist(options) {
|
|
1587
1640
|
const { client } = useBehio();
|
|
1588
1641
|
const qc = useQueryClient10();
|
|
1589
|
-
const query =
|
|
1642
|
+
const query = useQuery27({
|
|
1590
1643
|
queryKey: ["behio", "wishlist"],
|
|
1591
1644
|
queryFn: () => unwrap(client.wishlist.get()),
|
|
1592
1645
|
enabled: options?.enabled ?? true
|
|
1593
1646
|
});
|
|
1594
|
-
const addMutation =
|
|
1647
|
+
const addMutation = useMutation10({
|
|
1595
1648
|
mutationFn: (productId) => unwrap(client.wishlist.add(productId)),
|
|
1596
1649
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
|
|
1597
1650
|
});
|
|
1598
|
-
const removeMutation =
|
|
1651
|
+
const removeMutation = useMutation10({
|
|
1599
1652
|
mutationFn: (productId) => unwrap(client.wishlist.remove(productId)),
|
|
1600
1653
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
|
|
1601
1654
|
});
|
|
@@ -1609,7 +1662,7 @@ function useWishlist(options) {
|
|
|
1609
1662
|
}
|
|
1610
1663
|
function useIsInWishlist(productId) {
|
|
1611
1664
|
const { client } = useBehio();
|
|
1612
|
-
return
|
|
1665
|
+
return useQuery27({
|
|
1613
1666
|
queryKey: ["behio", "wishlist-check", productId],
|
|
1614
1667
|
queryFn: () => unwrap(client.wishlist.isInWishlist(productId)),
|
|
1615
1668
|
enabled: Boolean(productId)
|
|
@@ -1617,10 +1670,10 @@ function useIsInWishlist(productId) {
|
|
|
1617
1670
|
}
|
|
1618
1671
|
|
|
1619
1672
|
// src/react/hooks/use-reviews.ts
|
|
1620
|
-
import { useQuery as
|
|
1673
|
+
import { useQuery as useQuery28, useMutation as useMutation11, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
|
|
1621
1674
|
function useProductReviews(productId, options) {
|
|
1622
1675
|
const { client } = useBehio();
|
|
1623
|
-
return
|
|
1676
|
+
return useQuery28({
|
|
1624
1677
|
queryKey: ["behio", "reviews", productId, options?.page ?? 1],
|
|
1625
1678
|
queryFn: () => unwrap(client.reviews.getProductReviews(productId, options?.page, options?.limit)),
|
|
1626
1679
|
enabled: Boolean(productId) && (options?.enabled ?? true)
|
|
@@ -1629,29 +1682,29 @@ function useProductReviews(productId, options) {
|
|
|
1629
1682
|
function useSubmitReview() {
|
|
1630
1683
|
const { client } = useBehio();
|
|
1631
1684
|
const qc = useQueryClient11();
|
|
1632
|
-
return
|
|
1685
|
+
return useMutation11({
|
|
1633
1686
|
mutationFn: (input) => unwrap(client.reviews.submit(input)),
|
|
1634
1687
|
onSuccess: (_, input) => qc.invalidateQueries({ queryKey: ["behio", "reviews", input.productId] })
|
|
1635
1688
|
});
|
|
1636
1689
|
}
|
|
1637
1690
|
|
|
1638
1691
|
// src/react/hooks/use-returns.ts
|
|
1639
|
-
import { useQuery as
|
|
1692
|
+
import { useQuery as useQuery29, useMutation as useMutation12 } from "@tanstack/react-query";
|
|
1640
1693
|
function useLookupReturnableOrder() {
|
|
1641
1694
|
const { client } = useBehio();
|
|
1642
|
-
return
|
|
1695
|
+
return useMutation12({
|
|
1643
1696
|
mutationFn: ({ orderNumber, email }) => unwrap(client.returns.lookupOrder(orderNumber, email))
|
|
1644
1697
|
});
|
|
1645
1698
|
}
|
|
1646
1699
|
function useSubmitReturn() {
|
|
1647
1700
|
const { client } = useBehio();
|
|
1648
|
-
return
|
|
1701
|
+
return useMutation12({
|
|
1649
1702
|
mutationFn: (input) => unwrap(client.returns.submit(input))
|
|
1650
1703
|
});
|
|
1651
1704
|
}
|
|
1652
1705
|
function useReturnStatus(returnId, email) {
|
|
1653
1706
|
const { client } = useBehio();
|
|
1654
|
-
return
|
|
1707
|
+
return useQuery29({
|
|
1655
1708
|
queryKey: ["behio", "return-status", returnId],
|
|
1656
1709
|
queryFn: () => unwrap(client.returns.getStatus(returnId, email)),
|
|
1657
1710
|
enabled: Boolean(returnId && email)
|
|
@@ -1659,16 +1712,16 @@ function useReturnStatus(returnId, email) {
|
|
|
1659
1712
|
}
|
|
1660
1713
|
|
|
1661
1714
|
// src/react/hooks/use-quotes.ts
|
|
1662
|
-
import { useMutation as
|
|
1715
|
+
import { useMutation as useMutation13, useQuery as useQuery30 } from "@tanstack/react-query";
|
|
1663
1716
|
function useSubmitQuote() {
|
|
1664
1717
|
const { client } = useBehio();
|
|
1665
|
-
return
|
|
1718
|
+
return useMutation13({
|
|
1666
1719
|
mutationFn: (input) => unwrap(client.quotes.submit(input))
|
|
1667
1720
|
});
|
|
1668
1721
|
}
|
|
1669
1722
|
function useQuoteStatus(quoteId, email) {
|
|
1670
1723
|
const { client } = useBehio();
|
|
1671
|
-
return
|
|
1724
|
+
return useQuery30({
|
|
1672
1725
|
queryKey: ["behio", "quote-status", quoteId],
|
|
1673
1726
|
queryFn: () => unwrap(client.quotes.getStatus(quoteId, email)),
|
|
1674
1727
|
enabled: Boolean(quoteId && email)
|
|
@@ -1676,10 +1729,10 @@ function useQuoteStatus(quoteId, email) {
|
|
|
1676
1729
|
}
|
|
1677
1730
|
|
|
1678
1731
|
// src/react/hooks/use-back-in-stock.ts
|
|
1679
|
-
import { useMutation as
|
|
1732
|
+
import { useMutation as useMutation14 } from "@tanstack/react-query";
|
|
1680
1733
|
function useNotifyWhenAvailable() {
|
|
1681
1734
|
const { client } = useBehio();
|
|
1682
|
-
return
|
|
1735
|
+
return useMutation14({
|
|
1683
1736
|
mutationFn: ({ productId, email }) => unwrap(client.catalog.notifyWhenAvailable(productId, email))
|
|
1684
1737
|
});
|
|
1685
1738
|
}
|
|
@@ -1717,13 +1770,17 @@ export {
|
|
|
1717
1770
|
useIsInWishlist,
|
|
1718
1771
|
useLabels,
|
|
1719
1772
|
useLookupReturnableOrder,
|
|
1773
|
+
useLoyalty,
|
|
1720
1774
|
useMenu,
|
|
1775
|
+
useNewsletterSubscribe,
|
|
1776
|
+
useNewsletterUnsubscribe,
|
|
1721
1777
|
useNotifyWhenAvailable,
|
|
1722
1778
|
useOrder,
|
|
1723
1779
|
useOrderAccess,
|
|
1724
1780
|
useOrders,
|
|
1725
1781
|
usePage,
|
|
1726
1782
|
usePages,
|
|
1783
|
+
usePickupPoints,
|
|
1727
1784
|
useProduct,
|
|
1728
1785
|
useProductGroup,
|
|
1729
1786
|
useProductPromotions,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behio/storefront-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "TypeScript SDK for Behio Headless E-Shop
|
|
3
|
+
"version": "0.30.0",
|
|
4
|
+
"description": "TypeScript SDK for Behio Headless E-Shop — core client + React hooks",
|
|
5
5
|
"author": "Behio",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -63,4 +63,4 @@
|
|
|
63
63
|
"tsup": "^8.0.0",
|
|
64
64
|
"typescript": "^5.2.0"
|
|
65
65
|
}
|
|
66
|
-
}
|
|
66
|
+
}
|