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

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.cjs.js CHANGED
@@ -3462,6 +3462,7 @@ var paymentMethod_fr = {
3462
3462
  };
3463
3463
 
3464
3464
  var title$d = "Enter your email to subscribe to our newsletter";
3465
+ var updateTitle$1 = "Update newsletter selections";
3465
3466
  var subtitle$7 = "We may use your email for other marketing communication";
3466
3467
  var labels$l = {
3467
3468
  submit: "Submit",
@@ -3473,22 +3474,21 @@ var labels$l = {
3473
3474
  };
3474
3475
  var messages$p = {
3475
3476
  alreadyHaveAccount: "Already have an account?",
3477
+ success: "Newsletters were successfully updated",
3476
3478
  loginHere: "Login here.",
3477
3479
  createAnAccount: " Create an account by clicking ",
3478
3480
  here: "here"
3479
3481
  };
3480
- var errors$b = {
3481
- "": ""
3482
- };
3483
3482
  var newsletter_en = {
3484
3483
  title: title$d,
3484
+ updateTitle: updateTitle$1,
3485
3485
  subtitle: subtitle$7,
3486
3486
  labels: labels$l,
3487
- messages: messages$p,
3488
- errors: errors$b
3487
+ messages: messages$p
3489
3488
  };
3490
3489
 
3491
3490
  var title$c = "Entrez votre adresse courriel pour vous abonner à notre infolettre";
3491
+ var updateTitle = "Mettre à jour son choix d'infolettres";
3492
3492
  var subtitle$6 = "Nous pouvons utiliser votre adresse courriel pour d’autres communications marketing";
3493
3493
  var labels$k = {
3494
3494
  submit: "Lire l’article !",
@@ -3500,19 +3500,17 @@ var labels$k = {
3500
3500
  };
3501
3501
  var messages$o = {
3502
3502
  alreadyHaveAccount: "Vous avez déjà un compte ?",
3503
+ success: "Votre choix d'infolettres à été mis à jour",
3503
3504
  loginHere: "Connectez-vous ici",
3504
3505
  createAnAccount: " Créez un compte en cliquant ",
3505
3506
  here: "ici"
3506
3507
  };
3507
- var errors$a = {
3508
- "": ""
3509
- };
3510
3508
  var newsletter_fr = {
3511
3509
  title: title$c,
3510
+ updateTitle: updateTitle,
3512
3511
  subtitle: subtitle$6,
3513
3512
  labels: labels$k,
3514
- messages: messages$o,
3515
- errors: errors$a
3513
+ messages: messages$o
3516
3514
  };
3517
3515
 
3518
3516
  var labels$j = {
@@ -3621,7 +3619,8 @@ var labels$h = {
3621
3619
  code: "Coupon code",
3622
3620
  "for": "for",
3623
3621
  interval: "{{count}} {{interval}}",
3624
- interval_plural: "{{count}} {{interval}}s"
3622
+ interval_plural: "{{count}} {{interval}}s",
3623
+ tax: "+ Tax"
3625
3624
  };
3626
3625
  var checkoutForm_en = {
3627
3626
  messages: messages$j,
@@ -3646,7 +3645,8 @@ var labels$g = {
3646
3645
  code: "Code promo",
3647
3646
  "for": "pour",
3648
3647
  interval: "{{count}} {{interval}}",
3649
- interval_plural: "{{count}} {{interval}}s"
3648
+ interval_plural: "{{count}} {{interval}}s",
3649
+ tax: "+ Taxe"
3650
3650
  };
3651
3651
  var checkoutForm_fr = {
3652
3652
  messages: messages$i,
@@ -4375,6 +4375,7 @@ var labels$3 = {
4375
4375
  profile: "Profile",
4376
4376
  updateProfile: "Edit profile",
4377
4377
  changePassword: "Change password",
4378
+ editNewsletters: "Edit newsletters",
4378
4379
  edit: "Edit",
4379
4380
  gifts: "Gifts",
4380
4381
  redeemGift: "Redeem gift",
@@ -4451,6 +4452,7 @@ var labels$2 = {
4451
4452
  profile: "Profil",
4452
4453
  updateProfile: "Mettre à jour le profil",
4453
4454
  changePassword: "Changer le mot de passe",
4455
+ editNewsletters: "Modifier les newsletters",
4454
4456
  edit: "Modifier",
4455
4457
  gifts: "Cadeaux",
4456
4458
  redeemGift: "Échanger un cadeau",
@@ -5927,7 +5929,7 @@ class PelcroActions {
5927
5929
  view,
5928
5930
  cartItems,
5929
5931
  ...otherStateFields
5930
- } = initialState$f;
5932
+ } = initialState$g;
5931
5933
  this.set(otherStateFields);
5932
5934
  });
5933
5935
 
@@ -6217,7 +6219,7 @@ class PelcroCallbacks {
6217
6219
 
6218
6220
  }
6219
6221
 
6220
- const initialState$f = {
6222
+ const initialState$g = {
6221
6223
  // View
6222
6224
  view: null,
6223
6225
  // Plans
@@ -6245,7 +6247,7 @@ const createPelcroStore = () => createStore(middleware_3((set, get) => {
6245
6247
  return {
6246
6248
  // Store setter
6247
6249
  set,
6248
- ...initialState$f,
6250
+ ...initialState$g,
6249
6251
  // State actions
6250
6252
  ...actions,
6251
6253
  // Callbacks
@@ -6376,11 +6378,40 @@ const calcAndFormatItemsTotal = (items, currency) => {
6376
6378
  */
6377
6379
 
6378
6380
  const isValidViewFromURL = 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)) {
6381
+ 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()) {
6380
6382
  return true;
6381
6383
  }
6382
6384
 
6383
6385
  return false;
6386
+
6387
+ function hasValidNewsletterUpdateUrl() {
6388
+ var _window$Pelcro, _window$Pelcro$uiSett;
6389
+
6390
+ if (viewID !== "newsletter-update") return false;
6391
+ 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;
6392
+ const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
6393
+
6394
+ if (!siteHasNewslettersDefined) {
6395
+ return false;
6396
+ }
6397
+
6398
+ const queryParamEmail = window.Pelcro.helpers.getURLParameter("email");
6399
+
6400
+ if (queryParamEmail && window.Pelcro.user.isAuthenticated()) {
6401
+ var _window$Pelcro$user$r4;
6402
+
6403
+ if (queryParamEmail !== ((_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.email)) {
6404
+ console.error("email query parameter and user account email are different, url email query parameter must match user email if user is logged in");
6405
+ return false;
6406
+ }
6407
+ }
6408
+
6409
+ if (!queryParamEmail && !window.Pelcro.user.isAuthenticated()) {
6410
+ return false;
6411
+ }
6412
+
6413
+ return true;
6414
+ }
6384
6415
  };
6385
6416
  /**
6386
6417
  * Returns the current stable viewID from all old variations
@@ -6412,7 +6443,7 @@ const disableScroll = () => {
6412
6443
  }
6413
6444
  };
6414
6445
  const trackSubscriptionOnGA = () => {
6415
- 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;
6446
+ 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;
6416
6447
 
6417
6448
  const {
6418
6449
  product,
@@ -6434,7 +6465,7 @@ const trackSubscriptionOnGA = () => {
6434
6465
  }
6435
6466
 
6436
6467
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
6437
- 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
6468
+ 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
6438
6469
  });
6439
6470
  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", {
6440
6471
  id: lastSubscriptionId,
@@ -6462,9 +6493,9 @@ const trackSubscriptionOnGA = () => {
6462
6493
  */
6463
6494
 
6464
6495
  const userHasPaymentMethod = () => {
6465
- var _window$Pelcro$user$r6, _window$Pelcro$user$r7;
6496
+ var _window$Pelcro$user$r7, _window$Pelcro$user$r8;
6466
6497
 
6467
- 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 : [];
6498
+ 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 : [];
6468
6499
  return sources.length > 0;
6469
6500
  };
6470
6501
  /**
@@ -6846,8 +6877,8 @@ const saveToMetadataButton = new SaveToMetadataButtonClass();
6846
6877
 
6847
6878
  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}}
6848
6879
 
6849
- function _extends$t() {
6850
- _extends$t = Object.assign || function (target) {
6880
+ function _extends$u() {
6881
+ _extends$u = Object.assign || function (target) {
6851
6882
  for (var i = 1; i < arguments.length; i++) {
6852
6883
  var source = arguments[i];
6853
6884
 
@@ -6861,7 +6892,7 @@ function _extends$t() {
6861
6892
  return target;
6862
6893
  };
6863
6894
 
6864
- return _extends$t.apply(this, arguments);
6895
+ return _extends$u.apply(this, arguments);
6865
6896
  }
6866
6897
 
6867
6898
  function _taggedTemplateLiteralLoose(strings, raw) {
@@ -6951,7 +6982,7 @@ var clearFromRemoveQueue = function clearFromRemoveQueue(toastId) {
6951
6982
  var reducer = function reducer(state, action) {
6952
6983
  switch (action.type) {
6953
6984
  case ActionType.ADD_TOAST:
6954
- return _extends$t({}, state, {
6985
+ return _extends$u({}, state, {
6955
6986
  toasts: [action.toast].concat(state.toasts).slice(0, TOAST_LIMIT)
6956
6987
  });
6957
6988
 
@@ -6961,9 +6992,9 @@ var reducer = function reducer(state, action) {
6961
6992
  clearFromRemoveQueue(action.toast.id);
6962
6993
  }
6963
6994
 
6964
- return _extends$t({}, state, {
6995
+ return _extends$u({}, state, {
6965
6996
  toasts: state.toasts.map(function (t) {
6966
- return t.id === action.toast.id ? _extends$t({}, t, action.toast) : t;
6997
+ return t.id === action.toast.id ? _extends$u({}, t, action.toast) : t;
6967
6998
  })
6968
6999
  });
6969
7000
 
@@ -6990,9 +7021,9 @@ var reducer = function reducer(state, action) {
6990
7021
  });
6991
7022
  }
6992
7023
 
6993
- return _extends$t({}, state, {
7024
+ return _extends$u({}, state, {
6994
7025
  toasts: state.toasts.map(function (t) {
6995
- return t.id === toastId || toastId === undefined ? _extends$t({}, t, {
7026
+ return t.id === toastId || toastId === undefined ? _extends$u({}, t, {
6996
7027
  visible: false
6997
7028
  }) : t;
6998
7029
  })
@@ -7000,28 +7031,28 @@ var reducer = function reducer(state, action) {
7000
7031
 
7001
7032
  case ActionType.REMOVE_TOAST:
7002
7033
  if (action.toastId === undefined) {
7003
- return _extends$t({}, state, {
7034
+ return _extends$u({}, state, {
7004
7035
  toasts: []
7005
7036
  });
7006
7037
  }
7007
7038
 
7008
- return _extends$t({}, state, {
7039
+ return _extends$u({}, state, {
7009
7040
  toasts: state.toasts.filter(function (t) {
7010
7041
  return t.id !== action.toastId;
7011
7042
  })
7012
7043
  });
7013
7044
 
7014
7045
  case ActionType.START_PAUSE:
7015
- return _extends$t({}, state, {
7046
+ return _extends$u({}, state, {
7016
7047
  pausedAt: action.time
7017
7048
  });
7018
7049
 
7019
7050
  case ActionType.END_PAUSE:
7020
7051
  var diff = action.time - (state.pausedAt || 0);
7021
- return _extends$t({}, state, {
7052
+ return _extends$u({}, state, {
7022
7053
  pausedAt: undefined,
7023
7054
  toasts: state.toasts.map(function (t) {
7024
- return _extends$t({}, t, {
7055
+ return _extends$u({}, t, {
7025
7056
  pauseDuration: t.pauseDuration + diff
7026
7057
  });
7027
7058
  })
@@ -7068,12 +7099,12 @@ var useStore = function useStore(toastOptions) {
7068
7099
  var mergedToasts = state.toasts.map(function (t) {
7069
7100
  var _toastOptions$t$type, _toastOptions, _toastOptions$t$type2;
7070
7101
 
7071
- return _extends$t({}, toastOptions, toastOptions[t.type], t, {
7102
+ return _extends$u({}, toastOptions, toastOptions[t.type], t, {
7072
7103
  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],
7073
- style: _extends$t({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7104
+ style: _extends$u({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7074
7105
  });
7075
7106
  });
7076
- return _extends$t({}, state, {
7107
+ return _extends$u({}, state, {
7077
7108
  toasts: mergedToasts
7078
7109
  });
7079
7110
  };
@@ -7083,7 +7114,7 @@ var createToast = function createToast(message, type, opts) {
7083
7114
  type = 'blank';
7084
7115
  }
7085
7116
 
7086
- return _extends$t({
7117
+ return _extends$u({
7087
7118
  createdAt: Date.now(),
7088
7119
  visible: true,
7089
7120
  type: type,
@@ -7133,14 +7164,14 @@ toast.remove = function (toastId) {
7133
7164
  };
7134
7165
 
7135
7166
  toast.promise = function (promise, msgs, opts) {
7136
- var id = toast.loading(msgs.loading, _extends$t({}, opts, opts == null ? void 0 : opts.loading));
7167
+ var id = toast.loading(msgs.loading, _extends$u({}, opts, opts == null ? void 0 : opts.loading));
7137
7168
  promise.then(function (p) {
7138
- toast.success(resolveValue(msgs.success, p), _extends$t({
7169
+ toast.success(resolveValue(msgs.success, p), _extends$u({
7139
7170
  id: id
7140
7171
  }, opts, opts == null ? void 0 : opts.success));
7141
7172
  return p;
7142
7173
  })["catch"](function (e) {
7143
- toast.error(resolveValue(msgs.error, e), _extends$t({
7174
+ toast.error(resolveValue(msgs.error, e), _extends$u({
7144
7175
  id: id
7145
7176
  }, opts, opts == null ? void 0 : opts.error));
7146
7177
  });
@@ -7479,7 +7510,7 @@ var ToastBar = /*#__PURE__*/React.memo(function (_ref2) {
7479
7510
  var message = React.createElement(Message, Object.assign({}, toast.ariaProps), resolveValue(toast.message, toast));
7480
7511
  return React.createElement(ToastBarBase, {
7481
7512
  className: toast.className,
7482
- style: _extends$t({}, animationStyle, style, toast.style)
7513
+ style: _extends$u({}, animationStyle, style, toast.style)
7483
7514
  }, typeof children === 'function' ? children({
7484
7515
  icon: icon,
7485
7516
  message: message
@@ -7509,7 +7540,7 @@ var getPositionStyle = function getPositionStyle(position, offset) {
7509
7540
  } : position.includes('right') ? {
7510
7541
  justifyContent: 'flex-end'
7511
7542
  } : {};
7512
- return _extends$t({
7543
+ return _extends$u({
7513
7544
  left: 0,
7514
7545
  right: 0,
7515
7546
  display: 'flex',
@@ -7536,7 +7567,7 @@ var Toaster = function Toaster(_ref) {
7536
7567
  handlers = _useToaster.handlers;
7537
7568
 
7538
7569
  return React.createElement("div", {
7539
- style: _extends$t({
7570
+ style: _extends$u({
7540
7571
  position: 'fixed',
7541
7572
  zIndex: 9999,
7542
7573
  top: DEFAULT_OFFSET,
@@ -7571,82 +7602,82 @@ var Toaster = function Toaster(_ref) {
7571
7602
  }));
7572
7603
  };
7573
7604
 
7574
- var _path$q;
7605
+ var _path$r;
7575
7606
 
7576
- 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); }
7607
+ 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); }
7577
7608
 
7578
7609
  function SvgCheckSolid(props) {
7579
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
7610
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
7580
7611
  xmlns: "http://www.w3.org/2000/svg",
7581
7612
  className: "h-5 w-5",
7582
7613
  viewBox: "0 0 20 20",
7583
7614
  fill: "currentColor"
7584
- }, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
7615
+ }, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
7585
7616
  fillRule: "evenodd",
7586
7617
  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",
7587
7618
  clipRule: "evenodd"
7588
7619
  })));
7589
7620
  }
7590
7621
 
7591
- var _path$p;
7622
+ var _path$q;
7592
7623
 
7593
- 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); }
7624
+ 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); }
7594
7625
 
7595
7626
  function SvgXIcon(props) {
7596
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
7627
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
7597
7628
  xmlns: "http://www.w3.org/2000/svg",
7598
7629
  viewBox: "0 0 20 20",
7599
7630
  fill: "currentColor"
7600
- }, props), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
7631
+ }, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
7601
7632
  fill: "evenodd",
7602
7633
  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",
7603
7634
  clipRule: "evenodd"
7604
7635
  })));
7605
7636
  }
7606
7637
 
7607
- var _path$o;
7638
+ var _path$p;
7608
7639
 
7609
- 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); }
7640
+ 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); }
7610
7641
 
