@behio/storefront-sdk 1.8.0 → 1.9.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
@@ -194,6 +194,21 @@ var BehioStorefront = class {
194
194
  body: input
195
195
  });
196
196
  }
197
+ /**
198
+ * Visitor messages from merchant automations (storefront.event action).
199
+ * Consent-gated visitor id; each message carries a merchant-defined `name`
200
+ * and free-form `payload` the template reacts to (modal, banner, ...).
201
+ * Messages stay listed until acknowledged via `ackVisitorMessage`.
202
+ */
203
+ async getVisitorMessages(visitorId) {
204
+ return this.request("GET", "/messages", { query: { visitorId } });
205
+ }
206
+ /** Acknowledge a visitor message so it is not delivered again. */
207
+ async ackVisitorMessage(messageId, visitorId) {
208
+ return this.request("POST", `/messages/${messageId}/ack`, {
209
+ query: { visitorId }
210
+ });
211
+ }
197
212
  /** Get basic shop info */
198
213
  async getShopInfo() {
199
214
  return this.request("GET", "/shop");
@@ -3133,11 +3148,78 @@ function usePersonalOffers(options) {
3133
3148
  };
3134
3149
  }
3135
3150
 
3151
+ // src/react/hooks/use-visitor-messages.ts
3152
+ import { useCallback as useCallback9, useEffect as useEffect5, useRef as useRef3, useState as useState6 } from "react";
3153
+ import { useQuery as useQuery27, useQueryClient as useQueryClient13 } from "@tanstack/react-query";
3154
+ function useVisitorMessages(options) {
3155
+ const { client } = useBehio();
3156
+ const queryClient = useQueryClient13();
3157
+ const [polledVid, setPolledVid] = useState6(null);
3158
+ const seenRef = useRef3(/* @__PURE__ */ new Set());
3159
+ const explicitVid = options?.visitorId;
3160
+ useEffect5(() => {
3161
+ if (explicitVid) return;
3162
+ const read = () => {
3163
+ const vid = client.getAnalyticsVisitorId();
3164
+ if (vid) setPolledVid(vid);
3165
+ return vid;
3166
+ };
3167
+ if (read()) return;
3168
+ const timer = setInterval(() => {
3169
+ if (read()) clearInterval(timer);
3170
+ }, 3e3);
3171
+ return () => clearInterval(timer);
3172
+ }, [client, explicitVid]);
3173
+ const visitorId = explicitVid ?? polledVid;
3174
+ const pollMs = options?.pollMs ?? 3e4;
3175
+ const queryKey = ["behio", "visitor-messages", visitorId ?? ""];
3176
+ const { data, isLoading, error, refetch } = useQuery27({
3177
+ queryKey,
3178
+ queryFn: () => unwrap(client.getVisitorMessages(visitorId)),
3179
+ enabled: options?.enabled !== false && !!visitorId,
3180
+ refetchInterval: pollMs > 0 ? pollMs : false
3181
+ });
3182
+ const ack = useCallback9(
3183
+ async (messageId) => {
3184
+ if (!visitorId) return false;
3185
+ const result = await unwrap(client.ackVisitorMessage(messageId, visitorId));
3186
+ queryClient.setQueryData(
3187
+ queryKey,
3188
+ (prev) => prev ? { items: prev.items.filter((m) => m.id !== messageId) } : prev
3189
+ );
3190
+ return result.ok;
3191
+ },
3192
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3193
+ [client, visitorId, queryClient]
3194
+ );
3195
+ const onMessage = options?.onMessage;
3196
+ const dispatchDom = options?.dispatchDomEvents !== false;
3197
+ useEffect5(() => {
3198
+ for (const message of data?.items ?? []) {
3199
+ if (seenRef.current.has(message.id)) continue;
3200
+ seenRef.current.add(message.id);
3201
+ if (dispatchDom && typeof window !== "undefined") {
3202
+ window.dispatchEvent(new CustomEvent("behio:visitor-message", { detail: message }));
3203
+ }
3204
+ onMessage?.(message);
3205
+ }
3206
+ }, [data, onMessage, dispatchDom]);
3207
+ return {
3208
+ messages: data?.items ?? [],
3209
+ isLoading,
3210
+ error,
3211
+ refetch,
3212
+ /** Mark a message as shown; it will not be delivered again. */
3213
+ ack,
3214
+ visitorId
3215
+ };
3216
+ }
3217
+
3136
3218
  // src/react/hooks/use-analytics-events.ts
