@behio/storefront-sdk 0.1.11 → 0.3.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/README.md +67 -1340
- package/dist/{chunk-WMBSTKJR.mjs → chunk-45FTJKSW.mjs} +96 -0
- package/dist/{chunk-33DUMF3N.js → chunk-ZEPWNT56.js} +96 -0
- package/dist/index.d.mts +183 -1
- package/dist/index.d.ts +183 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/react.d.mts +502 -3
- package/dist/react.d.ts +502 -3
- package/dist/react.js +245 -58
- package/dist/react.mjs +220 -33
- package/package.json +1 -1
|
@@ -102,6 +102,12 @@ var BehioStorefront = class {
|
|
|
102
102
|
this.orders = new OrdersModule(this);
|
|
103
103
|
this.customer = new CustomerModule(this);
|
|
104
104
|
this.pages = new PagesModule(this);
|
|
105
|
+
this.wishlist = new WishlistModule(this);
|
|
106
|
+
this.reviews = new ReviewsModule(this);
|
|
107
|
+
this.returns = new ReturnsModule(this);
|
|
108
|
+
this.consent = new ConsentModule(this);
|
|
109
|
+
this.quotes = new QuotesModule(this);
|
|
110
|
+
this.addresses = new AddressModule(this);
|
|
105
111
|
}
|
|
106
112
|
// --- Public methods ---
|
|
107
113
|
/** Get basic shop info */
|
|
@@ -676,6 +682,96 @@ var PagesModule = class {
|
|
|
676
682
|
return this.client.request("GET", `/pages/${slug}`, { query: { locale } });
|
|
677
683
|
}
|
|
678
684
|
};
|
|
685
|
+
var WishlistModule = class {
|
|
686
|
+
constructor(client) {
|
|
687
|
+
this.client = client;
|
|
688
|
+
}
|
|
689
|
+
async get() {
|
|
690
|
+
return this.client.request("GET", "/customer/wishlist");
|
|
691
|
+
}
|
|
692
|
+
async add(productId) {
|
|
693
|
+
return this.client.request("POST", "/customer/wishlist", { body: { productId } });
|
|
694
|
+
}
|
|
695
|
+
async remove(productId) {
|
|
696
|
+
return this.client.request("DELETE", `/customer/wishlist/${productId}`);
|
|
697
|
+
}
|
|
698
|
+
async isInWishlist(productId) {
|
|
699
|
+
return this.client.request("GET", `/customer/wishlist/${productId}/check`);
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
var ReviewsModule = class {
|
|
703
|
+
constructor(client) {
|
|
704
|
+
this.client = client;
|
|
705
|
+
}
|
|
706
|
+
async getProductReviews(productId, page = 1, limit = 20) {
|
|
707
|
+
return this.client.request("GET", `/catalog/products/${productId}/reviews`, {
|
|
708
|
+
query: { page: String(page), limit: String(limit) }
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
async submit(input) {
|
|
712
|
+
return this.client.request("POST", "/catalog/reviews", { body: input });
|
|
713
|
+
}
|
|
714
|
+
async voteHelpful(reviewId, helpful) {
|
|
715
|
+
return this.client.request("POST", `/catalog/reviews/${reviewId}/vote`, { body: { helpful } });
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
var ReturnsModule = class {
|
|
719
|
+
constructor(client) {
|
|
720
|
+
this.client = client;
|
|
721
|
+
}
|
|
722
|
+
async submit(input) {
|
|
723
|
+
return this.client.request("POST", "/returns", { body: input });
|
|
724
|
+
}
|
|
725
|
+
async getStatus(returnId, email) {
|
|
726
|
+
return this.client.request("GET", `/returns/${returnId}/status`, { query: { email } });
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
var ConsentModule = class {
|
|
730
|
+
constructor(client) {
|
|
731
|
+
this.client = client;
|
|
732
|
+
}
|
|
733
|
+
async record(input) {
|
|
734
|
+
return this.client.request("POST", "/consent", { body: input, auth: false });
|
|
735
|
+
}
|
|
736
|
+
async get(visitorId) {
|
|
737
|
+
return this.client.request("GET", `/consent/${visitorId}`, { auth: false });
|
|
738
|
+
}
|
|
739
|
+
async revoke(visitorId) {
|
|
740
|
+
return this.client.request("DELETE", `/consent/${visitorId}`, { auth: false });
|
|
741
|
+
}
|
|
742
|
+
};
|
|
743
|
+
var QuotesModule = class {
|
|
744
|
+
constructor(client) {
|
|
745
|
+
this.client = client;
|
|
746
|
+
}
|
|
747
|
+
async submit(input) {
|
|
748
|
+
return this.client.request("POST", "/catalog/quote-request", { body: input });
|
|
749
|
+
}
|
|
750
|
+
async accept(quoteId, email) {
|
|
751
|
+
return this.client.request("POST", `/quotes/${quoteId}/accept`, { body: { email } });
|
|
752
|
+
}
|
|
753
|
+
async getStatus(quoteId) {
|
|
754
|
+
return this.client.request("GET", `/quotes/${quoteId}`);
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
var AddressModule = class {
|
|
758
|
+
constructor(client) {
|
|
759
|
+
this.client = client;
|
|
760
|
+
}
|
|
761
|
+
/** Search for address suggestions (debounce on your side, or use the React hook) */
|
|
762
|
+
async autocomplete(query, country) {
|
|
763
|
+
if (!query || query.length < 2) return { suggestions: [] };
|
|
764
|
+
return this.client.request("GET", "/addresses/autocomplete", {
|
|
765
|
+
query: { q: query, country }
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
/** Get full structured address from a suggestion's placeId */
|
|
769
|
+
async getDetail(placeId) {
|
|
770
|
+
return this.client.request("GET", "/addresses/place-detail", {
|
|
771
|
+
query: { placeId }
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
};
|
|
679
775
|
|
|
680
776
|
export {
|
|
681
777
|
ProductSort,
|
|
@@ -102,6 +102,12 @@ var BehioStorefront = class {
|
|
|
102
102
|
this.orders = new OrdersModule(this);
|
|
103
103
|
this.customer = new CustomerModule(this);
|
|
104
104
|
this.pages = new PagesModule(this);
|
|
105
|
+
this.wishlist = new WishlistModule(this);
|
|
106
|
+
this.reviews = new ReviewsModule(this);
|
|
107
|
+
this.returns = new ReturnsModule(this);
|
|
108
|
+
this.consent = new ConsentModule(this);
|
|
109
|
+
this.quotes = new QuotesModule(this);
|
|
110
|
+
this.addresses = new AddressModule(this);
|
|
105
111
|
}
|
|
106
112
|
// --- Public methods ---
|
|
107
113
|
/** Get basic shop info */
|
|
@@ -676,6 +682,96 @@ var PagesModule = class {
|
|
|
676
682
|
return this.client.request("GET", `/pages/${slug}`, { query: { locale } });
|
|
677
683
|
}
|
|
678
684
|
};
|
|
685
|
+
var WishlistModule = class {
|
|
686
|
+
constructor(client) {
|
|
687
|
+
this.client = client;
|
|
688
|
+
}
|
|
689
|
+
async get() {
|
|
690
|
+
return this.client.request("GET", "/customer/wishlist");
|
|
691
|
+
}
|
|
692
|
+
async add(productId) {
|
|
693
|
+
return this.client.request("POST", "/customer/wishlist", { body: { productId } });
|
|
694
|
+
}
|
|
695
|
+
async remove(productId) {
|
|
696
|
+
return this.client.request("DELETE", `/customer/wishlist/${productId}`);
|
|
697
|
+
}
|
|
698
|
+
async isInWishlist(productId) {
|
|
699
|
+
return this.client.request("GET", `/customer/wishlist/${productId}/check`);
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
var ReviewsModule = class {
|
|
703
|
+
constructor(client) {
|
|
704
|
+
this.client = client;
|
|
705
|
+
}
|
|
706
|
+
async getProductReviews(productId, page = 1, limit = 20) {
|
|
707
|
+
return this.client.request("GET", `/catalog/products/${productId}/reviews`, {
|
|
708
|
+
query: { page: String(page), limit: String(limit) }
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
async submit(input) {
|
|
712
|
+
return this.client.request("POST", "/catalog/reviews", { body: input });
|
|
713
|
+
}
|
|
714
|
+
async voteHelpful(reviewId, helpful) {
|
|
715
|
+
return this.client.request("POST", `/catalog/reviews/${reviewId}/vote`, { body: { helpful } });
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
var ReturnsModule = class {
|
|
719
|
+
constructor(client) {
|
|
720
|
+
this.client = client;
|
|
721
|
+
}
|
|
722
|
+
async submit(input) {
|
|
723
|
+
return this.client.request("POST", "/returns", { body: input });
|
|
724
|
+
}
|
|
725
|
+
async getStatus(returnId, email) {
|
|
726
|
+
return this.client.request("GET", `/returns/${returnId}/status`, { query: { email } });
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
var ConsentModule = class {
|
|
730
|
+
constructor(client) {
|
|
731
|
+
this.client = client;
|
|
732
|
+
}
|
|
733
|
+
async record(input) {
|
|
734
|
+
return this.client.request("POST", "/consent", { body: input, auth: false });
|
|
735
|
+
}
|
|
736
|
+
async get(visitorId) {
|
|
737
|
+
return this.client.request("GET", `/consent/${visitorId}`, { auth: false });
|
|
738
|
+
}
|
|
739
|
+
async revoke(visitorId) {
|
|
740
|
+
return this.client.request("DELETE", `/consent/${visitorId}`, { auth: false });
|
|
741
|
+
}
|
|
742
|
+
};
|
|
743
|
+
var QuotesModule = class {
|
|
744
|
+
constructor(client) {
|
|
745
|
+
this.client = client;
|
|
746
|
+
}
|
|
747
|
+
async submit(input) {
|
|
748
|
+
return this.client.request("POST", "/catalog/quote-request", { body: input });
|
|
749
|
+
}
|
|
750
|
+
async accept(quoteId, email) {
|
|
751
|
+
return this.client.request("POST", `/quotes/${quoteId}/accept`, { body: { email } });
|
|
752
|
+
}
|
|
753
|
+
async getStatus(quoteId) {
|
|
754
|
+
return this.client.request("GET", `/quotes/${quoteId}`);
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
var AddressModule = class {
|
|
758
|
+
constructor(client) {
|
|
759
|
+
this.client = client;
|
|
760
|
+
}
|
|
761
|
+
/** Search for address suggestions (debounce on your side, or use the React hook) */
|
|
762
|
+
async autocomplete(query, country) {
|
|
763
|
+
if (!query || query.length < 2) return { suggestions: [] };
|
|
764
|
+
return this.client.request("GET", "/addresses/autocomplete", {
|
|
765
|
+
query: { q: query, country }
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
/** Get full structured address from a suggestion's placeId */
|
|
769
|
+
async getDetail(placeId) {
|
|
770
|
+
return this.client.request("GET", "/addresses/place-detail", {
|
|
771
|
+
query: { placeId }
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
};
|
|
679
775
|
|
|
680
776
|
|
|
681
777
|
|
package/dist/index.d.mts
CHANGED
|
@@ -441,6 +441,103 @@ interface GiftCardBalance {
|
|
|
441
441
|
balance: number;
|
|
442
442
|
currency: string;
|
|
443
443
|
}
|
|
444
|
+
interface WishlistItem {
|
|
445
|
+
id: string;
|
|
446
|
+
productId: string;
|
|
447
|
+
productName: string;
|
|
448
|
+
productSku: string;
|
|
449
|
+
productSlug: string | null;
|
|
450
|
+
imageUrl: string | null;
|
|
451
|
+
price: number | null;
|
|
452
|
+
stockCached: number;
|
|
453
|
+
createdAt: number;
|
|
454
|
+
}
|
|
455
|
+
interface ProductReview {
|
|
456
|
+
id: string;
|
|
457
|
+
authorName: string;
|
|
458
|
+
rating: number;
|
|
459
|
+
title: string | null;
|
|
460
|
+
content: string | null;
|
|
461
|
+
imageUrls: string[];
|
|
462
|
+
isVerifiedPurchase: boolean;
|
|
463
|
+
helpfulCount: number;
|
|
464
|
+
unhelpfulCount: number;
|
|
465
|
+
replyContent: string | null;
|
|
466
|
+
createdAt: number;
|
|
467
|
+
}
|
|
468
|
+
interface ProductReviewsResponse {
|
|
469
|
+
items: ProductReview[];
|
|
470
|
+
averageRating: number;
|
|
471
|
+
reviewCount: number;
|
|
472
|
+
page: number;
|
|
473
|
+
totalPages: number;
|
|
474
|
+
}
|
|
475
|
+
interface SubmitReviewInput {
|
|
476
|
+
productId: string;
|
|
477
|
+
rating: number;
|
|
478
|
+
title?: string;
|
|
479
|
+
content?: string;
|
|
480
|
+
authorName: string;
|
|
481
|
+
authorEmail?: string;
|
|
482
|
+
imageUrls?: string[];
|
|
483
|
+
}
|
|
484
|
+
interface ReturnRequest {
|
|
485
|
+
id: string;
|
|
486
|
+
orderId: string;
|
|
487
|
+
status: string;
|
|
488
|
+
reason: string;
|
|
489
|
+
customerNote: string | null;
|
|
490
|
+
refundAmount: number | null;
|
|
491
|
+
refundMethod: string | null;
|
|
492
|
+
createdAt: number;
|
|
493
|
+
}
|
|
494
|
+
interface SubmitReturnInput {
|
|
495
|
+
orderId: string;
|
|
496
|
+
reason: string;
|
|
497
|
+
customerNote?: string;
|
|
498
|
+
items: {
|
|
499
|
+
orderItemId: string;
|
|
500
|
+
productName: string;
|
|
501
|
+
quantity: number;
|
|
502
|
+
reason?: string;
|
|
503
|
+
imageUrls?: string[];
|
|
504
|
+
}[];
|
|
505
|
+
}
|
|
506
|
+
interface CookieConsent {
|
|
507
|
+
necessary: boolean;
|
|
508
|
+
analytics: boolean;
|
|
509
|
+
marketing: boolean;
|
|
510
|
+
preferences: boolean;
|
|
511
|
+
consentedAt: number;
|
|
512
|
+
}
|
|
513
|
+
interface CookieConsentInput {
|
|
514
|
+
visitorId: string;
|
|
515
|
+
analytics: boolean;
|
|
516
|
+
marketing: boolean;
|
|
517
|
+
preferences: boolean;
|
|
518
|
+
}
|
|
519
|
+
interface QuoteRequest {
|
|
520
|
+
id: string;
|
|
521
|
+
status: string;
|
|
522
|
+
contactName: string;
|
|
523
|
+
contactEmail: string;
|
|
524
|
+
companyName: string | null;
|
|
525
|
+
quotedTotal: number | null;
|
|
526
|
+
createdAt: number;
|
|
527
|
+
}
|
|
528
|
+
interface SubmitQuoteInput {
|
|
529
|
+
contactName: string;
|
|
530
|
+
contactEmail: string;
|
|
531
|
+
contactPhone?: string;
|
|
532
|
+
companyName?: string;
|
|
533
|
+
companyIco?: string;
|
|
534
|
+
message?: string;
|
|
535
|
+
items: {
|
|
536
|
+
productId: string;
|
|
537
|
+
quantity: number;
|
|
538
|
+
requestedPrice?: number;
|
|
539
|
+
}[];
|
|
540
|
+
}
|
|
444
541
|
|
|
445
542
|
declare class BehioStorefront {
|
|
446
543
|
private baseUrl;
|
|
@@ -469,6 +566,12 @@ declare class BehioStorefront {
|
|
|
469
566
|
readonly orders: OrdersModule;
|
|
470
567
|
readonly customer: CustomerModule;
|
|
471
568
|
readonly pages: PagesModule;
|
|
569
|
+
readonly wishlist: WishlistModule;
|
|
570
|
+
readonly reviews: ReviewsModule;
|
|
571
|
+
readonly returns: ReturnsModule;
|
|
572
|
+
readonly consent: ConsentModule;
|
|
573
|
+
readonly quotes: QuotesModule;
|
|
574
|
+
readonly addresses: AddressModule;
|
|
472
575
|
/** Get basic shop info */
|
|
473
576
|
getShopInfo(): Promise<ShopInfo>;
|
|
474
577
|
/** Get SEO metadata for the shop homepage in the given locale (defaults to shop default). */
|
|
@@ -672,5 +775,84 @@ declare class PagesModule {
|
|
|
672
775
|
/** Get page by slug */
|
|
673
776
|
get(slug: string, locale?: string): Promise<PageDetail>;
|
|
674
777
|
}
|
|
778
|
+
declare class WishlistModule {
|
|
779
|
+
private client;
|
|
780
|
+
constructor(client: BehioStorefront);
|
|
781
|
+
get(): Promise<{
|
|
782
|
+
items: WishlistItem[];
|
|
783
|
+
}>;
|
|
784
|
+
add(productId: string): Promise<{
|
|
785
|
+
success: boolean;
|
|
786
|
+
}>;
|
|
787
|
+
remove(productId: string): Promise<{
|
|
788
|
+
success: boolean;
|
|
789
|
+
}>;
|
|
790
|
+
isInWishlist(productId: string): Promise<{
|
|
791
|
+
inWishlist: boolean;
|
|
792
|
+
}>;
|
|
793
|
+
}
|
|
794
|
+
declare class ReviewsModule {
|
|
795
|
+
private client;
|
|
796
|
+
constructor(client: BehioStorefront);
|
|
797
|
+
getProductReviews(productId: string, page?: number, limit?: number): Promise<ProductReviewsResponse>;
|
|
798
|
+
submit(input: SubmitReviewInput): Promise<{
|
|
799
|
+
id: string;
|
|
800
|
+
}>;
|
|
801
|
+
voteHelpful(reviewId: string, helpful: boolean): Promise<{
|
|
802
|
+
success: boolean;
|
|
803
|
+
}>;
|
|
804
|
+
}
|
|
805
|
+
declare class ReturnsModule {
|
|
806
|
+
private client;
|
|
807
|
+
constructor(client: BehioStorefront);
|
|
808
|
+
submit(input: SubmitReturnInput): Promise<ReturnRequest>;
|
|
809
|
+
getStatus(returnId: string, email: string): Promise<ReturnRequest>;
|
|
810
|
+
}
|
|
811
|
+
declare class ConsentModule {
|
|
812
|
+
private client;
|
|
813
|
+
constructor(client: BehioStorefront);
|
|
814
|
+
record(input: CookieConsentInput): Promise<CookieConsent>;
|
|
815
|
+
get(visitorId: string): Promise<CookieConsent | null>;
|
|
816
|
+
revoke(visitorId: string): Promise<{
|
|
817
|
+
success: boolean;
|
|
818
|
+
}>;
|
|
819
|
+
}
|
|
820
|
+
declare class QuotesModule {
|
|
821
|
+
private client;
|
|
822
|
+
constructor(client: BehioStorefront);
|
|
823
|
+
submit(input: SubmitQuoteInput): Promise<QuoteRequest>;
|
|
824
|
+
accept(quoteId: string, email: string): Promise<QuoteRequest>;
|
|
825
|
+
getStatus(quoteId: string): Promise<QuoteRequest>;
|
|
826
|
+
}
|
|
827
|
+
interface AddressSuggestion {
|
|
828
|
+
placeId: string;
|
|
829
|
+
description: string;
|
|
830
|
+
street: string;
|
|
831
|
+
city: string;
|
|
832
|
+
zip: string;
|
|
833
|
+
country: string;
|
|
834
|
+
countryCode: string;
|
|
835
|
+
}
|
|
836
|
+
interface AddressDetail {
|
|
837
|
+
street: string;
|
|
838
|
+
streetNumber: string;
|
|
839
|
+
city: string;
|
|
840
|
+
zip: string;
|
|
841
|
+
country: string;
|
|
842
|
+
countryCode: string;
|
|
843
|
+
formattedAddress: string;
|
|
844
|
+
lat: number;
|
|
845
|
+
lng: number;
|
|
846
|
+
}
|
|
847
|
+
declare class AddressModule {
|
|
848
|
+
private client;
|
|
849
|
+
constructor(client: BehioStorefront);
|
|
850
|
+
/** Search for address suggestions (debounce on your side, or use the React hook) */
|
|
851
|
+
autocomplete(query: string, country: string): Promise<{
|
|
852
|
+
suggestions: AddressSuggestion[];
|
|
853
|
+
}>;
|
|
854
|
+
/** Get full structured address from a suggestion's placeId */
|
|
855
|
+
getDetail(placeId: string): Promise<AddressDetail>;
|
|
856
|
+
}
|
|
675
857
|
|
|
676
|
-
export { type ActivePromotion, type AddToCartInput, 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 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, ProductSort, type ProductSortValue, type ProductVariant, type ProductVolumePrice, type ProductsQuery, type RegisterInput, type RequestInterceptor, type RequestInterceptorConfig, type ResponseInterceptor, type ResponseInterceptorData, type ShopInfo, type ShopSeo };
|
|
858
|
+
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 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 ShopInfo, type ShopSeo, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type WishlistItem };
|
package/dist/index.d.ts
CHANGED
|
@@ -441,6 +441,103 @@ interface GiftCardBalance {
|
|
|
441
441
|
balance: number;
|
|
442
442
|
currency: string;
|
|
443
443
|
}
|
|
444
|
+
interface WishlistItem {
|
|
445
|
+
id: string;
|
|
446
|
+
productId: string;
|
|
447
|
+
productName: string;
|
|
448
|
+
productSku: string;
|
|
449
|
+
productSlug: string | null;
|
|
450
|
+
imageUrl: string | null;
|
|
451
|
+
price: number | null;
|
|
452
|
+
stockCached: number;
|
|
453
|
+
createdAt: number;
|
|
454
|
+
}
|
|
455
|
+
interface ProductReview {
|
|
456
|
+
id: string;
|
|
457
|
+
authorName: string;
|
|
458
|
+
rating: number;
|
|
459
|
+
title: string | null;
|
|
460
|
+
content: string | null;
|
|
461
|
+
imageUrls: string[];
|
|
462
|
+
isVerifiedPurchase: boolean;
|
|
463
|
+
helpfulCount: number;
|
|
464
|
+
unhelpfulCount: number;
|
|
465
|
+
replyContent: string | null;
|
|
466
|
+
createdAt: number;
|
|
467
|
+
}
|
|
468
|
+
interface ProductReviewsResponse {
|
|
469
|
+
items: ProductReview[];
|
|
470
|
+
averageRating: number;
|
|
471
|
+
reviewCount: number;
|
|
472
|
+
page: number;
|
|
473
|
+
totalPages: number;
|
|
474
|
+
}
|
|
475
|
+
interface SubmitReviewInput {
|
|
476
|
+
productId: string;
|
|
477
|
+
rating: number;
|
|
478
|
+
title?: string;
|
|
479
|
+
content?: string;
|
|
480
|
+
authorName: string;
|
|
481
|
+
authorEmail?: string;
|
|
482
|
+
imageUrls?: string[];
|
|
483
|
+
}
|
|
484
|
+
interface ReturnRequest {
|
|
485
|
+
id: string;
|
|
486
|
+
orderId: string;
|
|
487
|
+
status: string;
|
|
488
|
+
reason: string;
|
|
489
|
+
customerNote: string | null;
|
|
490
|
+
refundAmount: number | null;
|
|
491
|
+
refundMethod: string | null;
|
|
492
|
+
createdAt: number;
|
|
493
|
+
}
|
|
494
|
+
interface SubmitReturnInput {
|
|
495
|
+
orderId: string;
|
|
496
|
+
reason: string;
|
|
497
|
+
customerNote?: string;
|
|
498
|
+
items: {
|
|
499
|
+
orderItemId: string;
|
|
500
|
+
productName: string;
|
|
501
|
+
quantity: number;
|
|
502
|
+
reason?: string;
|
|
503
|
+
imageUrls?: string[];
|
|
504
|
+
}[];
|
|
505
|
+
}
|
|
506
|
+
interface CookieConsent {
|
|
507
|
+
necessary: boolean;
|
|
508
|
+
analytics: boolean;
|
|
509
|
+
marketing: boolean;
|
|
510
|
+
preferences: boolean;
|
|
511
|
+
consentedAt: number;
|
|
512
|
+
}
|
|
513
|
+
interface CookieConsentInput {
|
|
514
|
+
visitorId: string;
|
|
515
|
+
analytics: boolean;
|
|
516
|
+
marketing: boolean;
|
|
517
|
+
preferences: boolean;
|
|
518
|
+
}
|
|
519
|
+
interface QuoteRequest {
|
|
520
|
+
id: string;
|
|
521
|
+
status: string;
|
|
522
|
+
contactName: string;
|
|
523
|
+
contactEmail: string;
|
|
524
|
+
companyName: string | null;
|
|
525
|
+
quotedTotal: number | null;
|
|
526
|
+
createdAt: number;
|
|
527
|
+
}
|
|
528
|
+
interface SubmitQuoteInput {
|
|
529
|
+
contactName: string;
|
|
530
|
+
contactEmail: string;
|
|
531
|
+
contactPhone?: string;
|
|
532
|
+
companyName?: string;
|
|
533
|
+
companyIco?: string;
|
|
534
|
+
message?: string;
|
|
535
|
+
items: {
|
|
536
|
+
productId: string;
|
|
537
|
+
quantity: number;
|
|
538
|
+
requestedPrice?: number;
|
|
539
|
+
}[];
|
|
540
|
+
}
|
|
444
541
|
|
|
445
542
|
declare class BehioStorefront {
|
|
446
543
|
private baseUrl;
|
|
@@ -469,6 +566,12 @@ declare class BehioStorefront {
|
|
|
469
566
|
readonly orders: OrdersModule;
|
|
470
567
|
readonly customer: CustomerModule;
|
|
471
568
|
readonly pages: PagesModule;
|
|
569
|
+
readonly wishlist: WishlistModule;
|
|
570
|
+
readonly reviews: ReviewsModule;
|
|
571
|
+
readonly returns: ReturnsModule;
|
|
572
|
+
readonly consent: ConsentModule;
|
|
573
|
+
readonly quotes: QuotesModule;
|
|
574
|
+
readonly addresses: AddressModule;
|
|
472
575
|
/** Get basic shop info */
|
|
473
576
|
getShopInfo(): Promise<ShopInfo>;
|
|
474
577
|
/** Get SEO metadata for the shop homepage in the given locale (defaults to shop default). */
|
|
@@ -672,5 +775,84 @@ declare class PagesModule {
|
|
|
672
775
|
/** Get page by slug */
|
|
673
776
|
get(slug: string, locale?: string): Promise<PageDetail>;
|
|
674
777
|
}
|
|
778
|
+
declare class WishlistModule {
|
|
779
|
+
private client;
|
|
780
|
+
constructor(client: BehioStorefront);
|
|
781
|
+
get(): Promise<{
|
|
782
|
+
items: WishlistItem[];
|
|
783
|
+
}>;
|
|
784
|
+
add(productId: string): Promise<{
|
|
785
|
+
success: boolean;
|
|
786
|
+
}>;
|
|
787
|
+
remove(productId: string): Promise<{
|
|
788
|
+
success: boolean;
|
|
789
|
+
}>;
|
|
790
|
+
isInWishlist(productId: string): Promise<{
|
|
791
|
+
inWishlist: boolean;
|
|
792
|
+
}>;
|
|
793
|
+
}
|
|
794
|
+
declare class ReviewsModule {
|
|
795
|
+
private client;
|
|
796
|
+
constructor(client: BehioStorefront);
|
|
797
|
+
getProductReviews(productId: string, page?: number, limit?: number): Promise<ProductReviewsResponse>;
|
|
798
|
+
submit(input: SubmitReviewInput): Promise<{
|
|
799
|
+
id: string;
|
|
800
|
+
}>;
|
|
801
|
+
voteHelpful(reviewId: string, helpful: boolean): Promise<{
|
|
802
|
+
success: boolean;
|
|
803
|
+
}>;
|
|
804
|
+
}
|
|
805
|
+
declare class ReturnsModule {
|
|
806
|
+
private client;
|
|
807
|
+
constructor(client: BehioStorefront);
|
|
808
|
+
submit(input: SubmitReturnInput): Promise<ReturnRequest>;
|
|
809
|
+
getStatus(returnId: string, email: string): Promise<ReturnRequest>;
|
|
810
|
+
}
|
|
811
|
+
declare class ConsentModule {
|
|
812
|
+
private client;
|
|
813
|
+
constructor(client: BehioStorefront);
|
|
814
|
+
record(input: CookieConsentInput): Promise<CookieConsent>;
|
|
815
|
+
get(visitorId: string): Promise<CookieConsent | null>;
|
|
816
|
+
revoke(visitorId: string): Promise<{
|
|
817
|
+
success: boolean;
|
|
818
|
+
}>;
|
|
819
|
+
}
|
|
820
|
+
declare class QuotesModule {
|
|
821
|
+
private client;
|
|
822
|
+
constructor(client: BehioStorefront);
|
|
823
|
+
submit(input: SubmitQuoteInput): Promise<QuoteRequest>;
|
|
824
|
+
accept(quoteId: string, email: string): Promise<QuoteRequest>;
|
|
825
|
+
getStatus(quoteId: string): Promise<QuoteRequest>;
|
|
826
|
+
}
|
|
827
|
+
interface AddressSuggestion {
|
|
828
|
+
placeId: string;
|
|
829
|
+
description: string;
|
|
830
|
+
street: string;
|
|
831
|
+
city: string;
|
|
832
|
+
zip: string;
|
|
833
|
+
country: string;
|
|
834
|
+
countryCode: string;
|
|
835
|
+
}
|
|
836
|
+
interface AddressDetail {
|
|
837
|
+
street: string;
|
|
838
|
+
streetNumber: string;
|
|
839
|
+
city: string;
|
|
840
|
+
zip: string;
|
|
841
|
+
country: string;
|
|
842
|
+
countryCode: string;
|
|
843
|
+
formattedAddress: string;
|
|
844
|
+
lat: number;
|
|
845
|
+
lng: number;
|
|
846
|
+
}
|
|
847
|
+
declare class AddressModule {
|
|
848
|
+
private client;
|
|
849
|
+
constructor(client: BehioStorefront);
|
|
850
|
+
/** Search for address suggestions (debounce on your side, or use the React hook) */
|
|
851
|
+
autocomplete(query: string, country: string): Promise<{
|
|
852
|
+
suggestions: AddressSuggestion[];
|
|
853
|
+
}>;
|
|
854
|
+
/** Get full structured address from a suggestion's placeId */
|
|
855
|
+
getDetail(placeId: string): Promise<AddressDetail>;
|
|
856
|
+
}
|
|
675
857
|
|
|
676
|
-
export { type ActivePromotion, type AddToCartInput, 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 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, ProductSort, type ProductSortValue, type ProductVariant, type ProductVolumePrice, type ProductsQuery, type RegisterInput, type RequestInterceptor, type RequestInterceptorConfig, type ResponseInterceptor, type ResponseInterceptorData, type ShopInfo, type ShopSeo };
|
|
858
|
+
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 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 ShopInfo, type ShopSeo, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type WishlistItem };
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkZEPWNT56js = require('./chunk-ZEPWNT56.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -17,4 +17,4 @@ var _chunk33DUMF3Njs = require('./chunk-33DUMF3N.js');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
exports.AddressTypes =
|
|
20
|
+
exports.AddressTypes = _chunkZEPWNT56js.AddressTypes; exports.BehioApiError = _chunkZEPWNT56js.BehioApiError; exports.BehioNetworkError = _chunkZEPWNT56js.BehioNetworkError; exports.BehioStorefront = _chunkZEPWNT56js.BehioStorefront; exports.FulfillmentStatuses = _chunkZEPWNT56js.FulfillmentStatuses; exports.OrderStatuses = _chunkZEPWNT56js.OrderStatuses; exports.PaymentStatuses = _chunkZEPWNT56js.PaymentStatuses; exports.ProductSort = _chunkZEPWNT56js.ProductSort;
|