7611
7642
  function SvgXIconSolid(props) {
7612
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
7643
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
7613
7644
  className: "plc-w-4 plc-h-4",
7614
7645
  fill: "currentColor",
7615
7646
  xmlns: "http://www.w3.org/2000/svg",
7616
7647
  viewBox: "0 0 100 100"
7617
- }, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
7648
+ }, props), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
7618
7649
  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"
7619
7650
  })));
7620
7651
  }
7621
7652
 
7622
- var _path$n;
7653
+ var _path$o;
7623
7654
 
7624
- 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); }
7655
+ 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); }
7625
7656
 
7626
7657
  function SvgExclamation(props) {
7627
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
7658
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
7628
7659
  className: "plc-w-4 plc-h-4 plc-mr-1",
7629
7660
  xmlns: "http://www.w3.org/2000/svg",
7630
7661
  viewBox: "0 0 20 20",
7631
7662
  fill: "currentColor"
7632
- }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
7663
+ }, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
7633
7664
  fillRule: "evenodd",
7634
7665
  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",
7635
7666
  clipRule: "evenodd"
7636
7667
  })));
7637
7668
  }
7638
7669
 
7639
- var _path$m, _path2$3;
7670
+ var _path$n, _path2$3;
7640
7671
 
7641
- 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); }
7672
+ 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); }
7642
7673
 
7643
7674
  function SvgSpinner(props) {
7644
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
7675
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
7645
7676
  className: "plc-animate-spin",
7646
7677
  viewBox: "0 0 24 24",
7647
7678
  fill: "currentColor",
7648
7679
  xmlns: "http://www.w3.org/2000/svg"
7649
- }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
7680
+ }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
7650
7681
  opacity: 0.2,
7651
7682
  fill: "evenodd",
7652
7683
  clipRule: "evenodd",
@@ -7872,6 +7903,16 @@ const init$1 = () => {
7872
7903
  }
7873
7904
  }
7874
7905
 
7906
+ const pelcroUpdateNewslettersButtons = document.getElementsByClassName("pelcro-update-newsletters-button");
7907
+
7908
+ if (pelcroUpdateNewslettersButtons.length !== 0) {
7909
+ for (let i = 0; i < pelcroUpdateNewslettersButtons.length; i++) {
7910
+ pelcroUpdateNewslettersButtons[i].addEventListener("click", () => {
7911
+ switchView("newsletter-update");
7912
+ });
7913
+ }
7914
+ }
7915
+
7875
7916
  const pelcroCartButtonsByClass = document.getElementsByClassName("pelcro-cart-button");
7876
7917
 
7877
7918
  if (pelcroCartButtonsByClass.length !== 0) {
@@ -8197,6 +8238,175 @@ function shouldBlurContent(entitlements) {
8197
8238
  return entitlements.every(entitlement => !window.Pelcro.user.isEntitledTo(entitlement));
8198
8239
  }
8199
8240
 
8241
+ var pure$1 = createCommonjsModule(function (module, exports) {
8242
+
8243
+ Object.defineProperty(exports, '__esModule', { value: true });
8244
+
8245
+ function _typeof(obj) {
8246
+ "@babel/helpers - typeof";
8247
+
8248
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
8249
+ _typeof = function (obj) {
8250
+ return typeof obj;
8251
+ };
8252
+ } else {
8253
+ _typeof = function (obj) {
8254
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
8255
+ };
8256
+ }
8257
+
8258
+ return _typeof(obj);
8259
+ }
8260
+
8261
+ var V3_URL = 'https://js.stripe.com/v3';
8262
+ var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
8263
+ 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';
8264
+ var findScript = function findScript() {
8265
+ var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
8266
+
8267
+ for (var i = 0; i < scripts.length; i++) {
8268
+ var script = scripts[i];
8269
+
8270
+ if (!V3_URL_REGEX.test(script.src)) {
8271
+ continue;
8272
+ }
8273
+
8274
+ return script;
8275
+ }
8276
+
8277
+ return null;
8278
+ };
8279
+
8280
+ var injectScript = function injectScript(params) {
8281
+ var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
8282
+ var script = document.createElement('script');
8283
+ script.src = "".concat(V3_URL).concat(queryString);
8284
+ var headOrBody = document.head || document.body;
8285
+
8286
+ if (!headOrBody) {
8287
+ throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
8288
+ }
8289
+
8290
+ headOrBody.appendChild(script);
8291
+ return script;
8292
+ };
8293
+
8294
+ var registerWrapper = function registerWrapper(stripe, startTime) {
8295
+ if (!stripe || !stripe._registerWrapper) {
8296
+ return;
8297
+ }
8298
+
8299
+ stripe._registerWrapper({
8300
+ name: 'stripe-js',
8301
+ version: "1.21.1",
8302
+ startTime: startTime
8303
+ });
8304
+ };
8305
+
8306
+ var stripePromise = null;
8307
+ var loadScript = function loadScript(params) {
8308
+ // Ensure that we only attempt to load Stripe.js at most once
8309
+ if (stripePromise !== null) {
8310
+ return stripePromise;
8311
+ }
8312
+
8313
+ stripePromise = new Promise(function (resolve, reject) {
8314
+ if (typeof window === 'undefined') {
8315
+ // Resolve to null when imported server side. This makes the module
8316
+ // safe to import in an isomorphic code base.
8317
+ resolve(null);
8318
+ return;
8319
+ }
8320
+
8321
+ if (window.Stripe && params) {
8322
+ console.warn(EXISTING_SCRIPT_MESSAGE);
8323
+ }
8324
+
8325
+ if (window.Stripe) {
8326
+ resolve(window.Stripe);
8327
+ return;
8328
+ }
8329
+
8330
+ try {
8331
+ var script = findScript();
8332
+
8333
+ if (script && params) {
8334
+ console.warn(EXISTING_SCRIPT_MESSAGE);
8335
+ } else if (!script) {
8336
+ script = injectScript(params);
8337
+ }
8338
+
8339
+ script.addEventListener('load', function () {
8340
+ if (window.Stripe) {
8341
+ resolve(window.Stripe);
8342
+ } else {
8343
+ reject(new Error('Stripe.js not available'));
8344
+ }
8345
+ });
8346
+ script.addEventListener('error', function () {
8347
+ reject(new Error('Failed to load Stripe.js'));
8348
+ });
8349
+ } catch (error) {
8350
+ reject(error);
8351
+ return;
8352
+ }
8353
+ });
8354
+ return stripePromise;
8355
+ };
8356
+ var initStripe = function initStripe(maybeStripe, args, startTime) {
8357
+ if (maybeStripe === null) {
8358
+ return null;
8359
+ }
8360
+
8361
+ var stripe = maybeStripe.apply(undefined, args);
8362
+ registerWrapper(stripe, startTime);
8363
+ return stripe;
8364
+ };
8365
+ var validateLoadParams = function validateLoadParams(params) {
8366
+ var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
8367
+
8368
+ if (params === null || _typeof(params) !== 'object') {
8369
+ throw new Error(errorMessage);
8370
+ }
8371
+
8372
+ if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === 'boolean') {
8373
+ return params;
8374
+ }
8375
+
8376
+ throw new Error(errorMessage);
8377
+ };
8378
+
8379
+ var loadParams;
8380
+ var loadStripeCalled = false;
8381
+ var loadStripe = function loadStripe() {
8382
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8383
+ args[_key] = arguments[_key];
8384
+ }
8385
+
8386
+ loadStripeCalled = true;
8387
+ var startTime = Date.now();
8388
+ return loadScript(loadParams).then(function (maybeStripe) {
8389
+ return initStripe(maybeStripe, args, startTime);
8390
+ });
8391
+ };
8392
+
8393
+ loadStripe.setLoadParameters = function (params) {
8394
+ if (loadStripeCalled) {
8395
+ throw new Error('You cannot change load parameters after calling loadStripe');
8396
+ }
8397
+
8398
+ loadParams = validateLoadParams(params);
8399
+ };
8400
+
8401
+ exports.loadStripe = loadStripe;
8402
+ });
8403
+
8404
+ unwrapExports(pure$1);
8405
+ pure$1.loadStripe;
8406
+
8407
+ var pure = pure$1;
8408
+ var pure_1 = pure.loadStripe;
8409
+
8200
8410
  /**
8201
8411
  * @typedef {Object} OptionsType
8202
8412
  * @property {boolean} loadPaymentSDKs
@@ -8266,8 +8476,15 @@ const initPaywalls = () => {
8266
8476
  }
8267
8477
  };
8268
8478
  const loadPaymentSDKs = () => {
8269
- // Load stripe's SDK
8270
- window.Pelcro.helpers.loadSDK("https://js.stripe.com/v3/", "pelcro-sdk-stripe-id"); // Load PayPal SDK's
8479
+ // Lazy load stripe's SDK
8480
+ const {
8481
+ whenUserReady
8482
+ } = usePelcro.getStore();
8483
+ whenUserReady(() => {
8484
+ if (!window.Stripe) {
8485
+ pure_1(window.Pelcro.environment.stripe);
8486
+ }
8487
+ }); // Load PayPal SDK's
8271
8488
 
8272
8489
  const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
8273
8490
 
@@ -8861,6 +9078,7 @@ const GET_STATES_SUCCESS = "GET_STATES_SUCCESS";
8861
9078
  const GET_STATES_FETCH = "GET_STATES_FETCH";
8862
9079
  const HANDLE_SUBMIT = "HANDLE_SUBMIT";
8863
9080
  const SET_UPDATED_PRICE = "SET_UPDATED_PRICE";
9081
+ const SET_TAX_AMOUNT = "SET_TAX_AMOUNT";
8864
9082
  const SET_CAN_MAKE_PAYMENT = "SET_CAN_MAKE_PAYMENT";
8865
9083
  const SET_PAYMENT_REQUEST = "SET_PAYMENT_REQUEST";
8866
9084
  const INIT_CONTAINER = "INIT_CONTAINER";
@@ -8889,6 +9107,9 @@ const SET_IMAGE_SRC = "SET_IMAGE_SRC";
8889
9107
  const PASSWORD_CHANGE_SUCCESS = "PASSWORD_CHANGE_SUCCESS";
8890
9108
  const SELECT_PAYMENT_METHOD = "SELECT_PAYMENT_METHOD";
8891
9109
  const LOAD_PAYMENT_METHODS = "LOAD_PAYMENT_METHODS";
9110
+ const GET_NEWSLETTERS_FETCH = "GET_NEWSLETTERS_FETCH";
9111
+ const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
9112
+ const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
8892
9113
 
8893
9114
  /**
8894
9115
  * Extracts error message from the response error object
@@ -8950,7 +9171,7 @@ const debounce = (func, waitTime) => {
8950
9171
  };
8951
9172
  };
8952
9173
 
8953
- const initialState$e = {
9174
+ const initialState$f = {
8954
9175
  email: "",
8955
9176
  password: "",
8956
9177
  emailError: null,
@@ -8961,10 +9182,10 @@ const initialState$e = {
8961
9182
  content: ""
8962
9183
  }
8963
9184
  };
8964
- const store$e = /*#__PURE__*/React.createContext(initialState$e);
9185
+ const store$f = /*#__PURE__*/React.createContext(initialState$f);
8965
9186
  const {
8966
- Provider: Provider$e
8967
- } = store$e;
9187
+ Provider: Provider$f
9188
+ } = store$f;
8968
9189
 
