@behio/storefront-sdk 0.8.0 → 0.10.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-DMTMGPUZ.js → chunk-LNSFBNPJ.js} +58 -14
- package/dist/{chunk-EZEZUV2B.mjs → chunk-O3IM7PAY.mjs} +46 -2
- package/dist/index.d.mts +62 -3
- package/dist/index.d.ts +62 -3
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/next.js +2 -2
- package/dist/next.mjs +1 -1
- package/dist/react.d.mts +31 -2
- package/dist/react.d.ts +31 -2
- package/dist/react.js +64 -3
- package/dist/react.mjs +83 -22
- package/package.json +1 -1
|
@@ -307,7 +307,10 @@ var BehioStorefront = class {
|
|
|
307
307
|
if (this.cartSession) {
|
|
308
308
|
headers["X-Cart-Session"] = this.cartSession;
|
|
309
309
|
}
|
|
310
|
-
|
|
310
|
+
if (_optionalChain([options, 'optionalAccess', _14 => _14.headers])) {
|
|
311
|
+
Object.assign(headers, options.headers);
|
|
312
|
+
}
|
|
313
|
+
const bodyStr = _optionalChain([options, 'optionalAccess', _15 => _15.body]) ? JSON.stringify(options.body) : void 0;
|
|
311
314
|
let interceptedConfig = {
|
|
312
315
|
url,
|
|
313
316
|
method,
|
|
@@ -321,7 +324,7 @@ var BehioStorefront = class {
|
|
|
321
324
|
for (let attempt = 0; attempt <= this.retries; attempt++) {
|
|
322
325
|
const controller = new AbortController();
|
|
323
326
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
324
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
327
|
+
if (_optionalChain([options, 'optionalAccess', _16 => _16.signal])) {
|
|
325
328
|
if (options.signal.aborted) {
|
|
326
329
|
clearTimeout(timeoutId);
|
|
327
330
|
throw new BehioNetworkError("Request aborted", false);
|
|
@@ -362,8 +365,8 @@ var BehioStorefront = class {
|
|
|
362
365
|
this.emit("response", { method, path, status: res.status });
|
|
363
366
|
if (!res.ok) {
|
|
364
367
|
const body = await res.json().catch(() => null);
|
|
365
|
-
const apiError = new BehioApiError(res.status, body, _optionalChain([body, 'optionalAccess',
|
|
366
|
-
if (res.status === 401 && this.refreshToken && _optionalChain([options, 'optionalAccess',
|
|
368
|
+
const apiError = new BehioApiError(res.status, body, _optionalChain([body, 'optionalAccess', _17 => _17.message]) || `API Error ${res.status}`);
|
|
369
|
+
if (res.status === 401 && this.refreshToken && _optionalChain([options, 'optionalAccess', _18 => _18.auth]) !== false && !_optionalChain([options, 'optionalAccess', _19 => _19._isRetryAfterRefresh])) {
|
|
367
370
|
try {
|
|
368
371
|
await this.handleTokenRefresh();
|
|
369
372
|
return this.rawRequest(method, path, { ...options, _isRetryAfterRefresh: true });
|
|
@@ -426,7 +429,7 @@ var CatalogModule = class {
|
|
|
426
429
|
/** Get product detail by slug */
|
|
427
430
|
async getProduct(slug, options) {
|
|
428
431
|
return this.client.request("GET", `/catalog/products/${slug}`, {
|
|
429
|
-
query: { locale: _optionalChain([options, 'optionalAccess',
|
|
432
|
+
query: { locale: _optionalChain([options, 'optionalAccess', _20 => _20.locale]), currency: _optionalChain([options, 'optionalAccess', _21 => _21.currency]) }
|
|
430
433
|
});
|
|
431
434
|
}
|
|
432
435
|
/** Get category tree */
|
|
@@ -460,7 +463,7 @@ var CatalogModule = class {
|
|
|
460
463
|
/** Get featured products */
|
|
461
464
|
async getFeatured(options) {
|
|
462
465
|
return this.client.request("GET", "/catalog/featured", {
|
|
463
|
-
query: { locale: _optionalChain([options, 'optionalAccess',
|
|
466
|
+
query: { locale: _optionalChain([options, 'optionalAccess', _22 => _22.locale]), currency: _optionalChain([options, 'optionalAccess', _23 => _23.currency]) }
|
|
464
467
|
});
|
|
465
468
|
}
|
|
466
469
|
/** Get available filter fields for dynamic filter UI */
|
|
@@ -505,7 +508,7 @@ var CatalogModule = class {
|
|
|
505
508
|
/** List configured payment methods (filtered by currency). */
|
|
506
509
|
async listPaymentMethods(opts) {
|
|
507
510
|
const query = {};
|
|
508
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
511
|
+
if (_optionalChain([opts, 'optionalAccess', _24 => _24.currency])) query.currency = opts.currency;
|
|
509
512
|
return this.client.request("GET", "/catalog/payment-methods", { query });
|
|
510
513
|
}
|
|
511
514
|
};
|
|
@@ -746,7 +749,7 @@ var OrdersModule = class {
|
|
|
746
749
|
/** List customer orders (requires auth) */
|
|
747
750
|
async list(options) {
|
|
748
751
|
return this.client.request("GET", "/orders", {
|
|
749
|
-
query: { page: _optionalChain([options, 'optionalAccess',
|
|
752
|
+
query: { page: _optionalChain([options, 'optionalAccess', _25 => _25.page]), limit: _optionalChain([options, 'optionalAccess', _26 => _26.limit]) }
|
|
750
753
|
});
|
|
751
754
|
}
|
|
752
755
|
/** Get order detail (requires auth) */
|
|
@@ -757,10 +760,50 @@ var OrdersModule = class {
|
|
|
757
760
|
async cancel(orderNumber) {
|
|
758
761
|
return this.client.request("POST", `/orders/${orderNumber}/cancel`);
|
|
759
762
|
}
|
|
760
|
-
/**
|
|
763
|
+
/**
|
|
764
|
+
* Track an order by tracking token (no login, only API key). Returns a
|
|
765
|
+
* PII-minimized view: order status + items + masked email + destination
|
|
766
|
+
* city, never full address / phone / billing — the token travels in URLs
|
|
767
|
+
* and e-mails so it must not expose full personal data.
|
|
768
|
+
*/
|
|
761
769
|
async track(trackingToken) {
|
|
762
770
|
return this.client.request("GET", `/orders/track/${trackingToken}`, { auth: false });
|
|
763
771
|
}
|
|
772
|
+
/**
|
|
773
|
+
* Step 1 of guest order-access: request a 6-digit code e-mailed to the
|
|
774
|
+
* address on the order. The response is always generic (success) regardless
|
|
775
|
+
* of whether the order number + e-mail match, so order numbers can't be
|
|
776
|
+
* enumerated. No login, only API key.
|
|
777
|
+
*/
|
|
778
|
+
async requestAccessCode(orderNumber, email) {
|
|
779
|
+
return this.client.request("POST", "/orders/access/request", {
|
|
780
|
+
auth: false,
|
|
781
|
+
body: { orderNumber, email }
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Step 2 of guest order-access: verify the e-mailed code. On success returns
|
|
786
|
+
* the FULL order detail plus a short-lived `accessToken` you can pass to
|
|
787
|
+
* {@link getByAccessToken} to re-fetch the detail without re-entering the
|
|
788
|
+
* code. No login, only API key.
|
|
789
|
+
*/
|
|
790
|
+
async verifyAccessCode(orderNumber, email, code) {
|
|
791
|
+
return this.client.request("POST", "/orders/access/verify", {
|
|
792
|
+
auth: false,
|
|
793
|
+
body: { orderNumber, email, code }
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Re-fetch a guest order's full detail using the `accessToken` returned by
|
|
798
|
+
* {@link verifyAccessCode}. The token is scoped to that single order and
|
|
799
|
+
* expires after 30 minutes.
|
|
800
|
+
*/
|
|
801
|
+
async getByAccessToken(accessToken) {
|
|
802
|
+
return this.client.request("GET", "/orders/access/detail", {
|
|
803
|
+
auth: false,
|
|
804
|
+
headers: { "X-Order-Access": accessToken }
|
|
805
|
+
});
|
|
806
|
+
}
|
|
764
807
|
};
|
|
765
808
|
var CustomerModule = class {
|
|
766
809
|
constructor(client) {
|
|
@@ -860,8 +903,9 @@ var ReturnsModule = class {
|
|
|
860
903
|
async submit(input) {
|
|
861
904
|
return this.client.request("POST", "/returns", { body: input });
|
|
862
905
|
}
|
|
906
|
+
/** Email is the ownership gate; POST so it never lands in a URL / log. */
|
|
863
907
|
async getStatus(returnId, email) {
|
|
864
|
-
return this.client.request("
|
|
908
|
+
return this.client.request("POST", `/returns/${returnId}/status`, { body: { email } });
|
|
865
909
|
}
|
|
866
910
|
};
|
|
867
911
|
var ConsentModule = class {
|
|
@@ -928,10 +972,10 @@ var ShippingModule = class {
|
|
|
928
972
|
*/
|
|
929
973
|
async listMethods(opts) {
|
|
930
974
|
const query = {};
|
|
931
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
932
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
933
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
934
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
975
|
+
if (_optionalChain([opts, 'optionalAccess', _27 => _27.currency])) query.currency = opts.currency;
|
|
976
|
+
if (_optionalChain([opts, 'optionalAccess', _28 => _28.country])) query.country = opts.country;
|
|
977
|
+
if (_optionalChain([opts, 'optionalAccess', _29 => _29.cartTotal]) != null) query.cartTotal = String(opts.cartTotal);
|
|
978
|
+
if (_optionalChain([opts, 'optionalAccess', _30 => _30.cartWeightKg]) != null) query.cartWeightKg = String(opts.cartWeightKg);
|
|
935
979
|
return this.client.request(
|
|
936
980
|
"GET",
|
|
937
981
|
"/catalog/shipping-methods",
|
|
@@ -307,6 +307,9 @@ var BehioStorefront = class {
|
|
|
307
307
|
if (this.cartSession) {
|
|
308
308
|
headers["X-Cart-Session"] = this.cartSession;
|
|
309
309
|
}
|
|
310
|
+
if (options?.headers) {
|
|
311
|
+
Object.assign(headers, options.headers);
|
|
312
|
+
}
|
|
310
313
|
const bodyStr = options?.body ? JSON.stringify(options.body) : void 0;
|
|
311
314
|
let interceptedConfig = {
|
|
312
315
|
url,
|
|
@@ -757,10 +760,50 @@ var OrdersModule = class {
|
|
|
757
760
|
async cancel(orderNumber) {
|
|
758
761
|
return this.client.request("POST", `/orders/${orderNumber}/cancel`);
|
|
759
762
|
}
|
|
760
|
-
/**
|
|
763
|
+
/**
|
|
764
|
+
* Track an order by tracking token (no login, only API key). Returns a
|
|
765
|
+
* PII-minimized view: order status + items + masked email + destination
|
|
766
|
+
* city, never full address / phone / billing — the token travels in URLs
|
|
767
|
+
* and e-mails so it must not expose full personal data.
|
|
768
|
+
*/
|
|
761
769
|
async track(trackingToken) {
|
|
762
770
|
return this.client.request("GET", `/orders/track/${trackingToken}`, { auth: false });
|
|
763
771
|
}
|
|
772
|
+
/**
|
|
773
|
+
* Step 1 of guest order-access: request a 6-digit code e-mailed to the
|
|
774
|
+
* address on the order. The response is always generic (success) regardless
|
|
775
|
+
* of whether the order number + e-mail match, so order numbers can't be
|
|
776
|
+
* enumerated. No login, only API key.
|
|
777
|
+
*/
|
|
778
|
+
async requestAccessCode(orderNumber, email) {
|
|
779
|
+
return this.client.request("POST", "/orders/access/request", {
|
|
780
|
+
auth: false,
|
|
781
|
+
body: { orderNumber, email }
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Step 2 of guest order-access: verify the e-mailed code. On success returns
|
|
786
|
+
* the FULL order detail plus a short-lived `accessToken` you can pass to
|
|
787
|
+
* {@link getByAccessToken} to re-fetch the detail without re-entering the
|
|
788
|
+
* code. No login, only API key.
|
|
789
|
+
*/
|
|
790
|
+
async verifyAccessCode(orderNumber, email, code) {
|
|
791
|
+
return this.client.request("POST", "/orders/access/verify", {
|
|
792
|
+
auth: false,
|
|
793
|
+
body: { orderNumber, email, code }
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Re-fetch a guest order's full detail using the `accessToken` returned by
|
|
798
|
+
* {@link verifyAccessCode}. The token is scoped to that single order and
|
|
799
|
+
* expires after 30 minutes.
|
|
800
|
+
*/
|
|
801
|
+
async getByAccessToken(accessToken) {
|
|
802
|
+
return this.client.request("GET", "/orders/access/detail", {
|
|
803
|
+
auth: false,
|
|
804
|
+
headers: { "X-Order-Access": accessToken }
|
|
805
|
+
});
|
|
806
|
+
}
|
|
764
807
|
};
|
|
765
808
|
var CustomerModule = class {
|
|
766
809
|
constructor(client) {
|
|
@@ -860,8 +903,9 @@ var ReturnsModule = class {
|
|
|
860
903
|
async submit(input) {
|
|
861
904
|
return this.client.request("POST", "/returns", { body: input });
|
|
862
905
|
}
|
|
906
|
+
/** Email is the ownership gate; POST so it never lands in a URL / log. */
|
|
863
907
|
async getStatus(returnId, email) {
|
|
864
|
-
return this.client.request("
|
|
908
|
+
return this.client.request("POST", `/returns/${returnId}/status`, { body: { email } });
|
|
865
909
|
}
|
|
866
910
|
};
|
|
867
911
|
var ConsentModule = class {
|
package/dist/index.d.mts
CHANGED
|
@@ -392,6 +392,25 @@ interface OrderItem {
|
|
|
392
392
|
totalPrice: number;
|
|
393
393
|
totalPriceWithTax: number;
|
|
394
394
|
}
|
|
395
|
+
/**
|
|
396
|
+
* PII-minimized order view returned by `orders.track(token)`. The tracking
|
|
397
|
+
* token is shared in URLs and e-mails, so this deliberately omits full
|
|
398
|
+
* address, phone, billing and customer note, and masks the email.
|
|
399
|
+
*/
|
|
400
|
+
interface OrderTracking {
|
|
401
|
+
orderNumber: string;
|
|
402
|
+
status: OrderStatus;
|
|
403
|
+
paymentStatus: PaymentStatus;
|
|
404
|
+
fulfillmentStatus: FulfillmentStatus;
|
|
405
|
+
currency: string;
|
|
406
|
+
grandTotal: number;
|
|
407
|
+
/** Masked, e.g. "j***@e***.cz" */
|
|
408
|
+
emailMasked: string;
|
|
409
|
+
shippingCity: string | null;
|
|
410
|
+
shippingCountry: string | null;
|
|
411
|
+
items: OrderItem[];
|
|
412
|
+
createdAt: number;
|
|
413
|
+
}
|
|
395
414
|
interface OrderStatusHistory {
|
|
396
415
|
fromStatus?: OrderStatus;
|
|
397
416
|
toStatus: OrderStatus;
|
|
@@ -421,6 +440,19 @@ interface OrderDetail extends OrderListItem {
|
|
|
421
440
|
*/
|
|
422
441
|
paymentRedirectUrl?: string | null;
|
|
423
442
|
}
|
|
443
|
+
/** Generic response to `orders.requestAccessCode` — never reveals existence. */
|
|
444
|
+
interface OrderAccessRequestResponse {
|
|
445
|
+
success: boolean;
|
|
446
|
+
message: string;
|
|
447
|
+
}
|
|
448
|
+
/** Response to a successful `orders.verifyAccessCode`. */
|
|
449
|
+
interface OrderAccessVerifyResponse {
|
|
450
|
+
/** Short-lived JWT scoped to this single order (use with `getByAccessToken`). */
|
|
451
|
+
accessToken: string;
|
|
452
|
+
/** Token lifetime in seconds. */
|
|
453
|
+
expiresIn: number;
|
|
454
|
+
order: OrderDetail;
|
|
455
|
+
}
|
|
424
456
|
interface CustomerProfile {
|
|
425
457
|
id: string;
|
|
426
458
|
email: string;
|
|
@@ -933,6 +965,7 @@ declare class BehioStorefront {
|
|
|
933
965
|
query?: Record<string, string | number | boolean | undefined | string[] | number[]>;
|
|
934
966
|
auth?: boolean;
|
|
935
967
|
signal?: AbortSignal;
|
|
968
|
+
headers?: Record<string, string>;
|
|
936
969
|
}): Promise<SdkResult<T>>;
|
|
937
970
|
/**
|
|
938
971
|
* Throws on failure (API error / network / timeout). Kept private so
|
|
@@ -1094,8 +1127,33 @@ declare class OrdersModule {
|
|
|
1094
1127
|
get(orderNumber: string): Promise<SdkResult<OrderDetail>>;
|
|
1095
1128
|
/** Cancel a PENDING order (requires auth) */
|
|
1096
1129
|
cancel(orderNumber: string): Promise<SdkResult<OrderDetail>>;
|
|
1097
|
-
/**
|
|
1098
|
-
|
|
1130
|
+
/**
|
|
1131
|
+
* Track an order by tracking token (no login, only API key). Returns a
|
|
1132
|
+
* PII-minimized view: order status + items + masked email + destination
|
|
1133
|
+
* city, never full address / phone / billing — the token travels in URLs
|
|
1134
|
+
* and e-mails so it must not expose full personal data.
|
|
1135
|
+
*/
|
|
1136
|
+
track(trackingToken: string): Promise<SdkResult<OrderTracking>>;
|
|
1137
|
+
/**
|
|
1138
|
+
* Step 1 of guest order-access: request a 6-digit code e-mailed to the
|
|
1139
|
+
* address on the order. The response is always generic (success) regardless
|
|
1140
|
+
* of whether the order number + e-mail match, so order numbers can't be
|
|
1141
|
+
* enumerated. No login, only API key.
|
|
1142
|
+
*/
|
|
1143
|
+
requestAccessCode(orderNumber: string, email: string): Promise<SdkResult<OrderAccessRequestResponse>>;
|
|
1144
|
+
/**
|
|
1145
|
+
* Step 2 of guest order-access: verify the e-mailed code. On success returns
|
|
1146
|
+
* the FULL order detail plus a short-lived `accessToken` you can pass to
|
|
1147
|
+
* {@link getByAccessToken} to re-fetch the detail without re-entering the
|
|
1148
|
+
* code. No login, only API key.
|
|
1149
|
+
*/
|
|
1150
|
+
verifyAccessCode(orderNumber: string, email: string, code: string): Promise<SdkResult<OrderAccessVerifyResponse>>;
|
|
1151
|
+
/**
|
|
1152
|
+
* Re-fetch a guest order's full detail using the `accessToken` returned by
|
|
1153
|
+
* {@link verifyAccessCode}. The token is scoped to that single order and
|
|
1154
|
+
* expires after 30 minutes.
|
|
1155
|
+
*/
|
|
1156
|
+
getByAccessToken(accessToken: string): Promise<SdkResult<OrderDetail>>;
|
|
1099
1157
|
}
|
|
1100
1158
|
declare class CustomerModule {
|
|
1101
1159
|
private client;
|
|
@@ -1164,6 +1222,7 @@ declare class ReturnsModule {
|
|
|
1164
1222
|
*/
|
|
1165
1223
|
lookupOrder(orderNumber: string, email: string): Promise<SdkResult<ReturnableOrder>>;
|
|
1166
1224
|
submit(input: SubmitReturnInput): Promise<SdkResult<ReturnRequest>>;
|
|
1225
|
+
/** Email is the ownership gate; POST so it never lands in a URL / log. */
|
|
1167
1226
|
getStatus(returnId: string, email: string): Promise<SdkResult<ReturnStatus>>;
|
|
1168
1227
|
}
|
|
1169
1228
|
declare class ConsentModule {
|
|
@@ -1256,4 +1315,4 @@ declare class ShippingModule {
|
|
|
1256
1315
|
}>>;
|
|
1257
1316
|
}
|
|
1258
1317
|
|
|
1259
|
-
export { type ActivePromotion, type AddToCartInput, type AddressDetail, type AddressSuggestion, type AddressType, AddressTypes, type AuthTokens, type BackInStockSubscription, BehioApiError, type BehioErrorCode, type BehioEventHandler, type BehioEventType, BehioNetworkError, BehioStorefront, type BehioStorefrontConfig, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type CartItemProduct, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CheckoutPaymentMethod, type CookieConsent, type CookieConsentInput, type CrossSellItem, type CustomerAddress, type CustomerProfile, type DataGroupFieldType, type FilterField, type FulfillmentStatus, FulfillmentStatuses, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type OrderStatusHistory, OrderStatuses, type Page, type PageAttachment, type PageDetail, type PaginatedResponse, type PaymentStatus, PaymentStatuses, type ProductDetail, type ProductLabel, type ProductListItem, type ProductMedia, type ProductMediaVariant, type ProductPrice, type ProductReview, type ProductReviewsResponse, ProductSort, type ProductSortValue, type ProductVariant, type ProductVolumePrice, type ProductsQuery, type QuoteItem, type QuoteRequest, type RegisterInput, type RequestInterceptor, type RequestInterceptorConfig, type ResponseInterceptor, type ResponseInterceptorData, type ReturnRequest, type ReturnRequestItem, type ReturnStatus, type ReturnStatusItem, type ReturnableOrder, type ReturnableOrderItem, type SdkError, type SdkResult, type ShippingMethodSummary, type ShippingQuote, type ShippingQuoteInput, type ShopInfo, type ShopSeo, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type WishlistItem, err, ok, toSdkError };
|
|
1318
|
+
export { type ActivePromotion, type AddToCartInput, type AddressDetail, type AddressSuggestion, type AddressType, AddressTypes, type AuthTokens, type BackInStockSubscription, BehioApiError, type BehioErrorCode, type BehioEventHandler, type BehioEventType, BehioNetworkError, BehioStorefront, type BehioStorefrontConfig, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type CartItemProduct, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CheckoutPaymentMethod, type CookieConsent, type CookieConsentInput, type CrossSellItem, type CustomerAddress, type CustomerProfile, type DataGroupFieldType, type FilterField, type FulfillmentStatus, FulfillmentStatuses, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderAccessRequestResponse, type OrderAccessVerifyResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type OrderStatusHistory, OrderStatuses, type OrderTracking, type Page, type PageAttachment, type PageDetail, type PaginatedResponse, type PaymentStatus, PaymentStatuses, type ProductDetail, type ProductLabel, type ProductListItem, type ProductMedia, type ProductMediaVariant, type ProductPrice, type ProductReview, type ProductReviewsResponse, ProductSort, type ProductSortValue, type ProductVariant, type ProductVolumePrice, type ProductsQuery, type QuoteItem, type QuoteRequest, type RegisterInput, type RequestInterceptor, type RequestInterceptorConfig, type ResponseInterceptor, type ResponseInterceptorData, type ReturnRequest, type ReturnRequestItem, type ReturnStatus, type ReturnStatusItem, type ReturnableOrder, type ReturnableOrderItem, type SdkError, type SdkResult, type ShippingMethodSummary, type ShippingQuote, type ShippingQuoteInput, type ShopInfo, type ShopSeo, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type WishlistItem, err, ok, toSdkError };
|
package/dist/index.d.ts
CHANGED
|
@@ -392,6 +392,25 @@ interface OrderItem {
|
|
|
392
392
|
totalPrice: number;
|
|
393
393
|
totalPriceWithTax: number;
|
|
394
394
|
}
|
|
395
|
+
/**
|
|
396
|
+
* PII-minimized order view returned by `orders.track(token)`. The tracking
|
|
397
|
+
* token is shared in URLs and e-mails, so this deliberately omits full
|
|
398
|
+
* address, phone, billing and customer note, and masks the email.
|
|
399
|
+
*/
|
|
400
|
+
interface OrderTracking {
|
|
401
|
+
orderNumber: string;
|
|
402
|
+
status: OrderStatus;
|
|
403
|
+
paymentStatus: PaymentStatus;
|
|
404
|
+
fulfillmentStatus: FulfillmentStatus;
|
|
405
|
+
currency: string;
|
|
406
|
+
grandTotal: number;
|
|
407
|
+
/** Masked, e.g. "j***@e***.cz" */
|
|
408
|
+
emailMasked: string;
|
|
409
|
+
shippingCity: string | null;
|
|
410
|
+
shippingCountry: string | null;
|
|
411
|
+
items: OrderItem[];
|
|
412
|
+
createdAt: number;
|
|
413
|
+
}
|
|
395
414
|
interface OrderStatusHistory {
|
|
396
415
|
fromStatus?: OrderStatus;
|
|
397
416
|
toStatus: OrderStatus;
|
|
@@ -421,6 +440,19 @@ interface OrderDetail extends OrderListItem {
|
|
|
421
440
|
*/
|
|
422
441
|
paymentRedirectUrl?: string | null;
|
|
423
442
|
}
|
|
443
|
+
/** Generic response to `orders.requestAccessCode` — never reveals existence. */
|
|
444
|
+
interface OrderAccessRequestResponse {
|
|
445
|
+
success: boolean;
|
|
446
|
+
message: string;
|
|
447
|
+
}
|
|
448
|
+
/** Response to a successful `orders.verifyAccessCode`. */
|
|
449
|
+
interface OrderAccessVerifyResponse {
|
|
450
|
+
/** Short-lived JWT scoped to this single order (use with `getByAccessToken`). */
|
|
451
|
+
accessToken: string;
|
|
452
|
+
/** Token lifetime in seconds. */
|
|
453
|
+
expiresIn: number;
|
|
454
|
+
order: OrderDetail;
|
|
455
|
+
}
|
|
424
456
|
interface CustomerProfile {
|
|
425
457
|
id: string;
|
|
426
458
|
email: string;
|
|
@@ -933,6 +965,7 @@ declare class BehioStorefront {
|
|
|
933
965
|
query?: Record<string, string | number | boolean | undefined | string[] | number[]>;
|
|
934
966
|
auth?: boolean;
|
|
935
967
|
signal?: AbortSignal;
|
|
968
|
+
headers?: Record<string, string>;
|
|
936
969
|
}): Promise<SdkResult<T>>;
|
|
937
970
|
/**
|
|
938
971
|
* Throws on failure (API error / network / timeout). Kept private so
|
|
@@ -1094,8 +1127,33 @@ declare class OrdersModule {
|
|
|
1094
1127
|
get(orderNumber: string): Promise<SdkResult<OrderDetail>>;
|
|
1095
1128
|
/** Cancel a PENDING order (requires auth) */
|
|
1096
1129
|
cancel(orderNumber: string): Promise<SdkResult<OrderDetail>>;
|
|
1097
|
-
/**
|
|
1098
|
-
|
|
1130
|
+
/**
|
|
1131
|
+
* Track an order by tracking token (no login, only API key). Returns a
|
|
1132
|
+
* PII-minimized view: order status + items + masked email + destination
|
|
1133
|
+
* city, never full address / phone / billing — the token travels in URLs
|
|
1134
|
+
* and e-mails so it must not expose full personal data.
|
|
1135
|
+
*/
|
|
1136
|
+
track(trackingToken: string): Promise<SdkResult<OrderTracking>>;
|
|
1137
|
+
/**
|
|
1138
|
+
* Step 1 of guest order-access: request a 6-digit code e-mailed to the
|
|
1139
|
+
* address on the order. The response is always generic (success) regardless
|
|
1140
|
+
* of whether the order number + e-mail match, so order numbers can't be
|
|
1141
|
+
* enumerated. No login, only API key.
|
|
1142
|
+
*/
|
|
1143
|
+
requestAccessCode(orderNumber: string, email: string): Promise<SdkResult<OrderAccessRequestResponse>>;
|
|
1144
|
+
/**
|
|
1145
|
+
* Step 2 of guest order-access: verify the e-mailed code. On success returns
|
|
1146
|
+
* the FULL order detail plus a short-lived `accessToken` you can pass to
|
|
1147
|
+
* {@link getByAccessToken} to re-fetch the detail without re-entering the
|
|
1148
|
+
* code. No login, only API key.
|
|
1149
|
+
*/
|
|
1150
|
+
verifyAccessCode(orderNumber: string, email: string, code: string): Promise<SdkResult<OrderAccessVerifyResponse>>;
|
|
1151
|
+
/**
|
|
1152
|
+
* Re-fetch a guest order's full detail using the `accessToken` returned by
|
|
1153
|
+
* {@link verifyAccessCode}. The token is scoped to that single order and
|
|
1154
|
+
* expires after 30 minutes.
|
|
1155
|
+
*/
|
|
1156
|
+
getByAccessToken(accessToken: string): Promise<SdkResult<OrderDetail>>;
|
|
1099
1157
|
}
|
|
1100
1158
|
declare class CustomerModule {
|
|
1101
1159
|
private client;
|
|
@@ -1164,6 +1222,7 @@ declare class ReturnsModule {
|
|
|
1164
1222
|
*/
|
|
1165
1223
|
lookupOrder(orderNumber: string, email: string): Promise<SdkResult<ReturnableOrder>>;
|
|
1166
1224
|
submit(input: SubmitReturnInput): Promise<SdkResult<ReturnRequest>>;
|
|
1225
|
+
/** Email is the ownership gate; POST so it never lands in a URL / log. */
|
|
1167
1226
|
getStatus(returnId: string, email: string): Promise<SdkResult<ReturnStatus>>;
|
|
1168
1227
|
}
|
|
1169
1228
|
declare class ConsentModule {
|
|
@@ -1256,4 +1315,4 @@ declare class ShippingModule {
|
|
|
1256
1315
|
}>>;
|
|
1257
1316
|
}
|
|
1258
1317
|
|
|
1259
|
-
export { type ActivePromotion, type AddToCartInput, type AddressDetail, type AddressSuggestion, type AddressType, AddressTypes, type AuthTokens, type BackInStockSubscription, BehioApiError, type BehioErrorCode, type BehioEventHandler, type BehioEventType, BehioNetworkError, BehioStorefront, type BehioStorefrontConfig, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type CartItemProduct, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CheckoutPaymentMethod, type CookieConsent, type CookieConsentInput, type CrossSellItem, type CustomerAddress, type CustomerProfile, type DataGroupFieldType, type FilterField, type FulfillmentStatus, FulfillmentStatuses, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type OrderStatusHistory, OrderStatuses, type Page, type PageAttachment, type PageDetail, type PaginatedResponse, type PaymentStatus, PaymentStatuses, type ProductDetail, type ProductLabel, type ProductListItem, type ProductMedia, type ProductMediaVariant, type ProductPrice, type ProductReview, type ProductReviewsResponse, ProductSort, type ProductSortValue, type ProductVariant, type ProductVolumePrice, type ProductsQuery, type QuoteItem, type QuoteRequest, type RegisterInput, type RequestInterceptor, type RequestInterceptorConfig, type ResponseInterceptor, type ResponseInterceptorData, type ReturnRequest, type ReturnRequestItem, type ReturnStatus, type ReturnStatusItem, type ReturnableOrder, type ReturnableOrderItem, type SdkError, type SdkResult, type ShippingMethodSummary, type ShippingQuote, type ShippingQuoteInput, type ShopInfo, type ShopSeo, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type WishlistItem, err, ok, toSdkError };
|
|
1318
|
+
export { type ActivePromotion, type AddToCartInput, type AddressDetail, type AddressSuggestion, type AddressType, AddressTypes, type AuthTokens, type BackInStockSubscription, BehioApiError, type BehioErrorCode, type BehioEventHandler, type BehioEventType, BehioNetworkError, BehioStorefront, type BehioStorefrontConfig, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type CartItemProduct, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CheckoutPaymentMethod, type CookieConsent, type CookieConsentInput, type CrossSellItem, type CustomerAddress, type CustomerProfile, type DataGroupFieldType, type FilterField, type FulfillmentStatus, FulfillmentStatuses, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderAccessRequestResponse, type OrderAccessVerifyResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type OrderStatusHistory, OrderStatuses, type OrderTracking, type Page, type PageAttachment, type PageDetail, type PaginatedResponse, type PaymentStatus, PaymentStatuses, type ProductDetail, type ProductLabel, type ProductListItem, type ProductMedia, type ProductMediaVariant, type ProductPrice, type ProductReview, type ProductReviewsResponse, ProductSort, type ProductSortValue, type ProductVariant, type ProductVolumePrice, type ProductsQuery, type QuoteItem, type QuoteRequest, type RegisterInput, type RequestInterceptor, type RequestInterceptorConfig, type ResponseInterceptor, type ResponseInterceptorData, type ReturnRequest, type ReturnRequestItem, type ReturnStatus, type ReturnStatusItem, type ReturnableOrder, type ReturnableOrderItem, type SdkError, type SdkResult, type ShippingMethodSummary, type ShippingQuote, type ShippingQuoteInput, type ShopInfo, type ShopSeo, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type WishlistItem, err, ok, toSdkError };
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkLNSFBNPJjs = require('./chunk-LNSFBNPJ.js');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -23,4 +23,4 @@ var _chunkDMTMGPUZjs = require('./chunk-DMTMGPUZ.js');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
exports.AddressTypes =
|
|
26
|
+
exports.AddressTypes = _chunkLNSFBNPJjs.AddressTypes; exports.BehioApiError = _chunkLNSFBNPJjs.BehioApiError; exports.BehioNetworkError = _chunkLNSFBNPJjs.BehioNetworkError; exports.BehioStorefront = _chunkLNSFBNPJjs.BehioStorefront; exports.FulfillmentStatuses = _chunkLNSFBNPJjs.FulfillmentStatuses; exports.OrderStatuses = _chunkLNSFBNPJjs.OrderStatuses; exports.PaymentStatuses = _chunkLNSFBNPJjs.PaymentStatuses; exports.ProductSort = _chunkLNSFBNPJjs.ProductSort; exports.err = _chunkLNSFBNPJjs.err; exports.ok = _chunkLNSFBNPJjs.ok; exports.toSdkError = _chunkLNSFBNPJjs.toSdkError;
|
package/dist/index.mjs
CHANGED
package/dist/next.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLNSFBNPJjs = require('./chunk-LNSFBNPJ.js');
|
|
4
4
|
|
|
5
5
|
// src/next.ts
|
|
6
6
|
var _headers = require('next/headers');
|
|
@@ -17,7 +17,7 @@ async function getBehio(options = {}) {
|
|
|
17
17
|
const locale = _nullishCoalesce(options.locale, () => ( process.env.BEHIO_LOCALE));
|
|
18
18
|
const currency = _nullishCoalesce(options.currency, () => ( process.env.BEHIO_CURRENCY));
|
|
19
19
|
const cookieName = _nullishCoalesce(options.cartCookieName, () => ( CART_COOKIE_NAME));
|
|
20
|
-
const client = new (0,
|
|
20
|
+
const client = new (0, _chunkLNSFBNPJjs.BehioStorefront)({
|
|
21
21
|
apiKey,
|
|
22
22
|
...baseUrl ? { baseUrl } : {},
|
|
23
23
|
...locale ? { locale } : {},
|
package/dist/next.mjs
CHANGED
package/dist/react.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
3
|
import { QueryClient } from '@tanstack/react-query';
|
|
4
|
-
import { BehioStorefront, ProductsQuery, PaginatedResponse, ProductListItem, ProductDetail, Category, CategoryDetail, ProductLabel, FilterField, Cart, CustomerProfile, RegisterInput, CustomerAddress, AddressSuggestion, AddressDetail, OrderListItem, OrderDetail, CheckoutInput, PageDetail, Page, ShopInfo, ShopSeo, Bundle, CrossSellItem, ActivePromotion, GiftCardBalance, WishlistItem, ProductReviewsResponse, SubmitReviewInput, ReturnableOrder, ReturnStatus, ReturnRequest, SubmitReturnInput, CookieConsent, CookieConsentInput, QuoteRequest, SubmitQuoteInput, BackInStockSubscription } from './index.mjs';
|
|
4
|
+
import { BehioStorefront, ProductsQuery, PaginatedResponse, ProductListItem, ProductDetail, Category, CategoryDetail, ProductLabel, FilterField, Cart, CustomerProfile, RegisterInput, CustomerAddress, AddressSuggestion, AddressDetail, OrderListItem, OrderDetail, OrderAccessRequestResponse, OrderAccessVerifyResponse, CheckoutInput, PageDetail, Page, ShopInfo, ShopSeo, Bundle, CrossSellItem, ActivePromotion, GiftCardBalance, WishlistItem, ProductReviewsResponse, SubmitReviewInput, ReturnableOrder, ReturnStatus, ReturnRequest, SubmitReturnInput, CookieConsent, CookieConsentInput, QuoteRequest, SubmitQuoteInput, BackInStockSubscription } from './index.mjs';
|
|
5
5
|
export { AddToCartInput, AuthTokens, BehioApiError, BundleItem, CartDiscount, CartItem, CheckoutAddress, FulfillmentStatus, LoginInput, MessageResponse, OrderItem, OrderStatus, PaymentStatus, ProductPrice, ProductReview, ProductVariant } from './index.mjs';
|
|
6
6
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
7
7
|
|
|
@@ -292,6 +292,35 @@ declare function useOrder(orderNumber: string, options?: UseOrderOptions): {
|
|
|
292
292
|
isCancelling: boolean;
|
|
293
293
|
};
|
|
294
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Verified guest order-access flow (no login). Two steps:
|
|
297
|
+
* 1. `requestCode(orderNumber, email)` — e-mails a 6-digit code to the
|
|
298
|
+
* address on the order. Always resolves generically, so order numbers
|
|
299
|
+
* can't be enumerated.
|
|
300
|
+
* 2. `verifyCode(code)` — verifies the code, then exposes the full
|
|
301
|
+
* `order` detail and a short-lived `accessToken`.
|
|
302
|
+
*
|
|
303
|
+
* Knowing the order number alone is never enough to see the detail — control
|
|
304
|
+
* of the order e-mail must be proven first.
|
|
305
|
+
*/
|
|
306
|
+
declare function useOrderAccess(): {
|
|
307
|
+
/** Step 1: send the code. */
|
|
308
|
+
requestCode: (on: string, em: string) => Promise<OrderAccessRequestResponse>;
|
|
309
|
+
isRequesting: boolean;
|
|
310
|
+
requestError: Error | null;
|
|
311
|
+
/** True once a code has been requested (move the UI to the code input). */
|
|
312
|
+
codeSent: boolean;
|
|
313
|
+
/** Step 2: verify the code. */
|
|
314
|
+
verifyCode: (code: string) => Promise<OrderAccessVerifyResponse>;
|
|
315
|
+
isVerifying: boolean;
|
|
316
|
+
verifyError: Error | null;
|
|
317
|
+
/** Full order detail, available after a successful verify. */
|
|
318
|
+
order: OrderDetail | null;
|
|
319
|
+
/** Short-lived token scoped to this order (30 min). */
|
|
320
|
+
accessToken: string | null;
|
|
321
|
+
reset: () => void;
|
|
322
|
+
};
|
|
323
|
+
|
|
295
324
|
declare function useCheckout(): {
|
|
296
325
|
createOrder: (input: CheckoutInput) => Promise<OrderDetail>;
|
|
297
326
|
isCreating: boolean;
|
|
@@ -862,4 +891,4 @@ declare function useBehioClient(): BehioStorefront;
|
|
|
862
891
|
*/
|
|
863
892
|
declare function formatPrice(amount: number, currency: string, locale?: string): string;
|
|
864
893
|
|
|
865
|
-
export { ActivePromotion, BehioProvider, type BehioProviderProps, Bundle, Cart, Category, CategoryDetail, CheckoutInput, CookieConsent, CookieConsentInput, CrossSellItem, CustomerAddress, CustomerProfile, FilterField, GiftCardBalance, OrderDetail, OrderListItem, Page, PageDetail, PaginatedResponse, ProductDetail, ProductLabel, ProductListItem, ProductReviewsResponse, ProductsQuery, QuoteRequest, RegisterInput, ReturnRequest, ShopInfo, ShopSeo, type StorageAdapter, SubmitQuoteInput, SubmitReturnInput, SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCustomerOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UseProductOptions, type UseProductsOptions, type UseSearchOptions, type UseShopInfoOptions, type UseShopSeoOptions, WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, localStorageAdapter, memoryStorage, useAddressAutocomplete, useAddresses, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCheckout, useCookieConsent, useCrossSell, useCustomer, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLookupReturnableOrder, useNotifyWhenAvailable, useOrder, useOrders, usePage, usePages, useProduct, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
|
|
894
|
+
export { ActivePromotion, BehioProvider, type BehioProviderProps, Bundle, Cart, Category, CategoryDetail, CheckoutInput, CookieConsent, CookieConsentInput, CrossSellItem, CustomerAddress, CustomerProfile, FilterField, GiftCardBalance, OrderDetail, OrderListItem, Page, PageDetail, PaginatedResponse, ProductDetail, ProductLabel, ProductListItem, ProductReviewsResponse, ProductsQuery, QuoteRequest, RegisterInput, ReturnRequest, ShopInfo, ShopSeo, type StorageAdapter, SubmitQuoteInput, SubmitReturnInput, SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCustomerOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UseProductOptions, type UseProductsOptions, type UseSearchOptions, type UseShopInfoOptions, type UseShopSeoOptions, WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, localStorageAdapter, memoryStorage, useAddressAutocomplete, useAddresses, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCheckout, useCookieConsent, useCrossSell, useCustomer, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLookupReturnableOrder, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, useProduct, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
3
|
import { QueryClient } from '@tanstack/react-query';
|
|
4
|
-
import { BehioStorefront, ProductsQuery, PaginatedResponse, ProductListItem, ProductDetail, Category, CategoryDetail, ProductLabel, FilterField, Cart, CustomerProfile, RegisterInput, CustomerAddress, AddressSuggestion, AddressDetail, OrderListItem, OrderDetail, CheckoutInput, PageDetail, Page, ShopInfo, ShopSeo, Bundle, CrossSellItem, ActivePromotion, GiftCardBalance, WishlistItem, ProductReviewsResponse, SubmitReviewInput, ReturnableOrder, ReturnStatus, ReturnRequest, SubmitReturnInput, CookieConsent, CookieConsentInput, QuoteRequest, SubmitQuoteInput, BackInStockSubscription } from './index.js';
|
|
4
|
+
import { BehioStorefront, ProductsQuery, PaginatedResponse, ProductListItem, ProductDetail, Category, CategoryDetail, ProductLabel, FilterField, Cart, CustomerProfile, RegisterInput, CustomerAddress, AddressSuggestion, AddressDetail, OrderListItem, OrderDetail, OrderAccessRequestResponse, OrderAccessVerifyResponse, CheckoutInput, PageDetail, Page, ShopInfo, ShopSeo, Bundle, CrossSellItem, ActivePromotion, GiftCardBalance, WishlistItem, ProductReviewsResponse, SubmitReviewInput, ReturnableOrder, ReturnStatus, ReturnRequest, SubmitReturnInput, CookieConsent, CookieConsentInput, QuoteRequest, SubmitQuoteInput, BackInStockSubscription } from './index.js';
|
|
5
5
|
export { AddToCartInput, AuthTokens, BehioApiError, BundleItem, CartDiscount, CartItem, CheckoutAddress, FulfillmentStatus, LoginInput, MessageResponse, OrderItem, OrderStatus, PaymentStatus, ProductPrice, ProductReview, ProductVariant } from './index.js';
|
|
6
6
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
7
7
|
|
|
@@ -292,6 +292,35 @@ declare function useOrder(orderNumber: string, options?: UseOrderOptions): {
|
|
|
292
292
|
isCancelling: boolean;
|
|
293
293
|
};
|
|
294
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Verified guest order-access flow (no login). Two steps:
|
|
297
|
+
* 1. `requestCode(orderNumber, email)` — e-mails a 6-digit code to the
|
|
298
|
+
* address on the order. Always resolves generically, so order numbers
|
|
299
|
+
* can't be enumerated.
|
|
300
|
+
* 2. `verifyCode(code)` — verifies the code, then exposes the full
|
|
301
|
+
* `order` detail and a short-lived `accessToken`.
|
|
302
|
+
*
|
|
303
|
+
* Knowing the order number alone is never enough to see the detail — control
|
|
304
|
+
* of the order e-mail must be proven first.
|
|
305
|
+
*/
|
|
306
|
+
declare function useOrderAccess(): {
|
|
307
|
+
/** Step 1: send the code. */
|
|
308
|
+
requestCode: (on: string, em: string) => Promise<OrderAccessRequestResponse>;
|
|
309
|
+
isRequesting: boolean;
|
|
310
|
+
requestError: Error | null;
|
|
311
|
+
/** True once a code has been requested (move the UI to the code input). */
|
|
312
|
+
codeSent: boolean;
|
|
313
|
+
/** Step 2: verify the code. */
|
|
314
|
+
verifyCode: (code: string) => Promise<OrderAccessVerifyResponse>;
|
|
315
|
+
isVerifying: boolean;
|
|
316
|
+
verifyError: Error | null;
|
|
317
|
+
/** Full order detail, available after a successful verify. */
|
|
318
|
+
order: OrderDetail | null;
|
|
319
|
+
/** Short-lived token scoped to this order (30 min). */
|
|
320
|
+
accessToken: string | null;
|
|
321
|
+
reset: () => void;
|
|
322
|
+
};
|
|
323
|
+
|
|
295
324
|
declare function useCheckout(): {
|
|
296
325
|
createOrder: (input: CheckoutInput) => Promise<OrderDetail>;
|
|
297
326
|
isCreating: boolean;
|
|
@@ -862,4 +891,4 @@ declare function useBehioClient(): BehioStorefront;
|
|
|
862
891
|
*/
|
|
863
892
|
declare function formatPrice(amount: number, currency: string, locale?: string): string;
|
|
864
893
|
|
|
865
|
-
export { ActivePromotion, BehioProvider, type BehioProviderProps, Bundle, Cart, Category, CategoryDetail, CheckoutInput, CookieConsent, CookieConsentInput, CrossSellItem, CustomerAddress, CustomerProfile, FilterField, GiftCardBalance, OrderDetail, OrderListItem, Page, PageDetail, PaginatedResponse, ProductDetail, ProductLabel, ProductListItem, ProductReviewsResponse, ProductsQuery, QuoteRequest, RegisterInput, ReturnRequest, ShopInfo, ShopSeo, type StorageAdapter, SubmitQuoteInput, SubmitReturnInput, SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCustomerOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UseProductOptions, type UseProductsOptions, type UseSearchOptions, type UseShopInfoOptions, type UseShopSeoOptions, WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, localStorageAdapter, memoryStorage, useAddressAutocomplete, useAddresses, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCheckout, useCookieConsent, useCrossSell, useCustomer, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLookupReturnableOrder, useNotifyWhenAvailable, useOrder, useOrders, usePage, usePages, useProduct, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
|
|
894
|
+
export { ActivePromotion, BehioProvider, type BehioProviderProps, Bundle, Cart, Category, CategoryDetail, CheckoutInput, CookieConsent, CookieConsentInput, CrossSellItem, CustomerAddress, CustomerProfile, FilterField, GiftCardBalance, OrderDetail, OrderListItem, Page, PageDetail, PaginatedResponse, ProductDetail, ProductLabel, ProductListItem, ProductReviewsResponse, ProductsQuery, QuoteRequest, RegisterInput, ReturnRequest, ShopInfo, ShopSeo, type StorageAdapter, SubmitQuoteInput, SubmitReturnInput, SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCustomerOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UseProductOptions, type UseProductsOptions, type UseSearchOptions, type UseShopInfoOptions, type UseShopSeoOptions, WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, localStorageAdapter, memoryStorage, useAddressAutocomplete, useAddresses, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCheckout, useCookieConsent, useCrossSell, useCustomer, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLookupReturnableOrder, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, useProduct, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
|
package/dist/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLNSFBNPJjs = require('./chunk-LNSFBNPJ.js');
|
|
4
4
|
|
|
5
5
|
// src/react/provider.tsx
|
|
6
6
|
var _react = require('react');
|
|
@@ -114,7 +114,7 @@ function BehioProvider({
|
|
|
114
114
|
const storageAdapter = _react.useMemo.call(void 0, () => resolveStorage(storageOption), [storageOption]);
|
|
115
115
|
const clientRef = _react.useRef.call(void 0, null);
|
|
116
116
|
if (!clientRef.current) {
|
|
117
|
-
clientRef.current = new (0,
|
|
117
|
+
clientRef.current = new (0, _chunkLNSFBNPJjs.BehioStorefront)({
|
|
118
118
|
apiKey,
|
|
119
119
|
baseUrl,
|
|
120
120
|
locale,
|
|
@@ -886,6 +886,66 @@ function useOrder(orderNumber, options) {
|
|
|
886
886
|
};
|
|
887
887
|
}
|
|
888
888
|
|
|
889
|
+
// src/react/hooks/use-order-access.ts
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
function useOrderAccess() {
|
|
893
|
+
const { client } = useBehio();
|
|
894
|
+
const [orderNumber, setOrderNumber] = _react.useState.call(void 0, null);
|
|
895
|
+
const [email, setEmail] = _react.useState.call(void 0, null);
|
|
896
|
+
const [order, setOrder] = _react.useState.call(void 0, null);
|
|
897
|
+
const [accessToken, setAccessToken] = _react.useState.call(void 0, null);
|
|
898
|
+
const requestMutation = _reactquery.useMutation.call(void 0, {
|
|
899
|
+
mutationFn: (input) => unwrap(client.orders.requestAccessCode(input.orderNumber, input.email)),
|
|
900
|
+
onSuccess: (_data, input) => {
|
|
901
|
+
setOrderNumber(input.orderNumber);
|
|
902
|
+
setEmail(input.email);
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
const verifyMutation = _reactquery.useMutation.call(void 0, {
|
|
906
|
+
mutationFn: (code) => {
|
|
907
|
+
if (!orderNumber || !email) {
|
|
908
|
+
throw new Error("Request a code before verifying");
|
|
909
|
+
}
|
|
910
|
+
return unwrap(client.orders.verifyAccessCode(orderNumber, email, code));
|
|
911
|
+
},
|
|
912
|
+
onSuccess: (result) => {
|
|
913
|
+
setOrder(result.order);
|
|
914
|
+
setAccessToken(result.accessToken);
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
const requestCode = _react.useCallback.call(void 0,
|
|
918
|
+
(on, em) => requestMutation.mutateAsync({ orderNumber: on, email: em }),
|
|
919
|
+
[requestMutation]
|
|
920
|
+
);
|
|
921
|
+
const verifyCode = _react.useCallback.call(void 0, (code) => verifyMutation.mutateAsync(code), [verifyMutation]);
|
|
922
|
+
const reset = _react.useCallback.call(void 0, () => {
|
|
923
|
+
setOrderNumber(null);
|
|
924
|
+
setEmail(null);
|
|
925
|
+
setOrder(null);
|
|
926
|
+
setAccessToken(null);
|
|
927
|
+
requestMutation.reset();
|
|
928
|
+
verifyMutation.reset();
|
|
929
|
+
}, [requestMutation, verifyMutation]);
|
|
930
|
+
return {
|
|
931
|
+
/** Step 1: send the code. */
|
|
932
|
+
requestCode,
|
|
933
|
+
isRequesting: requestMutation.isPending,
|
|
934
|
+
requestError: requestMutation.error,
|
|
935
|
+
/** True once a code has been requested (move the UI to the code input). */
|
|
936
|
+
codeSent: !!orderNumber && !!email,
|
|
937
|
+
/** Step 2: verify the code. */
|
|
938
|
+
verifyCode,
|
|
939
|
+
isVerifying: verifyMutation.isPending,
|
|
940
|
+
verifyError: verifyMutation.error,
|
|
941
|
+
/** Full order detail, available after a successful verify. */
|
|
942
|
+
order,
|
|
943
|
+
/** Short-lived token scoped to this order (30 min). */
|
|
944
|
+
accessToken,
|
|
945
|
+
reset
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
|
|
889
949
|
// src/react/hooks/use-checkout.ts
|
|
890
950
|
|
|
891
951
|
|
|
@@ -1216,4 +1276,5 @@ function formatPrice(amount, currency, locale) {
|
|
|
1216
1276
|
|
|
1217
1277
|
|
|
1218
1278
|
|
|
1219
|
-
|
|
1279
|
+
|
|
1280
|
+
exports.BehioProvider = BehioProvider; exports.cookieStorage = cookieStorage; exports.createMemoryStorage = createMemoryStorage; exports.detectStorage = detectStorage; exports.formatPrice = formatPrice; exports.localStorageAdapter = localStorageAdapter; exports.memoryStorage = memoryStorage; exports.useAddressAutocomplete = useAddressAutocomplete; exports.useAddresses = useAddresses; exports.useAuth = useAuth; exports.useBehio = useBehio; exports.useBehioClient = useBehioClient; exports.useBundle = useBundle; exports.useBundles = useBundles; exports.useCart = useCart; exports.useCartCount = useCartCount; exports.useCategories = useCategories; exports.useCategory = useCategory; exports.useCheckout = useCheckout; exports.useCookieConsent = useCookieConsent; exports.useCrossSell = useCrossSell; exports.useCustomer = useCustomer; exports.useFeatured = useFeatured; exports.useFilters = useFilters; exports.useGiftCardBalance = useGiftCardBalance; exports.useIsInWishlist = useIsInWishlist; exports.useLabels = useLabels; exports.useLookupReturnableOrder = useLookupReturnableOrder; exports.useNotifyWhenAvailable = useNotifyWhenAvailable; exports.useOrder = useOrder; exports.useOrderAccess = useOrderAccess; exports.useOrders = useOrders; exports.usePage = usePage; exports.usePages = usePages; exports.useProduct = useProduct; exports.useProductPromotions = useProductPromotions; exports.useProductReviews = useProductReviews; exports.useProducts = useProducts; exports.useQuoteStatus = useQuoteStatus; exports.useReturnStatus = useReturnStatus; exports.useSearch = useSearch; exports.useShopInfo = useShopInfo; exports.useShopSeo = useShopSeo; exports.useSubmitQuote = useSubmitQuote; exports.useSubmitReturn = useSubmitReturn; exports.useSubmitReview = useSubmitReview; exports.useWishlist = useWishlist;
|
package/dist/react.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BehioStorefront
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-O3IM7PAY.mjs";
|
|
4
4
|
|
|
5
5
|
// src/react/provider.tsx
|
|
6
6
|
import { useRef, useEffect, useMemo } from "react";
|
|
@@ -886,14 +886,74 @@ function useOrder(orderNumber, options) {
|
|
|
886
886
|
};
|
|
887
887
|
}
|
|
888
888
|
|
|
889
|
+
// src/react/hooks/use-order-access.ts
|
|
890
|
+
import { useCallback as useCallback9, useState as useState5 } from "react";
|
|
891
|
+
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
892
|
+
function useOrderAccess() {
|
|
893
|
+
const { client } = useBehio();
|
|
894
|
+
const [orderNumber, setOrderNumber] = useState5(null);
|
|
895
|
+
const [email, setEmail] = useState5(null);
|
|
896
|
+
const [order, setOrder] = useState5(null);
|
|
897
|
+
const [accessToken, setAccessToken] = useState5(null);
|
|
898
|
+
const requestMutation = useMutation6({
|
|
899
|
+
mutationFn: (input) => unwrap(client.orders.requestAccessCode(input.orderNumber, input.email)),
|
|
900
|
+
onSuccess: (_data, input) => {
|
|
901
|
+
setOrderNumber(input.orderNumber);
|
|
902
|
+
setEmail(input.email);
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
const verifyMutation = useMutation6({
|
|
906
|
+
mutationFn: (code) => {
|
|
907
|
+
if (!orderNumber || !email) {
|
|
908
|
+
throw new Error("Request a code before verifying");
|
|
909
|
+
}
|
|
910
|
+
return unwrap(client.orders.verifyAccessCode(orderNumber, email, code));
|
|
911
|
+
},
|
|
912
|
+
onSuccess: (result) => {
|
|
913
|
+
setOrder(result.order);
|
|
914
|
+
setAccessToken(result.accessToken);
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
const requestCode = useCallback9(
|
|
918
|
+
(on, em) => requestMutation.mutateAsync({ orderNumber: on, email: em }),
|
|
919
|
+
[requestMutation]
|
|
920
|
+
);
|
|
921
|
+
const verifyCode = useCallback9((code) => verifyMutation.mutateAsync(code), [verifyMutation]);
|
|
922
|
+
const reset = useCallback9(() => {
|
|
923
|
+
setOrderNumber(null);
|
|
924
|
+
setEmail(null);
|
|
925
|
+
setOrder(null);
|
|
926
|
+
setAccessToken(null);
|
|
927
|
+
requestMutation.reset();
|
|
928
|
+
verifyMutation.reset();
|
|
929
|
+
}, [requestMutation, verifyMutation]);
|
|
930
|
+
return {
|
|
931
|
+
/** Step 1: send the code. */
|
|
932
|
+
requestCode,
|
|
933
|
+
isRequesting: requestMutation.isPending,
|
|
934
|
+
requestError: requestMutation.error,
|
|
935
|
+
/** True once a code has been requested (move the UI to the code input). */
|
|
936
|
+
codeSent: !!orderNumber && !!email,
|
|
937
|
+
/** Step 2: verify the code. */
|
|
938
|
+
verifyCode,
|
|
939
|
+
isVerifying: verifyMutation.isPending,
|
|
940
|
+
verifyError: verifyMutation.error,
|
|
941
|
+
/** Full order detail, available after a successful verify. */
|
|
942
|
+
order,
|
|
943
|
+
/** Short-lived token scoped to this order (30 min). */
|
|
944
|
+
accessToken,
|
|
945
|
+
reset
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
|
|
889
949
|
// src/react/hooks/use-checkout.ts
|
|
890
|
-
import { useState as
|
|
891
|
-
import { useMutation as
|
|
950
|
+
import { useState as useState6, useCallback as useCallback10 } from "react";
|
|
951
|
+
import { useMutation as useMutation7, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
892
952
|
function useCheckout() {
|
|
893
953
|
const { client, storage } = useBehio();
|
|
894
954
|
const queryClient = useQueryClient8();
|
|
895
|
-
const [order, setOrder] =
|
|
896
|
-
const mutation =
|
|
955
|
+
const [order, setOrder] = useState6(null);
|
|
956
|
+
const mutation = useMutation7({
|
|
897
957
|
mutationFn: (input) => unwrap(client.checkout.createOrder(input)),
|
|
898
958
|
onSuccess: (result) => {
|
|
899
959
|
setOrder(result);
|
|
@@ -902,11 +962,11 @@ function useCheckout() {
|
|
|
902
962
|
queryClient.invalidateQueries({ queryKey: ["behio", "orders"] });
|
|
903
963
|
}
|
|
904
964
|
});
|
|
905
|
-
const createOrder =
|
|
965
|
+
const createOrder = useCallback10(
|
|
906
966
|
(input) => mutation.mutateAsync(input),
|
|
907
967
|
[mutation]
|
|
908
968
|
);
|
|
909
|
-
const reset =
|
|
969
|
+
const reset = useCallback10(() => {
|
|
910
970
|
setOrder(null);
|
|
911
971
|
mutation.reset();
|
|
912
972
|
}, [mutation]);
|
|
@@ -1023,7 +1083,7 @@ function useGiftCardBalance(code, options) {
|
|
|
1023
1083
|
}
|
|
1024
1084
|
|
|
1025
1085
|
// src/react/hooks/use-wishlist.ts
|
|
1026
|
-
import { useQuery as useQuery21, useMutation as
|
|
1086
|
+
import { useQuery as useQuery21, useMutation as useMutation8, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
1027
1087
|
function useWishlist(options) {
|
|
1028
1088
|
const { client } = useBehio();
|
|
1029
1089
|
const qc = useQueryClient9();
|
|
@@ -1032,11 +1092,11 @@ function useWishlist(options) {
|
|
|
1032
1092
|
queryFn: () => unwrap(client.wishlist.get()),
|
|
1033
1093
|
enabled: options?.enabled ?? true
|
|
1034
1094
|
});
|
|
1035
|
-
const addMutation =
|
|
1095
|
+
const addMutation = useMutation8({
|
|
1036
1096
|
mutationFn: (productId) => unwrap(client.wishlist.add(productId)),
|
|
1037
1097
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
|
|
1038
1098
|
});
|
|
1039
|
-
const removeMutation =
|
|
1099
|
+
const removeMutation = useMutation8({
|
|
1040
1100
|
mutationFn: (productId) => unwrap(client.wishlist.remove(productId)),
|
|
1041
1101
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
|
|
1042
1102
|
});
|
|
@@ -1058,7 +1118,7 @@ function useIsInWishlist(productId) {
|
|
|
1058
1118
|
}
|
|
1059
1119
|
|
|
1060
1120
|
// src/react/hooks/use-reviews.ts
|
|
1061
|
-
import { useQuery as useQuery22, useMutation as
|
|
1121
|
+
import { useQuery as useQuery22, useMutation as useMutation9, useQueryClient as useQueryClient10 } from "@tanstack/react-query";
|
|
1062
1122
|
function useProductReviews(productId, options) {
|
|
1063
1123
|
const { client } = useBehio();
|
|
1064
1124
|
return useQuery22({
|
|
@@ -1070,23 +1130,23 @@ function useProductReviews(productId, options) {
|
|
|
1070
1130
|
function useSubmitReview() {
|
|
1071
1131
|
const { client } = useBehio();
|
|
1072
1132
|
const qc = useQueryClient10();
|
|
1073
|
-
return
|
|
1133
|
+
return useMutation9({
|
|
1074
1134
|
mutationFn: (input) => unwrap(client.reviews.submit(input)),
|
|
1075
1135
|
onSuccess: (_, input) => qc.invalidateQueries({ queryKey: ["behio", "reviews", input.productId] })
|
|
1076
1136
|
});
|
|
1077
1137
|
}
|
|
1078
1138
|
|
|
1079
1139
|
// src/react/hooks/use-returns.ts
|
|
1080
|
-
import { useQuery as useQuery23, useMutation as
|
|
1140
|
+
import { useQuery as useQuery23, useMutation as useMutation10 } from "@tanstack/react-query";
|
|
1081
1141
|
function useLookupReturnableOrder() {
|
|
1082
1142
|
const { client } = useBehio();
|
|
1083
|
-
return
|
|
1143
|
+
return useMutation10({
|
|
1084
1144
|
mutationFn: ({ orderNumber, email }) => unwrap(client.returns.lookupOrder(orderNumber, email))
|
|
1085
1145
|
});
|
|
1086
1146
|
}
|
|
1087
1147
|
function useSubmitReturn() {
|
|
1088
1148
|
const { client } = useBehio();
|
|
1089
|
-
return
|
|
1149
|
+
return useMutation10({
|
|
1090
1150
|
mutationFn: (input) => unwrap(client.returns.submit(input))
|
|
1091
1151
|
});
|
|
1092
1152
|
}
|
|
@@ -1100,7 +1160,7 @@ function useReturnStatus(returnId, email) {
|
|
|
1100
1160
|
}
|
|
1101
1161
|
|
|
1102
1162
|
// src/react/hooks/use-consent.ts
|
|
1103
|
-
import { useQuery as useQuery24, useMutation as
|
|
1163
|
+
import { useQuery as useQuery24, useMutation as useMutation11, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
|
|
1104
1164
|
function useCookieConsent(visitorId) {
|
|
1105
1165
|
const { client } = useBehio();
|
|
1106
1166
|
const qc = useQueryClient11();
|
|
@@ -1109,11 +1169,11 @@ function useCookieConsent(visitorId) {
|
|
|
1109
1169
|
queryFn: () => unwrap(client.consent.get(visitorId)),
|
|
1110
1170
|
enabled: Boolean(visitorId)
|
|
1111
1171
|
});
|
|
1112
|
-
const recordMutation =
|
|
1172
|
+
const recordMutation = useMutation11({
|
|
1113
1173
|
mutationFn: (input) => unwrap(client.consent.record(input)),
|
|
1114
1174
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "consent"] })
|
|
1115
1175
|
});
|
|
1116
|
-
const revokeMutation =
|
|
1176
|
+
const revokeMutation = useMutation11({
|
|
1117
1177
|
mutationFn: () => unwrap(client.consent.revoke(visitorId)),
|
|
1118
1178
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "consent"] })
|
|
1119
1179
|
});
|
|
@@ -1125,10 +1185,10 @@ function useCookieConsent(visitorId) {
|
|
|
1125
1185
|
}
|
|
1126
1186
|
|
|
1127
1187
|
// src/react/hooks/use-quotes.ts
|
|
1128
|
-
import { useMutation as
|
|
1188
|
+
import { useMutation as useMutation12, useQuery as useQuery25 } from "@tanstack/react-query";
|
|
1129
1189
|
function useSubmitQuote() {
|
|
1130
1190
|
const { client } = useBehio();
|
|
1131
|
-
return
|
|
1191
|
+
return useMutation12({
|
|
1132
1192
|
mutationFn: (input) => unwrap(client.quotes.submit(input))
|
|
1133
1193
|
});
|
|
1134
1194
|
}
|
|
@@ -1142,10 +1202,10 @@ function useQuoteStatus(quoteId, email) {
|
|
|
1142
1202
|
}
|
|
1143
1203
|
|
|
1144
1204
|
// src/react/hooks/use-back-in-stock.ts
|
|
1145
|
-
import { useMutation as
|
|
1205
|
+
import { useMutation as useMutation13 } from "@tanstack/react-query";
|
|
1146
1206
|
function useNotifyWhenAvailable() {
|
|
1147
1207
|
const { client } = useBehio();
|
|
1148
|
-
return
|
|
1208
|
+
return useMutation13({
|
|
1149
1209
|
mutationFn: ({ productId, email }) => unwrap(client.catalog.notifyWhenAvailable(productId, email))
|
|
1150
1210
|
});
|
|
1151
1211
|
}
|
|
@@ -1200,6 +1260,7 @@ export {
|
|
|
1200
1260
|
useLookupReturnableOrder,
|
|
1201
1261
|
useNotifyWhenAvailable,
|
|
1202
1262
|
useOrder,
|
|
1263
|
+
useOrderAccess,
|
|
1203
1264
|
useOrders,
|
|
1204
1265
|
usePage,
|
|
1205
1266
|
usePages,
|