@behio/storefront-sdk 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-KRGDHGTY.js → chunk-77TWIYZE.js} +21 -5
- package/dist/{chunk-3GOQSB25.mjs → chunk-COWHUXHJ.mjs} +16 -0
- package/dist/index.d.mts +130 -7
- package/dist/index.d.ts +130 -7
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/next.d.mts +14 -0
- package/dist/next.d.ts +14 -0
- package/dist/next.js +57 -0
- package/dist/next.mjs +57 -0
- package/dist/react.d.mts +8 -3
- package/dist/react.d.ts +8 -3
- package/dist/react.js +10 -3
- package/dist/react.mjs +8 -1
- package/package.json +6 -1
|
@@ -494,6 +494,12 @@ var CatalogModule = class {
|
|
|
494
494
|
async checkGiftCard(code) {
|
|
495
495
|
return this.client.request("GET", `/catalog/gift-cards/${encodeURIComponent(code)}/check`);
|
|
496
496
|
}
|
|
497
|
+
/** List configured payment methods (filtered by currency). */
|
|
498
|
+
async listPaymentMethods(opts) {
|
|
499
|
+
const query = {};
|
|
500
|
+
if (_optionalChain([opts, 'optionalAccess', _23 => _23.currency])) query.currency = opts.currency;
|
|
501
|
+
return this.client.request("GET", "/catalog/payment-methods", { query });
|
|
502
|
+
}
|
|
497
503
|
};
|
|
498
504
|
var AuthModule = class {
|
|
499
505
|
constructor(client) {
|
|
@@ -732,7 +738,7 @@ var OrdersModule = class {
|
|
|
732
738
|
/** List customer orders (requires auth) */
|
|
733
739
|
async list(options) {
|
|
734
740
|
return this.client.request("GET", "/orders", {
|
|
735
|
-
query: { page: _optionalChain([options, 'optionalAccess',
|
|
741
|
+
query: { page: _optionalChain([options, 'optionalAccess', _24 => _24.page]), limit: _optionalChain([options, 'optionalAccess', _25 => _25.limit]) }
|
|
736
742
|
});
|
|
737
743
|
}
|
|
738
744
|
/** Get order detail (requires auth) */
|
|
@@ -833,6 +839,16 @@ var ReturnsModule = class {
|
|
|
833
839
|
constructor(client) {
|
|
834
840
|
this.client = client;
|
|
835
841
|
}
|
|
842
|
+
/**
|
|
843
|
+
* Guest order lookup for the EU withdrawal form: order number + the email
|
|
844
|
+
* used on the order resolve to the order id and per-item returnable
|
|
845
|
+
* quantities. POST so the email never appears in a URL.
|
|
846
|
+
*/
|
|
847
|
+
async lookupOrder(orderNumber, email) {
|
|
848
|
+
return this.client.request("POST", "/returns/lookup-order", {
|
|
849
|
+
body: { orderNumber, email }
|
|
850
|
+
});
|
|
851
|
+
}
|
|
836
852
|
async submit(input) {
|
|
837
853
|
return this.client.request("POST", "/returns", { body: input });
|
|
838
854
|
}
|
|
@@ -898,10 +914,10 @@ var ShippingModule = class {
|
|
|
898
914
|
*/
|
|
899
915
|
async listMethods(opts) {
|
|
900
916
|
const query = {};
|
|
901
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
902
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
903
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
904
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
917
|
+
if (_optionalChain([opts, 'optionalAccess', _26 => _26.currency])) query.currency = opts.currency;
|
|
918
|
+
if (_optionalChain([opts, 'optionalAccess', _27 => _27.country])) query.country = opts.country;
|
|
919
|
+
if (_optionalChain([opts, 'optionalAccess', _28 => _28.cartTotal]) != null) query.cartTotal = String(opts.cartTotal);
|
|
920
|
+
if (_optionalChain([opts, 'optionalAccess', _29 => _29.cartWeightKg]) != null) query.cartWeightKg = String(opts.cartWeightKg);
|
|
905
921
|
return this.client.request(
|
|
906
922
|
"GET",
|
|
907
923
|
"/catalog/shipping-methods",
|
|
@@ -494,6 +494,12 @@ var CatalogModule = class {
|
|
|
494
494
|
async checkGiftCard(code) {
|
|
495
495
|
return this.client.request("GET", `/catalog/gift-cards/${encodeURIComponent(code)}/check`);
|
|
496
496
|
}
|
|
497
|
+
/** List configured payment methods (filtered by currency). */
|
|
498
|
+
async listPaymentMethods(opts) {
|
|
499
|
+
const query = {};
|
|
500
|
+
if (opts?.currency) query.currency = opts.currency;
|
|
501
|
+
return this.client.request("GET", "/catalog/payment-methods", { query });
|
|
502
|
+
}
|
|
497
503
|
};
|
|
498
504
|
var AuthModule = class {
|
|
499
505
|
constructor(client) {
|
|
@@ -833,6 +839,16 @@ var ReturnsModule = class {
|
|
|
833
839
|
constructor(client) {
|
|
834
840
|
this.client = client;
|
|
835
841
|
}
|
|
842
|
+
/**
|
|
843
|
+
* Guest order lookup for the EU withdrawal form: order number + the email
|
|
844
|
+
* used on the order resolve to the order id and per-item returnable
|
|
845
|
+
* quantities. POST so the email never appears in a URL.
|
|
846
|
+
*/
|
|
847
|
+
async lookupOrder(orderNumber, email) {
|
|
848
|
+
return this.client.request("POST", "/returns/lookup-order", {
|
|
849
|
+
body: { orderNumber, email }
|
|
850
|
+
});
|
|
851
|
+
}
|
|
836
852
|
async submit(input) {
|
|
837
853
|
return this.client.request("POST", "/returns", { body: input });
|
|
838
854
|
}
|
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.
|
|
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;
|
|
@@ -652,18 +706,75 @@ interface SubmitReviewInput {
|
|
|
652
706
|
authorEmail?: string;
|
|
653
707
|
imageUrls?: string[];
|
|
654
708
|
}
|
|
709
|
+
interface ReturnableOrderItem {
|
|
710
|
+
orderItemId: string;
|
|
711
|
+
productName: string;
|
|
712
|
+
/** Quantity ordered */
|
|
713
|
+
quantity: number;
|
|
714
|
+
/** Units still returnable (ordered minus active return claims) */
|
|
715
|
+
returnableQuantity: number;
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Result of the guest order lookup used by the EU withdrawal form:
|
|
719
|
+
* the customer enters their order number + email and gets back the
|
|
720
|
+
* internal ids needed to submit a return. No account required.
|
|
721
|
+
*/
|
|
722
|
+
interface ReturnableOrder {
|
|
723
|
+
orderId: string;
|
|
724
|
+
orderNumber: string;
|
|
725
|
+
status: string;
|
|
726
|
+
items: ReturnableOrderItem[];
|
|
727
|
+
createdAt: number;
|
|
728
|
+
}
|
|
729
|
+
interface ReturnRequestItem {
|
|
730
|
+
id: string;
|
|
731
|
+
orderItemId: string;
|
|
732
|
+
productName: string;
|
|
733
|
+
quantity: number;
|
|
734
|
+
reason: string | null;
|
|
735
|
+
imageUrls: string[];
|
|
736
|
+
}
|
|
737
|
+
/** Returned by `returns.submit()` — the acknowledged withdrawal request. */
|
|
655
738
|
interface ReturnRequest {
|
|
656
739
|
id: string;
|
|
740
|
+
eshopId: string;
|
|
657
741
|
orderId: string;
|
|
742
|
+
/** REQUESTED | APPROVED | SHIPPED_BACK | RECEIVED | REFUNDED | REJECTED | CLOSED */
|
|
743
|
+
status: string;
|
|
744
|
+
reason: string;
|
|
745
|
+
customerNote: string | null;
|
|
746
|
+
items: ReturnRequestItem[];
|
|
747
|
+
createdAt: number;
|
|
748
|
+
}
|
|
749
|
+
interface ReturnStatusItem {
|
|
750
|
+
id: string;
|
|
751
|
+
productName: string;
|
|
752
|
+
quantity: number;
|
|
753
|
+
reason: string | null;
|
|
754
|
+
}
|
|
755
|
+
/** Returned by `returns.getStatus()` — the full public view of a return. */
|
|
756
|
+
interface ReturnStatus {
|
|
757
|
+
id: string;
|
|
758
|
+
orderNumber: string;
|
|
759
|
+
/** REQUESTED | APPROVED | SHIPPED_BACK | RECEIVED | REFUNDED | REJECTED | CLOSED */
|
|
658
760
|
status: string;
|
|
659
761
|
reason: string;
|
|
660
762
|
customerNote: string | null;
|
|
661
|
-
refundAmount: number | null;
|
|
662
763
|
refundMethod: string | null;
|
|
764
|
+
refundAmount: number | null;
|
|
765
|
+
refundedAt: number | null;
|
|
766
|
+
returnTrackingNumber: string | null;
|
|
767
|
+
items: ReturnStatusItem[];
|
|
663
768
|
createdAt: number;
|
|
769
|
+
updatedAt: number;
|
|
664
770
|
}
|
|
665
771
|
interface SubmitReturnInput {
|
|
666
772
|
orderId: string;
|
|
773
|
+
/**
|
|
774
|
+
* Email used on the order. Required — it is the ownership gate for guest
|
|
775
|
+
* withdrawals; the backend rejects submissions whose email doesn't match.
|
|
776
|
+
*/
|
|
777
|
+
email: string;
|
|
667
778
|
reason: string;
|
|
668
779
|
customerNote?: string;
|
|
669
780
|
items: {
|
|
@@ -854,6 +965,12 @@ declare class CatalogModule {
|
|
|
854
965
|
}>>;
|
|
855
966
|
/** Check a gift card code — returns validity and remaining balance */
|
|
856
967
|
checkGiftCard(code: string): Promise<SdkResult<GiftCardBalance>>;
|
|
968
|
+
/** List configured payment methods (filtered by currency). */
|
|
969
|
+
listPaymentMethods(opts?: {
|
|
970
|
+
currency?: string;
|
|
971
|
+
}): Promise<SdkResult<{
|
|
972
|
+
items: CheckoutPaymentMethod[];
|
|
973
|
+
}>>;
|
|
857
974
|
}
|
|
858
975
|
declare class AuthModule {
|
|
859
976
|
private client;
|
|
@@ -1008,8 +1125,14 @@ declare class ReviewsModule {
|
|
|
1008
1125
|
declare class ReturnsModule {
|
|
1009
1126
|
private client;
|
|
1010
1127
|
constructor(client: BehioStorefront);
|
|
1128
|
+
/**
|
|
1129
|
+
* Guest order lookup for the EU withdrawal form: order number + the email
|
|
1130
|
+
* used on the order resolve to the order id and per-item returnable
|
|
1131
|
+
* quantities. POST so the email never appears in a URL.
|
|
1132
|
+
*/
|
|
1133
|
+
lookupOrder(orderNumber: string, email: string): Promise<SdkResult<ReturnableOrder>>;
|
|
1011
1134
|
submit(input: SubmitReturnInput): Promise<SdkResult<ReturnRequest>>;
|
|
1012
|
-
getStatus(returnId: string, email: string): Promise<SdkResult<
|
|
1135
|
+
getStatus(returnId: string, email: string): Promise<SdkResult<ReturnStatus>>;
|
|
1013
1136
|
}
|
|
1014
1137
|
declare class ConsentModule {
|
|
1015
1138
|
private client;
|
|
@@ -1099,4 +1222,4 @@ declare class ShippingModule {
|
|
|
1099
1222
|
}>>;
|
|
1100
1223
|
}
|
|
1101
1224
|
|
|
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 };
|
|
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 };
|
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.
|
|
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;
|
|
@@ -652,18 +706,75 @@ interface SubmitReviewInput {
|
|
|
652
706
|
authorEmail?: string;
|
|
653
707
|
imageUrls?: string[];
|
|
654
708
|
}
|
|
709
|
+
interface ReturnableOrderItem {
|
|
710
|
+
orderItemId: string;
|
|
711
|
+
productName: string;
|
|
712
|
+
/** Quantity ordered */
|
|
713
|
+
quantity: number;
|
|
714
|
+
/** Units still returnable (ordered minus active return claims) */
|
|
715
|
+
returnableQuantity: number;
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Result of the guest order lookup used by the EU withdrawal form:
|
|
719
|
+
* the customer enters their order number + email and gets back the
|
|
720
|
+
* internal ids needed to submit a return. No account required.
|
|
721
|
+
*/
|
|
722
|
+
interface ReturnableOrder {
|
|
723
|
+
orderId: string;
|
|
724
|
+
orderNumber: string;
|
|
725
|
+
status: string;
|
|
726
|
+
items: ReturnableOrderItem[];
|
|
727
|
+
createdAt: number;
|
|
728
|
+
}
|
|
729
|
+
interface ReturnRequestItem {
|
|
730
|
+
id: string;
|
|
731
|
+
orderItemId: string;
|
|
732
|
+
productName: string;
|
|
733
|
+
quantity: number;
|
|
734
|
+
reason: string | null;
|
|
735
|
+
imageUrls: string[];
|
|
736
|
+
}
|
|
737
|
+
/** Returned by `returns.submit()` — the acknowledged withdrawal request. */
|
|
655
738
|
interface ReturnRequest {
|
|
656
739
|
id: string;
|
|
740
|
+
eshopId: string;
|
|
657
741
|
orderId: string;
|
|
742
|
+
/** REQUESTED | APPROVED | SHIPPED_BACK | RECEIVED | REFUNDED | REJECTED | CLOSED */
|
|
743
|
+
status: string;
|
|
744
|
+
reason: string;
|
|
745
|
+
customerNote: string | null;
|
|
746
|
+
items: ReturnRequestItem[];
|
|
747
|
+
createdAt: number;
|
|
748
|
+
}
|
|
749
|
+
interface ReturnStatusItem {
|
|
750
|
+
id: string;
|
|
751
|
+
productName: string;
|
|
752
|
+
quantity: number;
|
|
753
|
+
reason: string | null;
|
|
754
|
+
}
|
|
755
|
+
/** Returned by `returns.getStatus()` — the full public view of a return. */
|
|
756
|
+
interface ReturnStatus {
|
|
757
|
+
id: string;
|
|
758
|
+
orderNumber: string;
|
|
759
|
+
/** REQUESTED | APPROVED | SHIPPED_BACK | RECEIVED | REFUNDED | REJECTED | CLOSED */
|
|
658
760
|
status: string;
|
|
659
761
|
reason: string;
|
|
660
762
|
customerNote: string | null;
|
|
661
|
-
refundAmount: number | null;
|
|
662
763
|
refundMethod: string | null;
|
|
764
|
+
refundAmount: number | null;
|
|
765
|
+
refundedAt: number | null;
|
|
766
|
+
returnTrackingNumber: string | null;
|
|
767
|
+
items: ReturnStatusItem[];
|
|
663
768
|
createdAt: number;
|
|
769
|
+
updatedAt: number;
|
|
664
770
|
}
|
|
665
771
|
interface SubmitReturnInput {
|
|
666
772
|
orderId: string;
|
|
773
|
+
/**
|
|
774
|
+
* Email used on the order. Required — it is the ownership gate for guest
|
|
775
|
+
* withdrawals; the backend rejects submissions whose email doesn't match.
|
|
776
|
+
*/
|
|
777
|
+
email: string;
|
|
667
778
|
reason: string;
|
|
668
779
|
customerNote?: string;
|
|
669
780
|
items: {
|
|
@@ -854,6 +965,12 @@ declare class CatalogModule {
|
|
|
854
965
|
}>>;
|
|
855
966
|
/** Check a gift card code — returns validity and remaining balance */
|
|
856
967
|
checkGiftCard(code: string): Promise<SdkResult<GiftCardBalance>>;
|
|
968
|
+
/** List configured payment methods (filtered by currency). */
|
|
969
|
+
listPaymentMethods(opts?: {
|
|
970
|
+
currency?: string;
|
|
971
|
+
}): Promise<SdkResult<{
|
|
972
|
+
items: CheckoutPaymentMethod[];
|
|
973
|
+
}>>;
|
|
857
974
|
}
|
|
858
975
|
declare class AuthModule {
|
|
859
976
|
private client;
|
|
@@ -1008,8 +1125,14 @@ declare class ReviewsModule {
|
|
|
1008
1125
|
declare class ReturnsModule {
|
|
1009
1126
|
private client;
|
|
1010
1127
|
constructor(client: BehioStorefront);
|
|
1128
|
+
/**
|
|
1129
|
+
* Guest order lookup for the EU withdrawal form: order number + the email
|
|
1130
|
+
* used on the order resolve to the order id and per-item returnable
|
|
1131
|
+
* quantities. POST so the email never appears in a URL.
|
|
1132
|
+
*/
|
|
1133
|
+
lookupOrder(orderNumber: string, email: string): Promise<SdkResult<ReturnableOrder>>;
|
|
1011
1134
|
submit(input: SubmitReturnInput): Promise<SdkResult<ReturnRequest>>;
|
|
1012
|
-
getStatus(returnId: string, email: string): Promise<SdkResult<
|
|
1135
|
+
getStatus(returnId: string, email: string): Promise<SdkResult<ReturnStatus>>;
|
|
1013
1136
|
}
|
|
1014
1137
|
declare class ConsentModule {
|
|
1015
1138
|
private client;
|
|
@@ -1099,4 +1222,4 @@ declare class ShippingModule {
|
|
|
1099
1222
|
}>>;
|
|
1100
1223
|
}
|
|
1101
1224
|
|
|
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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunk77TWIYZEjs = require('./chunk-77TWIYZE.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 =
|
|
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;
|
package/dist/index.mjs
CHANGED
package/dist/next.d.mts
ADDED
|
@@ -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 _chunk77TWIYZEjs = require('./chunk-77TWIYZE.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, _chunk77TWIYZEjs.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-COWHUXHJ.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 } 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<
|
|
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>;
|
|
@@ -851,4 +856,4 @@ declare function useBehioClient(): BehioStorefront;
|
|
|
851
856
|
*/
|
|
852
857
|
declare function formatPrice(amount: number, currency: string, locale?: string): string;
|
|
853
858
|
|
|
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 };
|
|
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 };
|
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 } 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<
|
|
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>;
|
|
@@ -851,4 +856,4 @@ declare function useBehioClient(): BehioStorefront;
|
|
|
851
856
|
*/
|
|
852
857
|
declare function formatPrice(amount: number, currency: string, locale?: string): string;
|
|
853
858
|
|
|
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 };
|
|
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 };
|
package/dist/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk77TWIYZEjs = require('./chunk-77TWIYZE.js');
|
|
4
4
|
|
|
5
5
|
// src/react/provider.tsx
|
|
6
6
|
var _react = require('react');
|
|
@@ -114,7 +114,7 @@ function BehioProvider({
|
|
|
114
114
|
const storageAdapter = _react.useMemo.call(void 0, () => resolveStorage(storageOption), [storageOption]);
|
|
115
115
|
const clientRef = _react.useRef.call(void 0, null);
|
|
116
116
|
if (!clientRef.current) {
|
|
117
|
-
clientRef.current = new (0,
|
|
117
|
+
clientRef.current = new (0, _chunk77TWIYZEjs.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, {
|
|
@@ -1199,4 +1205,5 @@ function formatPrice(amount, currency, locale) {
|
|
|
1199
1205
|
|
|
1200
1206
|
|
|
1201
1207
|
|
|
1202
|
-
|
|
1208
|
+
|
|
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;
|
package/dist/react.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BehioStorefront
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-COWHUXHJ.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({
|
|
@@ -1182,6 +1188,7 @@ export {
|
|
|
1182
1188
|
useGiftCardBalance,
|
|
1183
1189
|
useIsInWishlist,
|
|
1184
1190
|
useLabels,
|
|
1191
|
+
useLookupReturnableOrder,
|
|
1185
1192
|
useOrder,
|
|
1186
1193
|
useOrders,
|
|
1187
1194
|
usePage,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behio/storefront-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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": [
|