8969
9190
  const LoginContainer = ({
8970
9191
  style,
@@ -9071,7 +9292,7 @@ const LoginContainer = ({
9071
9292
  });
9072
9293
 
9073
9294
  case RESET_LOGIN_FORM:
9074
- return initialState$e;
9295
+ return initialState$f;
9075
9296
 
9076
9297
  case DISABLE_LOGIN_BUTTON:
9077
9298
  return lib_7({ ...state,
@@ -9089,12 +9310,12 @@ const LoginContainer = ({
9089
9310
  default:
9090
9311
  return state;
9091
9312
  }
9092
- }, initialState$e);
9313
+ }, initialState$f);
9093
9314
  return /*#__PURE__*/React__default['default'].createElement("div", {
9094
9315
  style: { ...style
9095
9316
  },
9096
9317
  className: `pelcro-container pelcro-login-container ${className}`
9097
- }, /*#__PURE__*/React__default['default'].createElement(Provider$e, {
9318
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$f, {
9098
9319
  value: {
9099
9320
  state,
9100
9321
  dispatch
@@ -9102,12 +9323,12 @@ const LoginContainer = ({
9102
9323
  }, children.length ? children.map((child, i) => {
9103
9324
  if (child) {
9104
9325
  return /*#__PURE__*/React__default['default'].cloneElement(child, {
9105
- store: store$e,
9326
+ store: store$f,
9106
9327
  key: i
9107
9328
  });
9108
9329
  }
9109
9330
  }) : /*#__PURE__*/React__default['default'].cloneElement(children, {
9110
- store: store$e
9331
+ store: store$f
9111
9332
  })));
9112
9333
  };
9113
9334
 
@@ -9352,7 +9573,7 @@ const LoginButton = ({
9352
9573
  buttonDisabled
9353
9574
  },
9354
9575
  dispatch
9355
- } = React.useContext(store$e);
9576
+ } = React.useContext(store$f);
9356
9577
  const {
9357
9578
  t
9358
9579
  } = useTranslation("login");
@@ -9373,23 +9594,23 @@ const LoginButton = ({
9373
9594
  };
9374
9595
 
9375
9596
  const LoginEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
9376
- store: store$e
9597
+ store: store$f
9377
9598
  }, props));
9378
9599
 
9379
9600
  const LoginPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
9380
- store: store$e
9601
+ store: store$f
9381
9602
  }, props));
9382
9603
 
9383
- var _path$l;
9604
+ var _path$m;
9384
9605
 
9385
- 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); }
9606
+ 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); }
9386
9607
 
9387
9608
  function SvgCheck(props) {
9388
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
9609
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
9389
9610
  xmlns: "http://www.w3.org/2000/svg",
9390
9611
  fill: "currentColor",
9391
9612
  viewBox: "0 0 20 20"
9392
- }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
9613
+ }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
9393
9614
  fillRule: "evenodd",
9394
9615
  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",
9395
9616
  clipRule: "evenodd"
@@ -9454,7 +9675,7 @@ var facebookLoginRenderProps = createCommonjsModule(function (module, exports) {
9454
9675
  var FacebookLogin = unwrapExports(facebookLoginRenderProps);
9455
9676
  facebookLoginRenderProps.FacebookLogin;
9456
9677
 
9457
- const initialState$d = {
9678
+ const initialState$e = {
9458
9679
  email: "",
9459
9680
  password: "",
9460
9681
  emailError: null,
@@ -9471,10 +9692,10 @@ const initialState$d = {
9471
9692
  content: ""
9472
9693
  }
9473
9694
  };
9474
- const store$d = /*#__PURE__*/React.createContext(initialState$d);
9695
+ const store$e = /*#__PURE__*/React.createContext(initialState$e);
9475
9696
  const {
9476
- Provider: Provider$d
9477
- } = store$d;
9697
+ Provider: Provider$e
9698
+ } = store$e;
9478
9699
 
9479
9700
  const RegisterContainer = ({
9480
9701
  style,
@@ -9639,7 +9860,7 @@ const RegisterContainer = ({
9639
9860
  });
9640
9861
 
9641
9862
  case RESET_LOGIN_FORM:
9642
- return initialState$d;
9863
+ return initialState$e;
9643
9864
 
9644
9865
  case DISABLE_REGISTRATION_BUTTON:
9645
9866
  return lib_7({ ...state,
@@ -9657,12 +9878,12 @@ const RegisterContainer = ({
9657
9878
  default:
9658
9879
  return state;
9659
9880
  }
9660
- }, initialState$d);
9881
+ }, initialState$e);
9661
9882
  return /*#__PURE__*/React__default['default'].createElement("div", {
9662
9883
  style: { ...style
9663
9884
  },
9664
9885
  className: `pelcro-container pelcro-register-container ${className}`
9665
- }, /*#__PURE__*/React__default['default'].createElement(Provider$d, {
9886
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$e, {
9666
9887
  value: {
9667
9888
  state,
9668
9889
  dispatch
@@ -9670,24 +9891,24 @@ const RegisterContainer = ({
9670
9891
  }, children.length ? children.map((child, i) => {
9671
9892
  if (child) {
9672
9893
  return /*#__PURE__*/React__default['default'].cloneElement(child, {
9673
- store: store$d,
9894
+ store: store$e,
9674
9895
  key: i
9675
9896
  });
9676
9897
  }
9677
9898
  }) : /*#__PURE__*/React__default['default'].cloneElement(children, {
9678
- store: store$d
9899
+ store: store$e
9679
9900
  })));
9680
9901
  };
9681
9902
 
9682
- var _path$k;
9903
+ var _path$l;
9683
9904
 
9684
- 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); }
9905
+ 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); }
9685
9906
 
9686
9907
  function SvgFacebookLogo(props) {
9687
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
9908
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
9688
9909
  xmlns: "http://www.w3.org/2000/svg",
9689
9910
  viewBox: "88.428 12.828 107.543 207.085"
9690
- }, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
9911
+ }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
9691
9912
  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",
9692
9913
  fill: "#3c5a9a"
9693
9914
  })));
@@ -9704,10 +9925,10 @@ const FacebookLoginButton = ({
9704
9925
  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;
9705
9926
  const {
9706
9927
  dispatch: loginDispatch
9707
- } = React.useContext(store$e);
9928
+ } = React.useContext(store$f);
9708
9929
  const {
9709
9930
  dispatch: registerDispatch
9710
- } = React.useContext(store$d);
9931
+ } = React.useContext(store$e);
9711
9932
 
9712
9933
  const onSuccess = facebookUser => {
9713
9934
  loginDispatch === null || loginDispatch === void 0 ? void 0 : loginDispatch({
@@ -9760,15 +9981,15 @@ var googleLogin = createCommonjsModule(function (module, exports) {
9760
9981
  unwrapExports(googleLogin);
9761
9982
  var googleLogin_1 = googleLogin.GoogleLogin;
9762
9983
 
9763
- var _path$j, _path2$2, _path3$1, _path4;
9984
+ var _path$k, _path2$2, _path3$1, _path4;
9764
9985
 
9765
- 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); }
9986
+ 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); }
9766
9987
 
9767
9988
  function SvgGoogleLogo(props) {
9768
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
9989
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
9769
9990
  viewBox: "0 0 24 24",
9770
9991
  xmlns: "http://www.w3.org/2000/svg"
9771
- }, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
9992
+ }, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
9772
9993
  fill: "#4285F4",
9773
9994
  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"
9774
9995
  })), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -9794,10 +10015,10 @@ const GoogleLoginButton = ({
9794
10015
  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;
9795
10016
  const {
9796
10017
  dispatch: loginDispatch
9797
- } = React.useContext(store$e);
10018
+ } = React.useContext(store$f);
9798
10019
  const {
9799
10020
  dispatch: registerDispatch
9800
- } = React.useContext(store$d);
10021
+ } = React.useContext(store$e);
9801
10022
 
