@pelcro/react-pelcro-js 3.1.0 → 3.2.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -7064,8 +7064,8 @@ const saveToMetadataButton = new SaveToMetadataButtonClass();
7064
7064
 
7065
7065
  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}}
7066
7066
 
7067
- function _extends$y() {
7068
- _extends$y = Object.assign || function (target) {
7067
+ function _extends$z() {
7068
+ _extends$z = Object.assign || function (target) {
7069
7069
  for (var i = 1; i < arguments.length; i++) {
7070
7070
  var source = arguments[i];
7071
7071
 
@@ -7079,7 +7079,7 @@ function _extends$y() {
7079
7079
  return target;
7080
7080
  };
7081
7081
 
7082
- return _extends$y.apply(this, arguments);
7082
+ return _extends$z.apply(this, arguments);
7083
7083
  }
7084
7084
 
7085
7085
  function _taggedTemplateLiteralLoose(strings, raw) {
@@ -7169,7 +7169,7 @@ var clearFromRemoveQueue = function clearFromRemoveQueue(toastId) {
7169
7169
  var reducer = function reducer(state, action) {
7170
7170
  switch (action.type) {
7171
7171
  case ActionType.ADD_TOAST:
7172
- return _extends$y({}, state, {
7172
+ return _extends$z({}, state, {
7173
7173
  toasts: [action.toast].concat(state.toasts).slice(0, TOAST_LIMIT)
7174
7174
  });
7175
7175
 
@@ -7179,9 +7179,9 @@ var reducer = function reducer(state, action) {
7179
7179
  clearFromRemoveQueue(action.toast.id);
7180
7180
  }
7181
7181
 
7182
- return _extends$y({}, state, {
7182
+ return _extends$z({}, state, {
7183
7183
  toasts: state.toasts.map(function (t) {
7184
- return t.id === action.toast.id ? _extends$y({}, t, action.toast) : t;
7184
+ return t.id === action.toast.id ? _extends$z({}, t, action.toast) : t;
7185
7185
  })
7186
7186
  });
7187
7187
 
@@ -7208,9 +7208,9 @@ var reducer = function reducer(state, action) {
7208
7208
  });
7209
7209
  }
7210
7210
 
7211
- return _extends$y({}, state, {
7211
+ return _extends$z({}, state, {
7212
7212
  toasts: state.toasts.map(function (t) {
7213
- return t.id === toastId || toastId === undefined ? _extends$y({}, t, {
7213
+ return t.id === toastId || toastId === undefined ? _extends$z({}, t, {
7214
7214
  visible: false
7215
7215
  }) : t;
7216
7216
  })
@@ -7218,28 +7218,28 @@ var reducer = function reducer(state, action) {
7218
7218
 
7219
7219
  case ActionType.REMOVE_TOAST:
7220
7220
  if (action.toastId === undefined) {
7221
- return _extends$y({}, state, {
7221
+ return _extends$z({}, state, {
7222
7222
  toasts: []
7223
7223
  });
7224
7224
  }
7225
7225
 
7226
- return _extends$y({}, state, {
7226
+ return _extends$z({}, state, {
7227
7227
  toasts: state.toasts.filter(function (t) {
7228
7228
  return t.id !== action.toastId;
7229
7229
  })
7230
7230
  });
7231
7231
 
7232
7232
  case ActionType.START_PAUSE:
7233
- return _extends$y({}, state, {
7233
+ return _extends$z({}, state, {
7234
7234
  pausedAt: action.time
7235
7235
  });
7236
7236
 
7237
7237
  case ActionType.END_PAUSE:
7238
7238
  var diff = action.time - (state.pausedAt || 0);
7239
- return _extends$y({}, state, {
7239
+ return _extends$z({}, state, {
7240
7240
  pausedAt: undefined,
7241
7241
  toasts: state.toasts.map(function (t) {
7242
- return _extends$y({}, t, {
7242
+ return _extends$z({}, t, {
7243
7243
  pauseDuration: t.pauseDuration + diff
7244
7244
  });
7245
7245
  })
@@ -7286,12 +7286,12 @@ var useStore = function useStore(toastOptions) {
7286
7286
  var mergedToasts = state.toasts.map(function (t) {
7287
7287
  var _toastOptions$t$type, _toastOptions, _toastOptions$t$type2;
7288
7288
 
7289
- return _extends$y({}, toastOptions, toastOptions[t.type], t, {
7289
+ return _extends$z({}, toastOptions, toastOptions[t.type], t, {
7290
7290
  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],
7291
- style: _extends$y({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7291
+ style: _extends$z({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7292
7292
  });
7293
7293
  });
7294
- return _extends$y({}, state, {
7294
+ return _extends$z({}, state, {
7295
7295
  toasts: mergedToasts
7296
7296
  });
7297
7297
  };
@@ -7301,7 +7301,7 @@ var createToast = function createToast(message, type, opts) {
7301
7301
  type = 'blank';
7302
7302
  }
7303
7303
 
7304
- return _extends$y({
7304
+ return _extends$z({
7305
7305
  createdAt: Date.now(),
7306
7306
  visible: true,
7307
7307
  type: type,
@@ -7351,14 +7351,14 @@ toast.remove = function (toastId) {
7351
7351
  };
7352
7352
 
7353
7353
  toast.promise = function (promise, msgs, opts) {
7354
- var id = toast.loading(msgs.loading, _extends$y({}, opts, opts == null ? void 0 : opts.loading));
7354
+ var id = toast.loading(msgs.loading, _extends$z({}, opts, opts == null ? void 0 : opts.loading));
7355
7355
  promise.then(function (p) {
7356
- toast.success(resolveValue(msgs.success, p), _extends$y({
7356
+ toast.success(resolveValue(msgs.success, p), _extends$z({
7357
7357
  id: id
7358
7358
  }, opts, opts == null ? void 0 : opts.success));
7359
7359
  return p;
7360
7360
  })["catch"](function (e) {
7361
- toast.error(resolveValue(msgs.error, e), _extends$y({
7361
+ toast.error(resolveValue(msgs.error, e), _extends$z({
7362
7362
  id: id
7363
7363
  }, opts, opts == null ? void 0 : opts.error));
7364
7364
  });
@@ -7697,7 +7697,7 @@ var ToastBar = /*#__PURE__*/memo(function (_ref2) {
7697
7697
  var message = createElement(Message, Object.assign({}, toast.ariaProps), resolveValue(toast.message, toast));
7698
7698
  return createElement(ToastBarBase, {
7699
7699
  className: toast.className,
7700
- style: _extends$y({}, animationStyle, style, toast.style)
7700
+ style: _extends$z({}, animationStyle, style, toast.style)
7701
7701
  }, typeof children === 'function' ? children({
7702
7702
  icon: icon,
7703
7703
  message: message
@@ -7727,7 +7727,7 @@ var getPositionStyle = function getPositionStyle(position, offset) {
7727
7727
  } : position.includes('right') ? {
7728
7728
  justifyContent: 'flex-end'
7729
7729
  } : {};
7730
- return _extends$y({
7730
+ return _extends$z({
7731
7731
  left: 0,
7732
7732
  right: 0,
7733
7733
  display: 'flex',
@@ -7754,7 +7754,7 @@ var Toaster = function Toaster(_ref) {
7754
7754
  handlers = _useToaster.handlers;
7755
7755
 
7756
7756
  return createElement("div", {
7757
- style: _extends$y({
7757
+ style: _extends$z({
7758
7758
  position: 'fixed',
7759
7759
  zIndex: 9999,
7760
7760
  top: DEFAULT_OFFSET,
@@ -7789,82 +7789,82 @@ var Toaster = function Toaster(_ref) {
7789
7789
  }));
7790
7790
  };
7791
7791
 
7792
- var _path$v;
7792
+ var _path$w;
7793
7793
 
7794
- function _extends$x() { _extends$x = 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$x.apply(this, arguments); }
7794
+ function _extends$y() { _extends$y = 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$y.apply(this, arguments); }
7795
7795
 
7796
7796
  function SvgCheckSolid(props) {
7797
- return /*#__PURE__*/React.createElement("svg", _extends$x({
7797
+ return /*#__PURE__*/React.createElement("svg", _extends$y({
7798
7798
  xmlns: "http://www.w3.org/2000/svg",
7799
7799
  className: "h-5 w-5",
7800
7800
  viewBox: "0 0 20 20",
7801
7801
  fill: "currentColor"
7802
- }, props), _path$v || (_path$v = /*#__PURE__*/React.createElement("path", {
7802
+ }, props), _path$w || (_path$w = /*#__PURE__*/React.createElement("path", {
7803
7803
  fillRule: "evenodd",
7804
7804
  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",
7805
7805
  clipRule: "evenodd"
7806
7806
  })));
7807
7807
  }
7808
7808
 
7809
- var _path$u;
7809
+ var _path$v;
7810
7810
 
7811
- function _extends$w() { _extends$w = 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$w.apply(this, arguments); }
7811
+ function _extends$x() { _extends$x = 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$x.apply(this, arguments); }
7812
7812
 
7813
7813
  function SvgXIcon(props) {
7814
- return /*#__PURE__*/React.createElement("svg", _extends$w({
7814
+ return /*#__PURE__*/React.createElement("svg", _extends$x({
7815
7815
  xmlns: "http://www.w3.org/2000/svg",
7816
7816
  viewBox: "0 0 20 20",
7817
7817
  fill: "currentColor"
7818
- }, props), _path$u || (_path$u = /*#__PURE__*/React.createElement("path", {
7818
+ }, props), _path$v || (_path$v = /*#__PURE__*/React.createElement("path", {
7819
7819
  fill: "evenodd",
7820
7820
  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",
7821
7821
  clipRule: "evenodd"
7822
7822
  })));
7823
7823
  }
7824
7824
 
7825
- var _path$t;
7825
+ var _path$u;
7826
7826
 
7827
- function _extends$v() { _extends$v = 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$v.apply(this, arguments); }
7827
+ function _extends$w() { _extends$w = 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$w.apply(this, arguments); }
7828
7828
 
7829
7829
  function SvgXIconSolid(props) {
7830
- return /*#__PURE__*/React.createElement("svg", _extends$v({
7830
+ return /*#__PURE__*/React.createElement("svg", _extends$w({
7831
7831
  className: "plc-w-4 plc-h-4",
7832
7832
  fill: "currentColor",
7833
7833
  xmlns: "http://www.w3.org/2000/svg",
7834
7834
  viewBox: "0 0 100 100"
7835
- }, props), _path$t || (_path$t = /*#__PURE__*/React.createElement("path", {
7835
+ }, props), _path$u || (_path$u = /*#__PURE__*/React.createElement("path", {
7836
7836
  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"
7837
7837
  })));
7838
7838
  }
7839
7839
 
7840
- var _path$s;
7840
+ var _path$t;
7841
7841
 
7842
- 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); }
7842
+ function _extends$v() { _extends$v = 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$v.apply(this, arguments); }
7843
7843
 
7844
7844
  function SvgExclamation(props) {
7845
- return /*#__PURE__*/React.createElement("svg", _extends$u({
7845
+ return /*#__PURE__*/React.createElement("svg", _extends$v({
7846
7846
  className: "plc-w-4 plc-h-4 plc-mr-1",
7847
7847
  xmlns: "http://www.w3.org/2000/svg",
7848
7848
  viewBox: "0 0 20 20",
7849
7849
  fill: "currentColor"
7850
- }, props), _path$s || (_path$s = /*#__PURE__*/React.createElement("path", {
7850
+ }, props), _path$t || (_path$t = /*#__PURE__*/React.createElement("path", {
7851
7851
  fillRule: "evenodd",
7852
7852
  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",
7853
7853
  clipRule: "evenodd"
7854
7854
  })));
7855
7855
  }
7856
7856
 
7857
- var _path$r, _path2$4;
7857
+ var _path$s, _path2$4;
7858
7858
 
7859
- 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); }
7859
+ 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); }
7860
7860
 
7861
7861
  function SvgSpinner(props) {
7862
- return /*#__PURE__*/React.createElement("svg", _extends$t({
7862
+ return /*#__PURE__*/React.createElement("svg", _extends$u({
7863
7863
  className: "plc-animate-spin",
7864
7864
  viewBox: "0 0 24 24",
7865
7865
  fill: "currentColor",
7866
7866
  xmlns: "http://www.w3.org/2000/svg"
7867
- }, props), _path$r || (_path$r = /*#__PURE__*/React.createElement("path", {
7867
+ }, props), _path$s || (_path$s = /*#__PURE__*/React.createElement("path", {
7868
7868
  opacity: 0.2,
7869
7869
  fill: "evenodd",
7870
7870
  clipRule: "evenodd",
@@ -8599,6 +8599,7 @@ var pure_1 = pure.loadStripe;
8599
8599
  * @param {Object} error Error object
8600
8600
  * @return {string}
8601
8601
  */
8602
+
8602
8603
  const getErrorMessages = error => {
8603
8604
  var _error$error, _error$response, _error$response$data, _error$response3, _error$response3$data, _error$response3$data2, _error$response5, _error$response5$data;
8604
8605
 
@@ -8653,6 +8654,15 @@ const debounce = (func, waitTime) => {
8653
8654
  timeout = setTimeout(later, waitTime);
8654
8655
  };
8655
8656
  };
8657
+ function getSiteCardProcessor() {
8658
+ var _window$Pelcro$site$r;
8659
+
8660
+ if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_pay_page_id) {
8661
+ return "vantiv";
8662
+ }
8663
+
8664
+ return "stripe";
8665
+ }
8656
8666
 
8657
8667
  /**
8658
8668
  * @typedef {Object} OptionsType
@@ -8733,13 +8743,26 @@ const loadPaymentSDKs = () => {
8733
8743
  if (!window.Stripe) {
8734
8744
  pure_1(window.Pelcro.environment.stripe);
8735
8745
  }
8736
- }); // Load PayPal SDK's
8746
+ }); // Load PayPal SDKs
8737
8747
 
8738
8748
  const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
8739
8749
 
8740
8750
  if (supportsPaypal) {
8741
8751
  window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.69.0/js/client.min.js", "braintree-sdk");
8742
8752
  window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.69.0/js/paypal-checkout.min.js", "braintree-paypal-sdk");
8753
+ } // Load Vantiv SDKs
8754
+
8755
+
8756
+ const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_pay_page_id);
8757
+
8758
+ if (supportsVantiv) {
8759
+ if (!window.jQuery) {
8760
+ window.Pelcro.helpers.loadSDK("https://code.jquery.com/jquery-3.6.0.slim.min.js", "vantiv-jquery-sdk");
8761
+ }
8762
+
8763
+ if (!window.EprotectIframeClient) {
8764
+ window.Pelcro.helpers.loadSDK("https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js", "vantiv-eprotect-sdk");
8765
+ }
8743
8766
  }
8744
8767
  };
8745
8768
  const loadAuth0SDK = () => {
@@ -8899,8 +8922,7 @@ const initViewFromURL = () => {
8899
8922
  }
8900
8923
 
8901
8924
  if (view === "invoice-details") {
8902
- // FIXME: commented out to remove from the release
8903
- return false; // return showInvoiceDetailsFromUrl();
8925
+ return showInvoiceDetailsFromUrl();
8904
8926
  }
8905
8927
 
8906
8928
  switchView(view);
@@ -9079,6 +9101,43 @@ const verifyEmailTokenFromUrl = () => {
9079
9101
  });
9080
9102
  };
9081
9103
 
9104
+ const showInvoiceDetailsFromUrl = () => {
9105
+ const {
9106
+ isAuthenticated,
9107
+ setInvoice,
9108
+ whenSiteReady,
9109
+ switchView
9110
+ } = usePelcro.getStore();
9111
+ whenSiteReady(() => {
9112
+ if (!isAuthenticated()) {
9113
+ return switchView("login");
9114
+ }
9115
+
9116
+ const invoiceId = window.Pelcro.helpers.getURLParameter("id");
9117
+ const wasSetSuccessfully = setInvoice(invoiceId);
9118
+
9119
+ if (!wasSetSuccessfully) {
9120
+ const errorMessage = i18next.t("messages:invalidInvoice", {
9121
+ returnObjects: true
9122
+ });
9123
+ return notify.error(errorMessage);
9124
+ }
9125
+
9126
+ const {
9127
+ invoice
9128
+ } = usePelcro.getStore();
9129
+
9130
+ if (invoice.total === 0) {
9131
+ const errorMessage = i18next.t("messages:zeroTotalInvoice", {
9132
+ returnObjects: true
9133
+ });
9134
+ return notify.error(errorMessage);
9135
+ }
9136
+
9137
+ return switchView("invoice-details");
9138
+ });
9139
+ };
9140
+
9082
9141
  const defaultOptions = {
9083
9142
  loadPaymentSDKs: true,
9084
9143
  loadAuth0SDK: true,
@@ -9848,16 +9907,16 @@ const LoginPassword = props => /*#__PURE__*/React__default.createElement(Passwor
9848
9907
  store: store$h
9849
9908
  }, props));
9850
9909
 
9851
- var _path$q;
9910
+ var _path$r;
9852
9911
 
9853
- 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); }
9912
+ 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); }
9854
9913
 
9855
9914
  function SvgCheck(props) {
9856
- return /*#__PURE__*/React.createElement("svg", _extends$s({
9915
+ return /*#__PURE__*/React.createElement("svg", _extends$t({
9857
9916
  xmlns: "http://www.w3.org/2000/svg",
9858
9917
  fill: "currentColor",
9859
9918
  viewBox: "0 0 20 20"
9860
- }, props), _path$q || (_path$q = /*#__PURE__*/React.createElement("path", {
9919
+ }, props), _path$r || (_path$r = /*#__PURE__*/React.createElement("path", {
9861
9920
  fillRule: "evenodd",
9862
9921
  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",
9863
9922
  clipRule: "evenodd"
@@ -10176,15 +10235,15 @@ function hasSecurityTokenEnabled$1() {
10176
10235
  return hasSecuritySdkLoaded;
10177
10236
  }
10178
10237
 
10179
- var _path$p;
10238
+ var _path$q;
10180
10239
 
10181
- 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); }
10240
+ 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); }
10182
10241
 
10183
10242
  function SvgFacebookLogo(props) {
10184
- return /*#__PURE__*/React.createElement("svg", _extends$r({
10243
+ return /*#__PURE__*/React.createElement("svg", _extends$s({
10185
10244
  xmlns: "http://www.w3.org/2000/svg",
10186
10245
  viewBox: "88.428 12.828 107.543 207.085"
10187
- }, props), _path$p || (_path$p = /*#__PURE__*/React.createElement("path", {
10246
+ }, props), _path$q || (_path$q = /*#__PURE__*/React.createElement("path", {
10188
10247
  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",
10189
10248
  fill: "#3c5a9a"
10190
10249
  })));
@@ -10257,15 +10316,15 @@ var googleLogin = createCommonjsModule(function (module, exports) {
10257
10316
  unwrapExports(googleLogin);
10258
10317
  var googleLogin_1 = googleLogin.GoogleLogin;
10259
10318
 
10260
- var _path$o, _path2$3, _path3$1, _path4;
10319
+ var _path$p, _path2$3, _path3$1, _path4;
10261
10320
 
10262
- 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); }
10321
+ 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); }
10263
10322
 
10264
10323
  function SvgGoogleLogo(props) {
10265
- return /*#__PURE__*/React.createElement("svg", _extends$q({
10324
+ return /*#__PURE__*/React.createElement("svg", _extends$r({
10266
10325
  viewBox: "0 0 24 24",
10267
10326
  xmlns: "http://www.w3.org/2000/svg"
10268
- }, props), _path$o || (_path$o = /*#__PURE__*/React.createElement("path", {
10327
+ }, props), _path$p || (_path$p = /*#__PURE__*/React.createElement("path", {
10269
10328
  fill: "#4285F4",
10270
10329
  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"
10271
10330
  })), _path2$3 || (_path2$3 = /*#__PURE__*/React.createElement("path", {
@@ -10342,15 +10401,15 @@ const GoogleLoginButton = ({
10342
10401
  }) : null;
10343
10402
  };
10344
10403
 
10345
- var _path$n;
10404
+ var _path$o;
10346
10405
 
10347
- 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); }
10406
+ 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); }
10348
10407
 
10349
10408
  function SvgAuth0Logo(props) {
10350
- return /*#__PURE__*/React.createElement("svg", _extends$p({
10409
+ return /*#__PURE__*/React.createElement("svg", _extends$q({
10351
10410
  viewBox: "0 0 256 285",
10352
10411
  xmlns: "http://www.w3.org/2000/svg"
10353
- }, props), _path$n || (_path$n = /*#__PURE__*/React.createElement("path", {
10412
+ }, props), _path$o || (_path$o = /*#__PURE__*/React.createElement("path", {
10354
10413
  d: "M220.412 0h-92.415l28.562 89.006h92.416l-74.77 53.077 28.57 89.511c48.128-35.06 63.854-88.12 46.208-142.588L220.413 0zM7.018 89.006h92.416L127.997 0H35.589L7.019 89.006c-17.655 54.468-1.92 107.529 46.207 142.588l28.563-89.51-74.77-53.078zm46.208 142.588l74.77 52.97 74.77-52.97-74.77-53.847-74.77 53.847z"
10355
10414
  })));
10356
10415
  }
@@ -10526,15 +10585,15 @@ function LoginView(props) {
10526
10585
  }, /*#__PURE__*/React__default.createElement(GoogleLoginButton, null), /*#__PURE__*/React__default.createElement(FacebookLoginButton, null), /*#__PURE__*/React__default.createElement(Auth0LoginButton, null))))));
10527
10586
  }
10528
10587
 
10529
- var _path$m, _path2$2, _path3;
10588
+ var _path$n, _path2$2, _path3;
10530
10589
 
10531
- 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); }
10590
+ 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); }
10532
10591
 
10533
10592
  function SvgPelcroAuthorship(props) {
10534
- return /*#__PURE__*/React.createElement("svg", _extends$o({
10593
+ return /*#__PURE__*/React.createElement("svg", _extends$p({
10535
10594
  xmlns: "http://www.w3.org/2000/svg",
10536
10595
  viewBox: "0 -80.652 497.072 179.991"
10537
- }, props), _path$m || (_path$m = /*#__PURE__*/React.createElement("path", {
10596
+ }, props), _path$n || (_path$n = /*#__PURE__*/React.createElement("path", {
10538
10597
  fill: "none",
10539
10598
  stroke: "#4a4a4a",
10540
10599
  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"
@@ -12678,7 +12737,7 @@ var _generateUserError = /*#__PURE__*/new WeakMap();
12678
12737
  class Subscription {
12679
12738
  /**
12680
12739
  * Subscription service constructor
12681
- * @param {(StripeGateway|PaypalGateWay)} paymentGateway
12740
+ * @param {(StripeGateway|PaypalGateway|VantivGateway)} paymentGateway
12682
12741
  */
12683
12742
  constructor(paymentGateway) {
12684
12743
  _defineProperty$3(this, "execute", (options, callback) => {
@@ -12699,7 +12758,7 @@ class Subscription {
12699
12758
  _isPaymentGatewayInvalid.set(this, {
12700
12759
  writable: true,
12701
12760
  value: gateway => {
12702
- return gateway && !(gateway instanceof StripeGateway) && gateway && !(gateway instanceof PaypalGateWay);
12761
+ return gateway && !(gateway instanceof StripeGateway || gateway instanceof PaypalGateway || gateway instanceof VantivGateway);
12703
12762
  }
12704
12763
  });
12705
12764
 
@@ -12752,7 +12811,8 @@ class Subscription {
12752
12811
  }
12753
12812
  const PAYMENT_GATEWAYS_ENUM = {
12754
12813
  stripe: "stripe",
12755
- paypal: "braintree"
12814
+ paypal: "braintree",
12815
+ vantiv: "vantiv"
12756
12816
  };
12757
12817
  /**
12758
12818
  * Subscription Strategies
@@ -12944,7 +13004,7 @@ var _createGiftedSubscription2 = /*#__PURE__*/new WeakMap();
12944
13004
 
12945
13005
  var _payInvoice2 = /*#__PURE__*/new WeakMap();
12946
13006
 
12947
- class PaypalGateWay {
13007
+ class PaypalGateway {
12948
13008
  constructor() {
12949
13009
  _paymentGateway2.set(this, {
12950
13010
  writable: true,
@@ -13045,6 +13105,180 @@ class PaypalGateWay {
13045
13105
 
13046
13106
  }
13047
13107
 
13108
+ var _paymentGateway3 = /*#__PURE__*/new WeakMap();
13109
+
13110
+ var _createSubscription3 = /*#__PURE__*/new WeakMap();
13111
+
13112
+ var _renewSubscription2 = /*#__PURE__*/new WeakMap();
13113
+
13114
+ var _createGiftedSubscription3 = /*#__PURE__*/new WeakMap();
13115
+
13116
+ var _renewGiftedSubscription2 = /*#__PURE__*/new WeakMap();
13117
+
13118
+ class VantivGateway {
13119
+ constructor() {
13120
+ _paymentGateway3.set(this, {
13121
+ writable: true,
13122
+ value: PAYMENT_GATEWAYS_ENUM["vantiv"]
13123
+ });
13124
+
13125
+ _defineProperty$3(this, "execute", (options, callback) => {
13126
+ const types = SUBSCRIPTION_TYPES;
13127
+
13128
+ switch (options.type) {
13129
+ case types.CREATE_SUBSCRIPTION:
13130
+ return _classPrivateFieldGet(this, _createSubscription3).call(this, options, callback);
13131
+
13132
+ case types.RENEW_SUBSCRIPTION:
13133
+ return _classPrivateFieldGet(this, _renewSubscription2).call(this, options, callback);
13134
+
13135
+ case types.CREATE_GIFTED_SUBSCRIPTION:
13136
+ return _classPrivateFieldGet(this, _createGiftedSubscription3).call(this, options, callback);
13137
+
13138
+ case types.RENEW_GIFTED_SUBSCRIPTION:
13139
+ return _classPrivateFieldGet(this, _renewGiftedSubscription2).call(this, options, callback);
13140
+ // TODO: implement paying invoices as well
13141
+ // case types.PAY_INVOICE:
13142
+ // return this.#payInvoice(options, callback);
13143
+
13144
+ default:
13145
+ console.error("Unsupported subscriptiion method: vantiv Gateway");
13146
+ }
13147
+ });
13148
+
13149
+ _createSubscription3.set(this, {
13150
+ writable: true,
13151
+ value: (options, callback) => {
13152
+ const {
13153
+ token,
13154
+ plan,
13155
+ couponCode,
13156
+ product,
13157
+ quantity = 1,
13158
+ addressId,
13159
+ isExistingSource
13160
+ } = options;
13161
+ const params = isExistingSource ? {
13162
+ source_id: token
13163
+ } : {
13164
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13165
+ gateway_token: token
13166
+ };
13167
+ window.Pelcro.subscription.create({
13168
+ quantity,
13169
+ auth_token: window.Pelcro.user.read().auth_token,
13170
+ plan_id: plan.id,
13171
+ coupon_code: couponCode,
13172
+ address_id: product.address_required ? addressId : null,
13173
+ ...params
13174
+ }, (err, res) => {
13175
+ callback(err, res);
13176
+ });
13177
+ }
13178
+ });
13179
+
13180
+ _renewSubscription2.set(this, {
13181
+ writable: true,
13182
+ value: (options, callback) => {
13183
+ const {
13184
+ subscriptionIdToRenew,
13185
+ token,
13186
+ plan,
13187
+ couponCode,
13188
+ product,
13189
+ addressId,
13190
+ isExistingSource
13191
+ } = options;
13192
+ const params = isExistingSource ? {
13193
+ source_id: token
13194
+ } : {
13195
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13196
+ gateway_token: token
13197
+ };
13198
+ window.Pelcro.subscription.renew({
13199
+ auth_token: window.Pelcro.user.read().auth_token,
13200
+ plan_id: plan.id,
13201
+ coupon_code: couponCode,
13202
+ subscription_id: subscriptionIdToRenew,
13203
+ address_id: product.address_required ? addressId : null,
13204
+ ...params
13205
+ }, (err, res) => {
13206
+ callback(err, res);
13207
+ });
13208
+ }
13209
+ });
13210
+
13211
+ _createGiftedSubscription3.set(this, {
13212
+ writable: true,
13213
+ value: (options, callback) => {
13214
+ const {
13215
+ token,
13216
+ plan,
13217
+ couponCode,
13218
+ product,
13219
+ giftRecipient,
13220
+ quantity = 1,
13221
+ addressId,
13222
+ isExistingSource
13223
+ } = options;
13224
+ const params = isExistingSource ? {
13225
+ source_id: token
13226
+ } : {
13227
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13228
+ gateway_token: token
13229
+ };
13230
+ window.Pelcro.subscription.create({
13231
+ quantity,
13232
+ auth_token: window.Pelcro.user.read().auth_token,
13233
+ plan_id: plan.id,
13234
+ coupon_code: couponCode,
13235
+ gift_recipient_email: giftRecipient.email,
13236
+ gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
13237
+ gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
13238
+ gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
13239
+ gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
13240
+ address_id: product.address_required ? addressId : null,
13241
+ ...params
13242
+ }, (err, res) => {
13243
+ callback(err, res);
13244
+ });
13245
+ }
13246
+ });
13247
+
13248
+ _renewGiftedSubscription2.set(this, {
13249
+ writable: true,
13250
+ value: (options, callback) => {
13251
+ const {
13252
+ subscriptionIdToRenew,
13253
+ token,
13254
+ product,
13255
+ plan,
13256
+ couponCode,
13257
+ addressId,
13258
+ isExistingSource
13259
+ } = options;
13260
+ const params = isExistingSource ? {
13261
+ source_id: token
13262
+ } : {
13263
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13264
+ gateway_token: token
13265
+ };
13266
+ window.Pelcro.subscription.renewGift({
13267
+ auth_token: window.Pelcro.user.read().auth_token,
13268
+ plan_id: plan.id,
13269
+ coupon_code: couponCode,
13270
+ subscription_id: subscriptionIdToRenew,
13271
+ address_id: product.address_required ? addressId : null,
13272
+ ...params
13273
+ }, (err, res) => {
13274
+ callback(err, res);
13275
+ });
13276
+ }
13277
+ });
13278
+ }
13279
+
13280
+ }
13281
+
13048
13282
  /**
13049
13283
  * @typedef {Object} PaymentStateType
13050
13284
  * @property {boolean} disableSubmit
@@ -13100,7 +13334,7 @@ const PaymentMethodContainerWithoutStripe = ({
13100
13334
  onFailure = () => {},
13101
13335
  ...props
13102
13336
  }) => {
13103
- var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isRenewingGift, _props$invoice;
13337
+ var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice;
13104
13338
 
13105
13339
  const {
13106
13340
  t
@@ -13116,6 +13350,7 @@ const PaymentMethodContainerWithoutStripe = ({
13116
13350
  const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
13117
13351
  const selectedAddressId = (_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : pelcroStore.selectedAddressId;
13118
13352
  const giftRecipient = (_props$giftRecipient = props.giftRecipient) !== null && _props$giftRecipient !== void 0 ? _props$giftRecipient : pelcroStore.giftRecipient;
13353
+ const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
13119
13354
  const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
13120
13355
  const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
13121
13356
  useEffect(() => {
@@ -13132,6 +13367,159 @@ const PaymentMethodContainerWithoutStripe = ({
13132
13367
  updateTotalAmountWithTax();
13133
13368
  }, []);
13134
13369
 
13370
+ function submitVantivPayment() {
13371
+ if (!selectedPaymentMethodId) {
13372
+ if (!vantivInstanceRef.current) {
13373
+ return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
13374
+ }
13375
+
13376
+ const orderId = `pelcro-${new Date().getTime()}`; // calls handleVantivPayment
13377
+
13378
+ vantivInstanceRef.current.getPaypageRegistrationId({
13379
+ id: orderId,
13380
+ orderId: orderId
13381
+ });
13382
+ } else {
13383
+ handleVantivPayment(null);
13384
+ }
13385
+ }
13386
+
13387
+ function handleVantivPayment(paymentRequest) {
13388
+ if (paymentRequest) {
13389
+ const SUCCESS_STATUS = "870";
13390
+
13391
+ if (paymentRequest.response !== SUCCESS_STATUS) {
13392
+ return handlePaymentError({
13393
+ error: new Error(paymentRequest.message)
13394
+ });
13395
+ }
13396
+ }
13397
+
13398
+ const subscription = new Subscription(new VantivGateway());
13399
+
13400
+ if (type === "createPayment") {
13401
+ handleVantivSubscription();
13402
+ } // TODO: handle other types of payments
13403
+ // } else if (type === "orderCreate") {
13404
+ // purchase(stripeSource, state, dispatch);
13405
+ // } else if (type === "invoicePayment") {
13406
+ // payInvoice(new StripeGateway(), stripeSource.id, dispatch);
13407
+ // }
13408
+
13409
+
13410
+ function handleVantivSubscription() {
13411
+ const createSubscription = !isGift && !subscriptionIdToRenew;
13412
+ const renewSubscription = !isGift && subscriptionIdToRenew;
13413
+ const giftSubscriprition = isGift && !subscriptionIdToRenew;
13414
+ const renewGift = isRenewingGift;
13415
+ const {
13416
+ couponCode
13417
+ } = state;
13418
+ const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
13419
+
13420
+ if (renewGift) {
13421
+ return subscription.execute({
13422
+ type: SUBSCRIPTION_TYPES.RENEW_GIFTED_SUBSCRIPTION,
13423
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13424
+ plan,
13425
+ couponCode,
13426
+ product,
13427
+ isExistingSource: isUsingExistingPaymentMethod,
13428
+ subscriptionIdToRenew,
13429
+ addressId: selectedAddressId
13430
+ }, (err, res) => {
13431
+ if (err) {
13432
+ return handlePaymentError(err);
13433
+ }
13434
+
13435
+ onSuccess(res);
13436
+ });
13437
+ } else if (giftSubscriprition) {
13438
+ return subscription.execute({
13439
+ type: SUBSCRIPTION_TYPES.CREATE_GIFTED_SUBSCRIPTION,
13440
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13441
+ quantity: plan.quantity,
13442
+ plan,
13443
+ couponCode,
13444
+ product,
13445
+ isExistingSource: isUsingExistingPaymentMethod,
13446
+ giftRecipient,
13447
+ addressId: selectedAddressId
13448
+ }, (err, res) => {
13449
+ if (err) {
13450
+ return handlePaymentError(err);
13451
+ }
13452
+
13453
+ onSuccess(res);
13454
+ });
13455
+ } else if (renewSubscription) {
13456
+ return subscription.execute({
13457
+ type: SUBSCRIPTION_TYPES.RENEW_SUBSCRIPTION,
13458
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13459
+ quantity: plan.quantity,
13460
+ plan,
13461
+ couponCode,
13462
+ product,
13463
+ isExistingSource: isUsingExistingPaymentMethod,
13464
+ subscriptionIdToRenew,
13465
+ addressId: selectedAddressId
13466
+ }, (err, res) => {
13467
+ if (err) {
13468
+ return handlePaymentError(err);
13469
+ }
13470
+
13471
+ onSuccess(res);
13472
+ });
13473
+ } else if (createSubscription) {
13474
+ return subscription.execute({
13475
+ type: SUBSCRIPTION_TYPES.CREATE_SUBSCRIPTION,
13476
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13477
+ quantity: plan.quantity,
13478
+ plan,
13479
+ couponCode,
13480
+ product,
13481
+ isExistingSource: isUsingExistingPaymentMethod,
13482
+ addressId: selectedAddressId
13483
+ }, (err, res) => {
13484
+ if (err) {
13485
+ return handlePaymentError(err);
13486
+ }
13487
+
13488
+ onSuccess(res);
13489
+ });
13490
+ }
13491
+ }
13492
+ }
13493
+
13494
+ const vantivInstanceRef = React__default.useRef(null);
13495
+ useEffect(() => {
13496
+ const cardProcessor = getSiteCardProcessor();
13497
+
13498
+ if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
13499
+ var _window$Pelcro$site$r;
13500
+
13501
+ const payPageId = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_pay_page_id;
13502
+ vantivInstanceRef.current = new window.EprotectIframeClient({
13503
+ paypageId: payPageId,
13504
+ reportGroup: payPageId,
13505
+ style: "pelcro",
13506
+ height: "245",
13507
+ timeout: 50000,
13508
+ div: "eProtectiframe",
13509
+ callback: handleVantivPayment,
13510
+ showCvv: true,
13511
+ numYears: 8,
13512
+ placeholderText: {
13513
+ cvv: "CVV",
13514
+ accountNumber: "1234 1234 1234 1234"
13515
+ },
13516
+ enhancedUxFeatures: {
13517
+ inlineFieldValidations: true
13518
+ }
13519
+ });
13520
+ }
13521
+ }, [selectedPaymentMethodId]);
13522
+
13135
13523
  const initPaymentRequest = (state, dispatch) => {
13136
13524
  try {
13137
13525
  const paymentRequest = stripe.paymentRequest({
@@ -13202,9 +13590,9 @@ const PaymentMethodContainerWithoutStripe = ({
13202
13590
 
13203
13591
 
13204
13592
  const updateTotalAmountWithTax = () => {
13205
- var _window$Pelcro$site$r;
13593
+ var _window$Pelcro$site$r2;
13206
13594
 
13207
- const taxesEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.taxes_enabled;
13595
+ const taxesEnabled = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.taxes_enabled;
13208
13596
 
13209
13597
  if (taxesEnabled && type === "createPayment") {
13210
13598
  dispatch({
@@ -13554,7 +13942,7 @@ const PaymentMethodContainerWithoutStripe = ({
13554
13942
 
13555
13943
 
13556
13944
  const handlePaypalSubscription = (state, paypalNonce) => {
13557
- const subscription = new Subscription(new PaypalGateWay());
13945
+ const subscription = new Subscription(new PaypalGateway());
13558
13946
  const {
13559
13947
  couponCode
13560
13948
  } = state;
@@ -13849,13 +14237,13 @@ const PaymentMethodContainerWithoutStripe = ({
13849
14237
 
13850
14238
 
13851
14239
  const resolveTaxCalculation = () => {
13852
- var _window$Pelcro$site$r2;
14240
+ var _window$Pelcro$site$r3;
13853
14241
 
13854
14242
  if (type === "invoicePayment") {
13855
14243
  return new Promise(resolve => resolve());
13856
14244
  }
13857
14245
 
13858
- const taxesEnabled = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.taxes_enabled;
14246
+ const taxesEnabled = (_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.taxes_enabled;
13859
14247
  return new Promise((resolve, reject) => {
13860
14248
  // resolve early if taxes isn't enabled
13861
14249
  if (!taxesEnabled) {
@@ -13934,6 +14322,8 @@ const PaymentMethodContainerWithoutStripe = ({
13934
14322
  };
13935
14323
 
13936
14324
  const handlePaymentError = error => {
14325
+ var _getErrorMessages;
14326
+
13937
14327
  if (error.type === "validation_error" && // Subscription creation & renewal
13938
14328
  type === "createPayment") {
13939
14329
  var _state$couponObject;
@@ -13952,7 +14342,7 @@ const PaymentMethodContainerWithoutStripe = ({
13952
14342
  type: SHOW_ALERT,
13953
14343
  payload: {
13954
14344
  type: "error",
13955
- content: error === null || error === void 0 ? void 0 : error.message
14345
+ content: (_getErrorMessages = getErrorMessages(error)) !== null && _getErrorMessages !== void 0 ? _getErrorMessages : error === null || error === void 0 ? void 0 : error.message
13956
14346
  }
13957
14347
  });
13958
14348
  dispatch({
@@ -14047,6 +14437,10 @@ const PaymentMethodContainerWithoutStripe = ({
14047
14437
  disableSubmit: true,
14048
14438
  isLoading: true
14049
14439
  }, (state, dispatch) => {
14440
+ if (getSiteCardProcessor() === "vantiv") {
14441
+ return submitVantivPayment();
14442
+ }
14443
+
14050
14444
  if (selectedPaymentMethodId) {
14051
14445
  // pay with selected method (source) if exists already
14052
14446
  return handlePayment({
@@ -14056,16 +14450,16 @@ const PaymentMethodContainerWithoutStripe = ({
14056
14450
  }
14057
14451
 
14058
14452
  if (type === "updatePaymentSource") {
14059
- updatePaymentSource(state, dispatch);
14060
- } else {
14061
- submitPayment(state);
14453
+ return updatePaymentSource(state, dispatch);
14062
14454
  }
14455
+
14456
+ submitPayment(state);
14063
14457
  });
14064
14458
 
14065
14459
  case HANDLE_PAYPAL_SUBSCRIPTION:
14066
14460
  return lib_5(state, (state, dispatch) => {
14067
14461
  if (type === "invoicePayment") {
14068
- payInvoice(new PaypalGateWay(), action.payload, dispatch);
14462
+ payInvoice(new PaypalGateway(), action.payload, dispatch);
14069
14463
  } else {
14070
14464
  handlePaypalSubscription(state, action.payload);
14071
14465
  }
@@ -14248,19 +14642,35 @@ const CheckoutForm = () => {
14248
14642
  const {
14249
14643
  selectedPaymentMethodId
14250
14644
  } = usePelcro();
14251
- return !selectedPaymentMethodId && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(PelcroCardNumber, {
14252
- autoFocus: true
14253
- }), /*#__PURE__*/React__default.createElement("img", {
14254
- alt: "credit_cards",
14255
- className: "plc-h-4 plc-w-auto plc-mt-2",
14256
- src: "https://js.pelcro.com/ui/plugin/main/images/credit_cards.png"
14257
- }), /*#__PURE__*/React__default.createElement("div", {
14258
- className: "plc-flex plc-justify-between plc-my-2 plc-items-end"
14259
- }, /*#__PURE__*/React__default.createElement("div", {
14260
- className: "plc-w-6/12 plc-pr-4"
14261
- }, /*#__PURE__*/React__default.createElement(PelcroCardExpiry, null)), /*#__PURE__*/React__default.createElement("div", {
14262
- className: "plc-w-6/12 plc-pl-4"
14263
- }, /*#__PURE__*/React__default.createElement(PelcroCardCVC, null))));
14645
+ const cardProcessor = getSiteCardProcessor();
14646
+
14647
+ if (selectedPaymentMethodId) {
14648
+ return null;
14649
+ }
14650
+
14651
+ if (cardProcessor === "vantiv") {
14652
+ return /*#__PURE__*/React__default.createElement("div", {
14653
+ id: "eProtectiframe"
14654
+ });
14655
+ }
14656
+
14657
+ if (cardProcessor === "stripe") {
14658
+ return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(PelcroCardNumber, {
14659
+ autoFocus: true
14660
+ }), /*#__PURE__*/React__default.createElement("img", {
14661
+ alt: "credit_cards",
14662
+ className: "plc-w-auto plc-h-4 plc-mt-2",
14663
+ src: "https://js.pelcro.com/ui/plugin/main/images/credit_cards.png"
14664
+ }), /*#__PURE__*/React__default.createElement("div", {
14665
+ className: "plc-flex plc-items-end plc-justify-between plc-my-2"
14666
+ }, /*#__PURE__*/React__default.createElement("div", {
14667
+ className: "plc-w-6/12 plc-pr-4"
14668
+ }, /*#__PURE__*/React__default.createElement(PelcroCardExpiry, null)), /*#__PURE__*/React__default.createElement("div", {
14669
+ className: "plc-w-6/12 plc-pl-4"
14670
+ }, /*#__PURE__*/React__default.createElement(PelcroCardCVC, null))));
14671
+ }
14672
+
14673
+ return null;
14264
14674
  };
14265
14675
 
14266
14676
  const DiscountedPrice = props => {
@@ -14347,17 +14757,17 @@ const SubmitPaymentMethod = ({
14347
14757
  }, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
14348
14758
  };
14349
14759
 
14350
- var _path$l;
14760
+ var _path$m;
14351
14761
 
14352
- 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); }
14762
+ 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); }
14353
14763
 
14354
14764
  function SvgArrowLeft(props) {
14355
- return /*#__PURE__*/React.createElement("svg", _extends$n({
14765
+ return /*#__PURE__*/React.createElement("svg", _extends$o({
14356
14766
  xmlns: "http://www.w3.org/2000/svg",
14357
14767
  fill: "none",
14358
14768
  viewBox: "0 0 24 24",
14359
14769
  stroke: "currentColor"
14360
- }, props), _path$l || (_path$l = /*#__PURE__*/React.createElement("path", {
14770
+ }, props), _path$m || (_path$m = /*#__PURE__*/React.createElement("path", {
14361
14771
  strokeLinecap: "round",
14362
14772
  strokeLinejoin: "round",
14363
14773
  strokeWidth: 2,
@@ -14439,17 +14849,17 @@ const CouponCodeField = props => {
14439
14849
  }, props));
14440
14850
  };
14441
14851
 
14442
- var _path$k;
14852
+ var _path$l;
14443
14853
 
14444
- 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); }
14854
+ 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); }
14445
14855
 
14446
14856
  function SvgTicket(props) {
14447
- return /*#__PURE__*/React.createElement("svg", _extends$m({
14857
+ return /*#__PURE__*/React.createElement("svg", _extends$n({
14448
14858
  xmlns: "http://www.w3.org/2000/svg",
14449
14859
  fill: "none",
14450
14860
  viewBox: "0 0 24 24",
14451
14861
  stroke: "currentColor"
14452
- }, props), _path$k || (_path$k = /*#__PURE__*/React.createElement("path", {
14862
+ }, props), _path$l || (_path$l = /*#__PURE__*/React.createElement("path", {
14453
14863
  strokeLinecap: "round",
14454
14864
  strokeLinejoin: "round",
14455
14865
  strokeWidth: 2,
@@ -14809,16 +15219,16 @@ const BankRedirection = () => {
14809
15219
  }));
14810
15220
  };
14811
15221
 
14812
- var _path$j;
15222
+ var _path$k;
14813
15223
 
14814
- 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); }
15224
+ 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); }
14815
15225
 
14816
15226
  function SvgLock(props) {
14817
- return /*#__PURE__*/React.createElement("svg", _extends$l({
15227
+ return /*#__PURE__*/React.createElement("svg", _extends$m({
14818
15228
  xmlns: "http://www.w3.org/2000/svg",
14819
15229
  viewBox: "0 0 20 20",
14820
15230
  fill: "currentColor"
14821
- }, props), _path$j || (_path$j = /*#__PURE__*/React.createElement("path", {
15231
+ }, props), _path$k || (_path$k = /*#__PURE__*/React.createElement("path", {
14822
15232
  fillRule: "evenodd",
14823
15233
  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",
14824
15234
  clipRule: "evenodd"
@@ -14910,9 +15320,10 @@ function PaymentMethodView({
14910
15320
  const {
14911
15321
  t
14912
15322
  } = useTranslation("checkoutForm");
15323
+ const cardProcessor = getSiteCardProcessor();
14913
15324
  return /*#__PURE__*/React__default.createElement("div", {
14914
15325
  className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
14915
- }, /*#__PURE__*/React__default.createElement("div", {
15326
+ }, cardProcessor === "stripe" && /*#__PURE__*/React__default.createElement("div", {
14916
15327
  className: "plc-flex plc-items-center plc-w-full plc-px-4 plc-py-2 plc-text-center plc-text-green-600 plc-border plc-border-green-400 plc-rounded plc-bg-green-50"
14917
15328
  }, /*#__PURE__*/React__default.createElement(SvgLock, {
14918
15329
  className: "plc-w-5 plc-h-5 plc-mr-1"
@@ -15040,12 +15451,12 @@ function SubscriptionRenewModal({
15040
15451
  }
15041
15452
  SubscriptionRenewModal.viewId = "subscription-renew";
15042
15453
 
15043
- var _path$i;
15454
+ var _path$j;
15044
15455
 
15045
- 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); }
15456
+ 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); }
15046
15457
 
15047
15458
  function SvgGift(props) {
15048
- return /*#__PURE__*/React.createElement("svg", _extends$k({
15459
+ return /*#__PURE__*/React.createElement("svg", _extends$l({
15049
15460
  className: "plc-w-6 plc-h-6 plc-mr-2",
15050
15461
  fill: "none",
15051
15462
  stroke: "currentColor",
@@ -15054,7 +15465,7 @@ function SvgGift(props) {
15054
15465
  strokeWidth: 2,
15055
15466
  viewBox: "0 0 24 24",
15056
15467
  xmlns: "http://www.w3.org/2000/svg"
15057
- }, props), _path$i || (_path$i = /*#__PURE__*/React.createElement("path", {
15468
+ }, props), _path$j || (_path$j = /*#__PURE__*/React.createElement("path", {
15058
15469
  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"
15059
15470
  })));
15060
15471
  }
@@ -16063,17 +16474,17 @@ const UserUpdatePhone = props => /*#__PURE__*/React__default.createElement(Phone
16063
16474
 
16064
16475
  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";
16065
16476
 
16066
- var _path$h;
16477
+ var _path$i;
16067
16478
 
16068
- 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); }
16479
+ 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); }
16069
16480
 
16070
16481
  function SvgEdit(props) {
16071
- return /*#__PURE__*/React.createElement("svg", _extends$j({
16482
+ return /*#__PURE__*/React.createElement("svg", _extends$k({
16072
16483
  className: "plc-w-6 plc-h-6",
16073
16484
  xmlns: "http://www.w3.org/2000/svg",
16074
16485
  viewBox: "0 0 20 20",
16075
16486
  fill: "currentColor"
16076
- }, props), _path$h || (_path$h = /*#__PURE__*/React.createElement("path", {
16487
+ }, props), _path$i || (_path$i = /*#__PURE__*/React.createElement("path", {
16077
16488
  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"
16078
16489
  })));
16079
16490
  }
@@ -19183,18 +19594,18 @@ const GiftCreateLastName = props => /*#__PURE__*/React__default.createElement(La
19183
19594
  store: store$6
19184
19595
  }, props));
19185
19596
 
19186
- var _path$g;
19597
+ var _path$h;
19187
19598
 
19188
- 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); }
19599
+ 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); }
19189
19600
 
19190
19601
  function SvgInfoCircle(props) {
19191
- return /*#__PURE__*/React.createElement("svg", _extends$i({
19602
+ return /*#__PURE__*/React.createElement("svg", _extends$j({
19192
19603
  xmlns: "http://www.w3.org/2000/svg",
19193
19604
  className: "plc-w-5 plc-h-5",
19194
19605
  fill: "none",
19195
19606
  viewBox: "0 0 24 24",
19196
19607
  stroke: "currentColor"
19197
- }, props), _path$g || (_path$g = /*#__PURE__*/React.createElement("path", {
19608
+ }, props), _path$h || (_path$h = /*#__PURE__*/React.createElement("path", {
19198
19609
  strokeLinecap: "round",
19199
19610
  strokeLinejoin: "round",
19200
19611
  strokeWidth: 2,
@@ -20206,8 +20617,8 @@ const PaymentMethodSelectModal = ({
20206
20617
  };
20207
20618
  PaymentMethodSelectModal.viewId = "payment-method-select";
20208
20619
 
20209
- function _extends$h() {
20210
- _extends$h = Object.assign || function (target) {
20620
+ function _extends$i() {
20621
+ _extends$i = Object.assign || function (target) {
20211
20622
  for (var i = 1; i < arguments.length; i++) {
20212
20623
  var source = arguments[i];
20213
20624
 
@@ -20221,7 +20632,7 @@ function _extends$h() {
20221
20632
  return target;
20222
20633
  };
20223
20634
 
20224
- return _extends$h.apply(this, arguments);
20635
+ return _extends$i.apply(this, arguments);
20225
20636
  }
20226
20637
 
20227
20638
  function _objectWithoutPropertiesLoose(source, excluded) {
@@ -20405,7 +20816,7 @@ function render(props, propsBag, defaultTag, features, visible) {
20405
20816
  return match(strategy, (_match = {}, _match[RenderStrategy.Unmount] = function () {
20406
20817
  return null;
20407
20818
  }, _match[RenderStrategy.Hidden] = function () {
20408
- return _render(_extends$h({}, _rest, {
20819
+ return _render(_extends$i({}, _rest, {
20409
20820
  hidden: true,
20410
20821
  style: {
20411
20822
  display: 'none'
@@ -20933,7 +21344,7 @@ function TransitionChild(props) {
20933
21344
  var passthroughProps = rest;
20934
21345
  return React__default.createElement(NestingContext.Provider, {
20935
21346
  value: nesting
20936
- }, render(_extends$h({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
21347
+ }, render(_extends$i({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
20937
21348
  }
20938
21349
 
20939
21350
  function Transition(props) {
@@ -20977,7 +21388,7 @@ function Transition(props) {
20977
21388
  value: nestingBag
20978
21389
  }, React__default.createElement(TransitionContext.Provider, {
20979
21390
  value: transitionBag
20980
- }, render(_extends$h({}, sharedProps, {
21391
+ }, render(_extends$i({}, sharedProps, {
20981
21392
  as: Fragment,
20982
21393
  children: React__default.createElement(TransitionChild, Object.assign({}, sharedProps, passthroughProps))
20983
21394
  }), propsBag, Fragment, TransitionChildRenderFeatures, state === TreeStates.Visible)));
@@ -21104,12 +21515,12 @@ var ActionTypes;
21104
21515
  })(ActionTypes || (ActionTypes = {}));
21105
21516
 
21106
21517
  (_reducers = {}, _reducers[ActionTypes.CloseMenu] = function (state) {
21107
- return _extends$h({}, state, {
21518
+ return _extends$i({}, state, {
21108
21519
  activeItemIndex: null,
21109
21520
  menuState: MenuStates.Closed
21110
21521
  });
21111
21522
  }, _reducers[ActionTypes.OpenMenu] = function (state) {
21112
- return _extends$h({}, state, {
21523
+ return _extends$i({}, state, {
21113
21524
  menuState: MenuStates.Open
21114
21525
  });
21115
21526
  }, _reducers[ActionTypes.GoToItem] = function (state, action) {
@@ -21128,7 +21539,7 @@ var ActionTypes;
21128
21539
  }
21129
21540
  });
21130
21541
  if (state.searchQuery === '' && state.activeItemIndex === activeItemIndex) return state;
21131
- return _extends$h({}, state, {
21542
+ return _extends$i({}, state, {
21132
21543
  searchQuery: '',
21133
21544
  activeItemIndex: activeItemIndex
21134
21545
  });
@@ -21139,19 +21550,19 @@ var ActionTypes;
21139
21550
 
21140
21551
  return ((_item$dataRef$current = item.dataRef.current.textValue) == null ? void 0 : _item$dataRef$current.startsWith(searchQuery)) && !item.dataRef.current.disabled;
21141
21552
  });
21142
- if (match === -1 || match === state.activeItemIndex) return _extends$h({}, state, {
21553
+ if (match === -1 || match === state.activeItemIndex) return _extends$i({}, state, {
21143
21554
  searchQuery: searchQuery
21144
21555
  });
21145
- return _extends$h({}, state, {
21556
+ return _extends$i({}, state, {
21146
21557
  searchQuery: searchQuery,
21147
21558
  activeItemIndex: match
21148
21559
  });
21149
21560
  }, _reducers[ActionTypes.ClearSearch] = function (state) {
21150
- return _extends$h({}, state, {
21561
+ return _extends$i({}, state, {
21151
21562
  searchQuery: ''
21152
21563
  });
21153
21564
  }, _reducers[ActionTypes.RegisterItem] = function (state, action) {
21154
- return _extends$h({}, state, {
21565
+ return _extends$i({}, state, {
21155
21566
  items: [].concat(state.items, [{
21156
21567
  id: action.id,
21157
21568
  dataRef: action.dataRef
@@ -21164,7 +21575,7 @@ var ActionTypes;
21164
21575
  return a.id === action.id;
21165
21576
  });
21166
21577
  if (idx !== -1) nextItems.splice(idx, 1);
21167
- return _extends$h({}, state, {
21578
+ return _extends$i({}, state, {
21168
21579
  items: nextItems,
21169
21580
  activeItemIndex: function () {
21170
21581
  if (idx === state.activeItemIndex) return null;
@@ -21203,19 +21614,19 @@ var ActionTypes$1;
21203
21614
  (_reducers$1 = {}, _reducers$1[ActionTypes$1.CloseListbox] = function (state) {
21204
21615
  if (state.disabled) return state;
21205
21616
  if (state.listboxState === ListboxStates.Closed) return state;
21206
- return _extends$h({}, state, {
21617
+ return _extends$i({}, state, {
21207
21618
  activeOptionIndex: null,
21208
21619
  listboxState: ListboxStates.Closed
21209
21620
  });
21210
21621
  }, _reducers$1[ActionTypes$1.OpenListbox] = function (state) {
21211
21622
  if (state.disabled) return state;
21212
21623
  if (state.listboxState === ListboxStates.Open) return state;
21213
- return _extends$h({}, state, {
21624
+ return _extends$i({}, state, {
21214
21625
  listboxState: ListboxStates.Open
21215
21626
  });
21216
21627
  }, _reducers$1[ActionTypes$1.SetDisabled] = function (state, action) {
21217
21628
  if (state.disabled === action.disabled) return state;
21218
- return _extends$h({}, state, {
21629
+ return _extends$i({}, state, {
21219
21630
  disabled: action.disabled
21220
21631
  });
21221
21632
  }, _reducers$1[ActionTypes$1.GoToOption] = function (state, action) {
@@ -21236,7 +21647,7 @@ var ActionTypes$1;
21236
21647
  }
21237
21648
  });
21238
21649
  if (state.searchQuery === '' && state.activeOptionIndex === activeOptionIndex) return state;
21239
- return _extends$h({}, state, {
21650
+ return _extends$i({}, state, {
21240
21651
  searchQuery: '',
21241
21652
  activeOptionIndex: activeOptionIndex
21242
21653
  });
@@ -21249,10 +21660,10 @@ var ActionTypes$1;
21249
21660
 
21250
21661
  return !option.dataRef.current.disabled && ((_option$dataRef$curre = option.dataRef.current.textValue) == null ? void 0 : _option$dataRef$curre.startsWith(searchQuery));
21251
21662
  });
21252
- if (match === -1 || match === state.activeOptionIndex) return _extends$h({}, state, {
21663
+ if (match === -1 || match === state.activeOptionIndex) return _extends$i({}, state, {
21253
21664
  searchQuery: searchQuery
21254
21665
  });
21255
- return _extends$h({}, state, {
21666
+ return _extends$i({}, state, {
21256
21667
  searchQuery: searchQuery,
21257
21668
  activeOptionIndex: match
21258
21669
  });
@@ -21260,11 +21671,11 @@ var ActionTypes$1;
21260
21671
  if (state.disabled) return state;
21261
21672
  if (state.listboxState === ListboxStates.Closed) return state;
21262
21673
  if (state.searchQuery === '') return state;
21263
- return _extends$h({}, state, {
21674
+ return _extends$i({}, state, {
21264
21675
  searchQuery: ''
21265
21676
  });
21266
21677
  }, _reducers$1[ActionTypes$1.RegisterOption] = function (state, action) {
21267
- return _extends$h({}, state, {
21678
+ return _extends$i({}, state, {
21268
21679
  options: [].concat(state.options, [{
21269
21680
  id: action.id,
21270
21681
  dataRef: action.dataRef
@@ -21277,7 +21688,7 @@ var ActionTypes$1;
21277
21688
  return a.id === action.id;
21278
21689
  });
21279
21690
  if (idx !== -1) nextOptions.splice(idx, 1);
21280
- return _extends$h({}, state, {
21691
+ return _extends$i({}, state, {
21281
21692
  options: nextOptions,
21282
21693
  activeOptionIndex: function () {
21283
21694
  if (idx === state.activeOptionIndex) return null;
@@ -21338,18 +21749,18 @@ const getPaymentCardIcon = name => {
21338
21749
  }));
21339
21750
  };
21340
21751
 
21341
- var _path$f;
21752
+ var _path$g;
21342
21753
 
21343
- 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); }
21754
+ 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); }
21344
21755
 
21345
21756
  function SvgChevronRight(props) {
21346
- return /*#__PURE__*/React.createElement("svg", _extends$g({
21757
+ return /*#__PURE__*/React.createElement("svg", _extends$h({
21347
21758
  className: "plc-w-6 plc-h-6",
21348
21759
  xmlns: "http://www.w3.org/2000/svg",
21349
21760
  fill: "none",
21350
21761
  viewBox: "0 0 24 24",
21351
21762
  stroke: "currentColor"
21352
- }, props), _path$f || (_path$f = /*#__PURE__*/React.createElement("path", {
21763
+ }, props), _path$g || (_path$g = /*#__PURE__*/React.createElement("path", {
21353
21764
  strokeLinecap: "round",
21354
21765
  strokeLinejoin: "round",
21355
21766
  strokeWidth: 2,
@@ -21565,18 +21976,18 @@ const SavedItems = ({
21565
21976
  });
21566
21977
  };
21567
21978
 
21568
- var _path$e;
21979
+ var _path$f;
21569
21980
 
21570
- 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); }
21981
+ 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); }
21571
21982
 
21572
21983
  function SvgRefresh(props) {
21573
- return /*#__PURE__*/React.createElement("svg", _extends$f({
21984
+ return /*#__PURE__*/React.createElement("svg", _extends$g({
21574
21985
  className: "plc-w-4 plc-h-4 plc-mr-1",
21575
21986
  xmlns: "http://www.w3.org/2000/svg",
21576
21987
  fill: "none",
21577
21988
  viewBox: "0 0 24 24",
21578
21989
  stroke: "currentColor"
21579
- }, props), _path$e || (_path$e = /*#__PURE__*/React.createElement("path", {
21990
+ }, props), _path$f || (_path$f = /*#__PURE__*/React.createElement("path", {
21580
21991
  strokeLinecap: "round",
21581
21992
  strokeLinejoin: "round",
21582
21993
  strokeWidth: 2,
@@ -21584,35 +21995,35 @@ function SvgRefresh(props) {
21584
21995
  })));
21585
21996
  }
21586
21997
 
21587
- var _path$d;
21998
+ var _path$e;
21588
21999
 
21589
- 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); }
22000
+ 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); }
21590
22001
 
21591
22002
  function SvgCalendar(props) {
21592
- return /*#__PURE__*/React.createElement("svg", _extends$e({
22003
+ return /*#__PURE__*/React.createElement("svg", _extends$f({
21593
22004
  xmlns: "http://www.w3.org/2000/svg",
21594
22005
  className: "plc-h-4 plc-w-4 plc-mr-1",
21595
22006
  viewBox: "0 0 20 20",
21596
22007
  fill: "currentColor"
21597
- }, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
22008
+ }, props), _path$e || (_path$e = /*#__PURE__*/React.createElement("path", {
21598
22009
  fillRule: "evenodd",
21599
22010
  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",
21600
22011
  clipRule: "evenodd"
21601
22012
  })));
21602
22013
  }
21603
22014
 
21604
- var _path$c;
22015
+ var _path$d;
21605
22016
 
21606
- 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); }
22017
+ 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); }
21607
22018
 
21608
22019
  function SvgPlus(props) {
21609
- return /*#__PURE__*/React.createElement("svg", _extends$d({
22020
+ return /*#__PURE__*/React.createElement("svg", _extends$e({
21610
22021
  className: "plc-w-5 plc-h-5",
21611
22022
  xmlns: "http://www.w3.org/2000/svg",
21612
22023
  fill: "none",
21613
22024
  viewBox: "0 0 24 24",
21614
22025
  stroke: "currentColor"
21615
- }, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
22026
+ }, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
21616
22027
  strokeLinecap: "round",
21617
22028
  strokeLinejoin: "round",
21618
22029
  strokeWidth: 2,
@@ -21620,17 +22031,17 @@ function SvgPlus(props) {
21620
22031
  })));
21621
22032
  }
21622
22033
 
21623
- var _path$b;
22034
+ var _path$c;
21624
22035
 
21625
- 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); }
22036
+ 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); }
21626
22037
 
21627
22038
  function SvgCheckMark(props) {
21628
- return /*#__PURE__*/React.createElement("svg", _extends$c({
22039
+ return /*#__PURE__*/React.createElement("svg", _extends$d({
21629
22040
  className: "plc-w-4 plc-h-4 plc-mr-1",
21630
22041
  xmlns: "http://www.w3.org/2000/svg",
21631
22042
  viewBox: "0 0 20 20",
21632
22043
  fill: "currentColor"
21633
- }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
22044
+ }, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
21634
22045
  fillRule: "evenodd",
21635
22046
  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",
21636
22047
  clipRule: "evenodd"
@@ -21925,13 +22336,31 @@ Accordion.item = function AccordionItem({
21925
22336
  }, content)) : null;
21926
22337
  };
21927
22338
 
22339
+ var _path$b;
22340
+
22341
+ 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); }
22342
+
22343
+ function SvgExit(props) {
22344
+ return /*#__PURE__*/React.createElement("svg", _extends$c({
22345
+ className: "plc-w-6 plc-h-6",
22346
+ xmlns: "http://www.w3.org/2000/svg",
22347
+ fill: "none",
22348
+ viewBox: "0 0 24 24",
22349
+ stroke: "currentColor"
22350
+ }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
22351
+ strokeLinecap: "round",
22352
+ strokeLinejoin: "round",
22353
+ strokeWidth: 2,
22354
+ d: "M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"
22355
+ })));
22356
+ }
22357
+
21928
22358
  var _path$a;
21929
22359
 
21930
22360
  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); }
21931
22361
 
21932
- function SvgExit(props) {
22362
+ function SvgUser(props) {
21933
22363
  return /*#__PURE__*/React.createElement("svg", _extends$b({
21934
- className: "plc-w-6 plc-h-6",
21935
22364
  xmlns: "http://www.w3.org/2000/svg",
21936
22365
  fill: "none",
21937
22366
  viewBox: "0 0 24 24",
@@ -21940,7 +22369,7 @@ function SvgExit(props) {
21940
22369
  strokeLinecap: "round",
21941
22370
  strokeLinejoin: "round",
21942
22371
  strokeWidth: 2,
21943
- d: "M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"
22372
+ d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zm-4 7a7 7 0 00-7 7h14a7 7 0 00-7-7z"
21944
22373
  })));
21945
22374
  }
21946
22375
 
@@ -21948,9 +22377,10 @@ var _path$9;
21948
22377
 
21949
22378
  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); }
21950
22379
 
21951
- function SvgUser(props) {
22380
+ function SvgNewsletter(props) {
21952
22381
  return /*#__PURE__*/React.createElement("svg", _extends$a({
21953
22382
  xmlns: "http://www.w3.org/2000/svg",
22383
+ className: "plc-h-5 plc-w-5",
21954
22384
  fill: "none",
21955
22385
  viewBox: "0 0 24 24",
21956
22386
  stroke: "currentColor"
@@ -21958,7 +22388,7 @@ function SvgUser(props) {
21958
22388
  strokeLinecap: "round",
21959
22389
  strokeLinejoin: "round",
21960
22390
  strokeWidth: 2,
21961
- d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zm-4 7a7 7 0 00-7 7h14a7 7 0 00-7-7z"
22391
+ d: "M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z"
21962
22392
  })));
21963
22393
  }
21964
22394
 
@@ -21966,10 +22396,10 @@ var _path$8;
21966
22396
 
21967
22397
  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); }
21968
22398
 
21969
- function SvgNewsletter(props) {
22399
+ function SvgDocument(props) {
21970
22400
  return /*#__PURE__*/React.createElement("svg", _extends$9({
21971
22401
  xmlns: "http://www.w3.org/2000/svg",
21972
- className: "plc-h-5 plc-w-5",
22402
+ className: "plc-h-6 plc-w-6 plc-mr-2",
21973
22403
  fill: "none",
21974
22404
  viewBox: "0 0 24 24",
21975
22405
  stroke: "currentColor"
@@ -21977,7 +22407,7 @@ function SvgNewsletter(props) {
21977
22407
  strokeLinecap: "round",
21978
22408
  strokeLinejoin: "round",
21979
22409
  strokeWidth: 2,
21980
- d: "M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z"
22410
+ d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
21981
22411
  })));
21982
22412
  }
21983
22413
 
@@ -22157,6 +22587,138 @@ function formatStartDate(date) {
22157
22587
  return new Intl.DateTimeFormat("en-CA").format(startDate);
22158
22588
  }
22159
22589
 
22590
+ const InvoicesMenu = props => {
22591
+ const {
22592
+ t
22593
+ } = useTranslation("dashboard");
22594
+ return /*#__PURE__*/React__default.createElement("table", {
22595
+ className: "plc-w-full plc-table-fixed"
22596
+ }, /*#__PURE__*/React__default.createElement("thead", {
22597
+ className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
22598
+ }, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
22599
+ className: "plc-w-4/12 "
22600
+ }, t("labels.details")), /*#__PURE__*/React__default.createElement("th", {
22601
+ className: "plc-w-4/12 "
22602
+ }, t("labels.status.title")), /*#__PURE__*/React__default.createElement("th", {
22603
+ className: "plc-w-3/12 "
22604
+ }, t("labels.actions")))), /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", {
22605
+ className: "plc-h-4"
22606
+ }), /*#__PURE__*/React__default.createElement(InvoicesItems, props)));
22607
+ };
22608
+
22609
+ const InvoicesItems = () => {
22610
+ var _window$Pelcro$invoic, _window$Pelcro$invoic2;
22611
+
22612
+ const {
22613
+ t
22614
+ } = useTranslation("dashboard");
22615
+ const {
22616
+ setInvoice,
22617
+ switchView
22618
+ } = usePelcro();
22619
+ const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
22620
+
22621
+ const showInvoiceDetails = event => {
22622
+ if (setInvoice(event.target.dataset.id)) {
22623
+ switchView("invoice-details");
22624
+ }
22625
+ };
22626
+
22627
+ if (invoices.length === 0) return null;
22628
+ return invoices.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()).map(invoice => {
22629
+ const invoiceStatus = getInvoiceStatus(invoice);
22630
+ const formattedCreationDate = new Intl.DateTimeFormat("en-CA").format(new Date(invoice.created_at));
22631
+ return /*#__PURE__*/React__default.createElement("tr", {
22632
+ key: invoice.id,
22633
+ className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50`
22634
+ }, /*#__PURE__*/React__default.createElement("td", {
22635
+ className: "plc-truncate"
22636
+ }, /*#__PURE__*/React__default.createElement("span", {
22637
+ className: "plc-font-semibold plc-text-gray-500"
22638
+ }, `#${invoice.id}`), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
22639
+ className: "plc-text-sm plc-text-gray-500"
22640
+ }, getFormattedPriceByLocal(invoice.total, invoice.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
22641
+ className: "plc-text-sm plc-text-gray-500"
22642
+ }, formattedCreationDate)), /*#__PURE__*/React__default.createElement("td", {
22643
+ className: "plc-py-2"
22644
+ }, /*#__PURE__*/React__default.createElement("span", {
22645
+ className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${invoiceStatus.bgColor} plc-uppercase ${invoiceStatus.textColor} plc-rounded-lg`
22646
+ }, invoiceStatus.icon, invoiceStatus.title)), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement(Button, {
22647
+ variant: "ghost",
22648
+ className: "plc-text-blue-400 focus:plc-ring-blue-400 pelcro-dashboard-view-invoice-button",
22649
+ icon: /*#__PURE__*/React__default.createElement(SvgDocument, {
22650
+ className: "plc-w-4 plc-h-4"
22651
+ }),
22652
+ onClick: showInvoiceDetails,
22653
+ "data-id": invoice.id
22654
+ }, t("labels.view"))));
22655
+ });
22656
+ };
22657
+
22658
+ function getInvoiceStatus(invoice) {
22659
+ const translations = i18next.t("dashboard:labels", {
22660
+ returnObjects: true
22661
+ });
22662
+
22663
+ switch (invoice.status) {
22664
+ case "paid":
22665
+ return {
22666
+ textColor: "plc-text-green-700",
22667
+ bgColor: "plc-bg-green-100",
22668
+ icon: /*#__PURE__*/React__default.createElement(SvgCheckMark, null),
22669
+ title: translations.paid
22670
+ };
22671
+
22672
+ case "past_due":
22673
+ return {
22674
+ textColor: "plc-text-orange-700",
22675
+ bgColor: "plc-bg-orange-100",
22676
+ icon: /*#__PURE__*/React__default.createElement(SvgExclamation, null),
22677
+ title: translations.pastDue
22678
+ };
22679
+
22680
+ case "open":
22681
+ return {
22682
+ textColor: "plc-text-yellow-700",
22683
+ bgColor: "plc-bg-yellow-100",
22684
+ icon: /*#__PURE__*/React__default.createElement(SvgExclamation, null),
22685
+ title: translations.open
22686
+ };
22687
+
22688
+ case "draft":
22689
+ return {
22690
+ textColor: "plc-text-blue-700",
22691
+ bgColor: "plc-bg-blue-100",
22692
+ icon: /*#__PURE__*/React__default.createElement(SvgEdit, null),
22693
+ title: translations.draft
22694
+ };
22695
+
22696
+ case "scheduled":
22697
+ return {
22698
+ textColor: "plc-text-blue-700",
22699
+ bgColor: "plc-bg-blue-100",
22700
+ icon: /*#__PURE__*/React__default.createElement(SvgCalendar, null),
22701
+ title: translations.scheduled
22702
+ };
22703
+
22704
+ case "uncollectible":
22705
+ return {
22706
+ textColor: "plc-text-red-700",
22707
+ bgColor: "plc-bg-red-100",
22708
+ icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
22709
+ title: translations.uncollectible
22710
+ };
22711
+
22712
+ case "void":
22713
+ return {
22714
+ textColor: "plc-text-gray-700",
22715
+ bgColor: "plc-bg-gray-100",
22716
+ icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
22717
+ title: translations.void
22718
+ };
22719
+ }
22720
+ }
22721
+
22160
22722
  const SUB_MENUS = {
22161
22723
  PROFILE: "profile",
22162
22724
  SUBSCRIPTIONS: "subscriptions",
@@ -22710,6 +23272,12 @@ class Dashboard extends Component {
22710
23272
  icon: /*#__PURE__*/React__default.createElement(SvgShopping, null),
22711
23273
  title: this.locale("labels.orders.label"),
22712
23274
  content: /*#__PURE__*/React__default.createElement(OrdersMenu, null)
23275
+ }), /*#__PURE__*/React__default.createElement(Accordion.item, {
23276
+ show: hasInvoices(),
23277
+ name: SUB_MENUS.INVOICES,
23278
+ icon: /*#__PURE__*/React__default.createElement(SvgDocument, null),
23279
+ title: this.locale("labels.invoices"),
23280
+ content: /*#__PURE__*/React__default.createElement(InvoicesMenu, null)
22713
23281
  }), /*#__PURE__*/React__default.createElement(Accordion.item, {
22714
23282
  name: SUB_MENUS.SAVED_ITEMS,
22715
23283
  icon: /*#__PURE__*/React__default.createElement(SvgBookmark, null),
@@ -22725,6 +23293,13 @@ class Dashboard extends Component {
22725
23293
 
22726
23294
  }
22727
23295
 
23296
+ function hasInvoices() {
23297
+ var _window$Pelcro$invoic, _window$Pelcro$invoic2;
23298
+
23299
+ const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
23300
+ return invoices.length > 0;
23301
+ }
23302
+
22728
23303
  function hasDonationSubs() {
22729
23304
  var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
22730
23305