@behio/storefront-sdk 0.23.0 → 0.24.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-2CD4CPEV.mjs → chunk-OFUECU3W.mjs} +11 -0
- package/dist/{chunk-3RI2QBQO.js → chunk-YS4RARKL.js} +11 -0
- package/dist/{client-B0VFrsad.d.mts → client-B2x8fUb3.d.mts} +23 -0
- package/dist/{client-B0VFrsad.d.ts → client-B2x8fUb3.d.ts} +23 -0
- 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 +24 -17
- package/dist/react.mjs +9 -2
- package/package.json +1 -1
|
@@ -182,6 +182,17 @@ var BehioStorefront = class {
|
|
|
182
182
|
} catch {
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Personal behavioral offers for this visitor (consent-gated id). Returns
|
|
187
|
+
* only the visitor's own offers; requires the analytics visitor id.
|
|
188
|
+
*/
|
|
189
|
+
async getPersonalOffers(visitorId) {
|
|
190
|
+
return this.request("GET", "/offers", { query: { visitorId } });
|
|
191
|
+
}
|
|
192
|
+
/** Email-gate completion: trade an e-mail for the personal discount code. */
|
|
193
|
+
async claimOfferByEmail(offerId, input) {
|
|
194
|
+
return this.request("POST", `/offers/${offerId}/claim-email`, { body: input });
|
|
195
|
+
}
|
|
185
196
|
/** Get basic shop info */
|
|
186
197
|
async getShopInfo() {
|
|
187
198
|
return this.request("GET", "/shop");
|
|
@@ -182,6 +182,17 @@ var BehioStorefront = class {
|
|
|
182
182
|
} catch (e) {
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Personal behavioral offers for this visitor (consent-gated id). Returns
|
|
187
|
+
* only the visitor's own offers; requires the analytics visitor id.
|
|
188
|
+
*/
|
|
189
|
+
async getPersonalOffers(visitorId) {
|
|
190
|
+
return this.request("GET", "/offers", { query: { visitorId } });
|
|
191
|
+
}
|
|
192
|
+
/** Email-gate completion: trade an e-mail for the personal discount code. */
|
|
193
|
+
async claimOfferByEmail(offerId, input) {
|
|
194
|
+
return this.request("POST", `/offers/${offerId}/claim-email`, { body: input });
|
|
195
|
+
}
|
|
185
196
|
/** Get basic shop info */
|
|
186
197
|
async getShopInfo() {
|
|
187
198
|
return this.request("GET", "/shop");
|
|
@@ -1066,6 +1066,29 @@ declare class BehioStorefront {
|
|
|
1066
1066
|
props?: Record<string, unknown>;
|
|
1067
1067
|
}>;
|
|
1068
1068
|
}): Promise<void>;
|
|
1069
|
+
/**
|
|
1070
|
+
* Personal behavioral offers for this visitor (consent-gated id). Returns
|
|
1071
|
+
* only the visitor's own offers; requires the analytics visitor id.
|
|
1072
|
+
*/
|
|
1073
|
+
getPersonalOffers(visitorId: string): Promise<SdkResult<{
|
|
1074
|
+
items: Array<{
|
|
1075
|
+
id: string;
|
|
1076
|
+
productId: string;
|
|
1077
|
+
percent: number;
|
|
1078
|
+
status: string;
|
|
1079
|
+
code: string | null;
|
|
1080
|
+
expiresAt: number;
|
|
1081
|
+
}>;
|
|
1082
|
+
}>>;
|
|
1083
|
+
/** Email-gate completion: trade an e-mail for the personal discount code. */
|
|
1084
|
+
claimOfferByEmail(offerId: string, input: {
|
|
1085
|
+
visitorId: string;
|
|
1086
|
+
email: string;
|
|
1087
|
+
}): Promise<SdkResult<{
|
|
1088
|
+
code: string;
|
|
1089
|
+
percent: number;
|
|
1090
|
+
expiresAt: number;
|
|
1091
|
+
}>>;
|
|
1069
1092
|
/** Get basic shop info */
|
|
1070
1093
|
getShopInfo(): Promise<SdkResult<ShopInfo>>;
|
|
1071
1094
|
/** Get SEO metadata for the shop homepage in the given locale (defaults to shop default). */
|
|
@@ -1066,6 +1066,29 @@ declare class BehioStorefront {
|
|
|
1066
1066
|
props?: Record<string, unknown>;
|
|
1067
1067
|
}>;
|
|
1068
1068
|
}): Promise<void>;
|
|
1069
|
+
/**
|
|
1070
|
+
* Personal behavioral offers for this visitor (consent-gated id). Returns
|
|
1071
|
+
* only the visitor's own offers; requires the analytics visitor id.
|
|
1072
|
+
*/
|
|
1073
|
+
getPersonalOffers(visitorId: string): Promise<SdkResult<{
|
|
1074
|
+
items: Array<{
|
|
1075
|
+
id: string;
|
|
1076
|
+
productId: string;
|
|
1077
|
+
percent: number;
|
|
1078
|
+
status: string;
|
|
1079
|
+
code: string | null;
|
|
1080
|
+
expiresAt: number;
|
|
1081
|
+
}>;
|
|
1082
|
+
}>>;
|
|
1083
|
+
/** Email-gate completion: trade an e-mail for the personal discount code. */
|
|
1084
|
+
claimOfferByEmail(offerId: string, input: {
|
|
1085
|
+
visitorId: string;
|
|
1086
|
+
email: string;
|
|
1087
|
+
}): Promise<SdkResult<{
|
|
1088
|
+
code: string;
|
|
1089
|
+
percent: number;
|
|
1090
|
+
expiresAt: number;
|
|
1091
|
+
}>>;
|
|
1069
1092
|
/** Get basic shop info */
|
|
1070
1093
|
getShopInfo(): Promise<SdkResult<ShopInfo>>;
|
|
1071
1094
|
/** Get SEO metadata for the shop homepage in the given locale (defaults to shop default). */
|
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 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-
|
|
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-B2x8fUb3.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 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-
|
|
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-B2x8fUb3.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Format a price amount with currency using Intl.NumberFormat.
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var _chunkJIAOZ5YWjs = require('./chunk-JIAOZ5YW.js');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkYS4RARKLjs = require('./chunk-YS4RARKL.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -29,4 +29,4 @@ var _chunk3RI2QBQOjs = require('./chunk-3RI2QBQO.js');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
exports.AddressTypes =
|
|
32
|
+
exports.AddressTypes = _chunkYS4RARKLjs.AddressTypes; exports.BehioApiError = _chunkYS4RARKLjs.BehioApiError; exports.BehioNetworkError = _chunkYS4RARKLjs.BehioNetworkError; exports.BehioStorefront = _chunkYS4RARKLjs.BehioStorefront; exports.FulfillmentStatuses = _chunkYS4RARKLjs.FulfillmentStatuses; exports.OrderStatuses = _chunkYS4RARKLjs.OrderStatuses; exports.PaymentStatuses = _chunkYS4RARKLjs.PaymentStatuses; exports.ProductSort = _chunkYS4RARKLjs.ProductSort; exports.err = _chunkYS4RARKLjs.err; exports.formatPrice = _chunkJIAOZ5YWjs.formatPrice; exports.ok = _chunkYS4RARKLjs.ok; exports.toSdkError = _chunkYS4RARKLjs.toSdkError; exports.trackEcommerceEvent = _chunkJIAOZ5YWjs.trackEcommerceEvent;
|
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-B2x8fUb3.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-B2x8fUb3.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 _chunkYS4RARKLjs = require('./chunk-YS4RARKL.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, _chunkYS4RARKLjs.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-B2x8fUb3.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-B2x8fUb3.mjs';
|
|
6
6
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
7
7
|
export { EcommerceEventName, EcommerceItem, EcommercePayload, formatPrice, trackEcommerceEvent } 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-B2x8fUb3.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-B2x8fUb3.js';
|
|
6
6
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
7
7
|
export { EcommerceEventName, EcommerceItem, EcommercePayload, formatPrice, trackEcommerceEvent } from './index.js';
|
|
8
8
|
|
package/dist/react.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var _chunkJIAOZ5YWjs = require('./chunk-JIAOZ5YW.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkYS4RARKLjs = require('./chunk-YS4RARKL.js');
|
|
8
8
|
|
|
9
9
|
// src/react/provider.tsx
|
|
10
10
|
var _react = require('react');
|
|
@@ -134,7 +134,7 @@ function BehioProvider({
|
|
|
134
134
|
const [activeCurrency, setActiveCurrency] = _react.useState.call(void 0, resolveInitialCurrency);
|
|
135
135
|
const clientRef = _react.useRef.call(void 0, null);
|
|
136
136
|
if (!clientRef.current) {
|
|
137
|
-
clientRef.current = new (0,
|
|
137
|
+
clientRef.current = new (0, _chunkYS4RARKLjs.BehioStorefront)({
|
|
138
138
|
apiKey,
|
|
139
139
|
baseUrl,
|
|
140
140
|
...shopDomain ? { shopDomain } : {},
|
|
@@ -1436,7 +1436,14 @@ function initTracker(client) {
|
|
|
1436
1436
|
ts: Date.now(),
|
|
1437
1437
|
...payload.value != null ? { value: payload.value } : {},
|
|
1438
1438
|
...payload.currency ? { currency: payload.currency } : {},
|
|
1439
|
-
...Array.isArray(payload.items) && payload.items.length > 0 ? {
|
|
1439
|
+
...Array.isArray(payload.items) && payload.items.length > 0 ? {
|
|
1440
|
+
props: {
|
|
1441
|
+
items: payload.items.length,
|
|
1442
|
+
// First item id = the product (view_item/add_to_cart are
|
|
1443
|
+
// single-product in practice) - Behavioral Offers count on it.
|
|
1444
|
+
itemId: _optionalChain([payload, 'access', _74 => _74.items, 'access', _75 => _75[0], 'optionalAccess', _76 => _76.item_id])
|
|
1445
|
+
}
|
|
1446
|
+
} : {}
|
|
1440
1447
|
});
|
|
1441
1448
|
};
|
|
1442
1449
|
const origPush = history.pushState.bind(history);
|
|
@@ -1496,8 +1503,8 @@ function useBundles(options) {
|
|
|
1496
1503
|
return _reactquery.useQuery.call(void 0, {
|
|
1497
1504
|
queryKey: ["behio", "bundles"],
|
|
1498
1505
|
queryFn: () => unwrap(client.catalog.getBundles()),
|
|
1499
|
-
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1500
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1506
|
+
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _77 => _77.enabled]), () => ( true)),
|
|
1507
|
+
initialData: _optionalChain([options, 'optionalAccess', _78 => _78.initialData])
|
|
1501
1508
|
});
|
|
1502
1509
|
}
|
|
1503
1510
|
function useBundle(slug, options) {
|
|
@@ -1505,8 +1512,8 @@ function useBundle(slug, options) {
|
|
|
1505
1512
|
return _reactquery.useQuery.call(void 0, {
|
|
1506
1513
|
queryKey: ["behio", "bundle", slug],
|
|
1507
1514
|
queryFn: () => unwrap(client.catalog.getBundle(slug)),
|
|
1508
|
-
enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1509
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1515
|
+
enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _79 => _79.enabled]), () => ( true))),
|
|
1516
|
+
initialData: _optionalChain([options, 'optionalAccess', _80 => _80.initialData])
|
|
1510
1517
|
});
|
|
1511
1518
|
}
|
|
1512
1519
|
|
|
@@ -1517,8 +1524,8 @@ function useCrossSell(productSlug, options) {
|
|
|
1517
1524
|
return _reactquery.useQuery.call(void 0, {
|
|
1518
1525
|
queryKey: ["behio", "cross-sell", productSlug],
|
|
1519
1526
|
queryFn: () => unwrap(client.catalog.getCrossSell(productSlug)),
|
|
1520
|
-
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1521
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1527
|
+
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _81 => _81.enabled]), () => ( true))),
|
|
1528
|
+
initialData: _optionalChain([options, 'optionalAccess', _82 => _82.initialData])
|
|
1522
1529
|
});
|
|
1523
1530
|
}
|
|
1524
1531
|
|
|
@@ -1529,8 +1536,8 @@ function useProductPromotions(productSlug, options) {
|
|
|
1529
1536
|
return _reactquery.useQuery.call(void 0, {
|
|
1530
1537
|
queryKey: ["behio", "product-promotions", productSlug],
|
|
1531
1538
|
queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
|
|
1532
|
-
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1533
|
-
refetchInterval: _optionalChain([options, 'optionalAccess',
|
|
1539
|
+
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _83 => _83.enabled]), () => ( true))),
|
|
1540
|
+
refetchInterval: _optionalChain([options, 'optionalAccess', _84 => _84.refetchIntervalMs])
|
|
1534
1541
|
});
|
|
1535
1542
|
}
|
|
1536
1543
|
|
|
@@ -1538,11 +1545,11 @@ function useProductPromotions(productSlug, options) {
|
|
|
1538
1545
|
|
|
1539
1546
|
function useGiftCardBalance(code, options) {
|
|
1540
1547
|
const { client } = useBehio();
|
|
1541
|
-
const trimmed = _optionalChain([code, 'optionalAccess',
|
|
1548
|
+
const trimmed = _optionalChain([code, 'optionalAccess', _85 => _85.trim, 'call', _86 => _86()]);
|
|
1542
1549
|
return _reactquery.useQuery.call(void 0, {
|
|
1543
1550
|
queryKey: ["behio", "gift-card-balance", trimmed],
|
|
1544
1551
|
queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
|
|
1545
|
-
enabled: Boolean(trimmed && trimmed.length >= 6) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1552
|
+
enabled: Boolean(trimmed && trimmed.length >= 6) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _87 => _87.enabled]), () => ( true)))
|
|
1546
1553
|
});
|
|
1547
1554
|
}
|
|
1548
1555
|
|
|
@@ -1554,7 +1561,7 @@ function useWishlist(options) {
|
|
|
1554
1561
|
const query = _reactquery.useQuery.call(void 0, {
|
|
1555
1562
|
queryKey: ["behio", "wishlist"],
|
|
1556
1563
|
queryFn: () => unwrap(client.wishlist.get()),
|
|
1557
|
-
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1564
|
+
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _88 => _88.enabled]), () => ( true))
|
|
1558
1565
|
});
|
|
1559
1566
|
const addMutation = _reactquery.useMutation.call(void 0, {
|
|
1560
1567
|
mutationFn: (productId) => unwrap(client.wishlist.add(productId)),
|
|
@@ -1586,9 +1593,9 @@ function useIsInWishlist(productId) {
|
|
|
1586
1593
|
function useProductReviews(productId, options) {
|
|
1587
1594
|
const { client } = useBehio();
|
|
1588
1595
|
return _reactquery.useQuery.call(void 0, {
|
|
1589
|
-
queryKey: ["behio", "reviews", productId, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1590
|
-
queryFn: () => unwrap(client.reviews.getProductReviews(productId, _optionalChain([options, 'optionalAccess',
|
|
1591
|
-
enabled: Boolean(productId) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1596
|
+
queryKey: ["behio", "reviews", productId, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _89 => _89.page]), () => ( 1))],
|
|
1597
|
+
queryFn: () => unwrap(client.reviews.getProductReviews(productId, _optionalChain([options, 'optionalAccess', _90 => _90.page]), _optionalChain([options, 'optionalAccess', _91 => _91.limit]))),
|
|
1598
|
+
enabled: Boolean(productId) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _92 => _92.enabled]), () => ( true)))
|
|
1592
1599
|
});
|
|
1593
1600
|
}
|
|
1594
1601
|
function useSubmitReview() {
|
package/dist/react.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-ZOZAJG6T.mjs";
|
|
5
5
|
import {
|
|
6
6
|
BehioStorefront
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-OFUECU3W.mjs";
|
|
8
8
|
|
|
9
9
|
// src/react/provider.tsx
|
|
10
10
|
import { useRef, useEffect, useMemo, useState, useCallback } from "react";
|
|
@@ -1436,7 +1436,14 @@ function initTracker(client) {
|
|
|
1436
1436
|
ts: Date.now(),
|
|
1437
1437
|
...payload.value != null ? { value: payload.value } : {},
|
|
1438
1438
|
...payload.currency ? { currency: payload.currency } : {},
|
|
1439
|
-
...Array.isArray(payload.items) && payload.items.length > 0 ? {
|
|
1439
|
+
...Array.isArray(payload.items) && payload.items.length > 0 ? {
|
|
1440
|
+
props: {
|
|
1441
|
+
items: payload.items.length,
|
|
1442
|
+
// First item id = the product (view_item/add_to_cart are
|
|
1443
|
+
// single-product in practice) - Behavioral Offers count on it.
|
|
1444
|
+
itemId: payload.items[0]?.item_id
|
|
1445
|
+
}
|
|
1446
|
+
} : {}
|
|
1440
1447
|
});
|
|
1441
1448
|
};
|
|
1442
1449
|
const origPush = history.pushState.bind(history);
|