@behio/storefront-sdk 0.29.0 → 0.31.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-CXKZLKUY.js → chunk-NG46DR3A.js} +43 -0
- package/dist/{chunk-TN5C6CAB.mjs → chunk-O7HDB5R4.mjs} +43 -0
- package/dist/{client-BQroQWyY.d.mts → client-D1GZSa-N.d.mts} +296 -1
- package/dist/{client-BQroQWyY.d.ts → client-D1GZSa-N.d.ts} +296 -1
- 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 +45 -3
- package/dist/react.d.ts +45 -3
- package/dist/react.js +96 -44
- package/dist/react.mjs +102 -50
- 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
|
/**
|
|
@@ -958,6 +959,14 @@ var CustomerModule = class {
|
|
|
958
959
|
async deleteAddress(addressId) {
|
|
959
960
|
return this.client.request("DELETE", `/customer/addresses/${addressId}`);
|
|
960
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
|
+
}
|
|
961
970
|
};
|
|
962
971
|
var PagesModule = class {
|
|
963
972
|
constructor(client) {
|
|
@@ -1121,6 +1130,40 @@ var ShippingModule = class {
|
|
|
1121
1130
|
{ body: input }
|
|
1122
1131
|
);
|
|
1123
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
|
+
}
|
|
1124
1167
|
};
|
|
1125
1168
|
|
|
1126
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
|
/**
|
|
@@ -958,6 +959,14 @@ var CustomerModule = class {
|
|
|
958
959
|
async deleteAddress(addressId) {
|
|
959
960
|
return this.client.request("DELETE", `/customer/addresses/${addressId}`);
|
|
960
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
|
+
}
|
|
961
970
|
};
|
|
962
971
|
var PagesModule = class {
|
|
963
972
|
constructor(client) {
|
|
@@ -1121,6 +1130,40 @@ var ShippingModule = class {
|
|
|
1121
1130
|
{ body: input }
|
|
1122
1131
|
);
|
|
1123
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
|
+
}
|
|
1124
1167
|
};
|
|
1125
1168
|
|
|
1126
1169
|
export {
|
|
@@ -34,6 +34,73 @@ 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
|
+
/**
|
|
80
|
+
* How sold-out products behave. The SERVER enforces the buying rules; the
|
|
81
|
+
* template mirrors them in UX:
|
|
82
|
+
* - `HIDE`: sold-out products are already filtered out of browse/search/
|
|
83
|
+
* featured responses server-side; PDP direct links still resolve — render
|
|
84
|
+
* them as sold out with the buy button disabled.
|
|
85
|
+
* - `SHOW_SOLD_OUT`: sold-out products render with a "Vyprodáno" state and
|
|
86
|
+
* a disabled buy button; the API rejects over-stock adds with a 400.
|
|
87
|
+
* - `BACKORDER`: out-of-stock products stay purchasable (any quantity);
|
|
88
|
+
* render "Na objednávku" instead of disabling the button.
|
|
89
|
+
* For HIDE/SHOW_SOLD_OUT cap quantity steppers at `stockQuantity` — the
|
|
90
|
+
* cart API 400s on anything above it.
|
|
91
|
+
*/
|
|
92
|
+
stockBehavior: StockBehavior;
|
|
93
|
+
/**
|
|
94
|
+
* Merchant enabled the "only X left" nudge. When true, products whose stock
|
|
95
|
+
* is within `lowStockThreshold` carry `lowStockRemaining` — render the badge
|
|
96
|
+
* from that field alone (it is null everywhere else).
|
|
97
|
+
*/
|
|
98
|
+
showLowStock: boolean;
|
|
99
|
+
/** Stock level at (and below) which the low-stock nudge shows. */
|
|
100
|
+
lowStockThreshold: number;
|
|
101
|
+
/** Google Places address autocomplete is enabled; mount the UX when true. */
|
|
102
|
+
addressAutocompleteEnabled: boolean;
|
|
103
|
+
}
|
|
37
104
|
interface ShopInfo {
|
|
38
105
|
id: string;
|
|
39
106
|
name: string;
|
|
@@ -56,6 +123,25 @@ interface ShopInfo {
|
|
|
56
123
|
* than hardcoded template config.
|
|
57
124
|
*/
|
|
58
125
|
quotesEnabled: boolean;
|
|
126
|
+
/** Full merchant checkout & cart contract. Honour these in cart + checkout. */
|
|
127
|
+
checkout: CheckoutSettings;
|
|
128
|
+
}
|
|
129
|
+
interface NewsletterSubscribeInput {
|
|
130
|
+
email: string;
|
|
131
|
+
/** Preferred locale (ISO-639-1) captured at signup. */
|
|
132
|
+
locale?: string;
|
|
133
|
+
/** Where the opt-in came from, e.g. "footer" or "checkout". */
|
|
134
|
+
source?: string;
|
|
135
|
+
/** Honeypot: keep empty. A filled value is treated as a bot and ignored. */
|
|
136
|
+
website?: string;
|
|
137
|
+
}
|
|
138
|
+
interface NewsletterSubscribeResult {
|
|
139
|
+
success: boolean;
|
|
140
|
+
/** True when this email was already an active subscriber. */
|
|
141
|
+
alreadySubscribed: boolean;
|
|
142
|
+
}
|
|
143
|
+
interface NewsletterUnsubscribeResult {
|
|
144
|
+
success: boolean;
|
|
59
145
|
}
|
|
60
146
|
interface ShopSeo {
|
|
61
147
|
locale: string;
|
|
@@ -152,6 +238,8 @@ interface ProductVariant {
|
|
|
152
238
|
price: ProductPrice | null;
|
|
153
239
|
inStock: boolean;
|
|
154
240
|
stockQuantity?: number;
|
|
241
|
+
/** "Only X left" for this variant — same contract as ProductListItem.lowStockRemaining. */
|
|
242
|
+
lowStockRemaining?: number | null;
|
|
155
243
|
/**
|
|
156
244
|
* Cover image URL for the variant. Falls back to the parent product's
|
|
157
245
|
* cover when the variant has no photo of its own — see `imageIsInherited`.
|
|
@@ -170,6 +258,28 @@ interface ProductLabel {
|
|
|
170
258
|
name: string;
|
|
171
259
|
color?: string;
|
|
172
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Resolved availability status of a product. Either a merchant preset
|
|
263
|
+
* ("skladem", "na objednávku", "předobjednávka", custom) or, when the product
|
|
264
|
+
* has none assigned, a status DERIVED from stock server-side. Render `label`
|
|
265
|
+
* as-is — it is already localized to the requested locale.
|
|
266
|
+
*/
|
|
267
|
+
interface ProductAvailability {
|
|
268
|
+
/**
|
|
269
|
+
* Stable machine code for styling hooks: a merchant preset slug (e.g.
|
|
270
|
+
* "preorder") or the derived `"in-stock"` / `"sold-out"`.
|
|
271
|
+
*/
|
|
272
|
+
code: string;
|
|
273
|
+
/** Localized display label (requested locale → shop default → slug). */
|
|
274
|
+
label: string;
|
|
275
|
+
/** Optional merchant-configured hex badge color (e.g. "#f59e0b"). */
|
|
276
|
+
color?: string | null;
|
|
277
|
+
/**
|
|
278
|
+
* "Available from" date (epoch ms) for preorder / on-order style states.
|
|
279
|
+
* Render as "Skladem od 20. 7." when present; null when not scheduled.
|
|
280
|
+
*/
|
|
281
|
+
restockAt?: number | null;
|
|
282
|
+
}
|
|
173
283
|
interface ProductListItem {
|
|
174
284
|
id: string;
|
|
175
285
|
slug: string;
|
|
@@ -181,6 +291,15 @@ interface ProductListItem {
|
|
|
181
291
|
price: ProductPrice | null;
|
|
182
292
|
inStock: boolean;
|
|
183
293
|
stockQuantity?: number;
|
|
294
|
+
/**
|
|
295
|
+
* "Zbývá posledních X kusů" nudge, computed SERVER-side. Non-null ONLY when
|
|
296
|
+
* the merchant enabled the low-stock indicator AND 0 < stock <= threshold;
|
|
297
|
+
* the value is the exact remaining quantity. Render the badge whenever this
|
|
298
|
+
* is a number — no client-side threshold math needed.
|
|
299
|
+
*/
|
|
300
|
+
lowStockRemaining?: number | null;
|
|
301
|
+
/** Resolved availability status (merchant preset or derived from stock). */
|
|
302
|
+
availability: ProductAvailability;
|
|
184
303
|
/** Cover image of the listing. The API returns an object (url + alt + order), never a bare string. */
|
|
185
304
|
image?: {
|
|
186
305
|
url: string;
|
|
@@ -532,6 +651,12 @@ interface CheckoutAddress {
|
|
|
532
651
|
firstName: string;
|
|
533
652
|
lastName: string;
|
|
534
653
|
company?: string;
|
|
654
|
+
/** Company registration number (IČO). Required when `ShopInfo.checkout`
|
|
655
|
+
* requires tax ids; loosely validated (6-12 digits). */
|
|
656
|
+
companyId?: string;
|
|
657
|
+
/** VAT id (DIČ). Required alongside `companyId` when tax ids are required;
|
|
658
|
+
* loosely validated (optional 2-letter country prefix + 6-12 digits). */
|
|
659
|
+
vatId?: string;
|
|
535
660
|
street: string;
|
|
536
661
|
city: string;
|
|
537
662
|
zip: string;
|
|
@@ -550,6 +675,15 @@ interface CheckoutInput {
|
|
|
550
675
|
email: string;
|
|
551
676
|
phone?: string;
|
|
552
677
|
customerNote?: string;
|
|
678
|
+
/**
|
|
679
|
+
* Legal / marketing consent echoed from the checkout checkboxes. Render the
|
|
680
|
+
* boxes from `ShopInfo.checkout` (requireTermsConsent / requireGdprConsent /
|
|
681
|
+
* newsletterOptInDefault) and send the customer's choice. The backend rejects
|
|
682
|
+
* the order when a required consent is not `true`.
|
|
683
|
+
*/
|
|
684
|
+
termsConsent?: boolean;
|
|
685
|
+
gdprConsent?: boolean;
|
|
686
|
+
newsletterOptIn?: boolean;
|
|
553
687
|
/**
|
|
554
688
|
* Chosen shipping method. Required whenever the eshop has at least one
|
|
555
689
|
* enabled shipping method — the backend rejects the order without it.
|
|
@@ -563,7 +697,19 @@ interface CheckoutInput {
|
|
|
563
697
|
* or foreign quote is rejected.
|
|
564
698
|
*/
|
|
565
699
|
shippingQuoteId?: string;
|
|
700
|
+
/**
|
|
701
|
+
* Chosen pickup point `externalId` from `shipping.getPickupPoints()`.
|
|
702
|
+
* REQUIRED when the resolved shipping method has `supportsPickupPoints`;
|
|
703
|
+
* the backend rejects the order without it. Snapshotted onto the order.
|
|
704
|
+
*/
|
|
705
|
+
pickupPointId?: string;
|
|
566
706
|
paymentMethodId?: string;
|
|
707
|
+
/**
|
|
708
|
+
* Loyalty points to redeem on this order. Validated server-side against the
|
|
709
|
+
* customer's actual balance and the program's redemption cap; ignored for
|
|
710
|
+
* guests. See `customer.getLoyalty()` for the available balance.
|
|
711
|
+
*/
|
|
712
|
+
redeemLoyaltyPoints?: number;
|
|
567
713
|
}
|
|
568
714
|
type OrderStatus = (typeof OrderStatuses)[keyof typeof OrderStatuses];
|
|
569
715
|
type PaymentStatus = (typeof PaymentStatuses)[keyof typeof PaymentStatuses];
|
|
@@ -890,6 +1036,122 @@ interface ShippingQuote extends ShippingMethodSummary {
|
|
|
890
1036
|
/** Quote expiry (epoch ms). Null for fixed-price methods. */
|
|
891
1037
|
expiresAt: number | null;
|
|
892
1038
|
}
|
|
1039
|
+
/**
|
|
1040
|
+
* A pickup point (parcel shop / locker) for a shipping method with
|
|
1041
|
+
* `supportsPickupPoints`. Fetch with `behio.shipping.getPickupPoints()`,
|
|
1042
|
+
* then send the chosen `externalId` as `checkout.pickupPointId`.
|
|
1043
|
+
*/
|
|
1044
|
+
interface PickupPoint {
|
|
1045
|
+
/** Carrier-native id. Send this back as `checkout.pickupPointId`. */
|
|
1046
|
+
externalId: string;
|
|
1047
|
+
name: string;
|
|
1048
|
+
street: string | null;
|
|
1049
|
+
city: string;
|
|
1050
|
+
zip: string;
|
|
1051
|
+
country: string;
|
|
1052
|
+
latitude: number | null;
|
|
1053
|
+
longitude: number | null;
|
|
1054
|
+
cashOnDelivery: boolean;
|
|
1055
|
+
cardPayment: boolean;
|
|
1056
|
+
/** Per-day opening hours; empty when the provider gives none. */
|
|
1057
|
+
openingHours: PickupPointHours[];
|
|
1058
|
+
}
|
|
1059
|
+
/** One day's opening-hours block for a pickup point. */
|
|
1060
|
+
interface PickupPointHours {
|
|
1061
|
+
/** Provider-native day key (e.g. weekday name or index). */
|
|
1062
|
+
day: string;
|
|
1063
|
+
/** Morning open time. */
|
|
1064
|
+
from1: string | null;
|
|
1065
|
+
/** Morning close time. */
|
|
1066
|
+
to1: string | null;
|
|
1067
|
+
/** Afternoon open time. */
|
|
1068
|
+
from2: string | null;
|
|
1069
|
+
/** Afternoon close time. */
|
|
1070
|
+
to2: string | null;
|
|
1071
|
+
}
|
|
1072
|
+
/** Input for `behio.shipping.getPickupPoints()`. */
|
|
1073
|
+
interface PickupPointsInput {
|
|
1074
|
+
/** Shipping method id (must have `supportsPickupPoints`). */
|
|
1075
|
+
methodId: string;
|
|
1076
|
+
/** Free-text search over name / city / zip. */
|
|
1077
|
+
query?: string;
|
|
1078
|
+
/** ISO 3166-1 alpha-2 country filter; defaults to the method's first
|
|
1079
|
+
* allowed country or CZ. */
|
|
1080
|
+
country?: string;
|
|
1081
|
+
/** Max results (default 30, capped at 100). */
|
|
1082
|
+
limit?: number;
|
|
1083
|
+
}
|
|
1084
|
+
/** Public terms of the eshop's loyalty program. */
|
|
1085
|
+
interface LoyaltyProgram {
|
|
1086
|
+
name: string;
|
|
1087
|
+
pointName: string;
|
|
1088
|
+
pointNamePlural: string;
|
|
1089
|
+
/** 1 point = `pointValueRatio` currency units. */
|
|
1090
|
+
pointValueRatio: number;
|
|
1091
|
+
currency: string;
|
|
1092
|
+
minRedemptionPoints: number;
|
|
1093
|
+
maxRedemptionPercent: number;
|
|
1094
|
+
combineWithDiscounts: boolean;
|
|
1095
|
+
description: string | null;
|
|
1096
|
+
iconUrl: string | null;
|
|
1097
|
+
}
|
|
1098
|
+
interface LoyaltyBalance {
|
|
1099
|
+
currentPoints: number;
|
|
1100
|
+
/** `currentPoints` valued in the program currency. */
|
|
1101
|
+
currentPointsValue: number;
|
|
1102
|
+
lifetimePointsEarned: number;
|
|
1103
|
+
lifetimePointsRedeemed: number;
|
|
1104
|
+
lifetimeSpend: number;
|
|
1105
|
+
}
|
|
1106
|
+
interface LoyaltyTier {
|
|
1107
|
+
name: string;
|
|
1108
|
+
slug: string;
|
|
1109
|
+
color: string | null;
|
|
1110
|
+
earnMultiplier: number;
|
|
1111
|
+
/** Tier perks (human-readable perk lines), or null when the tier has none. */
|
|
1112
|
+
perks: LoyaltyTierPerks | null;
|
|
1113
|
+
}
|
|
1114
|
+
/** Perks attached to a loyalty tier. */
|
|
1115
|
+
interface LoyaltyTierPerks {
|
|
1116
|
+
/** Human-readable perk lines shown on the tier. */
|
|
1117
|
+
list: string[];
|
|
1118
|
+
}
|
|
1119
|
+
interface LoyaltyNextTier {
|
|
1120
|
+
name: string;
|
|
1121
|
+
slug: string;
|
|
1122
|
+
color: string | null;
|
|
1123
|
+
thresholdType: string;
|
|
1124
|
+
thresholdValue: number;
|
|
1125
|
+
currentValue: number;
|
|
1126
|
+
remaining: number;
|
|
1127
|
+
/** 0-100 progress toward this tier. */
|
|
1128
|
+
progressPercent: number;
|
|
1129
|
+
}
|
|
1130
|
+
interface LoyaltyTransaction {
|
|
1131
|
+
type: string;
|
|
1132
|
+
/** Positive = earned, negative = redeemed / expired. */
|
|
1133
|
+
points: number;
|
|
1134
|
+
balanceAfter: number;
|
|
1135
|
+
eventType: string | null;
|
|
1136
|
+
description: string | null;
|
|
1137
|
+
createdAt: number;
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Loyalty summary for the logged-in customer. `hasProgram` is false when the
|
|
1141
|
+
* eshop runs no program; `enrolled` is false when the customer has not yet
|
|
1142
|
+
* joined (then `program` still carries the public terms so you can render a
|
|
1143
|
+
* "join and earn" CTA).
|
|
1144
|
+
*/
|
|
1145
|
+
interface LoyaltySummary {
|
|
1146
|
+
hasProgram: boolean;
|
|
1147
|
+
enrolled: boolean;
|
|
1148
|
+
program: LoyaltyProgram | null;
|
|
1149
|
+
balance: LoyaltyBalance | null;
|
|
1150
|
+
currentTier: LoyaltyTier | null;
|
|
1151
|
+
nextTier: LoyaltyNextTier | null;
|
|
1152
|
+
referralCode: string | null;
|
|
1153
|
+
transactions: LoyaltyTransaction[];
|
|
1154
|
+
}
|
|
893
1155
|
interface CrossSellItem {
|
|
894
1156
|
productId: string;
|
|
895
1157
|
slug: string | null;
|
|
@@ -909,6 +1171,9 @@ interface CrossSellItem {
|
|
|
909
1171
|
stockCached: number;
|
|
910
1172
|
/** Convenience flag: `stockCached > 0`. */
|
|
911
1173
|
inStock: boolean;
|
|
1174
|
+
/** Merchant-editable note ("proč se to hodí") resolved for the requested
|
|
1175
|
+
* locale (falls back to the eshop default language). `null` when unset. */
|
|
1176
|
+
note?: string | null;
|
|
912
1177
|
}
|
|
913
1178
|
interface ActivePromotion {
|
|
914
1179
|
id: string;
|
|
@@ -1142,6 +1407,7 @@ declare class BehioStorefront {
|
|
|
1142
1407
|
readonly quotes: QuotesModule;
|
|
1143
1408
|
readonly addresses: AddressModule;
|
|
1144
1409
|
readonly shipping: ShippingModule;
|
|
1410
|
+
readonly newsletter: NewsletterModule;
|
|
1145
1411
|
/**
|
|
1146
1412
|
* Called by the analytics tracker when the visitor grants (id) or revokes
|
|
1147
1413
|
* (null) analytics consent. When set, requests carry the X-Behio-Vid header
|
|
@@ -1503,6 +1769,12 @@ declare class CustomerModule {
|
|
|
1503
1769
|
updateAddress(addressId: string, data: Partial<CustomerAddress>): Promise<SdkResult<CustomerAddress>>;
|
|
1504
1770
|
/** Delete address */
|
|
1505
1771
|
deleteAddress(addressId: string): Promise<SdkResult<void>>;
|
|
1772
|
+
/**
|
|
1773
|
+
* Loyalty program summary for the logged-in customer (points balance +
|
|
1774
|
+
* value, current tier, next-tier progress, point ratio, referral code,
|
|
1775
|
+
* recent transactions). Requires an authenticated customer session.
|
|
1776
|
+
*/
|
|
1777
|
+
getLoyalty(): Promise<SdkResult<LoyaltySummary>>;
|
|
1506
1778
|
}
|
|
1507
1779
|
declare class PagesModule {
|
|
1508
1780
|
private client;
|
|
@@ -1642,6 +1914,29 @@ declare class ShippingModule {
|
|
|
1642
1914
|
quote(input: ShippingQuoteInput): Promise<SdkResult<{
|
|
1643
1915
|
items: ShippingQuote[];
|
|
1644
1916
|
}>>;
|
|
1917
|
+
/**
|
|
1918
|
+
* List pickup points (parcel shops / lockers) for a method that has
|
|
1919
|
+
* `supportsPickupPoints`. Filter with `query` (name / city / zip) for a
|
|
1920
|
+
* "find your branch" box. Send the chosen point's `externalId` back as
|
|
1921
|
+
* `checkout.pickupPointId`.
|
|
1922
|
+
*/
|
|
1923
|
+
getPickupPoints(input: PickupPointsInput): Promise<SdkResult<{
|
|
1924
|
+
items: PickupPoint[];
|
|
1925
|
+
}>>;
|
|
1926
|
+
}
|
|
1927
|
+
/**
|
|
1928
|
+
* First-party newsletter opt-in. Use for the footer signup block and the
|
|
1929
|
+
* checkout newsletter checkbox (render its default from
|
|
1930
|
+
* `ShopInfo.checkout.newsletterOptInDefault`). Subscribing is idempotent and
|
|
1931
|
+
* re-activates a previously unsubscribed email. Pass the hidden `website`
|
|
1932
|
+
* honeypot field straight through from your form: a filled value is silently
|
|
1933
|
+
* accepted but stored nowhere.
|
|
1934
|
+
*/
|
|
1935
|
+
declare class NewsletterModule {
|
|
1936
|
+
private client;
|
|
1937
|
+
constructor(client: BehioStorefront);
|
|
1938
|
+
subscribe(input: NewsletterSubscribeInput): Promise<SdkResult<NewsletterSubscribeResult>>;
|
|
1939
|
+
unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
1645
1940
|
}
|
|
1646
1941
|
|
|
1647
|
-
export { type
|
|
1942
|
+
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 ShippingQuoteInput 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 ProductAvailability as aI, type ProductMedia as aJ, type ProductMediaVariant as aK, ProductSort as aL, type ProductSortValue as aM, type ProductVolumePrice as aN, type QuoteItem as aO, type RegisterResult as aP, type RequestInterceptor as aQ, type RequestInterceptorConfig as aR, type ResponseInterceptor as aS, type ResponseInterceptorData as aT, type ReturnRequestItem as aU, type ReturnStatusItem as aV, type ReturnableOrderItem as aW, type SdkError as aX, type SdkResult as aY, type ShippingMethodSummary as aZ, type ShippingQuote 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 ShopScript as b0, type ShopScriptPlacement as b1, type ShopScriptType as b2, type StockBehavior as b3, err as b4, ok as b5, toSdkError as b6, 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 };
|