@behio/storefront-sdk 2.23.0 → 2.25.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/README.md +42 -0
- package/dist/{chunk-VHHDIU6J.mjs → chunk-GNWW2O3A.mjs} +68 -0
- package/dist/{chunk-L7IIU5MZ.js → chunk-IUC57IOB.js} +73 -5
- package/dist/{client-BeI4IFKu.d.mts → client-CF_H3vgY.d.mts} +270 -1
- package/dist/{client-BeI4IFKu.d.ts → client-CF_H3vgY.d.ts} +270 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +66 -3
- package/dist/index.mjs +64 -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 +302 -1
- package/dist/react.d.ts +302 -1
- package/dist/react.js +193 -41
- package/dist/react.mjs +185 -41
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -46,8 +46,11 @@ __export(react_exports, {
|
|
|
46
46
|
useBlogPost: () => useBlogPost,
|
|
47
47
|
useBlogPosts: () => useBlogPosts,
|
|
48
48
|
useBlogs: () => useBlogs,
|
|
49
|
+
useBookingConfig: () => useBookingConfig,
|
|
50
|
+
useBookingSlots: () => useBookingSlots,
|
|
49
51
|
useBundle: () => useBundle,
|
|
50
52
|
useBundles: () => useBundles,
|
|
53
|
+
useCancelBooking: () => useCancelBooking,
|
|
51
54
|
useCart: () => useCart,
|
|
52
55
|
useCartCount: () => useCartCount,
|
|
53
56
|
useCategories: () => useCategories,
|
|
@@ -61,6 +64,7 @@ __export(react_exports, {
|
|
|
61
64
|
useCourse: () => useCourse,
|
|
62
65
|
useCourseCertificates: () => useCourseCertificates,
|
|
63
66
|
useCourses: () => useCourses,
|
|
67
|
+
useCreateBooking: () => useCreateBooking,
|
|
64
68
|
useCrossSell: () => useCrossSell,
|
|
65
69
|
useCurrency: () => useCurrency,
|
|
66
70
|
useCustomer: () => useCustomer,
|
|
@@ -78,6 +82,8 @@ __export(react_exports, {
|
|
|
78
82
|
useLessonTutor: () => useLessonTutor,
|
|
79
83
|
useLookupReturnableOrder: () => useLookupReturnableOrder,
|
|
80
84
|
useLoyalty: () => useLoyalty,
|
|
85
|
+
useManagedBooking: () => useManagedBooking,
|
|
86
|
+
useManagedBookingSlots: () => useManagedBookingSlots,
|
|
81
87
|
useMenu: () => useMenu,
|
|
82
88
|
useNewsletterSubscribe: () => useNewsletterSubscribe,
|
|
83
89
|
useNewsletterUnsubscribe: () => useNewsletterUnsubscribe,
|
|
@@ -97,6 +103,7 @@ __export(react_exports, {
|
|
|
97
103
|
useProductReviews: () => useProductReviews,
|
|
98
104
|
useProducts: () => useProducts,
|
|
99
105
|
useQuoteStatus: () => useQuoteStatus,
|
|
106
|
+
useRescheduleBooking: () => useRescheduleBooking,
|
|
100
107
|
useReturnStatus: () => useReturnStatus,
|
|
101
108
|
useSearch: () => useSearch,
|
|
102
109
|
useShippingMethods: () => useShippingMethods,
|
|
@@ -109,6 +116,7 @@ __export(react_exports, {
|
|
|
109
116
|
useSubmitQuote: () => useSubmitQuote,
|
|
110
117
|
useSubmitReturn: () => useSubmitReturn,
|
|
111
118
|
useSubmitReview: () => useSubmitReview,
|
|
119
|
+
useSubmitWithdrawal: () => useSubmitWithdrawal,
|
|
112
120
|
useSubscriptions: () => useSubscriptions,
|
|
113
121
|
useVisitorMessages: () => useVisitorMessages,
|
|
114
122
|
useWishlist: () => useWishlist
|
|
@@ -288,6 +296,7 @@ var BehioStorefront = class {
|
|
|
288
296
|
this.forms = new FormsModule(this);
|
|
289
297
|
this.collections = new CollectionsModule(this);
|
|
290
298
|
this.faq = new FaqModule(this);
|
|
299
|
+
this.bookings = new BookingsModule(this);
|
|
291
300
|
this.wishlist = new WishlistModule(this);
|
|
292
301
|
this.reviews = new ReviewsModule(this);
|
|
293
302
|
this.returns = new ReturnsModule(this);
|
|
@@ -1964,6 +1973,60 @@ var FaqModule = class {
|
|
|
1964
1973
|
});
|
|
1965
1974
|
}
|
|
1966
1975
|
};
|
|
1976
|
+
var BookingsModule = class {
|
|
1977
|
+
constructor(client) {
|
|
1978
|
+
this.client = client;
|
|
1979
|
+
}
|
|
1980
|
+
/** Services, categories, staff, branches and rules of the booking flow. */
|
|
1981
|
+
async getConfig() {
|
|
1982
|
+
return this.client.request("GET", "/bookings/config", { auth: false });
|
|
1983
|
+
}
|
|
1984
|
+
/** Free start times for the selected services (at most 31 days per call). */
|
|
1985
|
+
async getSlots(query) {
|
|
1986
|
+
return this.client.request("GET", "/bookings/slots", {
|
|
1987
|
+
query: {
|
|
1988
|
+
serviceIds: query.serviceIds.join(","),
|
|
1989
|
+
staffId: query.staffId ?? void 0,
|
|
1990
|
+
from: query.from,
|
|
1991
|
+
to: query.to
|
|
1992
|
+
},
|
|
1993
|
+
auth: false
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* Create a booking. Counts toward the monthly online limit of the plan.
|
|
1998
|
+
* Keep `manageToken` only to link the customer to the change and cancel
|
|
1999
|
+
* page; the same link arrives in the confirmation email.
|
|
2000
|
+
*/
|
|
2001
|
+
async create(input) {
|
|
2002
|
+
return this.client.request("POST", "/bookings", { body: input, auth: false });
|
|
2003
|
+
}
|
|
2004
|
+
/** The booking behind the token from the confirmation email. */
|
|
2005
|
+
async getByToken(token) {
|
|
2006
|
+
return this.client.request("GET", `/bookings/manage/${encodeURIComponent(token)}`, { auth: false });
|
|
2007
|
+
}
|
|
2008
|
+
/** Free times to move the booking to (same services and person rules). */
|
|
2009
|
+
async getManageSlots(token, query) {
|
|
2010
|
+
return this.client.request("GET", `/bookings/manage/${encodeURIComponent(token)}/slots`, {
|
|
2011
|
+
query: { from: query.from, to: query.to },
|
|
2012
|
+
auth: false
|
|
2013
|
+
});
|
|
2014
|
+
}
|
|
2015
|
+
/** Cancel the booking (optional reason for the business). */
|
|
2016
|
+
async cancel(token, input) {
|
|
2017
|
+
return this.client.request("POST", `/bookings/manage/${encodeURIComponent(token)}/cancel`, {
|
|
2018
|
+
body: { reason: input?.reason ?? null },
|
|
2019
|
+
auth: false
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
/** Move the booking to `startMs` of a slot from `getManageSlots`. */
|
|
2023
|
+
async reschedule(token, input) {
|
|
2024
|
+
return this.client.request("POST", `/bookings/manage/${encodeURIComponent(token)}/reschedule`, {
|
|
2025
|
+
body: { startMs: input.startMs },
|
|
2026
|
+
auth: false
|
|
2027
|
+
});
|
|
2028
|
+
}
|
|
2029
|
+
};
|
|
1967
2030
|
var FormsModule = class {
|
|
1968
2031
|
constructor(client) {
|
|
1969
2032
|
this.client = client;
|
|
@@ -2127,6 +2190,19 @@ var ReturnsModule = class {
|
|
|
2127
2190
|
}
|
|
2128
2191
|
);
|
|
2129
2192
|
}
|
|
2193
|
+
/**
|
|
2194
|
+
* EU withdrawal function (Art. 11a Directive 2011/83/EU, 2.25.0). Two steps
|
|
2195
|
+
* in the template: the form (name, order number, e-mail), then a summary
|
|
2196
|
+
* with the "Confirm withdrawal" button that calls this. The result is the
|
|
2197
|
+
* acknowledgement to show; the same content with date and time goes out by
|
|
2198
|
+
* e-mail. Guests welcome, the order e-mail is the gate.
|
|
2199
|
+
*/
|
|
2200
|
+
async withdraw(input) {
|
|
2201
|
+
return this.client.request("POST", "/returns/withdrawal", {
|
|
2202
|
+
body: input
|
|
2203
|
+
});
|
|
2204
|
+
}
|
|
2205
|
+
/** Return or complaint. Reason CHANGED_MIND is recorded as a withdrawal on the server. */
|
|
2130
2206
|
async submit(input) {
|
|
2131
2207
|
return this.client.request("POST", "/returns", {
|
|
2132
2208
|
body: input
|
|
@@ -4254,11 +4330,73 @@ function useSiteFormSubmit(slug) {
|
|
|
4254
4330
|
};
|
|
4255
4331
|
}
|
|
4256
4332
|
|
|
4257
|
-
// src/react/hooks/use-
|
|
4333
|
+
// src/react/hooks/use-bookings.ts
|
|
4258
4334
|
var import_react_query40 = require("@tanstack/react-query");
|
|
4259
|
-
function
|
|
4335
|
+
function useBookingConfig(options) {
|
|
4260
4336
|
const { client } = useBehio();
|
|
4261
4337
|
return (0, import_react_query40.useQuery)({
|
|
4338
|
+
queryKey: ["behio", "bookings", "config"],
|
|
4339
|
+
queryFn: () => unwrap(client.bookings.getConfig()),
|
|
4340
|
+
enabled: options?.enabled !== false
|
|
4341
|
+
});
|
|
4342
|
+
}
|
|
4343
|
+
function useBookingSlots(query, options) {
|
|
4344
|
+
const { client } = useBehio();
|
|
4345
|
+
return (0, import_react_query40.useQuery)({
|
|
4346
|
+
queryKey: ["behio", "bookings", "slots", query.serviceIds.join(","), query.staffId ?? null, query.from, query.to],
|
|
4347
|
+
queryFn: () => unwrap(client.bookings.getSlots(query)),
|
|
4348
|
+
enabled: options?.enabled !== false && query.serviceIds.length > 0,
|
|
4349
|
+
staleTime: 3e4
|
|
4350
|
+
});
|
|
4351
|
+
}
|
|
4352
|
+
function useCreateBooking() {
|
|
4353
|
+
const { client } = useBehio();
|
|
4354
|
+
const queryClient = (0, import_react_query40.useQueryClient)();
|
|
4355
|
+
return (0, import_react_query40.useMutation)({
|
|
4356
|
+
mutationFn: (input) => unwrap(client.bookings.create(input)),
|
|
4357
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: ["behio", "bookings", "slots"] })
|
|
4358
|
+
});
|
|
4359
|
+
}
|
|
4360
|
+
function useManagedBooking(token, options) {
|
|
4361
|
+
const { client } = useBehio();
|
|
4362
|
+
return (0, import_react_query40.useQuery)({
|
|
4363
|
+
queryKey: ["behio", "bookings", "manage", token],
|
|
4364
|
+
queryFn: () => unwrap(client.bookings.getByToken(token)),
|
|
4365
|
+
enabled: options?.enabled !== false && !!token
|
|
4366
|
+
});
|
|
4367
|
+
}
|
|
4368
|
+
function useManagedBookingSlots(token, query, options) {
|
|
4369
|
+
const { client } = useBehio();
|
|
4370
|
+
return (0, import_react_query40.useQuery)({
|
|
4371
|
+
queryKey: ["behio", "bookings", "manage", token, "slots", query.from, query.to],
|
|
4372
|
+
queryFn: () => unwrap(client.bookings.getManageSlots(token, query)),
|
|
4373
|
+
enabled: options?.enabled !== false && !!token,
|
|
4374
|
+
staleTime: 3e4
|
|
4375
|
+
});
|
|
4376
|
+
}
|
|
4377
|
+
function useCancelBooking(token) {
|
|
4378
|
+
const { client } = useBehio();
|
|
4379
|
+
const queryClient = (0, import_react_query40.useQueryClient)();
|
|
4380
|
+
return (0, import_react_query40.useMutation)({
|
|
4381
|
+
mutationFn: (input) => unwrap(client.bookings.cancel(token, input ?? void 0)),
|
|
4382
|
+
onSuccess: (booking) => queryClient.setQueryData(["behio", "bookings", "manage", token], booking)
|
|
4383
|
+
});
|
|
4384
|
+
}
|
|
4385
|
+
function useRescheduleBooking(token) {
|
|
4386
|
+
const { client } = useBehio();
|
|
4387
|
+
const queryClient = (0, import_react_query40.useQueryClient)();
|
|
4388
|
+
return (0, import_react_query40.useMutation)({
|
|
4389
|
+
mutationFn: (input) => unwrap(client.bookings.reschedule(token, input)),
|
|
4390
|
+
onSuccess: (booking) => queryClient.setQueryData(["behio", "bookings", "manage", token], booking),
|
|
4391
|
+
onSettled: () => queryClient.invalidateQueries({ queryKey: ["behio", "bookings", "manage", token, "slots"] })
|
|
4392
|
+
});
|
|
4393
|
+
}
|
|
4394
|
+
|
|
4395
|
+
// src/react/hooks/use-shop-info.ts
|
|
4396
|
+
var import_react_query41 = require("@tanstack/react-query");
|
|
4397
|
+
function useShopInfo(options) {
|
|
4398
|
+
const { client } = useBehio();
|
|
4399
|
+
return (0, import_react_query41.useQuery)({
|
|
4262
4400
|
queryKey: ["behio", "shop-info"],
|
|
4263
4401
|
queryFn: () => unwrap(client.getShopInfo()),
|
|
4264
4402
|
enabled: options?.enabled !== false
|
|
@@ -4266,10 +4404,10 @@ function useShopInfo(options) {
|
|
|
4266
4404
|
}
|
|
4267
4405
|
|
|
4268
4406
|
// src/react/hooks/use-shop-scripts.ts
|
|
4269
|
-
var
|
|
4407
|
+
var import_react_query42 = require("@tanstack/react-query");
|
|
4270
4408
|
function useShopScripts(options) {
|
|
4271
4409
|
const { client } = useBehio();
|
|
4272
|
-
return (0,
|
|
4410
|
+
return (0, import_react_query42.useQuery)({
|
|
4273
4411
|
queryKey: ["behio", "shop-scripts"],
|
|
4274
4412
|
queryFn: () => unwrap(client.getShopScripts()),
|
|
4275
4413
|
enabled: options?.enabled !== false,
|
|
@@ -4278,11 +4416,11 @@ function useShopScripts(options) {
|
|
|
4278
4416
|
}
|
|
4279
4417
|
|
|
4280
4418
|
// src/react/hooks/use-shop-seo.ts
|
|
4281
|
-
var
|
|
4419
|
+
var import_react_query43 = require("@tanstack/react-query");
|
|
4282
4420
|
function useShopSeo(options) {
|
|
4283
4421
|
const { client } = useBehio();
|
|
4284
4422
|
const { locale, initialData, enabled = true } = options ?? {};
|
|
4285
|
-
return (0,
|
|
4423
|
+
return (0, import_react_query43.useQuery)({
|
|
4286
4424
|
queryKey: ["behio", "shop-seo", locale ?? "_default"],
|
|
4287
4425
|
queryFn: () => unwrap(client.getShopSeo(locale)),
|
|
4288
4426
|
initialData,
|
|
@@ -4345,20 +4483,20 @@ function CurrencySwitcher({
|
|
|
4345
4483
|
var import_react18 = require("react");
|
|
4346
4484
|
|
|
4347
4485
|
// src/react/hooks/use-consent.ts
|
|
4348
|
-
var
|
|
4486
|
+
var import_react_query44 = require("@tanstack/react-query");
|
|
4349
4487
|
function useCookieConsent(visitorId) {
|
|
4350
4488
|
const { client } = useBehio();
|
|
4351
|
-
const qc = (0,
|
|
4352
|
-
const query = (0,
|
|
4489
|
+
const qc = (0, import_react_query44.useQueryClient)();
|
|
4490
|
+
const query = (0, import_react_query44.useQuery)({
|
|
4353
4491
|
queryKey: ["behio", "consent", visitorId],
|
|
4354
4492
|
queryFn: () => unwrap(client.consent.get(visitorId)),
|
|
4355
4493
|
enabled: Boolean(visitorId)
|
|
4356
4494
|
});
|
|
4357
|
-
const recordMutation = (0,
|
|
4495
|
+
const recordMutation = (0, import_react_query44.useMutation)({
|
|
4358
4496
|
mutationFn: (input) => unwrap(client.consent.record(input)),
|
|
4359
4497
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "consent"] })
|
|
4360
4498
|
});
|
|
4361
|
-
const revokeMutation = (0,
|
|
4499
|
+
const revokeMutation = (0, import_react_query44.useMutation)({
|
|
4362
4500
|
mutationFn: () => unwrap(client.consent.revoke(visitorId)),
|
|
4363
4501
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "consent"] })
|
|
4364
4502
|
});
|
|
@@ -4737,11 +4875,11 @@ function RichText({ html, className, as = "div" }) {
|
|
|
4737
4875
|
}
|
|
4738
4876
|
|
|
4739
4877
|
// src/react/hooks/use-bundles.ts
|
|
4740
|
-
var
|
|
4878
|
+
var import_react_query45 = require("@tanstack/react-query");
|
|
4741
4879
|
function useBundles(options) {
|
|
4742
4880
|
const { client, sessionRestored } = useBehio();
|
|
4743
4881
|
const query = { locale: options?.locale ?? client.getLocale(), currency: options?.currency ?? client.getCurrency(), country: options?.country ?? client.getCountry() };
|
|
4744
|
-
return (0,
|
|
4882
|
+
return (0, import_react_query45.useQuery)({
|
|
4745
4883
|
queryKey: ["behio", "bundles", query],
|
|
4746
4884
|
queryFn: () => unwrap(client.catalog.getBundles(query)),
|
|
4747
4885
|
enabled: sessionRestored && (options?.enabled ?? true),
|
|
@@ -4751,7 +4889,7 @@ function useBundles(options) {
|
|
|
4751
4889
|
function useBundle(slug, options) {
|
|
4752
4890
|
const { client, sessionRestored } = useBehio();
|
|
4753
4891
|
const query = { locale: options?.locale ?? client.getLocale(), currency: options?.currency ?? client.getCurrency(), country: options?.country ?? client.getCountry() };
|
|
4754
|
-
return (0,
|
|
4892
|
+
return (0, import_react_query45.useQuery)({
|
|
4755
4893
|
queryKey: ["behio", "bundle", slug, query],
|
|
4756
4894
|
queryFn: () => unwrap(client.catalog.getBundle(slug, query)),
|
|
4757
4895
|
enabled: sessionRestored && Boolean(slug) && (options?.enabled ?? true),
|
|
@@ -4760,10 +4898,10 @@ function useBundle(slug, options) {
|
|
|
4760
4898
|
}
|
|
4761
4899
|
|
|
4762
4900
|
// src/react/hooks/use-product-group.ts
|
|
4763
|
-
var
|
|
4901
|
+
var import_react_query46 = require("@tanstack/react-query");
|
|
4764
4902
|
function useProductGroup(slug, options) {
|
|
4765
4903
|
const { client } = useBehio();
|
|
4766
|
-
return (0,
|
|
4904
|
+
return (0, import_react_query46.useQuery)({
|
|
4767
4905
|
queryKey: ["behio", "product-group", slug, options?.locale, options?.currency],
|
|
4768
4906
|
queryFn: () => unwrap(
|
|
4769
4907
|
client.catalog.getProductGroup(slug, {
|
|
@@ -4777,10 +4915,10 @@ function useProductGroup(slug, options) {
|
|
|
4777
4915
|
}
|
|
4778
4916
|
|
|
4779
4917
|
// src/react/hooks/use-cross-sell.ts
|
|
4780
|
-
var
|
|
4918
|
+
var import_react_query47 = require("@tanstack/react-query");
|
|
4781
4919
|
function useCrossSell(productSlug, options) {
|
|
4782
4920
|
const { client } = useBehio();
|
|
4783
|
-
return (0,
|
|
4921
|
+
return (0, import_react_query47.useQuery)({
|
|
4784
4922
|
queryKey: ["behio", "cross-sell", productSlug, options?.locale, options?.currency],
|
|
4785
4923
|
queryFn: () => unwrap(
|
|
4786
4924
|
client.catalog.getCrossSell(productSlug, {
|
|
@@ -4794,10 +4932,10 @@ function useCrossSell(productSlug, options) {
|
|
|
4794
4932
|
}
|
|
4795
4933
|
|
|
4796
4934
|
// src/react/hooks/use-product-promotions.ts
|
|
4797
|
-
var
|
|
4935
|
+
var import_react_query48 = require("@tanstack/react-query");
|
|
4798
4936
|
function useProductPromotions(productSlug, options) {
|
|
4799
4937
|
const { client } = useBehio();
|
|
4800
|
-
return (0,
|
|
4938
|
+
return (0, import_react_query48.useQuery)({
|
|
4801
4939
|
queryKey: ["behio", "product-promotions", productSlug],
|
|
4802
4940
|
queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
|
|
4803
4941
|
enabled: Boolean(productSlug) && (options?.enabled ?? true),
|
|
@@ -4806,11 +4944,11 @@ function useProductPromotions(productSlug, options) {
|
|
|
4806
4944
|
}
|
|
4807
4945
|
|
|
4808
4946
|
// src/react/hooks/use-gift-card.ts
|
|
4809
|
-
var
|
|
4947
|
+
var import_react_query49 = require("@tanstack/react-query");
|
|
4810
4948
|
function useGiftCardBalance(code, options) {
|
|
4811
4949
|
const { client } = useBehio();
|
|
4812
4950
|
const trimmed = code?.trim();
|
|
4813
|
-
return (0,
|
|
4951
|
+
return (0, import_react_query49.useQuery)({
|
|
4814
4952
|
queryKey: ["behio", "gift-card-balance", trimmed],
|
|
4815
4953
|
queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
|
|
4816
4954
|
enabled: Boolean(trimmed && trimmed.length >= 6) && (options?.enabled ?? true)
|
|
@@ -4818,20 +4956,20 @@ function useGiftCardBalance(code, options) {
|
|
|
4818
4956
|
}
|
|
4819
4957
|
|
|
4820
4958
|
// src/react/hooks/use-wishlist.ts
|
|
4821
|
-
var
|
|
4959
|
+
var import_react_query50 = require("@tanstack/react-query");
|
|
4822
4960
|
function useWishlist(options) {
|
|
4823
4961
|
const { client } = useBehio();
|
|
4824
|
-
const qc = (0,
|
|
4825
|
-
const query = (0,
|
|
4962
|
+
const qc = (0, import_react_query50.useQueryClient)();
|
|
4963
|
+
const query = (0, import_react_query50.useQuery)({
|
|
4826
4964
|
queryKey: ["behio", "wishlist"],
|
|
4827
4965
|
queryFn: () => unwrap(client.wishlist.get()),
|
|
4828
4966
|
enabled: options?.enabled ?? true
|
|
4829
4967
|
});
|
|
4830
|
-
const addMutation = (0,
|
|
4968
|
+
const addMutation = (0, import_react_query50.useMutation)({
|
|
4831
4969
|
mutationFn: (productId) => unwrap(client.wishlist.add(productId)),
|
|
4832
4970
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
|
|
4833
4971
|
});
|
|
4834
|
-
const removeMutation = (0,
|
|
4972
|
+
const removeMutation = (0, import_react_query50.useMutation)({
|
|
4835
4973
|
mutationFn: (productId) => unwrap(client.wishlist.remove(productId)),
|
|
4836
4974
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
|
|
4837
4975
|
});
|
|
@@ -4845,7 +4983,7 @@ function useWishlist(options) {
|
|
|
4845
4983
|
}
|
|
4846
4984
|
function useIsInWishlist(productId) {
|
|
4847
4985
|
const { client } = useBehio();
|
|
4848
|
-
return (0,
|
|
4986
|
+
return (0, import_react_query50.useQuery)({
|
|
4849
4987
|
queryKey: ["behio", "wishlist-check", productId],
|
|
4850
4988
|
queryFn: () => unwrap(client.wishlist.isInWishlist(productId)),
|
|
4851
4989
|
enabled: Boolean(productId)
|
|
@@ -4853,10 +4991,10 @@ function useIsInWishlist(productId) {
|
|
|
4853
4991
|
}
|
|
4854
4992
|
|
|
4855
4993
|
// src/react/hooks/use-reviews.ts
|
|
4856
|
-
var
|
|
4994
|
+
var import_react_query51 = require("@tanstack/react-query");
|
|
4857
4995
|
function useProductReviews(productId, options) {
|
|
4858
4996
|
const { client } = useBehio();
|
|
4859
|
-
return (0,
|
|
4997
|
+
return (0, import_react_query51.useQuery)({
|
|
4860
4998
|
queryKey: ["behio", "reviews", productId, options?.page ?? 1, options?.limit ?? 20],
|
|
4861
4999
|
queryFn: () => unwrap(client.reviews.getProductReviews(productId, options?.page, options?.limit)),
|
|
4862
5000
|
initialData: options?.initialData,
|
|
@@ -4866,30 +5004,36 @@ function useProductReviews(productId, options) {
|
|
|
4866
5004
|
}
|
|
4867
5005
|
function useSubmitReview() {
|
|
4868
5006
|
const { client } = useBehio();
|
|
4869
|
-
const qc = (0,
|
|
4870
|
-
return (0,
|
|
5007
|
+
const qc = (0, import_react_query51.useQueryClient)();
|
|
5008
|
+
return (0, import_react_query51.useMutation)({
|
|
4871
5009
|
mutationFn: (input) => unwrap(client.reviews.submit(input)),
|
|
4872
5010
|
onSuccess: (_, input) => qc.invalidateQueries({ queryKey: ["behio", "reviews", input.productId] })
|
|
4873
5011
|
});
|
|
4874
5012
|
}
|
|
4875
5013
|
|
|
4876
5014
|
// src/react/hooks/use-returns.ts
|
|
4877
|
-
var
|
|
5015
|
+
var import_react_query52 = require("@tanstack/react-query");
|
|
4878
5016
|
function useLookupReturnableOrder() {
|
|
4879
5017
|
const { client } = useBehio();
|
|
4880
|
-
return (0,
|
|
5018
|
+
return (0, import_react_query52.useMutation)({
|
|
4881
5019
|
mutationFn: ({ orderNumber, email }) => unwrap(client.returns.lookupOrder(orderNumber, email))
|
|
4882
5020
|
});
|
|
4883
5021
|
}
|
|
5022
|
+
function useSubmitWithdrawal() {
|
|
5023
|
+
const { client } = useBehio();
|
|
5024
|
+
return (0, import_react_query52.useMutation)({
|
|
5025
|
+
mutationFn: (input) => unwrap(client.returns.withdraw(input))
|
|
5026
|
+
});
|
|
5027
|
+
}
|
|
4884
5028
|
function useSubmitReturn() {
|
|
4885
5029
|
const { client } = useBehio();
|
|
4886
|
-
return (0,
|
|
5030
|
+
return (0, import_react_query52.useMutation)({
|
|
4887
5031
|
mutationFn: (input) => unwrap(client.returns.submit(input))
|
|
4888
5032
|
});
|
|
4889
5033
|
}
|
|
4890
5034
|
function useReturnStatus(returnId, email) {
|
|
4891
5035
|
const { client } = useBehio();
|
|
4892
|
-
return (0,
|
|
5036
|
+
return (0, import_react_query52.useQuery)({
|
|
4893
5037
|
queryKey: ["behio", "return-status", returnId],
|
|
4894
5038
|
queryFn: () => unwrap(client.returns.getStatus(returnId, email)),
|
|
4895
5039
|
enabled: Boolean(returnId && email)
|
|
@@ -4897,16 +5041,16 @@ function useReturnStatus(returnId, email) {
|
|
|
4897
5041
|
}
|
|
4898
5042
|
|
|
4899
5043
|
// src/react/hooks/use-quotes.ts
|
|
4900
|
-
var
|
|
5044
|
+
var import_react_query53 = require("@tanstack/react-query");
|
|
4901
5045
|
function useSubmitQuote() {
|
|
4902
5046
|
const { client } = useBehio();
|
|
4903
|
-
return (0,
|
|
5047
|
+
return (0, import_react_query53.useMutation)({
|
|
4904
5048
|
mutationFn: (input) => unwrap(client.quotes.submit(input))
|
|
4905
5049
|
});
|
|
4906
5050
|
}
|
|
4907
5051
|
function useQuoteStatus(quoteId, email) {
|
|
4908
5052
|
const { client } = useBehio();
|
|
4909
|
-
return (0,
|
|
5053
|
+
return (0, import_react_query53.useQuery)({
|
|
4910
5054
|
queryKey: ["behio", "quote-status", quoteId],
|
|
4911
5055
|
queryFn: () => unwrap(client.quotes.getStatus(quoteId, email)),
|
|
4912
5056
|
enabled: Boolean(quoteId && email)
|
|
@@ -4914,10 +5058,10 @@ function useQuoteStatus(quoteId, email) {
|
|
|
4914
5058
|
}
|
|
4915
5059
|
|
|
4916
5060
|
// src/react/hooks/use-back-in-stock.ts
|
|
4917
|
-
var
|
|
5061
|
+
var import_react_query54 = require("@tanstack/react-query");
|
|
4918
5062
|
function useNotifyWhenAvailable() {
|
|
4919
5063
|
const { client } = useBehio();
|
|
4920
|
-
return (0,
|
|
5064
|
+
return (0, import_react_query54.useMutation)({
|
|
4921
5065
|
mutationFn: ({ productId, email }) => unwrap(client.catalog.notifyWhenAvailable(productId, email))
|
|
4922
5066
|
});
|
|
4923
5067
|
}
|
|
@@ -5066,8 +5210,11 @@ async function revokeAnalyticsConsent(client) {
|
|
|
5066
5210
|
useBlogPost,
|
|
5067
5211
|
useBlogPosts,
|
|
5068
5212
|
useBlogs,
|
|
5213
|
+
useBookingConfig,
|
|
5214
|
+
useBookingSlots,
|
|
5069
5215
|
useBundle,
|
|
5070
5216
|
useBundles,
|
|
5217
|
+
useCancelBooking,
|
|
5071
5218
|
useCart,
|
|
5072
5219
|
useCartCount,
|
|
5073
5220
|
useCategories,
|
|
@@ -5081,6 +5228,7 @@ async function revokeAnalyticsConsent(client) {
|
|
|
5081
5228
|
useCourse,
|
|
5082
5229
|
useCourseCertificates,
|
|
5083
5230
|
useCourses,
|
|
5231
|
+
useCreateBooking,
|
|
5084
5232
|
useCrossSell,
|
|
5085
5233
|
useCurrency,
|
|
5086
5234
|
useCustomer,
|
|
@@ -5098,6 +5246,8 @@ async function revokeAnalyticsConsent(client) {
|
|
|
5098
5246
|
useLessonTutor,
|
|
5099
5247
|
useLookupReturnableOrder,
|
|
5100
5248
|
useLoyalty,
|
|
5249
|
+
useManagedBooking,
|
|
5250
|
+
useManagedBookingSlots,
|
|
5101
5251
|
useMenu,
|
|
5102
5252
|
useNewsletterSubscribe,
|
|
5103
5253
|
useNewsletterUnsubscribe,
|
|
@@ -5117,6 +5267,7 @@ async function revokeAnalyticsConsent(client) {
|
|
|
5117
5267
|
useProductReviews,
|
|
5118
5268
|
useProducts,
|
|
5119
5269
|
useQuoteStatus,
|
|
5270
|
+
useRescheduleBooking,
|
|
5120
5271
|
useReturnStatus,
|
|
5121
5272
|
useSearch,
|
|
5122
5273
|
useShippingMethods,
|
|
@@ -5129,6 +5280,7 @@ async function revokeAnalyticsConsent(client) {
|
|
|
5129
5280
|
useSubmitQuote,
|
|
5130
5281
|
useSubmitReturn,
|
|
5131
5282
|
useSubmitReview,
|
|
5283
|
+
useSubmitWithdrawal,
|
|
5132
5284
|
useSubscriptions,
|
|
5133
5285
|
useVisitorMessages,
|
|
5134
5286
|
useWishlist
|