@behio/storefront-sdk 0.1.10 → 0.2.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-HYKJO2IB.mjs → chunk-EFFPOXWL.mjs} +95 -0
- package/dist/{chunk-QOEYSUF2.js → chunk-R7H7E5BX.js} +95 -0
- package/dist/index.d.mts +163 -1
- package/dist/index.d.ts +163 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/react.d.mts +466 -3
- package/dist/react.d.ts +466 -3
- package/dist/react.js +191 -56
- package/dist/react.mjs +137 -2
- package/package.json +1 -1
|
@@ -102,6 +102,11 @@ 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);
|
|
105
110
|
}
|
|
106
111
|
// --- Public methods ---
|
|
107
112
|
/** Get basic shop info */
|
|
@@ -418,6 +423,10 @@ var CatalogModule = class {
|
|
|
418
423
|
async getProductPromotions(productSlug) {
|
|
419
424
|
return this.client.request("GET", `/catalog/products/${productSlug}/promotions`);
|
|
420
425
|
}
|
|
426
|
+
/** Check a gift card code — returns validity and remaining balance */
|
|
427
|
+
async checkGiftCard(code) {
|
|
428
|
+
return this.client.request("GET", `/catalog/gift-cards/${encodeURIComponent(code)}/check`);
|
|
429
|
+
}
|
|
421
430
|
};
|
|
422
431
|
var AuthModule = class {
|
|
423
432
|
constructor(client) {
|
|
@@ -529,6 +538,20 @@ var CartModule = class {
|
|
|
529
538
|
this.client.emit("cart:cleared");
|
|
530
539
|
return result;
|
|
531
540
|
}
|
|
541
|
+
/** Apply a gift card code to the cart. Balance is deducted at checkout. */
|
|
542
|
+
async applyGiftCard(code) {
|
|
543
|
+
const result = await this.client.request("POST", "/cart/gift-card", {
|
|
544
|
+
body: { code }
|
|
545
|
+
});
|
|
546
|
+
this.client.emit("cart:updated", result);
|
|
547
|
+
return result;
|
|
548
|
+
}
|
|
549
|
+
/** Remove a gift card from the cart */
|
|
550
|
+
async removeGiftCard() {
|
|
551
|
+
const result = await this.client.request("DELETE", "/cart/gift-card");
|
|
552
|
+
this.client.emit("cart:updated", result);
|
|
553
|
+
return result;
|
|
554
|
+
}
|
|
532
555
|
/** Add a bundle to the cart (price is locked at the bundle's current price) */
|
|
533
556
|
async addBundle(bundleId, quantity = 1) {
|
|
534
557
|
const result = await this.client.request("POST", "/cart/bundles", {
|
|
@@ -658,6 +681,78 @@ var PagesModule = class {
|
|
|
658
681
|
return this.client.request("GET", `/pages/${slug}`, { query: { locale } });
|
|
659
682
|
}
|
|
660
683
|
};
|
|
684
|
+
var WishlistModule = class {
|
|
685
|
+
constructor(client) {
|
|
686
|
+
this.client = client;
|
|
687
|
+
}
|
|
688
|
+
async get() {
|
|
689
|
+
return this.client.request("GET", "/customer/wishlist");
|
|
690
|
+
}
|
|
691
|
+
async add(productId) {
|
|
692
|
+
return this.client.request("POST", "/customer/wishlist", { body: { productId } });
|
|
693
|
+
}
|
|
694
|
+
async remove(productId) {
|
|
695
|
+
return this.client.request("DELETE", `/customer/wishlist/${productId}`);
|
|
696
|
+
}
|
|
697
|
+
async isInWishlist(productId) {
|
|
698
|
+
return this.client.request("GET", `/customer/wishlist/${productId}/check`);
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
var ReviewsModule = class {
|
|
702
|
+
constructor(client) {
|
|
703
|
+
this.client = client;
|
|
704
|
+
}
|
|
705
|
+
async getProductReviews(productId, page = 1, limit = 20) {
|
|
706
|
+
return this.client.request("GET", `/catalog/products/${productId}/reviews`, {
|
|
707
|
+
query: { page: String(page), limit: String(limit) }
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
async submit(input) {
|
|
711
|
+
return this.client.request("POST", "/catalog/reviews", { body: input });
|
|
712
|
+
}
|
|
713
|
+
async voteHelpful(reviewId, helpful) {
|
|
714
|
+
return this.client.request("POST", `/catalog/reviews/${reviewId}/vote`, { body: { helpful } });
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
var ReturnsModule = class {
|
|
718
|
+
constructor(client) {
|
|
719
|
+
this.client = client;
|
|
720
|
+
}
|
|
721
|
+
async submit(input) {
|
|
722
|
+
return this.client.request("POST", "/returns", { body: input });
|
|
723
|
+
}
|
|
724
|
+
async getStatus(returnId, email) {
|
|
725
|
+
return this.client.request("GET", `/returns/${returnId}/status`, { query: { email } });
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
var ConsentModule = class {
|
|
729
|
+
constructor(client) {
|
|
730
|
+
this.client = client;
|
|
731
|
+
}
|
|
732
|
+
async record(input) {
|
|
733
|
+
return this.client.request("POST", "/consent", { body: input, auth: false });
|
|
734
|
+
}
|
|
735
|
+
async get(visitorId) {
|
|
736
|
+
return this.client.request("GET", `/consent/${visitorId}`, { auth: false });
|
|
737
|
+
}
|
|
738
|
+
async revoke(visitorId) {
|
|
739
|
+
return this.client.request("DELETE", `/consent/${visitorId}`, { auth: false });
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
var QuotesModule = class {
|
|
743
|
+
constructor(client) {
|
|
744
|
+
this.client = client;
|
|
745
|
+
}
|
|
746
|
+
async submit(input) {
|
|
747
|
+
return this.client.request("POST", "/catalog/quote-request", { body: input });
|
|
748
|
+
}
|
|
749
|
+
async accept(quoteId, email) {
|
|
750
|
+
return this.client.request("POST", `/quotes/${quoteId}/accept`, { body: { email } });
|
|
751
|
+
}
|
|
752
|
+
async getStatus(quoteId) {
|
|
753
|
+
return this.client.request("GET", `/quotes/${quoteId}`);
|
|
754
|
+
}
|
|
755
|
+
};
|
|
661
756
|
|
|
662
757
|
export {
|
|
663
758
|
ProductSort,
|
|
@@ -102,6 +102,11 @@ 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);
|
|
105
110
|
}
|
|
106
111
|
// --- Public methods ---
|
|
107
112
|
/** Get basic shop info */
|
|
@@ -418,6 +423,10 @@ var CatalogModule = class {
|
|
|
418
423
|
async getProductPromotions(productSlug) {
|
|
419
424
|
return this.client.request("GET", `/catalog/products/${productSlug}/promotions`);
|
|
420
425
|
}
|
|
426
|
+
/** Check a gift card code — returns validity and remaining balance */
|
|
427
|
+
async checkGiftCard(code) {
|
|
428
|
+
return this.client.request("GET", `/catalog/gift-cards/${encodeURIComponent(code)}/check`);
|
|
429
|
+
}
|
|
421
430
|
};
|
|
422
431
|
var AuthModule = class {
|
|
423
432
|
constructor(client) {
|
|
@@ -529,6 +538,20 @@ var CartModule = class {
|
|
|
529
538
|
this.client.emit("cart:cleared");
|
|
530
539
|
return result;
|
|
531
540
|
}
|
|
541
|
+
/** Apply a gift card code to the cart. Balance is deducted at checkout. */
|
|
542
|
+
async applyGiftCard(code) {
|
|
543
|
+
const result = await this.client.request("POST", "/cart/gift-card", {
|
|
544
|
+
body: { code }
|
|
545
|
+
});
|
|
546
|
+
this.client.emit("cart:updated", result);
|
|
547
|
+
return result;
|
|
548
|
+
}
|
|
549
|
+
/** Remove a gift card from the cart */
|
|
550
|
+
async removeGiftCard() {
|
|
551
|
+
const result = await this.client.request("DELETE", "/cart/gift-card");
|
|
552
|
+
this.client.emit("cart:updated", result);
|
|
553
|
+
return result;
|
|
554
|
+
}
|
|
532
555
|
/** Add a bundle to the cart (price is locked at the bundle's current price) */
|
|
533
556
|
async addBundle(bundleId, quantity = 1) {
|
|
534
557
|
const result = await this.client.request("POST", "/cart/bundles", {
|
|
@@ -658,6 +681,78 @@ var PagesModule = class {
|
|
|
658
681
|
return this.client.request("GET", `/pages/${slug}`, { query: { locale } });
|
|
659
682
|
}
|
|
660
683
|
};
|
|
684
|
+
var WishlistModule = class {
|
|
685
|
+
constructor(client) {
|
|
686
|
+
this.client = client;
|
|
687
|
+
}
|
|
688
|
+
async get() {
|
|
689
|
+
return this.client.request("GET", "/customer/wishlist");
|
|
690
|
+
}
|
|
691
|
+
async add(productId) {
|
|
692
|
+
return this.client.request("POST", "/customer/wishlist", { body: { productId } });
|
|
693
|
+
}
|
|
694
|
+
async remove(productId) {
|
|
695
|
+
return this.client.request("DELETE", `/customer/wishlist/${productId}`);
|
|
696
|
+
}
|
|
697
|
+
async isInWishlist(productId) {
|
|
698
|
+
return this.client.request("GET", `/customer/wishlist/${productId}/check`);
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
var ReviewsModule = class {
|
|
702
|
+
constructor(client) {
|
|
703
|
+
this.client = client;
|
|
704
|
+
}
|
|
705
|
+
async getProductReviews(productId, page = 1, limit = 20) {
|
|
706
|
+
return this.client.request("GET", `/catalog/products/${productId}/reviews`, {
|
|
707
|
+
query: { page: String(page), limit: String(limit) }
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
async submit(input) {
|
|
711
|
+
return this.client.request("POST", "/catalog/reviews", { body: input });
|
|
712
|
+
}
|
|
713
|
+
async voteHelpful(reviewId, helpful) {
|
|
714
|
+
return this.client.request("POST", `/catalog/reviews/${reviewId}/vote`, { body: { helpful } });
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
var ReturnsModule = class {
|
|
718
|
+
constructor(client) {
|
|
719
|
+
this.client = client;
|
|
720
|
+
}
|
|
721
|
+
async submit(input) {
|
|
722
|
+
return this.client.request("POST", "/returns", { body: input });
|
|
723
|
+
}
|
|
724
|
+
async getStatus(returnId, email) {
|
|
725
|
+
return this.client.request("GET", `/returns/${returnId}/status`, { query: { email } });
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
var ConsentModule = class {
|
|
729
|
+
constructor(client) {
|
|
730
|
+
this.client = client;
|
|
731
|
+
}
|
|
732
|
+
async record(input) {
|
|
733
|
+
return this.client.request("POST", "/consent", { body: input, auth: false });
|
|
734
|
+
}
|
|
735
|
+
async get(visitorId) {
|
|
736
|
+
return this.client.request("GET", `/consent/${visitorId}`, { auth: false });
|
|
737
|
+
}
|
|
738
|
+
async revoke(visitorId) {
|
|
739
|
+
return this.client.request("DELETE", `/consent/${visitorId}`, { auth: false });
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
var QuotesModule = class {
|
|
743
|
+
constructor(client) {
|
|
744
|
+
this.client = client;
|
|
745
|
+
}
|
|
746
|
+
async submit(input) {
|
|
747
|
+
return this.client.request("POST", "/catalog/quote-request", { body: input });
|
|
748
|
+
}
|
|
749
|
+
async accept(quoteId, email) {
|
|
750
|
+
return this.client.request("POST", `/quotes/${quoteId}/accept`, { body: { email } });
|
|
751
|
+
}
|
|
752
|
+
async getStatus(quoteId) {
|
|
753
|
+
return this.client.request("GET", `/quotes/${quoteId}`);
|
|
754
|
+
}
|
|
755
|
+
};
|
|
661
756
|
|
|
662
757
|
|
|
663
758
|
|
package/dist/index.d.mts
CHANGED
|
@@ -436,6 +436,108 @@ interface ActivePromotion {
|
|
|
436
436
|
showCountdown: boolean;
|
|
437
437
|
couponRequired: boolean;
|
|
438
438
|
}
|
|
439
|
+
interface GiftCardBalance {
|
|
440
|
+
valid: boolean;
|
|
441
|
+
balance: number;
|
|
442
|
+
currency: string;
|
|
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
|
+
}
|
|
439
541
|
|
|
440
542
|
declare class BehioStorefront {
|
|
441
543
|
private baseUrl;
|
|
@@ -464,6 +566,11 @@ declare class BehioStorefront {
|
|
|
464
566
|
readonly orders: OrdersModule;
|
|
465
567
|
readonly customer: CustomerModule;
|
|
466
568
|
readonly pages: PagesModule;
|
|
569
|
+
readonly wishlist: WishlistModule;
|
|
570
|
+
readonly reviews: ReviewsModule;
|
|
571
|
+
readonly returns: ReturnsModule;
|
|
572
|
+
readonly consent: ConsentModule;
|
|
573
|
+
readonly quotes: QuotesModule;
|
|
467
574
|
/** Get basic shop info */
|
|
468
575
|
getShopInfo(): Promise<ShopInfo>;
|
|
469
576
|
/** Get SEO metadata for the shop homepage in the given locale (defaults to shop default). */
|
|
@@ -561,6 +668,8 @@ declare class CatalogModule {
|
|
|
561
668
|
getProductPromotions(productSlug: string): Promise<{
|
|
562
669
|
items: ActivePromotion[];
|
|
563
670
|
}>;
|
|
671
|
+
/** Check a gift card code — returns validity and remaining balance */
|
|
672
|
+
checkGiftCard(code: string): Promise<GiftCardBalance>;
|
|
564
673
|
}
|
|
565
674
|
declare class AuthModule {
|
|
566
675
|
private client;
|
|
@@ -597,6 +706,10 @@ declare class CartModule {
|
|
|
597
706
|
removeItem(itemId: string): Promise<Cart>;
|
|
598
707
|
/** Clear entire cart */
|
|
599
708
|
clear(): Promise<void>;
|
|
709
|
+
/** Apply a gift card code to the cart. Balance is deducted at checkout. */
|
|
710
|
+
applyGiftCard(code: string): Promise<Cart>;
|
|
711
|
+
/** Remove a gift card from the cart */
|
|
712
|
+
removeGiftCard(): Promise<Cart>;
|
|
600
713
|
/** Add a bundle to the cart (price is locked at the bundle's current price) */
|
|
601
714
|
addBundle(bundleId: string, quantity?: number): Promise<Cart>;
|
|
602
715
|
/** Update quantity of a bundle already in the cart */
|
|
@@ -661,5 +774,54 @@ declare class PagesModule {
|
|
|
661
774
|
/** Get page by slug */
|
|
662
775
|
get(slug: string, locale?: string): Promise<PageDetail>;
|
|
663
776
|
}
|
|
777
|
+
declare class WishlistModule {
|
|
778
|
+
private client;
|
|
779
|
+
constructor(client: BehioStorefront);
|
|
780
|
+
get(): Promise<{
|
|
781
|
+
items: WishlistItem[];
|
|
782
|
+
}>;
|
|
783
|
+
add(productId: string): Promise<{
|
|
784
|
+
success: boolean;
|
|
785
|
+
}>;
|
|
786
|
+
remove(productId: string): Promise<{
|
|
787
|
+
success: boolean;
|
|
788
|
+
}>;
|
|
789
|
+
isInWishlist(productId: string): Promise<{
|
|
790
|
+
inWishlist: boolean;
|
|
791
|
+
}>;
|
|
792
|
+
}
|
|
793
|
+
declare class ReviewsModule {
|
|
794
|
+
private client;
|
|
795
|
+
constructor(client: BehioStorefront);
|
|
796
|
+
getProductReviews(productId: string, page?: number, limit?: number): Promise<ProductReviewsResponse>;
|
|
797
|
+
submit(input: SubmitReviewInput): Promise<{
|
|
798
|
+
id: string;
|
|
799
|
+
}>;
|
|
800
|
+
voteHelpful(reviewId: string, helpful: boolean): Promise<{
|
|
801
|
+
success: boolean;
|
|
802
|
+
}>;
|
|
803
|
+
}
|
|
804
|
+
declare class ReturnsModule {
|
|
805
|
+
private client;
|
|
806
|
+
constructor(client: BehioStorefront);
|
|
807
|
+
submit(input: SubmitReturnInput): Promise<ReturnRequest>;
|
|
808
|
+
getStatus(returnId: string, email: string): Promise<ReturnRequest>;
|
|
809
|
+
}
|
|
810
|
+
declare class ConsentModule {
|
|
811
|
+
private client;
|
|
812
|
+
constructor(client: BehioStorefront);
|
|
813
|
+
record(input: CookieConsentInput): Promise<CookieConsent>;
|
|
814
|
+
get(visitorId: string): Promise<CookieConsent | null>;
|
|
815
|
+
revoke(visitorId: string): Promise<{
|
|
816
|
+
success: boolean;
|
|
817
|
+
}>;
|
|
818
|
+
}
|
|
819
|
+
declare class QuotesModule {
|
|
820
|
+
private client;
|
|
821
|
+
constructor(client: BehioStorefront);
|
|
822
|
+
submit(input: SubmitQuoteInput): Promise<QuoteRequest>;
|
|
823
|
+
accept(quoteId: string, email: string): Promise<QuoteRequest>;
|
|
824
|
+
getStatus(quoteId: string): Promise<QuoteRequest>;
|
|
825
|
+
}
|
|
664
826
|
|
|
665
|
-
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 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 };
|
|
827
|
+
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 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
|
@@ -436,6 +436,108 @@ interface ActivePromotion {
|
|
|
436
436
|
showCountdown: boolean;
|
|
437
437
|
couponRequired: boolean;
|
|
438
438
|
}
|
|
439
|
+
interface GiftCardBalance {
|
|
440
|
+
valid: boolean;
|
|
441
|
+
balance: number;
|
|
442
|
+
currency: string;
|
|
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
|
+
}
|
|
439
541
|
|
|
440
542
|
declare class BehioStorefront {
|
|
441
543
|
private baseUrl;
|
|
@@ -464,6 +566,11 @@ declare class BehioStorefront {
|
|
|
464
566
|
readonly orders: OrdersModule;
|
|
465
567
|
readonly customer: CustomerModule;
|
|
466
568
|
readonly pages: PagesModule;
|
|
569
|
+
readonly wishlist: WishlistModule;
|
|
570
|
+
readonly reviews: ReviewsModule;
|
|
571
|
+
readonly returns: ReturnsModule;
|
|
572
|
+
readonly consent: ConsentModule;
|
|
573
|
+
readonly quotes: QuotesModule;
|
|
467
574
|
/** Get basic shop info */
|
|
468
575
|
getShopInfo(): Promise<ShopInfo>;
|
|
469
576
|
/** Get SEO metadata for the shop homepage in the given locale (defaults to shop default). */
|
|
@@ -561,6 +668,8 @@ declare class CatalogModule {
|
|
|
561
668
|
getProductPromotions(productSlug: string): Promise<{
|
|
562
669
|
items: ActivePromotion[];
|
|
563
670
|
}>;
|
|
671
|
+
/** Check a gift card code — returns validity and remaining balance */
|
|
672
|
+
checkGiftCard(code: string): Promise<GiftCardBalance>;
|
|
564
673
|
}
|
|
565
674
|
declare class AuthModule {
|
|
566
675
|
private client;
|
|
@@ -597,6 +706,10 @@ declare class CartModule {
|
|
|
597
706
|
removeItem(itemId: string): Promise<Cart>;
|
|
598
707
|
/** Clear entire cart */
|
|
599
708
|
clear(): Promise<void>;
|
|
709
|
+
/** Apply a gift card code to the cart. Balance is deducted at checkout. */
|
|
710
|
+
applyGiftCard(code: string): Promise<Cart>;
|
|
711
|
+
/** Remove a gift card from the cart */
|
|
712
|
+
removeGiftCard(): Promise<Cart>;
|
|
600
713
|
/** Add a bundle to the cart (price is locked at the bundle's current price) */
|
|
601
714
|
addBundle(bundleId: string, quantity?: number): Promise<Cart>;
|
|
602
715
|
/** Update quantity of a bundle already in the cart */
|
|
@@ -661,5 +774,54 @@ declare class PagesModule {
|
|
|
661
774
|
/** Get page by slug */
|
|
662
775
|
get(slug: string, locale?: string): Promise<PageDetail>;
|
|
663
776
|
}
|
|
777
|
+
declare class WishlistModule {
|
|
778
|
+
private client;
|
|
779
|
+
constructor(client: BehioStorefront);
|
|
780
|
+
get(): Promise<{
|
|
781
|
+
items: WishlistItem[];
|
|
782
|
+
}>;
|
|
783
|
+
add(productId: string): Promise<{
|
|
784
|
+
success: boolean;
|
|
785
|
+
}>;
|
|
786
|
+
remove(productId: string): Promise<{
|
|
787
|
+
success: boolean;
|
|
788
|
+
}>;
|
|
789
|
+
isInWishlist(productId: string): Promise<{
|
|
790
|
+
inWishlist: boolean;
|
|
791
|
+
}>;
|
|
792
|
+
}
|
|
793
|
+
declare class ReviewsModule {
|
|
794
|
+
private client;
|
|
795
|
+
constructor(client: BehioStorefront);
|
|
796
|
+
getProductReviews(productId: string, page?: number, limit?: number): Promise<ProductReviewsResponse>;
|
|
797
|
+
submit(input: SubmitReviewInput): Promise<{
|
|
798
|
+
id: string;
|
|
799
|
+
}>;
|
|
800
|
+
voteHelpful(reviewId: string, helpful: boolean): Promise<{
|
|
801
|
+
success: boolean;
|
|
802
|
+
}>;
|
|
803
|
+
}
|
|
804
|
+
declare class ReturnsModule {
|
|
805
|
+
private client;
|
|
806
|
+
constructor(client: BehioStorefront);
|
|
807
|
+
submit(input: SubmitReturnInput): Promise<ReturnRequest>;
|
|
808
|
+
getStatus(returnId: string, email: string): Promise<ReturnRequest>;
|
|
809
|
+
}
|
|
810
|
+
declare class ConsentModule {
|
|
811
|
+
private client;
|
|
812
|
+
constructor(client: BehioStorefront);
|
|
813
|
+
record(input: CookieConsentInput): Promise<CookieConsent>;
|
|
814
|
+
get(visitorId: string): Promise<CookieConsent | null>;
|
|
815
|
+
revoke(visitorId: string): Promise<{
|
|
816
|
+
success: boolean;
|
|
817
|
+
}>;
|
|
818
|
+
}
|
|
819
|
+
declare class QuotesModule {
|
|
820
|
+
private client;
|
|
821
|
+
constructor(client: BehioStorefront);
|
|
822
|
+
submit(input: SubmitQuoteInput): Promise<QuoteRequest>;
|
|
823
|
+
accept(quoteId: string, email: string): Promise<QuoteRequest>;
|
|
824
|
+
getStatus(quoteId: string): Promise<QuoteRequest>;
|
|
825
|
+
}
|
|
664
826
|
|
|
665
|
-
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 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 };
|
|
827
|
+
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 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 _chunkR7H7E5BXjs = require('./chunk-R7H7E5BX.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -17,4 +17,4 @@ var _chunkQOEYSUF2js = require('./chunk-QOEYSUF2.js');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
exports.AddressTypes =
|
|
20
|
+
exports.AddressTypes = _chunkR7H7E5BXjs.AddressTypes; exports.BehioApiError = _chunkR7H7E5BXjs.BehioApiError; exports.BehioNetworkError = _chunkR7H7E5BXjs.BehioNetworkError; exports.BehioStorefront = _chunkR7H7E5BXjs.BehioStorefront; exports.FulfillmentStatuses = _chunkR7H7E5BXjs.FulfillmentStatuses; exports.OrderStatuses = _chunkR7H7E5BXjs.OrderStatuses; exports.PaymentStatuses = _chunkR7H7E5BXjs.PaymentStatuses; exports.ProductSort = _chunkR7H7E5BXjs.ProductSort;
|