3137
- import { useCallback as useCallback9 } from "react";
3219
+ import { useCallback as useCallback10 } from "react";
3138
3220
  function useAnalyticsEvents() {
3139
3221
  const { client } = useBehio();
3140
- const track = useCallback9(
3222
+ const track = useCallback10(
3141
3223
  (events, opts) => {
3142
3224
  const list = Array.isArray(events) ? events : [events];
3143
3225
  if (list.length === 0) return Promise.resolve();
@@ -3149,7 +3231,7 @@ function useAnalyticsEvents() {
3149
3231
  },
3150
3232
  [client]
3151
3233
  );
3152
- const trackEvent = useCallback9(
3234
+ const trackEvent = useCallback10(
3153
3235
  (name, props) => track({ type: "custom", name, props }),
3154
3236
  [track]
3155
3237
  );
@@ -3179,12 +3261,12 @@ function useNewsletterUnsubscribe() {
3179
3261
  }
3180
3262
 
3181
3263
  // src/react/hooks/use-orders.ts
3182
- import { useCallback as useCallback10, useMemo as useMemo3, useState as useState6 } from "react";
3264
+ import { useCallback as useCallback11, useMemo as useMemo3, useState as useState7 } from "react";
3183
3265
  import { useInfiniteQuery as useInfiniteQuery2 } from "@tanstack/react-query";
3184
3266
  function useOrders(options) {
3185
3267
  const { client } = useBehio();
3186
3268
  const { page: initialPage, limit, enabled } = options ?? {};
3187
- const [page, setPage] = useState6(initialPage ?? 1);
3269
+ const [page, setPage] = useState7(initialPage ?? 1);
3188
3270
  const infinite = useInfiniteQuery2({
3189
3271
  queryKey: ["behio", "orders", limit, page],
3190
3272
  queryFn: ({ pageParam }) => unwrap(client.orders.list({ limit, page: pageParam })),
@@ -3198,13 +3280,13 @@ function useOrders(options) {
3198
3280
  [infinite.data]
3199
3281
  );
3200
3282
  const lastPage = infinite.data?.pages[infinite.data.pages.length - 1];
3201
- const loadMore = useCallback10(() => {
3283
+ const loadMore = useCallback11(() => {
3202
3284
  if (infinite.hasNextPage && !infinite.isFetchingNextPage) {
3203
3285
  return infinite.fetchNextPage();
3204
3286
  }
3205
3287
  return Promise.resolve();
3206
3288
  }, [infinite]);
3207
- const goToPage = useCallback10((newPage) => {
3289
+ const goToPage = useCallback11((newPage) => {
3208
3290
  setPage(newPage);
3209
3291
  }, []);
3210
3292
  return {
@@ -3230,16 +3312,16 @@ function useOrders(options) {
3230
3312
  }
3231
3313
 
3232
3314
  // src/react/hooks/use-order.ts
3233
- import { useCallback as useCallback11 } from "react";
3234
- import { useQuery as useQuery27, useMutation as useMutation12, useQueryClient as useQueryClient13 } from "@tanstack/react-query";
3315
+ import { useCallback as useCallback12 } from "react";
3316
+ import { useQuery as useQuery28, useMutation as useMutation12, useQueryClient as useQueryClient14 } from "@tanstack/react-query";
3235
3317
  function useOrder(orderNumber, options) {
3236
3318
  const { client } = useBehio();
3237
- const queryClient = useQueryClient13();
3319
+ const queryClient = useQueryClient14();
3238
3320
  const {
3239
3321
  data,
3240
3322
  isLoading,
3241
3323
  error
3242
- } = useQuery27({
3324
+ } = useQuery28({
3243
3325
  queryKey: ["behio", "order", orderNumber],
3244
3326
  queryFn: () => unwrap(client.orders.get(orderNumber)),
3245
3327
  enabled: options?.enabled !== false && !!orderNumber && !!client.getAccessToken()
@@ -3251,7 +3333,7 @@ function useOrder(orderNumber, options) {
3251
3333
  queryClient.invalidateQueries({ queryKey: ["behio", "orders"] });
3252
3334
  }
3253
3335
  });
3254
- const cancel = useCallback11(
3336
+ const cancel = useCallback12(
3255
3337
  () => cancelMutation.mutateAsync(),
3256
3338
  [cancelMutation]
3257
3339
  );
@@ -3265,14 +3347,14 @@ function useOrder(orderNumber, options) {
3265
3347
  }
3266
3348
 
3267
3349
  // src/react/hooks/use-order-access.ts
3268
- import { useCallback as useCallback12, useState as useState7 } from "react";
3350
+ import { useCallback as useCallback13, useState as useState8 } from "react";
3269
3351
  import { useMutation as useMutation13 } from "@tanstack/react-query";
3270
3352
  function useOrderAccess() {
3271
3353
  const { client } = useBehio();
3272
- const [orderNumber, setOrderNumber] = useState7(null);
3273
- const [email, setEmail] = useState7(null);
3274
- const [order, setOrder] = useState7(null);
3275
- const [accessToken, setAccessToken] = useState7(null);
3354
+ const [orderNumber, setOrderNumber] = useState8(null);
3355
+ const [email, setEmail] = useState8(null);
3356
+ const [order, setOrder] = useState8(null);
3357
+ const [accessToken, setAccessToken] = useState8(null);
3276
3358
  const requestMutation = useMutation13({
3277
3359
  mutationFn: (input) => unwrap(client.orders.requestAccessCode(input.orderNumber, input.email)),
3278
3360
  onSuccess: (_data, input) => {
@@ -3292,12 +3374,12 @@ function useOrderAccess() {
3292
3374
  setAccessToken(result.accessToken);
3293
3375
  }
3294
3376
  });
3295
- const requestCode = useCallback12(
3377
+ const requestCode = useCallback13(
3296
3378
  (on, em) => requestMutation.mutateAsync({ orderNumber: on, email: em }),
3297
3379
  [requestMutation]
3298
3380
  );
3299
- const verifyCode = useCallback12((code) => verifyMutation.mutateAsync(code), [verifyMutation]);
3300
- const reset = useCallback12(() => {
3381
+ const verifyCode = useCallback13((code) => verifyMutation.mutateAsync(code), [verifyMutation]);
3382
+ const reset = useCallback13(() => {
3301
3383
  setOrderNumber(null);
3302
3384
  setEmail(null);
3303
3385
  setOrder(null);
@@ -3325,12 +3407,12 @@ function useOrderAccess() {
3325
3407
  }
3326
3408
 
3327
3409
  // src/react/hooks/use-checkout.ts
3328
- import { useState as useState8, useCallback as useCallback13 } from "react";
3329
- import { useMutation as useMutation14, useQueryClient as useQueryClient14 } from "@tanstack/react-query";
3410
+ import { useState as useState9, useCallback as useCallback14 } from "react";
3411
+ import { useMutation as useMutation14, useQueryClient as useQueryClient15 } from "@tanstack/react-query";
3330
3412
  function useCheckout() {
3331
3413
  const { client, storage } = useBehio();
3332
- const queryClient = useQueryClient14();
3333
- const [order, setOrder] = useState8(null);
3414
+ const queryClient = useQueryClient15();
3415
+ const [order, setOrder] = useState9(null);
3334
3416
  const mutation = useMutation14({
3335
3417
  mutationFn: (input) => unwrap(client.checkout.createOrder(input)),
3336
3418
  onSuccess: (result) => {
@@ -3340,11 +3422,11 @@ function useCheckout() {
3340
3422
  queryClient.invalidateQueries({ queryKey: ["behio", "orders"] });
3341
3423
  }
3342
3424
  });
3343
- const createOrder = useCallback13(
3425
+ const createOrder = useCallback14(
3344
3426
  (input) => mutation.mutateAsync(input),
3345
3427
  [mutation]
3346
3428
  );
3347
- const reset = useCallback13(() => {
3429
+ const reset = useCallback14(() => {
3348
3430
  setOrder(null);
3349
3431
  mutation.reset();
3350
3432
  }, [mutation]);
@@ -3358,10 +3440,10 @@ function useCheckout() {
3358
3440
  }
3359
3441
 
3360
3442
  // src/react/hooks/use-pages.ts
3361
- import { useQuery as useQuery28 } from "@tanstack/react-query";
3443
+ import { useQuery as useQuery29 } from "@tanstack/react-query";
3362
3444
  function usePages(locale, options) {
3363
3445
  const { client } = useBehio();
3364
- return useQuery28({
3446
+ return useQuery29({
3365
3447
  queryKey: ["behio", "pages", locale],
3366
3448
  queryFn: async () => {
3367
3449
  const result = await unwrap(client.pages.list(locale));
@@ -3372,7 +3454,7 @@ function usePages(locale, options) {
3372
3454
  }
3373
3455
  function usePage(slug, locale, options) {
3374
3456
  const { client } = useBehio();
3375
- return useQuery28({
3457
+ return useQuery29({
3376
3458
  queryKey: ["behio", "page", slug, locale],
3377
3459
  queryFn: () => unwrap(client.pages.get(slug, locale)),
3378
3460
  enabled: options?.enabled !== false && !!slug
@@ -3380,10 +3462,10 @@ function usePage(slug, locale, options) {
3380
3462
  }
3381
3463
 
3382
3464
  // src/react/hooks/use-shop-info.ts
3383
- import { useQuery as useQuery29 } from "@tanstack/react-query";
3465
+ import { useQuery as useQuery30 } from "@tanstack/react-query";
3384
3466
  function useShopInfo(options) {
3385
3467
  const { client } = useBehio();
3386
- return useQuery29({
3468
+ return useQuery30({
3387
3469
  queryKey: ["behio", "shop-info"],
3388
3470
  queryFn: () => unwrap(client.getShopInfo()),
3389
3471
  enabled: options?.enabled !== false
@@ -3391,10 +3473,10 @@ function useShopInfo(options) {
3391
3473
  }
3392
3474
 
3393
3475
  // src/react/hooks/use-shop-scripts.ts
3394
- import { useQuery as useQuery30 } from "@tanstack/react-query";
3476
+ import { useQuery as useQuery31 } from "@tanstack/react-query";
3395
3477
  function useShopScripts(options) {
3396
3478
  const { client } = useBehio();
3397
- return useQuery30({
3479
+ return useQuery31({
3398
3480
  queryKey: ["behio", "shop-scripts"],
3399
3481
  queryFn: () => unwrap(client.getShopScripts()),
3400
3482
  enabled: options?.enabled !== false
@@ -3402,11 +3484,11 @@ function useShopScripts(options) {
3402
3484
  }
3403
3485
 
3404
3486
  // src/react/hooks/use-shop-seo.ts
3405
- import { useQuery as useQuery31 } from "@tanstack/react-query";
3487
+ import { useQuery as useQuery32 } from "@tanstack/react-query";
3406
3488
  function useShopSeo(options) {
3407
3489
  const { client } = useBehio();
3408
3490
  const { locale, initialData, enabled = true } = options ?? {};
3409
- return useQuery31({
3491
+ return useQuery32({
3410
3492
  queryKey: ["behio", "shop-seo", locale ?? "_default"],
3411
3493
  queryFn: () => unwrap(client.getShopSeo(locale)),
3412
3494
  initialData,
@@ -3466,14 +3548,14 @@ function CurrencySwitcher({
3466
3548
  }
3467
3549
 
3468
3550
  // src/react/components/storefront-scripts.tsx
3469
- import { useEffect as useEffect5, useMemo as useMemo4, useState as useState9 } from "react";
3551
+ import { useEffect as useEffect6, useMemo as useMemo4, useState as useState10 } from "react";
3470
3552
 
3471
3553
  // src/react/hooks/use-consent.ts
3472
- import { useQuery as useQuery32, useMutation as useMutation15, useQueryClient as useQueryClient15 } from "@tanstack/react-query";
3554
+ import { useQuery as useQuery33, useMutation as useMutation15, useQueryClient as useQueryClient16 } from "@tanstack/react-query";
3473
3555
  function useCookieConsent(visitorId) {
3474
3556
  const { client } = useBehio();
3475
- const qc = useQueryClient15();
3476
- const query = useQuery32({
3557
+ const qc = useQueryClient16();
3558
+ const query = useQuery33({
3477
3559
  queryKey: ["behio", "consent", visitorId],
3478
3560
  queryFn: () => unwrap(client.consent.get(visitorId)),
3479
3561
  enabled: Boolean(visitorId)
@@ -3556,8 +3638,8 @@ function injectHtml(target, html) {
3556
3638
  }
3557
3639
  function StorefrontScripts({ visitorId: visitorIdProp } = {}) {
3558
3640
  const { data } = useShopScripts();
3559
- const [visitorId, setVisitorId] = useState9(visitorIdProp ?? "");
3560
- useEffect5(() => {
3641
+ const [visitorId, setVisitorId] = useState10(visitorIdProp ?? "");
3642
+ useEffect6(() => {
3561
3643
  if (visitorIdProp) return;
3562
3644
  try {
3563
3645
  const v = localStorage.getItem(VISITOR_KEY);
@@ -3575,7 +3657,7 @@ function StorefrontScripts({ visitorId: visitorIdProp } = {}) {
3575
3657
  () => JSON.stringify(scripts.map((s) => [s.id, s.type, s.placement, s.value])),
3576
3658
  [scripts]
3577
3659
  );
3578
- useEffect5(() => {
3660
+ useEffect6(() => {
3579
3661
  if (typeof document === "undefined") return;
3580
3662
  const added = [];
3581
3663
  for (const s of scripts) {
@@ -3592,7 +3674,7 @@ function StorefrontScripts({ visitorId: visitorIdProp } = {}) {
3592
3674
  }
3593
3675
 
3594
3676
  // src/react/components/behio-analytics.tsx
3595
- import { useEffect as useEffect6 } from "react";
3677
+ import { useEffect as useEffect7 } from "react";
3596
3678
 
3597
3679
  // src/react/hooks/use-behio-client.ts
3598
3680
  function useBehioClient() {
@@ -3602,7 +3684,7 @@ function useBehioClient() {
3602
3684
  // src/react/components/behio-analytics.tsx
3603
3685
  function BehioAnalyticsTracker() {
3604
3686
  const client = useBehioClient();
3605
- useEffect6(() => {
3687
+ useEffect7(() => {
3606
3688
  if (typeof window === "undefined") return;
3607
3689
  const w = window;
3608
3690
  if (w.__behioAnalytics) return;
@@ -3841,10 +3923,10 @@ function utmFromSearch(search) {
3841
3923
  }
3842
3924
 
3843
3925
  // src/react/hooks/use-bundles.ts
3844
- import { useQuery as useQuery33 } from "@tanstack/react-query";
3926
+ import { useQuery as useQuery34 } from "@tanstack/react-query";
3845
3927
  function useBundles(options) {
3846
3928
  const { client } = useBehio();
3847
- return useQuery33({
3929
+ return useQuery34({
3848
3930
  queryKey: ["behio", "bundles"],
3849
3931
  queryFn: () => unwrap(client.catalog.getBundles()),
3850
3932
  enabled: options?.enabled ?? true,
@@ -3853,7 +3935,7 @@ function useBundles(options) {
3853
3935
  }
3854
3936
  function useBundle(slug, options) {
3855
3937
  const { client } = useBehio();
3856
- return useQuery33({
3938
+ return useQuery34({
3857
3939
  queryKey: ["behio", "bundle", slug],
3858
3940
  queryFn: () => unwrap(client.catalog.getBundle(slug)),
3859
3941
  enabled: Boolean(slug) && (options?.enabled ?? true),
@@ -3862,10 +3944,10 @@ function useBundle(slug, options) {
3862
3944
  }
3863
3945
 
3864
3946
  // src/react/hooks/use-product-group.ts
3865
- import { useQuery as useQuery34 } from "@tanstack/react-query";
3947
+ import { useQuery as useQuery35 } from "@tanstack/react-query";
3866
3948
  function useProductGroup(slug, options) {
3867
3949
  const { client } = useBehio();
3868
- return useQuery34({
3950
+ return useQuery35({
3869
3951
  queryKey: ["behio", "product-group", slug, options?.locale, options?.currency],
3870
3952
  queryFn: () => unwrap(
3871
3953
  client.catalog.getProductGroup(slug, {
@@ -3879,10 +3961,10 @@ function useProductGroup(slug, options) {
3879
3961
  }
3880
3962
 
3881
3963
  // src/react/hooks/use-cross-sell.ts
3882
- import { useQuery as useQuery35 } from "@tanstack/react-query";
3964
+ import { useQuery as useQuery36 } from "@tanstack/react-query";
3883
3965
  function useCrossSell(productSlug, options) {
3884
3966
  const { client } = useBehio();
3885
- return useQuery35({
3967
+ return useQuery36({
3886
3968
  queryKey: ["behio", "cross-sell", productSlug, options?.locale, options?.currency],
3887
3969
  queryFn: () => unwrap(
3888
3970
  client.catalog.getCrossSell(productSlug, {
@@ -3896,10 +3978,10 @@ function useCrossSell(productSlug, options) {
3896
3978
  }
3897
3979
 
3898
3980
  // src/react/hooks/use-product-promotions.ts
3899
- import { useQuery as useQuery36 } from "@tanstack/react-query";
3981
+ import { useQuery as useQuery37 } from "@tanstack/react-query";
3900
3982
  function useProductPromotions(productSlug, options) {
3901
3983
  const { client } = useBehio();
3902
- return useQuery36({
3984
+ return useQuery37({
3903
3985
  queryKey: ["behio", "product-promotions", productSlug],
3904
3986
  queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
3905
3987
  enabled: Boolean(productSlug) && (options?.enabled ?? true),
@@ -3908,11 +3990,11 @@ function useProductPromotions(productSlug, options) {
3908
3990
  }
3909
3991
 
3910
3992
  // src/react/hooks/use-gift-card.ts
3911
- import { useQuery as useQuery37 } from "@tanstack/react-query";
3993
+ import { useQuery as useQuery38 } from "@tanstack/react-query";
3912
3994
  function useGiftCardBalance(code, options) {
3913
3995
  const { client } = useBehio();
3914
3996
  const trimmed = code?.trim();
3915
- return useQuery37({
3997
+ return useQuery38({
3916
3998
  queryKey: ["behio", "gift-card-balance", trimmed],
3917
3999
  queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
3918
4000
  enabled: Boolean(trimmed && trimmed.length >= 6) && (options?.enabled ?? true)
@@ -3920,11 +4002,11 @@ function useGiftCardBalance(code, options) {
3920
4002
  }
3921
4003
 
3922
4004
  // src/react/hooks/use-wishlist.ts
3923
- import { useQuery as useQuery38, useMutation as useMutation16, useQueryClient as useQueryClient16 } from "@tanstack/react-query";
4005
+ import { useQuery as useQuery39, useMutation as useMutation16, useQueryClient as useQueryClient17 } from "@tanstack/react-query";
3924
4006
  function useWishlist(options) {
3925
4007
  const { client } = useBehio();
3926
- const qc = useQueryClient16();
3927
- const query = useQuery38({
4008
+ const qc = useQueryClient17();
4009
+ const query = useQuery39({
3928
4010
  queryKey: ["behio", "wishlist"],
3929
4011
  queryFn: () => unwrap(client.wishlist.get()),
3930
4012
  enabled: options?.enabled ?? true
@@ -3947,7 +4029,7 @@ function useWishlist(options) {
3947
4029
  }
3948
4030
  function useIsInWishlist(productId) {
3949
4031
  const { client } = useBehio();
3950
- return useQuery38({
4032
+ return useQuery39({
3951
4033
  queryKey: ["behio", "wishlist-check", productId],
3952
4034
  queryFn: () => unwrap(client.wishlist.isInWishlist(productId)),
3953
4035
  enabled: Boolean(productId)
@@ -3955,10 +4037,10 @@ function useIsInWishlist(productId) {
3955
4037
  }
3956
4038
 
3957
4039
  // src/react/hooks/use-reviews.ts
3958
- import { useQuery as useQuery39, useMutation as useMutation17, useQueryClient as useQueryClient17 } from "@tanstack/react-query";
4040
+ import { useQuery as useQuery40, useMutation as useMutation17, useQueryClient as useQueryClient18 } from "@tanstack/react-query";
3959
4041
  function useProductReviews(productId, options) {
3960
4042
  const { client } = useBehio();
3961
- return useQuery39({
4043
+ return useQuery40({
3962
4044
  queryKey: ["behio", "reviews", productId, options?.page ?? 1],
3963
4045
  queryFn: () => unwrap(client.reviews.getProductReviews(productId, options?.page, options?.limit)),
3964
4046
  enabled: Boolean(productId) && (options?.enabled ?? true)
@@ -3966,7 +4048,7 @@ function useProductReviews(productId, options) {
3966
4048
  }
3967
4049
  function useSubmitReview() {
3968
4050
  const { client } = useBehio();
3969
- const qc = useQueryClient17();
4051
+ const qc = useQueryClient18();
3970
4052
  return useMutation17({
3971
4053
  mutationFn: (input) => unwrap(client.reviews.submit(input)),
3972
4054
  onSuccess: (_, input) => qc.invalidateQueries({ queryKey: ["behio", "reviews", input.productId] })
@@ -3974,7 +4056,7 @@ function useSubmitReview() {
3974
4056
  }
3975
4057
 
3976
4058
  // src/react/hooks/use-returns.ts
3977
- import { useQuery as useQuery40, useMutation as useMutation18 } from "@tanstack/react-query";
4059
+ import { useQuery as useQuery41, useMutation as useMutation18 } from "@tanstack/react-query";
3978
4060
  function useLookupReturnableOrder() {
3979
4061
  const { client } = useBehio();
3980
4062
  return useMutation18({
@@ -3989,7 +4071,7 @@ function useSubmitReturn() {
3989
4071
  }
3990
4072
  function useReturnStatus(returnId, email) {
3991
4073
  const { client } = useBehio();
3992
- return useQuery40({
4074
+ return useQuery41({
3993
4075
  queryKey: ["behio", "return-status", returnId],
3994
4076
  queryFn: () => unwrap(client.returns.getStatus(returnId, email)),
3995
4077
  enabled: Boolean(returnId && email)
@@ -3997,7 +4079,7 @@ function useReturnStatus(returnId, email) {
3997
4079
  }
3998
4080
 
3999
4081
  // src/react/hooks/use-quotes.ts
4000
- import { useMutation as useMutation19, useQuery as useQuery41 } from "@tanstack/react-query";
4082
+ import { useMutation as useMutation19, useQuery as useQuery42 } from "@tanstack/react-query";
4001
4083
  function useSubmitQuote() {
4002
4084
  const { client } = useBehio();
4003
4085
  return useMutation19({
@@ -4006,7 +4088,7 @@ function useSubmitQuote() {
4006
4088
  }
4007
4089
  function useQuoteStatus(quoteId, email) {
4008
4090
  const { client } = useBehio();
4009
- return useQuery41({
4091
+ return useQuery42({
4010
4092
  queryKey: ["behio", "quote-status", quoteId],
4011
4093
  queryFn: () => unwrap(client.quotes.getStatus(quoteId, email)),
4012
4094
  enabled: Boolean(quoteId && email)
@@ -4210,5 +4292,6 @@ export {
4210
4292
  useSubmitReturn,
4211
4293
  useSubmitReview,
4212
4294
  useSubscriptions,
4295
+ useVisitorMessages,
4213
4296
  useWishlist
4214
4297
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@behio/storefront-sdk",
3
- "version": "1.8.0",
4
- "description": "TypeScript SDK for Behio Headless E-Shop core client + React hooks",
3
+ "version": "1.9.0",
4
+ "description": "TypeScript SDK for Behio Headless E-Shop \u2014 core client + React hooks",
5
5
  "author": "Behio",
6
6
  "license": "MIT",
7
7
  "main": "./dist/index.js",