@behio/storefront-sdk 0.5.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
  }
@@ -494,6 +502,12 @@ var CatalogModule = class {
494
502
  async checkGiftCard(code) {
495
503
  return this.client.request("GET", `/catalog/gift-cards/${encodeURIComponent(code)}/check`);
496
504
  }
505
+ /** List configured payment methods (filtered by currency). */
506
+ async listPaymentMethods(opts) {
507
+ const query = {};
508
+ if (_optionalChain([opts, 'optionalAccess', _23 => _23.currency])) query.currency = opts.currency;
509
+ return this.client.request("GET", "/catalog/payment-methods", { query });
510
+ }
497
511
  };
498
512
  var AuthModule = class {
499
513
  constructor(client) {
@@ -732,7 +746,7 @@ var OrdersModule = class {
732
746
  /** List customer orders (requires auth) */
733
747
  async list(options) {
734
748
  return this.client.request("GET", "/orders", {
735
- query: { page: _optionalChain([options, 'optionalAccess', _23 => _23.page]), limit: _optionalChain([options, 'optionalAccess', _24 => _24.limit]) }
749
+ query: { page: _optionalChain([options, 'optionalAccess', _24 => _24.page]), limit: _optionalChain([options, 'optionalAccess', _25 => _25.limit]) }
736
750
  });
737
751
  }
738
752
  /** Get order detail (requires auth) */
@@ -833,6 +847,16 @@ var ReturnsModule = class {
833
847
  constructor(client) {
834
848
  this.client = client;
835
849
  }
850
+ /**
851
+ * Guest order lookup for the EU withdrawal form: order number + the email
852
+ * used on the order resolve to the order id and per-item returnable
853
+ * quantities. POST so the email never appears in a URL.
854
+ */
855
+ async lookupOrder(orderNumber, email) {
856
+ return this.client.request("POST", "/returns/lookup-order", {
857
+ body: { orderNumber, email }
858
+ });
859
+ }
836
860
  async submit(input) {
837
861
  return this.client.request("POST", "/returns", { body: input });
838
862
  }
@@ -848,7 +872,11 @@ var ConsentModule = class {
848
872
  return this.client.request("POST", "/consent", { body: input, auth: false });
849
873
  }
850
874
  async get(visitorId) {
851
- 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;
852
880
  }
853
881
  async revoke(visitorId) {
854
882
  return this.client.request("DELETE", `/consent/${visitorId}`, { auth: false });
@@ -864,8 +892,10 @@ var QuotesModule = class {
864
892
  async accept(quoteId, email) {
865
893
  return this.client.request("POST", `/quotes/${quoteId}/accept`, { body: { email } });
866
894
  }
867
- async getStatus(quoteId) {
868
- 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 } });
869
899
  }
870
900
  };
871
901
  var AddressModule = class {
@@ -898,10 +928,10 @@ var ShippingModule = class {
898
928
  */
899
929
  async listMethods(opts) {
900
930
  const query = {};
901
- if (_optionalChain([opts, 'optionalAccess', _25 => _25.currency])) query.currency = opts.currency;
902
- if (_optionalChain([opts, 'optionalAccess', _26 => _26.country])) query.country = opts.country;
903
- if (_optionalChain([opts, 'optionalAccess', _27 => _27.cartTotal]) != null) query.cartTotal = String(opts.cartTotal);
904
- if (_optionalChain([opts, 'optionalAccess', _28 => _28.cartWeightKg]) != null) query.cartWeightKg = String(opts.cartWeightKg);
931
+ if (_optionalChain([opts, 'optionalAccess', _26 => _26.currency])) query.currency = opts.currency;
932
+ if (_optionalChain([opts, 'optionalAccess', _27 => _27.country])) query.country = opts.country;
933
+ if (_optionalChain([opts, 'optionalAccess', _28 => _28.cartTotal]) != null) query.cartTotal = String(opts.cartTotal);
934
+ if (_optionalChain([opts, 'optionalAccess', _29 => _29.cartWeightKg]) != null) query.cartWeightKg = String(opts.cartWeightKg);
905
935
  return this.client.request(
906
936
  "GET",
907
937
  "/catalog/shipping-methods",
@@ -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
  }
@@ -494,6 +502,12 @@ var CatalogModule = class {
494
502
  async checkGiftCard(code) {
495
503
  return this.client.request("GET", `/catalog/gift-cards/${encodeURIComponent(code)}/check`);
496
504
  }
505
+ /** List configured payment methods (filtered by currency). */
506
+ async listPaymentMethods(opts) {
507
+ const query = {};
508
+ if (opts?.currency) query.currency = opts.currency;
509
+ return this.client.request("GET", "/catalog/payment-methods", { query });
510
+ }
497
511
  };
498
512
  var AuthModule = class {
499
513
  constructor(client) {
@@ -833,6 +847,16 @@ var ReturnsModule = class {
833
847
  constructor(client) {
834
848
  this.client = client;
835
849
  }
850
+ /**
851
+ * Guest order lookup for the EU withdrawal form: order number + the email
852
+ * used on the order resolve to the order id and per-item returnable
853
+ * quantities. POST so the email never appears in a URL.
854
+ */
855
+ async lookupOrder(orderNumber, email) {
856
+ return this.client.request("POST", "/returns/lookup-order", {
857
+ body: { orderNumber, email }
858
+ });
859
+ }
836
860
  async submit(input) {
837
861
  return this.client.request("POST", "/returns", { body: input });
838
862
  }
@@ -848,7 +872,11 @@ var ConsentModule = class {
848
872
  return this.client.request("POST", "/consent", { body: input, auth: false });
849
873
  }
850
874
  async get(visitorId) {
851
- 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;
852
880
  }
853
881
  async revoke(visitorId) {
854
882
  return this.client.request("DELETE", `/consent/${visitorId}`, { auth: false });
@@ -864,8 +892,10 @@ var QuotesModule = class {
864
892
  async accept(quoteId, email) {
865
893
  return this.client.request("POST", `/quotes/${quoteId}/accept`, { body: { email } });
866
894
  }
867
- async getStatus(quoteId) {
868
- 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 } });
869
899
  }
870
900
  };
871
901
  var AddressModule = class {
package/dist/index.d.mts CHANGED
@@ -140,13 +140,40 @@ interface ProductListItem {
140
140
  labels: ProductLabel[];
141
141
  isFeatured: boolean;
142
142
  }
143
+ /** A single responsive derivative (size + format) of a media image. */
144
+ interface ProductMediaVariant {
145
+ variant: 'thumb' | 'medium' | 'large' | 'xlarge';
146
+ format: 'jpeg' | 'webp' | 'avif';
147
+ url: string;
148
+ width: number;
149
+ height: number;
150
+ }
151
+ /**
152
+ * A product gallery entry (image or video), sourced from the inventory item
153
+ * so it is shared across every storefront listing the product. Images carry
154
+ * responsive `variants` (webp/avif/jpeg in three sizes) for fast LCP; pick
155
+ * the smallest format the client supports.
156
+ */
157
+ interface ProductMedia {
158
+ id: string;
159
+ type: 'IMAGE' | 'VIDEO';
160
+ /** Original uploaded file URL. */
161
+ url: string;
162
+ alt?: string | null;
163
+ isCover: boolean;
164
+ order: number;
165
+ variants: ProductMediaVariant[];
166
+ }
143
167
  interface ProductDetail extends ProductListItem {
144
168
  longDescription?: string;
169
+ /** @deprecated Legacy per-listing images. Prefer `media`. */
145
170
  images: Array<{
146
171
  url: string;
147
172
  alt?: string;
148
173
  order: number;
149
174
  }>;
175
+ /** Product gallery (images + videos) with responsive derivatives. */
176
+ media: ProductMedia[];
150
177
  categories: Array<{
151
178
  id: string;
152
179
  slug: string;
@@ -328,6 +355,20 @@ interface CheckoutInput {
328
355
  email: string;
329
356
  phone?: string;
330
357
  customerNote?: string;
358
+ /**
359
+ * Chosen shipping method. Required whenever the eshop has at least one
360
+ * enabled shipping method — the backend rejects the order without it.
361
+ * Prefer also sending `shippingQuoteId` from `shipping.quote()`; with only
362
+ * the method id the backend re-quotes the cart server-side.
363
+ */
364
+ shippingMethodId?: string;
365
+ /**
366
+ * Quote id from `shipping.quote()` — pins the exact server-computed price
367
+ * the customer saw. Expired quotes are re-quoted automatically; a consumed
368
+ * or foreign quote is rejected.
369
+ */
370
+ shippingQuoteId?: string;
371
+ paymentMethodId?: string;
331
372
  }
332
373
  type OrderStatus = (typeof OrderStatuses)[keyof typeof OrderStatuses];
333
374
  type PaymentStatus = (typeof PaymentStatuses)[keyof typeof PaymentStatuses];
@@ -372,6 +413,13 @@ interface OrderDetail extends OrderListItem {
372
413
  fulfillmentStatus: FulfillmentStatus;
373
414
  statusHistory: OrderStatusHistory[];
374
415
  trackingToken?: string;
416
+ /**
417
+ * For redirect payment gateways (GoPay, ...), the hosted URL the
418
+ * storefront must send the customer to in order to pay. Present only on
419
+ * the order returned by `checkout.createOrder()`. Null/absent for
420
+ * offline methods (bank transfer, COD) and zero-total orders.
421
+ */
422
+ paymentRedirectUrl?: string | null;
375
423
  }
376
424
  interface CustomerProfile {
377
425
  id: string;
@@ -532,11 +580,13 @@ interface ShippingMethodSummary {
532
580
  description: string | null;
533
581
  /** Internal routing id ("zaslat", "ppl_direct", "manual", …). Not for display. */
534
582
  provider: string;
583
+ /** "fixed" = price known upfront; "live_quote" = must call shipping.quote() with address. */
584
+ priceStrategy: "fixed" | "live_quote";
535
585
  currency: string | null;
536
- /** Final customer-facing price. Equals `basePrice` unless free-shipping kicks in. */
537
- price: number;
538
- /** Per-currency base price from the merchant's config. */
539
- basePrice: number;
586
+ /** Final customer-facing price. Null for live_quote methods (call quote() to resolve). */
587
+ price: number | null;
588
+ /** Per-currency base price from the merchant's config. Null for live_quote. */
589
+ basePrice: number | null;
540
590
  isFreeShipping: boolean;
541
591
  freeShippingThreshold: number | null;
542
592
  /** "address" | "pickup_point" | "in_store" | "digital". */
@@ -583,6 +633,10 @@ interface ShippingQuote extends ShippingMethodSummary {
583
633
  strategy: "fixed" | "live_quote";
584
634
  available: boolean;
585
635
  reason: string | null;
636
+ /** Server-generated quote ID. Null for fixed-price methods. Pass to checkout for tamper-proof pricing. */
637
+ quoteId: string | null;
638
+ /** Quote expiry (epoch ms). Null for fixed-price methods. */
639
+ expiresAt: number | null;
586
640
  }
587
641
  interface CrossSellItem {
588
642
  productId: string;
@@ -634,14 +688,24 @@ interface ProductReview {
634
688
  helpfulCount: number;
635
689
  unhelpfulCount: number;
636
690
  replyContent: string | null;
691
+ replyAt: number | null;
637
692
  createdAt: number;
638
693
  }
639
694
  interface ProductReviewsResponse {
640
- items: ProductReview[];
695
+ reviews: ProductReview[];
696
+ total: number;
697
+ page: number;
698
+ limit: number;
641
699
  averageRating: number;
642
700
  reviewCount: number;
643
- page: number;
644
- 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;
645
709
  }
646
710
  interface SubmitReviewInput {
647
711
  productId: string;
@@ -652,18 +716,75 @@ interface SubmitReviewInput {
652
716
  authorEmail?: string;
653
717
  imageUrls?: string[];
654
718
  }
719
+ interface ReturnableOrderItem {
720
+ orderItemId: string;
721
+ productName: string;
722
+ /** Quantity ordered */
723
+ quantity: number;
724
+ /** Units still returnable (ordered minus active return claims) */
725
+ returnableQuantity: number;
726
+ }
727
+ /**
728
+ * Result of the guest order lookup used by the EU withdrawal form:
729
+ * the customer enters their order number + email and gets back the
730
+ * internal ids needed to submit a return. No account required.
731
+ */
732
+ interface ReturnableOrder {
733
+ orderId: string;
734
+ orderNumber: string;
735
+ status: string;
736
+ items: ReturnableOrderItem[];
737
+ createdAt: number;
738
+ }
739
+ interface ReturnRequestItem {
740
+ id: string;
741
+ orderItemId: string;
742
+ productName: string;
743
+ quantity: number;
744
+ reason: string | null;
745
+ imageUrls: string[];
746
+ }
747
+ /** Returned by `returns.submit()` — the acknowledged withdrawal request. */
655
748
  interface ReturnRequest {
656
749
  id: string;
750
+ eshopId: string;
657
751
  orderId: string;
752
+ /** REQUESTED | APPROVED | SHIPPED_BACK | RECEIVED | REFUNDED | REJECTED | CLOSED */
753
+ status: string;
754
+ reason: string;
755
+ customerNote: string | null;
756
+ items: ReturnRequestItem[];
757
+ createdAt: number;
758
+ }
759
+ interface ReturnStatusItem {
760
+ id: string;
761
+ productName: string;
762
+ quantity: number;
763
+ reason: string | null;
764
+ }
765
+ /** Returned by `returns.getStatus()` — the full public view of a return. */
766
+ interface ReturnStatus {
767
+ id: string;
768
+ orderNumber: string;
769
+ /** REQUESTED | APPROVED | SHIPPED_BACK | RECEIVED | REFUNDED | REJECTED | CLOSED */
658
770
  status: string;
659
771
  reason: string;
660
772
  customerNote: string | null;
661
- refundAmount: number | null;
662
773
  refundMethod: string | null;
774
+ refundAmount: number | null;
775
+ refundedAt: number | null;
776
+ returnTrackingNumber: string | null;
777
+ items: ReturnStatusItem[];
663
778
  createdAt: number;
779
+ updatedAt: number;
664
780
  }
665
781
  interface SubmitReturnInput {
666
782
  orderId: string;
783
+ /**
784
+ * Email used on the order. Required — it is the ownership gate for guest
785
+ * withdrawals; the backend rejects submissions whose email doesn't match.
786
+ */
787
+ email: string;
667
788
  reason: string;
668
789
  customerNote?: string;
669
790
  items: {
@@ -687,13 +808,24 @@ interface CookieConsentInput {
687
808
  marketing: boolean;
688
809
  preferences: boolean;
689
810
  }
811
+ interface QuoteItem {
812
+ productId: string;
813
+ quantity: number;
814
+ requestedPrice: number | null;
815
+ quotedPrice: number | null;
816
+ }
690
817
  interface QuoteRequest {
691
818
  id: string;
819
+ /** PENDING | QUOTED | ACCEPTED | REJECTED | EXPIRED */
692
820
  status: string;
693
821
  contactName: string;
694
822
  contactEmail: string;
695
823
  companyName: string | null;
696
824
  quotedTotal: number | null;
825
+ quotedCurrency: string | null;
826
+ quotedNote: string | null;
827
+ expiresAt: number | null;
828
+ items: QuoteItem[];
697
829
  createdAt: number;
698
830
  }
699
831
  interface SubmitQuoteInput {
@@ -849,11 +981,19 @@ declare class CatalogModule {
849
981
  crossSell: CrossSellItem[];
850
982
  }>>;
851
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>>;
852
986
  getProductPromotions(productSlug: string): Promise<SdkResult<{
853
987
  items: ActivePromotion[];
854
988
  }>>;
855
989
  /** Check a gift card code — returns validity and remaining balance */
856
990
  checkGiftCard(code: string): Promise<SdkResult<GiftCardBalance>>;
991
+ /** List configured payment methods (filtered by currency). */
992
+ listPaymentMethods(opts?: {
993
+ currency?: string;
994
+ }): Promise<SdkResult<{
995
+ items: CheckoutPaymentMethod[];
996
+ }>>;
857
997
  }
858
998
  declare class AuthModule {
859
999
  private client;
@@ -1008,8 +1148,14 @@ declare class ReviewsModule {
1008
1148
  declare class ReturnsModule {
1009
1149
  private client;
1010
1150
  constructor(client: BehioStorefront);
1151
+ /**
1152
+ * Guest order lookup for the EU withdrawal form: order number + the email
1153
+ * used on the order resolve to the order id and per-item returnable
1154
+ * quantities. POST so the email never appears in a URL.
1155
+ */
1156
+ lookupOrder(orderNumber: string, email: string): Promise<SdkResult<ReturnableOrder>>;
1011
1157
  submit(input: SubmitReturnInput): Promise<SdkResult<ReturnRequest>>;
1012
- getStatus(returnId: string, email: string): Promise<SdkResult<ReturnRequest>>;
1158
+ getStatus(returnId: string, email: string): Promise<SdkResult<ReturnStatus>>;
1013
1159
  }
1014
1160
  declare class ConsentModule {
1015
1161
  private client;
@@ -1025,7 +1171,9 @@ declare class QuotesModule {
1025
1171
  constructor(client: BehioStorefront);
1026
1172
  submit(input: SubmitQuoteInput): Promise<SdkResult<QuoteRequest>>;
1027
1173
  accept(quoteId: string, email: string): Promise<SdkResult<QuoteRequest>>;
1028
- 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>>;
1029
1177
  }
1030
1178
  interface AddressSuggestion {
1031
1179
  placeId: string;
@@ -1099,4 +1247,4 @@ declare class ShippingModule {
1099
1247
  }>>;
1100
1248
  }
1101
1249
 
1102
- 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 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 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
@@ -140,13 +140,40 @@ interface ProductListItem {
140
140
  labels: ProductLabel[];
141
141
  isFeatured: boolean;
142
142
  }
143
+ /** A single responsive derivative (size + format) of a media image. */
144
+ interface ProductMediaVariant {
145
+ variant: 'thumb' | 'medium' | 'large' | 'xlarge';
146
+ format: 'jpeg' | 'webp' | 'avif';
147
+ url: string;
148
+ width: number;
149
+ height: number;
150
+ }
151
+ /**
152
+ * A product gallery entry (image or video), sourced from the inventory item
153
+ * so it is shared across every storefront listing the product. Images carry
154
+ * responsive `variants` (webp/avif/jpeg in three sizes) for fast LCP; pick
155
+ * the smallest format the client supports.
156
+ */
157
+ interface ProductMedia {
158
+ id: string;
159
+ type: 'IMAGE' | 'VIDEO';
160
+ /** Original uploaded file URL. */
161
+ url: string;
162
+ alt?: string | null;
163
+ isCover: boolean;
164
+ order: number;
165
+ variants: ProductMediaVariant[];
166
+ }
143
167
  interface ProductDetail extends ProductListItem {
144
168
  longDescription?: string;
169
+ /** @deprecated Legacy per-listing images. Prefer `media`. */
145
170
  images: Array<{
146
171
  url: string;
147
172
  alt?: string;
148
173
  order: number;
149
174
  }>;
175
+ /** Product gallery (images + videos) with responsive derivatives. */
176
+ media: ProductMedia[];
150
177
  categories: Array<{
151
178
  id: string;
152
179
  slug: string;
@@ -328,6 +355,20 @@ interface CheckoutInput {
328
355
  email: string;
329
356
  phone?: string;
330
357
  customerNote?: string;
358
+ /**
359
+ * Chosen shipping method. Required whenever the eshop has at least one
360
+ * enabled shipping method — the backend rejects the order without it.
361
+ * Prefer also sending `shippingQuoteId` from `shipping.quote()`; with only
362
+ * the method id the backend re-quotes the cart server-side.
363
+ */
364
+ shippingMethodId?: string;
365
+ /**
366
+ * Quote id from `shipping.quote()` — pins the exact server-computed price
367
+ * the customer saw. Expired quotes are re-quoted automatically; a consumed
368
+ * or foreign quote is rejected.
369
+ */
370
+ shippingQuoteId?: string;
371
+ paymentMethodId?: string;
331
372
  }
332
373
  type OrderStatus = (typeof OrderStatuses)[keyof typeof OrderStatuses];
333
374
  type PaymentStatus = (typeof PaymentStatuses)[keyof typeof PaymentStatuses];
@@ -372,6 +413,13 @@ interface OrderDetail extends OrderListItem {
372
413
  fulfillmentStatus: FulfillmentStatus;
373
414
  statusHistory: OrderStatusHistory[];
374
415
  trackingToken?: string;
416
+ /**
417
+ * For redirect payment gateways (GoPay, ...), the hosted URL the
418
+ * storefront must send the customer to in order to pay. Present only on
419
+ * the order returned by `checkout.createOrder()`. Null/absent for
420
+ * offline methods (bank transfer, COD) and zero-total orders.
421
+ */
422
+ paymentRedirectUrl?: string | null;
375
423
  }
376
424
  interface CustomerProfile {
377
425
  id: string;
@@ -532,11 +580,13 @@ interface ShippingMethodSummary {
532
580
  description: string | null;
533
581
  /** Internal routing id ("zaslat", "ppl_direct", "manual", …). Not for display. */
534
582
  provider: string;
583
+ /** "fixed" = price known upfront; "live_quote" = must call shipping.quote() with address. */
584
+ priceStrategy: "fixed" | "live_quote";
535
585
  currency: string | null;
536
- /** Final customer-facing price. Equals `basePrice` unless free-shipping kicks in. */
537
- price: number;
538
- /** Per-currency base price from the merchant's config. */
539
- basePrice: number;
586
+ /** Final customer-facing price. Null for live_quote methods (call quote() to resolve). */
587
+ price: number | null;
588
+ /** Per-currency base price from the merchant's config. Null for live_quote. */
589
+ basePrice: number | null;
540
590
  isFreeShipping: boolean;
541
591
  freeShippingThreshold: number | null;
542
592
  /** "address" | "pickup_point" | "in_store" | "digital". */
@@ -583,6 +633,10 @@ interface ShippingQuote extends ShippingMethodSummary {
583
633
  strategy: "fixed" | "live_quote";
584
634
  available: boolean;
585
635
  reason: string | null;
636
+ /** Server-generated quote ID. Null for fixed-price methods. Pass to checkout for tamper-proof pricing. */
637
+ quoteId: string | null;
638
+ /** Quote expiry (epoch ms). Null for fixed-price methods. */
639
+ expiresAt: number | null;
586
640
  }
587
641
  interface CrossSellItem {
588
642
  productId: string;
@@ -634,14 +688,24 @@ interface ProductReview {
634
688
  helpfulCount: number;
635
689
  unhelpfulCount: number;
636
690
  replyContent: string | null;
691
+ replyAt: number | null;
637
692
  createdAt: number;
638
693
  }
639
694
  interface ProductReviewsResponse {
640
- items: ProductReview[];
695
+ reviews: ProductReview[];
696
+ total: number;
697
+ page: number;
698
+ limit: number;
641
699
  averageRating: number;
642
700
  reviewCount: number;
643
- page: number;
644
- 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;
645
709
  }
646
710
  interface SubmitReviewInput {
647
711
  productId: string;
@@ -652,18 +716,75 @@ interface SubmitReviewInput {
652
716
  authorEmail?: string;
653
717
  imageUrls?: string[];
654
718
  }
719
+ interface ReturnableOrderItem {
720
+ orderItemId: string;
721
+ productName: string;
722
+ /** Quantity ordered */
723
+ quantity: number;
724
+ /** Units still returnable (ordered minus active return claims) */
725
+ returnableQuantity: number;
726
+ }
727
+ /**
728
+ * Result of the guest order lookup used by the EU withdrawal form:
729
+ * the customer enters their order number + email and gets back the
730
+ * internal ids needed to submit a return. No account required.
731
+ */
732
+ interface ReturnableOrder {
733
+ orderId: string;
734
+ orderNumber: string;
735
+ status: string;
736
+ items: ReturnableOrderItem[];
737
+ createdAt: number;
738
+ }
739
+ interface ReturnRequestItem {
740
+ id: string;
741
+ orderItemId: string;
742
+ productName: string;
743
+ quantity: number;
744
+ reason: string | null;
745
+ imageUrls: string[];
746
+ }
747
+ /** Returned by `returns.submit()` — the acknowledged withdrawal request. */
655
748
  interface ReturnRequest {
656
749
  id: string;
750
+ eshopId: string;
657
751
  orderId: string;
752
+ /** REQUESTED | APPROVED | SHIPPED_BACK | RECEIVED | REFUNDED | REJECTED | CLOSED */
753
+ status: string;
754
+ reason: string;
755
+ customerNote: string | null;
756
+ items: ReturnRequestItem[];
757
+ createdAt: number;
758
+ }
759
+ interface ReturnStatusItem {
760
+ id: string;
761
+ productName: string;
762
+ quantity: number;
763
+ reason: string | null;
764
+ }
765
+ /** Returned by `returns.getStatus()` — the full public view of a return. */
766
+ interface ReturnStatus {
767
+ id: string;
768
+ orderNumber: string;
769
+ /** REQUESTED | APPROVED | SHIPPED_BACK | RECEIVED | REFUNDED | REJECTED | CLOSED */
658
770
  status: string;
659
771
  reason: string;
660
772
  customerNote: string | null;
661
- refundAmount: number | null;
662
773
  refundMethod: string | null;
774
+ refundAmount: number | null;
775
+ refundedAt: number | null;
776
+ returnTrackingNumber: string | null;
777
+ items: ReturnStatusItem[];
663
778
  createdAt: number;
779
+ updatedAt: number;
664
780
  }
665
781
  interface SubmitReturnInput {
666
782
  orderId: string;
783
+ /**
784
+ * Email used on the order. Required — it is the ownership gate for guest
785
+ * withdrawals; the backend rejects submissions whose email doesn't match.
786
+ */
787
+ email: string;
667
788
  reason: string;
668
789
  customerNote?: string;
669
790
  items: {
@@ -687,13 +808,24 @@ interface CookieConsentInput {
687
808
  marketing: boolean;
688
809
  preferences: boolean;
689
810
  }
811
+ interface QuoteItem {
812
+ productId: string;
813
+ quantity: number;
814
+ requestedPrice: number | null;
815
+ quotedPrice: number | null;
816
+ }
690
817
  interface QuoteRequest {
691
818
  id: string;
819
+ /** PENDING | QUOTED | ACCEPTED | REJECTED | EXPIRED */
692
820
  status: string;
693
821
  contactName: string;
694
822
  contactEmail: string;
695
823
  companyName: string | null;
696
824
  quotedTotal: number | null;
825
+ quotedCurrency: string | null;
826
+ quotedNote: string | null;
827
+ expiresAt: number | null;
828
+ items: QuoteItem[];
697
829
  createdAt: number;
698
830
  }
699
831
  interface SubmitQuoteInput {
@@ -849,11 +981,19 @@ declare class CatalogModule {
849
981
  crossSell: CrossSellItem[];
850
982
  }>>;
851
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>>;
852
986
  getProductPromotions(productSlug: string): Promise<SdkResult<{
853
987
  items: ActivePromotion[];
854
988
  }>>;
855
989
  /** Check a gift card code — returns validity and remaining balance */
856
990
  checkGiftCard(code: string): Promise<SdkResult<GiftCardBalance>>;
991
+ /** List configured payment methods (filtered by currency). */
992
+ listPaymentMethods(opts?: {
993
+ currency?: string;
994
+ }): Promise<SdkResult<{
995
+ items: CheckoutPaymentMethod[];
996
+ }>>;
857
997
  }
858
998
  declare class AuthModule {
859
999
  private client;
@@ -1008,8 +1148,14 @@ declare class ReviewsModule {
1008
1148
  declare class ReturnsModule {
1009
1149
  private client;
1010
1150
  constructor(client: BehioStorefront);
1151
+ /**
1152
+ * Guest order lookup for the EU withdrawal form: order number + the email
1153
+ * used on the order resolve to the order id and per-item returnable
1154
+ * quantities. POST so the email never appears in a URL.
1155
+ */
1156
+ lookupOrder(orderNumber: string, email: string): Promise<SdkResult<ReturnableOrder>>;
1011
1157
  submit(input: SubmitReturnInput): Promise<SdkResult<ReturnRequest>>;
1012
- getStatus(returnId: string, email: string): Promise<SdkResult<ReturnRequest>>;
1158
+ getStatus(returnId: string, email: string): Promise<SdkResult<ReturnStatus>>;
1013
1159
  }
1014
1160
  declare class ConsentModule {
1015
1161
  private client;
@@ -1025,7 +1171,9 @@ declare class QuotesModule {
1025
1171
  constructor(client: BehioStorefront);
1026
1172
  submit(input: SubmitQuoteInput): Promise<SdkResult<QuoteRequest>>;
1027
1173
  accept(quoteId: string, email: string): Promise<SdkResult<QuoteRequest>>;
1028
- 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>>;
1029
1177
  }
1030
1178
  interface AddressSuggestion {
1031
1179
  placeId: string;
@@ -1099,4 +1247,4 @@ declare class ShippingModule {
1099
1247
  }>>;
1100
1248
  }
1101
1249
 
1102
- 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 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 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 _chunkKRGDHGTYjs = require('./chunk-KRGDHGTY.js');
13
+ var _chunkDMTMGPUZjs = require('./chunk-DMTMGPUZ.js');
14
14
 
15
15
 
16
16
 
@@ -23,4 +23,4 @@ var _chunkKRGDHGTYjs = require('./chunk-KRGDHGTY.js');
23
23
 
24
24
 
25
25
 
26
- exports.AddressTypes = _chunkKRGDHGTYjs.AddressTypes; exports.BehioApiError = _chunkKRGDHGTYjs.BehioApiError; exports.BehioNetworkError = _chunkKRGDHGTYjs.BehioNetworkError; exports.BehioStorefront = _chunkKRGDHGTYjs.BehioStorefront; exports.FulfillmentStatuses = _chunkKRGDHGTYjs.FulfillmentStatuses; exports.OrderStatuses = _chunkKRGDHGTYjs.OrderStatuses; exports.PaymentStatuses = _chunkKRGDHGTYjs.PaymentStatuses; exports.ProductSort = _chunkKRGDHGTYjs.ProductSort; exports.err = _chunkKRGDHGTYjs.err; exports.ok = _chunkKRGDHGTYjs.ok; exports.toSdkError = _chunkKRGDHGTYjs.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-3GOQSB25.mjs";
13
+ } from "./chunk-EZEZUV2B.mjs";
14
14
  export {
15
15
  AddressTypes,
16
16
  BehioApiError,
@@ -0,0 +1,14 @@
1
+ import { BehioStorefrontConfig, BehioStorefront } from './index.mjs';
2
+
3
+ interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
4
+ /** Override the cart session cookie name (default: "behio_cart_session"). */
5
+ cartCookieName?: string;
6
+ }
7
+ /**
8
+ * Returns a per-request bound BehioStorefront instance. Reads the cart
9
+ * session cookie on entry, writes new session tokens back to the cookie
10
+ * automatically. Safe to call from any Server Component or Server Action.
11
+ */
12
+ declare function getBehio(options?: GetBehioOptions): Promise<BehioStorefront>;
13
+
14
+ export { type GetBehioOptions, getBehio };
package/dist/next.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { BehioStorefrontConfig, BehioStorefront } from './index.js';
2
+
3
+ interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
4
+ /** Override the cart session cookie name (default: "behio_cart_session"). */
5
+ cartCookieName?: string;
6
+ }
7
+ /**
8
+ * Returns a per-request bound BehioStorefront instance. Reads the cart
9
+ * session cookie on entry, writes new session tokens back to the cookie
10
+ * automatically. Safe to call from any Server Component or Server Action.
11
+ */
12
+ declare function getBehio(options?: GetBehioOptions): Promise<BehioStorefront>;
13
+
14
+ export { type GetBehioOptions, getBehio };
package/dist/next.js ADDED
@@ -0,0 +1,57 @@
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
+
3
+ var _chunkDMTMGPUZjs = require('./chunk-DMTMGPUZ.js');
4
+
5
+ // src/next.ts
6
+ var _headers = require('next/headers');
7
+ var CART_COOKIE_NAME = "behio_cart_session";
8
+ var CART_COOKIE_MAX_AGE = 60 * 60 * 24 * 30;
9
+ async function getBehio(options = {}) {
10
+ const apiKey = _nullishCoalesce(options.apiKey, () => ( process.env.BEHIO_API_KEY));
11
+ if (!apiKey) {
12
+ throw new Error(
13
+ "[@behio/storefront-sdk/next] Missing API key. Set BEHIO_API_KEY env var or pass {apiKey} to getBehio()."
14
+ );
15
+ }
16
+ const baseUrl = _nullishCoalesce(options.baseUrl, () => ( process.env.BEHIO_API_URL));
17
+ const locale = _nullishCoalesce(options.locale, () => ( process.env.BEHIO_LOCALE));
18
+ const currency = _nullishCoalesce(options.currency, () => ( process.env.BEHIO_CURRENCY));
19
+ const cookieName = _nullishCoalesce(options.cartCookieName, () => ( CART_COOKIE_NAME));
20
+ const client = new (0, _chunkDMTMGPUZjs.BehioStorefront)({
21
+ apiKey,
22
+ ...baseUrl ? { baseUrl } : {},
23
+ ...locale ? { locale } : {},
24
+ ...currency ? { currency } : {},
25
+ ...options
26
+ });
27
+ const cookieStore = await _headers.cookies.call(void 0, );
28
+ const existing = _optionalChain([cookieStore, 'access', _ => _.get, 'call', _2 => _2(cookieName), 'optionalAccess', _3 => _3.value]);
29
+ if (existing) {
30
+ client.setCartSession(existing);
31
+ }
32
+ const originalSet = client.setCartSession.bind(client);
33
+ const originalClear = client.clearCartSession.bind(client);
34
+ client.setCartSession = (token) => {
35
+ originalSet(token);
36
+ try {
37
+ cookieStore.set(cookieName, token, {
38
+ httpOnly: true,
39
+ sameSite: "lax",
40
+ path: "/",
41
+ maxAge: CART_COOKIE_MAX_AGE
42
+ });
43
+ } catch (e) {
44
+ }
45
+ };
46
+ client.clearCartSession = () => {
47
+ originalClear();
48
+ try {
49
+ cookieStore.delete(cookieName);
50
+ } catch (e2) {
51
+ }
52
+ };
53
+ return client;
54
+ }
55
+
56
+
57
+ exports.getBehio = getBehio;
package/dist/next.mjs ADDED
@@ -0,0 +1,57 @@
1
+ import {
2
+ BehioStorefront
3
+ } from "./chunk-EZEZUV2B.mjs";
4
+
5
+ // src/next.ts
6
+ import { cookies } from "next/headers";
7
+ var CART_COOKIE_NAME = "behio_cart_session";
8
+ var CART_COOKIE_MAX_AGE = 60 * 60 * 24 * 30;
9
+ async function getBehio(options = {}) {
10
+ const apiKey = options.apiKey ?? process.env.BEHIO_API_KEY;
11
+ if (!apiKey) {
12
+ throw new Error(
13
+ "[@behio/storefront-sdk/next] Missing API key. Set BEHIO_API_KEY env var or pass {apiKey} to getBehio()."
14
+ );
15
+ }
16
+ const baseUrl = options.baseUrl ?? process.env.BEHIO_API_URL;
17
+ const locale = options.locale ?? process.env.BEHIO_LOCALE;
18
+ const currency = options.currency ?? process.env.BEHIO_CURRENCY;
19
+ const cookieName = options.cartCookieName ?? CART_COOKIE_NAME;
20
+ const client = new BehioStorefront({
21
+ apiKey,
22
+ ...baseUrl ? { baseUrl } : {},
23
+ ...locale ? { locale } : {},
24
+ ...currency ? { currency } : {},
25
+ ...options
26
+ });
27
+ const cookieStore = await cookies();
28
+ const existing = cookieStore.get(cookieName)?.value;
29
+ if (existing) {
30
+ client.setCartSession(existing);
31
+ }
32
+ const originalSet = client.setCartSession.bind(client);
33
+ const originalClear = client.clearCartSession.bind(client);
34
+ client.setCartSession = (token) => {
35
+ originalSet(token);
36
+ try {
37
+ cookieStore.set(cookieName, token, {
38
+ httpOnly: true,
39
+ sameSite: "lax",
40
+ path: "/",
41
+ maxAge: CART_COOKIE_MAX_AGE
42
+ });
43
+ } catch {
44
+ }
45
+ };
46
+ client.clearCartSession = () => {
47
+ originalClear();
48
+ try {
49
+ cookieStore.delete(cookieName);
50
+ } catch {
51
+ }
52
+ };
53
+ return client;
54
+ }
55
+ export {
56
+ getBehio
57
+ };
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, 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
 
@@ -639,8 +639,13 @@ declare function useSubmitReview(): _tanstack_react_query.UseMutationResult<{
639
639
  id: string;
640
640
  }, Error, SubmitReviewInput, unknown>;
641
641
 
642
+ /** Guest order lookup for the EU withdrawal form (order number + order email). */
643
+ declare function useLookupReturnableOrder(): _tanstack_react_query.UseMutationResult<ReturnableOrder, Error, {
644
+ orderNumber: string;
645
+ email: string;
646
+ }, unknown>;
642
647
  declare function useSubmitReturn(): _tanstack_react_query.UseMutationResult<ReturnRequest, Error, SubmitReturnInput, unknown>;
643
- declare function useReturnStatus(returnId: string | undefined, email: string | undefined): _tanstack_react_query.UseQueryResult<ReturnRequest, Error>;
648
+ declare function useReturnStatus(returnId: string | undefined, email: string | undefined): _tanstack_react_query.UseQueryResult<ReturnStatus, Error>;
644
649
 
645
650
  declare function useCookieConsent(visitorId: string | undefined): {
646
651
  record: _tanstack_react_query.UseMutateAsyncFunction<CookieConsent, Error, CookieConsentInput, unknown>;
@@ -831,7 +836,13 @@ declare function useCookieConsent(visitorId: string | undefined): {
831
836
  };
832
837
 
833
838
  declare function useSubmitQuote(): _tanstack_react_query.UseMutationResult<QuoteRequest, Error, SubmitQuoteInput, unknown>;
834
- 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>;
835
846
 
836
847
  /**
837
848
  * Returns the raw BehioStorefront client instance.
@@ -851,4 +862,4 @@ declare function useBehioClient(): BehioStorefront;
851
862
  */
852
863
  declare function formatPrice(amount: number, currency: string, locale?: string): string;
853
864
 
854
- 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, 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, 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
 
@@ -639,8 +639,13 @@ declare function useSubmitReview(): _tanstack_react_query.UseMutationResult<{
639
639
  id: string;
640
640
  }, Error, SubmitReviewInput, unknown>;
641
641
 
642
+ /** Guest order lookup for the EU withdrawal form (order number + order email). */
643
+ declare function useLookupReturnableOrder(): _tanstack_react_query.UseMutationResult<ReturnableOrder, Error, {
644
+ orderNumber: string;
645
+ email: string;
646
+ }, unknown>;
642
647
  declare function useSubmitReturn(): _tanstack_react_query.UseMutationResult<ReturnRequest, Error, SubmitReturnInput, unknown>;
643
- declare function useReturnStatus(returnId: string | undefined, email: string | undefined): _tanstack_react_query.UseQueryResult<ReturnRequest, Error>;
648
+ declare function useReturnStatus(returnId: string | undefined, email: string | undefined): _tanstack_react_query.UseQueryResult<ReturnStatus, Error>;
644
649
 
645
650
  declare function useCookieConsent(visitorId: string | undefined): {
646
651
  record: _tanstack_react_query.UseMutateAsyncFunction<CookieConsent, Error, CookieConsentInput, unknown>;
@@ -831,7 +836,13 @@ declare function useCookieConsent(visitorId: string | undefined): {
831
836
  };
832
837
 
833
838
  declare function useSubmitQuote(): _tanstack_react_query.UseMutationResult<QuoteRequest, Error, SubmitQuoteInput, unknown>;
834
- 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>;
835
846
 
836
847
  /**
837
848
  * Returns the raw BehioStorefront client instance.
@@ -851,4 +862,4 @@ declare function useBehioClient(): BehioStorefront;
851
862
  */
852
863
  declare function formatPrice(amount: number, currency: string, locale?: string): string;
853
864
 
854
- 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, 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 _chunkKRGDHGTYjs = require('./chunk-KRGDHGTY.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, _chunkKRGDHGTYjs.BehioStorefront)({
117
+ clientRef.current = new (0, _chunkDMTMGPUZjs.BehioStorefront)({
118
118
  apiKey,
119
119
  baseUrl,
120
120
  locale,
@@ -1078,6 +1078,12 @@ function useSubmitReview() {
1078
1078
 
1079
1079
  // src/react/hooks/use-returns.ts
1080
1080
 
1081
+ function useLookupReturnableOrder() {
1082
+ const { client } = useBehio();
1083
+ return _reactquery.useMutation.call(void 0, {
1084
+ mutationFn: ({ orderNumber, email }) => unwrap(client.returns.lookupOrder(orderNumber, email))
1085
+ });
1086
+ }
1081
1087
  function useSubmitReturn() {
1082
1088
  const { client } = useBehio();
1083
1089
  return _reactquery.useMutation.call(void 0, {
@@ -1126,12 +1132,21 @@ function useSubmitQuote() {
1126
1132
  mutationFn: (input) => unwrap(client.quotes.submit(input))
1127
1133
  });
1128
1134
  }
1129
- function useQuoteStatus(quoteId) {
1135
+ function useQuoteStatus(quoteId, email) {
1130
1136
  const { client } = useBehio();
1131
1137
  return _reactquery.useQuery.call(void 0, {
1132
1138
  queryKey: ["behio", "quote-status", quoteId],
1133
- queryFn: () => unwrap(client.quotes.getStatus(quoteId)),
1134
- 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))
1135
1150
  });
1136
1151
  }
1137
1152
 
@@ -1199,4 +1214,6 @@ function formatPrice(amount, currency, locale) {
1199
1214
 
1200
1215
 
1201
1216
 
1202
- 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.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;
1217
+
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-3GOQSB25.mjs";
3
+ } from "./chunk-EZEZUV2B.mjs";
4
4
 
5
5
  // src/react/provider.tsx
6
6
  import { useRef, useEffect, useMemo } from "react";
@@ -1078,6 +1078,12 @@ function useSubmitReview() {
1078
1078
 
1079
1079
  // src/react/hooks/use-returns.ts
1080
1080
  import { useQuery as useQuery23, useMutation as useMutation9 } from "@tanstack/react-query";
1081
+ function useLookupReturnableOrder() {
1082
+ const { client } = useBehio();
1083
+ return useMutation9({
1084
+ mutationFn: ({ orderNumber, email }) => unwrap(client.returns.lookupOrder(orderNumber, email))
1085
+ });
1086
+ }
1081
1087
  function useSubmitReturn() {
1082
1088
  const { client } = useBehio();
1083
1089
  return useMutation9({
@@ -1126,12 +1132,21 @@ function useSubmitQuote() {
1126
1132
  mutationFn: (input) => unwrap(client.quotes.submit(input))
1127
1133
  });
1128
1134
  }
1129
- function useQuoteStatus(quoteId) {
1135
+ function useQuoteStatus(quoteId, email) {
1130
1136
  const { client } = useBehio();
1131
1137
  return useQuery25({
1132
1138
  queryKey: ["behio", "quote-status", quoteId],
1133
- queryFn: () => unwrap(client.quotes.getStatus(quoteId)),
1134
- 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))
1135
1150
  });
1136
1151
  }
1137
1152
 
@@ -1182,6 +1197,8 @@ export {
1182
1197
  useGiftCardBalance,
1183
1198
  useIsInWishlist,
1184
1199
  useLabels,
1200
+ useLookupReturnableOrder,
1201
+ useNotifyWhenAvailable,
1185
1202
  useOrder,
1186
1203
  useOrders,
1187
1204
  usePage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@behio/storefront-sdk",
3
- "version": "0.5.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",
@@ -17,6 +17,11 @@
17
17
  "types": "./dist/react.d.ts",
18
18
  "import": "./dist/react.mjs",
19
19
  "require": "./dist/react.js"
20
+ },
21
+ "./next": {
22
+ "types": "./dist/next.d.ts",
23
+ "import": "./dist/next.mjs",
24
+ "require": "./dist/next.js"
20
25
  }
21
26
  },
22
27
  "files": [