@pelcro/react-pelcro-js 2.6.0-beta.1 → 2.6.0-beta.10

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
@@ -4359,7 +4359,8 @@ var labels$3 = {
4359
4359
  title: "Status",
4360
4360
  active: "Active",
4361
4361
  inTrial: "In trial",
4362
- endingSoon: "Ending soon"
4362
+ endingSoon: "Ending soon",
4363
+ scheduled: "Scheduled"
4363
4364
  },
4364
4365
  shipments: "Shipments remaining",
4365
4366
  logout: "Logout",
@@ -4385,6 +4386,7 @@ var labels$3 = {
4385
4386
  paymentSource: "Payment cards",
4386
4387
  actions: "Actions",
4387
4388
  expiresOn: "Ends",
4389
+ startsOn: "Starts",
4388
4390
  renewsOn: "Renews",
4389
4391
  canceledOn: "Canceled on",
4390
4392
  recipient: "Recipient",
@@ -4436,7 +4438,8 @@ var labels$2 = {
4436
4438
  title: "Statut",
4437
4439
  active: "Active",
4438
4440
  inTrial: "Dans l'essai",
4439
- endingSoon: "Fin bientôt"
4441
+ endingSoon: "Fin bientôt",
4442
+ scheduled: "Programmé"
4440
4443
  },
4441
4444
  shipments: "Expéditions restantes",
4442
4445
  logout: "Déconnexion",
@@ -4462,6 +4465,7 @@ var labels$2 = {
4462
4465
  paymentSource: "Sources de paiement",
4463
4466
  actions: "Actes",
4464
4467
  expiresOn: "Expire le",
4468
+ startsOn: "Débute le",
4465
4469
  renewsOn: "Renouvelle le",
4466
4470
  canceledOn: "Annulé le",
4467
4471
  recipient: "Destinataire",
@@ -4494,7 +4498,7 @@ var messages$2 = {
4494
4498
  isSureToCancel: "Êtes-vous certain de vouloir annuler votre abonnement?",
4495
4499
  loading: "Annulation de l'abonnement",
4496
4500
  success: "L'abonnement a été annulé avec succès",
4497
- error: "Une erreure s'est produite lors de l'annulation de l'abonnement"
4501
+ error: "Une erreur s'est produite lors de l'annulation de l'abonnement"
4498
4502
  }
4499
4503
  };
4500
4504
  var dashboard_fr = {
@@ -6327,13 +6331,34 @@ const getAddressById = id => {
6327
6331
  };
6328
6332
  /**
6329
6333
  * Transforms locale names stored in our backend like
6330
- * "en_US" into the standerd accepted in core i18n methods: "en-US"
6334
+ * "en_US" into the standard accepted in core i18n methods: "en-US"
6331
6335
  * @param {string} localeName
6332
6336
  * @return {string | undefined}
6333
6337
  * @example getCanonicalLocaleFormat("en_US") => "en-US"
6334
6338
  */
6335
6339
 
6336
6340
  const getCanonicalLocaleFormat = localeName => localeName === null || localeName === void 0 ? void 0 : localeName.replace("_", "-");
6341
+ /**
6342
+ * @param {string} localeName
6343
+ * @return {string | undefined}
6344
+ * @example getLanguageWithoutRegion("en-US") => "en"
6345
+ */
6346
+
6347
+ const getLanguageWithoutRegion = localeName => {
6348
+ var _getCanonicalLocaleFo;
6349
+
6350
+ return (_getCanonicalLocaleFo = getCanonicalLocaleFormat(localeName)) === null || _getCanonicalLocaleFo === void 0 ? void 0 : _getCanonicalLocaleFo.split("-")[0];
6351
+ };
6352
+ /**
6353
+ * Gets the current page language or fallbacks to site default
6354
+ * @return {string | undefined}
6355
+ */
6356
+
6357
+ const getPageOrDefaultLanguage = () => {
6358
+ var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
6359
+
6360
+ return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.call(_window$Pelcro$site)) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.default_locale);
6361
+ };
6337
6362
  /**
6338
6363
  * Returns a formatted price string depending on locale
6339
6364
  * @param {number} amount
@@ -6343,7 +6368,7 @@ const getCanonicalLocaleFormat = localeName => localeName === null || localeName
6343
6368
  * @example getFormattedPriceByLocal(10, 'USD', 'en-US') => "$10.00"
6344
6369
  */
6345
6370
 
6346
- const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en-US") => {
6371
+ const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en") => {
6347
6372
  const formatter = new Intl.NumberFormat(getCanonicalLocaleFormat(locale), {
6348
6373
  style: "currency",
6349
6374
  currency
@@ -6368,8 +6393,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
6368
6393
  totalWithoutDividingBy100 += parseFloat(item.price ? (item.price * item.quantity).toFixed(2) : item.amount.toFixed(2));
6369
6394
  }
6370
6395
 
6371
- const locale = window.Pelcro.site.read().default_locale;
6372
- return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, locale);
6396
+ return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
6373
6397
  };
6374
6398
  /**
6375
6399
  * returns true if the URL contains a supported view trigger URL
@@ -6383,12 +6407,15 @@ const isValidViewFromURL = viewID => {
6383
6407
  }
6384
6408
 
6385
6409
  return false;
6410
+ /**
6411
+ *
6412
+ */
6386
6413
 
6387
6414
  function hasValidNewsletterUpdateUrl() {
6388
- var _window$Pelcro, _window$Pelcro$uiSett;
6415
+ var _window$Pelcro2, _window$Pelcro2$uiSet;
6389
6416
 
6390
6417
  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;
6418
+ const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
6392
6419
  const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
6393
6420
 
6394
6421
  if (!siteHasNewslettersDefined) {
@@ -6561,10 +6588,20 @@ const getPaymentCardIcon$1 = name => {
6561
6588
  d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"
6562
6589
  }));
6563
6590
  };
6591
+ /**
6592
+ * Gets the current date with time set to 0
6593
+ * @param {Date} dateObject
6594
+ * @return {Date}
6595
+ */
6596
+
6597
+ function getDateWithoutTime(dateObject) {
6598
+ const date = new Date(dateObject.getTime());
6599
+ date.setHours(0, 0, 0, 0);
6600
+ return date;
6601
+ }
6564
6602
 