9802
10023
  const onSuccess = response => {
9803
10024
  var _response$getAuthResp, _profile$getEmail, _profile$getGivenName, _profile$getFamilyNam, _profile$getEmail2, _profile$getGivenName2, _profile$getFamilyNam2;
@@ -9902,15 +10123,15 @@ function LoginView(props) {
9902
10123
  }, /*#__PURE__*/React__default['default'].createElement(GoogleLoginButton, null), /*#__PURE__*/React__default['default'].createElement(FacebookLoginButton, null))))));
9903
10124
  }
9904
10125
 
9905
- var _path$i, _path2$1, _path3;
10126
+ var _path$j, _path2$1, _path3;
9906
10127
 
9907
- 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); }
10128
+ 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); }
9908
10129
 
9909
10130
  function SvgPelcroAuthorship(props) {
9910
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
10131
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
9911
10132
  xmlns: "http://www.w3.org/2000/svg",
9912
10133
  viewBox: "0 -80.652 497.072 179.991"
9913
- }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
10134
+ }, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
9914
10135
  fill: "none",
9915
10136
  stroke: "#4a4a4a",
9916
10137
  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"
@@ -10057,11 +10278,11 @@ function LoginModal({
10057
10278
  LoginModal.viewId = "login";
10058
10279
 
10059
10280
  const RegisterEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
10060
- store: store$d
10281
+ store: store$e
10061
10282
  }, props));
10062
10283
 
10063
10284
  const RegisterPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
10064
- store: store$d
10285
+ store: store$e
10065
10286
  }, props));
10066
10287
 
10067
10288
  const RegisterButton = ({
@@ -10078,7 +10299,7 @@ const RegisterButton = ({
10078
10299
  buttonDisabled
10079
10300
  },
10080
10301
  dispatch
10081
- } = React.useContext(store$d);
10302
+ } = React.useContext(store$e);
10082
10303
  const {
10083
10304
  t
10084
10305
  } = useTranslation("register");
@@ -10213,7 +10434,7 @@ function FirstName({
10213
10434
  }
10214
10435
 
10215
10436
  const RegisterFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
10216
- store: store$d
10437
+ store: store$e
10217
10438
  }, props));
10218
10439
 
10219
10440
  function LastName({
@@ -10244,7 +10465,7 @@ function LastName({
10244
10465
  }
10245
10466
 
10246
10467
  const RegisterLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
10247
- store: store$d
10468
+ store: store$e
10248
10469
  }, props));
10249
10470
 
10250
10471
  /**
@@ -10348,7 +10569,7 @@ function TextInput({
10348
10569
 
10349
10570
  const RegisterTextInput = props => {
10350
10571
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
10351
- store: store$d
10572
+ store: store$e
10352
10573
  }));
10353
10574
  };
10354
10575
 
@@ -12313,13 +12534,14 @@ class PaypalGateWay {
12313
12534
  * @property {unknown} canMakePayment
12314
12535
  * @property {unknown} paymentRequest
12315
12536
  * @property {number} updatedPrice
12537
+ * @property {number} taxAmount
12316
12538
  * @property {object} currentPlan
12317
12539
  * @property {object} alert
12318
12540
  */
12319
12541
 
12320
12542
  /** @type {PaymentStateType} */
12321
12543
 
12322
- const initialState$c = {
12544
+ const initialState$d = {
12323
12545
  disableSubmit: false,
12324
12546
  isLoading: false,
12325
12547
  disableCouponButton: false,
@@ -12331,16 +12553,17 @@ const initialState$c = {
12331
12553
  canMakePayment: false,
12332
12554
  paymentRequest: null,
12333
12555
  updatedPrice: null,
12556
+ taxAmount: null,
12334
12557
  currentPlan: null,
12335
12558
  alert: {
12336
12559
  type: "error",
12337
12560
  content: ""
12338
12561
  }
12339
12562
  };
12340
- const store$c = /*#__PURE__*/React.createContext(initialState$c);
12563
+ const store$d = /*#__PURE__*/React.createContext(initialState$d);
12341
12564
  const {
12342
- Provider: Provider$c
12343
- } = store$c;
12565
+ Provider: Provider$d
12566
+ } = store$d;
12344
12567
 
12345
12568
  const PaymentMethodContainerWithoutStripe = ({
12346
12569
  style,
@@ -12381,6 +12604,7 @@ const PaymentMethodContainerWithoutStripe = ({
12381
12604
  dispatch({
12382
12605
  type: INIT_CONTAINER
12383
12606
  });
12607
+ updateTotalAmountWithTax();
12384
12608
  }, []);
12385
12609
 
12386
12610
  const initPaymentRequest = (state, dispatch) => {
@@ -12447,6 +12671,45 @@ const PaymentMethodContainerWithoutStripe = ({
12447
12671
  console.log("Google Pay/Apple pay isn't available in this country");
12448
12672
  }
12449
12673
  };
12674
+ /**
12675
+ * Updates the total amount after adding taxes only if site taxes are enabled
12676
+ */
12677
+
12678
+
12679
+ const updateTotalAmountWithTax = () => {
12680
+ var _window$Pelcro$site$r;
12681
+
12682
+ 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;
12683
+
12684
+ if (taxesEnabled && type === "createPayment") {
12685
+ dispatch({
12686
+ type: DISABLE_SUBMIT,
12687
+ payload: true
12688
+ });
12689
+ resolveTaxCalculation().then(res => {
12690
+ if (res) {
12691
+ dispatch({
12692
+ type: SET_TAX_AMOUNT,
12693
+ payload: res.taxAmount
12694
+ });
12695
+ dispatch({
12696
+ type: SET_UPDATED_PRICE,
12697
+ payload: res.totalAmountWithTax
12698
+ });
12699
+ dispatch({
12700
+ type: UPDATE_PAYMENT_REQUEST
12701
+ });
12702
+ }
12703
+ }).catch(error => {
12704
+ handlePaymentError(error);
12705
+ }).finally(() => {
12706
+ dispatch({
12707
+ type: DISABLE_SUBMIT,
12708
+ payload: false
12709
+ });
12710
+ });
12711
+ }
12712
+ };
12450
12713
 
12451
12714
  const onApplyCouponCode = (state, dispatch) => {
12452
12715
  const {
@@ -12473,6 +12736,10 @@ const PaymentMethodContainerWithoutStripe = ({
12473
12736
  });
12474
12737
  }
12475
12738
 
12739
+ dispatch({
12740
+ type: SET_COUPON_ERROR,
12741
+ payload: ""
12742
+ });
12476
12743
  dispatch({
12477
12744
  type: SHOW_ALERT,
12478
12745
  payload: {
@@ -12489,7 +12756,11 @@ const PaymentMethodContainerWithoutStripe = ({
12489
12756
  payload: `${(_res$data$coupon = res.data.coupon) === null || _res$data$coupon === void 0 ? void 0 : _res$data$coupon.percent_off}%`
12490
12757
  });
12491
12758
  dispatch({
12492
- type: SET_UPDATED_PRICE,
12759
+ type: SET_TAX_AMOUNT,
12760
+ payload: res.data.taxes
12761
+ });
12762
+ dispatch({
12763
+ type: SET_UPDATED_PRICE,
12493
12764
  payload: res.data.total
12494
12765
  });
12495
12766
  dispatch({
@@ -12497,6 +12768,29 @@ const PaymentMethodContainerWithoutStripe = ({
12497
12768
  });
12498
12769
  };
12499
12770
 
12771
+ if ((couponCode === null || couponCode === void 0 ? void 0 : couponCode.trim()) === "") {
12772
+ dispatch({
12773
+ type: SET_COUPON,
12774
+ payload: null
12775
+ });
12776
+ dispatch({
12777
+ type: SET_PERCENT_OFF,
12778
+ payload: ""
12779
+ });
12780
+ dispatch({
12781
+ type: SET_UPDATED_PRICE,
12782
+ payload: null
12783
+ });
12784
+ dispatch({
12785
+ type: SET_TAX_AMOUNT,
12786
+ payload: null
12787
+ });
12788
+ dispatch({
12789
+ type: UPDATE_PAYMENT_REQUEST
12790
+ });
12791
+ updateTotalAmountWithTax();
12792
+ }
12793
+
12500
12794
  if (couponCode !== null && couponCode !== void 0 && couponCode.trim()) {
12501
12795
  dispatch({
12502
12796
  type: DISABLE_COUPON_BUTTON,
@@ -12883,16 +13177,20 @@ const PaymentMethodContainerWithoutStripe = ({
12883
13177
  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();
12884
13178
 
12885
13179
  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) {
12886
- return resolveTaxCalculation().then(totalAmountWithTax => generate3DSecureSource(source, totalAmountWithTax !== null && totalAmountWithTax !== void 0 ? totalAmountWithTax : totalAmount).then(({
12887
- source,
12888
- error
12889
- }) => {
12890
- if (error) {
12891
- return handlePaymentError(error);
12892
- }
13180
+ return resolveTaxCalculation().then(res => {
13181
+ var _res$totalAmountWithT;
12893
13182
 
12894
- toggleAuthenticationPendingView(true, source);
12895
- }));
13183
+ return generate3DSecureSource(source, (_res$totalAmountWithT = res === null || res === void 0 ? void 0 : res.totalAmountWithTax) !== null && _res$totalAmountWithT !== void 0 ? _res$totalAmountWithT : totalAmount).then(({
13184
+ source,
13185
+ error
13186
+ }) => {
13187
+ if (error) {
13188
+ return handlePaymentError(error);
13189
+ }
13190
+
13191
+ toggleAuthenticationPendingView(true, source);
13192
+ });
13193
+ });
12896
13194
  }
12897
13195
 
12898
13196
  return handlePayment(source);
@@ -12901,15 +13199,15 @@ const PaymentMethodContainerWithoutStripe = ({
12901
13199
  });
12902
13200
  };
12903
13201
  /**
12904
- * Resolves with the total including taxes incase taxes enabled by site
13202
+ * Resolves with the total & tax amount incase taxes enabled by site
12905
13203
  * @return {Promise}
12906
13204
  */
12907
13205
 
12908
13206
 
12909
13207
  const resolveTaxCalculation = () => {
12910
- var _window$Pelcro$site$r;
13208
+ var _window$Pelcro$site$r2;
12911
13209
 
12912
- 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;
13210
+ 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;
12913
13211
  return new Promise((resolve, reject) => {
12914
13212
  // resolve early if taxes isn't enabled
12915
13213
  if (!taxesEnabled) {
@@ -12922,14 +13220,18 @@ const PaymentMethodContainerWithoutStripe = ({
12922
13220
  coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
12923
13221
  address_id: selectedAddressId
12924
13222
  }, (error, res) => {
12925
- var _res$data;
13223
+ var _res$data, _res$data2;
12926
13224
 
12927
13225
  if (error) {
12928
13226
  return reject(error);
12929
13227
  }
12930
13228
 
12931
- const totalAmountWithTax = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.total;
12932
- resolve(totalAmountWithTax);
13229
+ const taxAmount = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.taxes;
13230
+ const totalAmountWithTax = (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.total;
13231
+ resolve({
13232
+ totalAmountWithTax,
13233
+ taxAmount
13234
+ });
12933
13235
  });
12934
13236
  });
12935
13237
  };
@@ -12984,13 +13286,13 @@ const PaymentMethodContainerWithoutStripe = ({
12984
13286
  const handlePaymentError = error => {
12985
13287
  if (error.type === "validation_error" && // Subscription creation & renewal
12986
13288
  type === "createPayment") {
12987
- var _state$coupon;
13289
+ var _state$couponObject;
12988
13290
 
12989
13291
  const {
12990
13292
  updatedPrice
12991
13293
  } = state; // When price is 0, we allow submitting without card info
12992
13294
 
12993
- if (updatedPrice === 0 && ((_state$coupon = state.coupon) === null || _state$coupon === void 0 ? void 0 : _state$coupon.duration) === "forever") {
13295
+ if (updatedPrice === 0 && ((_state$couponObject = state.couponObject) === null || _state$couponObject === void 0 ? void 0 : _state$couponObject.duration) === "forever") {
12994
13296
  return subscribe({}, state, dispatch);
12995
13297
  }
12996
13298
  }
@@ -13118,6 +13420,11 @@ const PaymentMethodContainerWithoutStripe = ({
13118
13420
  updatedPrice: action.payload
13119
13421
  });
13120
13422
 
13423
+ case SET_TAX_AMOUNT:
13424
+ return lib_7({ ...state,
13425
+ taxAmount: action.payload
13426
+ });
13427
+
13121
13428
  case SET_CAN_MAKE_PAYMENT:
13122
13429
  return lib_7({ ...state,
13123
13430
  canMakePayment: action.payload
@@ -13135,7 +13442,7 @@ const PaymentMethodContainerWithoutStripe = ({
13135
13442
 
13136
13443
  case SET_COUPON:
13137
13444
  return lib_7({ ...state,
13138
- coupon: action.payload
13445
+ couponObject: action.payload
13139
13446
  });
13140
13447
 
13141
13448
  case SET_COUPON_ERROR:
@@ -13161,21 +13468,21 @@ const PaymentMethodContainerWithoutStripe = ({
13161
13468
  default:
13162
13469
  return state;
13163
13470
  }
13164
- }, initialState$c);
13471
+ }, initialState$d);
13165
13472
  return /*#__PURE__*/React__default['default'].createElement("div", {
13166
13473
  style: { ...style
13167
13474
  },
13168
13475
  className: `pelcro-container pelcro-payment-container ${className}`
13169
- }, /*#__PURE__*/React__default['default'].createElement(Provider$c, {
13476
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$d, {
13170
13477
  value: {
13171
13478
  state,
13172
13479
  dispatch
13173
13480
  }
13174
13481
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
13175
- store: store$c,
13482
+ store: store$d,
13176
13483
  key: i
13177
13484
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
13178
- store: store$c
13485
+ store: store$d
13179
13486
  })));
13180
13487
  };
13181
13488
 
@@ -13188,7 +13495,7 @@ const PaymentMethodContainer = props => {
13188
13495
  stripeAccount: window.Pelcro.site.read().account_id,
13189
13496
  locale: getCanonicalLocaleFormat(window.Pelcro.site.read().default_locale)
13190
13497
  }, /*#__PURE__*/React__default['default'].createElement(es_11, null, /*#__PURE__*/React__default['default'].createElement(UnwrappedForm, Object.assign({
13191
- store: store$c
13498
+ store: store$d
13192
13499
  }, props))));
13193
13500
  }
13194
13501
 
@@ -13241,7 +13548,7 @@ const PelcroPaymentRequestButton = props => {
13241
13548
  currentPlan,
13242
13549
  updatedPrice
13243
13550
  }
13244
- } = React.useContext(store$c);
13551
+ } = React.useContext(store$d);
13245
13552
 
13246
13553
  const updatePaymentRequest = () => {
13247
13554
  // Make sure payment request is up to date, eg. user added a coupon code.
@@ -13294,9 +13601,10 @@ const DiscountedPrice = props => {
13294
13601
  const {
13295
13602
  state: {
13296
13603
  updatedPrice,
13604
+ taxAmount,
13297
13605
  percentOff
13298
13606
  }
13299
- } = React.useContext(store$c);
13607
+ } = React.useContext(store$d);
13300
13608
  const {
13301
13609
  default_locale
13302
13610
  } = Pelcro.site.read();
@@ -13306,12 +13614,15 @@ const DiscountedPrice = props => {
13306
13614
  } = usePelcro();
13307
13615
  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;
13308
13616
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
13309
- const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : updatedPrice * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
13617
+ const discountedPriceWithoutTax = updatedPrice - taxAmount;
13618
+ const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
13310
13619
 
13311
13620
  if (percentOff) {
13312
13621
  return /*#__PURE__*/React__default['default'].createElement("div", Object.assign({
13313
- className: "plc-my-2"
13314
- }, props), "(-", percentOff, ") ", priceFormatted);
13622
+ className: "plc-flex plc-justify-center plc-mt-2 pelcro-discount"
13623
+ }, props), "(-", percentOff, ")", " ", /*#__PURE__*/React__default['default'].createElement("span", {
13624
+ className: "plc-font-bold pelcro-discounted-price"
13625
+ }, priceFormatted));
13315
13626
  }
13316
13627
 
13317
13628
  return "";
@@ -13336,7 +13647,7 @@ const SubmitPaymentMethod = ({
13336
13647
  isLoading,
13337
13648
  updatedPrice
13338
13649
  }
13339
- } = React.useContext(store$c);
13650
+ } = React.useContext(store$d);
13340
13651
  const {
13341
13652
  default_locale
13342
13653
  } = Pelcro.site.read();
@@ -13360,17 +13671,17 @@ const SubmitPaymentMethod = ({
13360
13671
  }, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
13361
13672
  };
13362
13673
 
13363
- var _path$h;
13674
+ var _path$i;
13364
13675
 
13365
- 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); }
13676
+ 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); }
13366
13677
 
13367
13678
  function SvgArrowLeft(props) {
13368
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
13679
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
13369
13680
  xmlns: "http://www.w3.org/2000/svg",
13370
13681
  fill: "none",
13371
13682
  viewBox: "0 0 24 24",
13372
13683
  stroke: "currentColor"
13373
- }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
13684
+ }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
13374
13685
  strokeLinecap: "round",
13375
13686
  strokeLinejoin: "round",
13376
13687
  strokeWidth: 2,
@@ -13389,7 +13700,7 @@ const ApplyCouponButton = ({
13389
13700
  disableCouponButton
13390
13701
  },
13391
13702
  dispatch
13392
- } = React.useContext(store$c);
13703
+ } = React.useContext(store$d);
13393
13704
  const {
13394
13705
  t
13395
13706
  } = useTranslation("checkoutForm");
@@ -13423,7 +13734,7 @@ const CouponCodeField = props => {
13423
13734
  couponCode,
13424
13735
  couponError
13425
13736
  }
13426
- } = React.useContext(store$c);
13737
+ } = React.useContext(store$d);
13427
13738
 
13428
13739
  const onCouponCodeChange = e => {
13429
13740
  dispatch({
@@ -13441,6 +13752,7 @@ const CouponCodeField = props => {
13441
13752
 
13442
13753
  return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
13443
13754
  className: "plc-h-12",
13755
+ wrapperClassName: "plc-mb-1",
13444
13756
  errorClassName: "plc-h-12 sm:plc-h-8",
13445
13757
  error: couponError,
13446
13758
  "aria-label": t("labels.code"),
@@ -13451,17 +13763,17 @@ const CouponCodeField = props => {
13451
13763
  }, props));
13452
13764
  };
13453
13765
 
13454
- var _path$g;
13766
+ var _path$h;
13455
13767
 
13456
- 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); }
13768
+ 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); }
13457
13769
 
