@behio/storefront-sdk 2.28.0 → 2.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/index.js CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
 
14
14
 
15
- var _chunkIB3DU7B6js = require('./chunk-IB3DU7B6.js');
15
+ var _chunkOUPCGMSRjs = require('./chunk-OUPCGMSR.js');
16
16
 
17
17
  // src/react/utils/format-price.ts
18
18
  function formatPrice(amount, currency, locale, display) {
@@ -416,6 +416,7 @@ var ERROR_MESSAGES = {
416
416
  "be.storefront.mollieMissingCredentials": "Metod\u011B Mollie chyb\xED API kl\xED\u010D.",
417
417
  "be.storefront.mollieWebhookInvalid": "Notifikace Mollie nenese id platby.",
418
418
  "be.storefront.newCustomerNotEnrolled": "Nov\xFD z\xE1kazn\xEDk nen\xED v programu zapsan\xFD.",
419
+ "be.storefront.newsletterConfirmationInvalid": "Potvrzovac\xED odkaz je neplatn\xFD nebo vypr\u0161el. Vy\u017E\xE1dejte si nov\xFD e-mail.",
419
420
  "be.storefront.noConsentRecorded": "N\xE1v\u0161t\u011Bvn\xEDk nem\xE1 zaznamenan\xFD souhlas.",
420
421
  "be.storefront.noPickupPoints": "Tato doprava nem\xE1 v\xFDdejn\xED m\xEDsta.",
421
422
  "be.storefront.noReferralRules": "Program nem\xE1 nastaven\xE1 doporu\u010Dovac\xED pravidla.",
@@ -444,6 +445,7 @@ var ERROR_MESSAGES = {
444
445
  "be.storefront.paymentReconciliationInvalid": "\xDAdaje platebn\xED br\xE1ny neodpov\xEDdaj\xED objedn\xE1vce. Stav platby se nezm\u011Bnil.",
445
446
  "be.storefront.paypalMissingCredentials": "Metod\u011B PayPal chyb\xED p\u0159ihla\u0161ovac\xED \xFAdaje.",
446
447
  "be.storefront.paypalWebhookInvalid": "Notifikace PayPal nenese id objedn\xE1vky.",
448
+ "be.storefront.personalDiscountNotEligible": "Tento k\xF3d nelze pro tuto objedn\xE1vku pou\u017E\xEDt. Zkontrolujte e-mail p\u0159\xEDjemce a podm\xEDnku prvn\xED objedn\xE1vky.",
447
449
  "be.storefront.phoneRequired": "K dokon\u010Den\xED objedn\xE1vky je pot\u0159eba telefonn\xED \u010D\xEDslo.",
448
450
  "be.storefront.pickupPointCountryMismatch": "Vyberte v\xFDdejn\xED m\xEDsto v zemi doru\u010Den\xED.",
449
451
  "be.storefront.pickupPointNotFound": "Vybran\xE9 v\xFDdejn\xED m\xEDsto dopravce nezn\xE1. Vyberte pros\xEDm jin\xE9.",
@@ -501,6 +503,8 @@ var ERROR_MESSAGES = {
501
503
  "be.storefront.tokenInvalid": "Neplatn\xFD nebo pro\u0161l\xFD token.",
502
504
  "be.storefront.tokenWrongEshop": "Token pro tento e-shop neplat\xED.",
503
505
  "be.storefront.uniqueItemNoRestock": "Tento origin\xE1l se znovu vyr\xE1b\u011Bt nebude, hl\xEDdat ho nejde. Napi\u0161te n\xE1m, pokud chcete podobn\xFD.",
506
+ "be.storefront.uniqueQuantityInvalid": "Unik\xE1t se prod\xE1v\xE1 po jednom kusu. Nastavte minim\xE1ln\xED odb\u011Br a krok mno\u017Estv\xED na 1. U variant ozna\u010Dte jednotliv\xE9 kusy, ne cel\xFD spole\u010Dn\xFD produkt.",
507
+ "be.storefront.uniqueStockInvalid": "Unik\xE1t m\u016F\u017Ee m\xEDt na v\u0161ech skladech dohromady 0 nebo 1 kus. Nejd\u0159\xEDv opravte skladov\xE9 mno\u017Estv\xED.",
504
508
  "be.storefront.unknownPaymentProvider": "Nezn\xE1m\xFD poskytovatel plateb {provider}.",
505
509
  "be.storefront.variantsOnlyParent": "Produkt {name} nejde koupit p\u0159\xEDmo. Vyberte jednu z jeho variant.",
506
510
  "be.storefront.wishlistItemNotFound": "Polo\u017Eka obl\xEDben\xFDch nenalezena.",
@@ -703,6 +707,7 @@ var ERROR_MESSAGES = {
703
707
  "be.storefront.mollieMissingCredentials": "Met\xF3de Mollie ch\xFDba API k\u013E\xFA\u010D.",
704
708
  "be.storefront.mollieWebhookInvalid": "Notifik\xE1cia Mollie nenesie id platby.",
705
709
  "be.storefront.newCustomerNotEnrolled": "Nov\xFD z\xE1kazn\xEDk nie je v programe zap\xEDsan\xFD.",
710
+ "be.storefront.newsletterConfirmationInvalid": "Potvrdzovac\xED odkaz je neplatn\xFD alebo vypr\u0161al. Vy\u017Eiadajte si nov\xFD e-mail.",
706
711
  "be.storefront.noConsentRecorded": "N\xE1v\u0161tevn\xEDk nem\xE1 zaznamenan\xFD s\xFAhlas.",
707
712
  "be.storefront.noPickupPoints": "T\xE1to doprava nem\xE1 v\xFDdajn\xE9 miesta.",
708
713
  "be.storefront.noReferralRules": "Program nem\xE1 nastaven\xE9 odpor\xFA\u010Dacie pravidl\xE1.",
@@ -731,6 +736,7 @@ var ERROR_MESSAGES = {
731
736
  "be.storefront.paymentReconciliationInvalid": "\xDAdaje platobnej br\xE1ny nezodpovedaj\xFA objedn\xE1vke. Stav platby sa nezmenil.",
732
737
  "be.storefront.paypalMissingCredentials": "Met\xF3de PayPal ch\xFDbaj\xFA prihlasovacie \xFAdaje.",
733
738
  "be.storefront.paypalWebhookInvalid": "Notifik\xE1cia PayPal nenesie id objedn\xE1vky.",
739
+ "be.storefront.personalDiscountNotEligible": "Tento k\xF3d nemo\u017Eno pou\u017Ei\u0165 na t\xFAto objedn\xE1vku. Skontrolujte e-mail pr\xEDjemcu a podmienku prvej objedn\xE1vky.",
734
740
  "be.storefront.phoneRequired": "Na dokon\u010Denie objedn\xE1vky je potrebn\xE9 telef\xF3nne \u010D\xEDslo.",
735
741
  "be.storefront.pickupPointCountryMismatch": "Vyberte v\xFDdajn\xE9 miesto v krajine doru\u010Denia.",
736
742
  "be.storefront.pickupPointNotFound": "Vybran\xE9 v\xFDdajn\xE9 miesto dopravca nepozn\xE1. Vyberte pros\xEDm in\xE9.",
@@ -788,6 +794,8 @@ var ERROR_MESSAGES = {
788
794
  "be.storefront.tokenInvalid": "Neplatn\xFD alebo expirovan\xFD token.",
789
795
  "be.storefront.tokenWrongEshop": "Token pre tento e-shop neplat\xED.",
790
796
  "be.storefront.uniqueItemNoRestock": "Tento origin\xE1l sa znovu vyr\xE1ba\u0165 nebude, str\xE1\u017Ei\u0165 ho nejde. Nap\xED\u0161te n\xE1m, ak chcete podobn\xFD.",
797
+ "be.storefront.uniqueQuantityInvalid": "Unik\xE1t sa pred\xE1va po jednom kuse. Nastavte minim\xE1lny odber a krok mno\u017Estva na 1. Pri variantoch ozna\u010Dte jednotliv\xE9 kusy, nie cel\xFD spolo\u010Dn\xFD produkt.",
798
+ "be.storefront.uniqueStockInvalid": "Unik\xE1t m\xF4\u017Ee ma\u0165 na v\u0161etk\xFDch skladoch spolu 0 alebo 1 kus. Najprv opravte skladov\xE9 mno\u017Estvo.",
791
799
  "be.storefront.unknownPaymentProvider": "Nezn\xE1my poskytovate\u013E platieb {provider}.",
792
800
  "be.storefront.variantsOnlyParent": "Produkt {name} sa ned\xE1 k\xFApi\u0165 priamo. Vyberte jeden z jeho variantov.",
793
801
  "be.storefront.wishlistItemNotFound": "Polo\u017Eka ob\u013E\xFAben\xFDch sa nena\u0161la.",
@@ -990,6 +998,7 @@ var ERROR_MESSAGES = {
990
998
  "be.storefront.mollieMissingCredentials": "Mollie method is missing the API key",
991
999
  "be.storefront.mollieWebhookInvalid": "Mollie webhook is missing the payment id",
992
1000
  "be.storefront.newCustomerNotEnrolled": "New customer is not enrolled in this program",
1001
+ "be.storefront.newsletterConfirmationInvalid": "The confirmation link is invalid or expired. Request a new email.",
993
1002
  "be.storefront.noConsentRecorded": "No consent recorded for this visitor",
994
1003
  "be.storefront.noPickupPoints": "This shipping method has no pickup points",
995
1004
  "be.storefront.noReferralRules": "No referral rules configured for this program",
@@ -1018,6 +1027,7 @@ var ERROR_MESSAGES = {
1018
1027
  "be.storefront.paymentReconciliationInvalid": "The payment gateway data does not match the order. The payment status has not changed.",
1019
1028
  "be.storefront.paypalMissingCredentials": "PayPal method is missing credentials",
1020
1029
  "be.storefront.paypalWebhookInvalid": "PayPal webhook is missing the order id",
1030
+ "be.storefront.personalDiscountNotEligible": "This code is not eligible for this order. Check the recipient email and first-order requirement.",
1021
1031
  "be.storefront.phoneRequired": "Phone number is required to place this order",
1022
1032
  "be.storefront.pickupPointCountryMismatch": "Select a pickup point in the delivery country.",
1023
1033
  "be.storefront.pickupPointNotFound": "The carrier does not know the selected pickup point. Please choose another one.",
@@ -1075,6 +1085,8 @@ var ERROR_MESSAGES = {
1075
1085
  "be.storefront.tokenInvalid": "Invalid or expired token",
1076
1086
  "be.storefront.tokenWrongEshop": "Token is not valid for this e-shop",
1077
1087
  "be.storefront.uniqueItemNoRestock": "This one-of-a-kind piece will not be made again, so it cannot be watched. Contact us if you would like a similar one.",
1088
+ "be.storefront.uniqueQuantityInvalid": "A unique item is sold one piece at a time. Set the minimum order and quantity step to 1. Mark individual variants, not their shared parent product.",
1089
+ "be.storefront.uniqueStockInvalid": "A unique item can have a total stock of 0 or 1 across all warehouses. Correct the stock quantity first.",
1078
1090
  "be.storefront.unknownPaymentProvider": "Unknown payment provider",
1079
1091
  "be.storefront.variantsOnlyParent": "{name} cannot be purchased directly, choose one of its variants",
1080
1092
  "be.storefront.wishlistItemNotFound": "Wishlist item not found",
@@ -1106,7 +1118,7 @@ var GENERIC = {
1106
1118
  en: "Something went wrong, please try again."
1107
1119
  };
1108
1120
  function bodyOf(err2) {
1109
- const body = err2 instanceof _chunkIB3DU7B6js.BehioApiError ? err2.body : err2 && typeof err2 === "object" && "body" in err2 ? err2.body : err2;
1121
+ const body = err2 instanceof _chunkOUPCGMSRjs.BehioApiError ? err2.body : err2 && typeof err2 === "object" && "body" in err2 ? err2.body : err2;
1110
1122
  return body && typeof body === "object" ? body : null;
1111
1123
  }
1112
1124
  function errorCode(err2) {
@@ -1192,6 +1204,155 @@ function formFieldErrors(err2) {
1192
1204
  return out;
1193
1205
  }
1194
1206
 
1207
+ // src/react/storage.ts
1208
+ var localStorageAdapter = {
1209
+ get(key) {
1210
+ try {
1211
+ return window.localStorage.getItem(key);
1212
+ } catch (e9) {
1213
+ return null;
1214
+ }
1215
+ },
1216
+ set(key, value) {
1217
+ try {
1218
+ window.localStorage.setItem(key, value);
1219
+ } catch (e10) {
1220
+ }
1221
+ },
1222
+ remove(key) {
1223
+ try {
1224
+ window.localStorage.removeItem(key);
1225
+ } catch (e11) {
1226
+ }
1227
+ }
1228
+ };
1229
+ function createMemoryStorage() {
1230
+ const store = /* @__PURE__ */ new Map();
1231
+ return {
1232
+ get(key) {
1233
+ return _nullishCoalesce(store.get(key), () => ( null));
1234
+ },
1235
+ set(key, value) {
1236
+ store.set(key, value);
1237
+ },
1238
+ remove(key) {
1239
+ store.delete(key);
1240
+ }
1241
+ };
1242
+ }
1243
+ var memoryStorage = createMemoryStorage();
1244
+
1245
+ // src/form-popup.ts
1246
+ function preferenceMemory() {
1247
+ if (typeof window === "undefined") return /* @__PURE__ */ new Map();
1248
+ const browser = window;
1249
+ return _nullishCoalesce(browser.__behioFormPreferences, () => ( (browser.__behioFormPreferences = /* @__PURE__ */ new Map())));
1250
+ }
1251
+ var memoryAdapter = { get: (k) => _nullishCoalesce(preferenceMemory().get(k), () => ( null)), set: (k, v) => {
1252
+ preferenceMemory().set(k, v);
1253
+ }, remove: (k) => {
1254
+ preferenceMemory().delete(k);
1255
+ } };
1256
+ var NEWSLETTER_REQUESTED_EVENT = "behio:newsletter-requested";
1257
+ var PREFIX = "behio:forms:";
1258
+ var VISIT_MS = 30 * 60 * 1e3;
1259
+ function sessionAdapter() {
1260
+ return { get: (key) => {
1261
+ try {
1262
+ return _nullishCoalesce(sessionStorage.getItem(key), () => ( memoryAdapter.get(key)));
1263
+ } catch (e12) {
1264
+ return memoryAdapter.get(key);
1265
+ }
1266
+ }, set: (key, value) => {
1267
+ memoryAdapter.set(key, value);
1268
+ try {
1269
+ sessionStorage.setItem(key, value);
1270
+ } catch (e13) {
1271
+ }
1272
+ }, remove: (key) => {
1273
+ memoryAdapter.remove(key);
1274
+ try {
1275
+ sessionStorage.removeItem(key);
1276
+ } catch (e14) {
1277
+ }
1278
+ } };
1279
+ }
1280
+ function markNewsletterRequested() {
1281
+ if (typeof window === "undefined") return;
1282
+ memoryAdapter.set(PREFIX + "newsletter", "1");
1283
+ localStorageAdapter.set(PREFIX + "newsletter", "1");
1284
+ if (typeof window !== "undefined") window.dispatchEvent(new Event(NEWSLETTER_REQUESTED_EVENT));
1285
+ }
1286
+ function newsletterWasRequested() {
1287
+ return memoryAdapter.get(PREFIX + "newsletter") === "1" || localStorageAdapter.get(PREFIX + "newsletter") === "1";
1288
+ }
1289
+ function matchesFormPath(rule, pathname) {
1290
+ return rule.endsWith("*") ? pathname.startsWith(rule.slice(0, -1)) : pathname === rule;
1291
+ }
1292
+ function formPopupRouteAllowed(pathname, placement) {
1293
+ if (/^\/(cart|checkout|account|order|newsletter|login|register|forgot-password|reset-password|verify-email|session)(\/|$)/.test(pathname)) return false;
1294
+ return (!placement.includePaths.length || placement.includePaths.some((rule) => matchesFormPath(rule, pathname))) && !placement.excludePaths.some((rule) => matchesFormPath(rule, pathname));
1295
+ }
1296
+ var FormPopupClock = class {
1297
+ constructor(elapsedMs = 0) {
1298
+ this.since = null;
1299
+ this.elapsedMs = Math.max(0, elapsedMs);
1300
+ }
1301
+ setVisible(visible, now) {
1302
+ if (this.since !== null) this.elapsedMs += Math.max(0, now - this.since);
1303
+ this.since = visible ? now : null;
1304
+ }
1305
+ elapsed(now) {
1306
+ return this.elapsedMs + (this.since === null ? 0 : Math.max(0, now - this.since));
1307
+ }
1308
+ };
1309
+ var FormPopupPreferences = class {
1310
+ constructor(session = sessionAdapter(), persistent = localStorageAdapter, now = () => Date.now()) {
1311
+ this.session = session;
1312
+ this.persistent = persistent;
1313
+ this.now = now;
1314
+ this.shownInVisit = this.number("shown", this.session) > this.now() || this.number("shown", this.persistent) > this.now();
1315
+ }
1316
+ number(key, storage) {
1317
+ const n = Number(storage.get(PREFIX + key));
1318
+ return Number.isFinite(n) && n >= 0 ? n : 0;
1319
+ }
1320
+ visibleMs() {
1321
+ return this.now() - this.number("activity", this.session) < VISIT_MS ? this.number("visible", this.session) : 0;
1322
+ }
1323
+ saveTime(visible) {
1324
+ if (this.shownInVisit) {
1325
+ const until = String(this.now() + VISIT_MS);
1326
+ this.session.set(PREFIX + "shown", until);
1327
+ this.persistent.set(PREFIX + "shown", until);
1328
+ }
1329
+ this.session.set(PREFIX + "visible", String(visible));
1330
+ this.session.set(PREFIX + "activity", String(this.now()));
1331
+ }
1332
+ suppressed(slug, newsletter = false) {
1333
+ return newsletter && newsletterWasRequested() || this.shownInVisit || this.number("shown", this.session) > this.now() || this.number("shown", this.persistent) > this.now() || this.number("dismissed:" + slug, this.persistent) > this.now() || this.number("dismissed:" + slug, this.session) > this.now();
1334
+ }
1335
+ shown() {
1336
+ this.shownInVisit = true;
1337
+ const until = String(this.now() + VISIT_MS);
1338
+ this.session.set(PREFIX + "shown", until);
1339
+ this.persistent.set(PREFIX + "shown", until);
1340
+ }
1341
+ dismiss(slug, days) {
1342
+ const key = PREFIX + "dismissed:" + slug;
1343
+ const until = String(this.now() + days * 864e5);
1344
+ this.session.set(key, until);
1345
+ this.persistent.set(key, until);
1346
+ }
1347
+ };
1348
+
1349
+
1350
+
1351
+
1352
+
1353
+
1354
+
1355
+
1195
1356
 
1196
1357
 
1197
1358
 
@@ -1223,4 +1384,4 @@ function formFieldErrors(err2) {
1223
1384
 
1224
1385
 
1225
1386
 
1226
- exports.AddressTypes = _chunkIB3DU7B6js.AddressTypes; exports.BehioApiError = _chunkIB3DU7B6js.BehioApiError; exports.BehioNetworkError = _chunkIB3DU7B6js.BehioNetworkError; exports.BehioStorefront = _chunkIB3DU7B6js.BehioStorefront; exports.FulfillmentStatuses = _chunkIB3DU7B6js.FulfillmentStatuses; exports.OrderStatuses = _chunkIB3DU7B6js.OrderStatuses; exports.PaymentStatuses = _chunkIB3DU7B6js.PaymentStatuses; exports.ProductSort = _chunkIB3DU7B6js.ProductSort; exports.VARIANT_QUERY_PARAM = VARIANT_QUERY_PARAM; exports.availableAxisValues = availableAxisValues; exports.buildVariantComparison = buildVariantComparison; exports.clearCartSummary = _chunkIB3DU7B6js.clearCartSummary; exports.err = _chunkIB3DU7B6js.err; exports.errorCode = errorCode; exports.errorMessage = errorMessage; exports.errorParams = errorParams; exports.findVariantByAttributes = findVariantByAttributes; exports.formFieldErrors = formFieldErrors; exports.formatPrice = formatPrice; exports.generateVisitorId = generateVisitorId; exports.getStoredVisitorId = getStoredVisitorId; exports.grantAnalyticsConsent = grantAnalyticsConsent; exports.ok = _chunkIB3DU7B6js.ok; exports.publishCartSummary = _chunkIB3DU7B6js.publishCartSummary; exports.resolveVariantContent = resolveVariantContent; exports.revokeAnalyticsConsent = revokeAnalyticsConsent; exports.toSdkError = _chunkIB3DU7B6js.toSdkError; exports.trackEcommerceEvent = trackEcommerceEvent; exports.validationFieldMessages = validationFieldMessages; exports.variantFromQuery = variantFromQuery; exports.variantHref = variantHref;
1387
+ exports.AddressTypes = _chunkOUPCGMSRjs.AddressTypes; exports.BehioApiError = _chunkOUPCGMSRjs.BehioApiError; exports.BehioNetworkError = _chunkOUPCGMSRjs.BehioNetworkError; exports.BehioStorefront = _chunkOUPCGMSRjs.BehioStorefront; exports.FormPopupClock = FormPopupClock; exports.FormPopupPreferences = FormPopupPreferences; exports.FulfillmentStatuses = _chunkOUPCGMSRjs.FulfillmentStatuses; exports.NEWSLETTER_REQUESTED_EVENT = NEWSLETTER_REQUESTED_EVENT; exports.OrderStatuses = _chunkOUPCGMSRjs.OrderStatuses; exports.PaymentStatuses = _chunkOUPCGMSRjs.PaymentStatuses; exports.ProductSort = _chunkOUPCGMSRjs.ProductSort; exports.VARIANT_QUERY_PARAM = VARIANT_QUERY_PARAM; exports.availableAxisValues = availableAxisValues; exports.buildVariantComparison = buildVariantComparison; exports.clearCartSummary = _chunkOUPCGMSRjs.clearCartSummary; exports.err = _chunkOUPCGMSRjs.err; exports.errorCode = errorCode; exports.errorMessage = errorMessage; exports.errorParams = errorParams; exports.findVariantByAttributes = findVariantByAttributes; exports.formFieldErrors = formFieldErrors; exports.formPopupRouteAllowed = formPopupRouteAllowed; exports.formatPrice = formatPrice; exports.generateVisitorId = generateVisitorId; exports.getStoredVisitorId = getStoredVisitorId; exports.grantAnalyticsConsent = grantAnalyticsConsent; exports.markNewsletterRequested = markNewsletterRequested; exports.matchesFormPath = matchesFormPath; exports.newsletterWasRequested = newsletterWasRequested; exports.ok = _chunkOUPCGMSRjs.ok; exports.publishCartSummary = _chunkOUPCGMSRjs.publishCartSummary; exports.resolveVariantContent = resolveVariantContent; exports.revokeAnalyticsConsent = revokeAnalyticsConsent; exports.toSdkError = _chunkOUPCGMSRjs.toSdkError; exports.trackEcommerceEvent = trackEcommerceEvent; exports.validationFieldMessages = validationFieldMessages; exports.variantFromQuery = variantFromQuery; exports.variantHref = variantHref;
package/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  ok,
13
13
  publishCartSummary,
14
14
  toSdkError
15
- } from "./chunk-VYJLUJXO.mjs";
15
+ } from "./chunk-25UM2XCS.mjs";
16
16
 
17
17
  // src/react/utils/format-price.ts
18
18
  function formatPrice(amount, currency, locale, display) {
@@ -416,6 +416,7 @@ var ERROR_MESSAGES = {
416
416
  "be.storefront.mollieMissingCredentials": "Metod\u011B Mollie chyb\xED API kl\xED\u010D.",
417
417
  "be.storefront.mollieWebhookInvalid": "Notifikace Mollie nenese id platby.",
418
418
  "be.storefront.newCustomerNotEnrolled": "Nov\xFD z\xE1kazn\xEDk nen\xED v programu zapsan\xFD.",
419
+ "be.storefront.newsletterConfirmationInvalid": "Potvrzovac\xED odkaz je neplatn\xFD nebo vypr\u0161el. Vy\u017E\xE1dejte si nov\xFD e-mail.",
419
420
  "be.storefront.noConsentRecorded": "N\xE1v\u0161t\u011Bvn\xEDk nem\xE1 zaznamenan\xFD souhlas.",
420
421
  "be.storefront.noPickupPoints": "Tato doprava nem\xE1 v\xFDdejn\xED m\xEDsta.",
421
422
  "be.storefront.noReferralRules": "Program nem\xE1 nastaven\xE1 doporu\u010Dovac\xED pravidla.",
@@ -444,6 +445,7 @@ var ERROR_MESSAGES = {
444
445
  "be.storefront.paymentReconciliationInvalid": "\xDAdaje platebn\xED br\xE1ny neodpov\xEDdaj\xED objedn\xE1vce. Stav platby se nezm\u011Bnil.",
445
446
  "be.storefront.paypalMissingCredentials": "Metod\u011B PayPal chyb\xED p\u0159ihla\u0161ovac\xED \xFAdaje.",
446
447
  "be.storefront.paypalWebhookInvalid": "Notifikace PayPal nenese id objedn\xE1vky.",
448
+ "be.storefront.personalDiscountNotEligible": "Tento k\xF3d nelze pro tuto objedn\xE1vku pou\u017E\xEDt. Zkontrolujte e-mail p\u0159\xEDjemce a podm\xEDnku prvn\xED objedn\xE1vky.",
447
449
  "be.storefront.phoneRequired": "K dokon\u010Den\xED objedn\xE1vky je pot\u0159eba telefonn\xED \u010D\xEDslo.",
448
450
  "be.storefront.pickupPointCountryMismatch": "Vyberte v\xFDdejn\xED m\xEDsto v zemi doru\u010Den\xED.",
449
451
  "be.storefront.pickupPointNotFound": "Vybran\xE9 v\xFDdejn\xED m\xEDsto dopravce nezn\xE1. Vyberte pros\xEDm jin\xE9.",
@@ -501,6 +503,8 @@ var ERROR_MESSAGES = {
501
503
  "be.storefront.tokenInvalid": "Neplatn\xFD nebo pro\u0161l\xFD token.",
502
504
  "be.storefront.tokenWrongEshop": "Token pro tento e-shop neplat\xED.",
503
505
  "be.storefront.uniqueItemNoRestock": "Tento origin\xE1l se znovu vyr\xE1b\u011Bt nebude, hl\xEDdat ho nejde. Napi\u0161te n\xE1m, pokud chcete podobn\xFD.",
506
+ "be.storefront.uniqueQuantityInvalid": "Unik\xE1t se prod\xE1v\xE1 po jednom kusu. Nastavte minim\xE1ln\xED odb\u011Br a krok mno\u017Estv\xED na 1. U variant ozna\u010Dte jednotliv\xE9 kusy, ne cel\xFD spole\u010Dn\xFD produkt.",
507
+ "be.storefront.uniqueStockInvalid": "Unik\xE1t m\u016F\u017Ee m\xEDt na v\u0161ech skladech dohromady 0 nebo 1 kus. Nejd\u0159\xEDv opravte skladov\xE9 mno\u017Estv\xED.",
504
508
  "be.storefront.unknownPaymentProvider": "Nezn\xE1m\xFD poskytovatel plateb {provider}.",
505
509
  "be.storefront.variantsOnlyParent": "Produkt {name} nejde koupit p\u0159\xEDmo. Vyberte jednu z jeho variant.",
506
510
  "be.storefront.wishlistItemNotFound": "Polo\u017Eka obl\xEDben\xFDch nenalezena.",
@@ -703,6 +707,7 @@ var ERROR_MESSAGES = {
703
707
  "be.storefront.mollieMissingCredentials": "Met\xF3de Mollie ch\xFDba API k\u013E\xFA\u010D.",
704
708
  "be.storefront.mollieWebhookInvalid": "Notifik\xE1cia Mollie nenesie id platby.",
705
709
  "be.storefront.newCustomerNotEnrolled": "Nov\xFD z\xE1kazn\xEDk nie je v programe zap\xEDsan\xFD.",
710
+ "be.storefront.newsletterConfirmationInvalid": "Potvrdzovac\xED odkaz je neplatn\xFD alebo vypr\u0161al. Vy\u017Eiadajte si nov\xFD e-mail.",
706
711
  "be.storefront.noConsentRecorded": "N\xE1v\u0161tevn\xEDk nem\xE1 zaznamenan\xFD s\xFAhlas.",
707
712
  "be.storefront.noPickupPoints": "T\xE1to doprava nem\xE1 v\xFDdajn\xE9 miesta.",
708
713
  "be.storefront.noReferralRules": "Program nem\xE1 nastaven\xE9 odpor\xFA\u010Dacie pravidl\xE1.",
@@ -731,6 +736,7 @@ var ERROR_MESSAGES = {
731
736
  "be.storefront.paymentReconciliationInvalid": "\xDAdaje platobnej br\xE1ny nezodpovedaj\xFA objedn\xE1vke. Stav platby sa nezmenil.",
732
737
  "be.storefront.paypalMissingCredentials": "Met\xF3de PayPal ch\xFDbaj\xFA prihlasovacie \xFAdaje.",
733
738
  "be.storefront.paypalWebhookInvalid": "Notifik\xE1cia PayPal nenesie id objedn\xE1vky.",
739
+ "be.storefront.personalDiscountNotEligible": "Tento k\xF3d nemo\u017Eno pou\u017Ei\u0165 na t\xFAto objedn\xE1vku. Skontrolujte e-mail pr\xEDjemcu a podmienku prvej objedn\xE1vky.",
734
740
  "be.storefront.phoneRequired": "Na dokon\u010Denie objedn\xE1vky je potrebn\xE9 telef\xF3nne \u010D\xEDslo.",
735
741
  "be.storefront.pickupPointCountryMismatch": "Vyberte v\xFDdajn\xE9 miesto v krajine doru\u010Denia.",
736
742
  "be.storefront.pickupPointNotFound": "Vybran\xE9 v\xFDdajn\xE9 miesto dopravca nepozn\xE1. Vyberte pros\xEDm in\xE9.",
@@ -788,6 +794,8 @@ var ERROR_MESSAGES = {
788
794
  "be.storefront.tokenInvalid": "Neplatn\xFD alebo expirovan\xFD token.",
789
795
  "be.storefront.tokenWrongEshop": "Token pre tento e-shop neplat\xED.",
790
796
  "be.storefront.uniqueItemNoRestock": "Tento origin\xE1l sa znovu vyr\xE1ba\u0165 nebude, str\xE1\u017Ei\u0165 ho nejde. Nap\xED\u0161te n\xE1m, ak chcete podobn\xFD.",
797
+ "be.storefront.uniqueQuantityInvalid": "Unik\xE1t sa pred\xE1va po jednom kuse. Nastavte minim\xE1lny odber a krok mno\u017Estva na 1. Pri variantoch ozna\u010Dte jednotliv\xE9 kusy, nie cel\xFD spolo\u010Dn\xFD produkt.",
798
+ "be.storefront.uniqueStockInvalid": "Unik\xE1t m\xF4\u017Ee ma\u0165 na v\u0161etk\xFDch skladoch spolu 0 alebo 1 kus. Najprv opravte skladov\xE9 mno\u017Estvo.",
791
799
  "be.storefront.unknownPaymentProvider": "Nezn\xE1my poskytovate\u013E platieb {provider}.",
792
800
  "be.storefront.variantsOnlyParent": "Produkt {name} sa ned\xE1 k\xFApi\u0165 priamo. Vyberte jeden z jeho variantov.",
793
801
  "be.storefront.wishlistItemNotFound": "Polo\u017Eka ob\u013E\xFAben\xFDch sa nena\u0161la.",
@@ -990,6 +998,7 @@ var ERROR_MESSAGES = {
990
998
  "be.storefront.mollieMissingCredentials": "Mollie method is missing the API key",
991
999
  "be.storefront.mollieWebhookInvalid": "Mollie webhook is missing the payment id",
992
1000
  "be.storefront.newCustomerNotEnrolled": "New customer is not enrolled in this program",
1001
+ "be.storefront.newsletterConfirmationInvalid": "The confirmation link is invalid or expired. Request a new email.",
993
1002
  "be.storefront.noConsentRecorded": "No consent recorded for this visitor",
994
1003
  "be.storefront.noPickupPoints": "This shipping method has no pickup points",
995
1004
  "be.storefront.noReferralRules": "No referral rules configured for this program",
@@ -1018,6 +1027,7 @@ var ERROR_MESSAGES = {
1018
1027
  "be.storefront.paymentReconciliationInvalid": "The payment gateway data does not match the order. The payment status has not changed.",
1019
1028
  "be.storefront.paypalMissingCredentials": "PayPal method is missing credentials",
1020
1029
  "be.storefront.paypalWebhookInvalid": "PayPal webhook is missing the order id",
1030
+ "be.storefront.personalDiscountNotEligible": "This code is not eligible for this order. Check the recipient email and first-order requirement.",
1021
1031
  "be.storefront.phoneRequired": "Phone number is required to place this order",
1022
1032
  "be.storefront.pickupPointCountryMismatch": "Select a pickup point in the delivery country.",
1023
1033
  "be.storefront.pickupPointNotFound": "The carrier does not know the selected pickup point. Please choose another one.",
@@ -1075,6 +1085,8 @@ var ERROR_MESSAGES = {
1075
1085
  "be.storefront.tokenInvalid": "Invalid or expired token",
1076
1086
  "be.storefront.tokenWrongEshop": "Token is not valid for this e-shop",
1077
1087
  "be.storefront.uniqueItemNoRestock": "This one-of-a-kind piece will not be made again, so it cannot be watched. Contact us if you would like a similar one.",
1088
+ "be.storefront.uniqueQuantityInvalid": "A unique item is sold one piece at a time. Set the minimum order and quantity step to 1. Mark individual variants, not their shared parent product.",
1089
+ "be.storefront.uniqueStockInvalid": "A unique item can have a total stock of 0 or 1 across all warehouses. Correct the stock quantity first.",
1078
1090
  "be.storefront.unknownPaymentProvider": "Unknown payment provider",
1079
1091
  "be.storefront.variantsOnlyParent": "{name} cannot be purchased directly, choose one of its variants",
1080
1092
  "be.storefront.wishlistItemNotFound": "Wishlist item not found",
@@ -1191,12 +1203,157 @@ function formFieldErrors(err2) {
1191
1203
  }
1192
1204
  return out;
1193
1205
  }
1206
+
1207
+ // src/react/storage.ts
1208
+ var localStorageAdapter = {
1209
+ get(key) {
1210
+ try {
1211
+ return window.localStorage.getItem(key);
1212
+ } catch {
1213
+ return null;
1214
+ }
1215
+ },
1216
+ set(key, value) {
1217
+ try {
1218
+ window.localStorage.setItem(key, value);
1219
+ } catch {
1220
+ }
1221
+ },
1222
+ remove(key) {
1223
+ try {
1224
+ window.localStorage.removeItem(key);
1225
+ } catch {
1226
+ }
1227
+ }
1228
+ };
1229
+ function createMemoryStorage() {
1230
+ const store = /* @__PURE__ */ new Map();
1231
+ return {
1232
+ get(key) {
1233
+ return store.get(key) ?? null;
1234
+ },
1235
+ set(key, value) {
1236
+ store.set(key, value);
1237
+ },
1238
+ remove(key) {
1239
+ store.delete(key);
1240
+ }
1241
+ };
1242
+ }
1243
+ var memoryStorage = createMemoryStorage();
1244
+
1245
+ // src/form-popup.ts
1246
+ function preferenceMemory() {
1247
+ if (typeof window === "undefined") return /* @__PURE__ */ new Map();
1248
+ const browser = window;
1249
+ return browser.__behioFormPreferences ?? (browser.__behioFormPreferences = /* @__PURE__ */ new Map());
1250
+ }
1251
+ var memoryAdapter = { get: (k) => preferenceMemory().get(k) ?? null, set: (k, v) => {
1252
+ preferenceMemory().set(k, v);
1253
+ }, remove: (k) => {
1254
+ preferenceMemory().delete(k);
1255
+ } };
1256
+ var NEWSLETTER_REQUESTED_EVENT = "behio:newsletter-requested";
1257
+ var PREFIX = "behio:forms:";
1258
+ var VISIT_MS = 30 * 60 * 1e3;
1259
+ function sessionAdapter() {
1260
+ return { get: (key) => {
1261
+ try {
1262
+ return sessionStorage.getItem(key) ?? memoryAdapter.get(key);
1263
+ } catch {
1264
+ return memoryAdapter.get(key);
1265
+ }
1266
+ }, set: (key, value) => {
1267
+ memoryAdapter.set(key, value);
1268
+ try {
1269
+ sessionStorage.setItem(key, value);
1270
+ } catch {
1271
+ }
1272
+ }, remove: (key) => {
1273
+ memoryAdapter.remove(key);
1274
+ try {
1275
+ sessionStorage.removeItem(key);
1276
+ } catch {
1277
+ }
1278
+ } };
1279
+ }
1280
+ function markNewsletterRequested() {
1281
+ if (typeof window === "undefined") return;
1282
+ memoryAdapter.set(PREFIX + "newsletter", "1");
1283
+ localStorageAdapter.set(PREFIX + "newsletter", "1");
1284
+ if (typeof window !== "undefined") window.dispatchEvent(new Event(NEWSLETTER_REQUESTED_EVENT));
1285
+ }
1286
+ function newsletterWasRequested() {
1287
+ return memoryAdapter.get(PREFIX + "newsletter") === "1" || localStorageAdapter.get(PREFIX + "newsletter") === "1";
1288
+ }
1289
+ function matchesFormPath(rule, pathname) {
1290
+ return rule.endsWith("*") ? pathname.startsWith(rule.slice(0, -1)) : pathname === rule;
1291
+ }
1292
+ function formPopupRouteAllowed(pathname, placement) {
1293
+ if (/^\/(cart|checkout|account|order|newsletter|login|register|forgot-password|reset-password|verify-email|session)(\/|$)/.test(pathname)) return false;
1294
+ return (!placement.includePaths.length || placement.includePaths.some((rule) => matchesFormPath(rule, pathname))) && !placement.excludePaths.some((rule) => matchesFormPath(rule, pathname));
1295
+ }
1296
+ var FormPopupClock = class {
1297
+ constructor(elapsedMs = 0) {
1298
+ this.since = null;
1299
+ this.elapsedMs = Math.max(0, elapsedMs);
1300
+ }
1301
+ setVisible(visible, now) {
1302
+ if (this.since !== null) this.elapsedMs += Math.max(0, now - this.since);
1303
+ this.since = visible ? now : null;
1304
+ }
1305
+ elapsed(now) {
1306
+ return this.elapsedMs + (this.since === null ? 0 : Math.max(0, now - this.since));
1307
+ }
1308
+ };
1309
+ var FormPopupPreferences = class {
1310
+ constructor(session = sessionAdapter(), persistent = localStorageAdapter, now = () => Date.now()) {
1311
+ this.session = session;
1312
+ this.persistent = persistent;
1313
+ this.now = now;
1314
+ this.shownInVisit = this.number("shown", this.session) > this.now() || this.number("shown", this.persistent) > this.now();
1315
+ }
1316
+ number(key, storage) {
1317
+ const n = Number(storage.get(PREFIX + key));
1318
+ return Number.isFinite(n) && n >= 0 ? n : 0;
1319
+ }
1320
+ visibleMs() {
1321
+ return this.now() - this.number("activity", this.session) < VISIT_MS ? this.number("visible", this.session) : 0;
1322
+ }
1323
+ saveTime(visible) {
1324
+ if (this.shownInVisit) {
1325
+ const until = String(this.now() + VISIT_MS);
1326
+ this.session.set(PREFIX + "shown", until);
1327
+ this.persistent.set(PREFIX + "shown", until);
1328
+ }
1329
+ this.session.set(PREFIX + "visible", String(visible));
1330
+ this.session.set(PREFIX + "activity", String(this.now()));
1331
+ }
1332
+ suppressed(slug, newsletter = false) {
1333
+ return newsletter && newsletterWasRequested() || this.shownInVisit || this.number("shown", this.session) > this.now() || this.number("shown", this.persistent) > this.now() || this.number("dismissed:" + slug, this.persistent) > this.now() || this.number("dismissed:" + slug, this.session) > this.now();
1334
+ }
1335
+ shown() {
1336
+ this.shownInVisit = true;
1337
+ const until = String(this.now() + VISIT_MS);
1338
+ this.session.set(PREFIX + "shown", until);
1339
+ this.persistent.set(PREFIX + "shown", until);
1340
+ }
1341
+ dismiss(slug, days) {
1342
+ const key = PREFIX + "dismissed:" + slug;
1343
+ const until = String(this.now() + days * 864e5);
1344
+ this.session.set(key, until);
1345
+ this.persistent.set(key, until);
1346
+ }
1347
+ };
1194
1348
  export {
1195
1349
  AddressTypes,
1196
1350
  BehioApiError,
1197
1351
  BehioNetworkError,
1198
1352
  BehioStorefront,
1353
+ FormPopupClock,
1354
+ FormPopupPreferences,
1199
1355
  FulfillmentStatuses,
1356
+ NEWSLETTER_REQUESTED_EVENT,
1200
1357
  OrderStatuses,
1201
1358
  PaymentStatuses,
1202
1359
  ProductSort,
@@ -1210,10 +1367,14 @@ export {
1210
1367
  errorParams,
1211
1368
  findVariantByAttributes,
1212
1369
  formFieldErrors,
1370
+ formPopupRouteAllowed,
1213
1371
  formatPrice,
1214
1372
  generateVisitorId,
1215
1373
  getStoredVisitorId,
1216
1374
  grantAnalyticsConsent,
1375
+ markNewsletterRequested,
1376
+ matchesFormPath,
1377
+ newsletterWasRequested,
1217
1378
  ok,
1218
1379
  publishCartSummary,
1219
1380
  resolveVariantContent,
package/dist/next.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { q as BehioStorefrontConfig, B as BehioStorefront } from './client-Bm8Fwcp7.mjs';
1
+ import { r as BehioStorefrontConfig, B as BehioStorefront } from './client-DtAz0rDJ.mjs';
2
2
 
3
3
  interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
4
4
  /** Override the cart session cookie name (default: "behio_cart_session"). */
package/dist/next.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { q as BehioStorefrontConfig, B as BehioStorefront } from './client-Bm8Fwcp7.js';
1
+ import { r as BehioStorefrontConfig, B as BehioStorefront } from './client-DtAz0rDJ.js';
2
2
 
3
3
  interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
4
4
  /** Override the cart session cookie name (default: "behio_cart_session"). */
package/dist/next.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkIB3DU7B6js = require('./chunk-IB3DU7B6.js');
3
+ var _chunkOUPCGMSRjs = require('./chunk-OUPCGMSR.js');
4
4
 
5
5
  // src/next.ts
6
6
  var _headers = require('next/headers');
@@ -19,7 +19,7 @@ async function getBehio(options = {}) {
19
19
  const locale = _nullishCoalesce(options.locale, () => ( process.env.BEHIO_LOCALE));
20
20
  const currency = _nullishCoalesce(options.currency, () => ( process.env.BEHIO_CURRENCY));
21
21
  const cookieName = _nullishCoalesce(options.cartCookieName, () => ( CART_COOKIE_NAME));
22
- const client = new (0, _chunkIB3DU7B6js.BehioStorefront)({
22
+ const client = new (0, _chunkOUPCGMSRjs.BehioStorefront)({
23
23
  apiKey,
24
24
  ...baseUrl ? { baseUrl } : {},
25
25
  ...locale ? { locale } : {},
package/dist/next.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BehioStorefront
3
- } from "./chunk-VYJLUJXO.mjs";
3
+ } from "./chunk-25UM2XCS.mjs";
4
4
 
5
5
  // src/next.ts
6
6
  import { cookies, headers } from "next/headers";