6565
- var _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
6566
6603
  const resources = {
6567
- "en-US": {
6604
+ en: {
6568
6605
  common: common_en,
6569
6606
  paymentMethod: paymentMethod_en,
6570
6607
  newsletter: newsletter_en,
@@ -6586,7 +6623,7 @@ const resources = {
6586
6623
  select: select_en,
6587
6624
  notification: notification_en
6588
6625
  },
6589
- "fr-CA": {
6626
+ fr: {
6590
6627
  common: common_fr,
6591
6628
  paymentMethod: paymentMethod_fr,
6592
6629
  newsletter: newsletter_fr,
@@ -6608,13 +6645,14 @@ const resources = {
6608
6645
  select: select_fr,
6609
6646
  notification: notification_fr
6610
6647
  }
6611
- };
6612
- let locale = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.call(_window$Pelcro$site)) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.default_locale;
6613
- if (!locale) locale = "en-US";
6648
+ }; // set UI language to the page language or default to the language in site settings
6649
+
6650
+ const locale = getPageOrDefaultLanguage();
6614
6651
  i18next.use(initReactI18next) // passes i18n down to react-i18next,
6615
6652
  .init({
6616
6653
  resources,
6617
- lng: getCanonicalLocaleFormat(locale),
6654
+ lng: locale,
6655
+ fallbackLng: "en",
6618
6656
  // debug: true,
6619
6657
  interpolation: {
6620
6658
  escapeValue: false // react already safes from xss
@@ -6625,6 +6663,16 @@ i18next.use(initReactI18next) // passes i18n down to react-i18next,
6625
6663
 
6626
6664
  }
6627
6665
  });
6666
+ const pageLanguageObserver = new MutationObserver(mutationsList => {
6667
+ mutationsList.forEach(mutationRecord => {
6668
+ if (mutationRecord.attributeName === "lang") {
6669
+ i18next.changeLanguage(window.Pelcro.helpers.getHtmlLanguageAttribute());
6670
+ }
6671
+ });
6672
+ });
6673
+ pageLanguageObserver.observe(document.documentElement, {
6674
+ attributes: true
6675
+ });
6628
6676
 
6629
6677
  function _classPrivateFieldGet(receiver, privateMap) {
6630
6678
  var descriptor = privateMap.get(receiver);
@@ -6877,8 +6925,8 @@ const saveToMetadataButton = new SaveToMetadataButtonClass();
6877
6925
 
6878
6926
  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}}
6879
6927
 
6880
- function _extends$u() {
6881
- _extends$u = Object.assign || function (target) {
6928
+ function _extends$v() {
6929
+ _extends$v = Object.assign || function (target) {
6882
6930
  for (var i = 1; i < arguments.length; i++) {
6883
6931
  var source = arguments[i];
6884
6932
 
@@ -6892,7 +6940,7 @@ function _extends$u() {
6892
6940
  return target;
6893
6941
  };
6894
6942
 
6895
- return _extends$u.apply(this, arguments);
6943
+ return _extends$v.apply(this, arguments);
6896
6944
  }
6897
6945
 
6898
6946
  function _taggedTemplateLiteralLoose(strings, raw) {
@@ -6982,7 +7030,7 @@ var clearFromRemoveQueue = function clearFromRemoveQueue(toastId) {
6982
7030
  var reducer = function reducer(state, action) {
6983
7031
  switch (action.type) {
6984
7032
  case ActionType.ADD_TOAST:
6985
- return _extends$u({}, state, {
7033
+ return _extends$v({}, state, {
6986
7034
  toasts: [action.toast].concat(state.toasts).slice(0, TOAST_LIMIT)
6987
7035
  });
6988
7036
 
@@ -6992,9 +7040,9 @@ var reducer = function reducer(state, action) {
6992
7040
  clearFromRemoveQueue(action.toast.id);
6993
7041
  }
6994
7042
 
6995
- return _extends$u({}, state, {
7043
+ return _extends$v({}, state, {
6996
7044
  toasts: state.toasts.map(function (t) {
6997
- return t.id === action.toast.id ? _extends$u({}, t, action.toast) : t;
7045
+ return t.id === action.toast.id ? _extends$v({}, t, action.toast) : t;
6998
7046
  })
6999
7047
  });
7000
7048
 
@@ -7021,9 +7069,9 @@ var reducer = function reducer(state, action) {
7021
7069
  });
7022
7070
  }
7023
7071
 
7024
- return _extends$u({}, state, {
7072
+ return _extends$v({}, state, {
7025
7073
  toasts: state.toasts.map(function (t) {
7026
- return t.id === toastId || toastId === undefined ? _extends$u({}, t, {
7074
+ return t.id === toastId || toastId === undefined ? _extends$v({}, t, {
7027
7075
  visible: false
7028
7076
  }) : t;
7029
7077
  })
@@ -7031,28 +7079,28 @@ var reducer = function reducer(state, action) {
7031
7079
 
7032
7080
  case ActionType.REMOVE_TOAST:
7033
7081
  if (action.toastId === undefined) {
7034
- return _extends$u({}, state, {
7082
+ return _extends$v({}, state, {
7035
7083
  toasts: []
7036
7084
  });
7037
7085
  }
7038
7086
 
7039
- return _extends$u({}, state, {
7087
+ return _extends$v({}, state, {
7040
7088
  toasts: state.toasts.filter(function (t) {
7041
7089
  return t.id !== action.toastId;
7042
7090
  })
7043
7091
  });
7044
7092
 
7045
7093
  case ActionType.START_PAUSE:
7046
- return _extends$u({}, state, {
7094
+ return _extends$v({}, state, {
7047
7095
  pausedAt: action.time
7048
7096
  });
7049
7097
 
7050
7098
  case ActionType.END_PAUSE:
7051
7099
  var diff = action.time - (state.pausedAt || 0);
7052
- return _extends$u({}, state, {
7100
+ return _extends$v({}, state, {
7053
7101
  pausedAt: undefined,
7054
7102
  toasts: state.toasts.map(function (t) {
7055
- return _extends$u({}, t, {
7103
+ return _extends$v({}, t, {
7056
7104
  pauseDuration: t.pauseDuration + diff
7057
7105
  });
7058
7106
  })
@@ -7099,12 +7147,12 @@ var useStore = function useStore(toastOptions) {
7099
7147
  var mergedToasts = state.toasts.map(function (t) {
7100
7148
  var _toastOptions$t$type, _toastOptions, _toastOptions$t$type2;
7101
7149
 
7102
- return _extends$u({}, toastOptions, toastOptions[t.type], t, {
7150
+ return _extends$v({}, toastOptions, toastOptions[t.type], t, {
7103
7151
  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],
7104
- style: _extends$u({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7152
+ style: _extends$v({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7105
7153
  });
7106
7154
  });
7107
- return _extends$u({}, state, {
7155
+ return _extends$v({}, state, {
7108
7156
  toasts: mergedToasts
7109
7157
  });
7110
7158
  };
@@ -7114,7 +7162,7 @@ var createToast = function createToast(message, type, opts) {
7114
7162
  type = 'blank';
7115
7163
  }
7116
7164
 
7117
- return _extends$u({
7165
+ return _extends$v({
7118
7166
  createdAt: Date.now(),
7119
7167
  visible: true,
7120
7168
  type: type,
@@ -7164,14 +7212,14 @@ toast.remove = function (toastId) {
7164
7212
  };
7165
7213
 
7166
7214
  toast.promise = function (promise, msgs, opts) {
7167
- var id = toast.loading(msgs.loading, _extends$u({}, opts, opts == null ? void 0 : opts.loading));
7215
+ var id = toast.loading(msgs.loading, _extends$v({}, opts, opts == null ? void 0 : opts.loading));
7168
7216
  promise.then(function (p) {
7169
- toast.success(resolveValue(msgs.success, p), _extends$u({
7217
+ toast.success(resolveValue(msgs.success, p), _extends$v({
7170
7218
  id: id
7171
7219
  }, opts, opts == null ? void 0 : opts.success));
7172
7220
  return p;
7173
7221
  })["catch"](function (e) {
7174
- toast.error(resolveValue(msgs.error, e), _extends$u({
7222
+ toast.error(resolveValue(msgs.error, e), _extends$v({
7175
7223
  id: id
7176
7224
  }, opts, opts == null ? void 0 : opts.error));
7177
7225
  });
@@ -7510,7 +7558,7 @@ var ToastBar = /*#__PURE__*/React.memo(function (_ref2) {
7510
7558
  var message = React.createElement(Message, Object.assign({}, toast.ariaProps), resolveValue(toast.message, toast));
7511
7559
  return React.createElement(ToastBarBase, {
7512
7560
  className: toast.className,
7513
- style: _extends$u({}, animationStyle, style, toast.style)
7561
+ style: _extends$v({}, animationStyle, style, toast.style)
7514
7562
  }, typeof children === 'function' ? children({
7515
7563
  icon: icon,
7516
7564
  message: message
@@ -7540,7 +7588,7 @@ var getPositionStyle = function getPositionStyle(position, offset) {
7540
7588
  } : position.includes('right') ? {
7541
7589
  justifyContent: 'flex-end'
7542
7590
  } : {};
7543
- return _extends$u({
7591
+ return _extends$v({
7544
7592
  left: 0,
7545
7593
  right: 0,
7546
7594
  display: 'flex',
@@ -7567,7 +7615,7 @@ var Toaster = function Toaster(_ref) {
7567
7615
  handlers = _useToaster.handlers;
7568
7616
 
7569
7617
  return React.createElement("div", {
7570
- style: _extends$u({
7618
+ style: _extends$v({
7571
7619
  position: 'fixed',
7572
7620
  zIndex: 9999,
7573
7621
  top: DEFAULT_OFFSET,
@@ -7602,82 +7650,82 @@ var Toaster = function Toaster(_ref) {
7602
7650
  }));
7603
7651
  };
7604
7652
 
7605
- var _path$r;
7653
+ var _path$s;
7606
7654
 
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); }
7655
+ function _extends$u() { _extends$u = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
7608
7656
 
7609
7657
  function SvgCheckSolid(props) {
7610
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
7658
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$u({
7611
7659
  xmlns: "http://www.w3.org/2000/svg",
7612
7660
  className: "h-5 w-5",
7613
7661
  viewBox: "0 0 20 20",
7614
7662
  fill: "currentColor"
7615
- }, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
7663
+ }, props), _path$s || (_path$s = /*#__PURE__*/React__namespace.createElement("path", {
7616
7664
  fillRule: "evenodd",
7617
7665
  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",
7618
7666
  clipRule: "evenodd"
7619
7667
  })));
7620
7668
  }
7621
7669
 
7622
- var _path$q;
7670
+ var _path$r;
7623
7671
 
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); }
7672
+ 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); }
7625
7673
 
7626
7674
  function SvgXIcon(props) {
7627
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
7675
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
7628
7676
  xmlns: "http://www.w3.org/2000/svg",
7629
7677
  viewBox: "0 0 20 20",
7630
7678
  fill: "currentColor"
7631
- }, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
7679
+ }, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
7632
7680
  fill: "evenodd",
7633
7681
  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",
7634
7682
  clipRule: "evenodd"
7635
7683
  })));
7636
7684
  }
7637
7685
 
7638
- var _path$p;
7686
+ var _path$q;
7639
7687
 
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); }
7688
+ 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); }
7641
7689
 
7642
7690
  function SvgXIconSolid(props) {
7643
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
7691
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
7644
7692
  className: "plc-w-4 plc-h-4",
7645
7693
  fill: "currentColor",
7646
7694
  xmlns: "http://www.w3.org/2000/svg",
7647
7695
  viewBox: "0 0 100 100"
7648
- }, props), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
7696
+ }, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
7649
7697
  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"
7650
7698
  })));
7651
7699
  }
7652
7700
 
7653
- var _path$o;
7701
+ var _path$p;
7654
7702
 
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); }
7703
+ 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); }
7656
7704
 
7657
7705
  function SvgExclamation(props) {
7658
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
7706
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
7659
7707
  className: "plc-w-4 plc-h-4 plc-mr-1",
7660
7708
  xmlns: "http://www.w3.org/2000/svg",
7661
7709
  viewBox: "0 0 20 20",
7662
7710
  fill: "currentColor"
7663
- }, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
7711
+ }, props), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
7664
7712
  fillRule: "evenodd",
7665
7713
  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",
7666
7714
  clipRule: "evenodd"
7667
7715
  })));
7668
7716
  }
7669
7717
 
7670
- var _path$n, _path2$3;
7718
+ var _path$o, _path2$3;
7671
7719
 
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); }
7720
+ 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); }
7673
7721
 
7674
7722
  function SvgSpinner(props) {
7675
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
7723
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
7676
7724
  className: "plc-animate-spin",
7677
7725
  viewBox: "0 0 24 24",
7678
7726
  fill: "currentColor",
7679
7727
  xmlns: "http://www.w3.org/2000/svg"
7680
- }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
7728
+ }, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
7681
7729
  opacity: 0.2,
7682
7730
  fill: "evenodd",
7683
7731
  clipRule: "evenodd",
@@ -8238,6 +8286,175 @@ function shouldBlurContent(entitlements) {
8238
8286
  return entitlements.every(entitlement => !window.Pelcro.user.isEntitledTo(entitlement));
8239
8287
  }
8240
8288
 
8289
+ var pure$1 = createCommonjsModule(function (module, exports) {
8290
+
8291
+ Object.defineProperty(exports, '__esModule', { value: true });
8292
+
8293
+ function _typeof(obj) {
8294
+ "@babel/helpers - typeof";
8295
+
8296
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
8297
+ _typeof = function (obj) {
8298
+ return typeof obj;
8299
+ };
8300
+ } else {
8301
+ _typeof = function (obj) {
8302
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
8303
+ };
8304
+ }
8305
+
8306
+ return _typeof(obj);
8307
+ }
8308
+
8309
+ var V3_URL = 'https://js.stripe.com/v3';
8310
+ var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
8311
+ 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';
8312
+ var findScript = function findScript() {
8313
+ var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
8314
+
8315
+ for (var i = 0; i < scripts.length; i++) {
8316
+ var script = scripts[i];
8317
+
8318
+ if (!V3_URL_REGEX.test(script.src)) {
8319
+ continue;
8320
+ }
8321
+
8322
+ return script;
8323
+ }
8324
+
8325
+ return null;
8326
+ };
8327
+
8328
+ var injectScript = function injectScript(params) {
8329
+ var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
8330
+ var script = document.createElement('script');
8331
+ script.src = "".concat(V3_URL).concat(queryString);
8332
+ var headOrBody = document.head || document.body;
8333
+
8334
+ if (!headOrBody) {
8335
+ throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
8336
+ }
8337
+
8338
+ headOrBody.appendChild(script);
8339
+ return script;
8340
+ };
8341
+
8342
+ var registerWrapper = function registerWrapper(stripe, startTime) {
8343
+ if (!stripe || !stripe._registerWrapper) {
8344
+ return;
8345
+ }
8346
+
8347
+ stripe._registerWrapper({
8348
+ name: 'stripe-js',
8349
+ version: "1.21.1",
8350
+ startTime: startTime
8351
+ });
8352
+ };
8353
+
8354
+ var stripePromise = null;
8355
+ var loadScript = function loadScript(params) {
8356
+ // Ensure that we only attempt to load Stripe.js at most once
8357
+ if (stripePromise !== null) {
8358
+ return stripePromise;
8359
+ }
8360
+
8361
+ stripePromise = new Promise(function (resolve, reject) {
8362
+ if (typeof window === 'undefined') {
8363
+ // Resolve to null when imported server side. This makes the module
8364
+ // safe to import in an isomorphic code base.
8365
+ resolve(null);
8366
+ return;
8367
+ }
8368
+
8369
+ if (window.Stripe && params) {
8370
+ console.warn(EXISTING_SCRIPT_MESSAGE);
8371
+ }
8372
+
8373
+ if (window.Stripe) {
8374
+ resolve(window.Stripe);
8375
+ return;
8376
+ }
8377
+
8378
+ try {
8379
+ var script = findScript();
8380
+
8381
+ if (script && params) {
8382
+ console.warn(EXISTING_SCRIPT_MESSAGE);
8383
+ } else if (!script) {
8384
+ script = injectScript(params);
8385
+ }
8386
+
8387
+ script.addEventListener('load', function () {
8388
+ if (window.Stripe) {
8389
+ resolve(window.Stripe);
8390
+ } else {
8391
+ reject(new Error('Stripe.js not available'));
8392
+ }
8393
+ });
8394
+ script.addEventListener('error', function () {
8395
+ reject(new Error('Failed to load Stripe.js'));
8396
+ });
8397
+ } catch (error) {
8398
+ reject(error);
8399
+ return;
8400
+ }
8401
+ });
8402
+ return stripePromise;
8403
+ };
8404
+ var initStripe = function initStripe(maybeStripe, args, startTime) {
8405
+ if (maybeStripe === null) {
8406
+ return null;
8407
+ }
8408
+
8409
+ var stripe = maybeStripe.apply(undefined, args);
8410
+ registerWrapper(stripe, startTime);
8411
+ return stripe;
8412
+ };
8413
+ var validateLoadParams = function validateLoadParams(params) {
8414
+ var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
8415
+
8416
+ if (params === null || _typeof(params) !== 'object') {
8417
+ throw new Error(errorMessage);
8418
+ }
8419
+
8420
+ if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === 'boolean') {
8421
+ return params;
8422
+ }
8423
+
8424
+ throw new Error(errorMessage);
8425
+ };
8426
+
8427
+ var loadParams;
8428
+ var loadStripeCalled = false;
8429
+ var loadStripe = function loadStripe() {
8430
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8431
+ args[_key] = arguments[_key];
8432
+ }
8433
+
8434
+ loadStripeCalled = true;
8435
+ var startTime = Date.now();
8436
+ return loadScript(loadParams).then(function (maybeStripe) {
8437
+ return initStripe(maybeStripe, args, startTime);
8438
+ });
8439
+ };
8440
+
8441
+ loadStripe.setLoadParameters = function (params) {
8442
+ if (loadStripeCalled) {
8443
+ throw new Error('You cannot change load parameters after calling loadStripe');
8444
+ }
8445
+
8446
+ loadParams = validateLoadParams(params);
8447
+ };
8448
+
8449
+ exports.loadStripe = loadStripe;
8450
+ });
8451
+
8452
+ unwrapExports(pure$1);
8453
+ pure$1.loadStripe;
8454
+
8455
+ var pure = pure$1;
8456
+ var pure_1 = pure.loadStripe;
8457
+
8241
8458
  /**
8242
8459
  * @typedef {Object} OptionsType
8243
8460
  * @property {boolean} loadPaymentSDKs
@@ -8263,6 +8480,7 @@ const optionsController = options => {
8263
8480
  enableURLTriggers: initViewFromURL,
8264
8481
  enableTheme: applyPelcroTheme,
8265
8482
  enablePaywalls: initPaywalls,
8483
+ loadSecuritySDK: initSecuritySdk,
8266
8484
  enableGoogleAnalytics: initGATracking
8267
8485
  }; // Only execute enabled options
8268
8486
 
@@ -8307,8 +8525,15 @@ const initPaywalls = () => {
8307
8525
  }
8308
8526
  };
8309
8527
  const loadPaymentSDKs = () => {
8310
- // Load stripe's SDK
8311
- window.Pelcro.helpers.loadSDK("https://js.stripe.com/v3/", "pelcro-sdk-stripe-id"); // Load PayPal SDK's
8528
+ // Lazy load stripe's SDK
8529
+ const {
8530
+ whenUserReady
8531
+ } = usePelcro.getStore();
8532
+ whenUserReady(() => {
8533
+ if (!window.Stripe) {
8534
+ pure_1(window.Pelcro.environment.stripe);
8535
+ }
8536
+ }); // Load PayPal SDK's
8312
8537
 
8313
8538
  const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
8314
8539
 
@@ -8317,6 +8542,18 @@ const loadPaymentSDKs = () => {
8317
8542
  window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.69.0/js/paypal-checkout.min.js", "braintree-paypal-sdk");
8318
8543
  }
8319
8544
  };
8545
+ const initSecuritySdk = () => {
8546
+ const {
8547
+ whenSiteReady
8548
+ } = usePelcro.getStore();
8549
+ whenSiteReady(() => {
8550
+ var _window$Pelcro$site$r2;
8551
+
8552
+ const securityKey = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.security_key;
8553
+ if (!securityKey) return;
8554
+ window.Pelcro.helpers.loadSDK(`https://www.google.com/recaptcha/enterprise.js?render=${securityKey}`, "pelcro-security-enteprise");
8555
+ });
8556
+ };
8320
8557
  const initGATracking = () => {
8321
8558
  var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
8322
8559
 
@@ -8403,9 +8640,9 @@ const applyPelcroTheme = () => {
8403
8640
  };
8404
8641
 
8405
8642
  whenSiteReady(() => {
8406
- var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
8643
+ var _window$Pelcro$site$r3, _window$Pelcro$site$r4;
8407
8644
 
8408
- const primaryColorHex = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : (_window$Pelcro$site$r3 = _window$Pelcro$site$r2.design_settings) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.primary_color;
8645
+ const primaryColorHex = (_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : (_window$Pelcro$site$r4 = _window$Pelcro$site$r3.design_settings) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.primary_color;
8409
8646
 
8410
8647
  if (!primaryColorHex) {
8411
8648
  return;
@@ -8604,6 +8841,7 @@ const defaultOptions = {
8604
8841
  enableURLTriggers: true,
8605
8842
  enableTheme: true,
8606
8843
  enablePaywalls: true,
8844
+ loadSecuritySDK: true,
8607
8845
  enableGoogleAnalytics: false
8608
8846
  };
8609
8847
  const PelcroModalController = ({
@@ -9425,16 +9663,16 @@ const LoginPassword = props => /*#__PURE__*/React__default['default'].createElem
9425
9663
  store: store$f
9426
9664
  }, props));
9427
9665
 
9428
- var _path$m;
9666
+ var _path$n;
9429
9667
 
9430
- 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); }
9668
+ 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); }
9431
9669
 
9432
9670
  function SvgCheck(props) {
9433
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
9671
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
9434
9672
  xmlns: "http://www.w3.org/2000/svg",
9435
9673
  fill: "currentColor",
9436
9674
  viewBox: "0 0 20 20"
9437
- }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
9675
+ }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
9438
9676
  fillRule: "evenodd",
9439
9677
  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",
9440
9678
  clipRule: "evenodd"
@@ -9544,35 +9782,53 @@ const RegisterContainer = ({
9544
9782
  jobTitle,
9545
9783
  selectFields
9546
9784
  } = filteredData;
9547
- window.Pelcro.user.register({
9548
- email,
9549
- password,
9550
- first_name: firstName,
9551
- last_name: lastName,
9552
- metadata: {
9553
- organization,
9554
- jobTitle,
9555
- ...selectFields
9556
- }
9557
- }, (err, res) => {
9558
- dispatch({
9559
- type: DISABLE_REGISTRATION_BUTTON,
9560
- payload: false
9785
+
9786
+ if (!hasSecurityTokenEnabled()) {
9787
+ sendRegisterRequest();
9788
+ return;
9789
+ }
9790
+
9791
+ window.grecaptcha.enterprise.ready(async () => {
9792
+ var _window$Pelcro$site$r;
9793
+
9794
+ const token = await window.grecaptcha.enterprise.execute((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.security_key, {
9795
+ action: "register"
9561
9796
  });
9797
+ sendRegisterRequest(token);
9798
+ });
9562
9799
 
9563
- if (err) {
9800
+ function sendRegisterRequest(securityToken) {
9801
+ window.Pelcro.user.register({
9802
+ email,
9803
+ password,
9804
+ first_name: firstName,
9805
+ last_name: lastName,
9806
+ security_token: securityToken,
9807
+ metadata: {
9808
+ organization,
9809
+ jobTitle,
9810
+ ...selectFields
9811
+ }
9812
+ }, (err, res) => {
9564
9813
  dispatch({
9565
- type: SHOW_ALERT,
9566
- payload: {
9567
- type: "error",
9568
- content: getErrorMessages(err)
9569
- }
9814
+ type: DISABLE_REGISTRATION_BUTTON,
9815
+ payload: false
9570
9816
  });
9571
- onFailure(err);
9572
- } else {
9573
- onSuccess(res);
9574
- }
9575
- });
9817
+
9818
+ if (err) {
9819
+ dispatch({
9820
+ type: SHOW_ALERT,
9821
+ payload: {
9822
+ type: "error",
9823
+ content: getErrorMessages(err)
9824
+ }
9825
+ });
9826
+ onFailure(err);
9827
+ } else {
9828
+ onSuccess(res);
9829
+ }
9830
+ });
9831
+ }
9576
9832
  };
9577
9833
 
9578
9834
  const handleSocialLogin = ({
@@ -9723,16 +9979,25 @@ const RegisterContainer = ({
9723
9979
  store: store$e
9724
9980
  })));
9725
9981
  };
9982
+ /**
9983
+ * Checks if the current site has security token enabled
9984
+ * @return {boolean}
9985
+ */
9726
9986
 
9727
- var _path$l;
9987
+ function hasSecurityTokenEnabled() {
9988
+ const hasSecuritySdkLoaded = Boolean(window.grecaptcha);
9989
+ return hasSecuritySdkLoaded;
9990
+ }
9728
9991
 
9729
- 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); }
9992
+ var _path$m;
9993
+
9994
+ 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); }
9730
9995
 
9731
9996
  function SvgFacebookLogo(props) {
9732
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
9997
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
9733
9998
  xmlns: "http://www.w3.org/2000/svg",
9734
9999
  viewBox: "88.428 12.828 107.543 207.085"
9735
- }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
10000
+ }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
9736
10001
  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",
9737
10002
  fill: "#3c5a9a"
9738
10003
  })));
@@ -9744,7 +10009,7 @@ const FacebookLoginButton = ({
9744
10009
  labelClassName = "",
9745
10010
  iconClassName = ""
9746
10011
  }) => {
9747
- var _window$Pelcro$site$r, _window$Pelcro$site$r2;
10012
+ var _window$Pelcro$site$r;
9748
10013
 
9749
10014
  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;
9750
10015
  const {
@@ -9783,7 +10048,7 @@ const FacebookLoginButton = ({
9783
10048
 
9784
10049
  return facebookLoginEnabled ? /*#__PURE__*/React__default['default'].createElement(FacebookLogin, {
9785
10050
  appId: window.Pelcro.site.read().facebook_app_id,
9786
- language: (_window$Pelcro$site$r2 = window.Pelcro.site.read().default_locale) !== null && _window$Pelcro$site$r2 !== void 0 ? _window$Pelcro$site$r2 : "en_US",
10051
+ language: getPageOrDefaultLanguage(),
9787
10052
  fields: "first_name,last_name,email,picture",
9788
10053
  callback: onSuccess,
9789
10054
  onFailure: onFailure,
@@ -9805,15 +10070,15 @@ var googleLogin = createCommonjsModule(function (module, exports) {
9805
10070
  unwrapExports(googleLogin);
9806
10071
  var googleLogin_1 = googleLogin.GoogleLogin;
9807
10072
 
9808
- var _path$k, _path2$2, _path3$1, _path4;
10073
+ var _path$l, _path2$2, _path3$1, _path4;
9809
10074
 
9810
- 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); }
10075
+ 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); }
9811
10076
 
9812
10077
  function SvgGoogleLogo(props) {
9813
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
10078
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
9814
10079
  viewBox: "0 0 24 24",
9815
10080
  xmlns: "http://www.w3.org/2000/svg"
9816
- }, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
10081
+ }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
9817
10082
  fill: "#4285F4",
9818
10083
  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"
9819
10084
  })), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -9947,15 +10212,15 @@ function LoginView(props) {
9947
10212
  }, /*#__PURE__*/React__default['default'].createElement(GoogleLoginButton, null), /*#__PURE__*/React__default['default'].createElement(FacebookLoginButton, null))))));