13458
13770
  function SvgTicket(props) {
13459
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
13771
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
13460
13772
  xmlns: "http://www.w3.org/2000/svg",
13461
13773
  fill: "none",
13462
13774
  viewBox: "0 0 24 24",
13463
13775
  stroke: "currentColor"
13464
- }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
13776
+ }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
13465
13777
  strokeLinecap: "round",
13466
13778
  strokeLinejoin: "round",
13467
13779
  strokeWidth: 2,
@@ -13478,7 +13790,7 @@ const CouponCode = ({
13478
13790
  state: {
13479
13791
  enableCouponField
13480
13792
  }
13481
- } = React.useContext(store$c);
13793
+ } = React.useContext(store$d);
13482
13794
  const {
13483
13795
  t
13484
13796
  } = useTranslation("checkoutForm");
@@ -13492,16 +13804,16 @@ const CouponCode = ({
13492
13804
  };
13493
13805
 
13494
13806
  return /*#__PURE__*/React__default['default'].createElement("div", {
13495
- className: "plc-my-4"
13807
+ className: "plc-mt-4"
13496
13808
  }, /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
13497
- className: "plc-text-base plc-text-gray-500",
13809
+ className: "plc-mb-2 plc-text-base plc-text-gray-500",
13498
13810
  variant: "ghost",
13499
13811
  icon: /*#__PURE__*/React__default['default'].createElement(SvgTicket, {
13500
13812
  className: "plc-w-5 plc-h-5 plc-mr-2"
13501
13813
  }),
13502
13814
  onClick: showCouponField
13503
13815
  }, otherProps), !enableCouponField ? t("labels.addCode") : t("labels.hideCode")), enableCouponField && /*#__PURE__*/React__default['default'].createElement("div", {
13504
- className: "plc-flex plc-w-full plc-my-4 pelcro-apply-coupon-wrapper"
13816
+ className: "plc-flex plc-w-full plc-mt-2 pelcro-apply-coupon-wrapper"
13505
13817
  }, /*#__PURE__*/React__default['default'].createElement(CouponCodeField, null), /*#__PURE__*/React__default['default'].createElement(ApplyCouponButton, null)));
13506
13818
  };
13507
13819
 
@@ -13735,7 +14047,7 @@ const PaypalSubscribeButton = props => {
13735
14047
  const {
13736
14048
  dispatch,
13737
14049
  state
13738
- } = React.useContext(store$c);
14050
+ } = React.useContext(store$d);
13739
14051
  const {
13740
14052
  product,
13741
14053
  plan,
@@ -13820,16 +14132,16 @@ const BankRedirection = () => {
13820
14132
  }));
13821
14133
  };
13822
14134
 
13823
- var _path$f;
14135
+ var _path$g;
13824
14136
 
13825
- 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); }
14137
+ 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); }
13826
14138
 
13827
14139
  function SvgLock(props) {
13828
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
14140
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
13829
14141
  xmlns: "http://www.w3.org/2000/svg",
13830
14142
  viewBox: "0 0 20 20",
13831
14143
  fill: "currentColor"
13832
- }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
14144
+ }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
13833
14145
  fillRule: "evenodd",
13834
14146
  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",
13835
14147
  clipRule: "evenodd"
@@ -13846,7 +14158,7 @@ const SelectedPaymentMethod = () => {
13846
14158
  state: {
13847
14159
  isLoading
13848
14160
  }
13849
- } = React.useContext(store$c);
14161
+ } = React.useContext(store$d);
13850
14162
  const {
13851
14163
  switchView,
13852
14164
  selectedPaymentMethodId
@@ -13878,6 +14190,37 @@ const SelectedPaymentMethod = () => {
13878
14190
  }, t("select.buttons.changePaymentMethod")))));
13879
14191
  };
13880
14192
 
14193
+ const TaxAmount = () => {
14194
+ var _plan$quantity;
14195
+
14196
+ const {
14197
+ t
14198
+ } = useTranslation("checkoutForm");
14199
+ const {
14200
+ state: {
14201
+ taxAmount
14202
+ }
14203
+ } = React.useContext(store$d);
14204
+ const {
14205
+ default_locale
14206
+ } = Pelcro.site.read();
14207
+ const {
14208
+ plan
14209
+ } = usePelcro();
14210
+ const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
14211
+ const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
14212
+
14213
+ if (taxAmount) {
14214
+ return /*#__PURE__*/React__default['default'].createElement("div", {
14215
+ className: "plc-text-center pelcro-tax-amount"
14216
+ }, t("labels.tax"), " ", /*#__PURE__*/React__default['default'].createElement("span", {
14217
+ className: "plc-font-bold"
14218
+ }, priceFormatted));
14219
+ }
14220
+
14221
+ return null;
14222
+ };
14223
+
13881
14224
  /**
13882
14225
  *
13883
14226
  */
@@ -13914,7 +14257,9 @@ function PaymentMethodView({
13914
14257
  onFailure: onFailure
13915
14258
  }, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
13916
14259
  className: "plc-mb-2"
13917
- }), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), /*#__PURE__*/React__default['default'].createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(CouponCode, null), /*#__PURE__*/React__default['default'].createElement(DiscountedPrice, null)), /*#__PURE__*/React__default['default'].createElement("div", {
14260
+ }), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), /*#__PURE__*/React__default['default'].createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default['default'].createElement("div", {
14261
+ className: "plc-mb-2"
14262
+ }, /*#__PURE__*/React__default['default'].createElement(CouponCode, null), /*#__PURE__*/React__default['default'].createElement(DiscountedPrice, null)), /*#__PURE__*/React__default['default'].createElement(TaxAmount, null), /*#__PURE__*/React__default['default'].createElement("div", {
13918
14263
  className: "plc-grid plc-mt-4 plc-gap-y-2"
13919
14264
  }, /*#__PURE__*/React__default['default'].createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)))))));
