@behio/storefront-sdk 0.20.0 → 0.21.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-S7YSZHHD.js → chunk-BF4YVFHX.js} +7 -2
- package/dist/{chunk-L62FH6WI.mjs → chunk-PZED7VMQ.mjs} +7 -2
- package/dist/{client-Bc6qvoIu.d.mts → client-hCuGQERQ.d.mts} +13 -2
- package/dist/{client-Bc6qvoIu.d.ts → client-hCuGQERQ.d.ts} +13 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/next.d.mts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +2 -2
- package/dist/next.mjs +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +7 -5
- package/dist/react.mjs +6 -4
- package/package.json +1 -1
|
@@ -558,8 +558,13 @@ var AuthModule = class {
|
|
|
558
558
|
auth: false
|
|
559
559
|
});
|
|
560
560
|
if (res.error) return res;
|
|
561
|
-
|
|
562
|
-
|
|
561
|
+
if (res.data.accessToken && res.data.refreshToken) {
|
|
562
|
+
this.client.setTokens({
|
|
563
|
+
accessToken: res.data.accessToken,
|
|
564
|
+
refreshToken: res.data.refreshToken
|
|
565
|
+
});
|
|
566
|
+
this.client.emit("auth:login", { email: input.email });
|
|
567
|
+
}
|
|
563
568
|
return res;
|
|
564
569
|
}
|
|
565
570
|
/** Login with email and password */
|
|
@@ -558,8 +558,13 @@ var AuthModule = class {
|
|
|
558
558
|
auth: false
|
|
559
559
|
});
|
|
560
560
|
if (res.error) return res;
|
|
561
|
-
|
|
562
|
-
|
|
561
|
+
if (res.data.accessToken && res.data.refreshToken) {
|
|
562
|
+
this.client.setTokens({
|
|
563
|
+
accessToken: res.data.accessToken,
|
|
564
|
+
refreshToken: res.data.refreshToken
|
|
565
|
+
});
|
|
566
|
+
this.client.emit("auth:login", { email: input.email });
|
|
567
|
+
}
|
|
563
568
|
return res;
|
|
564
569
|
}
|
|
565
570
|
/** Login with email and password */
|
|
@@ -342,6 +342,17 @@ interface AuthTokens {
|
|
|
342
342
|
accessToken: string;
|
|
343
343
|
refreshToken: string;
|
|
344
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* Result of a registration. When the eshop requires admin approval,
|
|
347
|
+
* `pendingApproval` is true and the tokens are null (the account is created but
|
|
348
|
+
* inactive and can't log in until approved) — the storefront should show a
|
|
349
|
+
* "waiting for approval" message instead of a logged-in session.
|
|
350
|
+
*/
|
|
351
|
+
interface RegisterResult {
|
|
352
|
+
pendingApproval: boolean;
|
|
353
|
+
accessToken: string | null;
|
|
354
|
+
refreshToken: string | null;
|
|
355
|
+
}
|
|
345
356
|
interface RegisterInput {
|
|
346
357
|
email: string;
|
|
347
358
|
password: string;
|
|
@@ -1158,7 +1169,7 @@ declare class AuthModule {
|
|
|
1158
1169
|
private client;
|
|
1159
1170
|
constructor(client: BehioStorefront);
|
|
1160
1171
|
/** Register a new customer */
|
|
1161
|
-
register(input: RegisterInput): Promise<SdkResult<
|
|
1172
|
+
register(input: RegisterInput): Promise<SdkResult<RegisterResult>>;
|
|
1162
1173
|
/** Login with email and password */
|
|
1163
1174
|
login(input: LoginInput): Promise<SdkResult<AuthTokens>>;
|
|
1164
1175
|
/** Refresh access token using refresh token */
|
|
@@ -1432,4 +1443,4 @@ declare class ShippingModule {
|
|
|
1432
1443
|
}>>;
|
|
1433
1444
|
}
|
|
1434
1445
|
|
|
1435
|
-
export { type OrderStatus as $, type AddressSuggestion as A, type BehioStorefrontConfig as B, type Category as C, type SubmitReturnInput as D, type CookieConsent as E, type FilterField as F, type GiftCardBalance as G, type CookieConsentInput as H, type SubmitQuoteInput as I, type BackInStockSubscription as J, type AddToCartInput as K, type AuthTokens as L, BehioApiError as M, type BundleItem as N, type OrderListItem as O, type ProductsQuery as P, type QuoteRequest as Q, type RegisterInput as R, type ShopInfo as S, type CartDiscount as T, type CartItem as U, type CheckoutAddress as V, type WishlistItem as W, type FulfillmentStatus as X, type LoginInput as Y, type MessageResponse as Z, type OrderItem as _, BehioStorefront as a, type PaymentStatus as a0, type ProductPrice as a1, type ProductReview as a2, type ProductVariant as a3, type AddressType as a4, AddressTypes as a5, type BehioErrorCode as a6, type BehioEventHandler as a7, type BehioEventType as a8, BehioNetworkError as a9, type
|
|
1446
|
+
export { type OrderStatus as $, type AddressSuggestion as A, type BehioStorefrontConfig as B, type Category as C, type SubmitReturnInput as D, type CookieConsent as E, type FilterField as F, type GiftCardBalance as G, type CookieConsentInput as H, type SubmitQuoteInput as I, type BackInStockSubscription as J, type AddToCartInput as K, type AuthTokens as L, BehioApiError as M, type BundleItem as N, type OrderListItem as O, type ProductsQuery as P, type QuoteRequest as Q, type RegisterInput as R, type ShopInfo as S, type CartDiscount as T, type CartItem as U, type CheckoutAddress as V, type WishlistItem as W, type FulfillmentStatus as X, type LoginInput as Y, type MessageResponse as Z, type OrderItem as _, BehioStorefront as a, type PaymentStatus as a0, type ProductPrice as a1, type ProductReview as a2, type ProductVariant as a3, type AddressType as a4, AddressTypes as a5, type BehioErrorCode as a6, type BehioEventHandler as a7, type BehioEventType as a8, BehioNetworkError as a9, type SdkError as aA, type SdkResult as aB, type ShippingMethodSummary as aC, type ShippingQuote as aD, type ShippingQuoteInput as aE, type ShopScript as aF, type ShopScriptPlacement as aG, type ShopScriptType as aH, err as aI, ok as aJ, toSdkError as aK, type CartBundleLine as aa, type CartBundleLineItem as ab, type CartItemProduct as ac, type CheckoutPaymentMethod as ad, type DataGroupFieldType as ae, FulfillmentStatuses as af, type GiftCardSummary as ag, type OrderStatusHistory as ah, OrderStatuses as ai, type OrderTracking as aj, type PageAttachment as ak, PaymentStatuses as al, type ProductMedia as am, type ProductMediaVariant as an, ProductSort as ao, type ProductSortValue as ap, type ProductVolumePrice as aq, type QuoteItem as ar, type RegisterResult as as, type RequestInterceptor as at, type RequestInterceptorConfig as au, type ResponseInterceptor as av, type ResponseInterceptorData as aw, type ReturnRequestItem as ax, type ReturnStatusItem as ay, type ReturnableOrderItem as az, type PaginatedResponse as b, type ProductListItem as c, type ProductDetail as d, type CategoryDetail as e, type ProductLabel as f, type Cart as g, type CustomerProfile as h, type CustomerAddress as i, type AddressDetail as j, type OrderDetail as k, type OrderAccessRequestResponse as l, type OrderAccessVerifyResponse as m, type CheckoutInput as n, type PageDetail as o, type Page as p, type ShopScripts as q, type ShopSeo as r, type Bundle as s, type CrossSellItem as t, type ActivePromotion as u, type ProductReviewsResponse as v, type SubmitReviewInput as w, type ReturnableOrder as x, type ReturnStatus as y, type ReturnRequest as z };
|
|
@@ -342,6 +342,17 @@ interface AuthTokens {
|
|
|
342
342
|
accessToken: string;
|
|
343
343
|
refreshToken: string;
|
|
344
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* Result of a registration. When the eshop requires admin approval,
|
|
347
|
+
* `pendingApproval` is true and the tokens are null (the account is created but
|
|
348
|
+
* inactive and can't log in until approved) — the storefront should show a
|
|
349
|
+
* "waiting for approval" message instead of a logged-in session.
|
|
350
|
+
*/
|
|
351
|
+
interface RegisterResult {
|
|
352
|
+
pendingApproval: boolean;
|
|
353
|
+
accessToken: string | null;
|
|
354
|
+
refreshToken: string | null;
|
|
355
|
+
}
|
|
345
356
|
interface RegisterInput {
|
|
346
357
|
email: string;
|
|
347
358
|
password: string;
|
|
@@ -1158,7 +1169,7 @@ declare class AuthModule {
|
|
|
1158
1169
|
private client;
|
|
1159
1170
|
constructor(client: BehioStorefront);
|
|
1160
1171
|
/** Register a new customer */
|
|
1161
|
-
register(input: RegisterInput): Promise<SdkResult<
|
|
1172
|
+
register(input: RegisterInput): Promise<SdkResult<RegisterResult>>;
|
|
1162
1173
|
/** Login with email and password */
|
|
1163
1174
|
login(input: LoginInput): Promise<SdkResult<AuthTokens>>;
|
|
1164
1175
|
/** Refresh access token using refresh token */
|
|
@@ -1432,4 +1443,4 @@ declare class ShippingModule {
|
|
|
1432
1443
|
}>>;
|
|
1433
1444
|
}
|
|
1434
1445
|
|
|
1435
|
-
export { type OrderStatus as $, type AddressSuggestion as A, type BehioStorefrontConfig as B, type Category as C, type SubmitReturnInput as D, type CookieConsent as E, type FilterField as F, type GiftCardBalance as G, type CookieConsentInput as H, type SubmitQuoteInput as I, type BackInStockSubscription as J, type AddToCartInput as K, type AuthTokens as L, BehioApiError as M, type BundleItem as N, type OrderListItem as O, type ProductsQuery as P, type QuoteRequest as Q, type RegisterInput as R, type ShopInfo as S, type CartDiscount as T, type CartItem as U, type CheckoutAddress as V, type WishlistItem as W, type FulfillmentStatus as X, type LoginInput as Y, type MessageResponse as Z, type OrderItem as _, BehioStorefront as a, type PaymentStatus as a0, type ProductPrice as a1, type ProductReview as a2, type ProductVariant as a3, type AddressType as a4, AddressTypes as a5, type BehioErrorCode as a6, type BehioEventHandler as a7, type BehioEventType as a8, BehioNetworkError as a9, type
|
|
1446
|
+
export { type OrderStatus as $, type AddressSuggestion as A, type BehioStorefrontConfig as B, type Category as C, type SubmitReturnInput as D, type CookieConsent as E, type FilterField as F, type GiftCardBalance as G, type CookieConsentInput as H, type SubmitQuoteInput as I, type BackInStockSubscription as J, type AddToCartInput as K, type AuthTokens as L, BehioApiError as M, type BundleItem as N, type OrderListItem as O, type ProductsQuery as P, type QuoteRequest as Q, type RegisterInput as R, type ShopInfo as S, type CartDiscount as T, type CartItem as U, type CheckoutAddress as V, type WishlistItem as W, type FulfillmentStatus as X, type LoginInput as Y, type MessageResponse as Z, type OrderItem as _, BehioStorefront as a, type PaymentStatus as a0, type ProductPrice as a1, type ProductReview as a2, type ProductVariant as a3, type AddressType as a4, AddressTypes as a5, type BehioErrorCode as a6, type BehioEventHandler as a7, type BehioEventType as a8, BehioNetworkError as a9, type SdkError as aA, type SdkResult as aB, type ShippingMethodSummary as aC, type ShippingQuote as aD, type ShippingQuoteInput as aE, type ShopScript as aF, type ShopScriptPlacement as aG, type ShopScriptType as aH, err as aI, ok as aJ, toSdkError as aK, type CartBundleLine as aa, type CartBundleLineItem as ab, type CartItemProduct as ac, type CheckoutPaymentMethod as ad, type DataGroupFieldType as ae, FulfillmentStatuses as af, type GiftCardSummary as ag, type OrderStatusHistory as ah, OrderStatuses as ai, type OrderTracking as aj, type PageAttachment as ak, PaymentStatuses as al, type ProductMedia as am, type ProductMediaVariant as an, ProductSort as ao, type ProductSortValue as ap, type ProductVolumePrice as aq, type QuoteItem as ar, type RegisterResult as as, type RequestInterceptor as at, type RequestInterceptorConfig as au, type ResponseInterceptor as av, type ResponseInterceptorData as aw, type ReturnRequestItem as ax, type ReturnStatusItem as ay, type ReturnableOrderItem as az, type PaginatedResponse as b, type ProductListItem as c, type ProductDetail as d, type CategoryDetail as e, type ProductLabel as f, type Cart as g, type CustomerProfile as h, type CustomerAddress as i, type AddressDetail as j, type OrderDetail as k, type OrderAccessRequestResponse as l, type OrderAccessVerifyResponse as m, type CheckoutInput as n, type PageDetail as o, type Page as p, type ShopScripts as q, type ShopSeo as r, type Bundle as s, type CrossSellItem as t, type ActivePromotion as u, type ProductReviewsResponse as v, type SubmitReviewInput as w, type ReturnableOrder as x, type ReturnStatus as y, type ReturnRequest as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { u as ActivePromotion, K as AddToCartInput, j as AddressDetail, A as AddressSuggestion, a4 as AddressType, a5 as AddressTypes, L as AuthTokens, J as BackInStockSubscription, M as BehioApiError, a6 as BehioErrorCode, a7 as BehioEventHandler, a8 as BehioEventType, a9 as BehioNetworkError, a as BehioStorefront, B as BehioStorefrontConfig, s as Bundle, N as BundleItem, g as Cart, aa as CartBundleLine, ab as CartBundleLineItem, T as CartDiscount, U as CartItem, ac as CartItemProduct, C as Category, e as CategoryDetail, V as CheckoutAddress, n as CheckoutInput, ad as CheckoutPaymentMethod, E as CookieConsent, H as CookieConsentInput, t as CrossSellItem, i as CustomerAddress, h as CustomerProfile, ae as DataGroupFieldType, F as FilterField, X as FulfillmentStatus, af as FulfillmentStatuses, G as GiftCardBalance, ag as GiftCardSummary, Y as LoginInput, Z as MessageResponse, l as OrderAccessRequestResponse, m as OrderAccessVerifyResponse, k as OrderDetail, _ as OrderItem, O as OrderListItem, $ as OrderStatus, ah as OrderStatusHistory, ai as OrderStatuses, aj as OrderTracking, p as Page, ak as PageAttachment, o as PageDetail, b as PaginatedResponse, a0 as PaymentStatus, al as PaymentStatuses, d as ProductDetail, f as ProductLabel, c as ProductListItem, am as ProductMedia, an as ProductMediaVariant, a1 as ProductPrice, a2 as ProductReview, v as ProductReviewsResponse, ao as ProductSort, ap as ProductSortValue, a3 as ProductVariant, aq as ProductVolumePrice, P as ProductsQuery, ar as QuoteItem, Q as QuoteRequest, R as RegisterInput, as as
|
|
1
|
+
export { u as ActivePromotion, K as AddToCartInput, j as AddressDetail, A as AddressSuggestion, a4 as AddressType, a5 as AddressTypes, L as AuthTokens, J as BackInStockSubscription, M as BehioApiError, a6 as BehioErrorCode, a7 as BehioEventHandler, a8 as BehioEventType, a9 as BehioNetworkError, a as BehioStorefront, B as BehioStorefrontConfig, s as Bundle, N as BundleItem, g as Cart, aa as CartBundleLine, ab as CartBundleLineItem, T as CartDiscount, U as CartItem, ac as CartItemProduct, C as Category, e as CategoryDetail, V as CheckoutAddress, n as CheckoutInput, ad as CheckoutPaymentMethod, E as CookieConsent, H as CookieConsentInput, t as CrossSellItem, i as CustomerAddress, h as CustomerProfile, ae as DataGroupFieldType, F as FilterField, X as FulfillmentStatus, af as FulfillmentStatuses, G as GiftCardBalance, ag as GiftCardSummary, Y as LoginInput, Z as MessageResponse, l as OrderAccessRequestResponse, m as OrderAccessVerifyResponse, k as OrderDetail, _ as OrderItem, O as OrderListItem, $ as OrderStatus, ah as OrderStatusHistory, ai as OrderStatuses, aj as OrderTracking, p as Page, ak as PageAttachment, o as PageDetail, b as PaginatedResponse, a0 as PaymentStatus, al as PaymentStatuses, d as ProductDetail, f as ProductLabel, c as ProductListItem, am as ProductMedia, an as ProductMediaVariant, a1 as ProductPrice, a2 as ProductReview, v as ProductReviewsResponse, ao as ProductSort, ap as ProductSortValue, a3 as ProductVariant, aq as ProductVolumePrice, P as ProductsQuery, ar as QuoteItem, Q as QuoteRequest, R as RegisterInput, as as RegisterResult, at as RequestInterceptor, au as RequestInterceptorConfig, av as ResponseInterceptor, aw as ResponseInterceptorData, z as ReturnRequest, ax as ReturnRequestItem, y as ReturnStatus, ay as ReturnStatusItem, x as ReturnableOrder, az as ReturnableOrderItem, aA as SdkError, aB as SdkResult, aC as ShippingMethodSummary, aD as ShippingQuote, aE as ShippingQuoteInput, S as ShopInfo, aF as ShopScript, aG as ShopScriptPlacement, aH as ShopScriptType, q as ShopScripts, r as ShopSeo, I as SubmitQuoteInput, D as SubmitReturnInput, w as SubmitReviewInput, W as WishlistItem, aI as err, aJ as ok, aK as toSdkError } from './client-hCuGQERQ.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Format a price amount with currency using Intl.NumberFormat.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { u as ActivePromotion, K as AddToCartInput, j as AddressDetail, A as AddressSuggestion, a4 as AddressType, a5 as AddressTypes, L as AuthTokens, J as BackInStockSubscription, M as BehioApiError, a6 as BehioErrorCode, a7 as BehioEventHandler, a8 as BehioEventType, a9 as BehioNetworkError, a as BehioStorefront, B as BehioStorefrontConfig, s as Bundle, N as BundleItem, g as Cart, aa as CartBundleLine, ab as CartBundleLineItem, T as CartDiscount, U as CartItem, ac as CartItemProduct, C as Category, e as CategoryDetail, V as CheckoutAddress, n as CheckoutInput, ad as CheckoutPaymentMethod, E as CookieConsent, H as CookieConsentInput, t as CrossSellItem, i as CustomerAddress, h as CustomerProfile, ae as DataGroupFieldType, F as FilterField, X as FulfillmentStatus, af as FulfillmentStatuses, G as GiftCardBalance, ag as GiftCardSummary, Y as LoginInput, Z as MessageResponse, l as OrderAccessRequestResponse, m as OrderAccessVerifyResponse, k as OrderDetail, _ as OrderItem, O as OrderListItem, $ as OrderStatus, ah as OrderStatusHistory, ai as OrderStatuses, aj as OrderTracking, p as Page, ak as PageAttachment, o as PageDetail, b as PaginatedResponse, a0 as PaymentStatus, al as PaymentStatuses, d as ProductDetail, f as ProductLabel, c as ProductListItem, am as ProductMedia, an as ProductMediaVariant, a1 as ProductPrice, a2 as ProductReview, v as ProductReviewsResponse, ao as ProductSort, ap as ProductSortValue, a3 as ProductVariant, aq as ProductVolumePrice, P as ProductsQuery, ar as QuoteItem, Q as QuoteRequest, R as RegisterInput, as as
|
|
1
|
+
export { u as ActivePromotion, K as AddToCartInput, j as AddressDetail, A as AddressSuggestion, a4 as AddressType, a5 as AddressTypes, L as AuthTokens, J as BackInStockSubscription, M as BehioApiError, a6 as BehioErrorCode, a7 as BehioEventHandler, a8 as BehioEventType, a9 as BehioNetworkError, a as BehioStorefront, B as BehioStorefrontConfig, s as Bundle, N as BundleItem, g as Cart, aa as CartBundleLine, ab as CartBundleLineItem, T as CartDiscount, U as CartItem, ac as CartItemProduct, C as Category, e as CategoryDetail, V as CheckoutAddress, n as CheckoutInput, ad as CheckoutPaymentMethod, E as CookieConsent, H as CookieConsentInput, t as CrossSellItem, i as CustomerAddress, h as CustomerProfile, ae as DataGroupFieldType, F as FilterField, X as FulfillmentStatus, af as FulfillmentStatuses, G as GiftCardBalance, ag as GiftCardSummary, Y as LoginInput, Z as MessageResponse, l as OrderAccessRequestResponse, m as OrderAccessVerifyResponse, k as OrderDetail, _ as OrderItem, O as OrderListItem, $ as OrderStatus, ah as OrderStatusHistory, ai as OrderStatuses, aj as OrderTracking, p as Page, ak as PageAttachment, o as PageDetail, b as PaginatedResponse, a0 as PaymentStatus, al as PaymentStatuses, d as ProductDetail, f as ProductLabel, c as ProductListItem, am as ProductMedia, an as ProductMediaVariant, a1 as ProductPrice, a2 as ProductReview, v as ProductReviewsResponse, ao as ProductSort, ap as ProductSortValue, a3 as ProductVariant, aq as ProductVolumePrice, P as ProductsQuery, ar as QuoteItem, Q as QuoteRequest, R as RegisterInput, as as RegisterResult, at as RequestInterceptor, au as RequestInterceptorConfig, av as ResponseInterceptor, aw as ResponseInterceptorData, z as ReturnRequest, ax as ReturnRequestItem, y as ReturnStatus, ay as ReturnStatusItem, x as ReturnableOrder, az as ReturnableOrderItem, aA as SdkError, aB as SdkResult, aC as ShippingMethodSummary, aD as ShippingQuote, aE as ShippingQuoteInput, S as ShopInfo, aF as ShopScript, aG as ShopScriptPlacement, aH as ShopScriptType, q as ShopScripts, r as ShopSeo, I as SubmitQuoteInput, D as SubmitReturnInput, w as SubmitReviewInput, W as WishlistItem, aI as err, aJ as ok, aK as toSdkError } from './client-hCuGQERQ.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Format a price amount with currency using Intl.NumberFormat.
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var _chunkXWYDXBLGjs = require('./chunk-XWYDXBLG.js');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkBF4YVFHXjs = require('./chunk-BF4YVFHX.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -27,4 +27,4 @@ var _chunkS7YSZHHDjs = require('./chunk-S7YSZHHD.js');
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
exports.AddressTypes =
|
|
30
|
+
exports.AddressTypes = _chunkBF4YVFHXjs.AddressTypes; exports.BehioApiError = _chunkBF4YVFHXjs.BehioApiError; exports.BehioNetworkError = _chunkBF4YVFHXjs.BehioNetworkError; exports.BehioStorefront = _chunkBF4YVFHXjs.BehioStorefront; exports.FulfillmentStatuses = _chunkBF4YVFHXjs.FulfillmentStatuses; exports.OrderStatuses = _chunkBF4YVFHXjs.OrderStatuses; exports.PaymentStatuses = _chunkBF4YVFHXjs.PaymentStatuses; exports.ProductSort = _chunkBF4YVFHXjs.ProductSort; exports.err = _chunkBF4YVFHXjs.err; exports.formatPrice = _chunkXWYDXBLGjs.formatPrice; exports.ok = _chunkBF4YVFHXjs.ok; exports.toSdkError = _chunkBF4YVFHXjs.toSdkError;
|
package/dist/index.mjs
CHANGED
package/dist/next.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BehioStorefrontConfig, a as BehioStorefront } from './client-
|
|
1
|
+
import { B as BehioStorefrontConfig, a as BehioStorefront } from './client-hCuGQERQ.mjs';
|
|
2
2
|
|
|
3
3
|
interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
|
|
4
4
|
/** Override the cart session cookie name (default: "behio_cart_session"). */
|
package/dist/next.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BehioStorefrontConfig, a as BehioStorefront } from './client-
|
|
1
|
+
import { B as BehioStorefrontConfig, a as BehioStorefront } from './client-hCuGQERQ.js';
|
|
2
2
|
|
|
3
3
|
interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
|
|
4
4
|
/** Override the cart session cookie name (default: "behio_cart_session"). */
|
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 _chunkBF4YVFHXjs = require('./chunk-BF4YVFHX.js');
|
|
4
4
|
|
|
5
5
|
// src/next.ts
|
|
6
6
|
var _headers = require('next/headers');
|
|
@@ -18,7 +18,7 @@ async function getBehio(options = {}) {
|
|
|
18
18
|
const locale = _nullishCoalesce(options.locale, () => ( process.env.BEHIO_LOCALE));
|
|
19
19
|
const currency = _nullishCoalesce(options.currency, () => ( process.env.BEHIO_CURRENCY));
|
|
20
20
|
const cookieName = _nullishCoalesce(options.cartCookieName, () => ( CART_COOKIE_NAME));
|
|
21
|
-
const client = new (0,
|
|
21
|
+
const client = new (0, _chunkBF4YVFHXjs.BehioStorefront)({
|
|
22
22
|
apiKey,
|
|
23
23
|
...baseUrl ? { baseUrl } : {},
|
|
24
24
|
...locale ? { locale } : {},
|
package/dist/next.mjs
CHANGED
package/dist/react.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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 { a as BehioStorefront, P as ProductsQuery, b as PaginatedResponse, c as ProductListItem, d as ProductDetail, C as Category, e as CategoryDetail, f as ProductLabel, F as FilterField, g as Cart, h as CustomerProfile, R as RegisterInput, i as CustomerAddress, A as AddressSuggestion, j as AddressDetail, O as OrderListItem, k as OrderDetail, l as OrderAccessRequestResponse, m as OrderAccessVerifyResponse, n as CheckoutInput, o as PageDetail, p as Page, S as ShopInfo, q as ShopScripts, r as ShopSeo, s as Bundle, t as CrossSellItem, u as ActivePromotion, G as GiftCardBalance, W as WishlistItem, v as ProductReviewsResponse, w as SubmitReviewInput, x as ReturnableOrder, y as ReturnStatus, z as ReturnRequest, D as SubmitReturnInput, E as CookieConsent, H as CookieConsentInput, Q as QuoteRequest, I as SubmitQuoteInput, J as BackInStockSubscription } from './client-
|
|
5
|
-
export { K as AddToCartInput, L as AuthTokens, M as BehioApiError, N as BundleItem, T as CartDiscount, U as CartItem, V as CheckoutAddress, X as FulfillmentStatus, Y as LoginInput, Z as MessageResponse, _ as OrderItem, $ as OrderStatus, a0 as PaymentStatus, a1 as ProductPrice, a2 as ProductReview, a3 as ProductVariant } from './client-
|
|
4
|
+
import { a as BehioStorefront, P as ProductsQuery, b as PaginatedResponse, c as ProductListItem, d as ProductDetail, C as Category, e as CategoryDetail, f as ProductLabel, F as FilterField, g as Cart, h as CustomerProfile, R as RegisterInput, i as CustomerAddress, A as AddressSuggestion, j as AddressDetail, O as OrderListItem, k as OrderDetail, l as OrderAccessRequestResponse, m as OrderAccessVerifyResponse, n as CheckoutInput, o as PageDetail, p as Page, S as ShopInfo, q as ShopScripts, r as ShopSeo, s as Bundle, t as CrossSellItem, u as ActivePromotion, G as GiftCardBalance, W as WishlistItem, v as ProductReviewsResponse, w as SubmitReviewInput, x as ReturnableOrder, y as ReturnStatus, z as ReturnRequest, D as SubmitReturnInput, E as CookieConsent, H as CookieConsentInput, Q as QuoteRequest, I as SubmitQuoteInput, J as BackInStockSubscription } from './client-hCuGQERQ.mjs';
|
|
5
|
+
export { K as AddToCartInput, L as AuthTokens, M as BehioApiError, N as BundleItem, T as CartDiscount, U as CartItem, V as CheckoutAddress, X as FulfillmentStatus, Y as LoginInput, Z as MessageResponse, _ as OrderItem, $ as OrderStatus, a0 as PaymentStatus, a1 as ProductPrice, a2 as ProductReview, a3 as ProductVariant } from './client-hCuGQERQ.mjs';
|
|
6
6
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
7
7
|
export { formatPrice } from './index.mjs';
|
|
8
8
|
|
package/dist/react.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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 { a as BehioStorefront, P as ProductsQuery, b as PaginatedResponse, c as ProductListItem, d as ProductDetail, C as Category, e as CategoryDetail, f as ProductLabel, F as FilterField, g as Cart, h as CustomerProfile, R as RegisterInput, i as CustomerAddress, A as AddressSuggestion, j as AddressDetail, O as OrderListItem, k as OrderDetail, l as OrderAccessRequestResponse, m as OrderAccessVerifyResponse, n as CheckoutInput, o as PageDetail, p as Page, S as ShopInfo, q as ShopScripts, r as ShopSeo, s as Bundle, t as CrossSellItem, u as ActivePromotion, G as GiftCardBalance, W as WishlistItem, v as ProductReviewsResponse, w as SubmitReviewInput, x as ReturnableOrder, y as ReturnStatus, z as ReturnRequest, D as SubmitReturnInput, E as CookieConsent, H as CookieConsentInput, Q as QuoteRequest, I as SubmitQuoteInput, J as BackInStockSubscription } from './client-
|
|
5
|
-
export { K as AddToCartInput, L as AuthTokens, M as BehioApiError, N as BundleItem, T as CartDiscount, U as CartItem, V as CheckoutAddress, X as FulfillmentStatus, Y as LoginInput, Z as MessageResponse, _ as OrderItem, $ as OrderStatus, a0 as PaymentStatus, a1 as ProductPrice, a2 as ProductReview, a3 as ProductVariant } from './client-
|
|
4
|
+
import { a as BehioStorefront, P as ProductsQuery, b as PaginatedResponse, c as ProductListItem, d as ProductDetail, C as Category, e as CategoryDetail, f as ProductLabel, F as FilterField, g as Cart, h as CustomerProfile, R as RegisterInput, i as CustomerAddress, A as AddressSuggestion, j as AddressDetail, O as OrderListItem, k as OrderDetail, l as OrderAccessRequestResponse, m as OrderAccessVerifyResponse, n as CheckoutInput, o as PageDetail, p as Page, S as ShopInfo, q as ShopScripts, r as ShopSeo, s as Bundle, t as CrossSellItem, u as ActivePromotion, G as GiftCardBalance, W as WishlistItem, v as ProductReviewsResponse, w as SubmitReviewInput, x as ReturnableOrder, y as ReturnStatus, z as ReturnRequest, D as SubmitReturnInput, E as CookieConsent, H as CookieConsentInput, Q as QuoteRequest, I as SubmitQuoteInput, J as BackInStockSubscription } from './client-hCuGQERQ.js';
|
|
5
|
+
export { K as AddToCartInput, L as AuthTokens, M as BehioApiError, N as BundleItem, T as CartDiscount, U as CartItem, V as CheckoutAddress, X as FulfillmentStatus, Y as LoginInput, Z as MessageResponse, _ as OrderItem, $ as OrderStatus, a0 as PaymentStatus, a1 as ProductPrice, a2 as ProductReview, a3 as ProductVariant } from './client-hCuGQERQ.js';
|
|
6
6
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
7
7
|
export { formatPrice } from './index.js';
|
|
8
8
|
|
package/dist/react.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkXWYDXBLGjs = require('./chunk-XWYDXBLG.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkBF4YVFHXjs = require('./chunk-BF4YVFHX.js');
|
|
7
7
|
|
|
8
8
|
// src/react/provider.tsx
|
|
9
9
|
var _react = require('react');
|
|
@@ -133,7 +133,7 @@ function BehioProvider({
|
|
|
133
133
|
const [activeCurrency, setActiveCurrency] = _react.useState.call(void 0, resolveInitialCurrency);
|
|
134
134
|
const clientRef = _react.useRef.call(void 0, null);
|
|
135
135
|
if (!clientRef.current) {
|
|
136
|
-
clientRef.current = new (0,
|
|
136
|
+
clientRef.current = new (0, _chunkBF4YVFHXjs.BehioStorefront)({
|
|
137
137
|
apiKey,
|
|
138
138
|
baseUrl,
|
|
139
139
|
...shopDomain ? { shopDomain } : {},
|
|
@@ -635,9 +635,11 @@ function useAuth() {
|
|
|
635
635
|
mutationFn: async (input) => {
|
|
636
636
|
return unwrap(client.auth.register(input));
|
|
637
637
|
},
|
|
638
|
-
onSuccess: async (
|
|
639
|
-
|
|
640
|
-
|
|
638
|
+
onSuccess: async (result) => {
|
|
639
|
+
if (result.accessToken && result.refreshToken) {
|
|
640
|
+
persistTokens({ accessToken: result.accessToken, refreshToken: result.refreshToken });
|
|
641
|
+
await postAuth();
|
|
642
|
+
}
|
|
641
643
|
}
|
|
642
644
|
});
|
|
643
645
|
const logoutMutation = _reactquery.useMutation.call(void 0, {
|
package/dist/react.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-YJ45WIQZ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
BehioStorefront
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PZED7VMQ.mjs";
|
|
7
7
|
|
|
8
8
|
// src/react/provider.tsx
|
|
9
9
|
import { useRef, useEffect, useMemo, useState, useCallback } from "react";
|
|
@@ -635,9 +635,11 @@ function useAuth() {
|
|
|
635
635
|
mutationFn: async (input) => {
|
|
636
636
|
return unwrap(client.auth.register(input));
|
|
637
637
|
},
|
|
638
|
-
onSuccess: async (
|
|
639
|
-
|
|
640
|
-
|
|
638
|
+
onSuccess: async (result) => {
|
|
639
|
+
if (result.accessToken && result.refreshToken) {
|
|
640
|
+
persistTokens({ accessToken: result.accessToken, refreshToken: result.refreshToken });
|
|
641
|
+
await postAuth();
|
|
642
|
+
}
|
|
641
643
|
}
|
|
642
644
|
});
|
|
643
645
|
const logoutMutation = useMutation2({
|