9948
10213
  }
9949
10214
 
9950
- var _path$j, _path2$1, _path3;
10215
+ var _path$k, _path2$1, _path3;
9951
10216
 
9952
- 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); }
10217
+ 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); }
9953
10218
 
9954
10219
  function SvgPelcroAuthorship(props) {
9955
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
10220
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
9956
10221
  xmlns: "http://www.w3.org/2000/svg",
9957
10222
  viewBox: "0 -80.652 497.072 179.991"
9958
- }, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
10223
+ }, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
9959
10224
  fill: "none",
9960
10225
  stroke: "#4a4a4a",
9961
10226
  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"
@@ -10112,8 +10377,11 @@ const RegisterPassword = props => /*#__PURE__*/React__default['default'].createE
10112
10377
  const RegisterButton = ({
10113
10378
  name,
10114
10379
  onClick,
10380
+ className,
10115
10381
  ...otherProps
10116
10382
  }) => {
10383
+ var _window$Pelcro$site$r;
10384
+
10117
10385
  const {
10118
10386
  state: {
10119
10387
  emailError,
@@ -10139,7 +10407,10 @@ const RegisterButton = ({
10139
10407
  onClick === null || onClick === void 0 ? void 0 : onClick();
10140
10408
  },
10141
10409
  disabled: isDisabled,
10142
- isLoading: buttonDisabled
10410
+ isLoading: buttonDisabled,
10411
+ className: `${className} g-recaptcha`,
10412
+ "data-action": "register",
10413
+ "data-sitekey": (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.security_key
10143
10414
  }, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
10144
10415
  };
10145
10416
 
@@ -13313,11 +13584,20 @@ const PaymentMethodContainerWithoutStripe = ({
13313
13584
  const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
13314
13585
 
13315
13586
  const PaymentMethodContainer = props => {
13316
- if (window.Stripe) {
13587
+ const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
13588
+ React.useEffect(() => {
13589
+ if (!window.Stripe) {
13590
+ document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
13591
+ setIsStripeLoaded(true);
13592
+ });
13593
+ }
13594
+ }, []);
13595
+
13596
+ if (isStripeLoaded) {
13317
13597
  return /*#__PURE__*/React__default['default'].createElement(es_13, {
13318
13598
  apiKey: window.Pelcro.environment.stripe,
13319
13599
  stripeAccount: window.Pelcro.site.read().account_id,
13320
- locale: getCanonicalLocaleFormat(window.Pelcro.site.read().default_locale)
13600
+ locale: getPageOrDefaultLanguage()
13321
13601
  }, /*#__PURE__*/React__default['default'].createElement(es_11, null, /*#__PURE__*/React__default['default'].createElement(UnwrappedForm, Object.assign({
13322
13602
  store: store$d
13323
13603
  }, props))));
@@ -13429,9 +13709,6 @@ const DiscountedPrice = props => {
13429
13709
  percentOff
13430
13710
  }
13431
13711
  } = React.useContext(store$d);
13432
- const {
13433
- default_locale
13434
- } = Pelcro.site.read();
13435
13712
  const {
13436
13713
  order,
13437
13714
  plan
@@ -13439,7 +13716,7 @@ const DiscountedPrice = props => {
13439
13716
  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;
13440
13717
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
13441
13718
  const discountedPriceWithoutTax = updatedPrice - taxAmount;
13442
- const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
13719
+ const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
13443
13720
 
13444
13721
  if (percentOff) {
13445
13722
  return /*#__PURE__*/React__default['default'].createElement("div", Object.assign({
@@ -13472,12 +13749,9 @@ const SubmitPaymentMethod = ({
13472
13749
  updatedPrice
13473
13750
  }
13474
13751
  } = React.useContext(store$d);
13475
- const {
13476
- default_locale
13477
- } = Pelcro.site.read();
13478
13752
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
13479
13753
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
13480
- const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
13754
+ const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
13481
13755
  return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
13482
13756
  role: "submit",
13483
13757
  className: "plc-w-full plc-py-3",
@@ -13495,17 +13769,17 @@ const SubmitPaymentMethod = ({
13495
13769
  }, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
13496
13770
  };
13497
13771
 
13498
- var _path$i;
13772
+ var _path$j;
13499
13773
 
13500
- 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); }
13774
+ 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); }
13501
13775
 
13502
13776
  function SvgArrowLeft(props) {
13503
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
13777
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
13504
13778
  xmlns: "http://www.w3.org/2000/svg",
13505
13779
  fill: "none",
13506
13780
  viewBox: "0 0 24 24",
13507
13781
  stroke: "currentColor"
13508
- }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
13782
+ }, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
13509
13783
  strokeLinecap: "round",
13510
13784
  strokeLinejoin: "round",
13511
13785
  strokeWidth: 2,
@@ -13587,17 +13861,17 @@ const CouponCodeField = props => {
13587
13861
  }, props));
13588
13862
  };
13589
13863
 
13590
- var _path$h;
13864
+ var _path$i;
13591
13865
 
13592
- 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); }
13866
+ 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); }
13593
13867
 
