@pelcro/react-pelcro-js 2.4.0 → 2.6.0-beta.11

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.esm.js CHANGED
@@ -3432,6 +3432,7 @@ var paymentMethod_fr = {
3432
3432
  };
3433
3433
 
3434
3434
  var title$d = "Enter your email to subscribe to our newsletter";
3435
+ var updateTitle$1 = "Update newsletter selections";
3435
3436
  var subtitle$7 = "We may use your email for other marketing communication";
3436
3437
  var labels$l = {
3437
3438
  submit: "Submit",
@@ -3443,22 +3444,21 @@ var labels$l = {
3443
3444
  };
3444
3445
  var messages$p = {
3445
3446
  alreadyHaveAccount: "Already have an account?",
3447
+ success: "Newsletters were successfully updated",
3446
3448
  loginHere: "Login here.",
3447
3449
  createAnAccount: " Create an account by clicking ",
3448
3450
  here: "here"
3449
3451
  };
3450
- var errors$b = {
3451
- "": ""
3452
- };
3453
3452
  var newsletter_en = {
3454
3453
  title: title$d,
3454
+ updateTitle: updateTitle$1,
3455
3455
  subtitle: subtitle$7,
3456
3456
  labels: labels$l,
3457
- messages: messages$p,
3458
- errors: errors$b
3457
+ messages: messages$p
3459
3458
  };
3460
3459
 
3461
3460
  var title$c = "Entrez votre adresse courriel pour vous abonner à notre infolettre";
3461
+ var updateTitle = "Mettre à jour son choix d'infolettres";
3462
3462
  var subtitle$6 = "Nous pouvons utiliser votre adresse courriel pour d’autres communications marketing";
3463
3463
  var labels$k = {
3464
3464
  submit: "Lire l’article !",
@@ -3470,19 +3470,17 @@ var labels$k = {
3470
3470
  };
3471
3471
  var messages$o = {
3472
3472
  alreadyHaveAccount: "Vous avez déjà un compte ?",
3473
+ success: "Votre choix d'infolettres à été mis à jour",
3473
3474
  loginHere: "Connectez-vous ici",
3474
3475
  createAnAccount: " Créez un compte en cliquant ",
3475
3476
  here: "ici"
3476
3477
  };
3477
- var errors$a = {
3478
- "": ""
3479
- };
3480
3478
  var newsletter_fr = {
3481
3479
  title: title$c,
3480
+ updateTitle: updateTitle,
3482
3481
  subtitle: subtitle$6,
3483
3482
  labels: labels$k,
3484
- messages: messages$o,
3485
- errors: errors$a
3483
+ messages: messages$o
3486
3484
  };
3487
3485
 
3488
3486
  var labels$j = {
@@ -3591,7 +3589,8 @@ var labels$h = {
3591
3589
  code: "Coupon code",
3592
3590
  "for": "for",
3593
3591
  interval: "{{count}} {{interval}}",
3594
- interval_plural: "{{count}} {{interval}}s"
3592
+ interval_plural: "{{count}} {{interval}}s",
3593
+ tax: "+ Tax"
3595
3594
  };
3596
3595
  var checkoutForm_en = {
3597
3596
  messages: messages$j,
@@ -3616,7 +3615,8 @@ var labels$g = {
3616
3615
  code: "Code promo",
3617
3616
  "for": "pour",
3618
3617
  interval: "{{count}} {{interval}}",
3619
- interval_plural: "{{count}} {{interval}}s"
3618
+ interval_plural: "{{count}} {{interval}}s",
3619
+ tax: "+ Taxe"
3620
3620
  };
3621
3621
  var checkoutForm_fr = {
3622
3622
  messages: messages$i,
@@ -3628,12 +3628,14 @@ var cancel$1 = "Cancel your subscription online at anytime.";
3628
3628
  var giftSent$1 = "Subscription gift has been sent to";
3629
3629
  var successfully$1 = "successfully";
3630
3630
  var entitlement$1 = "Some of the content on this page is available with one or more of our plans. <1>Subscribe</1> now to get full page access.";
3631
+ var recaptcha$1 = "This site is protected by reCAPTCHA and the Google <1>Privacy Policy</1> and <3>Terms of Service</3> apply.";
3631
3632
  var messages_en = {
3632
3633
  youAreSafe: youAreSafe$1,
3633
3634
  cancel: cancel$1,
3634
3635
  giftSent: giftSent$1,
3635
3636
  successfully: successfully$1,
3636
- entitlement: entitlement$1
3637
+ entitlement: entitlement$1,
3638
+ recaptcha: recaptcha$1
3637
3639
  };
3638
3640
 
3639
3641
  var youAreSafe = "Vous êtes en sécurité - PCI conforme 128 SSL par";
@@ -3641,12 +3643,14 @@ var cancel = "Annuler votre abonnement en ligne à tout moment.";
3641
3643
  var giftSent = "Le cadeau d’abonnement a été envoyé à";
3642
3644
  var successfully = "avec succès.";
3643
3645
  var entitlement = "Une partie du contenu de cette page est disponible sous un ou plusieurs de nos plans. <1>Abonnez-vous</1> à l'un de nos plans disponibles pour accéder à plus de contenu";
3646
+ var recaptcha = "Ce site est protégé par reCAPTCHA - les <1>règles de confidentialité</1> Google ainsi que les <3>conditions d'utilisation</3> s'appliquent.";
3644
3647
  var messages_fr = {
3645
3648
  youAreSafe: youAreSafe,
3646
3649
  cancel: cancel,
3647
3650
  giftSent: giftSent,
3648
3651
  successfully: successfully,
3649
- entitlement: entitlement
3652
+ entitlement: entitlement,
3653
+ recaptcha: recaptcha
3650
3654
  };
3651
3655
 
3652
3656
  var labels$f = {
@@ -4329,7 +4333,8 @@ var labels$3 = {
4329
4333
  title: "Status",
4330
4334
  active: "Active",
4331
4335
  inTrial: "In trial",
4332
- endingSoon: "Ending soon"
4336
+ endingSoon: "Ending soon",
4337
+ scheduled: "Scheduled"
4333
4338
  },
4334
4339
  shipments: "Shipments remaining",
4335
4340
  logout: "Logout",
@@ -4345,6 +4350,7 @@ var labels$3 = {
4345
4350
  profile: "Profile",
4346
4351
  updateProfile: "Edit profile",
4347
4352
  changePassword: "Change password",
4353
+ editNewsletters: "Edit newsletters",
4348
4354
  edit: "Edit",
4349
4355
  gifts: "Gifts",
4350
4356
  redeemGift: "Redeem gift",
@@ -4354,6 +4360,7 @@ var labels$3 = {
4354
4360
  paymentSource: "Payment cards",
4355
4361
  actions: "Actions",
4356
4362
  expiresOn: "Ends",
4363
+ startsOn: "Starts",
4357
4364
  renewsOn: "Renews",
4358
4365
  canceledOn: "Canceled on",
4359
4366
  recipient: "Recipient",
@@ -4405,7 +4412,8 @@ var labels$2 = {
4405
4412
  title: "Statut",
4406
4413
  active: "Active",
4407
4414
  inTrial: "Dans l'essai",
4408
- endingSoon: "Fin bientôt"
4415
+ endingSoon: "Fin bientôt",
4416
+ scheduled: "Programmé"
4409
4417
  },
4410
4418
  shipments: "Expéditions restantes",
4411
4419
  logout: "Déconnexion",
@@ -4421,6 +4429,7 @@ var labels$2 = {
4421
4429
  profile: "Profil",
4422
4430
  updateProfile: "Mettre à jour le profil",
4423
4431
  changePassword: "Changer le mot de passe",
4432
+ editNewsletters: "Modifier les newsletters",
4424
4433
  edit: "Modifier",
4425
4434
  gifts: "Cadeaux",
4426
4435
  redeemGift: "Échanger un cadeau",
@@ -4430,6 +4439,7 @@ var labels$2 = {
4430
4439
  paymentSource: "Sources de paiement",
4431
4440
  actions: "Actes",
4432
4441
  expiresOn: "Expire le",
4442
+ startsOn: "Débute le",
4433
4443
  renewsOn: "Renouvelle le",
4434
4444
  canceledOn: "Annulé le",
4435
4445
  recipient: "Destinataire",
@@ -4462,7 +4472,7 @@ var messages$2 = {
4462
4472
  isSureToCancel: "Êtes-vous certain de vouloir annuler votre abonnement?",
4463
4473
  loading: "Annulation de l'abonnement",
4464
4474
  success: "L'abonnement a été annulé avec succès",
4465
- error: "Une erreure s'est produite lors de l'annulation de l'abonnement"
4475
+ error: "Une erreur s'est produite lors de l'annulation de l'abonnement"
4466
4476
  }
4467
4477
  };
4468
4478
  var dashboard_fr = {
@@ -5897,7 +5907,7 @@ class PelcroActions {
5897
5907
  view,
5898
5908
  cartItems,
5899
5909
  ...otherStateFields
5900
- } = initialState$f;
5910
+ } = initialState$g;
5901
5911
  this.set(otherStateFields);
5902
5912
  });
5903
5913
 
@@ -6187,7 +6197,7 @@ class PelcroCallbacks {
6187
6197
 
6188
6198
  }
6189
6199
 
6190
- const initialState$f = {
6200
+ const initialState$g = {
6191
6201
  // View
6192
6202
  view: null,
6193
6203
  // Plans
@@ -6215,7 +6225,7 @@ const createPelcroStore = () => createStore(middleware_3((set, get) => {
6215
6225
  return {
6216
6226
  // Store setter
6217
6227
  set,
6218
- ...initialState$f,
6228
+ ...initialState$g,
6219
6229
  // State actions
6220
6230
  ...actions,
6221
6231
  // Callbacks
@@ -6295,13 +6305,34 @@ const getAddressById = id => {
6295
6305
  };
6296
6306
  /**
6297
6307
  * Transforms locale names stored in our backend like
6298
- * "en_US" into the standerd accepted in core i18n methods: "en-US"
6308
+ * "en_US" into the standard accepted in core i18n methods: "en-US"
6299
6309
  * @param {string} localeName
6300
6310
  * @return {string | undefined}
6301
6311
  * @example getCanonicalLocaleFormat("en_US") => "en-US"
6302
6312
  */
6303
6313
 
6304
6314
  const getCanonicalLocaleFormat = localeName => localeName === null || localeName === void 0 ? void 0 : localeName.replace("_", "-");
6315
+ /**
6316
+ * @param {string} localeName
6317
+ * @return {string | undefined}
6318
+ * @example getLanguageWithoutRegion("en-US") => "en"
6319
+ */
6320
+
6321
+ const getLanguageWithoutRegion = localeName => {
6322
+ var _getCanonicalLocaleFo;
6323
+
6324
+ return (_getCanonicalLocaleFo = getCanonicalLocaleFormat(localeName)) === null || _getCanonicalLocaleFo === void 0 ? void 0 : _getCanonicalLocaleFo.split("-")[0];
6325
+ };
6326
+ /**
6327
+ * Gets the current page language or fallbacks to site default
6328
+ * @return {string | undefined}
6329
+ */
6330
+
6331
+ const getPageOrDefaultLanguage = () => {
6332
+ var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
6333
+
6334
+ return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.call(_window$Pelcro$site)) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.default_locale);
6335
+ };
6305
6336
  /**
6306
6337
  * Returns a formatted price string depending on locale
6307
6338
  * @param {number} amount
@@ -6311,7 +6342,7 @@ const getCanonicalLocaleFormat = localeName => localeName === null || localeName
6311
6342
  * @example getFormattedPriceByLocal(10, 'USD', 'en-US') => "$10.00"
6312
6343
  */
6313
6344
 
6314
- const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en-US") => {
6345
+ const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en") => {
6315
6346
  const formatter = new Intl.NumberFormat(getCanonicalLocaleFormat(locale), {
6316
6347
  style: "currency",
6317
6348
  currency
@@ -6336,8 +6367,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
6336
6367
  totalWithoutDividingBy100 += parseFloat(item.price ? (item.price * item.quantity).toFixed(2) : item.amount.toFixed(2));
6337
6368
  }
6338
6369
 
6339
- const locale = window.Pelcro.site.read().default_locale;
6340
- return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, locale);
6370
+ return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
6341
6371
  };
6342
6372
  /**
6343
6373
  * returns true if the URL contains a supported view trigger URL
@@ -6346,11 +6376,43 @@ const calcAndFormatItemsTotal = (items, currency) => {
6346
6376
  */
6347
6377
 
6348
6378
  const isValidViewFromURL = viewID => {
6349
- if (["login", "register", "plan-select", "gift-redeem", "password-forgot", "password-reset", "password-change", "payment-method-update", "user-edit", "newsletter", "address-create", "order-create", "cart"].includes(viewID)) {
6379
+ if (["login", "register", "plan-select", "gift-redeem", "password-forgot", "password-reset", "password-change", "payment-method-update", "user-edit", "newsletter", "address-create", "order-create", "cart"].includes(viewID) || hasValidNewsletterUpdateUrl()) {
6350
6380
  return true;
6351
6381
  }
6352
6382
 
6353
6383
  return false;
6384
+ /**
6385
+ *
6386
+ */
6387
+
6388
+ function hasValidNewsletterUpdateUrl() {
6389
+ var _window$Pelcro2, _window$Pelcro2$uiSet;
6390
+
6391
+ if (viewID !== "newsletter-update") return false;
6392
+ const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
6393
+ const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
6394
+
6395
+ if (!siteHasNewslettersDefined) {
6396
+ return false;
6397
+ }
6398
+
6399
+ const queryParamEmail = window.Pelcro.helpers.getURLParameter("email");
6400
+
6401
+ if (queryParamEmail && window.Pelcro.user.isAuthenticated()) {
6402
+ var _window$Pelcro$user$r4;
6403
+
6404
+ if (queryParamEmail !== ((_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.email)) {
6405
+ console.error("email query parameter and user account email are different, url email query parameter must match user email if user is logged in");
6406
+ return false;
6407
+ }
6408
+ }
6409
+
6410
+ if (!queryParamEmail && !window.Pelcro.user.isAuthenticated()) {
6411
+ return false;
6412
+ }
6413
+
6414
+ return true;
6415
+ }
6354
6416
  };
6355
6417
  /**
6356
6418
  * Returns the current stable viewID from all old variations
@@ -6382,7 +6444,7 @@ const disableScroll = () => {
6382
6444
  }
6383
6445
  };
6384
6446
  const trackSubscriptionOnGA = () => {
6385
- var _ReactGA$set, _window$Pelcro$user$r4, _window$Pelcro$user$r5, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
6447
+ var _ReactGA$set, _window$Pelcro$user$r5, _window$Pelcro$user$r6, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
6386
6448
 
6387
6449
  const {
6388
6450
  product,
@@ -6404,7 +6466,7 @@ const trackSubscriptionOnGA = () => {
6404
6466
  }
6405
6467
 
6406
6468
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
6407
- currencyCode: (_window$Pelcro$user$r4 = (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.currency) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : plan.currency
6469
+ currencyCode: (_window$Pelcro$user$r5 = (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.currency) !== null && _window$Pelcro$user$r5 !== void 0 ? _window$Pelcro$user$r5 : plan.currency
6408
6470
  });
6409
6471
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$execu = _ReactGA$plugin.execute) === null || _ReactGA$plugin$execu === void 0 ? void 0 : _ReactGA$plugin$execu.call(_ReactGA$plugin, "ecommerce", "addTransaction", {
6410
6472
  id: lastSubscriptionId,
@@ -6432,9 +6494,9 @@ const trackSubscriptionOnGA = () => {
6432
6494
  */
6433
6495
 
6434
6496
  const userHasPaymentMethod = () => {
6435
- var _window$Pelcro$user$r6, _window$Pelcro$user$r7;
6497
+ var _window$Pelcro$user$r7, _window$Pelcro$user$r8;
6436
6498
 
6437
- const sources = (_window$Pelcro$user$r6 = (_window$Pelcro$user$r7 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.sources) !== null && _window$Pelcro$user$r6 !== void 0 ? _window$Pelcro$user$r6 : [];
6499
+ const sources = (_window$Pelcro$user$r7 = (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.sources) !== null && _window$Pelcro$user$r7 !== void 0 ? _window$Pelcro$user$r7 : [];
6438
6500
  return sources.length > 0;
6439
6501
  };
6440
6502
  /**
@@ -6500,10 +6562,20 @@ const getPaymentCardIcon$1 = name => {
6500
6562
  d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"
6501
6563
  }));
6502
6564
  };
6565
+ /**
6566
+ * Gets the current date with time set to 0
6567
+ * @param {Date} dateObject
6568
+ * @return {Date}
6569
+ */
6570
+
6571
+ function getDateWithoutTime(dateObject) {
6572
+ const date = new Date(dateObject.getTime());
6573
+ date.setHours(0, 0, 0, 0);
6574
+ return date;
6575
+ }
6503
6576
 
6504
- var _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
6505
6577
  const resources = {
6506
- "en-US": {
6578
+ en: {
6507
6579
  common: common_en,
6508
6580
  paymentMethod: paymentMethod_en,
6509
6581
  newsletter: newsletter_en,
@@ -6525,7 +6597,7 @@ const resources = {
6525
6597
  select: select_en,
6526
6598
  notification: notification_en
6527
6599
  },
6528
- "fr-CA": {
6600
+ fr: {
6529
6601
  common: common_fr,
6530
6602
  paymentMethod: paymentMethod_fr,
6531
6603
  newsletter: newsletter_fr,
@@ -6547,13 +6619,14 @@ const resources = {
6547
6619
  select: select_fr,
6548
6620
  notification: notification_fr
6549
6621
  }
6550
- };
6551
- let locale = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.call(_window$Pelcro$site)) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.default_locale;
6552
- if (!locale) locale = "en-US";
6622
+ }; // set UI language to the page language or default to the language in site settings
6623
+
6624
+ const locale = getPageOrDefaultLanguage();
6553
6625
  i18next.use(initReactI18next) // passes i18n down to react-i18next,
6554
6626
  .init({
6555
6627
  resources,
6556
- lng: getCanonicalLocaleFormat(locale),
6628
+ lng: locale,
6629
+ fallbackLng: "en",
6557
6630
  // debug: true,
6558
6631
  interpolation: {
6559
6632
  escapeValue: false // react already safes from xss
@@ -6564,6 +6637,16 @@ i18next.use(initReactI18next) // passes i18n down to react-i18next,
6564
6637
 
6565
6638
  }
6566
6639
  });
6640
+ const pageLanguageObserver = new MutationObserver(mutationsList => {
6641
+ mutationsList.forEach(mutationRecord => {
6642
+ if (mutationRecord.attributeName === "lang") {
6643
+ i18next.changeLanguage(window.Pelcro.helpers.getHtmlLanguageAttribute());
6644
+ }
6645
+ });
6646
+ });
6647
+ pageLanguageObserver.observe(document.documentElement, {
6648
+ attributes: true
6649
+ });
6567
6650
 
6568
6651
  function _classPrivateFieldGet(receiver, privateMap) {
6569
6652
  var descriptor = privateMap.get(receiver);
@@ -6816,8 +6899,8 @@ const saveToMetadataButton = new SaveToMetadataButtonClass();
6816
6899
 
6817
6900
  let e={data:""},t=t=>"undefined"!=typeof window?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||e,l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(})/g,a=/\/\*[^]*?\*\/|\s\s+|\n/g,n=(e,t)=>{let r,l="",a="",o="";for(let c in e){let s=e[c];"object"==typeof s?(r=t?t.replace(/([^,])+/g,e=>c.replace(/([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):c,a+="@"==c[0]?"f"==c[1]?n(s,c):c+"{"+n(s,"k"==c[1]?"":t)+"}":n(s,r)):"@"==c[0]&&"i"==c[1]?l=c+" "+s+";":(c=c.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=n.p?n.p(c,s):c+":"+s+";");}return o[0]?(r=t?t+"{"+o+"}":o,l+r+a):l+a},o={},c=e=>{let t="";for(let r in e)t+=r+("object"==typeof e[r]?c(e[r]):e[r]);return t},s=(e,t,r,s,i)=>{let p="object"==typeof e?c(e):e,u=o[p]||(o[p]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(p));if(!o[u]){let t="object"==typeof e?e:(e=>{let t,r=[{}];for(;t=l.exec(e.replace(a,""));)t[4]&&r.shift(),t[3]?r.unshift(r[0][t[3]]=r[0][t[3]]||{}):t[4]||(r[0][t[1]]=t[2]);return r[0]})(e);o[u]=n(i?{["@keyframes "+u]:t}:t,r?"":"."+u);}return ((e,t,r)=>{-1==t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(o[u],t,s),u},i=(e,t,r)=>e.reduce((e,l,a)=>{let o=t[a];if(o&&o.call){let e=o(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;o=t?"."+t:e&&"object"==typeof e?e.props?"":n(e,""):e;}return e+l+(null==o?"":o)},"");function p(e){let r=this||{},l=e.call?e(r.p):e;return s(l.unshift?l.raw?i(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>t?Object.assign(e,t.call?t(r.p):t):e,{}):l,t(r.target),r.g,r.o,r.k)}let u,f,d;p.bind({g:1});let b=p.bind({k:1});function h(e,t,r,l){n.p=t,u=e,f=r,d=l;}function y(e,t){let r=this||{};return function(){let l=arguments;function a(n,o){let c=Object.assign({},n),s=c.className||a.className;r.p=Object.assign({theme:f&&f()},c),r.o=/ *go\d+/.test(s),c.className=p.apply(r,l)+(s?" "+s:""),t&&(c.ref=o);let i=c.as||e;return d&&i[0]&&d(c),u(i,c)}return t?t(a):a}}
6818
6901
 
6819
- function _extends$t() {
6820
- _extends$t = Object.assign || function (target) {
6902
+ function _extends$v() {
6903
+ _extends$v = Object.assign || function (target) {
6821
6904
  for (var i = 1; i < arguments.length; i++) {
6822
6905
  var source = arguments[i];
6823
6906
 
@@ -6831,7 +6914,7 @@ function _extends$t() {
6831
6914
  return target;
6832
6915
  };
6833
6916
 
6834
- return _extends$t.apply(this, arguments);
6917
+ return _extends$v.apply(this, arguments);
6835
6918
  }
6836
6919
 
6837
6920
  function _taggedTemplateLiteralLoose(strings, raw) {
@@ -6921,7 +7004,7 @@ var clearFromRemoveQueue = function clearFromRemoveQueue(toastId) {
6921
7004
  var reducer = function reducer(state, action) {
6922
7005
  switch (action.type) {
6923
7006
  case ActionType.ADD_TOAST:
6924
- return _extends$t({}, state, {
7007
+ return _extends$v({}, state, {
6925
7008
  toasts: [action.toast].concat(state.toasts).slice(0, TOAST_LIMIT)
6926
7009
  });
6927
7010
 
@@ -6931,9 +7014,9 @@ var reducer = function reducer(state, action) {
6931
7014
  clearFromRemoveQueue(action.toast.id);
6932
7015
  }
6933
7016
 
6934
- return _extends$t({}, state, {
7017
+ return _extends$v({}, state, {
6935
7018
  toasts: state.toasts.map(function (t) {
6936
- return t.id === action.toast.id ? _extends$t({}, t, action.toast) : t;
7019
+ return t.id === action.toast.id ? _extends$v({}, t, action.toast) : t;
6937
7020
  })
6938
7021
  });
6939
7022
 
@@ -6960,9 +7043,9 @@ var reducer = function reducer(state, action) {
6960
7043
  });
6961
7044
  }
6962
7045
 
6963
- return _extends$t({}, state, {
7046
+ return _extends$v({}, state, {
6964
7047
  toasts: state.toasts.map(function (t) {
6965
- return t.id === toastId || toastId === undefined ? _extends$t({}, t, {
7048
+ return t.id === toastId || toastId === undefined ? _extends$v({}, t, {
6966
7049
  visible: false
6967
7050
  }) : t;
6968
7051
  })
@@ -6970,28 +7053,28 @@ var reducer = function reducer(state, action) {
6970
7053
 
6971
7054
  case ActionType.REMOVE_TOAST:
6972
7055
  if (action.toastId === undefined) {
6973
- return _extends$t({}, state, {
7056
+ return _extends$v({}, state, {
6974
7057
  toasts: []
6975
7058
  });
6976
7059
  }
6977
7060
 
6978
- return _extends$t({}, state, {
7061
+ return _extends$v({}, state, {
6979
7062
  toasts: state.toasts.filter(function (t) {
6980
7063
  return t.id !== action.toastId;
6981
7064
  })
6982
7065
  });
6983
7066
 
6984
7067
  case ActionType.START_PAUSE:
6985
- return _extends$t({}, state, {
7068
+ return _extends$v({}, state, {
6986
7069
  pausedAt: action.time
6987
7070
  });
6988
7071
 
6989
7072
  case ActionType.END_PAUSE:
6990
7073
  var diff = action.time - (state.pausedAt || 0);
6991
- return _extends$t({}, state, {
7074
+ return _extends$v({}, state, {
6992
7075
  pausedAt: undefined,
6993
7076
  toasts: state.toasts.map(function (t) {
6994
- return _extends$t({}, t, {
7077
+ return _extends$v({}, t, {
6995
7078
  pauseDuration: t.pauseDuration + diff
6996
7079
  });
6997
7080
  })
@@ -7038,12 +7121,12 @@ var useStore = function useStore(toastOptions) {
7038
7121
  var mergedToasts = state.toasts.map(function (t) {
7039
7122
  var _toastOptions$t$type, _toastOptions, _toastOptions$t$type2;
7040
7123
 
7041
- return _extends$t({}, toastOptions, toastOptions[t.type], t, {
7124
+ return _extends$v({}, toastOptions, toastOptions[t.type], t, {
7042
7125
  duration: t.duration || ((_toastOptions$t$type = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type.duration) || ((_toastOptions = toastOptions) == null ? void 0 : _toastOptions.duration) || defaultTimeouts[t.type],
7043
- style: _extends$t({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7126
+ style: _extends$v({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7044
7127
  });
7045
7128
  });
7046
- return _extends$t({}, state, {
7129
+ return _extends$v({}, state, {
7047
7130
  toasts: mergedToasts
7048
7131
  });
7049
7132
  };
@@ -7053,7 +7136,7 @@ var createToast = function createToast(message, type, opts) {
7053
7136
  type = 'blank';
7054
7137
  }
7055
7138
 
7056
- return _extends$t({
7139
+ return _extends$v({
7057
7140
  createdAt: Date.now(),
7058
7141
  visible: true,
7059
7142
  type: type,
@@ -7103,14 +7186,14 @@ toast.remove = function (toastId) {
7103
7186
  };
7104
7187
 
7105
7188
  toast.promise = function (promise, msgs, opts) {
7106
- var id = toast.loading(msgs.loading, _extends$t({}, opts, opts == null ? void 0 : opts.loading));
7189
+ var id = toast.loading(msgs.loading, _extends$v({}, opts, opts == null ? void 0 : opts.loading));
7107
7190
  promise.then(function (p) {
7108
- toast.success(resolveValue(msgs.success, p), _extends$t({
7191
+ toast.success(resolveValue(msgs.success, p), _extends$v({
7109
7192
  id: id
7110
7193
  }, opts, opts == null ? void 0 : opts.success));
7111
7194
  return p;
7112
7195
  })["catch"](function (e) {
7113
- toast.error(resolveValue(msgs.error, e), _extends$t({
7196
+ toast.error(resolveValue(msgs.error, e), _extends$v({
7114
7197
  id: id
7115
7198
  }, opts, opts == null ? void 0 : opts.error));
7116
7199
  });
@@ -7449,7 +7532,7 @@ var ToastBar = /*#__PURE__*/memo(function (_ref2) {
7449
7532
  var message = createElement(Message, Object.assign({}, toast.ariaProps), resolveValue(toast.message, toast));
7450
7533
  return createElement(ToastBarBase, {
7451
7534
  className: toast.className,
7452
- style: _extends$t({}, animationStyle, style, toast.style)
7535
+ style: _extends$v({}, animationStyle, style, toast.style)
7453
7536
  }, typeof children === 'function' ? children({
7454
7537
  icon: icon,
7455
7538
  message: message
@@ -7479,7 +7562,7 @@ var getPositionStyle = function getPositionStyle(position, offset) {
7479
7562
  } : position.includes('right') ? {
7480
7563
  justifyContent: 'flex-end'
7481
7564
  } : {};
7482
- return _extends$t({
7565
+ return _extends$v({
7483
7566
  left: 0,
7484
7567
  right: 0,
7485
7568
  display: 'flex',
@@ -7506,7 +7589,7 @@ var Toaster = function Toaster(_ref) {
7506
7589
  handlers = _useToaster.handlers;
7507
7590
 
7508
7591
  return createElement("div", {
7509
- style: _extends$t({
7592
+ style: _extends$v({
7510
7593
  position: 'fixed',
7511
7594
  zIndex: 9999,
7512
7595
  top: DEFAULT_OFFSET,
@@ -7541,82 +7624,82 @@ var Toaster = function Toaster(_ref) {
7541
7624
  }));
7542
7625
  };
7543
7626
 
7544
- var _path$q;
7627
+ var _path$s;
7545
7628
 
7546
- function _extends$s() { _extends$s = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
7629
+ function _extends$u() { _extends$u = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
7547
7630
 
7548
7631
  function SvgCheckSolid(props) {
7549
- return /*#__PURE__*/React.createElement("svg", _extends$s({
7632
+ return /*#__PURE__*/React.createElement("svg", _extends$u({
7550
7633
  xmlns: "http://www.w3.org/2000/svg",
7551
7634
  className: "h-5 w-5",
7552
7635
  viewBox: "0 0 20 20",
7553
7636
  fill: "currentColor"
7554
- }, props), _path$q || (_path$q = /*#__PURE__*/React.createElement("path", {
7637
+ }, props), _path$s || (_path$s = /*#__PURE__*/React.createElement("path", {
7555
7638
  fillRule: "evenodd",
7556
7639
  d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
7557
7640
  clipRule: "evenodd"
7558
7641
  })));
7559
7642
  }
7560
7643
 
7561
- var _path$p;
7644
+ var _path$r;
7562
7645
 
7563
- function _extends$r() { _extends$r = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
7646
+ function _extends$t() { _extends$t = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
7564
7647
 
7565
7648
  function SvgXIcon(props) {
7566
- return /*#__PURE__*/React.createElement("svg", _extends$r({
7649
+ return /*#__PURE__*/React.createElement("svg", _extends$t({
7567
7650
  xmlns: "http://www.w3.org/2000/svg",
7568
7651
  viewBox: "0 0 20 20",
7569
7652
  fill: "currentColor"
7570
- }, props), _path$p || (_path$p = /*#__PURE__*/React.createElement("path", {
7653
+ }, props), _path$r || (_path$r = /*#__PURE__*/React.createElement("path", {
7571
7654
  fill: "evenodd",
7572
7655
  d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
7573
7656
  clipRule: "evenodd"
7574
7657
  })));
7575
7658
  }
7576
7659
 
7577
- var _path$o;
7660
+ var _path$q;
7578
7661
 
7579
- function _extends$q() { _extends$q = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
7662
+ function _extends$s() { _extends$s = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
7580
7663
 
7581
7664
  function SvgXIconSolid(props) {
7582
- return /*#__PURE__*/React.createElement("svg", _extends$q({
7665
+ return /*#__PURE__*/React.createElement("svg", _extends$s({
7583
7666
  className: "plc-w-4 plc-h-4",
7584
7667
  fill: "currentColor",
7585
7668
  xmlns: "http://www.w3.org/2000/svg",
7586
7669
  viewBox: "0 0 100 100"
7587
- }, props), _path$o || (_path$o = /*#__PURE__*/React.createElement("path", {
7670
+ }, props), _path$q || (_path$q = /*#__PURE__*/React.createElement("path", {
7588
7671
  d: "M94.842 48.408c0 24.852-20.148 44.999-45.002 44.999-24.851 0-44.997-20.146-44.997-44.999 0-24.854 20.146-45 44.997-45 24.853 0 45.002 20.146 45.002 45zM71.073 64.841L54.73 48.497l16.344-16.344-4.979-4.979-16.343 16.345-16.343-16.344-4.799 4.799 16.344 16.344L28.61 64.661l4.979 4.978 16.344-16.344 16.343 16.344 4.797-4.798z"
7589
7672
  })));
7590
7673
  }
7591
7674
 
7592
- var _path$n;
7675
+ var _path$p;
7593
7676
 
7594
- function _extends$p() { _extends$p = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
7677
+ function _extends$r() { _extends$r = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
7595
7678
 
7596
7679
  function SvgExclamation(props) {
7597
- return /*#__PURE__*/React.createElement("svg", _extends$p({
7680
+ return /*#__PURE__*/React.createElement("svg", _extends$r({
7598
7681
  className: "plc-w-4 plc-h-4 plc-mr-1",
7599
7682
  xmlns: "http://www.w3.org/2000/svg",
7600
7683
  viewBox: "0 0 20 20",
7601
7684
  fill: "currentColor"
7602
- }, props), _path$n || (_path$n = /*#__PURE__*/React.createElement("path", {
7685
+ }, props), _path$p || (_path$p = /*#__PURE__*/React.createElement("path", {
7603
7686
  fillRule: "evenodd",
7604
7687
  d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",
7605
7688
  clipRule: "evenodd"
7606
7689
  })));
7607
7690
  }
7608
7691
 
7609
- var _path$m, _path2$3;
7692
+ var _path$o, _path2$3;
7610
7693
 
7611
- function _extends$o() { _extends$o = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
7694
+ function _extends$q() { _extends$q = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
7612
7695
 
7613
7696
  function SvgSpinner(props) {
7614
- return /*#__PURE__*/React.createElement("svg", _extends$o({
7697
+ return /*#__PURE__*/React.createElement("svg", _extends$q({
7615
7698
  className: "plc-animate-spin",
7616
7699
  viewBox: "0 0 24 24",
7617
7700
  fill: "currentColor",
7618
7701
  xmlns: "http://www.w3.org/2000/svg"
7619
- }, props), _path$m || (_path$m = /*#__PURE__*/React.createElement("path", {
7702
+ }, props), _path$o || (_path$o = /*#__PURE__*/React.createElement("path", {
7620
7703
  opacity: 0.2,
7621
7704
  fill: "evenodd",
7622
7705
  clipRule: "evenodd",
@@ -7842,6 +7925,16 @@ const init$1 = () => {
7842
7925
  }
7843
7926
  }
7844
7927
 
7928
+ const pelcroUpdateNewslettersButtons = document.getElementsByClassName("pelcro-update-newsletters-button");
7929
+
7930
+ if (pelcroUpdateNewslettersButtons.length !== 0) {
7931
+ for (let i = 0; i < pelcroUpdateNewslettersButtons.length; i++) {
7932
+ pelcroUpdateNewslettersButtons[i].addEventListener("click", () => {
7933
+ switchView("newsletter-update");
7934
+ });
7935
+ }
7936
+ }
7937
+
7845
7938
  const pelcroCartButtonsByClass = document.getElementsByClassName("pelcro-cart-button");
7846
7939
 
7847
7940
  if (pelcroCartButtonsByClass.length !== 0) {
@@ -8167,6 +8260,175 @@ function shouldBlurContent(entitlements) {
8167
8260
  return entitlements.every(entitlement => !window.Pelcro.user.isEntitledTo(entitlement));
8168
8261
  }
8169
8262
 
8263
+ var pure$1 = createCommonjsModule(function (module, exports) {
8264
+
8265
+ Object.defineProperty(exports, '__esModule', { value: true });
8266
+
8267
+ function _typeof(obj) {
8268
+ "@babel/helpers - typeof";
8269
+
8270
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
8271
+ _typeof = function (obj) {
8272
+ return typeof obj;
8273
+ };
8274
+ } else {
8275
+ _typeof = function (obj) {
8276
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
8277
+ };
8278
+ }
8279
+
8280
+ return _typeof(obj);
8281
+ }
8282
+
8283
+ var V3_URL = 'https://js.stripe.com/v3';
8284
+ var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
8285
+ var EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
8286
+ var findScript = function findScript() {
8287
+ var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
8288
+
8289
+ for (var i = 0; i < scripts.length; i++) {
8290
+ var script = scripts[i];
8291
+
8292
+ if (!V3_URL_REGEX.test(script.src)) {
8293
+ continue;
8294
+ }
8295
+
8296
+ return script;
8297
+ }
8298
+
8299
+ return null;
8300
+ };
8301
+
8302
+ var injectScript = function injectScript(params) {
8303
+ var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
8304
+ var script = document.createElement('script');
8305
+ script.src = "".concat(V3_URL).concat(queryString);
8306
+ var headOrBody = document.head || document.body;
8307
+
8308
+ if (!headOrBody) {
8309
+ throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
8310
+ }
8311
+
8312
+ headOrBody.appendChild(script);
8313
+ return script;
8314
+ };
8315
+
8316
+ var registerWrapper = function registerWrapper(stripe, startTime) {
8317
+ if (!stripe || !stripe._registerWrapper) {
8318
+ return;
8319
+ }
8320
+
8321
+ stripe._registerWrapper({
8322
+ name: 'stripe-js',
8323
+ version: "1.21.1",
8324
+ startTime: startTime
8325
+ });
8326
+ };
8327
+
8328
+ var stripePromise = null;
8329
+ var loadScript = function loadScript(params) {
8330
+ // Ensure that we only attempt to load Stripe.js at most once
8331
+ if (stripePromise !== null) {
8332
+ return stripePromise;
8333
+ }
8334
+
8335
+ stripePromise = new Promise(function (resolve, reject) {
8336
+ if (typeof window === 'undefined') {
8337
+ // Resolve to null when imported server side. This makes the module
8338
+ // safe to import in an isomorphic code base.
8339
+ resolve(null);
8340
+ return;
8341
+ }
8342
+
8343
+ if (window.Stripe && params) {
8344
+ console.warn(EXISTING_SCRIPT_MESSAGE);
8345
+ }
8346
+
8347
+ if (window.Stripe) {
8348
+ resolve(window.Stripe);
8349
+ return;
8350
+ }
8351
+
8352
+ try {
8353
+ var script = findScript();
8354
+
8355
+ if (script && params) {
8356
+ console.warn(EXISTING_SCRIPT_MESSAGE);
8357
+ } else if (!script) {
8358
+ script = injectScript(params);
8359
+ }
8360
+
8361
+ script.addEventListener('load', function () {
8362
+ if (window.Stripe) {
8363
+ resolve(window.Stripe);
8364
+ } else {
8365
+ reject(new Error('Stripe.js not available'));
8366
+ }
8367
+ });
8368
+ script.addEventListener('error', function () {
8369
+ reject(new Error('Failed to load Stripe.js'));
8370
+ });
8371
+ } catch (error) {
8372
+ reject(error);
8373
+ return;
8374
+ }
8375
+ });
8376
+ return stripePromise;
8377
+ };
8378
+ var initStripe = function initStripe(maybeStripe, args, startTime) {
8379
+ if (maybeStripe === null) {
8380
+ return null;
8381
+ }
8382
+
8383
+ var stripe = maybeStripe.apply(undefined, args);
8384
+ registerWrapper(stripe, startTime);
8385
+ return stripe;
8386
+ };
8387
+ var validateLoadParams = function validateLoadParams(params) {
8388
+ var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
8389
+
8390
+ if (params === null || _typeof(params) !== 'object') {
8391
+ throw new Error(errorMessage);
8392
+ }
8393
+
8394
+ if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === 'boolean') {
8395
+ return params;
8396
+ }
8397
+
8398
+ throw new Error(errorMessage);
8399
+ };
8400
+
8401
+ var loadParams;
8402
+ var loadStripeCalled = false;
8403
+ var loadStripe = function loadStripe() {
8404
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8405
+ args[_key] = arguments[_key];
8406
+ }
8407
+
8408
+ loadStripeCalled = true;
8409
+ var startTime = Date.now();
8410
+ return loadScript(loadParams).then(function (maybeStripe) {
8411
+ return initStripe(maybeStripe, args, startTime);
8412
+ });
8413
+ };
8414
+
8415
+ loadStripe.setLoadParameters = function (params) {
8416
+ if (loadStripeCalled) {
8417
+ throw new Error('You cannot change load parameters after calling loadStripe');
8418
+ }
8419
+
8420
+ loadParams = validateLoadParams(params);
8421
+ };
8422
+
8423
+ exports.loadStripe = loadStripe;
8424
+ });
8425
+
8426
+ unwrapExports(pure$1);
8427
+ pure$1.loadStripe;
8428
+
8429
+ var pure = pure$1;
8430
+ var pure_1 = pure.loadStripe;
8431
+
8170
8432
  /**
8171
8433
  * @typedef {Object} OptionsType
8172
8434
  * @property {boolean} loadPaymentSDKs
@@ -8192,6 +8454,7 @@ const optionsController = options => {
8192
8454
  enableURLTriggers: initViewFromURL,
8193
8455
  enableTheme: applyPelcroTheme,
8194
8456
  enablePaywalls: initPaywalls,
8457
+ loadSecuritySDK: initSecuritySdk,
8195
8458
  enableGoogleAnalytics: initGATracking
8196
8459
  }; // Only execute enabled options
8197
8460
 
@@ -8236,8 +8499,15 @@ const initPaywalls = () => {
8236
8499
  }
8237
8500
  };
8238
8501
  const loadPaymentSDKs = () => {
8239
- // Load stripe's SDK
8240
- window.Pelcro.helpers.loadSDK("https://js.stripe.com/v3/", "pelcro-sdk-stripe-id"); // Load PayPal SDK's
8502
+ // Lazy load stripe's SDK
8503
+ const {
8504
+ whenUserReady
8505
+ } = usePelcro.getStore();
8506
+ whenUserReady(() => {
8507
+ if (!window.Stripe) {
8508
+ pure_1(window.Pelcro.environment.stripe);
8509
+ }
8510
+ }); // Load PayPal SDK's
8241
8511
 
8242
8512
  const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
8243
8513
 
@@ -8246,6 +8516,18 @@ const loadPaymentSDKs = () => {
8246
8516
  window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.69.0/js/paypal-checkout.min.js", "braintree-paypal-sdk");
8247
8517
  }
8248
8518
  };
8519
+ const initSecuritySdk = () => {
8520
+ const {
8521
+ whenSiteReady
8522
+ } = usePelcro.getStore();
8523
+ whenSiteReady(() => {
8524
+ var _window$Pelcro$site$r2;
8525
+
8526
+ const securityKey = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.security_key;
8527
+ if (!securityKey) return;
8528
+ window.Pelcro.helpers.loadSDK(`https://www.google.com/recaptcha/enterprise.js?render=${securityKey}`, "pelcro-security-enteprise");
8529
+ });
8530
+ };
8249
8531
  const initGATracking = () => {
8250
8532
  var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
8251
8533
 
@@ -8332,9 +8614,9 @@ const applyPelcroTheme = () => {
8332
8614
  };
8333
8615
 
8334
8616
  whenSiteReady(() => {
8335
- var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
8617
+ var _window$Pelcro$site$r3, _window$Pelcro$site$r4;
8336
8618
 
8337
- const primaryColorHex = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : (_window$Pelcro$site$r3 = _window$Pelcro$site$r2.design_settings) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.primary_color;
8619
+ const primaryColorHex = (_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : (_window$Pelcro$site$r4 = _window$Pelcro$site$r3.design_settings) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.primary_color;
8338
8620
 
8339
8621
  if (!primaryColorHex) {
8340
8622
  return;
@@ -8533,6 +8815,7 @@ const defaultOptions = {
8533
8815
  enableURLTriggers: true,
8534
8816
  enableTheme: true,
8535
8817
  enablePaywalls: true,
8818
+ loadSecuritySDK: true,
8536
8819
  enableGoogleAnalytics: false
8537
8820
  };
8538
8821
  const PelcroModalController = ({
@@ -8831,6 +9114,7 @@ const GET_STATES_SUCCESS = "GET_STATES_SUCCESS";
8831
9114
  const GET_STATES_FETCH = "GET_STATES_FETCH";
8832
9115
  const HANDLE_SUBMIT = "HANDLE_SUBMIT";
8833
9116
  const SET_UPDATED_PRICE = "SET_UPDATED_PRICE";
9117
+ const SET_TAX_AMOUNT = "SET_TAX_AMOUNT";
8834
9118
  const SET_CAN_MAKE_PAYMENT = "SET_CAN_MAKE_PAYMENT";
8835
9119
  const SET_PAYMENT_REQUEST = "SET_PAYMENT_REQUEST";
8836
9120
  const INIT_CONTAINER = "INIT_CONTAINER";
@@ -8859,6 +9143,9 @@ const SET_IMAGE_SRC = "SET_IMAGE_SRC";
8859
9143
  const PASSWORD_CHANGE_SUCCESS = "PASSWORD_CHANGE_SUCCESS";
8860
9144
  const SELECT_PAYMENT_METHOD = "SELECT_PAYMENT_METHOD";
8861
9145
  const LOAD_PAYMENT_METHODS = "LOAD_PAYMENT_METHODS";
9146
+ const GET_NEWSLETTERS_FETCH = "GET_NEWSLETTERS_FETCH";
9147
+ const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
9148
+ const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
8862
9149
 
8863
9150
  /**
8864
9151
  * Extracts error message from the response error object
@@ -8920,7 +9207,7 @@ const debounce = (func, waitTime) => {
8920
9207
  };
8921
9208
  };
8922
9209
 
8923
- const initialState$e = {
9210
+ const initialState$f = {
8924
9211
  email: "",
8925
9212
  password: "",
8926
9213
  emailError: null,
@@ -8931,10 +9218,10 @@ const initialState$e = {
8931
9218
  content: ""
8932
9219
  }
8933
9220
  };
8934
- const store$e = /*#__PURE__*/createContext(initialState$e);
9221
+ const store$f = /*#__PURE__*/createContext(initialState$f);
8935
9222
  const {
8936
- Provider: Provider$e
8937
- } = store$e;
9223
+ Provider: Provider$f
9224
+ } = store$f;
8938
9225
 
8939
9226
  const LoginContainer = ({
8940
9227
  style,
@@ -9041,7 +9328,7 @@ const LoginContainer = ({
9041
9328
  });
9042
9329
 
9043
9330
  case RESET_LOGIN_FORM:
9044
- return initialState$e;
9331
+ return initialState$f;
9045
9332
 
9046
9333
  case DISABLE_LOGIN_BUTTON:
9047
9334
  return lib_7({ ...state,
@@ -9059,12 +9346,12 @@ const LoginContainer = ({
9059
9346
  default:
9060
9347
  return state;
9061
9348
  }
9062
- }, initialState$e);
9349
+ }, initialState$f);
9063
9350
  return /*#__PURE__*/React__default.createElement("div", {
9064
9351
  style: { ...style
9065
9352
  },
9066
9353
  className: `pelcro-container pelcro-login-container ${className}`
9067
- }, /*#__PURE__*/React__default.createElement(Provider$e, {
9354
+ }, /*#__PURE__*/React__default.createElement(Provider$f, {
9068
9355
  value: {
9069
9356
  state,
9070
9357
  dispatch
@@ -9072,12 +9359,12 @@ const LoginContainer = ({
9072
9359
  }, children.length ? children.map((child, i) => {
9073
9360
  if (child) {
9074
9361
  return /*#__PURE__*/React__default.cloneElement(child, {
9075
- store: store$e,
9362
+ store: store$f,
9076
9363
  key: i
9077
9364
  });
9078
9365
  }
9079
9366
  }) : /*#__PURE__*/React__default.cloneElement(children, {
9080
- store: store$e
9367
+ store: store$f
9081
9368
  })));
9082
9369
  };
9083
9370
 
@@ -9322,7 +9609,7 @@ const LoginButton = ({
9322
9609
  buttonDisabled
9323
9610
  },
9324
9611
  dispatch
9325
- } = useContext(store$e);
9612
+ } = useContext(store$f);
9326
9613
  const {
9327
9614
  t
9328
9615
  } = useTranslation("login");
@@ -9343,23 +9630,23 @@ const LoginButton = ({
9343
9630
  };
9344
9631
 
9345
9632
  const LoginEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
9346
- store: store$e
9633
+ store: store$f
9347
9634
  }, props));
9348
9635
 
9349
9636
  const LoginPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
9350
- store: store$e
9637
+ store: store$f
9351
9638
  }, props));
9352
9639
 
9353
- var _path$l;
9640
+ var _path$n;
9354
9641
 
9355
- function _extends$n() { _extends$n = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
9642
+ function _extends$p() { _extends$p = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
9356
9643
 
9357
9644
  function SvgCheck(props) {
9358
- return /*#__PURE__*/React.createElement("svg", _extends$n({
9645
+ return /*#__PURE__*/React.createElement("svg", _extends$p({
9359
9646
  xmlns: "http://www.w3.org/2000/svg",
9360
9647
  fill: "currentColor",
9361
9648
  viewBox: "0 0 20 20"
9362
- }, props), _path$l || (_path$l = /*#__PURE__*/React.createElement("path", {
9649
+ }, props), _path$n || (_path$n = /*#__PURE__*/React.createElement("path", {
9363
9650
  fillRule: "evenodd",
9364
9651
  d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
9365
9652
  clipRule: "evenodd"
@@ -9424,7 +9711,7 @@ var facebookLoginRenderProps = createCommonjsModule(function (module, exports) {
9424
9711
  var FacebookLogin = unwrapExports(facebookLoginRenderProps);
9425
9712
  facebookLoginRenderProps.FacebookLogin;
9426
9713
 
9427
- const initialState$d = {
9714
+ const initialState$e = {
9428
9715
  email: "",
9429
9716
  password: "",
9430
9717
  emailError: null,
@@ -9441,10 +9728,10 @@ const initialState$d = {
9441
9728
  content: ""
9442
9729
  }
9443
9730
  };
9444
- const store$d = /*#__PURE__*/createContext(initialState$d);
9731
+ const store$e = /*#__PURE__*/createContext(initialState$e);
9445
9732
  const {
9446
- Provider: Provider$d
9447
- } = store$d;
9733
+ Provider: Provider$e
9734
+ } = store$e;
9448
9735
 
9449
9736
  const RegisterContainer = ({
9450
9737
  style,
@@ -9469,35 +9756,53 @@ const RegisterContainer = ({
9469
9756
  jobTitle,
9470
9757
  selectFields
9471
9758
  } = filteredData;
9472
- window.Pelcro.user.register({
9473
- email,
9474
- password,
9475
- first_name: firstName,
9476
- last_name: lastName,
9477
- metadata: {
9478
- organization,
9479
- jobTitle,
9480
- ...selectFields
9481
- }
9482
- }, (err, res) => {
9483
- dispatch({
9484
- type: DISABLE_REGISTRATION_BUTTON,
9485
- payload: false
9759
+
9760
+ if (!hasSecurityTokenEnabled$1()) {
9761
+ sendRegisterRequest();
9762
+ return;
9763
+ }
9764
+
9765
+ window.grecaptcha.enterprise.ready(async () => {
9766
+ var _window$Pelcro$site$r;
9767
+
9768
+ const token = await window.grecaptcha.enterprise.execute((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.security_key, {
9769
+ action: "register"
9486
9770
  });
9771
+ sendRegisterRequest(token);
9772
+ });
9487
9773
 
9488
- if (err) {
9774
+ function sendRegisterRequest(securityToken) {
9775
+ window.Pelcro.user.register({
9776
+ email,
9777
+ password,
9778
+ first_name: firstName,
9779
+ last_name: lastName,
9780
+ security_token: securityToken,
9781
+ metadata: {
9782
+ organization,
9783
+ jobTitle,
9784
+ ...selectFields
9785
+ }
9786
+ }, (err, res) => {
9489
9787
  dispatch({
9490
- type: SHOW_ALERT,
9491
- payload: {
9492
- type: "error",
9493
- content: getErrorMessages(err)
9494
- }
9788
+ type: DISABLE_REGISTRATION_BUTTON,
9789
+ payload: false
9495
9790
  });
9496
- onFailure(err);
9497
- } else {
9498
- onSuccess(res);
9499
- }
9500
- });
9791
+
9792
+ if (err) {
9793
+ dispatch({
9794
+ type: SHOW_ALERT,
9795
+ payload: {
9796
+ type: "error",
9797
+ content: getErrorMessages(err)
9798
+ }
9799
+ });
9800
+ onFailure(err);
9801
+ } else {
9802
+ onSuccess(res);
9803
+ }
9804
+ });
9805
+ }
9501
9806
  };
9502
9807
 
9503
9808
  const handleSocialLogin = ({
@@ -9609,7 +9914,7 @@ const RegisterContainer = ({
9609
9914
  });
9610
9915
 
9611
9916
  case RESET_LOGIN_FORM:
9612
- return initialState$d;
9917
+ return initialState$e;
9613
9918
 
9614
9919
  case DISABLE_REGISTRATION_BUTTON:
9615
9920
  return lib_7({ ...state,
@@ -9627,12 +9932,12 @@ const RegisterContainer = ({
9627
9932
  default:
9628
9933
  return state;
9629
9934
  }
9630
- }, initialState$d);
9935
+ }, initialState$e);
9631
9936
  return /*#__PURE__*/React__default.createElement("div", {
9632
9937
  style: { ...style
9633
9938
  },
9634
9939
  className: `pelcro-container pelcro-register-container ${className}`
9635
- }, /*#__PURE__*/React__default.createElement(Provider$d, {
9940
+ }, /*#__PURE__*/React__default.createElement(Provider$e, {
9636
9941
  value: {
9637
9942
  state,
9638
9943
  dispatch
@@ -9640,24 +9945,33 @@ const RegisterContainer = ({
9640
9945
  }, children.length ? children.map((child, i) => {
9641
9946
  if (child) {
9642
9947
  return /*#__PURE__*/React__default.cloneElement(child, {
9643
- store: store$d,
9948
+ store: store$e,
9644
9949
  key: i
9645
9950
  });
9646
9951
  }
9647
9952
  }) : /*#__PURE__*/React__default.cloneElement(children, {
9648
- store: store$d
9953
+ store: store$e
9649
9954
  })));
9650
9955
  };
9956
+ /**
9957
+ * Checks if the current site has security token enabled
9958
+ * @return {boolean}
9959
+ */
9651
9960
 
9652
- var _path$k;
9961
+ function hasSecurityTokenEnabled$1() {
9962
+ const hasSecuritySdkLoaded = Boolean(window.grecaptcha);
9963
+ return hasSecuritySdkLoaded;
9964
+ }
9653
9965
 
9654
- function _extends$m() { _extends$m = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$m.apply(this, arguments); }
9966
+ var _path$m;
9967
+
9968
+ function _extends$o() { _extends$o = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
9655
9969
 
9656
9970
  function SvgFacebookLogo(props) {
9657
- return /*#__PURE__*/React.createElement("svg", _extends$m({
9971
+ return /*#__PURE__*/React.createElement("svg", _extends$o({
9658
9972
  xmlns: "http://www.w3.org/2000/svg",
9659
9973
  viewBox: "88.428 12.828 107.543 207.085"
9660
- }, props), _path$k || (_path$k = /*#__PURE__*/React.createElement("path", {
9974
+ }, props), _path$m || (_path$m = /*#__PURE__*/React.createElement("path", {
9661
9975
  d: "M158.232 219.912v-94.461h31.707l4.747-36.813h-36.454V65.134c0-10.658 2.96-17.922 18.245-17.922l19.494-.009V14.278c-3.373-.447-14.944-1.449-28.406-1.449-28.106 0-47.348 17.155-47.348 48.661v27.149H88.428v36.813h31.788v94.461l38.016-.001z",
9662
9976
  fill: "#3c5a9a"
9663
9977
  })));
@@ -9669,15 +9983,15 @@ const FacebookLoginButton = ({
9669
9983
  labelClassName = "",
9670
9984
  iconClassName = ""
9671
9985
  }) => {
9672
- var _window$Pelcro$site$r, _window$Pelcro$site$r2;
9986
+ var _window$Pelcro$site$r;
9673
9987
 
9674
9988
  const facebookLoginEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id;
9675
9989
  const {
9676
9990
  dispatch: loginDispatch
9677
- } = useContext(store$e);
9991
+ } = useContext(store$f);
9678
9992
  const {
9679
9993
  dispatch: registerDispatch
9680
- } = useContext(store$d);
9994
+ } = useContext(store$e);
9681
9995
 
9682
9996
  const onSuccess = facebookUser => {
9683
9997
  loginDispatch === null || loginDispatch === void 0 ? void 0 : loginDispatch({
@@ -9708,7 +10022,7 @@ const FacebookLoginButton = ({
9708
10022
 
9709
10023
  return facebookLoginEnabled ? /*#__PURE__*/React__default.createElement(FacebookLogin, {
9710
10024
  appId: window.Pelcro.site.read().facebook_app_id,
9711
- language: (_window$Pelcro$site$r2 = window.Pelcro.site.read().default_locale) !== null && _window$Pelcro$site$r2 !== void 0 ? _window$Pelcro$site$r2 : "en_US",
10025
+ language: getPageOrDefaultLanguage(),
9712
10026
  fields: "first_name,last_name,email,picture",
9713
10027
  callback: onSuccess,
9714
10028
  onFailure: onFailure,
@@ -9730,15 +10044,15 @@ var googleLogin = createCommonjsModule(function (module, exports) {
9730
10044
  unwrapExports(googleLogin);
9731
10045
  var googleLogin_1 = googleLogin.GoogleLogin;
9732
10046
 
9733
- var _path$j, _path2$2, _path3$1, _path4;
10047
+ var _path$l, _path2$2, _path3$1, _path4;
9734
10048
 
9735
- function _extends$l() { _extends$l = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$l.apply(this, arguments); }
10049
+ function _extends$n() { _extends$n = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
9736
10050
 
9737
10051
  function SvgGoogleLogo(props) {
9738
- return /*#__PURE__*/React.createElement("svg", _extends$l({
10052
+ return /*#__PURE__*/React.createElement("svg", _extends$n({
9739
10053
  viewBox: "0 0 24 24",
9740
10054
  xmlns: "http://www.w3.org/2000/svg"
9741
- }, props), _path$j || (_path$j = /*#__PURE__*/React.createElement("path", {
10055
+ }, props), _path$l || (_path$l = /*#__PURE__*/React.createElement("path", {
9742
10056
  fill: "#4285F4",
9743
10057
  d: "M23.745 12.27c0-.79-.07-1.54-.19-2.27h-11.3v4.51h6.47c-.29 1.48-1.14 2.73-2.4 3.58v3h3.86c2.26-2.09 3.56-5.17 3.56-8.82z"
9744
10058
  })), _path2$2 || (_path2$2 = /*#__PURE__*/React.createElement("path", {
@@ -9764,10 +10078,10 @@ const GoogleLoginButton = ({
9764
10078
  const googleLoginEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.google_app_id;
9765
10079
  const {
9766
10080
  dispatch: loginDispatch
9767
- } = useContext(store$e);
10081
+ } = useContext(store$f);
9768
10082
  const {
9769
10083
  dispatch: registerDispatch
9770
- } = useContext(store$d);
10084
+ } = useContext(store$e);
9771
10085
 
9772
10086
  const onSuccess = response => {
9773
10087
  var _response$getAuthResp, _profile$getEmail, _profile$getGivenName, _profile$getFamilyNam, _profile$getEmail2, _profile$getGivenName2, _profile$getFamilyNam2;
@@ -9872,15 +10186,15 @@ function LoginView(props) {
9872
10186
  }, /*#__PURE__*/React__default.createElement(GoogleLoginButton, null), /*#__PURE__*/React__default.createElement(FacebookLoginButton, null))))));
9873
10187
  }
9874
10188
 
9875
- var _path$i, _path2$1, _path3;
10189
+ var _path$k, _path2$1, _path3;
9876
10190
 
9877
- function _extends$k() { _extends$k = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); }
10191
+ function _extends$m() { _extends$m = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$m.apply(this, arguments); }
9878
10192
 
9879
10193
  function SvgPelcroAuthorship(props) {
9880
- return /*#__PURE__*/React.createElement("svg", _extends$k({
10194
+ return /*#__PURE__*/React.createElement("svg", _extends$m({
9881
10195
  xmlns: "http://www.w3.org/2000/svg",
9882
10196
  viewBox: "0 -80.652 497.072 179.991"
9883
- }, props), _path$i || (_path$i = /*#__PURE__*/React.createElement("path", {
10197
+ }, props), _path$k || (_path$k = /*#__PURE__*/React.createElement("path", {
9884
10198
  fill: "none",
9885
10199
  stroke: "#4a4a4a",
9886
10200
  d: "M487.89 42.299c0 13.158-10.671 23.829-23.829 23.829H37.074c-13.162 0-23.832-10.671-23.832-23.829v-63.552c0-13.158 10.67-23.831 23.832-23.831H464.06c13.158 0 23.829 10.672 23.829 23.831l.001 63.552z"
@@ -10027,18 +10341,21 @@ function LoginModal({
10027
10341
  LoginModal.viewId = "login";
10028
10342
 
10029
10343
  const RegisterEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
10030
- store: store$d
10344
+ store: store$e
10031
10345
  }, props));
10032
10346
 
10033
10347
  const RegisterPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
10034
- store: store$d
10348
+ store: store$e
10035
10349
  }, props));
10036
10350
 
10037
10351
  const RegisterButton = ({
10038
10352
  name,
10039
10353
  onClick,
10354
+ className,
10040
10355
  ...otherProps
10041
10356
  }) => {
10357
+ var _window$Pelcro$site$r;
10358
+
10042
10359
  const {
10043
10360
  state: {
10044
10361
  emailError,
@@ -10048,7 +10365,7 @@ const RegisterButton = ({
10048
10365
  buttonDisabled
10049
10366
  },
10050
10367
  dispatch
10051
- } = useContext(store$d);
10368
+ } = useContext(store$e);
10052
10369
  const {
10053
10370
  t
10054
10371
  } = useTranslation("register");
@@ -10064,7 +10381,10 @@ const RegisterButton = ({
10064
10381
  onClick === null || onClick === void 0 ? void 0 : onClick();
10065
10382
  },
10066
10383
  disabled: isDisabled,
10067
- isLoading: buttonDisabled
10384
+ isLoading: buttonDisabled,
10385
+ className: `${className} g-recaptcha`,
10386
+ "data-action": "register",
10387
+ "data-sitekey": (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.security_key
10068
10388
  }, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
10069
10389
  };
10070
10390
 
@@ -10183,7 +10503,7 @@ function FirstName({
10183
10503
  }
10184
10504
 
10185
10505
  const RegisterFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
10186
- store: store$d
10506
+ store: store$e
10187
10507
  }, props));
10188
10508
 
10189
10509
  function LastName({
@@ -10214,7 +10534,7 @@ function LastName({
10214
10534
  }
10215
10535
 
10216
10536
  const RegisterLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
10217
- store: store$d
10537
+ store: store$e
10218
10538
  }, props));
10219
10539
 
10220
10540
  /**
@@ -10268,7 +10588,17 @@ function RegisterView(props) {
10268
10588
  className: "plc-w-full plc-mt-2",
10269
10589
  id: "pelcro-submit",
10270
10590
  name: t("messages.createAccount")
10271
- }), socialLoginEnabled && /*#__PURE__*/React__default.createElement("div", {
10591
+ }), hasSecurityTokenEnabled() && /*#__PURE__*/React__default.createElement("p", {
10592
+ className: "plc-text-sm plc-text-gray-500 plc-mt-1"
10593
+ }, /*#__PURE__*/React__default.createElement(Trans, {
10594
+ i18nKey: "messages:recaptcha"
10595
+ }, "This site is protected by reCAPTCHA and the Google", /*#__PURE__*/React__default.createElement(Link, {
10596
+ href: "https://policies.google.com/privacy",
10597
+ className: "plc-text-sm plc-text-gray-500"
10598
+ }, "Privacy Policy"), "and", /*#__PURE__*/React__default.createElement(Link, {
10599
+ href: "https://policies.google.com/terms",
10600
+ className: "plc-text-sm plc-text-gray-500"
10601
+ }, "Terms of Service"), "apply.")), socialLoginEnabled && /*#__PURE__*/React__default.createElement("div", {
10272
10602
  className: "plc-mt-5"
10273
10603
  }, /*#__PURE__*/React__default.createElement("div", {
10274
10604
  className: "plc-flex plc-items-center plc-justify-between "
@@ -10282,6 +10612,16 @@ function RegisterView(props) {
10282
10612
  className: "plc-flex plc-justify-center plc-px-5 plc-mt-1 plc-space-x-3"
10283
10613
  }, /*#__PURE__*/React__default.createElement(GoogleLoginButton, null), /*#__PURE__*/React__default.createElement(FacebookLoginButton, null))))));
10284
10614
  }
10615
+ /**
10616
+ * Checks if the current site has security token enabled
10617
+ * @return {boolean}
10618
+ */
10619
+
10620
+ function hasSecurityTokenEnabled() {
10621
+ var _window$Pelcro$site, _window$Pelcro$site$r3;
10622
+
10623
+ return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r3 = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.security_key);
10624
+ }
10285
10625
 
10286
10626
  function TextInput({
10287
10627
  store,
@@ -10318,7 +10658,7 @@ function TextInput({
10318
10658
 
10319
10659
  const RegisterTextInput = props => {
10320
10660
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
10321
- store: store$d
10661
+ store: store$e
10322
10662
  }));
10323
10663
  };
10324
10664
 
@@ -12283,13 +12623,14 @@ class PaypalGateWay {
12283
12623
  * @property {unknown} canMakePayment
12284
12624
  * @property {unknown} paymentRequest
12285
12625
  * @property {number} updatedPrice
12626
+ * @property {number} taxAmount
12286
12627
  * @property {object} currentPlan
12287
12628
  * @property {object} alert
12288
12629
  */
12289
12630
 
12290
12631
  /** @type {PaymentStateType} */
12291
12632
 
12292
- const initialState$c = {
12633
+ const initialState$d = {
12293
12634
  disableSubmit: false,
12294
12635
  isLoading: false,
12295
12636
  disableCouponButton: false,
@@ -12301,16 +12642,17 @@ const initialState$c = {
12301
12642
  canMakePayment: false,
12302
12643
  paymentRequest: null,
12303
12644
  updatedPrice: null,
12645
+ taxAmount: null,
12304
12646
  currentPlan: null,
12305
12647
  alert: {
12306
12648
  type: "error",
12307
12649
  content: ""
12308
12650
  }
12309
12651
  };
12310
- const store$c = /*#__PURE__*/createContext(initialState$c);
12652
+ const store$d = /*#__PURE__*/createContext(initialState$d);
12311
12653
  const {
12312
- Provider: Provider$c
12313
- } = store$c;
12654
+ Provider: Provider$d
12655
+ } = store$d;
12314
12656
 
12315
12657
  const PaymentMethodContainerWithoutStripe = ({
12316
12658
  style,
@@ -12351,6 +12693,7 @@ const PaymentMethodContainerWithoutStripe = ({
12351
12693
  dispatch({
12352
12694
  type: INIT_CONTAINER
12353
12695
  });
12696
+ updateTotalAmountWithTax();
12354
12697
  }, []);
12355
12698
 
12356
12699
  const initPaymentRequest = (state, dispatch) => {
@@ -12417,6 +12760,45 @@ const PaymentMethodContainerWithoutStripe = ({
12417
12760
  console.log("Google Pay/Apple pay isn't available in this country");
12418
12761
  }
12419
12762
  };
12763
+ /**
12764
+ * Updates the total amount after adding taxes only if site taxes are enabled
12765
+ */
12766
+
12767
+
12768
+ const updateTotalAmountWithTax = () => {
12769
+ var _window$Pelcro$site$r;
12770
+
12771
+ const taxesEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.taxes_enabled;
12772
+
12773
+ if (taxesEnabled && type === "createPayment") {
12774
+ dispatch({
12775
+ type: DISABLE_SUBMIT,
12776
+ payload: true
12777
+ });
12778
+ resolveTaxCalculation().then(res => {
12779
+ if (res) {
12780
+ dispatch({
12781
+ type: SET_TAX_AMOUNT,
12782
+ payload: res.taxAmount
12783
+ });
12784
+ dispatch({
12785
+ type: SET_UPDATED_PRICE,
12786
+ payload: res.totalAmountWithTax
12787
+ });
12788
+ dispatch({
12789
+ type: UPDATE_PAYMENT_REQUEST
12790
+ });
12791
+ }
12792
+ }).catch(error => {
12793
+ handlePaymentError(error);
12794
+ }).finally(() => {
12795
+ dispatch({
12796
+ type: DISABLE_SUBMIT,
12797
+ payload: false
12798
+ });
12799
+ });
12800
+ }
12801
+ };
12420
12802
 
12421
12803
  const onApplyCouponCode = (state, dispatch) => {
12422
12804
  const {
@@ -12443,6 +12825,10 @@ const PaymentMethodContainerWithoutStripe = ({
12443
12825
  });
12444
12826
  }
12445
12827
 
12828
+ dispatch({
12829
+ type: SET_COUPON_ERROR,
12830
+ payload: ""
12831
+ });
12446
12832
  dispatch({
12447
12833
  type: SHOW_ALERT,
12448
12834
  payload: {
@@ -12458,6 +12844,10 @@ const PaymentMethodContainerWithoutStripe = ({
12458
12844
  type: SET_PERCENT_OFF,
12459
12845
  payload: `${(_res$data$coupon = res.data.coupon) === null || _res$data$coupon === void 0 ? void 0 : _res$data$coupon.percent_off}%`
12460
12846
  });
12847
+ dispatch({
12848
+ type: SET_TAX_AMOUNT,
12849
+ payload: res.data.taxes
12850
+ });
12461
12851
  dispatch({
12462
12852
  type: SET_UPDATED_PRICE,
12463
12853
  payload: res.data.total
@@ -12467,6 +12857,29 @@ const PaymentMethodContainerWithoutStripe = ({
12467
12857
  });
12468
12858
  };
12469
12859
 
12860
+ if ((couponCode === null || couponCode === void 0 ? void 0 : couponCode.trim()) === "") {
12861
+ dispatch({
12862
+ type: SET_COUPON,
12863
+ payload: null
12864
+ });
12865
+ dispatch({
12866
+ type: SET_PERCENT_OFF,
12867
+ payload: ""
12868
+ });
12869
+ dispatch({
12870
+ type: SET_UPDATED_PRICE,
12871
+ payload: null
12872
+ });
12873
+ dispatch({
12874
+ type: SET_TAX_AMOUNT,
12875
+ payload: null
12876
+ });
12877
+ dispatch({
12878
+ type: UPDATE_PAYMENT_REQUEST
12879
+ });
12880
+ updateTotalAmountWithTax();
12881
+ }
12882
+
12470
12883
  if (couponCode !== null && couponCode !== void 0 && couponCode.trim()) {
12471
12884
  dispatch({
12472
12885
  type: DISABLE_COUPON_BUTTON,
@@ -12853,16 +13266,20 @@ const PaymentMethodContainerWithoutStripe = ({
12853
13266
  const totalAmount = (_ref = (_state$updatedPrice = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref !== void 0 ? _ref : getOrderItemsTotal();
12854
13267
 
12855
13268
  if ((source === null || source === void 0 ? void 0 : (_source$card3 = source.card) === null || _source$card3 === void 0 ? void 0 : _source$card3.three_d_secure) === "required" && totalAmount > 0) {
12856
- return resolveTaxCalculation().then(totalAmountWithTax => generate3DSecureSource(source, totalAmountWithTax !== null && totalAmountWithTax !== void 0 ? totalAmountWithTax : totalAmount).then(({
12857
- source,
12858
- error
12859
- }) => {
12860
- if (error) {
12861
- return handlePaymentError(error);
12862
- }
13269
+ return resolveTaxCalculation().then(res => {
13270
+ var _res$totalAmountWithT;
12863
13271
 
12864
- toggleAuthenticationPendingView(true, source);
12865
- }));
13272
+ return generate3DSecureSource(source, (_res$totalAmountWithT = res === null || res === void 0 ? void 0 : res.totalAmountWithTax) !== null && _res$totalAmountWithT !== void 0 ? _res$totalAmountWithT : totalAmount).then(({
13273
+ source,
13274
+ error
13275
+ }) => {
13276
+ if (error) {
13277
+ return handlePaymentError(error);
13278
+ }
13279
+
13280
+ toggleAuthenticationPendingView(true, source);
13281
+ });
13282
+ });
12866
13283
  }
12867
13284
 
12868
13285
  return handlePayment(source);
@@ -12871,15 +13288,15 @@ const PaymentMethodContainerWithoutStripe = ({
12871
13288
  });
12872
13289
  };
12873
13290
  /**
12874
- * Resolves with the total including taxes incase taxes enabled by site
13291
+ * Resolves with the total & tax amount incase taxes enabled by site
12875
13292
  * @return {Promise}
12876
13293
  */
12877
13294
 
12878
13295
 
12879
13296
  const resolveTaxCalculation = () => {
12880
- var _window$Pelcro$site$r;
13297
+ var _window$Pelcro$site$r2;
12881
13298
 
12882
- const taxesEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.taxes_enabled;
13299
+ const taxesEnabled = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.taxes_enabled;
12883
13300
  return new Promise((resolve, reject) => {
12884
13301
  // resolve early if taxes isn't enabled
12885
13302
  if (!taxesEnabled) {
@@ -12892,14 +13309,18 @@ const PaymentMethodContainerWithoutStripe = ({
12892
13309
  coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
12893
13310
  address_id: selectedAddressId
12894
13311
  }, (error, res) => {
12895
- var _res$data;
13312
+ var _res$data, _res$data2;
12896
13313
 
12897
13314
  if (error) {
12898
13315
  return reject(error);
12899
13316
  }
12900
13317
 
12901
- const totalAmountWithTax = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.total;
12902
- resolve(totalAmountWithTax);
13318
+ const taxAmount = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.taxes;
13319
+ const totalAmountWithTax = (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.total;
13320
+ resolve({
13321
+ totalAmountWithTax,
13322
+ taxAmount
13323
+ });
12903
13324
  });
12904
13325
  });
12905
13326
  };
@@ -12954,13 +13375,13 @@ const PaymentMethodContainerWithoutStripe = ({
12954
13375
  const handlePaymentError = error => {
12955
13376
  if (error.type === "validation_error" && // Subscription creation & renewal
12956
13377
  type === "createPayment") {
12957
- var _state$coupon;
13378
+ var _state$couponObject;
12958
13379
 
12959
13380
  const {
12960
13381
  updatedPrice
12961
13382
  } = state; // When price is 0, we allow submitting without card info
12962
13383
 
12963
- if (updatedPrice === 0 && ((_state$coupon = state.coupon) === null || _state$coupon === void 0 ? void 0 : _state$coupon.duration) === "forever") {
13384
+ if (updatedPrice === 0 && ((_state$couponObject = state.couponObject) === null || _state$couponObject === void 0 ? void 0 : _state$couponObject.duration) === "forever") {
12964
13385
  return subscribe({}, state, dispatch);
12965
13386
  }
12966
13387
  }
@@ -13088,6 +13509,11 @@ const PaymentMethodContainerWithoutStripe = ({
13088
13509
  updatedPrice: action.payload
13089
13510
  });
13090
13511
 
13512
+ case SET_TAX_AMOUNT:
13513
+ return lib_7({ ...state,
13514
+ taxAmount: action.payload
13515
+ });
13516
+
13091
13517
  case SET_CAN_MAKE_PAYMENT:
13092
13518
  return lib_7({ ...state,
13093
13519
  canMakePayment: action.payload
@@ -13105,7 +13531,7 @@ const PaymentMethodContainerWithoutStripe = ({
13105
13531
 
13106
13532
  case SET_COUPON:
13107
13533
  return lib_7({ ...state,
13108
- coupon: action.payload
13534
+ couponObject: action.payload
13109
13535
  });
13110
13536
 
13111
13537
  case SET_COUPON_ERROR:
@@ -13131,34 +13557,43 @@ const PaymentMethodContainerWithoutStripe = ({
13131
13557
  default:
13132
13558
  return state;
13133
13559
  }
13134
- }, initialState$c);
13560
+ }, initialState$d);
13135
13561
  return /*#__PURE__*/React__default.createElement("div", {
13136
13562
  style: { ...style
13137
13563
  },
13138
13564
  className: `pelcro-container pelcro-payment-container ${className}`
13139
- }, /*#__PURE__*/React__default.createElement(Provider$c, {
13565
+ }, /*#__PURE__*/React__default.createElement(Provider$d, {
13140
13566
  value: {
13141
13567
  state,
13142
13568
  dispatch
13143
13569
  }
13144
13570
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
13145
- store: store$c,
13571
+ store: store$d,
13146
13572
  key: i
13147
13573
  })) : /*#__PURE__*/React__default.cloneElement(children, {
13148
- store: store$c
13574
+ store: store$d
13149
13575
  })));
13150
13576
  };
13151
13577
 
13152
13578
  const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
13153
13579
 
13154
13580
  const PaymentMethodContainer = props => {
13155
- if (window.Stripe) {
13581
+ const [isStripeLoaded, setIsStripeLoaded] = useState(Boolean(window.Stripe));
13582
+ useEffect(() => {
13583
+ if (!window.Stripe) {
13584
+ document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
13585
+ setIsStripeLoaded(true);
13586
+ });
13587
+ }
13588
+ }, []);
13589
+
13590
+ if (isStripeLoaded) {
13156
13591
  return /*#__PURE__*/React__default.createElement(es_13, {
13157
13592
  apiKey: window.Pelcro.environment.stripe,
13158
13593
  stripeAccount: window.Pelcro.site.read().account_id,
13159
- locale: getCanonicalLocaleFormat(window.Pelcro.site.read().default_locale)
13594
+ locale: getPageOrDefaultLanguage()
13160
13595
  }, /*#__PURE__*/React__default.createElement(es_11, null, /*#__PURE__*/React__default.createElement(UnwrappedForm, Object.assign({
13161
- store: store$c
13596
+ store: store$d
13162
13597
  }, props))));
13163
13598
  }
13164
13599
 
@@ -13211,7 +13646,7 @@ const PelcroPaymentRequestButton = props => {
13211
13646
  currentPlan,
13212
13647
  updatedPrice
13213
13648
  }
13214
- } = useContext(store$c);
13649
+ } = useContext(store$d);
13215
13650
 
13216
13651
  const updatePaymentRequest = () => {
13217
13652
  // Make sure payment request is up to date, eg. user added a coupon code.
@@ -13264,24 +13699,25 @@ const DiscountedPrice = props => {
13264
13699
  const {
13265
13700
  state: {
13266
13701
  updatedPrice,
13702
+ taxAmount,
13267
13703
  percentOff
13268
13704
  }
13269
- } = useContext(store$c);
13270
- const {
13271
- default_locale
13272
- } = Pelcro.site.read();
13705
+ } = useContext(store$d);
13273
13706
  const {
13274
13707
  order,
13275
13708
  plan
13276
13709
  } = usePelcro();
13277
13710
  const ecommOrderCurrency = (_order$currency = order === null || order === void 0 ? void 0 : order.currency) !== null && _order$currency !== void 0 ? _order$currency : order === null || order === void 0 ? void 0 : (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency;
13278
13711
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
13279
- const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : updatedPrice * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
13712
+ const discountedPriceWithoutTax = updatedPrice - taxAmount;
13713
+ const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
13280
13714
 
13281
13715
  if (percentOff) {
13282
13716
  return /*#__PURE__*/React__default.createElement("div", Object.assign({
13283
- className: "plc-my-2"
13284
- }, props), "(-", percentOff, ") ", priceFormatted);
13717
+ className: "plc-flex plc-justify-center plc-mt-2 pelcro-discount"
13718
+ }, props), "(-", percentOff, ")", " ", /*#__PURE__*/React__default.createElement("span", {
13719
+ className: "plc-font-bold pelcro-discounted-price"
13720
+ }, priceFormatted));
13285
13721
  }
13286
13722
 
13287
13723
  return "";
@@ -13306,13 +13742,10 @@ const SubmitPaymentMethod = ({
13306
13742
  isLoading,
13307
13743
  updatedPrice
13308
13744
  }
13309
- } = useContext(store$c);
13310
- const {
13311
- default_locale
13312
- } = Pelcro.site.read();
13745
+ } = useContext(store$d);
13313
13746
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
13314
13747
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
13315
- const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
13748
+ const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
13316
13749
  return /*#__PURE__*/React__default.createElement(Button, Object.assign({
13317
13750
  role: "submit",
13318
13751
  className: "plc-w-full plc-py-3",
@@ -13330,17 +13763,17 @@ const SubmitPaymentMethod = ({
13330
13763
  }, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
13331
13764
  };
13332
13765
 
13333
- var _path$h;
13766
+ var _path$j;
13334
13767
 
13335
- function _extends$j() { _extends$j = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
13768
+ function _extends$l() { _extends$l = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$l.apply(this, arguments); }
13336
13769
 
13337
13770
  function SvgArrowLeft(props) {
13338
- return /*#__PURE__*/React.createElement("svg", _extends$j({
13771
+ return /*#__PURE__*/React.createElement("svg", _extends$l({
13339
13772
  xmlns: "http://www.w3.org/2000/svg",
13340
13773
  fill: "none",
13341
13774
  viewBox: "0 0 24 24",
13342
13775
  stroke: "currentColor"
13343
- }, props), _path$h || (_path$h = /*#__PURE__*/React.createElement("path", {
13776
+ }, props), _path$j || (_path$j = /*#__PURE__*/React.createElement("path", {
13344
13777
  strokeLinecap: "round",
13345
13778
  strokeLinejoin: "round",
13346
13779
  strokeWidth: 2,
@@ -13359,7 +13792,7 @@ const ApplyCouponButton = ({
13359
13792
  disableCouponButton
13360
13793
  },
13361
13794
  dispatch
13362
- } = useContext(store$c);
13795
+ } = useContext(store$d);
13363
13796
  const {
13364
13797
  t
13365
13798
  } = useTranslation("checkoutForm");
@@ -13393,7 +13826,7 @@ const CouponCodeField = props => {
13393
13826
  couponCode,
13394
13827
  couponError
13395
13828
  }
13396
- } = useContext(store$c);
13829
+ } = useContext(store$d);
13397
13830
 
13398
13831
  const onCouponCodeChange = e => {
13399
13832
  dispatch({
@@ -13411,6 +13844,7 @@ const CouponCodeField = props => {
13411
13844
 
13412
13845
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({
13413
13846
  className: "plc-h-12",
13847
+ wrapperClassName: "plc-mb-1",
13414
13848
  errorClassName: "plc-h-12 sm:plc-h-8",
13415
13849
  error: couponError,
13416
13850
  "aria-label": t("labels.code"),
@@ -13421,17 +13855,17 @@ const CouponCodeField = props => {
13421
13855
  }, props));
13422
13856
  };
13423
13857
 
13424
- var _path$g;
13858
+ var _path$i;
13425
13859
 
13426
- function _extends$i() { _extends$i = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
13860
+ function _extends$k() { _extends$k = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); }
13427
13861
 
13428
13862
  function SvgTicket(props) {
13429
- return /*#__PURE__*/React.createElement("svg", _extends$i({
13863
+ return /*#__PURE__*/React.createElement("svg", _extends$k({
13430
13864
  xmlns: "http://www.w3.org/2000/svg",
13431
13865
  fill: "none",
13432
13866
  viewBox: "0 0 24 24",
13433
13867
  stroke: "currentColor"
13434
- }, props), _path$g || (_path$g = /*#__PURE__*/React.createElement("path", {
13868
+ }, props), _path$i || (_path$i = /*#__PURE__*/React.createElement("path", {
13435
13869
  strokeLinecap: "round",
13436
13870
  strokeLinejoin: "round",
13437
13871
  strokeWidth: 2,
@@ -13448,7 +13882,7 @@ const CouponCode = ({
13448
13882
  state: {
13449
13883
  enableCouponField
13450
13884
  }
13451
- } = useContext(store$c);
13885
+ } = useContext(store$d);
13452
13886
  const {
13453
13887
  t
13454
13888
  } = useTranslation("checkoutForm");
@@ -13462,16 +13896,16 @@ const CouponCode = ({
13462
13896
  };
13463
13897
 
13464
13898
  return /*#__PURE__*/React__default.createElement("div", {
13465
- className: "plc-my-4"
13899
+ className: "plc-mt-4"
13466
13900
  }, /*#__PURE__*/React__default.createElement(Button, Object.assign({
13467
- className: "plc-text-base plc-text-gray-500",
13901
+ className: "plc-mb-2 plc-text-base plc-text-gray-500",
13468
13902
  variant: "ghost",
13469
13903
  icon: /*#__PURE__*/React__default.createElement(SvgTicket, {
13470
13904
  className: "plc-w-5 plc-h-5 plc-mr-2"
13471
13905
  }),
13472
13906
  onClick: showCouponField
13473
13907
  }, otherProps), !enableCouponField ? t("labels.addCode") : t("labels.hideCode")), enableCouponField && /*#__PURE__*/React__default.createElement("div", {
13474
- className: "plc-flex plc-w-full plc-my-4 pelcro-apply-coupon-wrapper"
13908
+ className: "plc-flex plc-w-full plc-mt-2 pelcro-apply-coupon-wrapper"
13475
13909
  }, /*#__PURE__*/React__default.createElement(CouponCodeField, null), /*#__PURE__*/React__default.createElement(ApplyCouponButton, null)));
13476
13910
  };
13477
13911
 
@@ -13556,7 +13990,7 @@ class PaypalClient {
13556
13990
  this.paypalButton = window.paypal.Buttons({
13557
13991
  fundingSource: window.paypal.FUNDING.PAYPAL,
13558
13992
  // button locale
13559
- locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale : this.siteInfo.default_locale,
13993
+ locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale : getPageOrDefaultLanguage(),
13560
13994
  // button style
13561
13995
  style: (_this$config$style = this.config.style) !== null && _this$config$style !== void 0 ? _this$config$style : defaultButtonStyle,
13562
13996
  // create payment handler
@@ -13653,7 +14087,7 @@ class PaypalClient {
13653
14087
  } : undefined,
13654
14088
  shippingAddressEditable: this.config.shippingAddressEditable,
13655
14089
  displayName: (_this$config$displayN = this.config.displayName) !== null && _this$config$displayN !== void 0 ? _this$config$displayN : this.siteInfo.name,
13656
- locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 : this.siteInfo.default_locale
14090
+ locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 : getPageOrDefaultLanguage()
13657
14091
  };
13658
14092
  }
13659
14093
  });
@@ -13662,7 +14096,7 @@ class PaypalClient {
13662
14096
  writable: true,
13663
14097
  value: () => {
13664
14098
  const totalAmount = (this.product.quantity || 1) * this.amount;
13665
- const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency, this.siteInfo.default_locale);
14099
+ const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency, getPageOrDefaultLanguage());
13666
14100
  const autoRenewed = this.product.auto_renew;
13667
14101
  const {
13668
14102
  interval,
@@ -13705,7 +14139,7 @@ const PaypalSubscribeButton = props => {
13705
14139
  const {
13706
14140
  dispatch,
13707
14141
  state
13708
- } = useContext(store$c);
14142
+ } = useContext(store$d);
13709
14143
  const {
13710
14144
  product,
13711
14145
  plan,
@@ -13790,16 +14224,16 @@ const BankRedirection = () => {
13790
14224
  }));
13791
14225
  };
13792
14226
 
13793
- var _path$f;
14227
+ var _path$h;
13794
14228
 
13795
- function _extends$h() { _extends$h = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
14229
+ function _extends$j() { _extends$j = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
13796
14230
 
13797
14231
  function SvgLock(props) {
13798
- return /*#__PURE__*/React.createElement("svg", _extends$h({
14232
+ return /*#__PURE__*/React.createElement("svg", _extends$j({
13799
14233
  xmlns: "http://www.w3.org/2000/svg",
13800
14234
  viewBox: "0 0 20 20",
13801
14235
  fill: "currentColor"
13802
- }, props), _path$f || (_path$f = /*#__PURE__*/React.createElement("path", {
14236
+ }, props), _path$h || (_path$h = /*#__PURE__*/React.createElement("path", {
13803
14237
  fillRule: "evenodd",
13804
14238
  d: "M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",
13805
14239
  clipRule: "evenodd"
@@ -13816,7 +14250,7 @@ const SelectedPaymentMethod = () => {
13816
14250
  state: {
13817
14251
  isLoading
13818
14252
  }
13819
- } = useContext(store$c);
14253
+ } = useContext(store$d);
13820
14254
  const {
13821
14255
  switchView,
13822
14256
  selectedPaymentMethodId
@@ -13848,6 +14282,34 @@ const SelectedPaymentMethod = () => {
13848
14282
  }, t("select.buttons.changePaymentMethod")))));
13849
14283
  };
13850
14284
 
14285
+ const TaxAmount = () => {
14286
+ var _plan$quantity;
14287
+
14288
+ const {
14289
+ t
14290
+ } = useTranslation("checkoutForm");
14291
+ const {
14292
+ state: {
14293
+ taxAmount
14294
+ }
14295
+ } = useContext(store$d);
14296
+ const {
14297
+ plan
14298
+ } = usePelcro();
14299
+ const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
14300
+ const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
14301
+
14302
+ if (taxAmount) {
14303
+ return /*#__PURE__*/React__default.createElement("div", {
14304
+ className: "plc-text-center pelcro-tax-amount"
14305
+ }, t("labels.tax"), " ", /*#__PURE__*/React__default.createElement("span", {
14306
+ className: "plc-font-bold"
14307
+ }, priceFormatted));
14308
+ }
14309
+
14310
+ return null;
14311
+ };
14312
+
13851
14313
  /**
13852
14314
  *
13853
14315
  */
@@ -13884,7 +14346,9 @@ function PaymentMethodView({
13884
14346
  onFailure: onFailure
13885
14347
  }, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(AlertWithContext, {
13886
14348
  className: "plc-mb-2"
13887
- }), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), /*#__PURE__*/React__default.createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement("div", {
14349
+ }), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), /*#__PURE__*/React__default.createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default.createElement("div", {
14350
+ className: "plc-mb-2"
14351
+ }, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), /*#__PURE__*/React__default.createElement("div", {
13888
14352
  className: "plc-grid plc-mt-4 plc-gap-y-2"
13889
14353
  }, /*#__PURE__*/React__default.createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)))))));
13890
14354
  }
@@ -13991,12 +14455,12 @@ function SubscriptionRenewModal({
13991
14455
  }
13992
14456
  SubscriptionRenewModal.viewId = "subscription-renew";
13993
14457
 
13994
- var _path$e;
14458
+ var _path$g;
13995
14459
 
13996
- function _extends$g() { _extends$g = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
14460
+ function _extends$i() { _extends$i = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
13997
14461
 
13998
14462
  function SvgGift(props) {
13999
- return /*#__PURE__*/React.createElement("svg", _extends$g({
14463
+ return /*#__PURE__*/React.createElement("svg", _extends$i({
14000
14464
  className: "plc-w-6 plc-h-6 plc-mr-2",
14001
14465
  fill: "none",
14002
14466
  stroke: "currentColor",
@@ -14005,7 +14469,7 @@ function SvgGift(props) {
14005
14469
  strokeWidth: 2,
14006
14470
  viewBox: "0 0 24 24",
14007
14471
  xmlns: "http://www.w3.org/2000/svg"
14008
- }, props), _path$e || (_path$e = /*#__PURE__*/React.createElement("path", {
14472
+ }, props), _path$g || (_path$g = /*#__PURE__*/React.createElement("path", {
14009
14473
  d: "M20 12v10H4V12M2 7h20v5H2zM12 22V7M12 7H7.5a2.5 2.5 0 010-5C11 2 12 7 12 7zM12 7h4.5a2.5 2.5 0 000-5C13 2 12 7 12 7z"
14010
14474
  })));
14011
14475
  }
@@ -14336,44 +14800,330 @@ class DefaultNewsLetter extends Component {
14336
14800
 
14337
14801
  const NewsLetter = withTranslation("newsletter")(DefaultNewsLetter);
14338
14802
 
14339
- const MeterView = () => {
14340
- var _paywallProduct$paywa, _paywallProduct$paywa2;
14341
-
14342
- const {
14343
- t
14344
- } = useTranslation("meter");
14345
- const {
14346
- switchView,
14347
- product,
14348
- isAuthenticated
14349
- } = usePelcro();
14350
- const paywallProduct = product !== null && product !== void 0 ? product : window.Pelcro.paywall.getProduct();
14351
- const visitsLeft = window.Pelcro.paywall.freeVisitsLeft();
14352
- const title = `${paywallProduct === null || paywallProduct === void 0 ? void 0 : (_paywallProduct$paywa = paywallProduct.paywall) === null || _paywallProduct$paywa === void 0 ? void 0 : _paywallProduct$paywa.meter_title}: ${visitsLeft}`;
14353
- const subtitle = paywallProduct === null || paywallProduct === void 0 ? void 0 : (_paywallProduct$paywa2 = paywallProduct.paywall) === null || _paywallProduct$paywa2 === void 0 ? void 0 : _paywallProduct$paywa2.meter_subtitle;
14354
- return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h4", {
14355
- className: "plc-mb-2 plc-text-2xl plc-font-semibold plc-text-gray-600"
14356
- }, title), /*#__PURE__*/React__default.createElement("p", {
14357
- className: "plc-text-sm plc-text-gray-600"
14358
- }, subtitle, " ", /*#__PURE__*/React__default.createElement(Link, {
14359
- className: "plc-ml-1",
14360
- onClick: () => switchView("plan-select")
14361
- }, t("messages.subscribeNow")), !isAuthenticated() && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", null, t("messages.alreadyHaveAccount") + " ", /*#__PURE__*/React__default.createElement(Link, {
14362
- className: "plc-ml-1",
14363
- onClick: () => switchView("login")
14364
- }, t("messages.loginHere"))))));
14803
+ const initialState$c = {
14804
+ didSubToNewslettersBefore: false,
14805
+ newsletters: [],
14806
+ isListLoading: true,
14807
+ isSubmitting: false,
14808
+ alert: {
14809
+ type: "error",
14810
+ content: ""
14811
+ }
14365
14812
  };
14813
+ const store$c = /*#__PURE__*/createContext(initialState$c);
14814
+ const {
14815
+ Provider: Provider$c
14816
+ } = store$c;
14366
14817
 
14367
- // Meter view.
14368
- const MeterModal = props => {
14369
- const {
14370
- resetView
14371
- } = usePelcro();
14372
- useEffect(() => {
14373
- var _props$onDisplay;
14374
-
14375
- (_props$onDisplay = props.onDisplay) === null || _props$onDisplay === void 0 ? void 0 : _props$onDisplay.call(props);
14376
- }, []);
14818
+ const NewsletterUpdateContainer = ({
14819
+ style,
14820
+ className = "",
14821
+ onSuccess = () => {},
14822
+ onFailure = () => {},
14823
+ children
14824
+ }) => {
14825
+ const [t] = useTranslation("newsletter");
14826
+
14827
+ const handleSubmit = ({
14828
+ newsletters,
14829
+ didSubToNewslettersBefore
14830
+ }, dispatch) => {
14831
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2;
14832
+
14833
+ const callback = (err, res) => {
14834
+ dispatch({
14835
+ type: LOADING,
14836
+ payload: false
14837
+ });
14838
+
14839
+ if (err) {
14840
+ dispatch({
14841
+ type: SHOW_ALERT,
14842
+ payload: {
14843
+ type: "error",
14844
+ content: getErrorMessages(err)
14845
+ }
14846
+ });
14847
+ onFailure(err);
14848
+ } else {
14849
+ if (!didSubToNewslettersBefore) {
14850
+ dispatch({
14851
+ type: SWITCH_TO_UPDATE
14852
+ });
14853
+ }
14854
+
14855
+ dispatch({
14856
+ type: SHOW_ALERT,
14857
+ payload: {
14858
+ type: "success",
14859
+ content: t("messages.success")
14860
+ }
14861
+ });
14862
+ onSuccess(res);
14863
+ }
14864
+ };
14865
+
14866
+ const requestData = {
14867
+ email: (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.email) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : window.Pelcro.helpers.getURLParameter("email"),
14868
+ source: "web",
14869
+ lists: newsletters.filter(newsletter => newsletter.selected).map(newsletter => newsletter.id).join(",")
14870
+ };
14871
+
14872
+ if (didSubToNewslettersBefore) {
14873
+ window.Pelcro.newsletter.update(requestData, callback);
14874
+ } else {
14875
+ window.Pelcro.newsletter.create(requestData, callback);
14876
+ }
14877
+ };
14878
+
14879
+ const [state, dispatch] = useReducerWithSideEffects((state, action) => {
14880
+ switch (action.type) {
14881
+ case GET_NEWSLETTERS_FETCH:
14882
+ return lib_7({ ...state,
14883
+ isListLoading: true
14884
+ });
14885
+
14886
+ case GET_NEWSLETTERS_SUCCESS:
14887
+ return lib_7({ ...state,
14888
+ newsletters: action.payload.newsletters,
14889
+ didSubToNewslettersBefore: action.payload.didSubToNewslettersBefore,
14890
+ isListLoading: false
14891
+ });
14892
+
14893
+ case SET_SELECT:
14894
+ return lib_7({ ...state,
14895
+ newsletters: state.newsletters.map(newsletter => {
14896
+ if (newsletter.id === action.payload) {
14897
+ return { ...newsletter,
14898
+ selected: !newsletter.selected
14899
+ };
14900
+ }
14901
+
14902
+ return newsletter;
14903
+ })
14904
+ });
14905
+
14906
+ case SWITCH_TO_UPDATE:
14907
+ return lib_7({ ...state,
14908
+ didSubToNewslettersBefore: true
14909
+ });
14910
+
14911
+ case SHOW_ALERT:
14912
+ return lib_7({ ...state,
14913
+ alert: action.payload
14914
+ });
14915
+
14916
+ case LOADING:
14917
+ return lib_7({ ...state,
14918
+ isSubmitting: action.payload
14919
+ });
14920
+
14921
+ case HANDLE_SUBMIT:
14922
+ return lib_5({ ...state,
14923
+ isSubmitting: true
14924
+ }, (state, dispatch) => handleSubmit(state, dispatch));
14925
+
14926
+ default:
14927
+ return state;
14928
+ }
14929
+ }, initialState$c);
14930
+ useEffect(() => {
14931
+ const getUserNewsletters = () => {
14932
+ var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
14933
+
14934
+ dispatch({
14935
+ type: GET_NEWSLETTERS_FETCH
14936
+ });
14937
+ const email = (_window$Pelcro$user$r3 = (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.email) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : window.Pelcro.helpers.getURLParameter("email");
14938
+ window.Pelcro.newsletter.getByEmail(email, (err, res) => {
14939
+ var _window$Pelcro$uiSett, _window$Pelcro, _window$Pelcro$uiSett2, _res$data$lists$split, _res$data$lists;
14940
+
14941
+ if (err) {
14942
+ return dispatch({
14943
+ type: SHOW_ALERT,
14944
+ payload: {
14945
+ type: "error",
14946
+ content: getErrorMessages(err)
14947
+ }
14948
+ });
14949
+ }
14950
+
14951
+ const newsletters = (_window$Pelcro$uiSett = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett2 = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett2 === void 0 ? void 0 : _window$Pelcro$uiSett2.newsletters) !== null && _window$Pelcro$uiSett !== void 0 ? _window$Pelcro$uiSett : [];
14952
+ const selectedNewsletters = (_res$data$lists$split = (_res$data$lists = res.data.lists) === null || _res$data$lists === void 0 ? void 0 : _res$data$lists.split(",")) !== null && _res$data$lists$split !== void 0 ? _res$data$lists$split : [];
14953
+ const allNewslettersWithSelectedField = newsletters.map(newsletter => ({ ...newsletter,
14954
+ id: String(newsletter.id),
14955
+ selected: selectedNewsletters.includes(String(newsletter.id))
14956
+ }));
14957
+ dispatch({
14958
+ type: GET_NEWSLETTERS_SUCCESS,
14959
+ payload: {
14960
+ newsletters: allNewslettersWithSelectedField,
14961
+ didSubToNewslettersBefore: Boolean(res.data.email)
14962
+ }
14963
+ });
14964
+ });
14965
+ };
14966
+
14967
+ getUserNewsletters();
14968
+ }, []);
14969
+ return /*#__PURE__*/React__default.createElement("div", {
14970
+ style: { ...style
14971
+ },
14972
+ className: `pelcro-container pelcro-newsletter-update-container ${className}`
14973
+ }, /*#__PURE__*/React__default.createElement(Provider$c, {
14974
+ value: {
14975
+ state,
14976
+ dispatch
14977
+ }
14978
+ }, children.length ? children.map((child, i) => {
14979
+ if (child) {
14980
+ return /*#__PURE__*/React__default.cloneElement(child, {
14981
+ store: store$c,
14982
+ key: i
14983
+ });
14984
+ }
14985
+ }) : /*#__PURE__*/React__default.cloneElement(children, {
14986
+ store: store$c
14987
+ })));
14988
+ };
14989
+
14990
+ const NewsletterUpdateButton = ({
14991
+ name,
14992
+ onClick,
14993
+ ...otherProps
14994
+ }) => {
14995
+ const {
14996
+ dispatch,
14997
+ state: {
14998
+ isSubmitting,
14999
+ isListLoading
15000
+ }
15001
+ } = useContext(store$c);
15002
+ const {
15003
+ t
15004
+ } = useTranslation("newsletter");
15005
+ return /*#__PURE__*/React__default.createElement(Button, Object.assign({
15006
+ onClick: () => {
15007
+ dispatch({
15008
+ type: HANDLE_SUBMIT
15009
+ });
15010
+ onClick === null || onClick === void 0 ? void 0 : onClick();
15011
+ },
15012
+ disabled: isListLoading,
15013
+ isLoading: isSubmitting
15014
+ }, otherProps), name !== null && name !== void 0 ? name : t("labels.submit"));
15015
+ };
15016
+
15017
+ const NewsletterUpdateList = () => {
15018
+ const handleSelectNewsletter = event => {
15019
+ dispatch({
15020
+ type: SET_SELECT,
15021
+ payload: event.target.value
15022
+ });
15023
+ };
15024
+
15025
+ const {
15026
+ dispatch,
15027
+ state: {
15028
+ newsletters,
15029
+ isListLoading
15030
+ }
15031
+ } = useContext(store$c);
15032
+
15033
+ if (isListLoading) {
15034
+ return /*#__PURE__*/React__default.createElement(Loader, {
15035
+ width: 60,
15036
+ height: 100
15037
+ });
15038
+ }
15039
+
15040
+ return /*#__PURE__*/React__default.createElement("div", {
15041
+ className: "plc-max-h-80 plc-overflow-y-auto pelcro-newsletters-wrapper"
15042
+ }, newsletters.map(newsletter => /*#__PURE__*/React__default.createElement("div", {
15043
+ key: newsletter.id,
15044
+ className: "plc-p-2 plc-mx-3 plc-mt-2 plc-border plc-border-gray-400 plc-border-solid plc-rounded plc-text-gray-900 pelcro-newsletter-wrapper"
15045
+ }, /*#__PURE__*/React__default.createElement(Checkbox, {
15046
+ className: "pelcro-select-newsletter-checkbox",
15047
+ labelClassName: "plc-cursor-pointer plc-w-full",
15048
+ id: `pelcro-newsletter-update-${newsletter.id}`,
15049
+ checked: newsletter.selected,
15050
+ value: newsletter.id,
15051
+ onChange: handleSelectNewsletter
15052
+ }, newsletter.label))));
15053
+ };
15054
+
15055
+ const NewsletterUpdateView = props => {
15056
+ const {
15057
+ t
15058
+ } = useTranslation("newsletter");
15059
+ return /*#__PURE__*/React__default.createElement("div", {
15060
+ id: "pelcro-newsletter-update-view"
15061
+ }, /*#__PURE__*/React__default.createElement("div", {
15062
+ className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
15063
+ }, /*#__PURE__*/React__default.createElement("h4", {
15064
+ className: "plc-text-2xl plc-font-semibold"
15065
+ }, t("updateTitle"))), /*#__PURE__*/React__default.createElement("form", {
15066
+ action: "javascript:void(0);",
15067
+ className: "plc-mt-2 pelcro-form"
15068
+ }, /*#__PURE__*/React__default.createElement(NewsletterUpdateContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), /*#__PURE__*/React__default.createElement(NewsletterUpdateList, null), /*#__PURE__*/React__default.createElement(NewsletterUpdateButton, {
15069
+ role: "submit",
15070
+ className: "plc-mt-4 plc-w-full",
15071
+ name: t("labels.submit"),
15072
+ id: "pelcro-submit"
15073
+ }))));
15074
+ };
15075
+
15076
+ const NewsletterUpdateModal = ({
15077
+ onDisplay,
15078
+ onClose,
15079
+ ...otherProps
15080
+ }) => {
15081
+ return /*#__PURE__*/React__default.createElement(Modal, {
15082
+ id: "pelcro-newsletter-update-modal",
15083
+ onDisplay: onDisplay,
15084
+ onClose: onClose
15085
+ }, /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(NewsletterUpdateView, otherProps)), /*#__PURE__*/React__default.createElement(ModalFooter, null, /*#__PURE__*/React__default.createElement(Authorship, null)));
15086
+ };
15087
+ NewsletterUpdateModal.viewId = "newsletter-update";
15088
+
15089
+ const MeterView = () => {
15090
+ var _paywallProduct$paywa, _paywallProduct$paywa2;
15091
+
15092
+ const {
15093
+ t
15094
+ } = useTranslation("meter");
15095
+ const {
15096
+ switchView,
15097
+ product,
15098
+ isAuthenticated
15099
+ } = usePelcro();
15100
+ const paywallProduct = product !== null && product !== void 0 ? product : window.Pelcro.paywall.getProduct();
15101
+ const visitsLeft = window.Pelcro.paywall.freeVisitsLeft();
15102
+ const title = `${paywallProduct === null || paywallProduct === void 0 ? void 0 : (_paywallProduct$paywa = paywallProduct.paywall) === null || _paywallProduct$paywa === void 0 ? void 0 : _paywallProduct$paywa.meter_title}: ${visitsLeft}`;
15103
+ const subtitle = paywallProduct === null || paywallProduct === void 0 ? void 0 : (_paywallProduct$paywa2 = paywallProduct.paywall) === null || _paywallProduct$paywa2 === void 0 ? void 0 : _paywallProduct$paywa2.meter_subtitle;
15104
+ return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h4", {
15105
+ className: "plc-mb-2 plc-text-2xl plc-font-semibold plc-text-gray-600"
15106
+ }, title), /*#__PURE__*/React__default.createElement("p", {
15107
+ className: "plc-text-sm plc-text-gray-600"
15108
+ }, subtitle, " ", /*#__PURE__*/React__default.createElement(Link, {
15109
+ className: "plc-ml-1",
15110
+ onClick: () => switchView("plan-select")
15111
+ }, t("messages.subscribeNow")), !isAuthenticated() && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", null, t("messages.alreadyHaveAccount") + " ", /*#__PURE__*/React__default.createElement(Link, {
15112
+ className: "plc-ml-1",
15113
+ onClick: () => switchView("login")
15114
+ }, t("messages.loginHere"))))));
15115
+ };
15116
+
15117
+ // Meter view.
15118
+ const MeterModal = props => {
15119
+ const {
15120
+ resetView
15121
+ } = usePelcro();
15122
+ useEffect(() => {
15123
+ var _props$onDisplay;
15124
+
15125
+ (_props$onDisplay = props.onDisplay) === null || _props$onDisplay === void 0 ? void 0 : _props$onDisplay.call(props);
15126
+ }, []);
14377
15127
 
14378
15128
  const onClose = () => {
14379
15129
  var _props$onClose;
@@ -14387,7 +15137,7 @@ const MeterModal = props => {
14387
15137
  className: "plc-fixed plc-bottom-0 plc-right-0 plc-w-full plc-p-4 plc-bg-white plc-border-t-4 plc-rounded plc-shadow-md motion-safe:plc-animate-slideInBottom sm:plc-m-4 sm:plc-max-w-md plc-z-max plc-border-primary-500"
14388
15138
  }, /*#__PURE__*/React__default.createElement("button", {
14389
15139
  type: "button",
14390
- className: "plc-absolute plc-top-0 plc-text-2xl plc-text-gray-500 plc-right-1 pelcro-close-btn",
15140
+ className: "plc-absolute plc-top-0 plc-text-2xl plc-text-gray-500 hover:plc-text-black focus:plc-text-black plc-right-1 plc-border-0 plc-bg-transparent hover:plc-bg-transparent focus:plc-bg-transparent pelcro-close-btn",
14391
15141
  "aria-label": "Close",
14392
15142
  onClick: onClose
14393
15143
  }, /*#__PURE__*/React__default.createElement("span", null, "\xD7")), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(MeterView, props)));
@@ -14420,10 +15170,7 @@ const SubscriptionCreateView = ({
14420
15170
  interval,
14421
15171
  count: interval_count
14422
15172
  });
14423
- const {
14424
- default_locale
14425
- } = Pelcro.site.read();
14426
- const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
15173
+ const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
14427
15174
  return /*#__PURE__*/React__default.createElement("p", {
14428
15175
  className: "plc-text-gray-600"
14429
15176
  }, /*#__PURE__*/React__default.createElement("span", {
@@ -14723,17 +15470,17 @@ const UserUpdatePhone = props => /*#__PURE__*/React__default.createElement(Phone
14723
15470
 
14724
15471
  var userSolidIcon = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20class%3D%22plc-h-5%20plc-w-5%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22white%22%3E%20%20%3Cpath%20transform%3D%22translate%280%2C2%29%22%20fill-rule%3D%22evenodd%22%20d%3D%22M10%209a3%203%200%20100-6%203%203%200%20000%206zm-7%209a7%207%200%201114%200H3z%22%20clip-rule%3D%22evenodd%22%20%2F%3E%3C%2Fsvg%3E";
14725
15472
 
14726
- var _path$d;
15473
+ var _path$f;
14727
15474
 
14728
- function _extends$f() { _extends$f = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
15475
+ function _extends$h() { _extends$h = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
14729
15476
 
14730
15477
  function SvgEdit(props) {
14731
- return /*#__PURE__*/React.createElement("svg", _extends$f({
15478
+ return /*#__PURE__*/React.createElement("svg", _extends$h({
14732
15479
  className: "plc-w-6 plc-h-6",
14733
15480
  xmlns: "http://www.w3.org/2000/svg",
14734
15481
  viewBox: "0 0 20 20",
14735
15482
  fill: "currentColor"
14736
- }, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
15483
+ }, props), _path$f || (_path$f = /*#__PURE__*/React.createElement("path", {
14737
15484
  d: "M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zm-2.207 2.207L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"
14738
15485
  })));
14739
15486
  }
@@ -17600,7 +18347,6 @@ const OrderConfirmModal = props => {
17600
18347
  const userOrders = window.Pelcro.user.read().orders;
17601
18348
  const latestOrder = userOrders === null || userOrders === void 0 ? void 0 : userOrders[userOrders.length - 1];
17602
18349
  const latestOrderDiscount = latestOrder === null || latestOrder === void 0 ? void 0 : (_latestOrder$coupon = latestOrder.coupon) === null || _latestOrder$coupon === void 0 ? void 0 : _latestOrder$coupon.percent_off;
17603
- const locale = window.Pelcro.site.read().default_locale;
17604
18350
  const {
17605
18351
  t
17606
18352
  } = useTranslation("shop");
@@ -17659,7 +18405,7 @@ const OrderConfirmModal = props => {
17659
18405
  className: "plc-mr-1 pelcro-summary-total-text"
17660
18406
  }, t("labels.total")), /*#__PURE__*/React__default.createElement("p", {
17661
18407
  className: "pelcro-summary-total"
17662
- }, latestOrderDiscount && `(-${latestOrderDiscount}%) `, getFormattedPriceByLocal(latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.amount, latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.currency, locale)))), /*#__PURE__*/React__default.createElement("div", {
18408
+ }, latestOrderDiscount && `(-${latestOrderDiscount}%) `, getFormattedPriceByLocal(latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.amount, latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default.createElement("div", {
17663
18409
  className: "plc-flex plc-justify-center plc-mt-6"
17664
18410
  }, /*#__PURE__*/React__default.createElement(Button, {
17665
18411
  id: "pelcro-submit",
@@ -17721,9 +18467,9 @@ const GiftCreateContainer = ({
17721
18467
  }
17722
18468
 
17723
18469
  if (giftRecipient.startDate) {
17724
- const nowDate = new Date();
17725
- const yearFromNowDate = new Date(new Date().setFullYear(nowDate.getFullYear() + 1));
17726
- const submittedDate = new Date(giftRecipient.startDate);
18470
+ const nowDate = getDateWithoutTime(new Date());
18471
+ const yearFromNowDate = getDateWithoutTime(new Date(new Date().setFullYear(nowDate.getFullYear() + 1)));
18472
+ const submittedDate = getDateWithoutTime(new Date(giftRecipient.startDate));
17727
18473
 
17728
18474
  if (submittedDate < nowDate || submittedDate > yearFromNowDate) {
17729
18475
  dispatch({
@@ -17844,18 +18590,18 @@ const GiftCreateLastName = props => /*#__PURE__*/React__default.createElement(La
17844
18590
  store: store$4
17845
18591
  }, props));
17846
18592
 
17847
- var _path$c;
18593
+ var _path$e;
17848
18594
 
17849
- function _extends$e() { _extends$e = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
18595
+ function _extends$g() { _extends$g = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
17850
18596
 
17851
18597
  function SvgInfoCircle(props) {
17852
- return /*#__PURE__*/React.createElement("svg", _extends$e({
18598
+ return /*#__PURE__*/React.createElement("svg", _extends$g({
17853
18599
  xmlns: "http://www.w3.org/2000/svg",
17854
18600
  className: "plc-w-5 plc-h-5",
17855
18601
  fill: "none",
17856
18602
  viewBox: "0 0 24 24",
17857
18603
  stroke: "currentColor"
17858
- }, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
18604
+ }, props), _path$e || (_path$e = /*#__PURE__*/React.createElement("path", {
17859
18605
  strokeLinecap: "round",
17860
18606
  strokeLinejoin: "round",
17861
18607
  strokeWidth: 2,
@@ -18842,8 +19588,8 @@ const PaymentMethodSelectModal = ({
18842
19588
  };
18843
19589
  PaymentMethodSelectModal.viewId = "payment-method-select";
18844
19590
 
18845
- function _extends$d() {
18846
- _extends$d = Object.assign || function (target) {
19591
+ function _extends$f() {
19592
+ _extends$f = Object.assign || function (target) {
18847
19593
  for (var i = 1; i < arguments.length; i++) {
18848
19594
  var source = arguments[i];
18849
19595
 
@@ -18857,7 +19603,7 @@ function _extends$d() {
18857
19603
  return target;
18858
19604
  };
18859
19605
 
18860
- return _extends$d.apply(this, arguments);
19606
+ return _extends$f.apply(this, arguments);
18861
19607
  }
18862
19608
 
18863
19609
  function _objectWithoutPropertiesLoose(source, excluded) {
@@ -19041,7 +19787,7 @@ function render(props, propsBag, defaultTag, features, visible) {
19041
19787
  return match(strategy, (_match = {}, _match[RenderStrategy.Unmount] = function () {
19042
19788
  return null;
19043
19789
  }, _match[RenderStrategy.Hidden] = function () {
19044
- return _render(_extends$d({}, _rest, {
19790
+ return _render(_extends$f({}, _rest, {
19045
19791
  hidden: true,
19046
19792
  style: {
19047
19793
  display: 'none'
@@ -19569,7 +20315,7 @@ function TransitionChild(props) {
19569
20315
  var passthroughProps = rest;
19570
20316
  return React__default.createElement(NestingContext.Provider, {
19571
20317
  value: nesting
19572
- }, render(_extends$d({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
20318
+ }, render(_extends$f({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
19573
20319
  }
19574
20320
 
19575
20321
  function Transition(props) {
@@ -19613,7 +20359,7 @@ function Transition(props) {
19613
20359
  value: nestingBag
19614
20360
  }, React__default.createElement(TransitionContext.Provider, {
19615
20361
  value: transitionBag
19616
- }, render(_extends$d({}, sharedProps, {
20362
+ }, render(_extends$f({}, sharedProps, {
19617
20363
  as: Fragment,
19618
20364
  children: React__default.createElement(TransitionChild, Object.assign({}, sharedProps, passthroughProps))
19619
20365
  }), propsBag, Fragment, TransitionChildRenderFeatures, state === TreeStates.Visible)));
@@ -19740,12 +20486,12 @@ var ActionTypes;
19740
20486
  })(ActionTypes || (ActionTypes = {}));
19741
20487
 
19742
20488
  (_reducers = {}, _reducers[ActionTypes.CloseMenu] = function (state) {
19743
- return _extends$d({}, state, {
20489
+ return _extends$f({}, state, {
19744
20490
  activeItemIndex: null,
19745
20491
  menuState: MenuStates.Closed
19746
20492
  });
19747
20493
  }, _reducers[ActionTypes.OpenMenu] = function (state) {
19748
- return _extends$d({}, state, {
20494
+ return _extends$f({}, state, {
19749
20495
  menuState: MenuStates.Open
19750
20496
  });
19751
20497
  }, _reducers[ActionTypes.GoToItem] = function (state, action) {
@@ -19764,7 +20510,7 @@ var ActionTypes;
19764
20510
  }
19765
20511
  });
19766
20512
  if (state.searchQuery === '' && state.activeItemIndex === activeItemIndex) return state;
19767
- return _extends$d({}, state, {
20513
+ return _extends$f({}, state, {
19768
20514
  searchQuery: '',
19769
20515
  activeItemIndex: activeItemIndex
19770
20516
  });
@@ -19775,19 +20521,19 @@ var ActionTypes;
19775
20521
 
19776
20522
  return ((_item$dataRef$current = item.dataRef.current.textValue) == null ? void 0 : _item$dataRef$current.startsWith(searchQuery)) && !item.dataRef.current.disabled;
19777
20523
  });
19778
- if (match === -1 || match === state.activeItemIndex) return _extends$d({}, state, {
20524
+ if (match === -1 || match === state.activeItemIndex) return _extends$f({}, state, {
19779
20525
  searchQuery: searchQuery
19780
20526
  });
19781
- return _extends$d({}, state, {
20527
+ return _extends$f({}, state, {
19782
20528
  searchQuery: searchQuery,
19783
20529
  activeItemIndex: match
19784
20530
  });
19785
20531
  }, _reducers[ActionTypes.ClearSearch] = function (state) {
19786
- return _extends$d({}, state, {
20532
+ return _extends$f({}, state, {
19787
20533
  searchQuery: ''
19788
20534
  });
19789
20535
  }, _reducers[ActionTypes.RegisterItem] = function (state, action) {
19790
- return _extends$d({}, state, {
20536
+ return _extends$f({}, state, {
19791
20537
  items: [].concat(state.items, [{
19792
20538
  id: action.id,
19793
20539
  dataRef: action.dataRef
@@ -19800,7 +20546,7 @@ var ActionTypes;
19800
20546
  return a.id === action.id;
19801
20547
  });
19802
20548
  if (idx !== -1) nextItems.splice(idx, 1);
19803
- return _extends$d({}, state, {
20549
+ return _extends$f({}, state, {
19804
20550
  items: nextItems,
19805
20551
  activeItemIndex: function () {
19806
20552
  if (idx === state.activeItemIndex) return null;
@@ -19839,19 +20585,19 @@ var ActionTypes$1;
19839
20585
  (_reducers$1 = {}, _reducers$1[ActionTypes$1.CloseListbox] = function (state) {
19840
20586
  if (state.disabled) return state;
19841
20587
  if (state.listboxState === ListboxStates.Closed) return state;
19842
- return _extends$d({}, state, {
20588
+ return _extends$f({}, state, {
19843
20589
  activeOptionIndex: null,
19844
20590
  listboxState: ListboxStates.Closed
19845
20591
  });
19846
20592
  }, _reducers$1[ActionTypes$1.OpenListbox] = function (state) {
19847
20593
  if (state.disabled) return state;
19848
20594
  if (state.listboxState === ListboxStates.Open) return state;
19849
- return _extends$d({}, state, {
20595
+ return _extends$f({}, state, {
19850
20596
  listboxState: ListboxStates.Open
19851
20597
  });
19852
20598
  }, _reducers$1[ActionTypes$1.SetDisabled] = function (state, action) {
19853
20599
  if (state.disabled === action.disabled) return state;
19854
- return _extends$d({}, state, {
20600
+ return _extends$f({}, state, {
19855
20601
  disabled: action.disabled
19856
20602
  });
19857
20603
  }, _reducers$1[ActionTypes$1.GoToOption] = function (state, action) {
@@ -19872,7 +20618,7 @@ var ActionTypes$1;
19872
20618
  }
19873
20619
  });
19874
20620
  if (state.searchQuery === '' && state.activeOptionIndex === activeOptionIndex) return state;
19875
- return _extends$d({}, state, {
20621
+ return _extends$f({}, state, {
19876
20622
  searchQuery: '',
19877
20623
  activeOptionIndex: activeOptionIndex
19878
20624
  });
@@ -19885,10 +20631,10 @@ var ActionTypes$1;
19885
20631
 
19886
20632
  return !option.dataRef.current.disabled && ((_option$dataRef$curre = option.dataRef.current.textValue) == null ? void 0 : _option$dataRef$curre.startsWith(searchQuery));
19887
20633
  });
19888
- if (match === -1 || match === state.activeOptionIndex) return _extends$d({}, state, {
20634
+ if (match === -1 || match === state.activeOptionIndex) return _extends$f({}, state, {
19889
20635
  searchQuery: searchQuery
19890
20636
  });
19891
- return _extends$d({}, state, {
20637
+ return _extends$f({}, state, {
19892
20638
  searchQuery: searchQuery,
19893
20639
  activeOptionIndex: match
19894
20640
  });
@@ -19896,11 +20642,11 @@ var ActionTypes$1;
19896
20642
  if (state.disabled) return state;
19897
20643
  if (state.listboxState === ListboxStates.Closed) return state;
19898
20644
  if (state.searchQuery === '') return state;
19899
- return _extends$d({}, state, {
20645
+ return _extends$f({}, state, {
19900
20646
  searchQuery: ''
19901
20647
  });
19902
20648
  }, _reducers$1[ActionTypes$1.RegisterOption] = function (state, action) {
19903
- return _extends$d({}, state, {
20649
+ return _extends$f({}, state, {
19904
20650
  options: [].concat(state.options, [{
19905
20651
  id: action.id,
19906
20652
  dataRef: action.dataRef
@@ -19913,7 +20659,7 @@ var ActionTypes$1;
19913
20659
  return a.id === action.id;
19914
20660
  });
19915
20661
  if (idx !== -1) nextOptions.splice(idx, 1);
19916
- return _extends$d({}, state, {
20662
+ return _extends$f({}, state, {
19917
20663
  options: nextOptions,
19918
20664
  activeOptionIndex: function () {
19919
20665
  if (idx === state.activeOptionIndex) return null;
@@ -19974,18 +20720,18 @@ const getPaymentCardIcon = name => {
19974
20720
  }));
19975
20721
  };
19976
20722
 
19977
- var _path$b;
20723
+ var _path$d;
19978
20724
 
19979
- function _extends$c() { _extends$c = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
20725
+ function _extends$e() { _extends$e = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
19980
20726
 
19981
20727
  function SvgChevronRight(props) {
19982
- return /*#__PURE__*/React.createElement("svg", _extends$c({
20728
+ return /*#__PURE__*/React.createElement("svg", _extends$e({
19983
20729
  className: "plc-w-6 plc-h-6",
19984
20730
  xmlns: "http://www.w3.org/2000/svg",
19985
20731
  fill: "none",
19986
20732
  viewBox: "0 0 24 24",
19987
20733
  stroke: "currentColor"
19988
- }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
20734
+ }, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
19989
20735
  strokeLinecap: "round",
19990
20736
  strokeLinejoin: "round",
19991
20737
  strokeWidth: 2,
@@ -20028,7 +20774,6 @@ const OrderItems = ({
20028
20774
  const {
20029
20775
  t
20030
20776
  } = useTranslation("dashboard");
20031
- const site = window.Pelcro.site.read();
20032
20777
  return !(orders !== null && orders !== void 0 && orders.length) ? /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
20033
20778
  colSpan: "3",
20034
20779
  className: "plc-text-center plc-text-gray-500"
@@ -20044,7 +20789,7 @@ const OrderItems = ({
20044
20789
  className: "plc-py-4 plc-pl-2"
20045
20790
  }, /*#__PURE__*/React__default.createElement("span", {
20046
20791
  className: "plc-text-xl plc-font-semibold "
20047
- }, getFormattedPriceByLocal(order.amount, order.currency, site.default_locale)), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
20792
+ }, getFormattedPriceByLocal(order.amount, order.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
20048
20793
  className: "plc-text-xs plc-text-gray-400 plc-uppercase"
20049
20794
  }, t("labels.orders.itemsAmount", {
20050
20795
  count: getItemsAmount(order.id)
@@ -20073,7 +20818,7 @@ const OrderItems = ({
20073
20818
  className: ""
20074
20819
  }, item.product_sku_name))), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("span", {
20075
20820
  className: "plc-font-semibold"
20076
- }, getFormattedPriceByLocal(item.amount, order.currency, site.default_locale))));
20821
+ }, getFormattedPriceByLocal(item.amount, order.currency, getPageOrDefaultLanguage()))));
20077
20822
  }), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
20078
20823
  colSpan: "3"
20079
20824
  }, /*#__PURE__*/React__default.createElement("hr", {
@@ -20202,9 +20947,267 @@ const SavedItems = ({
20202
20947
  });
20203
20948
  };
20204
20949
 
20205
- /**
20206
- * @typedef {Object} AccordionPropsType
20207
- * @property {string} initialActiveMenu the initial active menu
20950
+ var _path$c;
20951
+
20952
+ function _extends$d() { _extends$d = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
20953
+
20954
+ function SvgRefresh(props) {
20955
+ return /*#__PURE__*/React.createElement("svg", _extends$d({
20956
+ className: "plc-w-4 plc-h-4 plc-mr-1",
20957
+ xmlns: "http://www.w3.org/2000/svg",
20958
+ fill: "none",
20959
+ viewBox: "0 0 24 24",
20960
+ stroke: "currentColor"
20961
+ }, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
20962
+ strokeLinecap: "round",
20963
+ strokeLinejoin: "round",
20964
+ strokeWidth: 2,
20965
+ d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
20966
+ })));
20967
+ }
20968
+
20969
+ var _path$b;
20970
+
20971
+ function _extends$c() { _extends$c = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
20972
+
20973
+ function SvgCalendar(props) {
20974
+ return /*#__PURE__*/React.createElement("svg", _extends$c({
20975
+ xmlns: "http://www.w3.org/2000/svg",
20976
+ className: "plc-h-4 plc-w-4 plc-mr-1",
20977
+ viewBox: "0 0 20 20",
20978
+ fill: "currentColor"
20979
+ }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
20980
+ fillRule: "evenodd",
20981
+ d: "M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",
20982
+ clipRule: "evenodd"
20983
+ })));
20984
+ }
20985
+
20986
+ var _path$a;
20987
+
20988
+ function _extends$b() { _extends$b = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
20989
+
20990
+ function SvgPlus(props) {
20991
+ return /*#__PURE__*/React.createElement("svg", _extends$b({
20992
+ className: "plc-w-5 plc-h-5",
20993
+ xmlns: "http://www.w3.org/2000/svg",
20994
+ fill: "none",
20995
+ viewBox: "0 0 24 24",
20996
+ stroke: "currentColor"
20997
+ }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
20998
+ strokeLinecap: "round",
20999
+ strokeLinejoin: "round",
21000
+ strokeWidth: 2,
21001
+ d: "M12 6v6m0 0v6m0-6h6m-6 0H6"
21002
+ })));
21003
+ }
21004
+
21005
+ var _path$9;
21006
+
21007
+ function _extends$a() { _extends$a = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
21008
+
21009
+ function SvgCheckMark(props) {
21010
+ return /*#__PURE__*/React.createElement("svg", _extends$a({
21011
+ className: "plc-w-4 plc-h-4 plc-mr-1",
21012
+ xmlns: "http://www.w3.org/2000/svg",
21013
+ viewBox: "0 0 20 20",
21014
+ fill: "currentColor"
21015
+ }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
21016
+ fillRule: "evenodd",
21017
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
21018
+ clipRule: "evenodd"
21019
+ })));
21020
+ }
21021
+
21022
+ const SubscriptionsMenu = props => {
21023
+ const {
21024
+ t
21025
+ } = useTranslation("dashboard");
21026
+ return /*#__PURE__*/React__default.createElement("table", {
21027
+ className: "plc-w-full plc-table-fixed"
21028
+ }, /*#__PURE__*/React__default.createElement("thead", {
21029
+ className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
21030
+ }, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
21031
+ className: "plc-w-3/12 "
21032
+ }, t("labels.plan")), /*#__PURE__*/React__default.createElement("th", {
21033
+ className: "plc-w-4/12 "
21034
+ }, t("labels.status.title")), /*#__PURE__*/React__default.createElement("th", {
21035
+ className: "plc-w-3/12 "
21036
+ }, t("labels.actions")), /*#__PURE__*/React__default.createElement("th", {
21037
+ className: "plc-w-2/12 "
21038
+ }))), /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", {
21039
+ className: "plc-h-4"
21040
+ })), /*#__PURE__*/React__default.createElement(Accordion, null, /*#__PURE__*/React__default.createElement(SubscriptionsItems, props)), /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
21041
+ colSpan: "4",
21042
+ className: "plc-p-1"
21043
+ }, /*#__PURE__*/React__default.createElement(Button, {
21044
+ variant: "ghost",
21045
+ icon: /*#__PURE__*/React__default.createElement(SvgPlus, {
21046
+ className: "plc-w-4 plc-h-4 plc-mr-1"
21047
+ }),
21048
+ className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
21049
+ onClick: props.displayProductSelect
21050
+ }, t("labels.addSubscription")))), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
21051
+ colSpan: "4",
21052
+ className: "plc-p-1"
21053
+ }, /*#__PURE__*/React__default.createElement(Button, {
21054
+ variant: "ghost",
21055
+ icon: /*#__PURE__*/React__default.createElement(SvgGift, {
21056
+ className: "plc-w-4 plc-h-4 plc-mr-1"
21057
+ }),
21058
+ className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
21059
+ onClick: props.displayRedeem
21060
+ }, t("labels.redeemGift"))))));
21061
+ };
21062
+ const SubscriptionsItems = ({
21063
+ onClose,
21064
+ cancelSubscription,
21065
+ reactivateSubscription,
21066
+ setProductAndPlan,
21067
+ setSubscriptionIdToRenew,
21068
+ setView,
21069
+ getSubscriptionStatus,
21070
+ disableSubmit,
21071
+ activeMenu,
21072
+ toggleActiveMenu
21073
+ }) => {
21074
+ const {
21075
+ t
21076
+ } = useTranslation("dashboard");
21077
+ const subs = window.Pelcro.subscription.list();
21078
+ if (!subs || subs.length === 0) return null;
21079
+ return window.Pelcro.subscription.list().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
21080
+ const isActive = activeMenu === sub.id; // Cancel button click handlers
21081
+
21082
+ const onCancelClick = () => {
21083
+ onClose === null || onClose === void 0 ? void 0 : onClose();
21084
+ notify.confirm((onSuccess, onFailure) => {
21085
+ cancelSubscription(sub.id, onSuccess, onFailure);
21086
+ }, {
21087
+ confirmMessage: t("messages.subCancellation.isSureToCancel"),
21088
+ loadingMessage: t("messages.subCancellation.loading"),
21089
+ successMessage: t("messages.subCancellation.success"),
21090
+ errorMessage: t("messages.subCancellation.error")
21091
+ }, {
21092
+ closeButtonLabel: t("labels.subCancellation.goBack")
21093
+ });
21094
+ }; // Reactivate button click handlers
21095
+
21096
+
21097
+ const onReactivateClick = () => {
21098
+ reactivateSubscription(sub.id);
21099
+ }; // Renew click
21100
+
21101
+
21102
+ const onRenewClick = () => {
21103
+ const product_id = sub.plan.product.id;
21104
+ const plan_id = sub.plan.id;
21105
+ const product = window.Pelcro.product.getById(product_id);
21106
+ const plan = window.Pelcro.plan.getById(plan_id);
21107
+ setProductAndPlan(product, plan);
21108
+ setSubscriptionIdToRenew(sub.id);
21109
+ setView("plan-select");
21110
+ };
21111
+
21112
+ const getPhases = () => {
21113
+ if (!sub.schedule) return [];
21114
+ const currentPhaseStartDate = sub.schedule.current_phase.start_date;
21115
+ const currentPhase = sub.schedule.phases.find(phase => {
21116
+ return phase.start_date === currentPhaseStartDate;
21117
+ });
21118
+ const futurePhases = sub.schedule.phases.filter(phase => {
21119
+ return phase.start_date > currentPhaseStartDate;
21120
+ });
21121
+ return [currentPhase, ...futurePhases];
21122
+ };
21123
+
21124
+ const hasPhases = getPhases().length > 0;
21125
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
21126
+ key: sub.id
21127
+ }, /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", {
21128
+ onClick: () => toggleActiveMenu(sub.id),
21129
+ key: sub.id,
21130
+ className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header ${isActive ? "plc-bg-gray-100" : "hover:plc-bg-gray-50"}`
21131
+ }, /*#__PURE__*/React__default.createElement("td", {
21132
+ className: "plc-truncate"
21133
+ }, sub.plan.nickname && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
21134
+ className: "plc-font-semibold plc-text-gray-500"
21135
+ }, sub.plan.nickname), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
21136
+ className: "plc-text-xs plc-text-gray-400"
21137
+ }, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default.createElement("td", {
21138
+ className: "plc-py-2"
21139
+ }, /*#__PURE__*/React__default.createElement("span", {
21140
+ className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getSubscriptionStatus(sub).bgColor} plc-uppercase ${getSubscriptionStatus(sub).textColor} plc-rounded-lg`
21141
+ }, getSubscriptionStatus(sub).icon, getSubscriptionStatus(sub).title), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("div", {
21142
+ className: "plc-text-xs plc-text-gray-500"
21143
+ }, sub.status && /*#__PURE__*/React__default.createElement("span", {
21144
+ className: "plc-inline-block plc-mt-1 plc-underline"
21145
+ }, getSubscriptionStatus(sub).content), /*#__PURE__*/React__default.createElement("br", null), sub.shipments_remaining ? /*#__PURE__*/React__default.createElement("span", {
21146
+ className: "plc-inline-block plc-mt-1"
21147
+ }, sub.shipments_remaining, " ", t("labels.shipments")) : null)), /*#__PURE__*/React__default.createElement("td", null, sub.cancel_at_period_end === 0 && /*#__PURE__*/React__default.createElement(Button, {
21148
+ variant: "ghost",
21149
+ className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
21150
+ icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
21151
+ onClick: onCancelClick,
21152
+ disabled: disableSubmit,
21153
+ "data-key": sub.id
21154
+ }, t("labels.unsubscribe")), sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default.createElement(Button, {
21155
+ variant: "ghost",
21156
+ className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
21157
+ icon: /*#__PURE__*/React__default.createElement(SvgRefresh, null),
21158
+ onClick: onReactivateClick,
21159
+ disabled: disableSubmit,
21160
+ "data-key": sub.id
21161
+ }, t("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default.createElement(Button, {
21162
+ variant: "ghost",
21163
+ className: "plc-text-blue-400 pelcro-dashboard-sub-renew-button",
21164
+ icon: /*#__PURE__*/React__default.createElement(SvgRefresh, null),
21165
+ onClick: onRenewClick,
21166
+ disabled: disableSubmit,
21167
+ "data-key": sub.id
21168
+ }, t("labels.renew"))), /*#__PURE__*/React__default.createElement("td", null, hasPhases && /*#__PURE__*/React__default.createElement("div", {
21169
+ className: `plc-flex plc-items-center plc-justify-center plc-transition-transform plc-ease-out plc-transform plc-rounded-full plc-w-7 plc-h-7 ${isActive ? "plc-flex plc-place-items-center plc-w-7 plc-h-7 plc-p-1 plc-bg-primary-400 plc-rounded-full" : "accordion-chevron"}`
21170
+ }, /*#__PURE__*/React__default.createElement("span", {
21171
+ className: `plc-transition plc-ease-out ${isActive && "plc-text-white plc-transform plc-rotate-90"}`
21172
+ }, /*#__PURE__*/React__default.createElement(SvgChevronRight, null)))))), /*#__PURE__*/React__default.createElement("tbody", null, isActive && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, getPhases().map((phase, i) => {
21173
+ var _phase$plans;
21174
+
21175
+ const plan = (_phase$plans = phase.plans) === null || _phase$plans === void 0 ? void 0 : _phase$plans[0].plan;
21176
+ const isCurrentPhase = i === 0;
21177
+ const startDate = new Date(Number(`${phase.start_date}000`));
21178
+ const endDate = new Date(Number(`${phase.end_date}000`));
21179
+ const formattedStartDate = new Intl.DateTimeFormat("en-CA").format(startDate);
21180
+ const formattedEndDate = new Intl.DateTimeFormat("en-CA").format(endDate);
21181
+ const startDateString = `${t("labels.startsOn")} ${formattedStartDate}`;
21182
+ const endDateString = `${t("labels.expiresOn")} ${formattedEndDate}`;
21183
+ return /*#__PURE__*/React__default.createElement("tr", {
21184
+ key: `${phase.start_date}-${phase.end_date}`,
21185
+ className: "pelcro-sub-phase-row plc-w-full plc-align-middle"
21186
+ }, /*#__PURE__*/React__default.createElement("td", {
21187
+ className: "plc-truncate"
21188
+ }, plan.nickname && /*#__PURE__*/React__default.createElement("span", {
21189
+ className: "plc-font-semibold plc-text-gray-500"
21190
+ }, plan.nickname)), /*#__PURE__*/React__default.createElement("td", {
21191
+ className: "plc-py-2"
21192
+ }, /*#__PURE__*/React__default.createElement("span", {
21193
+ className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold plc-uppercase plc-rounded-lg ${isCurrentPhase ? "plc-text-green-700 plc-bg-green-100" : "plc-text-blue-700 plc-bg-blue-100"}
21194
+ `
21195
+ }, isCurrentPhase ? /*#__PURE__*/React__default.createElement(SvgCheckMark, null) : /*#__PURE__*/React__default.createElement(SvgCalendar, null), isCurrentPhase ? t("labels.status.active") : t("labels.status.scheduled")), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("div", {
21196
+ className: "plc-text-xs plc-text-gray-500"
21197
+ }, /*#__PURE__*/React__default.createElement("span", {
21198
+ className: "plc-inline-block plc-mt-1 plc-underline"
21199
+ }, isCurrentPhase ? endDateString : startDateString))));
21200
+ }), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
21201
+ colSpan: "4"
21202
+ }, /*#__PURE__*/React__default.createElement("hr", {
21203
+ className: "plc-mt-4"
21204
+ }))))));
21205
+ });
21206
+ };
21207
+
21208
+ /**
21209
+ * @typedef {Object} AccordionPropsType
21210
+ * @property {string} initialActiveMenu the initial active menu
20208
21211
  */
20209
21212
 
20210
21213
  /**
@@ -20228,7 +21231,7 @@ const Accordion = ({
20228
21231
  };
20229
21232
 
20230
21233
  return React__default.Children.map(children, (child, i) => {
20231
- if (child.type === Accordion.item || child.type === OrderItems || child.type === SavedItems) {
21234
+ if (child.type === Accordion.item || child.type === OrderItems || child.type === SavedItems || child.type === SubscriptionsItems) {
20232
21235
  return /*#__PURE__*/React__default.cloneElement(child, {
20233
21236
  activeMenu,
20234
21237
  toggleActiveMenu,
@@ -20284,18 +21287,18 @@ Accordion.item = function AccordionItem({
20284
21287
  }, content)) : null;
20285
21288
  };
20286
21289
 
20287
- var _path$a;
21290
+ var _path$8;
20288
21291
 
20289
- function _extends$b() { _extends$b = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
21292
+ function _extends$9() { _extends$9 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
20290
21293
 
20291
21294
  function SvgExit(props) {
20292
- return /*#__PURE__*/React.createElement("svg", _extends$b({
21295
+ return /*#__PURE__*/React.createElement("svg", _extends$9({
20293
21296
  className: "plc-w-6 plc-h-6",
20294
21297
  xmlns: "http://www.w3.org/2000/svg",
20295
21298
  fill: "none",
20296
21299
  viewBox: "0 0 24 24",
20297
21300
  stroke: "currentColor"
20298
- }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
21301
+ }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
20299
21302
  strokeLinecap: "round",
20300
21303
  strokeLinejoin: "round",
20301
21304
  strokeWidth: 2,
@@ -20303,34 +21306,17 @@ function SvgExit(props) {
20303
21306
  })));
20304
21307
  }
20305
21308
 
20306
- var _path$9;
20307
-
20308
- function _extends$a() { _extends$a = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
20309
-
20310
- function SvgCheckMark(props) {
20311
- return /*#__PURE__*/React.createElement("svg", _extends$a({
20312
- className: "plc-w-4 plc-h-4 plc-mr-1",
20313
- xmlns: "http://www.w3.org/2000/svg",
20314
- viewBox: "0 0 20 20",
20315
- fill: "currentColor"
20316
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
20317
- fillRule: "evenodd",
20318
- d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
20319
- clipRule: "evenodd"
20320
- })));
20321
- }
20322
-
20323
- var _path$8;
21309
+ var _path$7;
20324
21310
 
20325
- function _extends$9() { _extends$9 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
21311
+ function _extends$8() { _extends$8 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
20326
21312
 
20327
21313
  function SvgUser(props) {
20328
- return /*#__PURE__*/React.createElement("svg", _extends$9({
21314
+ return /*#__PURE__*/React.createElement("svg", _extends$8({
20329
21315
  xmlns: "http://www.w3.org/2000/svg",
20330
21316
  fill: "none",
20331
21317
  viewBox: "0 0 24 24",
20332
21318
  stroke: "currentColor"
20333
- }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
21319
+ }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
20334
21320
  strokeLinecap: "round",
20335
21321
  strokeLinejoin: "round",
20336
21322
  strokeWidth: 2,
@@ -20338,37 +21324,37 @@ function SvgUser(props) {
20338
21324
  })));
20339
21325
  }
20340
21326
 
20341
- var _path$7;
21327
+ var _path$6;
20342
21328
 
20343
- function _extends$8() { _extends$8 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
21329
+ function _extends$7() { _extends$7 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
20344
21330
 
20345
- function SvgRefresh(props) {
20346
- return /*#__PURE__*/React.createElement("svg", _extends$8({
20347
- className: "plc-w-4 plc-h-4 plc-mr-1",
21331
+ function SvgNewsletter(props) {
21332
+ return /*#__PURE__*/React.createElement("svg", _extends$7({
20348
21333
  xmlns: "http://www.w3.org/2000/svg",
21334
+ className: "plc-h-5 plc-w-5",
20349
21335
  fill: "none",
20350
21336
  viewBox: "0 0 24 24",
20351
21337
  stroke: "currentColor"
20352
- }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
21338
+ }, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
20353
21339
  strokeLinecap: "round",
20354
21340
  strokeLinejoin: "round",
20355
21341
  strokeWidth: 2,
20356
- d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
21342
+ d: "M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z"
20357
21343
  })));
20358
21344
  }
20359
21345
 
20360
- var _path$6;
21346
+ var _path$5;
20361
21347
 
20362
- function _extends$7() { _extends$7 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
21348
+ function _extends$6() { _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
20363
21349
 
20364
21350
  function SvgPaymentCard(props) {
20365
- return /*#__PURE__*/React.createElement("svg", _extends$7({
21351
+ return /*#__PURE__*/React.createElement("svg", _extends$6({
20366
21352
  className: "plc-w-6 plc-h-6 plc-mr-2",
20367
21353
  xmlns: "http://www.w3.org/2000/svg",
20368
21354
  fill: "none",
20369
21355
  viewBox: "0 0 24 24",
20370
21356
  stroke: "currentColor"
20371
- }, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
21357
+ }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
20372
21358
  strokeLinecap: "round",
20373
21359
  strokeLinejoin: "round",
20374
21360
  strokeWidth: 2,
@@ -20376,18 +21362,18 @@ function SvgPaymentCard(props) {
20376
21362
  })));
20377
21363
  }
20378
21364
 
20379
- var _path$5, _path2;
21365
+ var _path$4, _path2;
20380
21366
 
20381
- function _extends$6() { _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
21367
+ function _extends$5() { _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
20382
21368
 
20383
21369
  function SvgLocationPin(props) {
20384
- return /*#__PURE__*/React.createElement("svg", _extends$6({
21370
+ return /*#__PURE__*/React.createElement("svg", _extends$5({
20385
21371
  className: "plc-w-6 plc-h-6 plc-mr-2",
20386
21372
  xmlns: "http://www.w3.org/2000/svg",
20387
21373
  fill: "none",
20388
21374
  viewBox: "0 0 24 24",
20389
21375
  stroke: "currentColor"
20390
- }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
21376
+ }, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
20391
21377
  strokeLinecap: "round",
20392
21378
  strokeLinejoin: "round",
20393
21379
  strokeWidth: 2,
@@ -20402,10 +21388,10 @@ function SvgLocationPin(props) {
20402
21388
 
20403
21389
  var _switch;
20404
21390
 
20405
- function _extends$5() { _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
21391
+ function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
20406
21392
 
20407
21393
  function SvgSubscription(props) {
20408
- return /*#__PURE__*/React.createElement("svg", _extends$5({
21394
+ return /*#__PURE__*/React.createElement("svg", _extends$4({
20409
21395
  xmlns: "http://www.w3.org/2000/svg",
20410
21396
  viewBox: "0 0 100 125",
20411
21397
  fill: "currentColor"
@@ -20420,30 +21406,11 @@ function SvgSubscription(props) {
20420
21406
  }))))));
20421
21407
  }
20422
21408
 
20423
- var _path$4;
20424
-
20425
- function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
20426
-
20427
- function SvgShopping(props) {
20428
- return /*#__PURE__*/React.createElement("svg", _extends$4({
20429
- className: "plc-w-6 plc-h-6 plc-mr-2",
20430
- xmlns: "http://www.w3.org/2000/svg",
20431
- fill: "none",
20432
- viewBox: "0 0 24 24",
20433
- stroke: "currentColor"
20434
- }, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
20435
- strokeLinecap: "round",
20436
- strokeLinejoin: "round",
20437
- strokeWidth: 2,
20438
- d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"
20439
- })));
20440
- }
20441
-
20442
21409
  var _path$3;
20443
21410
 
20444
21411
  function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
20445
21412
 
20446
- function SvgBookmark(props) {
21413
+ function SvgShopping(props) {
20447
21414
  return /*#__PURE__*/React.createElement("svg", _extends$3({
20448
21415
  className: "plc-w-6 plc-h-6 plc-mr-2",
20449
21416
  xmlns: "http://www.w3.org/2000/svg",
@@ -20454,7 +21421,7 @@ function SvgBookmark(props) {
20454
21421
  strokeLinecap: "round",
20455
21422
  strokeLinejoin: "round",
20456
21423
  strokeWidth: 2,
20457
- d: "M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"
21424
+ d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"
20458
21425
  })));
20459
21426
  }
20460
21427
 
@@ -20462,9 +21429,9 @@ var _path$2;
20462
21429
 
20463
21430
  function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
20464
21431
 
20465
- function SvgPlus(props) {
21432
+ function SvgBookmark(props) {
20466
21433
  return /*#__PURE__*/React.createElement("svg", _extends$2({
20467
- className: "plc-w-5 plc-h-5",
21434
+ className: "plc-w-6 plc-h-6 plc-mr-2",
20468
21435
  xmlns: "http://www.w3.org/2000/svg",
20469
21436
  fill: "none",
20470
21437
  viewBox: "0 0 24 24",
@@ -20473,7 +21440,7 @@ function SvgPlus(props) {
20473
21440
  strokeLinecap: "round",
20474
21441
  strokeLinejoin: "round",
20475
21442
  strokeWidth: 2,
20476
- d: "M12 6v6m0 0v6m0-6h6m-6 0H6"
21443
+ d: "M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"
20477
21444
  })));
20478
21445
  }
20479
21446
 
@@ -20573,6 +21540,24 @@ class Dashboard extends Component {
20573
21540
  });
20574
21541
  });
20575
21542
 
21543
+ _defineProperty$3(this, "componentWillUnmount", () => {
21544
+ document.removeEventListener("click", this.hideMenuIfClickedOutside);
21545
+ });
21546
+
21547
+ _defineProperty$3(this, "initializeHideMenuHandler", () => {
21548
+ document.addEventListener("click", this.hideMenuIfClickedOutside);
21549
+ });
21550
+
21551
+ _defineProperty$3(this, "hideMenuIfClickedOutside", event => {
21552
+ const didClickOutsideMenu = this.state.isOpen && this.menuRef.current && !this.menuRef.current.contains(event.target);
21553
+
21554
+ if (didClickOutsideMenu) {
21555
+ this.setState({
21556
+ isOpen: false
21557
+ });
21558
+ }
21559
+ });
21560
+
20576
21561
  _defineProperty$3(this, "cancelSubscription", (subscription_id, onSuccess, onFailure) => {
20577
21562
  // disable the Login button to prevent repeated clicks
20578
21563
  window.Pelcro.subscription.cancel({
@@ -20610,6 +21595,10 @@ class Dashboard extends Component {
20610
21595
  return this.props.setView("password-change");
20611
21596
  });
20612
21597
 
21598
+ _defineProperty$3(this, "displayNewsletterUpdate", () => {
21599
+ return this.props.setView("newsletter-update");
21600
+ });
21601
+
20613
21602
  _defineProperty$3(this, "displayProductSelect", ({
20614
21603
  isGift
20615
21604
  }) => {
@@ -20715,116 +21704,6 @@ class Dashboard extends Component {
20715
21704
  };
20716
21705
  });
20717
21706
 
20718
- _defineProperty$3(this, "renderSubscriptions", () => {
20719
- var _this$state$subscript;
20720
-
20721
- const subscriptions = (_this$state$subscript = this.state.subscriptions) === null || _this$state$subscript === void 0 ? void 0 : _this$state$subscript.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
20722
- // Cancel button click handlers
20723
- const onCancelClick = () => {
20724
- this.props.onClose();
20725
- notify.confirm((onSuccess, onFailure) => {
20726
- this.cancelSubscription(sub.id, onSuccess, onFailure);
20727
- }, {
20728
- confirmMessage: this.locale("messages.subCancellation.isSureToCancel"),
20729
- loadingMessage: this.locale("messages.subCancellation.loading"),
20730
- successMessage: this.locale("messages.subCancellation.success"),
20731
- errorMessage: this.locale("messages.subCancellation.error")
20732
- }, {
20733
- closeButtonLabel: this.locale("labels.subCancellation.goBack")
20734
- });
20735
- }; // Reactivate button click handlers
20736
-
20737
-
20738
- const onReactivateClick = () => {
20739
- this.reactivateSubscription(sub.id);
20740
- }; // Renew click
20741
-
20742
-
20743
- const onRenewClick = () => {
20744
- const product_id = sub.plan.product.id;
20745
- const plan_id = sub.plan.id;
20746
- const product = window.Pelcro.product.getById(product_id);
20747
- const plan = window.Pelcro.plan.getById(plan_id);
20748
- this.props.setProductAndPlan(product, plan);
20749
- this.props.setSubscriptionIdToRenew(sub.id);
20750
- this.props.setView("plan-select");
20751
- };
20752
-
20753
- return /*#__PURE__*/React__default.createElement("tr", {
20754
- key: "dashboard-subscription-" + sub.id,
20755
- className: "plc-w-full plc-align-top"
20756
- }, /*#__PURE__*/React__default.createElement("td", {
20757
- className: "plc-truncate"
20758
- }, sub.plan.nickname && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
20759
- className: "plc-font-semibold plc-text-gray-500"
20760
- }, sub.plan.nickname), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
20761
- className: "plc-text-xs plc-text-gray-400"
20762
- }, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency, this.site.default_locale)))), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("span", {
20763
- className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${this.getSubscriptionStatus(sub).bgColor} plc-uppercase ${this.getSubscriptionStatus(sub).textColor} plc-rounded-lg`
20764
- }, this.getSubscriptionStatus(sub).icon, this.getSubscriptionStatus(sub).title), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("div", {
20765
- className: "plc-mb-4 plc-text-xs plc-text-gray-500"
20766
- }, sub.status && /*#__PURE__*/React__default.createElement("span", {
20767
- className: "plc-inline-block plc-mt-1 plc-underline"
20768
- }, this.getSubscriptionStatus(sub).content), /*#__PURE__*/React__default.createElement("br", null), sub.shipments_remaining ? /*#__PURE__*/React__default.createElement("span", {
20769
- className: "plc-inline-block plc-mt-1"
20770
- }, sub.shipments_remaining, " ", this.locale("labels.shipments")) : null)), /*#__PURE__*/React__default.createElement("td", null, sub.cancel_at_period_end === 0 && /*#__PURE__*/React__default.createElement(Button, {
20771
- variant: "ghost",
20772
- className: "plc-text-red-500 focus:plc-ring-red-500",
20773
- icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
20774
- onClick: onCancelClick,
20775
- disabled: this.state.disableSubmit,
20776
- "data-key": sub.id
20777
- }, this.locale("labels.unsubscribe")), sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default.createElement(Button, {
20778
- variant: "ghost",
20779
- className: "plc-text-green-400 focus:plc-ring-green-300",
20780
- icon: /*#__PURE__*/React__default.createElement(SvgRefresh, null),
20781
- onClick: onReactivateClick,
20782
- disabled: this.state.disableSubmit,
20783
- "data-key": sub.id
20784
- }, this.locale("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default.createElement(Button, {
20785
- variant: "ghost",
20786
- className: "plc-text-blue-400",
20787
- icon: /*#__PURE__*/React__default.createElement(SvgRefresh, null),
20788
- onClick: onRenewClick,
20789
- disabled: this.state.disableSubmit,
20790
- "data-key": sub.id
20791
- }, this.locale("labels.renew"))));
20792
- });
20793
- return /*#__PURE__*/React__default.createElement("table", {
20794
- className: "plc-w-full plc-table-fixed"
20795
- }, /*#__PURE__*/React__default.createElement("thead", {
20796
- className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
20797
- }, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
20798
- className: "plc-w-5/12 "
20799
- }, this.locale("labels.plan")), /*#__PURE__*/React__default.createElement("th", {
20800
- className: "plc-w-4/12 "
20801
- }, this.locale("labels.status.title")), /*#__PURE__*/React__default.createElement("th", {
20802
- className: "plc-w-3/12 "
20803
- }, this.locale("labels.actions")))), /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", {
20804
- className: "plc-h-4"
20805
- }), subscriptions, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
20806
- colSpan: "4",
20807
- className: "plc-p-1"
20808
- }, /*#__PURE__*/React__default.createElement(Button, {
20809
- variant: "ghost",
20810
- icon: /*#__PURE__*/React__default.createElement(SvgPlus, {
20811
- className: "plc-w-4 plc-h-4 plc-mr-1"
20812
- }),
20813
- className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
20814
- onClick: this.displayProductSelect
20815
- }, this.locale("labels.addSubscription")))), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
20816
- colSpan: "4",
20817
- className: "plc-p-1"
20818
- }, /*#__PURE__*/React__default.createElement(Button, {
20819
- variant: "ghost",
20820
- icon: /*#__PURE__*/React__default.createElement(SvgGift, {
20821
- className: "plc-w-4 plc-h-4 plc-mr-1"
20822
- }),
20823
- className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
20824
- onClick: this.displayRedeem
20825
- }, this.locale("labels.redeemGift"))))));
20826
- });
20827
-
20828
21707
  _defineProperty$3(this, "renderGiftRecipients", () => {
20829
21708
  var _giftRecipients$sort, _giftRecipients$sort$;
20830
21709
 
@@ -20862,7 +21741,7 @@ class Dashboard extends Component {
20862
21741
  className: "plc-font-semibold plc-text-gray-500"
20863
21742
  }, recipient.plan.nickname), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
20864
21743
  className: "plc-text-xs plc-text-gray-400"
20865
- }, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency, this.site.default_locale)))), recipient.status && /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("span", {
21744
+ }, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency, getPageOrDefaultLanguage())))), recipient.status && /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("span", {
20866
21745
  className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${this.getSubscriptionStatus(recipient).bgColor} plc-uppercase ${this.getSubscriptionStatus(recipient).textColor} plc-rounded-lg`
20867
21746
  }, this.getSubscriptionStatus(recipient).icon, this.getSubscriptionStatus(recipient).title), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("div", {
20868
21747
  className: "plc-mb-4 plc-text-xs plc-text-gray-500"
@@ -20964,28 +21843,33 @@ class Dashboard extends Component {
20964
21843
  this.site = window.Pelcro.site.read();
20965
21844
  this.locale = this.props.t;
20966
21845
  this.user = window.Pelcro.user.read();
21846
+ this.menuRef = /*#__PURE__*/React__default.createRef();
20967
21847
  }
20968
21848
 
20969
21849
  render() {
20970
- var _window$Pelcro$user$r3, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
21850
+ var _window$Pelcro$user$r3, _window$Pelcro, _window$Pelcro$uiSett, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
20971
21851
 
20972
21852
  const {
20973
21853
  isOpen
20974
21854
  } = this.state;
20975
21855
  const userHasName = this.user.first_name || this.user.last_name;
20976
21856
  const profilePicture = (_window$Pelcro$user$r3 = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : userSolidIcon;
21857
+ const newsletters = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.newsletters;
21858
+ const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
20977
21859
  return /*#__PURE__*/React__default.createElement(Transition, {
20978
21860
  className: "plc-fixed plc-inset-y-0 plc-right-0 plc-h-full plc-max-w-xl plc-overflow-y-auto plc-text-left plc-bg-white plc-shadow-xl plc-z-max",
20979
21861
  show: isOpen,
20980
21862
  enter: "plc-transform plc-transition plc-duration-500",
20981
21863
  enterFrom: "plc-translate-x-full",
20982
21864
  enterTo: "plc-translate-x-0",
21865
+ afterEnter: this.initializeHideMenuHandler,
20983
21866
  leave: "plc-transform plc-transition plc-duration-500",
20984
21867
  leaveFrom: "plc-translate-x-0",
20985
21868
  leaveTo: "plc-translate-x-full",
20986
21869
  afterLeave: this.props.onClose
20987
21870
  }, /*#__PURE__*/React__default.createElement("div", {
20988
- id: "pelcro-view-dashboard"
21871
+ id: "pelcro-view-dashboard",
21872
+ ref: this.menuRef
20989
21873
  }, /*#__PURE__*/React__default.createElement("header", {
20990
21874
  className: "plc-flex plc-flex-col plc-p-4 plc-pl-2 plc-min-h-40 sm:plc-pr-8 plc-bg-primary-500"
20991
21875
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -21048,7 +21932,14 @@ class Dashboard extends Component {
21048
21932
  }),
21049
21933
  className: "plc-text-sm plc-text-gray-500 hover:plc-text-primary-700",
21050
21934
  onClick: this.displayChangePassword
21051
- }, this.locale("labels.changePassword")))
21935
+ }, this.locale("labels.changePassword")), siteHasNewslettersDefined && /*#__PURE__*/React__default.createElement(Button, {
21936
+ variant: "ghost",
21937
+ icon: /*#__PURE__*/React__default.createElement(SvgNewsletter, {
21938
+ className: "plc-w-5 plc-h-5 plc-mr-1"
21939
+ }),
21940
+ className: "plc-text-sm plc-text-gray-500 hover:plc-text-primary-700",
21941
+ onClick: this.displayNewsletterUpdate
21942
+ }, this.locale("labels.editNewsletters")))
21052
21943
  }), /*#__PURE__*/React__default.createElement(Accordion.item, {
21053
21944
  name: SUB_MENUS.PAYMENT_CARDS,
21054
21945
  icon: /*#__PURE__*/React__default.createElement(SvgPaymentCard, null),
@@ -21087,7 +21978,18 @@ class Dashboard extends Component {
21087
21978
  className: "plc-w-10 plc-h-10 plc-pt-2 plc-pr-1 plc--ml-2"
21088
21979
  }),
21089
21980
  title: this.locale("labels.subscriptions"),
21090
- content: this.renderSubscriptions()
21981
+ content: /*#__PURE__*/React__default.createElement(SubscriptionsMenu, {
21982
+ onClose: this.props.onClose,
21983
+ cancelSubscription: this.cancelSubscription,
21984
+ reactivateSubscription: this.reactivateSubscription,
21985
+ setProductAndPlan: this.props.setProductAndPlan,
21986
+ setSubscriptionIdToRenew: this.props.setSubscriptionIdToRenew,
21987
+ setView: this.props.setView,
21988
+ getSubscriptionStatus: this.getSubscriptionStatus,
21989
+ disableSubmit: this.state.disableSubmit,
21990
+ displayProductSelect: this.displayProductSelect,
21991
+ displayRedeem: this.displayRedeem
21992
+ })
21091
21993
  }), /*#__PURE__*/React__default.createElement(Accordion.item, {
21092
21994
  name: SUB_MENUS.GIFTS,
21093
21995
  icon: /*#__PURE__*/React__default.createElement(SvgGift, null),
@@ -21124,7 +22026,7 @@ const DashboardOpenButton = () => {
21124
22026
  return /*#__PURE__*/React__default.createElement("div", {
21125
22027
  className: "plc-fixed plc-right-4 plc-bottom-4 pelcro-open-dashboard-btn"
21126
22028
  }, /*#__PURE__*/React__default.createElement("button", {
21127
- className: "plc-bg-white plc-border-2 plc-rounded-full focus:plc-outline-none plc-border-primary-300",
22029
+ className: "plc-bg-white plc-border-2 plc-rounded-full focus:plc-outline-none plc-border-primary-300 hover:plc-bg-white",
21128
22030
  name: "menu",
21129
22031
  id: "pelcro-view-menu",
21130
22032
  onClick: () => switchView("dashboard")
@@ -22957,4 +23859,4 @@ function ProfilePicChangeModal({
22957
23859
  }
22958
23860
  ProfilePicChangeModal.viewId = "profile-picture";
22959
23861
 
22960
- export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, ApplyCouponButton, Badge, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCreateContainer, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, notify, unauthenticatedButtons, usePelcro };
23862
+ export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Badge, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCreateContainer, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, notify, unauthenticatedButtons, usePelcro };