@behio/storefront-sdk 0.27.0 → 0.30.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-HOL6WRHR.js → chunk-NG46DR3A.js} +59 -9
- package/dist/{chunk-O5UHKZPG.mjs → chunk-O7HDB5R4.mjs} +53 -3
- package/dist/{client-DL533jvY.d.mts → client-CJ_CoUIh.d.mts} +286 -3
- package/dist/{client-DL533jvY.d.ts → client-CJ_CoUIh.d.ts} +286 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/next.d.mts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +2 -2
- package/dist/next.mjs +1 -1
- package/dist/react.d.mts +47 -3
- package/dist/react.d.ts +47 -3
- package/dist/react.js +100 -43
- package/dist/react.mjs +109 -52
- package/package.json +3 -3
|
@@ -146,6 +146,7 @@ var BehioStorefront = class {
|
|
|
146
146
|
this.quotes = new QuotesModule(this);
|
|
147
147
|
this.addresses = new AddressModule(this);
|
|
148
148
|
this.shipping = new ShippingModule(this);
|
|
149
|
+
this.newsletter = new NewsletterModule(this);
|
|
149
150
|
}
|
|
150
151
|
// --- Public methods ---
|
|
151
152
|
/**
|
|
@@ -589,11 +590,18 @@ var CatalogModule = class {
|
|
|
589
590
|
query: { locale: _optionalChain([options, 'optionalAccess', _25 => _25.locale]), currency: _optionalChain([options, 'optionalAccess', _26 => _26.currency]) }
|
|
590
591
|
});
|
|
591
592
|
}
|
|
592
|
-
/**
|
|
593
|
-
|
|
593
|
+
/**
|
|
594
|
+
* Cross-sell / related / upsell products for a product. Returns three
|
|
595
|
+
* separate lists: `related` (podobné produkty), `upsell` (dražší
|
|
596
|
+
* alternativy) and `crossSell` (doporučené k nákupu). Items are localized
|
|
597
|
+
* and priced in the requested currency, ready to render with the same card
|
|
598
|
+
* component as `getFeatured` / `getProductGroup`.
|
|
599
|
+
*/
|
|
600
|
+
async getCrossSell(productSlug, options) {
|
|
594
601
|
return this.client.request(
|
|
595
602
|
"GET",
|
|
596
|
-
`/catalog/products/${productSlug}/cross-sell
|
|
603
|
+
`/catalog/products/${encodeURIComponent(productSlug)}/cross-sell`,
|
|
604
|
+
{ query: { locale: _optionalChain([options, 'optionalAccess', _27 => _27.locale]), currency: _optionalChain([options, 'optionalAccess', _28 => _28.currency]) } }
|
|
597
605
|
);
|
|
598
606
|
}
|
|
599
607
|
/** Active promotions applicable to a product (with countdown end time) */
|
|
@@ -615,7 +623,7 @@ var CatalogModule = class {
|
|
|
615
623
|
/** List configured payment methods (filtered by currency). */
|
|
616
624
|
async listPaymentMethods(opts) {
|
|
617
625
|
const query = {};
|
|
618
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
626
|
+
if (_optionalChain([opts, 'optionalAccess', _29 => _29.currency])) query.currency = opts.currency;
|
|
619
627
|
return this.client.request("GET", "/catalog/payment-methods", { query });
|
|
620
628
|
}
|
|
621
629
|
};
|
|
@@ -861,7 +869,7 @@ var OrdersModule = class {
|
|
|
861
869
|
/** List customer orders (requires auth) */
|
|
862
870
|
async list(options) {
|
|
863
871
|
return this.client.request("GET", "/orders", {
|
|
864
|
-
query: { page: _optionalChain([options, 'optionalAccess',
|
|
872
|
+
query: { page: _optionalChain([options, 'optionalAccess', _30 => _30.page]), limit: _optionalChain([options, 'optionalAccess', _31 => _31.limit]) }
|
|
865
873
|
});
|
|
866
874
|
}
|
|
867
875
|
/** Get order detail (requires auth) */
|
|
@@ -951,6 +959,14 @@ var CustomerModule = class {
|
|
|
951
959
|
async deleteAddress(addressId) {
|
|
952
960
|
return this.client.request("DELETE", `/customer/addresses/${addressId}`);
|
|
953
961
|
}
|
|
962
|
+
/**
|
|
963
|
+
* Loyalty program summary for the logged-in customer (points balance +
|
|
964
|
+
* value, current tier, next-tier progress, point ratio, referral code,
|
|
965
|
+
* recent transactions). Requires an authenticated customer session.
|
|
966
|
+
*/
|
|
967
|
+
async getLoyalty() {
|
|
968
|
+
return this.client.request("GET", "/customer/loyalty");
|
|
969
|
+
}
|
|
954
970
|
};
|
|
955
971
|
var PagesModule = class {
|
|
956
972
|
constructor(client) {
|
|
@@ -1084,10 +1100,10 @@ var ShippingModule = class {
|
|
|
1084
1100
|
*/
|
|
1085
1101
|
async listMethods(opts) {
|
|
1086
1102
|
const query = {};
|
|
1087
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
1088
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
1089
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
1090
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
1103
|
+
if (_optionalChain([opts, 'optionalAccess', _32 => _32.currency])) query.currency = opts.currency;
|
|
1104
|
+
if (_optionalChain([opts, 'optionalAccess', _33 => _33.country])) query.country = opts.country;
|
|
1105
|
+
if (_optionalChain([opts, 'optionalAccess', _34 => _34.cartTotal]) != null) query.cartTotal = String(opts.cartTotal);
|
|
1106
|
+
if (_optionalChain([opts, 'optionalAccess', _35 => _35.cartWeightKg]) != null) query.cartWeightKg = String(opts.cartWeightKg);
|
|
1091
1107
|
return this.client.request(
|
|
1092
1108
|
"GET",
|
|
1093
1109
|
"/catalog/shipping-methods",
|
|
@@ -1114,6 +1130,40 @@ var ShippingModule = class {
|
|
|
1114
1130
|
{ body: input }
|
|
1115
1131
|
);
|
|
1116
1132
|
}
|
|
1133
|
+
/**
|
|
1134
|
+
* List pickup points (parcel shops / lockers) for a method that has
|
|
1135
|
+
* `supportsPickupPoints`. Filter with `query` (name / city / zip) for a
|
|
1136
|
+
* "find your branch" box. Send the chosen point's `externalId` back as
|
|
1137
|
+
* `checkout.pickupPointId`.
|
|
1138
|
+
*/
|
|
1139
|
+
async getPickupPoints(input) {
|
|
1140
|
+
const query = { methodId: input.methodId };
|
|
1141
|
+
if (input.query) query.query = input.query;
|
|
1142
|
+
if (input.country) query.country = input.country;
|
|
1143
|
+
if (input.limit != null) query.limit = String(input.limit);
|
|
1144
|
+
return this.client.request(
|
|
1145
|
+
"GET",
|
|
1146
|
+
"/catalog/shipping/pickup-points",
|
|
1147
|
+
{ query }
|
|
1148
|
+
);
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
var NewsletterModule = class {
|
|
1152
|
+
constructor(client) {
|
|
1153
|
+
this.client = client;
|
|
1154
|
+
}
|
|
1155
|
+
async subscribe(input) {
|
|
1156
|
+
return this.client.request("POST", "/newsletter/subscribe", {
|
|
1157
|
+
body: input,
|
|
1158
|
+
auth: false
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
async unsubscribe(email) {
|
|
1162
|
+
return this.client.request("POST", "/newsletter/unsubscribe", {
|
|
1163
|
+
body: { email },
|
|
1164
|
+
auth: false
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1117
1167
|
};
|
|
1118
1168
|
|
|
1119
1169
|
|
|
@@ -146,6 +146,7 @@ var BehioStorefront = class {
|
|
|
146
146
|
this.quotes = new QuotesModule(this);
|
|
147
147
|
this.addresses = new AddressModule(this);
|
|
148
148
|
this.shipping = new ShippingModule(this);
|
|
149
|
+
this.newsletter = new NewsletterModule(this);
|
|
149
150
|
}
|
|
150
151
|
// --- Public methods ---
|
|
151
152
|
/**
|
|
@@ -589,11 +590,18 @@ var CatalogModule = class {
|
|
|
589
590
|
query: { locale: options?.locale, currency: options?.currency }
|
|
590
591
|
});
|
|
591
592
|
}
|
|
592
|
-
/**
|
|
593
|
-
|
|
593
|
+
/**
|
|
594
|
+
* Cross-sell / related / upsell products for a product. Returns three
|
|
595
|
+
* separate lists: `related` (podobné produkty), `upsell` (dražší
|
|
596
|
+
* alternativy) and `crossSell` (doporučené k nákupu). Items are localized
|
|
597
|
+
* and priced in the requested currency, ready to render with the same card
|
|
598
|
+
* component as `getFeatured` / `getProductGroup`.
|
|
599
|
+
*/
|
|
600
|
+
async getCrossSell(productSlug, options) {
|
|
594
601
|
return this.client.request(
|
|
595
602
|
"GET",
|
|
596
|
-
`/catalog/products/${productSlug}/cross-sell
|
|
603
|
+
`/catalog/products/${encodeURIComponent(productSlug)}/cross-sell`,
|
|
604
|
+
{ query: { locale: options?.locale, currency: options?.currency } }
|
|
597
605
|
);
|
|
598
606
|
}
|
|
599
607
|
/** Active promotions applicable to a product (with countdown end time) */
|
|
@@ -951,6 +959,14 @@ var CustomerModule = class {
|
|
|
951
959
|
async deleteAddress(addressId) {
|
|
952
960
|
return this.client.request("DELETE", `/customer/addresses/${addressId}`);
|
|
953
961
|
}
|
|
962
|
+
/**
|
|
963
|
+
* Loyalty program summary for the logged-in customer (points balance +
|
|
964
|
+
* value, current tier, next-tier progress, point ratio, referral code,
|
|
965
|
+
* recent transactions). Requires an authenticated customer session.
|
|
966
|
+
*/
|
|
967
|
+
async getLoyalty() {
|
|
968
|
+
return this.client.request("GET", "/customer/loyalty");
|
|
969
|
+
}
|
|
954
970
|
};
|
|
955
971
|
var PagesModule = class {
|
|
956
972
|
constructor(client) {
|
|
@@ -1114,6 +1130,40 @@ var ShippingModule = class {
|
|
|
1114
1130
|
{ body: input }
|
|
1115
1131
|
);
|
|
1116
1132
|
}
|
|
1133
|
+
/**
|
|
1134
|
+
* List pickup points (parcel shops / lockers) for a method that has
|
|
1135
|
+
* `supportsPickupPoints`. Filter with `query` (name / city / zip) for a
|
|
1136
|
+
* "find your branch" box. Send the chosen point's `externalId` back as
|
|
1137
|
+
* `checkout.pickupPointId`.
|
|
1138
|
+
*/
|
|
1139
|
+
async getPickupPoints(input) {
|
|
1140
|
+
const query = { methodId: input.methodId };
|
|
1141
|
+
if (input.query) query.query = input.query;
|
|
1142
|
+
if (input.country) query.country = input.country;
|
|
1143
|
+
if (input.limit != null) query.limit = String(input.limit);
|
|
1144
|
+
return this.client.request(
|
|
1145
|
+
"GET",
|
|
1146
|
+
"/catalog/shipping/pickup-points",
|
|
1147
|
+
{ query }
|
|
1148
|
+
);
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
var NewsletterModule = class {
|
|
1152
|
+
constructor(client) {
|
|
1153
|
+
this.client = client;
|
|
1154
|
+
}
|
|
1155
|
+
async subscribe(input) {
|
|
1156
|
+
return this.client.request("POST", "/newsletter/subscribe", {
|
|
1157
|
+
body: input,
|
|
1158
|
+
auth: false
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
async unsubscribe(email) {
|
|
1162
|
+
return this.client.request("POST", "/newsletter/unsubscribe", {
|
|
1163
|
+
body: { email },
|
|
1164
|
+
auth: false
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1117
1167
|
};
|
|
1118
1168
|
|
|
1119
1169
|
export {
|
|
@@ -34,6 +34,53 @@ interface PaginatedResponse<T> {
|
|
|
34
34
|
interface MessageResponse {
|
|
35
35
|
message: string;
|
|
36
36
|
}
|
|
37
|
+
/** How the shop wants the newsletter opt-in rendered at checkout. */
|
|
38
|
+
type NewsletterOptInDefault = "CHECKED" | "UNCHECKED" | "HIDDEN";
|
|
39
|
+
/** How sold-out products behave in the catalog. */
|
|
40
|
+
type StockBehavior = "HIDE" | "BACKORDER" | "SHOW_SOLD_OUT";
|
|
41
|
+
/**
|
|
42
|
+
* Merchant-configured checkout & cart rules the storefront MUST honour so the
|
|
43
|
+
* shop behaves exactly as it was configured in the admin. Mirrors the backend
|
|
44
|
+
* Eshop settings; the server also enforces the enforceable rules, so these are
|
|
45
|
+
* for UX (render required fields, consent checkboxes, cart limits, free-shipping
|
|
46
|
+
* progress) rather than a security boundary.
|
|
47
|
+
*/
|
|
48
|
+
interface CheckoutSettings {
|
|
49
|
+
/** Guests may order without an account (also on ShopInfo for back-compat). */
|
|
50
|
+
allowGuestCheckout: boolean;
|
|
51
|
+
/** Checkout requires a logged-in / registered account. */
|
|
52
|
+
requireAccount: boolean;
|
|
53
|
+
/** New registrations wait for merchant approval before ordering (B2B). */
|
|
54
|
+
requireRegistrationApproval: boolean;
|
|
55
|
+
/** Phone number is a required checkout field. */
|
|
56
|
+
requirePhone: boolean;
|
|
57
|
+
/** Tax id (IČO/DIČ) is a required checkout field. */
|
|
58
|
+
requireTaxId: boolean;
|
|
59
|
+
/** Customer may leave an order note. */
|
|
60
|
+
allowOrderNote: boolean;
|
|
61
|
+
/** Discount / coupon codes may be applied in the cart. */
|
|
62
|
+
allowDiscountCodes: boolean;
|
|
63
|
+
/** Terms & conditions consent checkbox is required to place an order. */
|
|
64
|
+
requireTermsConsent: boolean;
|
|
65
|
+
/** GDPR / privacy consent checkbox is required to place an order. */
|
|
66
|
+
requireGdprConsent: boolean;
|
|
67
|
+
/** Default state of the newsletter opt-in on the checkout (or hide it). */
|
|
68
|
+
newsletterOptInDefault: NewsletterOptInDefault;
|
|
69
|
+
/** Minimum order value in the shop default currency, or null when unset. */
|
|
70
|
+
minOrderValue: number | null;
|
|
71
|
+
/** Maximum order value in the shop default currency, or null when unset. */
|
|
72
|
+
maxOrderValue: number | null;
|
|
73
|
+
/** Free-shipping threshold (shop default currency) for the cart progress bar. */
|
|
74
|
+
freeShippingThreshold: number | null;
|
|
75
|
+
/** Minimum number of items required in the cart to check out. */
|
|
76
|
+
minItemsInCart: number;
|
|
77
|
+
/** Maximum quantity of a single product per order, or null when unlimited. */
|
|
78
|
+
maxItemsPerProduct: number | null;
|
|
79
|
+
/** How sold-out products behave (HIDE / BACKORDER / SHOW_SOLD_OUT). */
|
|
80
|
+
stockBehavior: StockBehavior;
|
|
81
|
+
/** Google Places address autocomplete is enabled; mount the UX when true. */
|
|
82
|
+
addressAutocompleteEnabled: boolean;
|
|
83
|
+
}
|
|
37
84
|
interface ShopInfo {
|
|
38
85
|
id: string;
|
|
39
86
|
name: string;
|
|
@@ -48,6 +95,33 @@ interface ShopInfo {
|
|
|
48
95
|
metaTitle?: string;
|
|
49
96
|
metaDescription?: string;
|
|
50
97
|
allowGuestCheckout: boolean;
|
|
98
|
+
/** Shop runs in B2B / wholesale mode (unlocks B2B-oriented UX). */
|
|
99
|
+
b2bMode: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Whether quote requests ("Poptat množstevní cenu") make sense for this shop.
|
|
102
|
+
* Currently follows B2B mode. Gate the request-quote CTA on this flag rather
|
|
103
|
+
* than hardcoded template config.
|
|
104
|
+
*/
|
|
105
|
+
quotesEnabled: boolean;
|
|
106
|
+
/** Full merchant checkout & cart contract. Honour these in cart + checkout. */
|
|
107
|
+
checkout: CheckoutSettings;
|
|
108
|
+
}
|
|
109
|
+
interface NewsletterSubscribeInput {
|
|
110
|
+
email: string;
|
|
111
|
+
/** Preferred locale (ISO-639-1) captured at signup. */
|
|
112
|
+
locale?: string;
|
|
113
|
+
/** Where the opt-in came from, e.g. "footer" or "checkout". */
|
|
114
|
+
source?: string;
|
|
115
|
+
/** Honeypot: keep empty. A filled value is treated as a bot and ignored. */
|
|
116
|
+
website?: string;
|
|
117
|
+
}
|
|
118
|
+
interface NewsletterSubscribeResult {
|
|
119
|
+
success: boolean;
|
|
120
|
+
/** True when this email was already an active subscriber. */
|
|
121
|
+
alreadySubscribed: boolean;
|
|
122
|
+
}
|
|
123
|
+
interface NewsletterUnsubscribeResult {
|
|
124
|
+
success: boolean;
|
|
51
125
|
}
|
|
52
126
|
interface ShopSeo {
|
|
53
127
|
locale: string;
|
|
@@ -455,6 +529,15 @@ interface CartDiscount {
|
|
|
455
529
|
type: string;
|
|
456
530
|
value: number;
|
|
457
531
|
}
|
|
532
|
+
/** One automatically applied promotion, surfaced as a discount line on the cart.
|
|
533
|
+
* Covers PERCENTAGE / FIXED_AMOUNT / BUY_X_GET_Y promos; the amount is already
|
|
534
|
+
* netted into `grandTotal`. */
|
|
535
|
+
interface CartPromotion {
|
|
536
|
+
slug: string;
|
|
537
|
+
name: string;
|
|
538
|
+
/** Total money saved on the cart by this promotion. */
|
|
539
|
+
discountAmount: number;
|
|
540
|
+
}
|
|
458
541
|
interface Cart {
|
|
459
542
|
id: string;
|
|
460
543
|
sessionToken?: string;
|
|
@@ -462,6 +545,10 @@ interface Cart {
|
|
|
462
545
|
subtotal: number;
|
|
463
546
|
discountTotal: number;
|
|
464
547
|
discount?: CartDiscount;
|
|
548
|
+
/** Auto-apply promotion discount lines (sale/BOGO). */
|
|
549
|
+
appliedPromotions: CartPromotion[];
|
|
550
|
+
/** Sum of `appliedPromotions[].discountAmount`; already reflected in `grandTotal`. */
|
|
551
|
+
promotionDiscountTotal: number;
|
|
465
552
|
grandTotal: number;
|
|
466
553
|
currency: string;
|
|
467
554
|
itemCount: number;
|
|
@@ -511,6 +598,12 @@ interface CheckoutAddress {
|
|
|
511
598
|
firstName: string;
|
|
512
599
|
lastName: string;
|
|
513
600
|
company?: string;
|
|
601
|
+
/** Company registration number (IČO). Required when `ShopInfo.checkout`
|
|
602
|
+
* requires tax ids; loosely validated (6-12 digits). */
|
|
603
|
+
companyId?: string;
|
|
604
|
+
/** VAT id (DIČ). Required alongside `companyId` when tax ids are required;
|
|
605
|
+
* loosely validated (optional 2-letter country prefix + 6-12 digits). */
|
|
606
|
+
vatId?: string;
|
|
514
607
|
street: string;
|
|
515
608
|
city: string;
|
|
516
609
|
zip: string;
|
|
@@ -529,6 +622,15 @@ interface CheckoutInput {
|
|
|
529
622
|
email: string;
|
|
530
623
|
phone?: string;
|
|
531
624
|
customerNote?: string;
|
|
625
|
+
/**
|
|
626
|
+
* Legal / marketing consent echoed from the checkout checkboxes. Render the
|
|
627
|
+
* boxes from `ShopInfo.checkout` (requireTermsConsent / requireGdprConsent /
|
|
628
|
+
* newsletterOptInDefault) and send the customer's choice. The backend rejects
|
|
629
|
+
* the order when a required consent is not `true`.
|
|
630
|
+
*/
|
|
631
|
+
termsConsent?: boolean;
|
|
632
|
+
gdprConsent?: boolean;
|
|
633
|
+
newsletterOptIn?: boolean;
|
|
532
634
|
/**
|
|
533
635
|
* Chosen shipping method. Required whenever the eshop has at least one
|
|
534
636
|
* enabled shipping method — the backend rejects the order without it.
|
|
@@ -542,7 +644,19 @@ interface CheckoutInput {
|
|
|
542
644
|
* or foreign quote is rejected.
|
|
543
645
|
*/
|
|
544
646
|
shippingQuoteId?: string;
|
|
647
|
+
/**
|
|
648
|
+
* Chosen pickup point `externalId` from `shipping.getPickupPoints()`.
|
|
649
|
+
* REQUIRED when the resolved shipping method has `supportsPickupPoints`;
|
|
650
|
+
* the backend rejects the order without it. Snapshotted onto the order.
|
|
651
|
+
*/
|
|
652
|
+
pickupPointId?: string;
|
|
545
653
|
paymentMethodId?: string;
|
|
654
|
+
/**
|
|
655
|
+
* Loyalty points to redeem on this order. Validated server-side against the
|
|
656
|
+
* customer's actual balance and the program's redemption cap; ignored for
|
|
657
|
+
* guests. See `customer.getLoyalty()` for the available balance.
|
|
658
|
+
*/
|
|
659
|
+
redeemLoyaltyPoints?: number;
|
|
546
660
|
}
|
|
547
661
|
type OrderStatus = (typeof OrderStatuses)[keyof typeof OrderStatuses];
|
|
548
662
|
type PaymentStatus = (typeof PaymentStatuses)[keyof typeof PaymentStatuses];
|
|
@@ -869,14 +983,144 @@ interface ShippingQuote extends ShippingMethodSummary {
|
|
|
869
983
|
/** Quote expiry (epoch ms). Null for fixed-price methods. */
|
|
870
984
|
expiresAt: number | null;
|
|
871
985
|
}
|
|
986
|
+
/**
|
|
987
|
+
* A pickup point (parcel shop / locker) for a shipping method with
|
|
988
|
+
* `supportsPickupPoints`. Fetch with `behio.shipping.getPickupPoints()`,
|
|
989
|
+
* then send the chosen `externalId` as `checkout.pickupPointId`.
|
|
990
|
+
*/
|
|
991
|
+
interface PickupPoint {
|
|
992
|
+
/** Carrier-native id. Send this back as `checkout.pickupPointId`. */
|
|
993
|
+
externalId: string;
|
|
994
|
+
name: string;
|
|
995
|
+
street: string | null;
|
|
996
|
+
city: string;
|
|
997
|
+
zip: string;
|
|
998
|
+
country: string;
|
|
999
|
+
latitude: number | null;
|
|
1000
|
+
longitude: number | null;
|
|
1001
|
+
cashOnDelivery: boolean;
|
|
1002
|
+
cardPayment: boolean;
|
|
1003
|
+
/** Per-day opening hours; empty when the provider gives none. */
|
|
1004
|
+
openingHours: PickupPointHours[];
|
|
1005
|
+
}
|
|
1006
|
+
/** One day's opening-hours block for a pickup point. */
|
|
1007
|
+
interface PickupPointHours {
|
|
1008
|
+
/** Provider-native day key (e.g. weekday name or index). */
|
|
1009
|
+
day: string;
|
|
1010
|
+
/** Morning open time. */
|
|
1011
|
+
from1: string | null;
|
|
1012
|
+
/** Morning close time. */
|
|
1013
|
+
to1: string | null;
|
|
1014
|
+
/** Afternoon open time. */
|
|
1015
|
+
from2: string | null;
|
|
1016
|
+
/** Afternoon close time. */
|
|
1017
|
+
to2: string | null;
|
|
1018
|
+
}
|
|
1019
|
+
/** Input for `behio.shipping.getPickupPoints()`. */
|
|
1020
|
+
interface PickupPointsInput {
|
|
1021
|
+
/** Shipping method id (must have `supportsPickupPoints`). */
|
|
1022
|
+
methodId: string;
|
|
1023
|
+
/** Free-text search over name / city / zip. */
|
|
1024
|
+
query?: string;
|
|
1025
|
+
/** ISO 3166-1 alpha-2 country filter; defaults to the method's first
|
|
1026
|
+
* allowed country or CZ. */
|
|
1027
|
+
country?: string;
|
|
1028
|
+
/** Max results (default 30, capped at 100). */
|
|
1029
|
+
limit?: number;
|
|
1030
|
+
}
|
|
1031
|
+
/** Public terms of the eshop's loyalty program. */
|
|
1032
|
+
interface LoyaltyProgram {
|
|
1033
|
+
name: string;
|
|
1034
|
+
pointName: string;
|
|
1035
|
+
pointNamePlural: string;
|
|
1036
|
+
/** 1 point = `pointValueRatio` currency units. */
|
|
1037
|
+
pointValueRatio: number;
|
|
1038
|
+
currency: string;
|
|
1039
|
+
minRedemptionPoints: number;
|
|
1040
|
+
maxRedemptionPercent: number;
|
|
1041
|
+
combineWithDiscounts: boolean;
|
|
1042
|
+
description: string | null;
|
|
1043
|
+
iconUrl: string | null;
|
|
1044
|
+
}
|
|
1045
|
+
interface LoyaltyBalance {
|
|
1046
|
+
currentPoints: number;
|
|
1047
|
+
/** `currentPoints` valued in the program currency. */
|
|
1048
|
+
currentPointsValue: number;
|
|
1049
|
+
lifetimePointsEarned: number;
|
|
1050
|
+
lifetimePointsRedeemed: number;
|
|
1051
|
+
lifetimeSpend: number;
|
|
1052
|
+
}
|
|
1053
|
+
interface LoyaltyTier {
|
|
1054
|
+
name: string;
|
|
1055
|
+
slug: string;
|
|
1056
|
+
color: string | null;
|
|
1057
|
+
earnMultiplier: number;
|
|
1058
|
+
/** Tier perks (human-readable perk lines), or null when the tier has none. */
|
|
1059
|
+
perks: LoyaltyTierPerks | null;
|
|
1060
|
+
}
|
|
1061
|
+
/** Perks attached to a loyalty tier. */
|
|
1062
|
+
interface LoyaltyTierPerks {
|
|
1063
|
+
/** Human-readable perk lines shown on the tier. */
|
|
1064
|
+
list: string[];
|
|
1065
|
+
}
|
|
1066
|
+
interface LoyaltyNextTier {
|
|
1067
|
+
name: string;
|
|
1068
|
+
slug: string;
|
|
1069
|
+
color: string | null;
|
|
1070
|
+
thresholdType: string;
|
|
1071
|
+
thresholdValue: number;
|
|
1072
|
+
currentValue: number;
|
|
1073
|
+
remaining: number;
|
|
1074
|
+
/** 0-100 progress toward this tier. */
|
|
1075
|
+
progressPercent: number;
|
|
1076
|
+
}
|
|
1077
|
+
interface LoyaltyTransaction {
|
|
1078
|
+
type: string;
|
|
1079
|
+
/** Positive = earned, negative = redeemed / expired. */
|
|
1080
|
+
points: number;
|
|
1081
|
+
balanceAfter: number;
|
|
1082
|
+
eventType: string | null;
|
|
1083
|
+
description: string | null;
|
|
1084
|
+
createdAt: number;
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Loyalty summary for the logged-in customer. `hasProgram` is false when the
|
|
1088
|
+
* eshop runs no program; `enrolled` is false when the customer has not yet
|
|
1089
|
+
* joined (then `program` still carries the public terms so you can render a
|
|
1090
|
+
* "join and earn" CTA).
|
|
1091
|
+
*/
|
|
1092
|
+
interface LoyaltySummary {
|
|
1093
|
+
hasProgram: boolean;
|
|
1094
|
+
enrolled: boolean;
|
|
1095
|
+
program: LoyaltyProgram | null;
|
|
1096
|
+
balance: LoyaltyBalance | null;
|
|
1097
|
+
currentTier: LoyaltyTier | null;
|
|
1098
|
+
nextTier: LoyaltyNextTier | null;
|
|
1099
|
+
referralCode: string | null;
|
|
1100
|
+
transactions: LoyaltyTransaction[];
|
|
1101
|
+
}
|
|
872
1102
|
interface CrossSellItem {
|
|
873
1103
|
productId: string;
|
|
874
1104
|
slug: string | null;
|
|
1105
|
+
/** Localized product name (resolved for the requested locale, falls back to
|
|
1106
|
+
* the eshop default language). */
|
|
875
1107
|
name: string;
|
|
876
1108
|
sku: string;
|
|
1109
|
+
/** Price in the requested currency (or eshop default), including any price
|
|
1110
|
+
* list override for the authenticated customer. `null` when hidden (B2B). */
|
|
877
1111
|
price: number | null;
|
|
1112
|
+
/** Original (crossed-out) price in the same currency, when on sale. */
|
|
1113
|
+
compareAtPrice: number | null;
|
|
1114
|
+
/** Currency code the `price` / `compareAtPrice` are expressed in. */
|
|
1115
|
+
currency: string;
|
|
878
1116
|
imageUrl: string | null;
|
|
1117
|
+
/** Cached stock quantity of the recommended product. */
|
|
879
1118
|
stockCached: number;
|
|
1119
|
+
/** Convenience flag: `stockCached > 0`. */
|
|
1120
|
+
inStock: boolean;
|
|
1121
|
+
/** Merchant-editable note ("proč se to hodí") resolved for the requested
|
|
1122
|
+
* locale (falls back to the eshop default language). `null` when unset. */
|
|
1123
|
+
note?: string | null;
|
|
880
1124
|
}
|
|
881
1125
|
interface ActivePromotion {
|
|
882
1126
|
id: string;
|
|
@@ -1110,6 +1354,7 @@ declare class BehioStorefront {
|
|
|
1110
1354
|
readonly quotes: QuotesModule;
|
|
1111
1355
|
readonly addresses: AddressModule;
|
|
1112
1356
|
readonly shipping: ShippingModule;
|
|
1357
|
+
readonly newsletter: NewsletterModule;
|
|
1113
1358
|
/**
|
|
1114
1359
|
* Called by the analytics tracker when the visitor grants (id) or revokes
|
|
1115
1360
|
* (null) analytics consent. When set, requests carry the X-Behio-Vid header
|
|
@@ -1304,8 +1549,17 @@ declare class CatalogModule {
|
|
|
1304
1549
|
locale?: string;
|
|
1305
1550
|
currency?: string;
|
|
1306
1551
|
}): Promise<SdkResult<ProductGroup>>;
|
|
1307
|
-
/**
|
|
1308
|
-
|
|
1552
|
+
/**
|
|
1553
|
+
* Cross-sell / related / upsell products for a product. Returns three
|
|
1554
|
+
* separate lists: `related` (podobné produkty), `upsell` (dražší
|
|
1555
|
+
* alternativy) and `crossSell` (doporučené k nákupu). Items are localized
|
|
1556
|
+
* and priced in the requested currency, ready to render with the same card
|
|
1557
|
+
* component as `getFeatured` / `getProductGroup`.
|
|
1558
|
+
*/
|
|
1559
|
+
getCrossSell(productSlug: string, options?: {
|
|
1560
|
+
locale?: string;
|
|
1561
|
+
currency?: string;
|
|
1562
|
+
}): Promise<SdkResult<{
|
|
1309
1563
|
related: CrossSellItem[];
|
|
1310
1564
|
upsell: CrossSellItem[];
|
|
1311
1565
|
crossSell: CrossSellItem[];
|
|
@@ -1462,6 +1716,12 @@ declare class CustomerModule {
|
|
|
1462
1716
|
updateAddress(addressId: string, data: Partial<CustomerAddress>): Promise<SdkResult<CustomerAddress>>;
|
|
1463
1717
|
/** Delete address */
|
|
1464
1718
|
deleteAddress(addressId: string): Promise<SdkResult<void>>;
|
|
1719
|
+
/**
|
|
1720
|
+
* Loyalty program summary for the logged-in customer (points balance +
|
|
1721
|
+
* value, current tier, next-tier progress, point ratio, referral code,
|
|
1722
|
+
* recent transactions). Requires an authenticated customer session.
|
|
1723
|
+
*/
|
|
1724
|
+
getLoyalty(): Promise<SdkResult<LoyaltySummary>>;
|
|
1465
1725
|
}
|
|
1466
1726
|
declare class PagesModule {
|
|
1467
1727
|
private client;
|
|
@@ -1601,6 +1861,29 @@ declare class ShippingModule {
|
|
|
1601
1861
|
quote(input: ShippingQuoteInput): Promise<SdkResult<{
|
|
1602
1862
|
items: ShippingQuote[];
|
|
1603
1863
|
}>>;
|
|
1864
|
+
/**
|
|
1865
|
+
* List pickup points (parcel shops / lockers) for a method that has
|
|
1866
|
+
* `supportsPickupPoints`. Filter with `query` (name / city / zip) for a
|
|
1867
|
+
* "find your branch" box. Send the chosen point's `externalId` back as
|
|
1868
|
+
* `checkout.pickupPointId`.
|
|
1869
|
+
*/
|
|
1870
|
+
getPickupPoints(input: PickupPointsInput): Promise<SdkResult<{
|
|
1871
|
+
items: PickupPoint[];
|
|
1872
|
+
}>>;
|
|
1873
|
+
}
|
|
1874
|
+
/**
|
|
1875
|
+
* First-party newsletter opt-in. Use for the footer signup block and the
|
|
1876
|
+
* checkout newsletter checkbox (render its default from
|
|
1877
|
+
* `ShopInfo.checkout.newsletterOptInDefault`). Subscribing is idempotent and
|
|
1878
|
+
* re-activates a previously unsubscribed email. Pass the hidden `website`
|
|
1879
|
+
* honeypot field straight through from your form: a filled value is silently
|
|
1880
|
+
* accepted but stored nowhere.
|
|
1881
|
+
*/
|
|
1882
|
+
declare class NewsletterModule {
|
|
1883
|
+
private client;
|
|
1884
|
+
constructor(client: BehioStorefront);
|
|
1885
|
+
subscribe(input: NewsletterSubscribeInput): Promise<SdkResult<NewsletterSubscribeResult>>;
|
|
1886
|
+
unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
1604
1887
|
}
|
|
1605
1888
|
|
|
1606
|
-
export { type
|
|
1889
|
+
export { type BundleItem as $, type AddressSuggestion as A, type BehioStorefrontConfig as B, type Category as C, type ProductReviewsResponse as D, type SubmitReviewInput as E, type FilterField as F, type GiftCardBalance as G, type ReturnableOrder as H, type ReturnStatus as I, type ReturnRequest as J, type SubmitReturnInput as K, type LoyaltySummary as L, type Menu as M, type NewsletterSubscribeResult as N, type OrderListItem as O, type ProductsQuery as P, type CookieConsent as Q, type RegisterInput as R, type ShopInfo as S, type CookieConsentInput as T, type QuoteRequest as U, type SubmitQuoteInput as V, type WishlistItem as W, type BackInStockSubscription as X, type AddToCartInput as Y, type AuthTokens as Z, BehioApiError as _, BehioStorefront as a, type ShopScript as a$, type CartDiscount as a0, type CartItem as a1, type CheckoutAddress as a2, type FulfillmentStatus as a3, type LoginInput as a4, type MessageResponse as a5, type OrderItem as a6, type OrderStatus as a7, type PaymentStatus as a8, type ProductPrice as a9, type MenuItemType as aA, type NewsletterOptInDefault as aB, type OrderStatusHistory as aC, OrderStatuses as aD, type OrderTracking as aE, type PageAttachment as aF, PaymentStatuses as aG, type PickupPointHours as aH, type ProductMedia as aI, type ProductMediaVariant as aJ, ProductSort as aK, type ProductSortValue as aL, type ProductVolumePrice as aM, type QuoteItem as aN, type RegisterResult as aO, type RequestInterceptor as aP, type RequestInterceptorConfig as aQ, type ResponseInterceptor as aR, type ResponseInterceptorData as aS, type ReturnRequestItem as aT, type ReturnStatusItem as aU, type ReturnableOrderItem as aV, type SdkError as aW, type SdkResult as aX, type ShippingMethodSummary as aY, type ShippingQuote as aZ, type ShippingQuoteInput as a_, type ProductReview as aa, type ProductVariant as ab, type AddressType as ac, AddressTypes as ad, type BadgeTone as ae, type BehioErrorCode as af, type BehioEventHandler as ag, type BehioEventType as ah, BehioNetworkError as ai, type CartBundleLine as aj, type CartBundleLineItem as ak, type CartItemProduct as al, type CartPromotion as am, type CheckoutPaymentMethod as an, type CheckoutSettings as ao, type DataGroupFieldType as ap, FulfillmentStatuses as aq, type GiftCardSummary as ar, type LoyaltyBalance as as, type LoyaltyNextTier as at, type LoyaltyProgram as au, type LoyaltyTier as av, type LoyaltyTierPerks as aw, type LoyaltyTransaction as ax, type MenuItem as ay, type MenuItemRef as az, type PaginatedResponse as b, type ShopScriptPlacement as b0, type ShopScriptType as b1, type StockBehavior as b2, err as b3, ok as b4, toSdkError as b5, type ProductListItem as c, type ProductDetail as d, type CategoryDetail as e, type ProductLabel as f, type Cart as g, type CustomerProfile as h, type CustomerAddress as i, type AddressDetail as j, type PickupPointsInput as k, type PickupPoint as l, type NewsletterSubscribeInput as m, type NewsletterUnsubscribeResult as n, type OrderDetail as o, type OrderAccessRequestResponse as p, type OrderAccessVerifyResponse as q, type CheckoutInput as r, type PageDetail as s, type Page as t, type ShopScripts as u, type ShopSeo as v, type Bundle as w, type ProductGroup as x, type CrossSellItem as y, type ActivePromotion as z };
|