13594
13868
  function SvgTicket(props) {
13595
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
13869
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
13596
13870
  xmlns: "http://www.w3.org/2000/svg",
13597
13871
  fill: "none",
13598
13872
  viewBox: "0 0 24 24",
13599
13873
  stroke: "currentColor"
13600
- }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
13874
+ }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
13601
13875
  strokeLinecap: "round",
13602
13876
  strokeLinejoin: "round",
13603
13877
  strokeWidth: 2,
@@ -13722,7 +13996,7 @@ class PaypalClient {
13722
13996
  this.paypalButton = window.paypal.Buttons({
13723
13997
  fundingSource: window.paypal.FUNDING.PAYPAL,
13724
13998
  // button locale
13725
- locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale : this.siteInfo.default_locale,
13999
+ locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale : getPageOrDefaultLanguage(),
13726
14000
  // button style
13727
14001
  style: (_this$config$style = this.config.style) !== null && _this$config$style !== void 0 ? _this$config$style : defaultButtonStyle,
13728
14002
  // create payment handler
@@ -13819,7 +14093,7 @@ class PaypalClient {
13819
14093
  } : undefined,
13820
14094
  shippingAddressEditable: this.config.shippingAddressEditable,
13821
14095
  displayName: (_this$config$displayN = this.config.displayName) !== null && _this$config$displayN !== void 0 ? _this$config$displayN : this.siteInfo.name,
13822
- locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 : this.siteInfo.default_locale
14096
+ locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 : getPageOrDefaultLanguage()
13823
14097
  };
13824
14098
  }
13825
14099
  });
@@ -13828,7 +14102,7 @@ class PaypalClient {
13828
14102
  writable: true,
13829
14103
  value: () => {
13830
14104
  const totalAmount = (this.product.quantity || 1) * this.amount;
13831
- const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency, this.siteInfo.default_locale);
14105
+ const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency, getPageOrDefaultLanguage());
13832
14106
  const autoRenewed = this.product.auto_renew;
13833
14107
  const {
13834
14108
  interval,
@@ -13956,16 +14230,16 @@ const BankRedirection = () => {
13956
14230
  }));
13957
14231
  };
13958
14232
 
13959
- var _path$g;
14233
+ var _path$h;
13960
14234
 
13961
- 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); }
14235
+ 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); }
13962
14236
 
13963
14237
  function SvgLock(props) {
13964
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
14238
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
13965
14239
  xmlns: "http://www.w3.org/2000/svg",
13966
14240
  viewBox: "0 0 20 20",
13967
14241
  fill: "currentColor"
13968
- }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
14242
+ }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
13969
14243
  fillRule: "evenodd",
13970
14244
  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",
13971
14245
  clipRule: "evenodd"
@@ -14025,14 +14299,11 @@ const TaxAmount = () => {
14025
14299
  taxAmount
14026
14300
  }
14027
14301
  } = React.useContext(store$d);
14028
- const {
14029
- default_locale
14030
- } = Pelcro.site.read();
14031
14302
  const {
14032
14303
  plan
14033
14304
  } = usePelcro();
14034
14305
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
14035
- const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
14306
+ const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
14036
14307
 
14037
14308
  if (taxAmount) {
14038
14309
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -14190,12 +14461,12 @@ function SubscriptionRenewModal({
14190
14461
  }
14191
14462
  SubscriptionRenewModal.viewId = "subscription-renew";
14192
14463
 
14193
- var _path$f;
14464
+ var _path$g;
14194
14465
 
14195
- 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); }
14466
+ 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); }
14196
14467
 
14197
14468
  function SvgGift(props) {
14198
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
14469
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
14199
14470
  className: "plc-w-6 plc-h-6 plc-mr-2",
14200
14471
  fill: "none",
14201
14472
  stroke: "currentColor",
@@ -14204,7 +14475,7 @@ function SvgGift(props) {
14204
14475
  strokeWidth: 2,
14205
14476
  viewBox: "0 0 24 24",
14206
14477
  xmlns: "http://www.w3.org/2000/svg"
14207
- }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
14478
+ }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
14208
14479
  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"
14209
14480
  })));
14210
14481
  }
@@ -14905,10 +15176,7 @@ const SubscriptionCreateView = ({
14905
15176
  interval,
14906
15177
  count: interval_count
14907
15178
  });
14908
- const {
14909
- default_locale
14910
- } = Pelcro.site.read();
14911
- const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
15179
+ const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
14912
15180
  return /*#__PURE__*/React__default['default'].createElement("p", {
14913
15181
  className: "plc-text-gray-600"
14914
15182
  }, /*#__PURE__*/React__default['default'].createElement("span", {
@@ -15208,17 +15476,17 @@ const UserUpdatePhone = props => /*#__PURE__*/React__default['default'].createEl
15208
15476
 
15209
15477
  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";
15210
15478
 
15211
- var _path$e;
15479
+ var _path$f;
15212
15480
 
15213
- 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); }
15481
+ 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); }
15214
15482
 
15215
15483
  function SvgEdit(props) {
15216
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
15484
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
15217
15485
  className: "plc-w-6 plc-h-6",
15218
15486
  xmlns: "http://www.w3.org/2000/svg",
15219
15487
  viewBox: "0 0 20 20",
15220
15488
  fill: "currentColor"
15221
- }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
15489
+ }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
15222
15490
  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"
15223
15491
  })));
15224
15492
  }