13920
14265
  }
@@ -14021,12 +14366,12 @@ function SubscriptionRenewModal({
14021
14366
  }
14022
14367
  SubscriptionRenewModal.viewId = "subscription-renew";
14023
14368
 
14024
- var _path$e;
14369
+ var _path$f;
14025
14370
 
14026
- 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); }
14371
+ 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); }
14027
14372
 
14028
14373
  function SvgGift(props) {
14029
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
14374
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
14030
14375
  className: "plc-w-6 plc-h-6 plc-mr-2",
14031
14376
  fill: "none",
14032
14377
  stroke: "currentColor",
@@ -14035,7 +14380,7 @@ function SvgGift(props) {
14035
14380
  strokeWidth: 2,
14036
14381
  viewBox: "0 0 24 24",
14037
14382
  xmlns: "http://www.w3.org/2000/svg"
14038
- }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
14383
+ }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
14039
14384
  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"
14040
14385
  })));
14041
14386
  }
@@ -14366,6 +14711,292 @@ class DefaultNewsLetter extends React.Component {
14366
14711
 
14367
14712
  const NewsLetter = withTranslation("newsletter")(DefaultNewsLetter);
14368
14713
 
14714
+ const initialState$c = {
14715
+ didSubToNewslettersBefore: false,
14716
+ newsletters: [],
14717
+ isListLoading: true,
14718
+ isSubmitting: false,
14719
+ alert: {
14720
+ type: "error",
14721
+ content: ""
14722
+ }
14723
+ };
14724
+ const store$c = /*#__PURE__*/React.createContext(initialState$c);
14725
+ const {
14726
+ Provider: Provider$c
14727
+ } = store$c;
14728
+
14729
+ const NewsletterUpdateContainer = ({
14730
+ style,
14731
+ className = "",
14732
+ onSuccess = () => {},
14733
+ onFailure = () => {},
14734
+ children
14735
+ }) => {
14736
+ const [t] = useTranslation("newsletter");
14737
+
14738
+ const handleSubmit = ({
14739
+ newsletters,
14740
+ didSubToNewslettersBefore
14741
+ }, dispatch) => {
14742
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2;
14743
+
14744
+ const callback = (err, res) => {
14745
+ dispatch({
14746
+ type: LOADING,
14747
+ payload: false
14748
+ });
14749
+
14750
+ if (err) {
14751
+ dispatch({
14752
+ type: SHOW_ALERT,
14753
+ payload: {
14754
+ type: "error",
14755
+ content: getErrorMessages(err)
14756
+ }
14757
+ });
14758
+ onFailure(err);
14759
+ } else {
14760
+ if (!didSubToNewslettersBefore) {
14761
+ dispatch({
14762
+ type: SWITCH_TO_UPDATE
14763
+ });
14764
+ }
14765
+
14766
+ dispatch({
14767
+ type: SHOW_ALERT,
14768
+ payload: {
14769
+ type: "success",
14770
+ content: t("messages.success")
14771
+ }
14772
+ });
14773
+ onSuccess(res);
14774
+ }
14775
+ };
14776
+
14777
+ const requestData = {
14778
+ 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"),
14779
+ source: "web",
14780
+ lists: newsletters.filter(newsletter => newsletter.selected).map(newsletter => newsletter.id).join(",")
14781
+ };
14782
+
14783
+ if (didSubToNewslettersBefore) {
14784
+ window.Pelcro.newsletter.update(requestData, callback);
14785
+ } else {
14786
+ window.Pelcro.newsletter.create(requestData, callback);
14787
+ }
14788
+ };
14789
+
14790
+ const [state, dispatch] = useReducerWithSideEffects((state, action) => {
14791
+ switch (action.type) {
14792
+ case GET_NEWSLETTERS_FETCH:
14793
+ return lib_7({ ...state,
14794
+ isListLoading: true
14795
+ });
14796
+
14797
+ case GET_NEWSLETTERS_SUCCESS:
14798
+ return lib_7({ ...state,
14799
+ newsletters: action.payload.newsletters,
14800
+ didSubToNewslettersBefore: action.payload.didSubToNewslettersBefore,
14801
+ isListLoading: false
14802
+ });
14803
+
14804
+ case SET_SELECT:
14805
+ return lib_7({ ...state,
14806
+ newsletters: state.newsletters.map(newsletter => {
14807
+ if (newsletter.id === action.payload) {
14808
+ return { ...newsletter,
14809
+ selected: !newsletter.selected
14810
+ };
14811
+ }
14812
+
14813
+ return newsletter;
14814
+ })
14815
+ });
14816
+
14817
+ case SWITCH_TO_UPDATE:
14818
+ return lib_7({ ...state,
14819
+ didSubToNewslettersBefore: true
14820
+ });
14821
+
14822
+ case SHOW_ALERT:
14823
+ return lib_7({ ...state,
14824
+ alert: action.payload
14825
+ });
14826
+
14827
+ case LOADING:
14828
+ return lib_7({ ...state,
14829
+ isSubmitting: action.payload
14830
+ });
14831
+
14832
+ case HANDLE_SUBMIT:
14833
+ return lib_5({ ...state,
14834
+ isSubmitting: true
14835
+ }, (state, dispatch) => handleSubmit(state, dispatch));
14836
+
14837
+ default:
14838
+ return state;
14839
+ }
14840
+ }, initialState$c);
14841
+ React.useEffect(() => {
14842
+ const getUserNewsletters = () => {
14843
+ var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
14844
+
14845
+ dispatch({
14846
+ type: GET_NEWSLETTERS_FETCH
14847
+ });
14848
+ 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");
14849
+ window.Pelcro.newsletter.getByEmail(email, (err, res) => {
14850
+ var _window$Pelcro$uiSett, _window$Pelcro, _window$Pelcro$uiSett2, _res$data$lists$split, _res$data$lists;
14851
+
14852
+ if (err) {
14853
+ return dispatch({
14854
+ type: SHOW_ALERT,
14855
+ payload: {
14856
+ type: "error",
14857
+ content: getErrorMessages(err)
14858
+ }
14859
+ });
14860
+ }
14861
+
14862
+ 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 : [];
14863
+ 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 : [];
14864
+ const allNewslettersWithSelectedField = newsletters.map(newsletter => ({ ...newsletter,
14865
+ id: String(newsletter.id),
14866
+ selected: selectedNewsletters.includes(String(newsletter.id))
14867
+ }));
14868
+ dispatch({
14869
+ type: GET_NEWSLETTERS_SUCCESS,
14870
+ payload: {
14871
+ newsletters: allNewslettersWithSelectedField,
14872
+ didSubToNewslettersBefore: Boolean(res.data.email)
14873
+ }
14874
+ });
14875
+ });
14876
+ };
14877
+
14878
+ getUserNewsletters();
14879
+ }, []);
14880
+ return /*#__PURE__*/React__default['default'].createElement("div", {
14881
+ style: { ...style
14882
+ },
14883
+ className: `pelcro-container pelcro-newsletter-update-container ${className}`
14884
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$c, {
14885
+ value: {
14886
+ state,
14887
+ dispatch
14888
+ }
14889
+ }, children.length ? children.map((child, i) => {
14890
+ if (child) {
14891
+ return /*#__PURE__*/React__default['default'].cloneElement(child, {
14892
+ store: store$c,
14893
+ key: i
14894
+ });
14895
+ }
14896
+ }) : /*#__PURE__*/React__default['default'].cloneElement(children, {
14897
+ store: store$c
14898
+ })));
14899
+ };
14900
+
14901
+ const NewsletterUpdateButton = ({
14902
+ name,
14903
+ onClick,
14904
+ ...otherProps
14905
+ }) => {
14906
+ const {
14907
+ dispatch,
14908
+ state: {
14909
+ isSubmitting,
14910
+ isListLoading
14911
+ }
14912
+ } = React.useContext(store$c);
14913
+ const {
14914
+ t
14915
+ } = useTranslation("newsletter");
14916
+ return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
14917
+ onClick: () => {
14918
+ dispatch({
14919
+ type: HANDLE_SUBMIT
14920
+ });
14921
+ onClick === null || onClick === void 0 ? void 0 : onClick();
14922
+ },
14923
+ disabled: isListLoading,
14924
+ isLoading: isSubmitting
14925
+ }, otherProps), name !== null && name !== void 0 ? name : t("labels.submit"));
14926
+ };
14927
+
14928
+ const NewsletterUpdateList = () => {
14929
+ const handleSelectNewsletter = event => {
14930
+ dispatch({
14931
+ type: SET_SELECT,
14932
+ payload: event.target.value
14933
+ });
14934
+ };
14935
+
14936
+ const {
14937
+ dispatch,
14938
+ state: {
14939
+ newsletters,
14940
+ isListLoading
14941
+ }
14942
+ } = React.useContext(store$c);
14943
+
14944
+ if (isListLoading) {
14945
+ return /*#__PURE__*/React__default['default'].createElement(Loader, {
14946
+ width: 60,
14947
+ height: 100
14948
+ });
14949
+ }
14950
+
14951
+ return /*#__PURE__*/React__default['default'].createElement("div", {
14952
+ className: "plc-max-h-80 plc-overflow-y-auto pelcro-newsletters-wrapper"
14953
+ }, newsletters.map(newsletter => /*#__PURE__*/React__default['default'].createElement("div", {
14954
+ key: newsletter.id,
14955
+ 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"
14956
+ }, /*#__PURE__*/React__default['default'].createElement(Checkbox, {
14957
+ className: "pelcro-select-newsletter-checkbox",
14958
+ labelClassName: "plc-cursor-pointer plc-w-full",
14959
+ id: `pelcro-newsletter-update-${newsletter.id}`,
14960
+ checked: newsletter.selected,
14961
+ value: newsletter.id,
14962
+ onChange: handleSelectNewsletter
14963
+ }, newsletter.label))));
14964
+ };
14965
+
14966
+ const NewsletterUpdateView = props => {
14967
+ const {
14968
+ t
14969
+ } = useTranslation("newsletter");
14970
+ return /*#__PURE__*/React__default['default'].createElement("div", {
14971
+ id: "pelcro-newsletter-update-view"
14972
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
14973
+ className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
14974
+ }, /*#__PURE__*/React__default['default'].createElement("h4", {
14975
+ className: "plc-text-2xl plc-font-semibold"
14976
+ }, t("updateTitle"))), /*#__PURE__*/React__default['default'].createElement("form", {
14977
+ action: "javascript:void(0);",
14978
+ className: "plc-mt-2 pelcro-form"
14979
+ }, /*#__PURE__*/React__default['default'].createElement(NewsletterUpdateContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, null), /*#__PURE__*/React__default['default'].createElement(NewsletterUpdateList, null), /*#__PURE__*/React__default['default'].createElement(NewsletterUpdateButton, {
14980
+ role: "submit",
14981
+ className: "plc-mt-4 plc-w-full",
14982
+ name: t("labels.submit"),
14983
+ id: "pelcro-submit"
14984
+ }))));
14985
+ };
14986
+
14987
+ const NewsletterUpdateModal = ({
14988
+ onDisplay,
14989
+ onClose,
14990
+ ...otherProps
14991
+ }) => {
14992
+ return /*#__PURE__*/React__default['default'].createElement(Modal, {
14993
+ id: "pelcro-newsletter-update-modal",
14994
+ onDisplay: onDisplay,
14995
+ onClose: onClose
14996
+ }, /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(NewsletterUpdateView, otherProps)), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
14997
+ };
14998
+ NewsletterUpdateModal.viewId = "newsletter-update";
14999
+
14369
15000
  const MeterView = () => {
14370
15001
  var _paywallProduct$paywa, _paywallProduct$paywa2;
14371
15002
 
@@ -14417,7 +15048,7 @@ const MeterModal = props => {
14417
15048
  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"
14418
15049
  }, /*#__PURE__*/React__default['default'].createElement("button", {
14419
15050
  type: "button",
14420
- className: "plc-absolute plc-top-0 plc-text-2xl plc-text-gray-500 plc-right-1 pelcro-close-btn",
15051
+ 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",
14421
15052
  "aria-label": "Close",
14422
15053
  onClick: onClose
14423
15054
  }, /*#__PURE__*/React__default['default'].createElement("span", null, "\xD7")), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(MeterView, props)));
