@behio/storefront-sdk 0.6.0 → 0.7.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.
@@ -487,6 +487,14 @@ var CatalogModule = class {
487
487
  );
488
488
  }
489
489
  /** Active promotions applicable to a product (with countdown end time) */
490
+ /** Back-in-stock notification subscription for a sold-out product. */
491
+ async notifyWhenAvailable(productId, email) {
492
+ return this.client.request(
493
+ "POST",
494
+ `/catalog/products/${productId}/notify-when-available`,
495
+ { body: { email } }
496
+ );
497
+ }
490
498
  async getProductPromotions(productSlug) {
491
499
  return this.client.request("GET", `/catalog/products/${productSlug}/promotions`);
492
500
  }
@@ -864,7 +872,11 @@ var ConsentModule = class {
864
872
  return this.client.request("POST", "/consent", { body: input, auth: false });
865
873
  }
866
874
  async get(visitorId) {
867
- return this.client.request("GET", `/consent/${visitorId}`, { auth: false });
875
+ const result = await this.client.request("GET", `/consent/${visitorId}`, { auth: false });
876
+ if (result.error && result.error.status === 404) {
877
+ return { data: null, error: null };
878
+ }
879
+ return result;
868
880
  }
869
881
  async revoke(visitorId) {
870
882
  return this.client.request("DELETE", `/consent/${visitorId}`, { auth: false });
@@ -880,8 +892,10 @@ var QuotesModule = class {
880
892
  async accept(quoteId, email) {
881
893
  return this.client.request("POST", `/quotes/${quoteId}/accept`, { body: { email } });
882
894
  }
883
- async getStatus(quoteId) {
884
- return this.client.request("GET", `/quotes/${quoteId}`);
895
+ /** Email is the ownership gate — quotes carry contact PII and negotiated
896
+ * prices, so the id alone is never enough. POST keeps it out of URLs. */
897
+ async getStatus(quoteId, email) {
898
+ return this.client.request("POST", `/quotes/${quoteId}/status`, { body: { email } });
885
899
  }
886
900
  };
887
901
  var AddressModule = class {
@@ -487,6 +487,14 @@ var CatalogModule = class {
487
487
  );
488
488
  }
489
489
  /** Active promotions applicable to a product (with countdown end time) */
490
+ /** Back-in-stock notification subscription for a sold-out product. */
491
+ async notifyWhenAvailable(productId, email) {
492
+ return this.client.request(
493
+ "POST",
494
+ `/catalog/products/${productId}/notify-when-available`,
495
+ { body: { email } }
496
+ );
497
+ }
490
498
  async getProductPromotions(productSlug) {
491
499
  return this.client.request("GET", `/catalog/products/${productSlug}/promotions`);
492
500
  }
@@ -864,7 +872,11 @@ var ConsentModule = class {
864
872
  return this.client.request("POST", "/consent", { body: input, auth: false });
865
873
  }
866
874
  async get(visitorId) {
867
- return this.client.request("GET", `/consent/${visitorId}`, { auth: false });
875
+ const result = await this.client.request("GET", `/consent/${visitorId}`, { auth: false });
876
+ if (result.error && result.error.status === 404) {
877
+ return { data: null, error: null };
878
+ }
879
+ return result;
868
880
  }
869
881
  async revoke(visitorId) {
870
882
  return this.client.request("DELETE", `/consent/${visitorId}`, { auth: false });
@@ -880,8 +892,10 @@ var QuotesModule = class {
880
892
  async accept(quoteId, email) {
881
893
  return this.client.request("POST", `/quotes/${quoteId}/accept`, { body: { email } });
882
894
  }
883
- async getStatus(quoteId) {
884
- return this.client.request("GET", `/quotes/${quoteId}`);
895
+ /** Email is the ownership gate — quotes carry contact PII and negotiated
896
+ * prices, so the id alone is never enough. POST keeps it out of URLs. */
897
+ async getStatus(quoteId, email) {
898
+ return this.client.request("POST", `/quotes/${quoteId}/status`, { body: { email } });
885
899
  }
886
900
  };
887
901
  var AddressModule = class {
package/dist/index.d.mts CHANGED
@@ -688,14 +688,24 @@ interface ProductReview {
688
688
  helpfulCount: number;
689
689
  unhelpfulCount: number;
690
690
  replyContent: string | null;
691
+ replyAt: number | null;
691
692
  createdAt: number;
692
693
  }
693
694
  interface ProductReviewsResponse {
694
- items: ProductReview[];
695
+ reviews: ProductReview[];
696
+ total: number;
697
+ page: number;
698
+ limit: number;
695
699
  averageRating: number;
696
700
  reviewCount: number;
697
- page: number;
698
- totalPages: number;
701
+ }
702
+ /** Returned by `catalog.notifyWhenAvailable()` — back-in-stock subscription. */
703
+ interface BackInStockSubscription {
704
+ id: string;
705
+ eshopId: string;
706
+ productId: string;
707
+ email: string;
708
+ createdAt: number;
699
709
  }
700
710
  interface SubmitReviewInput {
701
711
  productId: string;
@@ -798,13 +808,24 @@ interface CookieConsentInput {
798
808
  marketing: boolean;
799
809
  preferences: boolean;
800
810
  }
811
+ interface QuoteItem {
812
+ productId: string;
813
+ quantity: number;
814
+ requestedPrice: number | null;
815
+ quotedPrice: number | null;
816
+ }
801
817
  interface QuoteRequest {
802
818
  id: string;
819
+ /** PENDING | QUOTED | ACCEPTED | REJECTED | EXPIRED */
803
820
  status: string;
804
821
  contactName: string;
805
822
  contactEmail: string;
806
823
  companyName: string | null;
807
824
  quotedTotal: number | null;
825
+ quotedCurrency: string | null;
826
+ quotedNote: string | null;
827
+ expiresAt: number | null;
828
+ items: QuoteItem[];
808
829
  createdAt: number;
809
830
  }
810
831
  interface SubmitQuoteInput {
@@ -960,6 +981,8 @@ declare class CatalogModule {
960
981
  crossSell: CrossSellItem[];
961
982
  }>>;
962
983
  /** Active promotions applicable to a product (with countdown end time) */
984
+ /** Back-in-stock notification subscription for a sold-out product. */
985
+ notifyWhenAvailable(productId: string, email: string): Promise<SdkResult<BackInStockSubscription>>;
963
986
  getProductPromotions(productSlug: string): Promise<SdkResult<{
964
987
  items: ActivePromotion[];
965
988
  }>>;
@@ -1148,7 +1171,9 @@ declare class QuotesModule {
1148
1171
  constructor(client: BehioStorefront);
1149
1172
  submit(input: SubmitQuoteInput): Promise<SdkResult<QuoteRequest>>;
1150
1173
  accept(quoteId: string, email: string): Promise<SdkResult<QuoteRequest>>;
1151
- getStatus(quoteId: string): Promise<SdkResult<QuoteRequest>>;
1174
+ /** Email is the ownership gate — quotes carry contact PII and negotiated
1175
+ * prices, so the id alone is never enough. POST keeps it out of URLs. */
1176
+ getStatus(quoteId: string, email: string): Promise<SdkResult<QuoteRequest>>;
1152
1177
  }
1153
1178
  interface AddressSuggestion {
1154
1179
  placeId: string;
@@ -1222,4 +1247,4 @@ declare class ShippingModule {
1222
1247
  }>>;
1223
1248
  }
1224
1249
 
1225
- export { type ActivePromotion, type AddToCartInput, type AddressDetail, type AddressSuggestion, type AddressType, AddressTypes, type AuthTokens, 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 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 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 };
1250
+ 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 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
@@ -688,14 +688,24 @@ interface ProductReview {
688
688
  helpfulCount: number;
689
689
  unhelpfulCount: number;
690
690
  replyContent: string | null;
691
+ replyAt: number | null;
691
692
  createdAt: number;
692
693
  }
693
694
  interface ProductReviewsResponse {
694
- items: ProductReview[];
695
+ reviews: ProductReview[];
696
+ total: number;
697
+ page: number;
698
+ limit: number;
695
699
  averageRating: number;
696
700
  reviewCount: number;
697
- page: number;
698
- totalPages: number;
701
+ }
702
+ /** Returned by `catalog.notifyWhenAvailable()` — back-in-stock subscription. */
703
+ interface BackInStockSubscription {
704
+ id: string;
705
+ eshopId: string;
706
+ productId: string;
707
+ email: string;
708
+ createdAt: number;
699
709
  }
700
710
  interface SubmitReviewInput {
701
711
  productId: string;
@@ -798,13 +808,24 @@ interface CookieConsentInput {
798
808
  marketing: boolean;
799
809
  preferences: boolean;
800
810
  }
811
+ interface QuoteItem {
812
+ productId: string;
813
+ quantity: number;
814
+ requestedPrice: number | null;
815
+ quotedPrice: number | null;
816
+ }
801
817
  interface QuoteRequest {
802
818
  id: string;
819
+ /** PENDING | QUOTED | ACCEPTED | REJECTED | EXPIRED */
803
820
  status: string;
804
821
  contactName: string;
805
822
  contactEmail: string;
806
823
  companyName: string | null;
807
824
  quotedTotal: number | null;
825
+ quotedCurrency: string | null;
826
+ quotedNote: string | null;
827
+ expiresAt: number | null;
828
+ items: QuoteItem[];
808
829
  createdAt: number;
809
830
  }
810
831
  interface SubmitQuoteInput {
@@ -960,6 +981,8 @@ declare class CatalogModule {
960
981
  crossSell: CrossSellItem[];
961
982
  }>>;
962
983
  /** Active promotions applicable to a product (with countdown end time) */
984
+ /** Back-in-stock notification subscription for a sold-out product. */
985
+ notifyWhenAvailable(productId: string, email: string): Promise<SdkResult<BackInStockSubscription>>;
963
986
  getProductPromotions(productSlug: string): Promise<SdkResult<{
964
987
  items: ActivePromotion[];
965
988
  }>>;
@@ -1148,7 +1171,9 @@ declare class QuotesModule {
1148
1171
  constructor(client: BehioStorefront);
1149
1172
  submit(input: SubmitQuoteInput): Promise<SdkResult<QuoteRequest>>;
1150
1173
  accept(quoteId: string, email: string): Promise<SdkResult<QuoteRequest>>;
1151
- getStatus(quoteId: string): Promise<SdkResult<QuoteRequest>>;
1174
+ /** Email is the ownership gate — quotes carry contact PII and negotiated
1175
+ * prices, so the id alone is never enough. POST keeps it out of URLs. */
1176
+ getStatus(quoteId: string, email: string): Promise<SdkResult<QuoteRequest>>;
1152
1177
  }
1153
1178
  interface AddressSuggestion {
1154
1179
  placeId: string;
@@ -1222,4 +1247,4 @@ declare class ShippingModule {
1222
1247
  }>>;
1223
1248
  }
1224
1249
 
1225
- export { type ActivePromotion, type AddToCartInput, type AddressDetail, type AddressSuggestion, type AddressType, AddressTypes, type AuthTokens, 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 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 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 };
1250
+ 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 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 _chunk77TWIYZEjs = require('./chunk-77TWIYZE.js');
13
+ var _chunkDMTMGPUZjs = require('./chunk-DMTMGPUZ.js');
14
14
 
15
15
 
16
16
 
@@ -23,4 +23,4 @@ var _chunk77TWIYZEjs = require('./chunk-77TWIYZE.js');
23
23
 
24
24
 
25
25
 
26
- exports.AddressTypes = _chunk77TWIYZEjs.AddressTypes; exports.BehioApiError = _chunk77TWIYZEjs.BehioApiError; exports.BehioNetworkError = _chunk77TWIYZEjs.BehioNetworkError; exports.BehioStorefront = _chunk77TWIYZEjs.BehioStorefront; exports.FulfillmentStatuses = _chunk77TWIYZEjs.FulfillmentStatuses; exports.OrderStatuses = _chunk77TWIYZEjs.OrderStatuses; exports.PaymentStatuses = _chunk77TWIYZEjs.PaymentStatuses; exports.ProductSort = _chunk77TWIYZEjs.ProductSort; exports.err = _chunk77TWIYZEjs.err; exports.ok = _chunk77TWIYZEjs.ok; exports.toSdkError = _chunk77TWIYZEjs.toSdkError;
26
+ exports.AddressTypes = _chunkDMTMGPUZjs.AddressTypes; exports.BehioApiError = _chunkDMTMGPUZjs.BehioApiError; exports.BehioNetworkError = _chunkDMTMGPUZjs.BehioNetworkError; exports.BehioStorefront = _chunkDMTMGPUZjs.BehioStorefront; exports.FulfillmentStatuses = _chunkDMTMGPUZjs.FulfillmentStatuses; exports.OrderStatuses = _chunkDMTMGPUZjs.OrderStatuses; exports.PaymentStatuses = _chunkDMTMGPUZjs.PaymentStatuses; exports.ProductSort = _chunkDMTMGPUZjs.ProductSort; exports.err = _chunkDMTMGPUZjs.err; exports.ok = _chunkDMTMGPUZjs.ok; exports.toSdkError = _chunkDMTMGPUZjs.toSdkError;
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  err,
11
11
  ok,
12
12
  toSdkError
13
- } from "./chunk-COWHUXHJ.mjs";
13
+ } from "./chunk-EZEZUV2B.mjs";
14
14
  export {
15
15
  AddressTypes,
16
16
  BehioApiError,
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 _chunk77TWIYZEjs = require('./chunk-77TWIYZE.js');
3
+ var _chunkDMTMGPUZjs = require('./chunk-DMTMGPUZ.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, _chunk77TWIYZEjs.BehioStorefront)({
20
+ const client = new (0, _chunkDMTMGPUZjs.BehioStorefront)({
21
21
  apiKey,
22
22
  ...baseUrl ? { baseUrl } : {},
23
23
  ...locale ? { locale } : {},
package/dist/next.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BehioStorefront
3
- } from "./chunk-COWHUXHJ.mjs";
3
+ } from "./chunk-EZEZUV2B.mjs";
4
4
 
5
5
  // src/next.ts
6
6
  import { cookies } from "next/headers";
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 } from './index.mjs';
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';
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
 
@@ -836,7 +836,13 @@ declare function useCookieConsent(visitorId: string | undefined): {
836
836
  };
837
837
 
838
838
  declare function useSubmitQuote(): _tanstack_react_query.UseMutationResult<QuoteRequest, Error, SubmitQuoteInput, unknown>;
839
- declare function useQuoteStatus(quoteId: string | undefined): _tanstack_react_query.UseQueryResult<QuoteRequest, Error>;
839
+ declare function useQuoteStatus(quoteId: string | undefined, email: string | undefined): _tanstack_react_query.UseQueryResult<QuoteRequest, Error>;
840
+
841
+ /** Subscribe an email to a back-in-stock notification for a product. */
842
+ declare function useNotifyWhenAvailable(): _tanstack_react_query.UseMutationResult<BackInStockSubscription, Error, {
843
+ productId: string;
844
+ email: string;
845
+ }, unknown>;
840
846
 
841
847
  /**
842
848
  * Returns the raw BehioStorefront client instance.
@@ -856,4 +862,4 @@ declare function useBehioClient(): BehioStorefront;
856
862
  */
857
863
  declare function formatPrice(amount: number, currency: string, locale?: string): string;
858
864
 
859
- 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, useOrder, useOrders, usePage, usePages, useProduct, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
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 };
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 } from './index.js';
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';
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
 
@@ -836,7 +836,13 @@ declare function useCookieConsent(visitorId: string | undefined): {
836
836
  };
837
837
 
838
838
  declare function useSubmitQuote(): _tanstack_react_query.UseMutationResult<QuoteRequest, Error, SubmitQuoteInput, unknown>;
839
- declare function useQuoteStatus(quoteId: string | undefined): _tanstack_react_query.UseQueryResult<QuoteRequest, Error>;
839
+ declare function useQuoteStatus(quoteId: string | undefined, email: string | undefined): _tanstack_react_query.UseQueryResult<QuoteRequest, Error>;
840
+
841
+ /** Subscribe an email to a back-in-stock notification for a product. */
842
+ declare function useNotifyWhenAvailable(): _tanstack_react_query.UseMutationResult<BackInStockSubscription, Error, {
843
+ productId: string;
844
+ email: string;
845
+ }, unknown>;
840
846
 
841
847
  /**
842
848
  * Returns the raw BehioStorefront client instance.
@@ -856,4 +862,4 @@ declare function useBehioClient(): BehioStorefront;
856
862
  */
857
863
  declare function formatPrice(amount: number, currency: string, locale?: string): string;
858
864
 
859
- 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, useOrder, useOrders, usePage, usePages, useProduct, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
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 };
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 _chunk77TWIYZEjs = require('./chunk-77TWIYZE.js');
3
+ var _chunkDMTMGPUZjs = require('./chunk-DMTMGPUZ.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, _chunk77TWIYZEjs.BehioStorefront)({
117
+ clientRef.current = new (0, _chunkDMTMGPUZjs.BehioStorefront)({
118
118
  apiKey,
119
119
  baseUrl,
120
120
  locale,
@@ -1132,12 +1132,21 @@ function useSubmitQuote() {
1132
1132
  mutationFn: (input) => unwrap(client.quotes.submit(input))
1133
1133
  });
1134
1134
  }
1135
- function useQuoteStatus(quoteId) {
1135
+ function useQuoteStatus(quoteId, email) {
1136
1136
  const { client } = useBehio();
1137
1137
  return _reactquery.useQuery.call(void 0, {
1138
1138
  queryKey: ["behio", "quote-status", quoteId],
1139
- queryFn: () => unwrap(client.quotes.getStatus(quoteId)),
1140
- enabled: Boolean(quoteId)
1139
+ queryFn: () => unwrap(client.quotes.getStatus(quoteId, email)),
1140
+ enabled: Boolean(quoteId && email)
1141
+ });
1142
+ }
1143
+
1144
+ // src/react/hooks/use-back-in-stock.ts
1145
+
1146
+ function useNotifyWhenAvailable() {
1147
+ const { client } = useBehio();
1148
+ return _reactquery.useMutation.call(void 0, {
1149
+ mutationFn: ({ productId, email }) => unwrap(client.catalog.notifyWhenAvailable(productId, email))
1141
1150
  });
1142
1151
  }
1143
1152
 
@@ -1206,4 +1215,5 @@ function formatPrice(amount, currency, locale) {
1206
1215
 
1207
1216
 
1208
1217
 
1209
- 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.useOrder = useOrder; 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;
1218
+
1219
+ 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.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-COWHUXHJ.mjs";
3
+ } from "./chunk-EZEZUV2B.mjs";
4
4
 
5
5
  // src/react/provider.tsx
6
6
  import { useRef, useEffect, useMemo } from "react";
@@ -1132,12 +1132,21 @@ function useSubmitQuote() {
1132
1132
  mutationFn: (input) => unwrap(client.quotes.submit(input))
1133
1133
  });
1134
1134
  }
1135
- function useQuoteStatus(quoteId) {
1135
+ function useQuoteStatus(quoteId, email) {
1136
1136
  const { client } = useBehio();
1137
1137
  return useQuery25({
1138
1138
  queryKey: ["behio", "quote-status", quoteId],
1139
- queryFn: () => unwrap(client.quotes.getStatus(quoteId)),
1140
- enabled: Boolean(quoteId)
1139
+ queryFn: () => unwrap(client.quotes.getStatus(quoteId, email)),
1140
+ enabled: Boolean(quoteId && email)
1141
+ });
1142
+ }
1143
+
1144
+ // src/react/hooks/use-back-in-stock.ts
1145
+ import { useMutation as useMutation12 } from "@tanstack/react-query";
1146
+ function useNotifyWhenAvailable() {
1147
+ const { client } = useBehio();
1148
+ return useMutation12({
1149
+ mutationFn: ({ productId, email }) => unwrap(client.catalog.notifyWhenAvailable(productId, email))
1141
1150
  });
1142
1151
  }
1143
1152
 
@@ -1189,6 +1198,7 @@ export {
1189
1198
  useIsInWishlist,
1190
1199
  useLabels,
1191
1200
  useLookupReturnableOrder,
1201
+ useNotifyWhenAvailable,
1192
1202
  useOrder,
1193
1203
  useOrders,
1194
1204
  usePage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@behio/storefront-sdk",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "TypeScript SDK for Behio Headless E-Shop — core client + React hooks",
5
5
  "author": "Behio",
6
6
  "license": "MIT",