@@ -18085,7 +18353,6 @@ const OrderConfirmModal = props => {
18085
18353
  const userOrders = window.Pelcro.user.read().orders;
18086
18354
  const latestOrder = userOrders === null || userOrders === void 0 ? void 0 : userOrders[userOrders.length - 1];
18087
18355
  const latestOrderDiscount = latestOrder === null || latestOrder === void 0 ? void 0 : (_latestOrder$coupon = latestOrder.coupon) === null || _latestOrder$coupon === void 0 ? void 0 : _latestOrder$coupon.percent_off;
18088
- const locale = window.Pelcro.site.read().default_locale;
18089
18356
  const {
18090
18357
  t
18091
18358
  } = useTranslation("shop");
@@ -18144,7 +18411,7 @@ const OrderConfirmModal = props => {
18144
18411
  className: "plc-mr-1 pelcro-summary-total-text"
18145
18412
  }, t("labels.total")), /*#__PURE__*/React__default['default'].createElement("p", {
18146
18413
  className: "pelcro-summary-total"
18147
- }, latestOrderDiscount && `(-${latestOrderDiscount}%) `, getFormattedPriceByLocal(latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.amount, latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.currency, locale)))), /*#__PURE__*/React__default['default'].createElement("div", {
18414
+ }, latestOrderDiscount && `(-${latestOrderDiscount}%) `, getFormattedPriceByLocal(latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.amount, latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default['default'].createElement("div", {
18148
18415
  className: "plc-flex plc-justify-center plc-mt-6"
18149
18416
  }, /*#__PURE__*/React__default['default'].createElement(Button, {
18150
18417
  id: "pelcro-submit",
@@ -18206,9 +18473,9 @@ const GiftCreateContainer = ({
18206
18473
  }
18207
18474
 
18208
18475
  if (giftRecipient.startDate) {
18209
- const nowDate = new Date();
18210
- const yearFromNowDate = new Date(new Date().setFullYear(nowDate.getFullYear() + 1));
18211
- const submittedDate = new Date(giftRecipient.startDate);
18476
+ const nowDate = getDateWithoutTime(new Date());
18477
+ const yearFromNowDate = getDateWithoutTime(new Date(new Date().setFullYear(nowDate.getFullYear() + 1)));
18478
+ const submittedDate = getDateWithoutTime(new Date(giftRecipient.startDate));
18212
18479
 
18213
18480
  if (submittedDate < nowDate || submittedDate > yearFromNowDate) {
18214
18481
  dispatch({
@@ -18329,18 +18596,18 @@ const GiftCreateLastName = props => /*#__PURE__*/React__default['default'].creat
18329
18596
  store: store$4
18330
18597
  }, props));
18331
18598
 
18332
- var _path$d;
18599
+ var _path$e;
18333
18600
 
18334
- 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); }
18601
+ 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); }
18335
18602
 
18336
18603
  function SvgInfoCircle(props) {
18337
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
18604
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
18338
18605
  xmlns: "http://www.w3.org/2000/svg",
18339
18606
  className: "plc-w-5 plc-h-5",
18340
18607
  fill: "none",
18341
18608
  viewBox: "0 0 24 24",
18342
18609
  stroke: "currentColor"
18343
- }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
18610
+ }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
18344
18611
  strokeLinecap: "round",
18345
18612
  strokeLinejoin: "round",
18346
18613
  strokeWidth: 2,
@@ -19327,8 +19594,8 @@ const PaymentMethodSelectModal = ({
19327
19594
  };
19328
19595
  PaymentMethodSelectModal.viewId = "payment-method-select";
19329
19596
 
19330
- function _extends$e() {
19331
- _extends$e = Object.assign || function (target) {
19597
+ function _extends$f() {
19598
+ _extends$f = Object.assign || function (target) {
19332
19599
  for (var i = 1; i < arguments.length; i++) {
19333
19600
  var source = arguments[i];
19334
19601
 
@@ -19342,7 +19609,7 @@ function _extends$e() {
19342
19609
  return target;
19343
19610
  };
19344
19611
 
19345
- return _extends$e.apply(this, arguments);
19612
+ return _extends$f.apply(this, arguments);
19346
19613
  }
19347
19614
 
19348
19615
  function _objectWithoutPropertiesLoose(source, excluded) {
@@ -19526,7 +19793,7 @@ function render(props, propsBag, defaultTag, features, visible) {
19526
19793
  return match(strategy, (_match = {}, _match[RenderStrategy.Unmount] = function () {
19527
19794
  return null;
19528
19795
  }, _match[RenderStrategy.Hidden] = function () {
19529
- return _render(_extends$e({}, _rest, {
19796
+ return _render(_extends$f({}, _rest, {
19530
19797
  hidden: true,
19531
19798
  style: {
19532
19799
  display: 'none'
@@ -20054,7 +20321,7 @@ function TransitionChild(props) {
20054
20321
  var passthroughProps = rest;
20055
20322
  return React__default['default'].createElement(NestingContext.Provider, {
20056
20323
  value: nesting
20057
- }, render(_extends$e({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
20324
+ }, render(_extends$f({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
20058
20325
  }
20059
20326
 
20060
20327
  function Transition(props) {
@@ -20098,7 +20365,7 @@ function Transition(props) {
20098
20365
  value: nestingBag
20099
20366
  }, React__default['default'].createElement(TransitionContext.Provider, {
20100
20367
  value: transitionBag
20101
- }, render(_extends$e({}, sharedProps, {
20368
+ }, render(_extends$f({}, sharedProps, {
20102
20369
  as: React.Fragment,
20103
20370
  children: React__default['default'].createElement(TransitionChild, Object.assign({}, sharedProps, passthroughProps))
20104
20371
  }), propsBag, React.Fragment, TransitionChildRenderFeatures, state === TreeStates.Visible)));
@@ -20225,12 +20492,12 @@ var ActionTypes;
20225
20492
  })(ActionTypes || (ActionTypes = {}));
20226
20493
 
20227
20494
  (_reducers = {}, _reducers[ActionTypes.CloseMenu] = function (state) {
20228
- return _extends$e({}, state, {
20495
+ return _extends$f({}, state, {
20229
20496
  activeItemIndex: null,
20230
20497
  menuState: MenuStates.Closed
20231
20498
  });
20232
20499
  }, _reducers[ActionTypes.OpenMenu] = function (state) {
20233
- return _extends$e({}, state, {
20500
+ return _extends$f({}, state, {
20234
20501
  menuState: MenuStates.Open
20235
20502
  });
20236
20503
  }, _reducers[ActionTypes.GoToItem] = function (state, action) {
@@ -20249,7 +20516,7 @@ var ActionTypes;
20249
20516
  }
20250
20517
  });
20251
20518
  if (state.searchQuery === '' && state.activeItemIndex === activeItemIndex) return state;
20252
- return _extends$e({}, state, {
20519
+ return _extends$f({}, state, {
20253
20520
  searchQuery: '',
20254
20521
  activeItemIndex: activeItemIndex
20255
20522
  });
@@ -20260,19 +20527,19 @@ var ActionTypes;
20260
20527
 
20261
20528
  return ((_item$dataRef$current = item.dataRef.current.textValue) == null ? void 0 : _item$dataRef$current.startsWith(searchQuery)) && !item.dataRef.current.disabled;
20262
20529
  });
20263
- if (match === -1 || match === state.activeItemIndex) return _extends$e({}, state, {
20530
+ if (match === -1 || match === state.activeItemIndex) return _extends$f({}, state, {
20264
20531
  searchQuery: searchQuery
20265
20532
  });
20266
- return _extends$e({}, state, {
20533
+ return _extends$f({}, state, {
20267
20534
  searchQuery: searchQuery,
20268
20535
  activeItemIndex: match
20269
20536
  });
20270
20537
  }, _reducers[ActionTypes.ClearSearch] = function (state) {
20271
- return _extends$e({}, state, {
20538
+ return _extends$f({}, state, {
20272
20539
  searchQuery: ''
20273
20540
  });
20274
20541
  }, _reducers[ActionTypes.RegisterItem] = function (state, action) {
20275
- return _extends$e({}, state, {
20542
+ return _extends$f({}, state, {
20276
20543
  items: [].concat(state.items, [{
20277
20544
  id: action.id,
20278
20545
  dataRef: action.dataRef
@@ -20285,7 +20552,7 @@ var ActionTypes;
20285
20552
  return a.id === action.id;
20286
20553
  });
20287
20554
  if (idx !== -1) nextItems.splice(idx, 1);
20288
- return _extends$e({}, state, {
20555
+ return _extends$f({}, state, {
20289
20556
  items: nextItems,
20290
20557
  activeItemIndex: function () {
20291
20558
  if (idx === state.activeItemIndex) return null;
@@ -20324,19 +20591,19 @@ var ActionTypes$1;
20324
20591
  (_reducers$1 = {}, _reducers$1[ActionTypes$1.CloseListbox] = function (state) {
20325
20592
  if (state.disabled) return state;
20326
20593
  if (state.listboxState === ListboxStates.Closed) return state;
20327
- return _extends$e({}, state, {
20594
+ return _extends$f({}, state, {
20328
20595
  activeOptionIndex: null,
20329
20596
  listboxState: ListboxStates.Closed
20330
20597
  });
20331
20598
  }, _reducers$1[ActionTypes$1.OpenListbox] = function (state) {
20332
20599
  if (state.disabled) return state;
20333
20600
  if (state.listboxState === ListboxStates.Open) return state;
20334
- return _extends$e({}, state, {
20601
+ return _extends$f({}, state, {
20335
20602
  listboxState: ListboxStates.Open
20336
20603
  });
20337
20604
  }, _reducers$1[ActionTypes$1.SetDisabled] = function (state, action) {
20338
20605
  if (state.disabled === action.disabled) return state;
20339
- return _extends$e({}, state, {
20606
+ return _extends$f({}, state, {
20340
20607
  disabled: action.disabled
20341
20608
  });
20342
20609
  }, _reducers$1[ActionTypes$1.GoToOption] = function (state, action) {
@@ -20357,7 +20624,7 @@ var ActionTypes$1;
20357
20624
  }
20358
20625
  });
20359
20626
  if (state.searchQuery === '' && state.activeOptionIndex === activeOptionIndex) return state;
20360
- return _extends$e({}, state, {
20627
+ return _extends$f({}, state, {
20361
20628
  searchQuery: '',
20362
20629
  activeOptionIndex: activeOptionIndex
20363
20630
  });
@@ -20370,10 +20637,10 @@ var ActionTypes$1;
20370
20637
 
20371
20638
  return !option.dataRef.current.disabled && ((_option$dataRef$curre = option.dataRef.current.textValue) == null ? void 0 : _option$dataRef$curre.startsWith(searchQuery));
20372
20639
  });
20373
- if (match === -1 || match === state.activeOptionIndex) return _extends$e({}, state, {
20640
+ if (match === -1 || match === state.activeOptionIndex) return _extends$f({}, state, {
20374
20641
  searchQuery: searchQuery
20375
20642
  });
20376
- return _extends$e({}, state, {
20643
+ return _extends$f({}, state, {
20377
20644
  searchQuery: searchQuery,
20378
20645
  activeOptionIndex: match
20379
20646
  });
@@ -20381,11 +20648,11 @@ var ActionTypes$1;
20381
20648
  if (state.disabled) return state;
20382
20649
  if (state.listboxState === ListboxStates.Closed) return state;
20383
20650
  if (state.searchQuery === '') return state;
20384
- return _extends$e({}, state, {
20651
+ return _extends$f({}, state, {
20385
20652
  searchQuery: ''
20386
20653
  });
20387
20654
  }, _reducers$1[ActionTypes$1.RegisterOption] = function (state, action) {
20388
- return _extends$e({}, state, {
20655
+ return _extends$f({}, state, {
20389
20656
  options: [].concat(state.options, [{
20390
20657
  id: action.id,
20391
20658
  dataRef: action.dataRef
@@ -20398,7 +20665,7 @@ var ActionTypes$1;
20398
20665
  return a.id === action.id;
20399
20666
  });
20400
20667
  if (idx !== -1) nextOptions.splice(idx, 1);
20401
- return _extends$e({}, state, {
20668
+ return _extends$f({}, state, {
20402
20669
  options: nextOptions,
20403
20670
  activeOptionIndex: function () {
20404
20671
  if (idx === state.activeOptionIndex) return null;
@@ -20459,18 +20726,18 @@ const getPaymentCardIcon = name => {
20459
20726
  }));
20460
20727
  };
20461
20728
 
20462
- var _path$c;
20729
+ var _path$d;
20463
20730
 
20464
- 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); }
20731
+ 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); }
20465
20732
 
20466
20733
  function SvgChevronRight(props) {
20467
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
20734
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
20468
20735
  className: "plc-w-6 plc-h-6",
20469
20736
  xmlns: "http://www.w3.org/2000/svg",
20470
20737
  fill: "none",
20471
20738
  viewBox: "0 0 24 24",
20472
20739
  stroke: "currentColor"
20473
- }, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
20740
+ }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
20474
20741
  strokeLinecap: "round",
20475
20742
  strokeLinejoin: "round",
20476
20743
  strokeWidth: 2,
@@ -20513,7 +20780,6 @@ const OrderItems = ({
20513
20780
  const {
20514
20781
  t
20515
20782
  } = useTranslation("dashboard");
20516
- const site = window.Pelcro.site.read();
20517
20783
  return !(orders !== null && orders !== void 0 && orders.length) ? /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
20518
20784
  colSpan: "3",
20519
20785
  className: "plc-text-center plc-text-gray-500"
@@ -20529,7 +20795,7 @@ const OrderItems = ({
20529
20795
  className: "plc-py-4 plc-pl-2"
20530
20796
  }, /*#__PURE__*/React__default['default'].createElement("span", {
20531
20797
  className: "plc-text-xl plc-font-semibold "
20532
- }, getFormattedPriceByLocal(order.amount, order.currency, site.default_locale)), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
20798
+ }, getFormattedPriceByLocal(order.amount, order.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
20533
20799
  className: "plc-text-xs plc-text-gray-400 plc-uppercase"
20534
20800
  }, t("labels.orders.itemsAmount", {
20535
20801
  count: getItemsAmount(order.id)
@@ -20558,7 +20824,7 @@ const OrderItems = ({
20558
20824
  className: ""
20559
20825
  }, item.product_sku_name))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
20560
20826
  className: "plc-font-semibold"
20561
- }, getFormattedPriceByLocal(item.amount, order.currency, site.default_locale))));
20827
+ }, getFormattedPriceByLocal(item.amount, order.currency, getPageOrDefaultLanguage()))));
20562
20828
  }), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
20563
20829
  colSpan: "3"
20564
20830
  }, /*#__PURE__*/React__default['default'].createElement("hr", {
@@ -20687,6 +20953,264 @@ const SavedItems = ({
20687
20953
  });
20688
20954
  };
20689
20955
 
20956
+ var _path$c;
20957
+
20958
+ 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); }
20959
+
20960
+ function SvgRefresh(props) {
20961
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
20962
+ className: "plc-w-4 plc-h-4 plc-mr-1",
20963
+ xmlns: "http://www.w3.org/2000/svg",
20964
+ fill: "none",
20965
+ viewBox: "0 0 24 24",
20966
+ stroke: "currentColor"
20967
+ }, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
20968
+ strokeLinecap: "round",
20969
+ strokeLinejoin: "round",
20970
+ strokeWidth: 2,
20971
+ d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
20972
+ })));
20973
+ }
20974
+
20975
+ var _path$b;
20976
+
20977
+ 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); }
20978
+
20979
+ function SvgCalendar(props) {
20980
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
20981
+ xmlns: "http://www.w3.org/2000/svg",
20982
+ className: "plc-h-4 plc-w-4 plc-mr-1",
20983
+ viewBox: "0 0 20 20",
20984
+ fill: "currentColor"
20985
+ }, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
20986
+ fillRule: "evenodd",
20987
+ d: "M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",
20988
+ clipRule: "evenodd"
20989
+ })));
20990
+ }
20991
+
20992
+ var _path$a;
20993
+
20994
+ 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); }
20995
+
20996
+ function SvgPlus(props) {
20997
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
20998
+ className: "plc-w-5 plc-h-5",
20999
+ xmlns: "http://www.w3.org/2000/svg",
21000
+ fill: "none",
21001
+ viewBox: "0 0 24 24",
21002
+ stroke: "currentColor"
21003
+ }, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
21004
+ strokeLinecap: "round",
21005
+ strokeLinejoin: "round",
21006
+ strokeWidth: 2,
21007
+ d: "M12 6v6m0 0v6m0-6h6m-6 0H6"
21008
+ })));
21009
+ }
21010
+
21011
+ var _path$9;
21012
+
21013
+ 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); }
21014
+
21015
+ function SvgCheckMark(props) {
21016
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
21017
+ className: "plc-w-4 plc-h-4 plc-mr-1",
21018
+ xmlns: "http://www.w3.org/2000/svg",
21019
+ viewBox: "0 0 20 20",
21020
+ fill: "currentColor"
21021
+ }, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
21022
+ fillRule: "evenodd",
21023
+ 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",
21024
+ clipRule: "evenodd"
21025
+ })));
21026
+ }
21027
+
21028
+ const SubscriptionsMenu = props => {
21029
+ const {
21030
+ t
21031
+ } = useTranslation("dashboard");
21032
+ return /*#__PURE__*/React__default['default'].createElement("table", {
21033
+ className: "plc-w-full plc-table-fixed"
21034
+ }, /*#__PURE__*/React__default['default'].createElement("thead", {
21035
+ className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
21036
+ }, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
21037
+ className: "plc-w-3/12 "
21038
+ }, t("labels.plan")), /*#__PURE__*/React__default['default'].createElement("th", {
21039
+ className: "plc-w-4/12 "
21040
+ }, t("labels.status.title")), /*#__PURE__*/React__default['default'].createElement("th", {
21041
+ className: "plc-w-3/12 "
21042
+ }, t("labels.actions")), /*#__PURE__*/React__default['default'].createElement("th", {
21043
+ className: "plc-w-2/12 "
21044
+ }))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
21045
+ className: "plc-h-4"
21046
+ })), /*#__PURE__*/React__default['default'].createElement(Accordion, null, /*#__PURE__*/React__default['default'].createElement(SubscriptionsItems, props)), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
21047
+ colSpan: "4",
21048
+ className: "plc-p-1"
21049
+ }, /*#__PURE__*/React__default['default'].createElement(Button, {
21050
+ variant: "ghost",
21051
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgPlus, {
21052
+ className: "plc-w-4 plc-h-4 plc-mr-1"
21053
+ }),
21054
+ className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
21055
+ onClick: props.displayProductSelect
21056
+ }, t("labels.addSubscription")))), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
21057
+ colSpan: "4",
21058
+ className: "plc-p-1"
21059
+ }, /*#__PURE__*/React__default['default'].createElement(Button, {
21060
+ variant: "ghost",
21061
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgGift, {
21062
+ className: "plc-w-4 plc-h-4 plc-mr-1"
21063
+ }),
21064
+ className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
21065
+ onClick: props.displayRedeem
21066
+ }, t("labels.redeemGift"))))));
21067
+ };
21068
+ const SubscriptionsItems = ({
21069
+ onClose,
21070
+ cancelSubscription,
21071
+ reactivateSubscription,
21072
+ setProductAndPlan,
21073
+ setSubscriptionIdToRenew,
21074
+ setView,
21075
+ getSubscriptionStatus,
21076
+ disableSubmit,
21077
+ activeMenu,
21078
+ toggleActiveMenu
21079
+ }) => {
21080
+ const {
21081
+ t
21082
+ } = useTranslation("dashboard");
21083
+ const subs = window.Pelcro.subscription.list();
21084
+ if (!subs || subs.length === 0) return null;
21085
+ return window.Pelcro.subscription.list().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
21086
+ const isActive = activeMenu === sub.id; // Cancel button click handlers
21087
+
21088
+ const onCancelClick = () => {
21089
+ onClose === null || onClose === void 0 ? void 0 : onClose();
21090
+ notify.confirm((onSuccess, onFailure) => {
21091
+ cancelSubscription(sub.id, onSuccess, onFailure);
21092
+ }, {
21093
+ confirmMessage: t("messages.subCancellation.isSureToCancel"),
21094
+ loadingMessage: t("messages.subCancellation.loading"),
21095
+ successMessage: t("messages.subCancellation.success"),
21096
+ errorMessage: t("messages.subCancellation.error")
21097
+ }, {
21098
+ closeButtonLabel: t("labels.subCancellation.goBack")
21099
+ });
21100
+ }; // Reactivate button click handlers
21101
+
21102
+
21103
+ const onReactivateClick = () => {
21104
+ reactivateSubscription(sub.id);
21105
+ }; // Renew click
21106
+
21107
+
21108
+ const onRenewClick = () => {
21109
+ const product_id = sub.plan.product.id;
21110
+ const plan_id = sub.plan.id;
21111
+ const product = window.Pelcro.product.getById(product_id);
21112
+ const plan = window.Pelcro.plan.getById(plan_id);
21113
+ setProductAndPlan(product, plan);
21114
+ setSubscriptionIdToRenew(sub.id);
21115
+ setView("plan-select");
21116
+ };
21117
+
21118
+ const getPhases = () => {
21119
+ if (!sub.schedule) return [];
21120
+ const currentPhaseStartDate = sub.schedule.current_phase.start_date;
21121
+ const currentPhase = sub.schedule.phases.find(phase => {
21122
+ return phase.start_date === currentPhaseStartDate;
21123
+ });
21124
+ const futurePhases = sub.schedule.phases.filter(phase => {
21125
+ return phase.start_date > currentPhaseStartDate;
21126
+ });
21127
+ return [currentPhase, ...futurePhases];
21128
+ };
21129
+
21130
+ const hasPhases = getPhases().length > 0;
21131
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, {
21132
+ key: sub.id
21133
+ }, /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
21134
+ onClick: () => toggleActiveMenu(sub.id),
21135
+ key: sub.id,
21136
+ className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header ${isActive ? "plc-bg-gray-100" : "hover:plc-bg-gray-50"}`
21137
+ }, /*#__PURE__*/React__default['default'].createElement("td", {
21138
+ className: "plc-truncate"
21139
+ }, sub.plan.nickname && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("span", {
21140
+ className: "plc-font-semibold plc-text-gray-500"
21141
+ }, sub.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
21142
+ className: "plc-text-xs plc-text-gray-400"
21143
+ }, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default['default'].createElement("td", {
21144
+ className: "plc-py-2"
21145
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
21146
+ className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getSubscriptionStatus(sub).bgColor} plc-uppercase ${getSubscriptionStatus(sub).textColor} plc-rounded-lg`
21147
+ }, getSubscriptionStatus(sub).icon, getSubscriptionStatus(sub).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
21148
+ className: "plc-text-xs plc-text-gray-500"
21149
+ }, sub.status && /*#__PURE__*/React__default['default'].createElement("span", {
21150
+ className: "plc-inline-block plc-mt-1 plc-underline"
21151
+ }, getSubscriptionStatus(sub).content), /*#__PURE__*/React__default['default'].createElement("br", null), sub.shipments_remaining ? /*#__PURE__*/React__default['default'].createElement("span", {
21152
+ className: "plc-inline-block plc-mt-1"
21153
+ }, sub.shipments_remaining, " ", t("labels.shipments")) : null)), /*#__PURE__*/React__default['default'].createElement("td", null, sub.cancel_at_period_end === 0 && /*#__PURE__*/React__default['default'].createElement(Button, {
21154
+ variant: "ghost",
21155
+ className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
21156
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
21157
+ onClick: onCancelClick,
21158
+ disabled: disableSubmit,
21159
+ "data-key": sub.id
21160
+ }, t("labels.unsubscribe")), sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default['default'].createElement(Button, {
21161
+ variant: "ghost",
21162
+ className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
21163
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
21164
+ onClick: onReactivateClick,
21165
+ disabled: disableSubmit,
21166
+ "data-key": sub.id
21167
+ }, t("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default['default'].createElement(Button, {
21168
+ variant: "ghost",
21169
+ className: "plc-text-blue-400 pelcro-dashboard-sub-renew-button",
21170
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
21171
+ onClick: onRenewClick,
21172
+ disabled: disableSubmit,
21173
+ "data-key": sub.id
21174
+ }, t("labels.renew"))), /*#__PURE__*/React__default['default'].createElement("td", null, hasPhases && /*#__PURE__*/React__default['default'].createElement("div", {
21175
+ className: `plc-flex plc-items-center plc-justify-center plc-transition-transform plc-ease-out plc-transform plc-rounded-full plc-w-7 plc-h-7 ${isActive ? "plc-flex plc-place-items-center plc-w-7 plc-h-7 plc-p-1 plc-bg-primary-400 plc-rounded-full" : "accordion-chevron"}`
21176
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
21177
+ className: `plc-transition plc-ease-out ${isActive && "plc-text-white plc-transform plc-rotate-90"}`
21178
+ }, /*#__PURE__*/React__default['default'].createElement(SvgChevronRight, null)))))), /*#__PURE__*/React__default['default'].createElement("tbody", null, isActive && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, getPhases().map((phase, i) => {
21179
+ var _phase$plans;
21180
+
21181
+ const plan = (_phase$plans = phase.plans) === null || _phase$plans === void 0 ? void 0 : _phase$plans[0].plan;
21182
+ const isCurrentPhase = i === 0;
21183
+ const startDate = new Date(Number(`${phase.start_date}000`));
21184
+ const endDate = new Date(Number(`${phase.end_date}000`));
21185
+ const formattedStartDate = new Intl.DateTimeFormat("en-CA").format(startDate);
21186
+ const formattedEndDate = new Intl.DateTimeFormat("en-CA").format(endDate);
21187
+ const startDateString = `${t("labels.startsOn")} ${formattedStartDate}`;
21188
+ const endDateString = `${t("labels.expiresOn")} ${formattedEndDate}`;
21189
+ return /*#__PURE__*/React__default['default'].createElement("tr", {
21190
+ key: `${phase.start_date}-${phase.end_date}`,
21191
+ className: "pelcro-sub-phase-row plc-w-full plc-align-middle"
21192
+ }, /*#__PURE__*/React__default['default'].createElement("td", {
21193
+ className: "plc-truncate"
21194
+ }, plan.nickname && /*#__PURE__*/React__default['default'].createElement("span", {
21195
+ className: "plc-font-semibold plc-text-gray-500"
21196
+ }, plan.nickname)), /*#__PURE__*/React__default['default'].createElement("td", {
21197
+ className: "plc-py-2"
21198
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
21199
+ className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold plc-uppercase plc-rounded-lg ${isCurrentPhase ? "plc-text-green-700 plc-bg-green-100" : "plc-text-blue-700 plc-bg-blue-100"}
21200
+ `
21201
+ }, isCurrentPhase ? /*#__PURE__*/React__default['default'].createElement(SvgCheckMark, null) : /*#__PURE__*/React__default['default'].createElement(SvgCalendar, null), isCurrentPhase ? t("labels.status.active") : t("labels.status.scheduled")), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
21202
+ className: "plc-text-xs plc-text-gray-500"
21203
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
21204
+ className: "plc-inline-block plc-mt-1 plc-underline"
21205
+ }, isCurrentPhase ? endDateString : startDateString))));
21206
+ }), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
21207
+ colSpan: "4"
21208
+ }, /*#__PURE__*/React__default['default'].createElement("hr", {
21209
+ className: "plc-mt-4"
21210
+ }))))));
21211
+ });
21212
+ };
21213
+
20690
21214
  /**
20691
21215
  * @typedef {Object} AccordionPropsType
20692
21216
  * @property {string} initialActiveMenu the initial active menu
@@ -20713,7 +21237,7 @@ const Accordion = ({
20713
21237
  };
20714
21238
 
20715
21239
  return React__default['default'].Children.map(children, (child, i) => {
20716
- if (child.type === Accordion.item || child.type === OrderItems || child.type === SavedItems) {
21240
+ if (child.type === Accordion.item || child.type === OrderItems || child.type === SavedItems || child.type === SubscriptionsItems) {
20717
21241
  return /*#__PURE__*/React__default['default'].cloneElement(child, {
20718
21242
  activeMenu,
20719
21243
  toggleActiveMenu,
@@ -20769,18 +21293,18 @@ Accordion.item = function AccordionItem({
20769
21293
  }, content)) : null;
20770
21294
  };
20771
21295
 
20772
- var _path$b;
21296
+ var _path$8;
20773
21297
 
20774
- 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); }
21298
+ 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); }
20775
21299
 
20776
21300
  function SvgExit(props) {
20777
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
21301
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
20778
21302
  className: "plc-w-6 plc-h-6",
20779
21303
  xmlns: "http://www.w3.org/2000/svg",
20780
21304
  fill: "none",
20781
21305
  viewBox: "0 0 24 24",
20782
21306
  stroke: "currentColor"
20783
- }, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
21307
+ }, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
20784
21308
  strokeLinecap: "round",
20785
21309
  strokeLinejoin: "round",
20786
21310
  strokeWidth: 2,
@@ -20788,34 +21312,17 @@ function SvgExit(props) {
20788
21312
  })));
20789
21313
  }
20790
21314
 
20791
- var _path$a;
20792
-
20793
- 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); }
20794
-
20795
- function SvgCheckMark(props) {
20796
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
20797
- className: "plc-w-4 plc-h-4 plc-mr-1",
20798
- xmlns: "http://www.w3.org/2000/svg",
20799
- viewBox: "0 0 20 20",
20800
- fill: "currentColor"
20801
- }, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
20802
- fillRule: "evenodd",
20803
- 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",
20804
- clipRule: "evenodd"
20805
- })));
20806
- }
20807
-
20808
- var _path$9;
21315
+ var _path$7;
20809
21316
 
20810
- 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); }
21317
+ function _extends$8() { _extends$8 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
20811
21318
 
20812
21319
  function SvgUser(props) {
20813
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
21320
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
20814
21321
  xmlns: "http://www.w3.org/2000/svg",
20815
21322
  fill: "none",
20816
21323
  viewBox: "0 0 24 24",
20817
21324
  stroke: "currentColor"
20818
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
21325
+ }, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
20819
21326
  strokeLinecap: "round",
20820
21327
  strokeLinejoin: "round",
20821
21328
  strokeWidth: 2,
@@ -20823,18 +21330,18 @@ function SvgUser(props) {
20823
21330
  })));
20824
21331
  }
20825
21332
 
20826
- var _path$8;
21333
+ var _path$6;
20827
21334
 
20828
- 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); }
21335
+ function _extends$7() { _extends$7 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
20829
21336
 
20830
21337
  function SvgNewsletter(props) {
20831
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
21338
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
20832
21339
  xmlns: "http://www.w3.org/2000/svg",
20833
21340
  className: "plc-h-5 plc-w-5",
20834
21341
  fill: "none",
20835
21342
  viewBox: "0 0 24 24",
20836
21343
  stroke: "currentColor"
20837
- }, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
21344
+ }, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
20838
21345
  strokeLinecap: "round",
20839
21346
  strokeLinejoin: "round",
20840
21347
  strokeWidth: 2,
@@ -20842,37 +21349,18 @@ function SvgNewsletter(props) {
20842
21349
  })));
20843
21350
  }
20844
21351
 
20845
- var _path$7;
20846
-
20847
- function _extends$8() { _extends$8 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
20848
-
20849
- function SvgRefresh(props) {
20850
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
20851
- className: "plc-w-4 plc-h-4 plc-mr-1",
20852
- xmlns: "http://www.w3.org/2000/svg",
20853
- fill: "none",
20854
- viewBox: "0 0 24 24",
20855
- stroke: "currentColor"
20856
- }, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
20857
- strokeLinecap: "round",
20858
- strokeLinejoin: "round",
20859
- strokeWidth: 2,
20860
- d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
20861
- })));
20862
- }
20863
-
20864
- var _path$6;
21352
+ var _path$5;
20865
21353
 
20866
- function _extends$7() { _extends$7 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
21354
+ function _extends$6() { _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
20867
21355
 
20868
21356
  function SvgPaymentCard(props) {
20869
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
21357
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
20870
21358
  className: "plc-w-6 plc-h-6 plc-mr-2",
20871
21359
  xmlns: "http://www.w3.org/2000/svg",
20872
21360
  fill: "none",
20873
21361
  viewBox: "0 0 24 24",
20874
21362
  stroke: "currentColor"
20875
- }, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
21363
+ }, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
20876
21364
  strokeLinecap: "round",
20877
21365
  strokeLinejoin: "round",
20878
21366
  strokeWidth: 2,
@@ -20880,18 +21368,18 @@ function SvgPaymentCard(props) {
20880
21368
  })));
20881
21369
  }
20882
21370
 
20883
- var _path$5, _path2;
21371
+ var _path$4, _path2;
20884
21372
 
20885
- function _extends$6() { _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
21373
+ function _extends$5() { _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
20886
21374
 
20887
21375
  function SvgLocationPin(props) {
20888
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
21376
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
20889
21377
  className: "plc-w-6 plc-h-6 plc-mr-2",
20890
21378
  xmlns: "http://www.w3.org/2000/svg",
20891
21379
  fill: "none",
20892
21380
  viewBox: "0 0 24 24",
20893
21381
  stroke: "currentColor"
20894
- }, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
21382
+ }, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
20895
21383
  strokeLinecap: "round",
20896
21384
  strokeLinejoin: "round",
20897
21385
  strokeWidth: 2,
@@ -20906,10 +21394,10 @@ function SvgLocationPin(props) {
20906
21394
 
20907
21395
  var _switch;
20908
21396
 
20909
- function _extends$5() { _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
21397
+ function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
20910
21398
 
20911
21399
  function SvgSubscription(props) {
20912
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
21400
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
20913
21401
  xmlns: "http://www.w3.org/2000/svg",
20914
21402
  viewBox: "0 0 100 125",
20915
21403
  fill: "currentColor"
@@ -20924,30 +21412,11 @@ function SvgSubscription(props) {
20924
21412
  }))))));
20925
21413
  }
20926
21414
 
20927
- var _path$4;
20928
-
20929
- function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
20930
-
20931
- function SvgShopping(props) {
20932
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
20933
- className: "plc-w-6 plc-h-6 plc-mr-2",
20934
- xmlns: "http://www.w3.org/2000/svg",
20935
- fill: "none",
20936
- viewBox: "0 0 24 24",
20937
- stroke: "currentColor"
20938
- }, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
20939
- strokeLinecap: "round",
20940
- strokeLinejoin: "round",
20941
- strokeWidth: 2,
20942
- d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"
20943
- })));
20944
- }
20945
-
20946
21415
  var _path$3;
20947
21416
 
20948
21417
  function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
20949
21418
 
20950
- function SvgBookmark(props) {
21419
+ function SvgShopping(props) {
20951
21420
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
20952
21421
  className: "plc-w-6 plc-h-6 plc-mr-2",
20953
21422
  xmlns: "http://www.w3.org/2000/svg",
@@ -20958,7 +21427,7 @@ function SvgBookmark(props) {
20958
21427
  strokeLinecap: "round",
20959
21428
  strokeLinejoin: "round",
20960
21429
  strokeWidth: 2,
20961
- d: "M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"
21430
+ d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"
20962
21431
  })));
20963
21432
  }
20964
21433
 
@@ -20966,9 +21435,9 @@ var _path$2;
20966
21435
 
20967
21436
  function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
20968
21437
 
20969
- function SvgPlus(props) {
21438
+ function SvgBookmark(props) {
20970
21439
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
20971
- className: "plc-w-5 plc-h-5",
21440
+ className: "plc-w-6 plc-h-6 plc-mr-2",
20972
21441
  xmlns: "http://www.w3.org/2000/svg",
20973
21442
  fill: "none",
20974
21443
  viewBox: "0 0 24 24",
@@ -20977,7 +21446,7 @@ function SvgPlus(props) {
20977
21446
  strokeLinecap: "round",
20978
21447
  strokeLinejoin: "round",
20979
21448
  strokeWidth: 2,
20980
- d: "M12 6v6m0 0v6m0-6h6m-6 0H6"
21449
+ d: "M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"
20981
21450
  })));
20982
21451
  }
20983
21452
 
@@ -21241,116 +21710,6 @@ class Dashboard extends React.Component {
21241
21710
  };
21242
21711
  });
21243
21712
 
21244
- _defineProperty$3(this, "renderSubscriptions", () => {
21245
- var _this$state$subscript;
21246
-
21247
- const subscriptions = (_this$state$subscript = this.state.subscriptions) === null || _this$state$subscript === void 0 ? void 0 : _this$state$subscript.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
21248
- // Cancel button click handlers
21249
- const onCancelClick = () => {
21250
- this.props.onClose();
21251
- notify.confirm((onSuccess, onFailure) => {
21252
- this.cancelSubscription(sub.id, onSuccess, onFailure);
21253
- }, {
21254
- confirmMessage: this.locale("messages.subCancellation.isSureToCancel"),
21255
- loadingMessage: this.locale("messages.subCancellation.loading"),
21256
- successMessage: this.locale("messages.subCancellation.success"),
21257
- errorMessage: this.locale("messages.subCancellation.error")
21258
- }, {
21259
- closeButtonLabel: this.locale("labels.subCancellation.goBack")
21260
- });
21261
- }; // Reactivate button click handlers
21262
-
21263
-
21264
- const onReactivateClick = () => {
21265
- this.reactivateSubscription(sub.id);
21266
- }; // Renew click
21267
-
21268
-
21269
- const onRenewClick = () => {
21270
- const product_id = sub.plan.product.id;
21271
- const plan_id = sub.plan.id;
21272
- const product = window.Pelcro.product.getById(product_id);
21273
- const plan = window.Pelcro.plan.getById(plan_id);
21274
- this.props.setProductAndPlan(product, plan);
21275
- this.props.setSubscriptionIdToRenew(sub.id);
21276
- this.props.setView("plan-select");
21277
- };
21278
-
21279
- return /*#__PURE__*/React__default['default'].createElement("tr", {
21280
- key: "dashboard-subscription-" + sub.id,
21281
- className: "plc-w-full plc-align-top"
21282
- }, /*#__PURE__*/React__default['default'].createElement("td", {
21283
- className: "plc-truncate"
21284
- }, sub.plan.nickname && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("span", {
21285
- className: "plc-font-semibold plc-text-gray-500"
21286
- }, sub.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
21287
- className: "plc-text-xs plc-text-gray-400"
21288
- }, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency, this.site.default_locale)))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
21289
- className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${this.getSubscriptionStatus(sub).bgColor} plc-uppercase ${this.getSubscriptionStatus(sub).textColor} plc-rounded-lg`
21290
- }, this.getSubscriptionStatus(sub).icon, this.getSubscriptionStatus(sub).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
21291
- className: "plc-mb-4 plc-text-xs plc-text-gray-500"
21292
- }, sub.status && /*#__PURE__*/React__default['default'].createElement("span", {
21293
- className: "plc-inline-block plc-mt-1 plc-underline"
21294
- }, this.getSubscriptionStatus(sub).content), /*#__PURE__*/React__default['default'].createElement("br", null), sub.shipments_remaining ? /*#__PURE__*/React__default['default'].createElement("span", {
21295
- className: "plc-inline-block plc-mt-1"
21296
- }, 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, {
21297
- variant: "ghost",
21298
- className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashoard-sub-cancel-button",
21299
- icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
21300
- onClick: onCancelClick,
21301
- disabled: this.state.disableSubmit,
21302
- "data-key": sub.id
21303
- }, this.locale("labels.unsubscribe")), sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default['default'].createElement(Button, {
21304
- variant: "ghost",
21305
- className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashoard-sub-reactivate-button",
21306
- icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
21307
- onClick: onReactivateClick,
21308
- disabled: this.state.disableSubmit,
21309
- "data-key": sub.id
21310
- }, this.locale("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default['default'].createElement(Button, {
21311
- variant: "ghost",
21312
- className: "plc-text-blue-400 pelcro-dashoard-sub-renew-button",
21313
- icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
21314
- onClick: onRenewClick,
21315
- disabled: this.state.disableSubmit,
21316
- "data-key": sub.id
21317
- }, this.locale("labels.renew"))));
21318
- });
21319
- return /*#__PURE__*/React__default['default'].createElement("table", {
21320
- className: "plc-w-full plc-table-fixed"
21321
- }, /*#__PURE__*/React__default['default'].createElement("thead", {
21322
- className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
21323
- }, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
21324
- className: "plc-w-5/12 "
21325
- }, this.locale("labels.plan")), /*#__PURE__*/React__default['default'].createElement("th", {
21326
- className: "plc-w-4/12 "
21327
- }, this.locale("labels.status.title")), /*#__PURE__*/React__default['default'].createElement("th", {
21328
- className: "plc-w-3/12 "
21329
- }, this.locale("labels.actions")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
21330
- className: "plc-h-4"
21331
- }), subscriptions, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
21332
- colSpan: "4",
21333
- className: "plc-p-1"
21334
- }, /*#__PURE__*/React__default['default'].createElement(Button, {
21335
- variant: "ghost",
21336
- icon: /*#__PURE__*/React__default['default'].createElement(SvgPlus, {
21337
- className: "plc-w-4 plc-h-4 plc-mr-1"
21338
- }),
21339
- className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
21340
- onClick: this.displayProductSelect
21341
- }, this.locale("labels.addSubscription")))), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
21342
- colSpan: "4",
21343
- className: "plc-p-1"
21344
- }, /*#__PURE__*/React__default['default'].createElement(Button, {
21345
- variant: "ghost",
21346
- icon: /*#__PURE__*/React__default['default'].createElement(SvgGift, {
21347
- className: "plc-w-4 plc-h-4 plc-mr-1"
21348
- }),
21349
- className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
21350
- onClick: this.displayRedeem
21351
- }, this.locale("labels.redeemGift"))))));
21352
- });
21353
-
21354
21713
  _defineProperty$3(this, "renderGiftRecipients", () => {
21355
21714
  var _giftRecipients$sort, _giftRecipients$sort$;
21356
21715
 
@@ -21388,7 +21747,7 @@ class Dashboard extends React.Component {
21388
21747
  className: "plc-font-semibold plc-text-gray-500"
21389
21748
  }, recipient.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
21390
21749
  className: "plc-text-xs plc-text-gray-400"
21391
- }, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency, this.site.default_locale)))), recipient.status && /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
21750
+ }, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency, getPageOrDefaultLanguage())))), recipient.status && /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
21392
21751
  className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${this.getSubscriptionStatus(recipient).bgColor} plc-uppercase ${this.getSubscriptionStatus(recipient).textColor} plc-rounded-lg`
21393
21752
  }, this.getSubscriptionStatus(recipient).icon, this.getSubscriptionStatus(recipient).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
21394
21753
  className: "plc-mb-4 plc-text-xs plc-text-gray-500"
@@ -21625,7 +21984,18 @@ class Dashboard extends React.Component {
21625
21984
  className: "plc-w-10 plc-h-10 plc-pt-2 plc-pr-1 plc--ml-2"
21626
21985
  }),
21627
21986
  title: this.locale("labels.subscriptions"),
21628
- content: this.renderSubscriptions()
21987
+ content: /*#__PURE__*/React__default['default'].createElement(SubscriptionsMenu, {
21988
+ onClose: this.props.onClose,
21989
+ cancelSubscription: this.cancelSubscription,
21990
+ reactivateSubscription: this.reactivateSubscription,
21991
+ setProductAndPlan: this.props.setProductAndPlan,
21992
+ setSubscriptionIdToRenew: this.props.setSubscriptionIdToRenew,
21993
+ setView: this.props.setView,
21994
+ getSubscriptionStatus: this.getSubscriptionStatus,
21995
+ disableSubmit: this.state.disableSubmit,
21996
+ displayProductSelect: this.displayProductSelect,
21997
+ displayRedeem: this.displayRedeem
21998
+ })
21629
21999
  }), /*#__PURE__*/React__default['default'].createElement(Accordion.item, {
21630
22000
  name: SUB_MENUS.GIFTS,
21631
22001
  icon: /*#__PURE__*/React__default['default'].createElement(SvgGift, null),