@@ -14753,17 +15384,17 @@ const UserUpdatePhone = props => /*#__PURE__*/React__default['default'].createEl
14753
15384
 
14754
15385
  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";
14755
15386
 
14756
- var _path$d;
15387
+ var _path$e;
14757
15388
 
14758
- 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); }
15389
+ 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); }
14759
15390
 
14760
15391
  function SvgEdit(props) {
14761
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
15392
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
14762
15393
  className: "plc-w-6 plc-h-6",
14763
15394
  xmlns: "http://www.w3.org/2000/svg",
14764
15395
  viewBox: "0 0 20 20",
14765
15396
  fill: "currentColor"
14766
- }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
15397
+ }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
14767
15398
  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"
14768
15399
  })));
14769
15400
  }
@@ -17874,18 +18505,18 @@ const GiftCreateLastName = props => /*#__PURE__*/React__default['default'].creat
17874
18505
  store: store$4
17875
18506
  }, props));
17876
18507
 
17877
- var _path$c;
18508
+ var _path$d;
17878
18509
 
17879
- 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); }
18510
+ 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); }
17880
18511
 
17881
18512
  function SvgInfoCircle(props) {
17882
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
18513
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
17883
18514
  xmlns: "http://www.w3.org/2000/svg",
17884
18515
  className: "plc-w-5 plc-h-5",
17885
18516
  fill: "none",
17886
18517
  viewBox: "0 0 24 24",
17887
18518
  stroke: "currentColor"
17888
- }, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
18519
+ }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
17889
18520
  strokeLinecap: "round",
17890
18521
  strokeLinejoin: "round",
17891
18522
  strokeWidth: 2,
