@behio/storefront-sdk 0.37.0 → 0.38.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/react.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-QUU76QUB.mjs";
9
9
  import {
10
10
  BehioStorefront
11
- } from "./chunk-5C6MNGGB.mjs";
11
+ } from "./chunk-MF5LMHZ4.mjs";
12
12
 
13
13
  // src/react/provider.tsx
14
14
  import { useRef, useEffect, useMemo, useState, useCallback } from "react";
@@ -900,27 +900,63 @@ function useLoyalty(options) {
900
900
  return { loyalty: data, isLoading, error, refetch };
901
901
  }
902
902
 
903
+ // src/react/hooks/use-courses.ts
904
+ import { useMutation as useMutation5, useQuery as useQuery16, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
905
+ var COURSES_KEY = ["behio", "courses"];
906
+ function useCourses(options) {
907
+ const { client } = useBehio();
908
+ const { data, isLoading, error, refetch } = useQuery16({
909
+ queryKey: [...COURSES_KEY],
910
+ queryFn: () => unwrap(client.customer.getCourses()),
911
+ enabled: options?.enabled !== false && !!client.getAccessToken()
912
+ });
913
+ return { courses: data?.items ?? [], isLoading, error, refetch };
914
+ }
915
+ function useCourse(courseId, options) {
916
+ const { client } = useBehio();
917
+ const queryClient = useQueryClient7();
918
+ const { data, isLoading, error, refetch } = useQuery16({
919
+ queryKey: [...COURSES_KEY, courseId],
920
+ queryFn: () => unwrap(client.customer.getCourse(courseId)),
921
+ enabled: options?.enabled !== false && !!courseId && !!client.getAccessToken()
922
+ });
923
+ const complete = useMutation5({
924
+ mutationFn: ({ lessonId }) => unwrap(client.customer.completeLesson(courseId, lessonId)),
925
+ onSuccess: () => {
926
+ void queryClient.invalidateQueries({ queryKey: [...COURSES_KEY] });
927
+ }
928
+ });
929
+ return {
930
+ course: data,
931
+ isLoading,
932
+ error,
933
+ refetch,
934
+ completeLesson: (lessonId) => complete.mutateAsync({ lessonId }),
935
+ isCompleting: complete.isPending
936
+ };
937
+ }
938
+
903
939
  // src/react/hooks/use-subscriptions.ts
904
- import { useQuery as useQuery16, useMutation as useMutation5, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
940
+ import { useQuery as useQuery17, useMutation as useMutation6, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
905
941
  var SUBSCRIPTIONS_KEY = ["behio", "subscriptions"];
906
942
  function useSubscriptions(options) {
907
943
  const { client } = useBehio();
908
- const qc = useQueryClient7();
909
- const query = useQuery16({
944
+ const qc = useQueryClient8();
945
+ const query = useQuery17({
910
946
  queryKey: [...SUBSCRIPTIONS_KEY],
911
947
  queryFn: () => unwrap(client.subscriptions.list()),
912
948
  enabled: options?.enabled !== false && !!client.getAccessToken()
913
949
  });
914
950
  const invalidate = () => qc.invalidateQueries({ queryKey: [...SUBSCRIPTIONS_KEY] });
915
- const pauseMutation = useMutation5({
951
+ const pauseMutation = useMutation6({
916
952
  mutationFn: (subscriptionId) => unwrap(client.subscriptions.pause(subscriptionId)),
917
953
  onSuccess: invalidate
918
954
  });
919
- const resumeMutation = useMutation5({
955
+ const resumeMutation = useMutation6({
920
956
  mutationFn: (subscriptionId) => unwrap(client.subscriptions.resume(subscriptionId)),
921
957
  onSuccess: invalidate
922
958
  });
923
- const cancelMutation = useMutation5({
959
+ const cancelMutation = useMutation6({
924
960
  mutationFn: (subscriptionId) => unwrap(client.subscriptions.cancel(subscriptionId)),
925
961
  onSuccess: invalidate
926
962
  });
@@ -939,11 +975,11 @@ function useSubscriptions(options) {
939
975
  }
940
976
 
941
977
  // src/react/hooks/use-pickup-points.ts
942
- import { useQuery as useQuery17 } from "@tanstack/react-query";
978
+ import { useQuery as useQuery18 } from "@tanstack/react-query";
943
979
  function usePickupPoints(input) {
944
980
  const { client } = useBehio();
945
981
  const { methodId, query, country, limit, enabled } = input;
946
- const { data, isLoading, error, refetch } = useQuery17({
982
+ const { data, isLoading, error, refetch } = useQuery18({
947
983
  queryKey: ["behio", "pickup-points", methodId, query ?? "", country ?? "", limit ?? 30],
948
984
  queryFn: () => unwrap(
949
985
  client.shipping.getPickupPoints({
@@ -959,12 +995,12 @@ function usePickupPoints(input) {
959
995
  }
960
996
 
961
997
  // src/react/hooks/use-shipping-methods.ts
962
- import { useQuery as useQuery18 } from "@tanstack/react-query";
998
+ import { useQuery as useQuery19 } from "@tanstack/react-query";
963
999
  function useShippingMethods(options) {
964
1000
  const { client, currency: activeCurrency } = useBehio();
965
1001
  const currency = options?.currency ?? activeCurrency;
966
1002
  const { country, cartTotal, cartWeightKg } = options ?? {};
967
- const { data, isLoading, error, refetch } = useQuery18({
1003
+ const { data, isLoading, error, refetch } = useQuery19({
968
1004
  queryKey: [
969
1005
  "behio",
970
1006
  "shipping-methods",
@@ -980,12 +1016,12 @@ function useShippingMethods(options) {
980
1016
  }
981
1017
 
982
1018
  // src/react/hooks/use-shipping-quote.ts
983
- import { useQuery as useQuery19 } from "@tanstack/react-query";
1019
+ import { useQuery as useQuery20 } from "@tanstack/react-query";
984
1020
  function useShippingQuote(options) {
985
1021
  const { client, currency: activeCurrency } = useBehio();
986
1022
  const { destinationAddress, items, cartTotal, enabled } = options ?? {};
987
1023
  const currency = options?.currency ?? activeCurrency;
988
- const { data, isLoading, error, refetch } = useQuery19({
1024
+ const { data, isLoading, error, refetch } = useQuery20({
989
1025
  queryKey: [
990
1026
  "behio",
991
1027
  "shipping-quote",
@@ -1008,11 +1044,11 @@ function useShippingQuote(options) {
1008
1044
  }
1009
1045
 
1010
1046
  // src/react/hooks/use-payment-methods.ts
1011
- import { useQuery as useQuery20 } from "@tanstack/react-query";
1047
+ import { useQuery as useQuery21 } from "@tanstack/react-query";
1012
1048
  function usePaymentMethods(options) {
1013
1049
  const { client, currency: activeCurrency } = useBehio();
1014
1050
  const currency = options?.currency ?? activeCurrency;
1015
- const { data, isLoading, error, refetch } = useQuery20({
1051
+ const { data, isLoading, error, refetch } = useQuery21({
1016
1052
  queryKey: ["behio", "payment-methods", currency ?? ""],
1017
1053
  queryFn: () => unwrap(client.catalog.listPaymentMethods({ currency })),
1018
1054
  enabled: options?.enabled !== false
@@ -1022,10 +1058,10 @@ function usePaymentMethods(options) {
1022
1058
 
1023
1059
  // src/react/hooks/use-personal-offers.ts
1024
1060
  import { useCallback as useCallback8, useEffect as useEffect4, useState as useState5 } from "react";
1025
- import { useMutation as useMutation6, useQuery as useQuery21, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
1061
+ import { useMutation as useMutation7, useQuery as useQuery22, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
1026
1062
  function usePersonalOffers(options) {
1027
1063
  const { client } = useBehio();
1028
- const queryClient = useQueryClient8();
1064
+ const queryClient = useQueryClient9();
1029
1065
  const [polledVid, setPolledVid] = useState5(null);
1030
1066
  const explicitVid = options?.visitorId;
1031
1067
  useEffect4(() => {
@@ -1043,12 +1079,12 @@ function usePersonalOffers(options) {
1043
1079
  }, [client, explicitVid]);
1044
1080
  const visitorId = explicitVid ?? polledVid;
1045
1081
  const queryKey = ["behio", "personal-offers", visitorId ?? ""];
1046
- const { data, isLoading, error, refetch } = useQuery21({
1082
+ const { data, isLoading, error, refetch } = useQuery22({
1047
1083
  queryKey,
1048
1084
  queryFn: () => unwrap(client.getPersonalOffers(visitorId)),
1049
1085
  enabled: options?.enabled !== false && !!visitorId
1050
1086
  });
1051
- const claimMutation = useMutation6({
1087
+ const claimMutation = useMutation7({
1052
1088
  mutationFn: ({ offerId, email }) => unwrap(client.claimOfferByEmail(offerId, { visitorId, email })),
1053
1089
  onSuccess: (result, { offerId }) => {
1054
1090
  queryClient.setQueryData(
@@ -1110,16 +1146,16 @@ function useAnalyticsEvents() {
1110
1146
  }
1111
1147
 
1112
1148
  // src/react/hooks/use-newsletter.ts
1113
- import { useMutation as useMutation7 } from "@tanstack/react-query";
1149
+ import { useMutation as useMutation8 } from "@tanstack/react-query";
1114
1150
  function useNewsletterSubscribe() {
1115
1151
  const { client } = useBehio();
1116
- return useMutation7({
1152
+ return useMutation8({
1117
1153
  mutationFn: (input) => unwrap(client.newsletter.subscribe(input))
1118
1154
  });
1119
1155
  }
1120
1156
  function useNewsletterUnsubscribe() {
1121
1157
  const { client } = useBehio();
1122
- return useMutation7({
1158
+ return useMutation8({
1123
1159
  mutationFn: (email) => unwrap(client.newsletter.unsubscribe(email))
1124
1160
  });
1125
1161
  }
@@ -1177,20 +1213,20 @@ function useOrders(options) {
1177
1213
 
1178
1214
  // src/react/hooks/use-order.ts
1179
1215
  import { useCallback as useCallback11 } from "react";
1180
- import { useQuery as useQuery22, useMutation as useMutation8, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
1216
+ import { useQuery as useQuery23, useMutation as useMutation9, useQueryClient as useQueryClient10 } from "@tanstack/react-query";
1181
1217
  function useOrder(orderNumber, options) {
1182
1218
  const { client } = useBehio();
1183
- const queryClient = useQueryClient9();
1219
+ const queryClient = useQueryClient10();
1184
1220
  const {
1185
1221
  data,
1186
1222
  isLoading,
1187
1223
  error
1188
- } = useQuery22({
1224
+ } = useQuery23({
1189
1225
  queryKey: ["behio", "order", orderNumber],
1190
1226
  queryFn: () => unwrap(client.orders.get(orderNumber)),
1191
1227
  enabled: options?.enabled !== false && !!orderNumber && !!client.getAccessToken()
1192
1228
  });
1193
- const cancelMutation = useMutation8({
1229
+ const cancelMutation = useMutation9({
1194
1230
  mutationFn: () => unwrap(client.orders.cancel(orderNumber)),
1195
1231
  onSuccess: (updated) => {
1196
1232
  queryClient.setQueryData(["behio", "order", orderNumber], updated);
@@ -1212,21 +1248,21 @@ function useOrder(orderNumber, options) {
1212
1248
 
1213
1249
  // src/react/hooks/use-order-access.ts
1214
1250
  import { useCallback as useCallback12, useState as useState7 } from "react";
1215
- import { useMutation as useMutation9 } from "@tanstack/react-query";
1251
+ import { useMutation as useMutation10 } from "@tanstack/react-query";
1216
1252
  function useOrderAccess() {
1217
1253
  const { client } = useBehio();
1218
1254
  const [orderNumber, setOrderNumber] = useState7(null);
1219
1255
  const [email, setEmail] = useState7(null);
1220
1256
  const [order, setOrder] = useState7(null);
1221
1257
  const [accessToken, setAccessToken] = useState7(null);
1222
- const requestMutation = useMutation9({
1258
+ const requestMutation = useMutation10({
1223
1259
  mutationFn: (input) => unwrap(client.orders.requestAccessCode(input.orderNumber, input.email)),
1224
1260
  onSuccess: (_data, input) => {
1225
1261
  setOrderNumber(input.orderNumber);
1226
1262
  setEmail(input.email);
1227
1263
  }
1228
1264
  });
1229
- const verifyMutation = useMutation9({
1265
+ const verifyMutation = useMutation10({
1230
1266
  mutationFn: (code) => {
1231
1267
  if (!orderNumber || !email) {
1232
1268
  throw new Error("Request a code before verifying");
@@ -1272,12 +1308,12 @@ function useOrderAccess() {
1272
1308
 
1273
1309
  // src/react/hooks/use-checkout.ts
1274
1310
  import { useState as useState8, useCallback as useCallback13 } from "react";
1275
- import { useMutation as useMutation10, useQueryClient as useQueryClient10 } from "@tanstack/react-query";
1311
+ import { useMutation as useMutation11, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
1276
1312
  function useCheckout() {
1277
1313
  const { client, storage } = useBehio();
1278
- const queryClient = useQueryClient10();
1314
+ const queryClient = useQueryClient11();
1279
1315
  const [order, setOrder] = useState8(null);
1280
- const mutation = useMutation10({
1316
+ const mutation = useMutation11({
1281
1317
  mutationFn: (input) => unwrap(client.checkout.createOrder(input)),
1282
1318
  onSuccess: (result) => {
1283
1319
  setOrder(result);
@@ -1304,10 +1340,10 @@ function useCheckout() {
1304
1340
  }
1305
1341
 
1306
1342
  // src/react/hooks/use-pages.ts
1307
- import { useQuery as useQuery23 } from "@tanstack/react-query";
1343
+ import { useQuery as useQuery24 } from "@tanstack/react-query";
1308
1344
  function usePages(locale, options) {
1309
1345
  const { client } = useBehio();
1310
- return useQuery23({
1346
+ return useQuery24({
1311
1347
  queryKey: ["behio", "pages", locale],
1312
1348
  queryFn: async () => {
1313
1349
  const result = await unwrap(client.pages.list(locale));
@@ -1318,7 +1354,7 @@ function usePages(locale, options) {
1318
1354
  }
1319
1355
  function usePage(slug, locale, options) {
1320
1356
  const { client } = useBehio();
1321
- return useQuery23({
1357
+ return useQuery24({
1322
1358
  queryKey: ["behio", "page", slug, locale],
1323
1359
  queryFn: () => unwrap(client.pages.get(slug, locale)),
1324
1360
  enabled: options?.enabled !== false && !!slug
@@ -1326,10 +1362,10 @@ function usePage(slug, locale, options) {
1326
1362
  }
1327
1363
 
1328
1364
  // src/react/hooks/use-shop-info.ts
1329
- import { useQuery as useQuery24 } from "@tanstack/react-query";
1365
+ import { useQuery as useQuery25 } from "@tanstack/react-query";
1330
1366
  function useShopInfo(options) {
1331
1367
  const { client } = useBehio();
1332
- return useQuery24({
1368
+ return useQuery25({
1333
1369
  queryKey: ["behio", "shop-info"],
1334
1370
  queryFn: () => unwrap(client.getShopInfo()),
1335
1371
  enabled: options?.enabled !== false
@@ -1337,10 +1373,10 @@ function useShopInfo(options) {
1337
1373
  }
1338
1374
 
1339
1375
  // src/react/hooks/use-shop-scripts.ts
1340
- import { useQuery as useQuery25 } from "@tanstack/react-query";
1376
+ import { useQuery as useQuery26 } from "@tanstack/react-query";
1341
1377
  function useShopScripts(options) {
1342
1378
  const { client } = useBehio();
1343
- return useQuery25({
1379
+ return useQuery26({
1344
1380
  queryKey: ["behio", "shop-scripts"],
1345
1381
  queryFn: () => unwrap(client.getShopScripts()),
1346
1382
  enabled: options?.enabled !== false
@@ -1348,11 +1384,11 @@ function useShopScripts(options) {
1348
1384
  }
1349
1385
 
1350
1386
  // src/react/hooks/use-shop-seo.ts
1351
- import { useQuery as useQuery26 } from "@tanstack/react-query";
1387
+ import { useQuery as useQuery27 } from "@tanstack/react-query";
1352
1388
  function useShopSeo(options) {
1353
1389
  const { client } = useBehio();
1354
1390
  const { locale, initialData, enabled = true } = options ?? {};
1355
- return useQuery26({
1391
+ return useQuery27({
1356
1392
  queryKey: ["behio", "shop-seo", locale ?? "_default"],
1357
1393
  queryFn: () => unwrap(client.getShopSeo(locale)),
1358
1394
  initialData,
@@ -1415,20 +1451,20 @@ function CurrencySwitcher({
1415
1451
  import { useEffect as useEffect5, useMemo as useMemo4, useState as useState9 } from "react";
1416
1452
 
1417
1453
  // src/react/hooks/use-consent.ts
1418
- import { useQuery as useQuery27, useMutation as useMutation11, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
1454
+ import { useQuery as useQuery28, useMutation as useMutation12, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
1419
1455
  function useCookieConsent(visitorId) {
1420
1456
  const { client } = useBehio();
1421
- const qc = useQueryClient11();
1422
- const query = useQuery27({
1457
+ const qc = useQueryClient12();
1458
+ const query = useQuery28({
1423
1459
  queryKey: ["behio", "consent", visitorId],
1424
1460
  queryFn: () => unwrap(client.consent.get(visitorId)),
1425
1461
  enabled: Boolean(visitorId)
1426
1462
  });
1427
- const recordMutation = useMutation11({
1463
+ const recordMutation = useMutation12({
1428
1464
  mutationFn: (input) => unwrap(client.consent.record(input)),
1429
1465
  onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "consent"] })
1430
1466
  });
1431
- const revokeMutation = useMutation11({
1467
+ const revokeMutation = useMutation12({
1432
1468
  mutationFn: () => unwrap(client.consent.revoke(visitorId)),
1433
1469
  onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "consent"] })
1434
1470
  });
@@ -1787,10 +1823,10 @@ function utmFromSearch(search) {
1787
1823
  }
1788
1824
 
1789
1825
  // src/react/hooks/use-bundles.ts
1790
- import { useQuery as useQuery28 } from "@tanstack/react-query";
1826
+ import { useQuery as useQuery29 } from "@tanstack/react-query";
1791
1827
  function useBundles(options) {
1792
1828
  const { client } = useBehio();
1793
- return useQuery28({
1829
+ return useQuery29({
1794
1830
  queryKey: ["behio", "bundles"],
1795
1831
  queryFn: () => unwrap(client.catalog.getBundles()),
1796
1832
  enabled: options?.enabled ?? true,
@@ -1799,7 +1835,7 @@ function useBundles(options) {
1799
1835
  }
1800
1836
  function useBundle(slug, options) {
1801
1837
  const { client } = useBehio();
1802
- return useQuery28({
1838
+ return useQuery29({
1803
1839
  queryKey: ["behio", "bundle", slug],
1804
1840
  queryFn: () => unwrap(client.catalog.getBundle(slug)),
1805
1841
  enabled: Boolean(slug) && (options?.enabled ?? true),
@@ -1808,10 +1844,10 @@ function useBundle(slug, options) {
1808
1844
  }
1809
1845
 
1810
1846
  // src/react/hooks/use-product-group.ts
1811
- import { useQuery as useQuery29 } from "@tanstack/react-query";
1847
+ import { useQuery as useQuery30 } from "@tanstack/react-query";
1812
1848
  function useProductGroup(slug, options) {
1813
1849
  const { client } = useBehio();
1814
- return useQuery29({
1850
+ return useQuery30({
1815
1851
  queryKey: ["behio", "product-group", slug, options?.locale, options?.currency],
1816
1852
  queryFn: () => unwrap(
1817
1853
  client.catalog.getProductGroup(slug, {
@@ -1825,10 +1861,10 @@ function useProductGroup(slug, options) {
1825
1861
  }
1826
1862
 
1827
1863
  // src/react/hooks/use-cross-sell.ts
1828
- import { useQuery as useQuery30 } from "@tanstack/react-query";
1864
+ import { useQuery as useQuery31 } from "@tanstack/react-query";
1829
1865
  function useCrossSell(productSlug, options) {
1830
1866
  const { client } = useBehio();
1831
- return useQuery30({
1867
+ return useQuery31({
1832
1868
  queryKey: ["behio", "cross-sell", productSlug, options?.locale, options?.currency],
1833
1869
  queryFn: () => unwrap(
1834
1870
  client.catalog.getCrossSell(productSlug, {
@@ -1842,10 +1878,10 @@ function useCrossSell(productSlug, options) {
1842
1878
  }
1843
1879
 
1844
1880
  // src/react/hooks/use-product-promotions.ts
1845
- import { useQuery as useQuery31 } from "@tanstack/react-query";
1881
+ import { useQuery as useQuery32 } from "@tanstack/react-query";
1846
1882
  function useProductPromotions(productSlug, options) {
1847
1883
  const { client } = useBehio();
1848
- return useQuery31({
1884
+ return useQuery32({
1849
1885
  queryKey: ["behio", "product-promotions", productSlug],
1850
1886
  queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
1851
1887
  enabled: Boolean(productSlug) && (options?.enabled ?? true),
@@ -1854,11 +1890,11 @@ function useProductPromotions(productSlug, options) {
1854
1890
  }
1855
1891
 
1856
1892
  // src/react/hooks/use-gift-card.ts
1857
- import { useQuery as useQuery32 } from "@tanstack/react-query";
1893
+ import { useQuery as useQuery33 } from "@tanstack/react-query";
1858
1894
  function useGiftCardBalance(code, options) {
1859
1895
  const { client } = useBehio();
1860
1896
  const trimmed = code?.trim();
1861
- return useQuery32({
1897
+ return useQuery33({
1862
1898
  queryKey: ["behio", "gift-card-balance", trimmed],
1863
1899
  queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
1864
1900
  enabled: Boolean(trimmed && trimmed.length >= 6) && (options?.enabled ?? true)
@@ -1866,20 +1902,20 @@ function useGiftCardBalance(code, options) {
1866
1902
  }
1867
1903
 
1868
1904
  // src/react/hooks/use-wishlist.ts
1869
- import { useQuery as useQuery33, useMutation as useMutation12, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
1905
+ import { useQuery as useQuery34, useMutation as useMutation13, useQueryClient as useQueryClient13 } from "@tanstack/react-query";
1870
1906
  function useWishlist(options) {
1871
1907
  const { client } = useBehio();
1872
- const qc = useQueryClient12();
1873
- const query = useQuery33({
1908
+ const qc = useQueryClient13();
1909
+ const query = useQuery34({
1874
1910
  queryKey: ["behio", "wishlist"],
1875
1911
  queryFn: () => unwrap(client.wishlist.get()),
1876
1912
  enabled: options?.enabled ?? true
1877
1913
  });
1878
- const addMutation = useMutation12({
1914
+ const addMutation = useMutation13({
1879
1915
  mutationFn: (productId) => unwrap(client.wishlist.add(productId)),
1880
1916
  onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
1881
1917
  });
1882
- const removeMutation = useMutation12({
1918
+ const removeMutation = useMutation13({
1883
1919
  mutationFn: (productId) => unwrap(client.wishlist.remove(productId)),
1884
1920
  onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
1885
1921
  });
@@ -1893,7 +1929,7 @@ function useWishlist(options) {
1893
1929
  }
1894
1930
  function useIsInWishlist(productId) {
1895
1931
  const { client } = useBehio();
1896
- return useQuery33({
1932
+ return useQuery34({
1897
1933
  queryKey: ["behio", "wishlist-check", productId],
1898
1934
  queryFn: () => unwrap(client.wishlist.isInWishlist(productId)),
1899
1935
  enabled: Boolean(productId)
@@ -1901,10 +1937,10 @@ function useIsInWishlist(productId) {
1901
1937
  }
1902
1938
 
1903
1939
  // src/react/hooks/use-reviews.ts
1904
- import { useQuery as useQuery34, useMutation as useMutation13, useQueryClient as useQueryClient13 } from "@tanstack/react-query";
1940
+ import { useQuery as useQuery35, useMutation as useMutation14, useQueryClient as useQueryClient14 } from "@tanstack/react-query";
1905
1941
  function useProductReviews(productId, options) {
1906
1942
  const { client } = useBehio();
1907
- return useQuery34({
1943
+ return useQuery35({
1908
1944
  queryKey: ["behio", "reviews", productId, options?.page ?? 1],
1909
1945
  queryFn: () => unwrap(client.reviews.getProductReviews(productId, options?.page, options?.limit)),
1910
1946
  enabled: Boolean(productId) && (options?.enabled ?? true)
@@ -1912,30 +1948,30 @@ function useProductReviews(productId, options) {
1912
1948
  }
1913
1949
  function useSubmitReview() {
1914
1950
  const { client } = useBehio();
1915
- const qc = useQueryClient13();
1916
- return useMutation13({
1951
+ const qc = useQueryClient14();
1952
+ return useMutation14({
1917
1953
  mutationFn: (input) => unwrap(client.reviews.submit(input)),
1918
1954
  onSuccess: (_, input) => qc.invalidateQueries({ queryKey: ["behio", "reviews", input.productId] })
1919
1955
  });
1920
1956
  }
1921
1957
 
1922
1958
  // src/react/hooks/use-returns.ts
1923
- import { useQuery as useQuery35, useMutation as useMutation14 } from "@tanstack/react-query";
1959
+ import { useQuery as useQuery36, useMutation as useMutation15 } from "@tanstack/react-query";
1924
1960
  function useLookupReturnableOrder() {
1925
1961
  const { client } = useBehio();
1926
- return useMutation14({
1962
+ return useMutation15({
1927
1963
  mutationFn: ({ orderNumber, email }) => unwrap(client.returns.lookupOrder(orderNumber, email))
1928
1964
  });
1929
1965
  }
1930
1966
  function useSubmitReturn() {
1931
1967
  const { client } = useBehio();
1932
- return useMutation14({
1968
+ return useMutation15({
1933
1969
  mutationFn: (input) => unwrap(client.returns.submit(input))
1934
1970
  });
1935
1971
  }
1936
1972
  function useReturnStatus(returnId, email) {
1937
1973
  const { client } = useBehio();
1938
- return useQuery35({
1974
+ return useQuery36({
1939
1975
  queryKey: ["behio", "return-status", returnId],
1940
1976
  queryFn: () => unwrap(client.returns.getStatus(returnId, email)),
1941
1977
  enabled: Boolean(returnId && email)
@@ -1943,16 +1979,16 @@ function useReturnStatus(returnId, email) {
1943
1979
  }
1944
1980
 
1945
1981
  // src/react/hooks/use-quotes.ts
1946
- import { useMutation as useMutation15, useQuery as useQuery36 } from "@tanstack/react-query";
1982
+ import { useMutation as useMutation16, useQuery as useQuery37 } from "@tanstack/react-query";
1947
1983
  function useSubmitQuote() {
1948
1984
  const { client } = useBehio();
1949
- return useMutation15({
1985
+ return useMutation16({
1950
1986
  mutationFn: (input) => unwrap(client.quotes.submit(input))
1951
1987
  });
1952
1988
  }
1953
1989
  function useQuoteStatus(quoteId, email) {
1954
1990
  const { client } = useBehio();
1955
- return useQuery36({
1991
+ return useQuery37({
1956
1992
  queryKey: ["behio", "quote-status", quoteId],
1957
1993
  queryFn: () => unwrap(client.quotes.getStatus(quoteId, email)),
1958
1994
  enabled: Boolean(quoteId && email)
@@ -1960,10 +1996,10 @@ function useQuoteStatus(quoteId, email) {
1960
1996
  }
1961
1997
 
1962
1998
  // src/react/hooks/use-back-in-stock.ts
1963
- import { useMutation as useMutation16 } from "@tanstack/react-query";
1999
+ import { useMutation as useMutation17 } from "@tanstack/react-query";
1964
2000
  function useNotifyWhenAvailable() {
1965
2001
  const { client } = useBehio();
1966
- return useMutation16({
2002
+ return useMutation17({
1967
2003
  mutationFn: ({ productId, email }) => unwrap(client.catalog.notifyWhenAvailable(productId, email))
1968
2004
  });
1969
2005
  }
@@ -1997,6 +2033,8 @@ export {
1997
2033
  useCategory,
1998
2034
  useCheckout,
1999
2035
  useCookieConsent,
2036
+ useCourse,
2037
+ useCourses,
2000
2038
  useCrossSell,
2001
2039
  useCurrency,
2002
2040
  useCustomer,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@behio/storefront-sdk",
3
- "version": "0.37.0",
4
- "description": "TypeScript SDK for Behio Headless E-Shop \u2014 core client + React hooks",
3
+ "version": "0.38.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",