@@ -18872,8 +19503,8 @@ const PaymentMethodSelectModal = ({
18872
19503
  };
18873
19504
  PaymentMethodSelectModal.viewId = "payment-method-select";
18874
19505
 
18875
- function _extends$d() {
18876
- _extends$d = Object.assign || function (target) {
19506
+ function _extends$e() {
19507
+ _extends$e = Object.assign || function (target) {
18877
19508
  for (var i = 1; i < arguments.length; i++) {
18878
19509
  var source = arguments[i];
18879
19510
 
@@ -18887,7 +19518,7 @@ function _extends$d() {
18887
19518
  return target;
18888
19519
  };
18889
19520
 
18890
- return _extends$d.apply(this, arguments);
19521
+ return _extends$e.apply(this, arguments);
18891
19522
  }
18892
19523
 
18893
19524
  function _objectWithoutPropertiesLoose(source, excluded) {
@@ -19071,7 +19702,7 @@ function render(props, propsBag, defaultTag, features, visible) {
19071
19702
  return match(strategy, (_match = {}, _match[RenderStrategy.Unmount] = function () {
19072
19703
  return null;
19073
19704
  }, _match[RenderStrategy.Hidden] = function () {
19074
- return _render(_extends$d({}, _rest, {
19705
+ return _render(_extends$e({}, _rest, {
19075
19706
  hidden: true,
19076
19707
  style: {
19077
19708
  display: 'none'
@@ -19599,7 +20230,7 @@ function TransitionChild(props) {
19599
20230
  var passthroughProps = rest;
19600
20231
  return React__default['default'].createElement(NestingContext.Provider, {
19601
20232
  value: nesting
19602
- }, render(_extends$d({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
20233
+ }, render(_extends$e({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
19603
20234
  }
19604
20235
 
19605
20236
  function Transition(props) {
@@ -19643,7 +20274,7 @@ function Transition(props) {
19643
20274
  value: nestingBag
19644
20275
  }, React__default['default'].createElement(TransitionContext.Provider, {
19645
20276
  value: transitionBag
19646
- }, render(_extends$d({}, sharedProps, {
20277
+ }, render(_extends$e({}, sharedProps, {
19647
20278
  as: React.Fragment,
19648
20279
  children: React__default['default'].createElement(TransitionChild, Object.assign({}, sharedProps, passthroughProps))
19649
20280
  }), propsBag, React.Fragment, TransitionChildRenderFeatures, state === TreeStates.Visible)));
@@ -19770,12 +20401,12 @@ var ActionTypes;
19770
20401
  })(ActionTypes || (ActionTypes = {}));
19771
20402
 
19772
20403
  (_reducers = {}, _reducers[ActionTypes.CloseMenu] = function (state) {
19773
- return _extends$d({}, state, {
20404
+ return _extends$e({}, state, {
19774
20405
  activeItemIndex: null,
19775
20406
  menuState: MenuStates.Closed
19776
20407
  });
19777
20408
  }, _reducers[ActionTypes.OpenMenu] = function (state) {
19778
- return _extends$d({}, state, {
20409
+ return _extends$e({}, state, {
19779
20410
  menuState: MenuStates.Open
19780
20411
  });
19781
20412
  }, _reducers[ActionTypes.GoToItem] = function (state, action) {
@@ -19794,7 +20425,7 @@ var ActionTypes;
19794
20425
  }
19795
20426
  });
19796
20427
  if (state.searchQuery === '' && state.activeItemIndex === activeItemIndex) return state;
19797
- return _extends$d({}, state, {
20428
+ return _extends$e({}, state, {
19798
20429
  searchQuery: '',
19799
20430
  activeItemIndex: activeItemIndex
19800
20431
  });
@@ -19805,19 +20436,19 @@ var ActionTypes;
19805
20436
 
19806
20437
  return ((_item$dataRef$current = item.dataRef.current.textValue) == null ? void 0 : _item$dataRef$current.startsWith(searchQuery)) && !item.dataRef.current.disabled;
19807
20438
  });
19808
- if (match === -1 || match === state.activeItemIndex) return _extends$d({}, state, {
20439
+ if (match === -1 || match === state.activeItemIndex) return _extends$e({}, state, {
19809
20440
  searchQuery: searchQuery
19810
20441
  });
19811
- return _extends$d({}, state, {
20442
+ return _extends$e({}, state, {
19812
20443
  searchQuery: searchQuery,
19813
20444
  activeItemIndex: match
19814
20445
  });
19815
20446
  }, _reducers[ActionTypes.ClearSearch] = function (state) {
19816
- return _extends$d({}, state, {
20447
+ return _extends$e({}, state, {
19817
20448
  searchQuery: ''
19818
20449
  });
19819
20450
  }, _reducers[ActionTypes.RegisterItem] = function (state, action) {
19820
- return _extends$d({}, state, {
20451
+ return _extends$e({}, state, {
19821
20452
  items: [].concat(state.items, [{
19822
20453
  id: action.id,
19823
20454
  dataRef: action.dataRef
@@ -19830,7 +20461,7 @@ var ActionTypes;
19830
20461
  return a.id === action.id;
19831
20462
  });
19832
20463
  if (idx !== -1) nextItems.splice(idx, 1);
19833
- return _extends$d({}, state, {
20464
+ return _extends$e({}, state, {
19834
20465
  items: nextItems,
19835
20466
  activeItemIndex: function () {
19836
20467
  if (idx === state.activeItemIndex) return null;
@@ -19869,19 +20500,19 @@ var ActionTypes$1;
19869
20500
  (_reducers$1 = {}, _reducers$1[ActionTypes$1.CloseListbox] = function (state) {
19870
20501
  if (state.disabled) return state;
19871
20502
  if (state.listboxState === ListboxStates.Closed) return state;
19872
- return _extends$d({}, state, {
20503
+ return _extends$e({}, state, {
19873
20504
  activeOptionIndex: null,
19874
20505
  listboxState: ListboxStates.Closed
19875
20506
  });
19876
20507
  }, _reducers$1[ActionTypes$1.OpenListbox] = function (state) {
19877
20508
  if (state.disabled) return state;
19878
20509
  if (state.listboxState === ListboxStates.Open) return state;
19879
- return _extends$d({}, state, {
20510
+ return _extends$e({}, state, {
19880
20511
  listboxState: ListboxStates.Open
19881
20512
  });
19882
20513
  }, _reducers$1[ActionTypes$1.SetDisabled] = function (state, action) {
19883
20514
  if (state.disabled === action.disabled) return state;
19884
- return _extends$d({}, state, {
20515
+ return _extends$e({}, state, {
19885
20516
  disabled: action.disabled
19886
20517
  });
19887
20518
  }, _reducers$1[ActionTypes$1.GoToOption] = function (state, action) {
@@ -19902,7 +20533,7 @@ var ActionTypes$1;
19902
20533
  }
19903
20534
  });
19904
20535
  if (state.searchQuery === '' && state.activeOptionIndex === activeOptionIndex) return state;
19905
- return _extends$d({}, state, {
20536
+ return _extends$e({}, state, {
19906
20537
  searchQuery: '',
19907
20538
  activeOptionIndex: activeOptionIndex
19908
20539
  });
@@ -19915,10 +20546,10 @@ var ActionTypes$1;
19915
20546
 
19916
20547
  return !option.dataRef.current.disabled && ((_option$dataRef$curre = option.dataRef.current.textValue) == null ? void 0 : _option$dataRef$curre.startsWith(searchQuery));
19917
20548
  });
19918
- if (match === -1 || match === state.activeOptionIndex) return _extends$d({}, state, {
20549
+ if (match === -1 || match === state.activeOptionIndex) return _extends$e({}, state, {
19919
20550
  searchQuery: searchQuery
19920
20551
  });
19921
- return _extends$d({}, state, {
20552
+ return _extends$e({}, state, {
19922
20553
  searchQuery: searchQuery,
19923
20554
  activeOptionIndex: match
19924
20555
  });
@@ -19926,11 +20557,11 @@ var ActionTypes$1;
19926
20557
  if (state.disabled) return state;
19927
20558
  if (state.listboxState === ListboxStates.Closed) return state;
19928
20559
  if (state.searchQuery === '') return state;
19929
- return _extends$d({}, state, {
20560
+ return _extends$e({}, state, {
19930
20561
  searchQuery: ''
19931
20562
  });
19932
20563
  }, _reducers$1[ActionTypes$1.RegisterOption] = function (state, action) {
19933
- return _extends$d({}, state, {
20564
+ return _extends$e({}, state, {
19934
20565
  options: [].concat(state.options, [{
19935
20566
  id: action.id,
19936
20567
  dataRef: action.dataRef
@@ -19943,7 +20574,7 @@ var ActionTypes$1;
19943
20574
  return a.id === action.id;
19944
20575
  });
19945
20576
  if (idx !== -1) nextOptions.splice(idx, 1);
19946
- return _extends$d({}, state, {
20577
+ return _extends$e({}, state, {
19947
20578
  options: nextOptions,
19948
20579
  activeOptionIndex: function () {
19949
20580
  if (idx === state.activeOptionIndex) return null;
@@ -20004,18 +20635,18 @@ const getPaymentCardIcon = name => {
20004
20635
  }));
20005
20636
  };
20006
20637
 
20007
- var _path$b;
20638
+ var _path$c;
20008
20639
 
20009
- 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); }
20640
+ 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); }
20010
20641
 
20011
20642
  function SvgChevronRight(props) {
20012
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
20643
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
20013
20644
  className: "plc-w-6 plc-h-6",
20014
20645
  xmlns: "http://www.w3.org/2000/svg",
20015
20646
  fill: "none",
20016
20647
  viewBox: "0 0 24 24",
20017
20648
  stroke: "currentColor"
20018
- }, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
20649
+ }, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
20019
20650
  strokeLinecap: "round",
20020
20651
  strokeLinejoin: "round",
20021
20652
  strokeWidth: 2,
@@ -20314,18 +20945,18 @@ Accordion.item = function AccordionItem({
20314
20945
  }, content)) : null;
20315
20946
  };
20316
20947
 
20317
- var _path$a;
20948
+ var _path$b;
20318
20949
 
20319
- 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); }
20950
+ 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); }
20320
20951
 
20321
20952
  function SvgExit(props) {
20322
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
20953
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
20323
20954
  className: "plc-w-6 plc-h-6",
20324
20955
  xmlns: "http://www.w3.org/2000/svg",
20325
20956
  fill: "none",
20326
20957
  viewBox: "0 0 24 24",
20327
20958
  stroke: "currentColor"
20328
- }, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
20959
+ }, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
20329
20960
  strokeLinecap: "round",
20330
20961
  strokeLinejoin: "round",
20331
20962
  strokeWidth: 2,
@@ -20333,30 +20964,49 @@ function SvgExit(props) {
20333
20964
  })));
20334
20965
  }
20335
20966
 
20336
- var _path$9;
20967
+ var _path$a;
20337
20968
 
20338
- 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); }
20969
+ 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); }
20339
20970
 
20340
20971
  function SvgCheckMark(props) {
20341
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
20972
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
20342
20973
  className: "plc-w-4 plc-h-4 plc-mr-1",
20343
20974
  xmlns: "http://www.w3.org/2000/svg",
20344
20975
  viewBox: "0 0 20 20",
20345
20976
  fill: "currentColor"
20346
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
20977
+ }, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
20347
20978
  fillRule: "evenodd",
20348
20979
  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",
20349
20980
  clipRule: "evenodd"
20350
20981
  })));
20351
20982
  }
20352
20983
 
20984
+ var _path$9;
20985
+
20986
+ 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); }
20987
+
20988
+ function SvgUser(props) {
20989
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
20990
+ xmlns: "http://www.w3.org/2000/svg",
20991
+ fill: "none",
20992
+ viewBox: "0 0 24 24",
20993
+ stroke: "currentColor"
20994
+ }, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
20995
+ strokeLinecap: "round",
20996
+ strokeLinejoin: "round",
20997
+ strokeWidth: 2,
20998
+ d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zm-4 7a7 7 0 00-7 7h14a7 7 0 00-7-7z"
20999
+ })));
21000
+ }
21001
+
20353
21002
  var _path$8;
20354
21003
 
20355
21004
  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); }
20356
21005
 
20357
- function SvgUser(props) {
21006
+ function SvgNewsletter(props) {
20358
21007
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
20359
21008
  xmlns: "http://www.w3.org/2000/svg",
21009
+ className: "plc-h-5 plc-w-5",
20360
21010
  fill: "none",
20361
21011
  viewBox: "0 0 24 24",
20362
21012
  stroke: "currentColor"
@@ -20364,7 +21014,7 @@ function SvgUser(props) {
20364
21014
  strokeLinecap: "round",
20365
21015
  strokeLinejoin: "round",
20366
21016
  strokeWidth: 2,
20367
- d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zm-4 7a7 7 0 00-7 7h14a7 7 0 00-7-7z"
21017
+ 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"
20368
21018
  })));
20369
21019
  }
20370
21020
 
@@ -20603,6 +21253,24 @@ class Dashboard extends React.Component {
20603
21253
  });
20604
21254
  });
20605
21255
 
21256
+ _defineProperty$3(this, "componentWillUnmount", () => {
21257
+ document.removeEventListener("click", this.hideMenuIfClickedOutside);
21258
+ });
21259
+
21260
+ _defineProperty$3(this, "initializeHideMenuHandler", () => {
21261
+ document.addEventListener("click", this.hideMenuIfClickedOutside);
21262
+ });
21263
+
21264
+ _defineProperty$3(this, "hideMenuIfClickedOutside", event => {
21265
+ const didClickOutsideMenu = this.state.isOpen && this.menuRef.current && !this.menuRef.current.contains(event.target);
21266
+
21267
+ if (didClickOutsideMenu) {
21268
+ this.setState({
21269
+ isOpen: false
21270
+ });
21271
+ }
21272
+ });
21273
+
20606
21274
  _defineProperty$3(this, "cancelSubscription", (subscription_id, onSuccess, onFailure) => {
20607
21275
  // disable the Login button to prevent repeated clicks
20608
21276
  window.Pelcro.subscription.cancel({
@@ -20640,6 +21308,10 @@ class Dashboard extends React.Component {
20640
21308
  return this.props.setView("password-change");
20641
21309
  });
20642
21310
 
21311
+ _defineProperty$3(this, "displayNewsletterUpdate", () => {
21312
+ return this.props.setView("newsletter-update");
21313
+ });
21314
+
20643
21315
  _defineProperty$3(this, "displayProductSelect", ({
20644
21316
  isGift
20645
21317
  }) => {
@@ -20799,21 +21471,21 @@ class Dashboard extends React.Component {
20799
21471
  className: "plc-inline-block plc-mt-1"
20800
21472
  }, sub.shipments_remaining, " ", this.locale("labels.shipments")) : null)), /*#__PURE__*/React__default['default'].createElement("td", null, sub.cancel_at_period_end === 0 && /*#__PURE__*/React__default['default'].createElement(Button, {
20801
21473
  variant: "ghost",
20802
- className: "plc-text-red-500 focus:plc-ring-red-500",
21474
+ className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
20803
21475
  icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
20804
21476
  onClick: onCancelClick,
20805
21477
  disabled: this.state.disableSubmit,
20806
21478
  "data-key": sub.id
20807
21479
  }, this.locale("labels.unsubscribe")), sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default['default'].createElement(Button, {
20808
21480
  variant: "ghost",
20809
- className: "plc-text-green-400 focus:plc-ring-green-300",
21481
+ className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
20810
21482
  icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
20811
21483
  onClick: onReactivateClick,
20812
21484
  disabled: this.state.disableSubmit,
20813
21485
  "data-key": sub.id
20814
21486
  }, this.locale("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default['default'].createElement(Button, {
20815
21487
  variant: "ghost",
20816
- className: "plc-text-blue-400",
21488
+ className: "plc-text-blue-400 pelcro-dashboard-sub-renew-button",
20817
21489
  icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
20818
21490
  onClick: onRenewClick,
20819
21491
  disabled: this.state.disableSubmit,
@@ -20994,28 +21666,33 @@ class Dashboard extends React.Component {
20994
21666
  this.site = window.Pelcro.site.read();
20995
21667
  this.locale = this.props.t;
20996
21668
  this.user = window.Pelcro.user.read();
21669
+ this.menuRef = /*#__PURE__*/React__default['default'].createRef();
20997
21670
  }
20998
21671
 
20999
21672
  render() {
21000
- var _window$Pelcro$user$r3, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
21673
+ var _window$Pelcro$user$r3, _window$Pelcro, _window$Pelcro$uiSett, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
21001
21674
 
21002
21675
  const {
21003
21676
  isOpen
21004
21677
  } = this.state;
21005
21678
  const userHasName = this.user.first_name || this.user.last_name;
21006
21679
  const profilePicture = (_window$Pelcro$user$r3 = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : userSolidIcon;
21680
+ 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;
21681
+ const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
21007
21682
  return /*#__PURE__*/React__default['default'].createElement(Transition, {
21008
21683
  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",
21009
21684
  show: isOpen,
21010
21685
  enter: "plc-transform plc-transition plc-duration-500",
21011
21686
  enterFrom: "plc-translate-x-full",
21012
21687
  enterTo: "plc-translate-x-0",
21688
+ afterEnter: this.initializeHideMenuHandler,
21013
21689
  leave: "plc-transform plc-transition plc-duration-500",
21014
21690
  leaveFrom: "plc-translate-x-0",
21015
21691
  leaveTo: "plc-translate-x-full",
21016
21692
  afterLeave: this.props.onClose
21017
21693
  }, /*#__PURE__*/React__default['default'].createElement("div", {
21018
- id: "pelcro-view-dashboard"
21694
+ id: "pelcro-view-dashboard",
21695
+ ref: this.menuRef
21019
21696
  }, /*#__PURE__*/React__default['default'].createElement("header", {
21020
21697
  className: "plc-flex plc-flex-col plc-p-4 plc-pl-2 plc-min-h-40 sm:plc-pr-8 plc-bg-primary-500"
21021
21698
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -21078,7 +21755,14 @@ class Dashboard extends React.Component {
21078
21755
  }),
21079
21756
  className: "plc-text-sm plc-text-gray-500 hover:plc-text-primary-700",
21080
21757
  onClick: this.displayChangePassword
21081
- }, this.locale("labels.changePassword")))
21758
+ }, this.locale("labels.changePassword")), siteHasNewslettersDefined && /*#__PURE__*/React__default['default'].createElement(Button, {
21759
+ variant: "ghost",
21760
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgNewsletter, {
21761
+ className: "plc-w-5 plc-h-5 plc-mr-1"
21762
+ }),
21763
+ className: "plc-text-sm plc-text-gray-500 hover:plc-text-primary-700",
21764
+ onClick: this.displayNewsletterUpdate
21765
+ }, this.locale("labels.editNewsletters")))
21082
21766
  }), /*#__PURE__*/React__default['default'].createElement(Accordion.item, {
21083
21767
  name: SUB_MENUS.PAYMENT_CARDS,
21084
21768
  icon: /*#__PURE__*/React__default['default'].createElement(SvgPaymentCard, null),
@@ -21154,7 +21838,7 @@ const DashboardOpenButton = () => {
21154
21838
  return /*#__PURE__*/React__default['default'].createElement("div", {
21155
21839
  className: "plc-fixed plc-right-4 plc-bottom-4 pelcro-open-dashboard-btn"
21156
21840
  }, /*#__PURE__*/React__default['default'].createElement("button", {
21157
- className: "plc-bg-white plc-border-2 plc-rounded-full focus:plc-outline-none plc-border-primary-300",
21841
+ className: "plc-bg-white plc-border-2 plc-rounded-full focus:plc-outline-none plc-border-primary-300 hover:plc-bg-white",
21158
21842
  name: "menu",
21159
21843
  id: "pelcro-view-menu",
21160
21844
  onClick: () => switchView("dashboard")
@@ -23019,6 +23703,7 @@ exports.AddressUpdateSubmit = AddressUpdateSubmit;
23019
23703
  exports.AddressUpdateTextInput = AddressUpdateTextInput;
23020
23704
  exports.AddressUpdateView = AddressUpdateView;
23021
23705
  exports.Alert = AlertWithContext;
23706
+ exports.AlertElement = Alert;
23022
23707
  exports.ApplyCouponButton = ApplyCouponButton;
23023
23708
  exports.Badge = Badge;
23024
23709
  exports.BankRedirection = BankRedirection;
@@ -23070,6 +23755,11 @@ exports.Modal = Modal;
23070
23755
  exports.ModalBody = ModalBody;
23071
23756
  exports.ModalFooter = ModalFooter;
23072
23757
  exports.NewsLetter = NewsletterWithHook;
23758
+ exports.NewsletterUpdateButton = NewsletterUpdateButton;
23759
+ exports.NewsletterUpdateContainer = NewsletterUpdateContainer;
23760
+ exports.NewsletterUpdateList = NewsletterUpdateList;
23761
+ exports.NewsletterUpdateModal = NewsletterUpdateModal;
23762
+ exports.NewsletterUpdateView = NewsletterUpdateView;
23073
23763
  exports.Notification = Notification;
23074
23764
  exports.OrderConfirmModal = OrderConfirmModal;
23075
23765
  exports.OrderCreateContainer = OrderCreateContainer;
@@ -23148,6 +23838,7 @@ exports.SubscriptionCreateView = SubscriptionCreateView;
23148
23838
  exports.SubscriptionRenewContainer = SubscriptionRenewContainer;
23149
23839
  exports.SubscriptionRenewModal = SubscriptionRenewModal;
23150
23840
  exports.SubscriptionRenewView = SubscriptionRenewView;
23841
+ exports.TaxAmount = TaxAmount;
23151
23842
  exports.TextArea = TextArea;
23152
23843
  exports.Tooltip = Tooltip;
23153
23844
  exports.UserUpdateButton = UserUpdateButton;