@pelcro/react-pelcro-js 3.1.0-beta.9 → 3.2.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
@@ -3461,9 +3461,9 @@ var paymentMethod_fr = {
3461
3461
  select: select
3462
3462
  };
3463
3463
 
3464
- var title$f = "Enter your email to subscribe to our newsletter";
3464
+ var title$h = "Enter your email to subscribe to our newsletter";
3465
3465
  var updateTitle$1 = "Update newsletter selections";
3466
- var subtitle$7 = "We may use your email for other marketing communication";
3466
+ var subtitle$9 = "We may use your email for other marketing communication";
3467
3467
  var labels$p = {
3468
3468
  submit: "Submit",
3469
3469
  firstName: "First name",
@@ -3480,16 +3480,16 @@ var messages$r = {
3480
3480
  here: "here"
3481
3481
  };
3482
3482
  var newsletter_en = {
3483
- title: title$f,
3483
+ title: title$h,
3484
3484
  updateTitle: updateTitle$1,
3485
- subtitle: subtitle$7,
3485
+ subtitle: subtitle$9,
3486
3486
  labels: labels$p,
3487
3487
  messages: messages$r
3488
3488
  };
3489
3489
 
3490
- var title$e = "Entrez votre adresse courriel pour vous abonner à notre infolettre";
3490
+ var title$g = "Entrez votre adresse courriel pour vous abonner à notre infolettre";
3491
3491
  var updateTitle = "Mettre à jour son choix d'infolettres";
3492
- var subtitle$6 = "Nous pouvons utiliser votre adresse courriel pour d’autres communications marketing";
3492
+ var subtitle$8 = "Nous pouvons utiliser votre adresse courriel pour d’autres communications marketing";
3493
3493
  var labels$o = {
3494
3494
  submit: "Lire l’article !",
3495
3495
  firstName: "Prénom",
@@ -3506,9 +3506,9 @@ var messages$q = {
3506
3506
  here: "ici"
3507
3507
  };
3508
3508
  var newsletter_fr = {
3509
- title: title$e,
3509
+ title: title$g,
3510
3510
  updateTitle: updateTitle,
3511
- subtitle: subtitle$6,
3511
+ subtitle: subtitle$8,
3512
3512
  labels: labels$o,
3513
3513
  messages: messages$q
3514
3514
  };
@@ -3765,8 +3765,8 @@ var login_fr = {
3765
3765
  errors: errors$4
3766
3766
  };
3767
3767
 
3768
- var title$d = "Create an account";
3769
- var subtitle$5 = "Enter your email and password below";
3768
+ var title$f = "Create an account";
3769
+ var subtitle$7 = "Enter your email and password below";
3770
3770
  var labels$h = {
3771
3771
  signUpFacebook: "Sign up with Facebook",
3772
3772
  signUpGoogle: "Sign up with Google",
@@ -3851,8 +3851,8 @@ var redeem$1 = {
3851
3851
  }
3852
3852
  };
3853
3853
  var register_en = {
3854
- title: title$d,
3855
- subtitle: subtitle$5,
3854
+ title: title$f,
3855
+ subtitle: subtitle$7,
3856
3856
  labels: labels$h,
3857
3857
  messages: messages$h,
3858
3858
  errors: errors$3,
@@ -3860,8 +3860,8 @@ var register_en = {
3860
3860
  redeem: redeem$1
3861
3861
  };
3862
3862
 
3863
- var title$c = "Créer un compte";
3864
- var subtitle$4 = "Entrez votre courriel et votre mot de passe ci-dessous";
3863
+ var title$e = "Créer un compte";
3864
+ var subtitle$6 = "Entrez votre courriel et votre mot de passe ci-dessous";
3865
3865
  var labels$g = {
3866
3866
  signUpFacebook: "Inscrivez-vous avec Facebook",
3867
3867
  signUpGoogle: "Inscrivez-vous avec Google",
@@ -3947,8 +3947,8 @@ var redeem = {
3947
3947
  }
3948
3948
  };
3949
3949
  var register_fr = {
3950
- title: title$c,
3951
- subtitle: subtitle$4,
3950
+ title: title$e,
3951
+ subtitle: subtitle$6,
3952
3952
  labels: labels$g,
3953
3953
  messages: messages$g,
3954
3954
  errors: errors$2,
@@ -4008,7 +4008,7 @@ var userEdit_fr = {
4008
4008
  messages: messages$e
4009
4009
  };
4010
4010
 
4011
- var title$b = "Enter your shipping address";
4011
+ var title$d = "Enter your shipping address";
4012
4012
  var selectAddressTitle$1 = "Please select an address";
4013
4013
  var selectAddressSubtitle$1 = "Select one of your saved addresses, or add a new one";
4014
4014
  var labels$d = {
@@ -4031,7 +4031,7 @@ var messages$d = {
4031
4031
  subRedeemed: "Your subscription has been redeemed."
4032
4032
  };
4033
4033
  var address_en = {
4034
- title: title$b,
4034
+ title: title$d,
4035
4035
  selectAddressTitle: selectAddressTitle$1,
4036
4036
  selectAddressSubtitle: selectAddressSubtitle$1,
4037
4037
  labels: labels$d,
@@ -4039,7 +4039,7 @@ var address_en = {
4039
4039
  messages: messages$d
4040
4040
  };
4041
4041
 
4042
- var title$a = "Entrez votre adresse de livraison";
4042
+ var title$c = "Entrez votre adresse de livraison";
4043
4043
  var selectAddressTitle = "Veuillez sélectionner une adresse";
4044
4044
  var selectAddressSubtitle = "Choisissez l'une de vos adresses ou créez-en une nouvelle";
4045
4045
  var labels$c = {
@@ -4062,7 +4062,7 @@ var messages$c = {
4062
4062
  subRedeemed: "Votre abonnement a bien été activé."
4063
4063
  };
4064
4064
  var address_fr = {
4065
- title: title$a,
4065
+ title: title$c,
4066
4066
  selectAddressTitle: selectAddressTitle,
4067
4067
  selectAddressSubtitle: selectAddressSubtitle,
4068
4068
  labels: labels$c,
@@ -4070,8 +4070,8 @@ var address_fr = {
4070
4070
  messages: messages$c
4071
4071
  };
4072
4072
 
4073
- var title$9 = "Reset your password";
4074
- var subtitle$3 = "Enter a new password below";
4073
+ var title$b = "Reset your password";
4074
+ var subtitle$5 = "Enter a new password below";
4075
4075
  var email$3 = "Email";
4076
4076
  var password$3 = "Password";
4077
4077
  var confirmPassword$1 = "Confirm password";
@@ -4079,8 +4079,8 @@ var submit$5 = "Submit";
4079
4079
  var required$5 = "Required";
4080
4080
  var passwordUpdated$1 = "Password has been updated, please login with the new password";
4081
4081
  var passwordReset_en = {
4082
- title: title$9,
4083
- subtitle: subtitle$3,
4082
+ title: title$b,
4083
+ subtitle: subtitle$5,
4084
4084
  email: email$3,
4085
4085
  password: password$3,
4086
4086
  confirmPassword: confirmPassword$1,
@@ -4089,8 +4089,8 @@ var passwordReset_en = {
4089
4089
  passwordUpdated: passwordUpdated$1
4090
4090
  };
4091
4091
 
4092
- var title$8 = "Réinitialiser votre mot de passe";
4093
- var subtitle$2 = "Entrez un nouveau mot de passe ci-dessous";
4092
+ var title$a = "Réinitialiser votre mot de passe";
4093
+ var subtitle$4 = "Entrez un nouveau mot de passe ci-dessous";
4094
4094
  var email$2 = "Adresse courriel";
4095
4095
  var password$2 = "Mot de passe";
4096
4096
  var confirmPassword = "Confirmer le mot de passe";
@@ -4098,8 +4098,8 @@ var submit$4 = "Soumettre";
4098
4098
  var required$4 = "Champs obligatoires";
4099
4099
  var passwordUpdated = "Votre mot de passe a été mis à jour, veuillez vous connecter avec celui-ci";
4100
4100
  var passwordReset_fr = {
4101
- title: title$8,
4102
- subtitle: subtitle$2,
4101
+ title: title$a,
4102
+ subtitle: subtitle$4,
4103
4103
  email: email$2,
4104
4104
  password: password$2,
4105
4105
  confirmPassword: confirmPassword,
@@ -4108,7 +4108,7 @@ var passwordReset_fr = {
4108
4108
  passwordUpdated: passwordUpdated
4109
4109
  };
4110
4110
 
4111
- var title$7 = "Forgot your password?";
4111
+ var title$9 = "Forgot your password?";
4112
4112
  var email$1 = "Email";
4113
4113
  var password$1 = "Password";
4114
4114
  var submit$3 = "Submit";
@@ -4119,7 +4119,7 @@ var messages$b = {
4119
4119
  loginHere: "login here."
4120
4120
  };
4121
4121
  var passwordForgot_en = {
4122
- title: title$7,
4122
+ title: title$9,
4123
4123
  email: email$1,
4124
4124
  password: password$1,
4125
4125
  submit: submit$3,
@@ -4128,7 +4128,7 @@ var passwordForgot_en = {
4128
4128
  messages: messages$b
4129
4129
  };
4130
4130
 
4131
- var title$6 = "Mot de passe oublié ?";
4131
+ var title$8 = "Mot de passe oublié ?";
4132
4132
  var email = "Courriel";
4133
4133
  var password = "Mot de passe";
4134
4134
  var submit$2 = "Soumettre";
@@ -4139,7 +4139,7 @@ var messages$a = {
4139
4139
  loginHere: "Connectez-vous ici"
4140
4140
  };
4141
4141
  var passwordForgot_fr = {
4142
- title: title$6,
4142
+ title: title$8,
4143
4143
  email: email,
4144
4144
  password: password,
4145
4145
  submit: submit$2,
@@ -4148,7 +4148,7 @@ var passwordForgot_fr = {
4148
4148
  messages: messages$a
4149
4149
  };
4150
4150
 
4151
- var title$5 = "Change your password";
4151
+ var title$7 = "Change your password";
4152
4152
  var currentPassword$1 = "Current password";
4153
4153
  var newPassword$1 = "New password";
4154
4154
  var confirmNewPassword$1 = "Confirm new password";
@@ -4158,7 +4158,7 @@ var passwordChanged$1 = "Password has been changed, please login with the new pa
4158
4158
  var passwordsNotMatching$1 = "Passwords don't match";
4159
4159
  var weakPassword$1 = "Your password must contain at least 6 characters";
4160
4160
  var passwordChange_en = {
4161
- title: title$5,
4161
+ title: title$7,
4162
4162
  currentPassword: currentPassword$1,
4163
4163
  newPassword: newPassword$1,
4164
4164
  confirmNewPassword: confirmNewPassword$1,
@@ -4169,7 +4169,7 @@ var passwordChange_en = {
4169
4169
  weakPassword: weakPassword$1
4170
4170
  };
4171
4171
 
4172
- var title$4 = "Changez votre mot de passe";
4172
+ var title$6 = "Changez votre mot de passe";
4173
4173
  var currentPassword = "Mot de passe actuel";
4174
4174
  var newPassword = "Nouveau mot de passe";
4175
4175
  var confirmNewPassword = "Confirmer le nouveau mot de passe";
@@ -4179,7 +4179,7 @@ var passwordChanged = "Le mot de passe a été modifié, veuillez vous connecter
4179
4179
  var passwordsNotMatching = "Les mots de passe ne correspondent pas";
4180
4180
  var weakPassword = "Votre mot de passe doit contenir au moins 6";
4181
4181
  var passwordChange_fr = {
4182
- title: title$4,
4182
+ title: title$6,
4183
4183
  currentPassword: currentPassword,
4184
4184
  newPassword: newPassword,
4185
4185
  confirmNewPassword: confirmNewPassword,
@@ -4190,8 +4190,8 @@ var passwordChange_fr = {
4190
4190
  weakPassword: weakPassword
4191
4191
  };
4192
4192
 
4193
- var title$3 = "Votre panier";
4194
- var subtitle$1 = "Terminez votre achat ci-dessous";
4193
+ var title$5 = "Votre panier";
4194
+ var subtitle$3 = "Terminez votre achat ci-dessous";
4195
4195
  var name$1 = "Produit";
4196
4196
  var quantity$1 = "Quantité";
4197
4197
  var price$1 = "Prix";
@@ -4202,8 +4202,8 @@ var confirm$3 = "Passer à la caisse";
4202
4202
  var empty$1 = "Votre panier est vide.";
4203
4203
  var removeAll$1 = "Vider";
4204
4204
  var cart_fr = {
4205
- title: title$3,
4206
- subtitle: subtitle$1,
4205
+ title: title$5,
4206
+ subtitle: subtitle$3,
4207
4207
  name: name$1,
4208
4208
  quantity: quantity$1,
4209
4209
  price: price$1,
@@ -4215,8 +4215,8 @@ var cart_fr = {
4215
4215
  removeAll: removeAll$1
4216
4216
  };
4217
4217
 
4218
- var title$2 = "Your shopping cart";
4219
- var subtitle = "Comple your purchase below";
4218
+ var title$4 = "Your shopping cart";
4219
+ var subtitle$2 = "Comple your purchase below";
4220
4220
  var name = "Name";
4221
4221
  var quantity = "Quantity";
4222
4222
  var price = "Price";
@@ -4227,8 +4227,8 @@ var confirm$2 = "Checkout";
4227
4227
  var empty = "Your cart is empty.";
4228
4228
  var removeAll = "Remove all";
4229
4229
  var cart_en = {
4230
- title: title$2,
4231
- subtitle: subtitle,
4230
+ title: title$4,
4231
+ subtitle: subtitle$2,
4232
4232
  name: name,
4233
4233
  quantity: quantity,
4234
4234
  price: price,
@@ -4666,7 +4666,7 @@ var verifyEmail_fr = {
4666
4666
  messages: messages
4667
4667
  };
4668
4668
 
4669
- var title$1 = "Invoice details";
4669
+ var title$3 = "Invoice details";
4670
4670
  var labels$1 = {
4671
4671
  summary: "Summary",
4672
4672
  total: "Total",
@@ -4679,29 +4679,55 @@ var buttons$1 = {
4679
4679
  pay: "Pay now"
4680
4680
  };
4681
4681
  var invoiceDetails_en = {
4682
- title: title$1,
4682
+ title: title$3,
4683
4683
  labels: labels$1,
4684
4684
  buttons: buttons$1
4685
4685
  };
4686
4686
 
4687
- var title = "Invoice details";
4687
+ var title$2 = "Détails de la facture";
4688
4688
  var labels = {
4689
- summary: "Summary",
4689
+ summary: "Résumé",
4690
4690
  total: "Total",
4691
- amountPaid: "Amount paid",
4692
- amountDue: "Amount due",
4693
- creationDate: "Created on:"
4691
+ amountPaid: "Montant payé",
4692
+ amountDue: "Montant ",
4693
+ creationDate: "Créé le:"
4694
4694
  };
4695
4695
  var buttons = {
4696
- download: "Download",
4697
- pay: "Pay now"
4696
+ download: "Télécharger",
4697
+ pay: "Payer"
4698
4698
  };
4699
4699
  var invoiceDetails_fr = {
4700
- title: title,
4700
+ title: title$2,
4701
4701
  labels: labels,
4702
4702
  buttons: buttons
4703
4703
  };
4704
4704
 
4705
+ var title$1 = "Renewal options";
4706
+ var subtitle$1 = "Select one of the options below to continue";
4707
+ var next$1 = "Next";
4708
+ var addNew$1 = "Add Another Subscription";
4709
+ var renew$1 = "Renew Existing Subscription";
4710
+ var subscriptionOptions_en = {
4711
+ title: title$1,
4712
+ subtitle: subtitle$1,
4713
+ next: next$1,
4714
+ addNew: addNew$1,
4715
+ renew: renew$1
4716
+ };
4717
+
4718
+ var title = "Renewal options";
4719
+ var subtitle = "Select one of the options below to continue";
4720
+ var next = "Next";
4721
+ var addNew = "Add Another Subscription";
4722
+ var renew = "Renew Existing Subscription";
4723
+ var subscriptionOptions_fr = {
4724
+ title: title,
4725
+ subtitle: subtitle,
4726
+ next: next,
4727
+ addNew: addNew,
4728
+ renew: renew
4729
+ };
4730
+
4705
4731
  function create$1(createState) {
4706
4732
  let state;
4707
4733
  const listeners = new Set();
@@ -6051,7 +6077,7 @@ class PelcroActions {
6051
6077
  view,
6052
6078
  cartItems,
6053
6079
  ...otherStateFields
6054
- } = initialState$i;
6080
+ } = initialState$j;
6055
6081
  this.set(otherStateFields);
6056
6082
  });
6057
6083
 
@@ -6075,6 +6101,16 @@ class PelcroActions {
6075
6101
  });
6076
6102
  }
6077
6103
 
6104
+ if (view === "subscription-options") {
6105
+ const noRenewableProducts = getRenewableProducts().length === 0;
6106
+
6107
+ if (noRenewableProducts) {
6108
+ return this.set({
6109
+ view: "plan-select"
6110
+ });
6111
+ }
6112
+ }
6113
+
6078
6114
  this.set({
6079
6115
  view
6080
6116
  });
@@ -6149,6 +6185,26 @@ class PelcroActions {
6149
6185
  }
6150
6186
  });
6151
6187
 
6188
+ _defineProperty$3(this, "setProductsList", products => {
6189
+ if (!Array.isArray(products)) {
6190
+ return console.error(`setProductsList expects an array of products as an argument, got an argument of type ${typeof products} instead`);
6191
+ }
6192
+
6193
+ const allowedProducts = window.Pelcro.product.list();
6194
+ const validProducts = products.filter(product => {
6195
+ const isValidProduct = allowedProducts.some(allowedProduct => allowedProduct.id === (product === null || product === void 0 ? void 0 : product.id) && allowedProduct.name === (product === null || product === void 0 ? void 0 : product.name));
6196
+
6197
+ if (!isValidProduct) {
6198
+ console.warn(`setProductsList expects an array of products that exist in the list of valid products (window.Pelcro.product.list()), but it recieved a product which doesn't exist in that list:`, product);
6199
+ }
6200
+
6201
+ return isValidProduct;
6202
+ });
6203
+ this.set({
6204
+ productsList: validProducts
6205
+ });
6206
+ });
6207
+
6152
6208
  _defineProperty$3(this, "setProduct", id => {
6153
6209
  const product = window.Pelcro.product.getById(id);
6154
6210
  if (!product) return console.error("invalid product id");
@@ -6370,10 +6426,12 @@ class PelcroCallbacks {
6370
6426
 
6371
6427
  }
6372
6428
 
6373
- const initialState$i = {
6429
+ var _window$Pelcro$produc, _window$Pelcro;
6430
+ const initialState$j = {
6374
6431
  // View
6375
6432
  view: null,
6376
6433
  // Plans
6434
+ productsList: (_window$Pelcro$produc = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : _window$Pelcro.product.list()) !== null && _window$Pelcro$produc !== void 0 ? _window$Pelcro$produc : [],
6377
6435
  product: null,
6378
6436
  plan: null,
6379
6437
  isGift: false,
@@ -6400,7 +6458,7 @@ const createPelcroStore = () => createStore(middleware_3((set, get) => {
6400
6458
  return {
6401
6459
  // Store setter
6402
6460
  set,
6403
- ...initialState$i,
6461
+ ...initialState$j,
6404
6462
  // State actions
6405
6463
  ...actions,
6406
6464
  // Callbacks
@@ -6755,6 +6813,30 @@ function userMustVerifyEmail() {
6755
6813
  const isUserEmailVerified = (_window$Pelcro$user$r9 = (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.email_confirm) !== null && _window$Pelcro$user$r9 !== void 0 ? _window$Pelcro$user$r9 : false;
6756
6814
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
6757
6815
  }
6816
+ function getRenewableProducts() {
6817
+ var _window$Pelcro$subscr, _window$Pelcro$subscr2;
6818
+
6819
+ const renewableSubs = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription.list()) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : _window$Pelcro$subscr2.filter(sub => sub.status === "active" && sub.cancel_at_period_end === 1)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
6820
+ const renewableProductsIds = [...new Set(renewableSubs.map(sub => sub.plan.product.id))];
6821
+ const renewablePlansIds = [...new Set(renewableSubs.map(sub => sub.plan.id))];
6822
+ const {
6823
+ productsList
6824
+ } = usePelcro.getStore();
6825
+ return productsList.map(product => {
6826
+ if (renewableProductsIds.includes(product.id)) {
6827
+ const renewablePlans = getRenewablePlansOnly(product);
6828
+ return { ...product,
6829
+ plans: renewablePlans
6830
+ };
6831
+ }
6832
+ }).filter(product => product);
6833
+
6834
+ function getRenewablePlansOnly(product) {
6835
+ var _product$plans$filter, _product$plans;
6836
+
6837
+ return (_product$plans$filter = product === null || product === void 0 ? void 0 : (_product$plans = product.plans) === null || _product$plans === void 0 ? void 0 : _product$plans.filter(plan => renewablePlansIds.includes(plan.id))) !== null && _product$plans$filter !== void 0 ? _product$plans$filter : [];
6838
+ }
6839
+ }
6758
6840
 
6759
6841
  const resources = {
6760
6842
  en: {
@@ -6779,7 +6861,8 @@ const resources = {
6779
6861
  dashboard: dashboard_en,
6780
6862
  select: select_en,
6781
6863
  notification: notification_en,
6782
- invoiceDetails: invoiceDetails_en
6864
+ invoiceDetails: invoiceDetails_en,
6865
+ subscriptionOptions: subscriptionOptions_en
6783
6866
  },
6784
6867
  fr: {
6785
6868
  common: common_fr,
@@ -6803,7 +6886,8 @@ const resources = {
6803
6886
  dashboard: dashboard_fr,
6804
6887
  select: select_fr,
6805
6888
  notification: notification_fr,
6806
- invoiceDetails: invoiceDetails_fr
6889
+ invoiceDetails: invoiceDetails_fr,
6890
+ subscriptionOptions: subscriptionOptions_fr
6807
6891
  }
6808
6892
  }; // set UI language to the page language or default to the language in site settings
6809
6893
 
@@ -7094,8 +7178,8 @@ const saveToMetadataButton = new SaveToMetadataButtonClass();
7094
7178
 
7095
7179
  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}}
7096
7180
 
7097
- function _extends$y() {
7098
- _extends$y = Object.assign || function (target) {
7181
+ function _extends$A() {
7182
+ _extends$A = Object.assign || function (target) {
7099
7183
  for (var i = 1; i < arguments.length; i++) {
7100
7184
  var source = arguments[i];
7101
7185
 
@@ -7109,7 +7193,7 @@ function _extends$y() {
7109
7193
  return target;
7110
7194
  };
7111
7195
 
7112
- return _extends$y.apply(this, arguments);
7196
+ return _extends$A.apply(this, arguments);
7113
7197
  }
7114
7198
 
7115
7199
  function _taggedTemplateLiteralLoose(strings, raw) {
@@ -7199,7 +7283,7 @@ var clearFromRemoveQueue = function clearFromRemoveQueue(toastId) {
7199
7283
  var reducer = function reducer(state, action) {
7200
7284
  switch (action.type) {
7201
7285
  case ActionType.ADD_TOAST:
7202
- return _extends$y({}, state, {
7286
+ return _extends$A({}, state, {
7203
7287
  toasts: [action.toast].concat(state.toasts).slice(0, TOAST_LIMIT)
7204
7288
  });
7205
7289
 
@@ -7209,9 +7293,9 @@ var reducer = function reducer(state, action) {
7209
7293
  clearFromRemoveQueue(action.toast.id);
7210
7294
  }
7211
7295
 
7212
- return _extends$y({}, state, {
7296
+ return _extends$A({}, state, {
7213
7297
  toasts: state.toasts.map(function (t) {
7214
- return t.id === action.toast.id ? _extends$y({}, t, action.toast) : t;
7298
+ return t.id === action.toast.id ? _extends$A({}, t, action.toast) : t;
7215
7299
  })
7216
7300
  });
7217
7301
 
@@ -7238,9 +7322,9 @@ var reducer = function reducer(state, action) {
7238
7322
  });
7239
7323
  }
7240
7324
 
7241
- return _extends$y({}, state, {
7325
+ return _extends$A({}, state, {
7242
7326
  toasts: state.toasts.map(function (t) {
7243
- return t.id === toastId || toastId === undefined ? _extends$y({}, t, {
7327
+ return t.id === toastId || toastId === undefined ? _extends$A({}, t, {
7244
7328
  visible: false
7245
7329
  }) : t;
7246
7330
  })
@@ -7248,28 +7332,28 @@ var reducer = function reducer(state, action) {
7248
7332
 
7249
7333
  case ActionType.REMOVE_TOAST:
7250
7334
  if (action.toastId === undefined) {
7251
- return _extends$y({}, state, {
7335
+ return _extends$A({}, state, {
7252
7336
  toasts: []
7253
7337
  });
7254
7338
  }
7255
7339
 
7256
- return _extends$y({}, state, {
7340
+ return _extends$A({}, state, {
7257
7341
  toasts: state.toasts.filter(function (t) {
7258
7342
  return t.id !== action.toastId;
7259
7343
  })
7260
7344
  });
7261
7345
 
7262
7346
  case ActionType.START_PAUSE:
7263
- return _extends$y({}, state, {
7347
+ return _extends$A({}, state, {
7264
7348
  pausedAt: action.time
7265
7349
  });
7266
7350
 
7267
7351
  case ActionType.END_PAUSE:
7268
7352
  var diff = action.time - (state.pausedAt || 0);
7269
- return _extends$y({}, state, {
7353
+ return _extends$A({}, state, {
7270
7354
  pausedAt: undefined,
7271
7355
  toasts: state.toasts.map(function (t) {
7272
- return _extends$y({}, t, {
7356
+ return _extends$A({}, t, {
7273
7357
  pauseDuration: t.pauseDuration + diff
7274
7358
  });
7275
7359
  })
@@ -7316,12 +7400,12 @@ var useStore = function useStore(toastOptions) {
7316
7400
  var mergedToasts = state.toasts.map(function (t) {
7317
7401
  var _toastOptions$t$type, _toastOptions, _toastOptions$t$type2;
7318
7402
 
7319
- return _extends$y({}, toastOptions, toastOptions[t.type], t, {
7403
+ return _extends$A({}, toastOptions, toastOptions[t.type], t, {
7320
7404
  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],
7321
- style: _extends$y({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7405
+ style: _extends$A({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7322
7406
  });
7323
7407
  });
7324
- return _extends$y({}, state, {
7408
+ return _extends$A({}, state, {
7325
7409
  toasts: mergedToasts
7326
7410
  });
7327
7411
  };
@@ -7331,7 +7415,7 @@ var createToast = function createToast(message, type, opts) {
7331
7415
  type = 'blank';
7332
7416
  }
7333
7417
 
7334
- return _extends$y({
7418
+ return _extends$A({
7335
7419
  createdAt: Date.now(),
7336
7420
  visible: true,
7337
7421
  type: type,
@@ -7381,14 +7465,14 @@ toast.remove = function (toastId) {
7381
7465
  };
7382
7466
 
7383
7467
  toast.promise = function (promise, msgs, opts) {
7384
- var id = toast.loading(msgs.loading, _extends$y({}, opts, opts == null ? void 0 : opts.loading));
7468
+ var id = toast.loading(msgs.loading, _extends$A({}, opts, opts == null ? void 0 : opts.loading));
7385
7469
  promise.then(function (p) {
7386
- toast.success(resolveValue(msgs.success, p), _extends$y({
7470
+ toast.success(resolveValue(msgs.success, p), _extends$A({
7387
7471
  id: id
7388
7472
  }, opts, opts == null ? void 0 : opts.success));
7389
7473
  return p;
7390
7474
  })["catch"](function (e) {
7391
- toast.error(resolveValue(msgs.error, e), _extends$y({
7475
+ toast.error(resolveValue(msgs.error, e), _extends$A({
7392
7476
  id: id
7393
7477
  }, opts, opts == null ? void 0 : opts.error));
7394
7478
  });
@@ -7727,7 +7811,7 @@ var ToastBar = /*#__PURE__*/React.memo(function (_ref2) {
7727
7811
  var message = React.createElement(Message, Object.assign({}, toast.ariaProps), resolveValue(toast.message, toast));
7728
7812
  return React.createElement(ToastBarBase, {
7729
7813
  className: toast.className,
7730
- style: _extends$y({}, animationStyle, style, toast.style)
7814
+ style: _extends$A({}, animationStyle, style, toast.style)
7731
7815
  }, typeof children === 'function' ? children({
7732
7816
  icon: icon,
7733
7817
  message: message
@@ -7757,7 +7841,7 @@ var getPositionStyle = function getPositionStyle(position, offset) {
7757
7841
  } : position.includes('right') ? {
7758
7842
  justifyContent: 'flex-end'
7759
7843
  } : {};
7760
- return _extends$y({
7844
+ return _extends$A({
7761
7845
  left: 0,
7762
7846
  right: 0,
7763
7847
  display: 'flex',
@@ -7784,7 +7868,7 @@ var Toaster = function Toaster(_ref) {
7784
7868
  handlers = _useToaster.handlers;
7785
7869
 
7786
7870
  return React.createElement("div", {
7787
- style: _extends$y({
7871
+ style: _extends$A({
7788
7872
  position: 'fixed',
7789
7873
  zIndex: 9999,
7790
7874
  top: DEFAULT_OFFSET,
@@ -7819,82 +7903,82 @@ var Toaster = function Toaster(_ref) {
7819
7903
  }));
7820
7904
  };
7821
7905
 
7822
- var _path$v;
7906
+ var _path$x;
7823
7907
 
7824
- 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); }
7908
+ function _extends$z() { _extends$z = 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$z.apply(this, arguments); }
7825
7909
 
7826
7910
  function SvgCheckSolid(props) {
7827
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$x({
7911
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$z({
7828
7912
  xmlns: "http://www.w3.org/2000/svg",
7829
7913
  className: "h-5 w-5",
7830
7914
  viewBox: "0 0 20 20",
7831
7915
  fill: "currentColor"
7832
- }, props), _path$v || (_path$v = /*#__PURE__*/React__namespace.createElement("path", {
7916
+ }, props), _path$x || (_path$x = /*#__PURE__*/React__namespace.createElement("path", {
7833
7917
  fillRule: "evenodd",
7834
7918
  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",
7835
7919
  clipRule: "evenodd"
7836
7920
  })));
7837
7921
  }
7838
7922
 
7839
- var _path$u;
7923
+ var _path$w;
7840
7924
 
7841
- 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); }
7925
+ 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); }
7842
7926
 
7843
7927
  function SvgXIcon(props) {
7844
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$w({
7928
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$y({
7845
7929
  xmlns: "http://www.w3.org/2000/svg",
7846
7930
  viewBox: "0 0 20 20",
7847
7931
  fill: "currentColor"
7848
- }, props), _path$u || (_path$u = /*#__PURE__*/React__namespace.createElement("path", {
7932
+ }, props), _path$w || (_path$w = /*#__PURE__*/React__namespace.createElement("path", {
7849
7933
  fill: "evenodd",
7850
7934
  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",
7851
7935
  clipRule: "evenodd"
7852
7936
  })));
7853
7937
  }
7854
7938
 
7855
- var _path$t;
7939
+ var _path$v;
7856
7940
 
7857
- 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); }
7941
+ 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); }
7858
7942
 
7859
7943
  function SvgXIconSolid(props) {
7860
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$v({
7944
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$x({
7861
7945
  className: "plc-w-4 plc-h-4",
7862
7946
  fill: "currentColor",
7863
7947
  xmlns: "http://www.w3.org/2000/svg",
7864
7948
  viewBox: "0 0 100 100"
7865
- }, props), _path$t || (_path$t = /*#__PURE__*/React__namespace.createElement("path", {
7949
+ }, props), _path$v || (_path$v = /*#__PURE__*/React__namespace.createElement("path", {
7866
7950
  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"
7867
7951
  })));
7868
7952
  }
7869
7953
 
7870
- var _path$s;
7954
+ var _path$u;
7871
7955
 
7872
- 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); }
7956
+ 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); }
7873
7957
 
7874
7958
  function SvgExclamation(props) {
7875
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$u({
7959
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$w({
7876
7960
  className: "plc-w-4 plc-h-4 plc-mr-1",
7877
7961
  xmlns: "http://www.w3.org/2000/svg",
7878
7962
  viewBox: "0 0 20 20",
7879
7963
  fill: "currentColor"
7880
- }, props), _path$s || (_path$s = /*#__PURE__*/React__namespace.createElement("path", {
7964
+ }, props), _path$u || (_path$u = /*#__PURE__*/React__namespace.createElement("path", {
7881
7965
  fillRule: "evenodd",
7882
7966
  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",
7883
7967
  clipRule: "evenodd"
7884
7968
  })));
7885
7969
  }
7886
7970
 
7887
- var _path$r, _path2$4;
7971
+ var _path$t, _path2$4;
7888
7972
 
7889
- 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); }
7973
+ 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); }
7890
7974
 
7891
7975
  function SvgSpinner(props) {
7892
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
7976
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$v({
7893
7977
  className: "plc-animate-spin",
7894
7978
  viewBox: "0 0 24 24",
7895
7979
  fill: "currentColor",
7896
7980
  xmlns: "http://www.w3.org/2000/svg"
7897
- }, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
7981
+ }, props), _path$t || (_path$t = /*#__PURE__*/React__namespace.createElement("path", {
7898
7982
  opacity: 0.2,
7899
7983
  fill: "evenodd",
7900
7984
  clipRule: "evenodd",
@@ -8184,7 +8268,9 @@ const init$1 = () => {
8184
8268
  return switchToAddressView();
8185
8269
  });
8186
8270
  } else {
8187
- pelcroSubscribeButtonsByClass[j].addEventListener("click", () => switchView("plan-select"));
8271
+ pelcroSubscribeButtonsByClass[j].addEventListener("click", () => {
8272
+ return switchView("subscription-options");
8273
+ });
8188
8274
  }
8189
8275
  }
8190
8276
  }
@@ -8346,7 +8432,8 @@ function Link({
8346
8432
  const init = () => {
8347
8433
  const {
8348
8434
  switchView,
8349
- set
8435
+ set,
8436
+ setProductsList
8350
8437
  } = usePelcro.getStore();
8351
8438
  const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
8352
8439
 
@@ -8397,7 +8484,8 @@ const init = () => {
8397
8484
  }
8398
8485
 
8399
8486
  notify.dismiss(NOTIFICATION_ID);
8400
- switchView("_plan-select-entitlements");
8487
+ setProductsList(window.Pelcro.product.getByEntitlements(entitlements));
8488
+ switchView("plan-select");
8401
8489
  }
8402
8490
  }, "Subscribe"), "now to get full page access.")), {
8403
8491
  className: "pelcro-notification-entitlement",
@@ -8629,6 +8717,7 @@ var pure_1 = pure.loadStripe;
8629
8717
  * @param {Object} error Error object
8630
8718
  * @return {string}
8631
8719
  */
8720
+
8632
8721
  const getErrorMessages = error => {
8633
8722
  var _error$error, _error$response, _error$response$data, _error$response3, _error$response3$data, _error$response3$data2, _error$response5, _error$response5$data;
8634
8723
 
@@ -8648,6 +8737,10 @@ const getErrorMessages = error => {
8648
8737
  return error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : (_error$response4$data = _error$response4.data) === null || _error$response4$data === void 0 ? void 0 : (_error$response4$data2 = _error$response4$data.error) === null || _error$response4$data2 === void 0 ? void 0 : _error$response4$data2.message;
8649
8738
  }
8650
8739
 
8740
+ if (error !== null && error !== void 0 && error.message) {
8741
+ return error.message;
8742
+ }
8743
+
8651
8744
  const errorMessages = []; // enumerable error (ex: validation errors)
8652
8745
 
8653
8746
  Object.values(error === null || error === void 0 ? void 0 : (_error$response5 = error.response) === null || _error$response5 === void 0 ? void 0 : (_error$response5$data = _error$response5.data) === null || _error$response5$data === void 0 ? void 0 : _error$response5$data.errors).forEach(([errorMessage]) => {
@@ -8683,6 +8776,15 @@ const debounce = (func, waitTime) => {
8683
8776
  timeout = setTimeout(later, waitTime);
8684
8777
  };
8685
8778
  };
8779
+ function getSiteCardProcessor() {
8780
+ var _window$Pelcro$site$r;
8781
+
8782
+ if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_gateway_settings) {
8783
+ return "vantiv";
8784
+ }
8785
+
8786
+ return "stripe";
8787
+ }
8686
8788
 
8687
8789
  /**
8688
8790
  * @typedef {Object} OptionsType
@@ -8763,13 +8865,29 @@ const loadPaymentSDKs = () => {
8763
8865
  if (!window.Stripe) {
8764
8866
  pure_1(window.Pelcro.environment.stripe);
8765
8867
  }
8766
- }); // Load PayPal SDK's
8868
+ }); // Load PayPal SDKs
8767
8869
 
8768
8870
  const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
8769
8871
 
8770
8872
  if (supportsPaypal) {
8771
8873
  window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.69.0/js/client.min.js", "braintree-sdk");
8772
8874
  window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.69.0/js/paypal-checkout.min.js", "braintree-paypal-sdk");
8875
+ } // Load Vantiv SDKs
8876
+
8877
+
8878
+ const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
8879
+
8880
+ if (supportsVantiv) {
8881
+ if (!window.jQuery) {
8882
+ window.Pelcro.helpers.loadSDK("https://code.jquery.com/jquery-3.6.0.slim.min.js", "vantiv-jquery-sdk");
8883
+ }
8884
+
8885
+ if (!window.EprotectIframeClient) {
8886
+ const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
8887
+ const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client4.min.js";
8888
+ const scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? PRODUCTION_URL : PRELIVE_URL;
8889
+ window.Pelcro.helpers.loadSDK(scriptUrlToUse, "vantiv-eprotect-sdk");
8890
+ }
8773
8891
  }
8774
8892
  };
8775
8893
  const loadAuth0SDK = () => {
@@ -8929,8 +9047,7 @@ const initViewFromURL = () => {
8929
9047
  }
8930
9048
 
8931
9049
  if (view === "invoice-details") {
8932
- // FIXME: commented out to remove from the release
8933
- return false; // return showInvoiceDetailsFromUrl();
9050
+ return showInvoiceDetailsFromUrl();
8934
9051
  }
8935
9052
 
8936
9053
  switchView(view);
@@ -9109,6 +9226,43 @@ const verifyEmailTokenFromUrl = () => {
9109
9226
  });
9110
9227
  };
9111
9228
 
9229
+ const showInvoiceDetailsFromUrl = () => {
9230
+ const {
9231
+ isAuthenticated,
9232
+ setInvoice,
9233
+ whenSiteReady,
9234
+ switchView
9235
+ } = usePelcro.getStore();
9236
+ whenSiteReady(() => {
9237
+ if (!isAuthenticated()) {
9238
+ return switchView("login");
9239
+ }
9240
+
9241
+ const invoiceId = window.Pelcro.helpers.getURLParameter("id");
9242
+ const wasSetSuccessfully = setInvoice(invoiceId);
9243
+
9244
+ if (!wasSetSuccessfully) {
9245
+ const errorMessage = i18next.t("messages:invalidInvoice", {
9246
+ returnObjects: true
9247
+ });
9248
+ return notify.error(errorMessage);
9249
+ }
9250
+
9251
+ const {
9252
+ invoice
9253
+ } = usePelcro.getStore();
9254
+
9255
+ if (invoice.total === 0) {
9256
+ const errorMessage = i18next.t("messages:zeroTotalInvoice", {
9257
+ returnObjects: true
9258
+ });
9259
+ return notify.error(errorMessage);
9260
+ }
9261
+
9262
+ return switchView("invoice-details");
9263
+ });
9264
+ };
9265
+
9112
9266
  const defaultOptions = {
9113
9267
  loadPaymentSDKs: true,
9114
9268
  loadAuth0SDK: true,
@@ -9166,7 +9320,7 @@ const PelcroModalController = ({
9166
9320
  type
9167
9321
  }) => (type === null || type === void 0 ? void 0 : type.viewId) === "dashboard-open"), React__default['default'].Children.map(children, child => child).find(({
9168
9322
  type
9169
- }) => (type === null || type === void 0 ? void 0 : type.viewId) === "notification"), view === "_plan-select-entitlements" && React__default['default'].Children.map(children, child => child).find(({
9323
+ }) => (type === null || type === void 0 ? void 0 : type.viewId) === "notification"), view === "_plan-select-renew" && React__default['default'].Children.map(children, child => child).find(({
9170
9324
  type
9171
9325
  }) => (type === null || type === void 0 ? void 0 : type.viewId) === "plan-select"), React__default['default'].Children.map(children, child => child).find(({
9172
9326
  type
@@ -9447,8 +9601,10 @@ const LOAD_PAYMENT_METHODS = "LOAD_PAYMENT_METHODS";
9447
9601
  const GET_NEWSLETTERS_FETCH = "GET_NEWSLETTERS_FETCH";
9448
9602
  const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
9449
9603
  const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
9604
+ const SWITCH_TO_RENEW = "SWITCH_TO_RENEW";
9605
+ const SWITCH_TO_NEW = "SWITCH_TO_NEW";
9450
9606
 
9451
- const initialState$h = {
9607
+ const initialState$i = {
9452
9608
  email: "",
9453
9609
  password: "",
9454
9610
  emailError: null,
@@ -9459,10 +9615,10 @@ const initialState$h = {
9459
9615
  content: ""
9460
9616
  }
9461
9617
  };
9462
- const store$h = /*#__PURE__*/React.createContext(initialState$h);
9618
+ const store$i = /*#__PURE__*/React.createContext(initialState$i);
9463
9619
  const {
9464
- Provider: Provider$h
9465
- } = store$h;
9620
+ Provider: Provider$i
9621
+ } = store$i;
9466
9622
 
9467
9623
  const LoginContainer = ({
9468
9624
  style,
@@ -9569,7 +9725,7 @@ const LoginContainer = ({
9569
9725
  });
9570
9726
 
9571
9727
  case RESET_LOGIN_FORM:
9572
- return initialState$h;
9728
+ return initialState$i;
9573
9729
 
9574
9730
  case DISABLE_LOGIN_BUTTON:
9575
9731
  return lib_7({ ...state,
@@ -9587,12 +9743,12 @@ const LoginContainer = ({
9587
9743
  default:
9588
9744
  return state;
9589
9745
  }
9590
- }, initialState$h);
9746
+ }, initialState$i);
9591
9747
  return /*#__PURE__*/React__default['default'].createElement("div", {
9592
9748
  style: { ...style
9593
9749
  },
9594
9750
  className: `pelcro-container pelcro-login-container ${className}`
9595
- }, /*#__PURE__*/React__default['default'].createElement(Provider$h, {
9751
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$i, {
9596
9752
  value: {
9597
9753
  state,
9598
9754
  dispatch
@@ -9600,12 +9756,12 @@ const LoginContainer = ({
9600
9756
  }, children.length ? children.map((child, i) => {
9601
9757
  if (child) {
9602
9758
  return /*#__PURE__*/React__default['default'].cloneElement(child, {
9603
- store: store$h,
9759
+ store: store$i,
9604
9760
  key: i
9605
9761
  });
9606
9762
  }
9607
9763
  }) : /*#__PURE__*/React__default['default'].cloneElement(children, {
9608
- store: store$h
9764
+ store: store$i
9609
9765
  })));
9610
9766
  };
9611
9767
 
@@ -9850,7 +10006,7 @@ const LoginButton = ({
9850
10006
  buttonDisabled
9851
10007
  },
9852
10008
  dispatch
9853
- } = React.useContext(store$h);
10009
+ } = React.useContext(store$i);
9854
10010
  const {
9855
10011
  t
9856
10012
  } = useTranslation("login");
@@ -9871,23 +10027,23 @@ const LoginButton = ({
9871
10027
  };
9872
10028
 
9873
10029
  const LoginEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
9874
- store: store$h
10030
+ store: store$i
9875
10031
  }, props));
9876
10032
 
9877
10033
  const LoginPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
9878
- store: store$h
10034
+ store: store$i
9879
10035
  }, props));
9880
10036
 
9881
- var _path$q;
10037
+ var _path$s;
9882
10038
 
9883
- 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); }
10039
+ 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); }
9884
10040
 
9885
10041
  function SvgCheck(props) {
9886
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
10042
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$u({
9887
10043
  xmlns: "http://www.w3.org/2000/svg",
9888
10044
  fill: "currentColor",
9889
10045
  viewBox: "0 0 20 20"
9890
- }, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
10046
+ }, props), _path$s || (_path$s = /*#__PURE__*/React__namespace.createElement("path", {
9891
10047
  fillRule: "evenodd",
9892
10048
  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",
9893
10049
  clipRule: "evenodd"
@@ -9952,7 +10108,7 @@ var facebookLoginRenderProps = createCommonjsModule(function (module, exports) {
9952
10108
  var FacebookLogin = unwrapExports(facebookLoginRenderProps);
9953
10109
  facebookLoginRenderProps.FacebookLogin;
9954
10110
 
9955
- const initialState$g = {
10111
+ const initialState$h = {
9956
10112
  email: "",
9957
10113
  password: "",
9958
10114
  emailError: null,
@@ -9969,10 +10125,10 @@ const initialState$g = {
9969
10125
  content: ""
9970
10126
  }
9971
10127
  };
9972
- const store$g = /*#__PURE__*/React.createContext(initialState$g);
10128
+ const store$h = /*#__PURE__*/React.createContext(initialState$h);
9973
10129
  const {
9974
- Provider: Provider$g
9975
- } = store$g;
10130
+ Provider: Provider$h
10131
+ } = store$h;
9976
10132
 
9977
10133
  const RegisterContainer = ({
9978
10134
  style,
@@ -10155,7 +10311,7 @@ const RegisterContainer = ({
10155
10311
  });
10156
10312
 
10157
10313
  case RESET_LOGIN_FORM:
10158
- return initialState$g;
10314
+ return initialState$h;
10159
10315
 
10160
10316
  case DISABLE_REGISTRATION_BUTTON:
10161
10317
  return lib_7({ ...state,
@@ -10173,12 +10329,12 @@ const RegisterContainer = ({
10173
10329
  default:
10174
10330
  return state;
10175
10331
  }
10176
- }, initialState$g);
10332
+ }, initialState$h);
10177
10333
  return /*#__PURE__*/React__default['default'].createElement("div", {
10178
10334
  style: { ...style
10179
10335
  },
10180
10336
  className: `pelcro-container pelcro-register-container ${className}`
10181
- }, /*#__PURE__*/React__default['default'].createElement(Provider$g, {
10337
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$h, {
10182
10338
  value: {
10183
10339
  state,
10184
10340
  dispatch
@@ -10186,12 +10342,12 @@ const RegisterContainer = ({
10186
10342
  }, children.length ? children.map((child, i) => {
10187
10343
  if (child) {
10188
10344
  return /*#__PURE__*/React__default['default'].cloneElement(child, {
10189
- store: store$g,
10345
+ store: store$h,
10190
10346
  key: i
10191
10347
  });
10192
10348
  }
10193
10349
  }) : /*#__PURE__*/React__default['default'].cloneElement(children, {
10194
- store: store$g
10350
+ store: store$h
10195
10351
  })));
10196
10352
  };
10197
10353
  /**
@@ -10206,15 +10362,15 @@ function hasSecurityTokenEnabled$1() {
10206
10362
  return hasSecuritySdkLoaded;
10207
10363
  }
10208
10364
 
10209
- var _path$p;
10365
+ var _path$r;
10210
10366
 
10211
- 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); }
10367
+ 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); }
10212
10368
 
10213
10369
  function SvgFacebookLogo(props) {
10214
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
10370
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
10215
10371
  xmlns: "http://www.w3.org/2000/svg",
10216
10372
  viewBox: "88.428 12.828 107.543 207.085"
10217
- }, props), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
10373
+ }, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
10218
10374
  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",
10219
10375
  fill: "#3c5a9a"
10220
10376
  })));
@@ -10231,10 +10387,10 @@ const FacebookLoginButton = ({
10231
10387
  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;
10232
10388
  const {
10233
10389
  dispatch: loginDispatch
10234
- } = React.useContext(store$h);
10390
+ } = React.useContext(store$i);
10235
10391
  const {
10236
10392
  dispatch: registerDispatch
10237
- } = React.useContext(store$g);
10393
+ } = React.useContext(store$h);
10238
10394
 
10239
10395
  const onSuccess = facebookUser => {
10240
10396
  loginDispatch === null || loginDispatch === void 0 ? void 0 : loginDispatch({
@@ -10287,15 +10443,15 @@ var googleLogin = createCommonjsModule(function (module, exports) {
10287
10443
  unwrapExports(googleLogin);
10288
10444
  var googleLogin_1 = googleLogin.GoogleLogin;
10289
10445
 
10290
- var _path$o, _path2$3, _path3$1, _path4;
10446
+ var _path$q, _path2$3, _path3$1, _path4;
10291
10447
 
10292
- 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); }
10448
+ 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); }
10293
10449
 
10294
10450
  function SvgGoogleLogo(props) {
10295
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
10451
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
10296
10452
  viewBox: "0 0 24 24",
10297
10453
  xmlns: "http://www.w3.org/2000/svg"
10298
- }, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
10454
+ }, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
10299
10455
  fill: "#4285F4",
10300
10456
  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"
10301
10457
  })), _path2$3 || (_path2$3 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -10321,10 +10477,10 @@ const GoogleLoginButton = ({
10321
10477
  const googleLoginEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.google_app_id;
10322
10478
  const {
10323
10479
  dispatch: loginDispatch
10324
- } = React.useContext(store$h);
10480
+ } = React.useContext(store$i);
10325
10481
  const {
10326
10482
  dispatch: registerDispatch
10327
- } = React.useContext(store$g);
10483
+ } = React.useContext(store$h);
10328
10484
 
10329
10485
  const onSuccess = response => {
10330
10486
  var _response$getAuthResp, _profile$getEmail, _profile$getGivenName, _profile$getFamilyNam, _profile$getEmail2, _profile$getGivenName2, _profile$getFamilyNam2;
@@ -10372,15 +10528,15 @@ const GoogleLoginButton = ({
10372
10528
  }) : null;
10373
10529
  };
10374
10530
 
10375
- var _path$n;
10531
+ var _path$p;
10376
10532
 
10377
- 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); }
10533
+ 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); }
10378
10534
 
10379
10535
  function SvgAuth0Logo(props) {
10380
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
10536
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
10381
10537
  viewBox: "0 0 256 285",
10382
10538
  xmlns: "http://www.w3.org/2000/svg"
10383
- }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
10539
+ }, props), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
10384
10540
  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"
10385
10541
  })));
10386
10542
  }
@@ -10420,10 +10576,10 @@ const Auth0LoginButton = ({
10420
10576
  }, [auth0Enabled, auth0Loaded]);
10421
10577
  const {
10422
10578
  dispatch: loginDispatch
10423
- } = React.useContext(store$h);
10579
+ } = React.useContext(store$i);
10424
10580
  const {
10425
10581
  dispatch: registerDispatch
10426
- } = React.useContext(store$g);
10582
+ } = React.useContext(store$h);
10427
10583
 
10428
10584
  function handleClick() {
10429
10585
  var _auth0InstanceRef$cur, _auth0InstanceRef$cur2, _auth0InstanceRef$cur3;
@@ -10556,15 +10712,15 @@ function LoginView(props) {
10556
10712
  }, /*#__PURE__*/React__default['default'].createElement(GoogleLoginButton, null), /*#__PURE__*/React__default['default'].createElement(FacebookLoginButton, null), /*#__PURE__*/React__default['default'].createElement(Auth0LoginButton, null))))));
10557
10713
  }
10558
10714
 
10559
- var _path$m, _path2$2, _path3;
10715
+ var _path$o, _path2$2, _path3;
10560
10716
 
10561
- 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); }
10717
+ 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); }
10562
10718
 
10563
10719
  function SvgPelcroAuthorship(props) {
10564
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
10720
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
10565
10721
  xmlns: "http://www.w3.org/2000/svg",
10566
10722
  viewBox: "0 -80.652 497.072 179.991"
10567
- }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
10723
+ }, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
10568
10724
  fill: "none",
10569
10725
  stroke: "#4a4a4a",
10570
10726
  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"
@@ -10711,11 +10867,11 @@ function LoginModal({
10711
10867
  LoginModal.viewId = "login";
10712
10868
 
10713
10869
  const RegisterEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
10714
- store: store$g
10870
+ store: store$h
10715
10871
  }, props));
10716
10872
 
10717
10873
  const RegisterPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
10718
- store: store$g
10874
+ store: store$h
10719
10875
  }, props));
10720
10876
 
10721
10877
  const RegisterButton = ({
@@ -10735,7 +10891,7 @@ const RegisterButton = ({
10735
10891
  buttonDisabled
10736
10892
  },
10737
10893
  dispatch
10738
- } = React.useContext(store$g);
10894
+ } = React.useContext(store$h);
10739
10895
  const {
10740
10896
  t
10741
10897
  } = useTranslation("register");
@@ -10873,7 +11029,7 @@ function FirstName({
10873
11029
  }
10874
11030
 
10875
11031
  const RegisterFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
10876
- store: store$g
11032
+ store: store$h
10877
11033
  }, props));
10878
11034
 
10879
11035
  function LastName({
@@ -10904,7 +11060,7 @@ function LastName({
10904
11060
  }
10905
11061
 
10906
11062
  const RegisterLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
10907
- store: store$g
11063
+ store: store$h
10908
11064
  }, props));
10909
11065
 
10910
11066
  /**
@@ -11028,7 +11184,7 @@ function TextInput({
11028
11184
 
11029
11185
  const RegisterTextInput = props => {
11030
11186
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
11031
- store: store$g
11187
+ store: store$h
11032
11188
  }));
11033
11189
  };
11034
11190
 
@@ -11175,6 +11331,7 @@ function SelectModalWithHook(props) {
11175
11331
  (_props$onDisplay = props.onDisplay) === null || _props$onDisplay === void 0 ? void 0 : _props$onDisplay.call(props);
11176
11332
  }, []);
11177
11333
  const {
11334
+ productsList,
11178
11335
  isGift,
11179
11336
  plan,
11180
11337
  product,
@@ -11184,11 +11341,12 @@ function SelectModalWithHook(props) {
11184
11341
  view,
11185
11342
  set
11186
11343
  } = usePelcro();
11187
- const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
11188
- const entitlements = entitlementsProtectedElements.length > 0 ? getEntitlementsFromElem(entitlementsProtectedElements[0]) : null;
11344
+ const isRenewingSub = view === "_plan-select-renew";
11189
11345
  return /*#__PURE__*/React__default['default'].createElement(SelectModalWithTrans, {
11346
+ productsList: productsList,
11190
11347
  isGift: isGift,
11191
- disableGifting: isRenewingGift,
11348
+ disableGifting: isRenewingGift || isRenewingSub,
11349
+ isRenewingSub: isRenewingSub,
11192
11350
  plan: plan,
11193
11351
  product: product,
11194
11352
  onClose: () => {
@@ -11202,8 +11360,10 @@ function SelectModalWithHook(props) {
11202
11360
  plan,
11203
11361
  isGift
11204
11362
  }),
11205
- setView: switchView,
11206
- matchingEntitlements: view === "_plan-select-entitlements" ? entitlements : null
11363
+ setSubscriptionIdToRenew: subscriptionIdToRenew => set({
11364
+ subscriptionIdToRenew
11365
+ }),
11366
+ setView: switchView
11207
11367
  });
11208
11368
  }
11209
11369
  SelectModalWithHook.viewId = "plan-select";
@@ -11235,10 +11395,10 @@ class SelectModal extends React.Component {
11235
11395
  });
11236
11396
  }
11237
11397
 
11238
- if (this.state.productList.length === 1) {
11398
+ if (this.props.productsList.length === 1) {
11239
11399
  this.setState({
11240
- product: this.state.productList[0],
11241
- planList: this.state.productList[0].plans,
11400
+ product: this.props.productsList[0],
11401
+ planList: this.props.productsList[0].plans,
11242
11402
  mode: "plan"
11243
11403
  });
11244
11404
  }
@@ -11255,7 +11415,7 @@ class SelectModal extends React.Component {
11255
11415
  });
11256
11416
 
11257
11417
  _defineProperty$3(this, "onProductChange", e => {
11258
- const product = window.Pelcro.product.list()[e.target.selectedIndex];
11418
+ const product = productsList[e.target.selectedIndex];
11259
11419
  this.setState({
11260
11420
  product: product,
11261
11421
  plan: product.plans[0]
@@ -11321,7 +11481,7 @@ class SelectModal extends React.Component {
11321
11481
 
11322
11482
  _defineProperty$3(this, "renderProducts", () => {
11323
11483
  const userDidSelectProduct = Boolean(this.state.mode === "plan");
11324
- const productsToShow = userDidSelectProduct ? [this.state.product] : this.state.productList;
11484
+ const productsToShow = userDidSelectProduct ? [this.state.product] : this.props.productsList;
11325
11485
  return productsToShow.map((product, index) => {
11326
11486
  return this.renderOneProduct(product, index);
11327
11487
  });
@@ -11334,7 +11494,7 @@ class SelectModal extends React.Component {
11334
11494
  return this.renderOneProduct(this.state.product);
11335
11495
  }
11336
11496
 
11337
- const [productsThatMatchArticleTag, allProductsMinusMatched] = productsWithMatchedTaggedFirst(); // Render normal products if there are no available matching products
11497
+ const [productsThatMatchArticleTag, allProductsMinusMatched] = productsWithMatchedTaggedFirst(this.props.productsList); // Render normal products if there are no available matching products
11338
11498
 
11339
11499
  if (!(productsThatMatchArticleTag !== null && productsThatMatchArticleTag !== void 0 && productsThatMatchArticleTag.length)) {
11340
11500
  return this.renderProducts();
@@ -11350,10 +11510,7 @@ class SelectModal extends React.Component {
11350
11510
  className: "plc-text-sm plc-font-semibold"
11351
11511
  }, this.locale("labels.restrictiveArticles.or")), allProductsMinusMatched.map((product, index) => this.renderOneProduct(product, index))));
11352
11512
 
11353
- function productsWithMatchedTaggedFirst() {
11354
- var _window$Pelcro$produc;
11355
-
11356
- const allProducts = (_window$Pelcro$produc = window.Pelcro.product.list()) !== null && _window$Pelcro$produc !== void 0 ? _window$Pelcro$produc : [];
11513
+ function productsWithMatchedTaggedFirst(allProducts) {
11357
11514
  const productsThatMatchArticleTag = window.Pelcro.product.getByMatchingPageTags();
11358
11515
  const allProductsMinusMatched = allProducts.filter(product => !productsThatMatchArticleTag.some(matchedProduct => matchedProduct.id === product.id));
11359
11516
  return [productsThatMatchArticleTag, allProductsMinusMatched];
@@ -11387,7 +11544,7 @@ class SelectModal extends React.Component {
11387
11544
  _defineProperty$3(this, "selectProduct", e => {
11388
11545
  const id = e.target.dataset.key;
11389
11546
 
11390
- for (const product of this.state.productList) {
11547
+ for (const product of this.props.productsList) {
11391
11548
  if (+product.id === +id) {
11392
11549
  var _this$state$plan;
11393
11550
 
@@ -11440,6 +11597,14 @@ class SelectModal extends React.Component {
11440
11597
 
11441
11598
  _defineProperty$3(this, "submitOption", () => {
11442
11599
  this.props.setProductAndPlan(this.state.product, this.state.plan, this.state.isGift);
11600
+
11601
+ if (this.props.isRenewingSub) {
11602
+ var _matchingSub$id;
11603
+
11604
+ const matchingSub = window.Pelcro.subscription.list().find(sub => sub.plan.id === this.state.plan.id && sub.status === "active" && sub.cancel_at_period_end === 1);
11605
+ this.props.setSubscriptionIdToRenew((_matchingSub$id = matchingSub === null || matchingSub === void 0 ? void 0 : matchingSub.id) !== null && _matchingSub$id !== void 0 ? _matchingSub$id : null);
11606
+ }
11607
+
11443
11608
  const {
11444
11609
  product,
11445
11610
  isGift
@@ -11477,8 +11642,7 @@ class SelectModal extends React.Component {
11477
11642
  plan: {},
11478
11643
  isGift: props.isGift,
11479
11644
  disabled: true,
11480
- mode: "product",
11481
- productList: props.matchingEntitlements ? window.Pelcro.product.getByEntitlements(props.matchingEntitlements) : window.Pelcro.product.list()
11645
+ mode: "product"
11482
11646
  };
11483
11647
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
11484
11648
  this.locale = this.props.t;
@@ -11486,7 +11650,7 @@ class SelectModal extends React.Component {
11486
11650
  }
11487
11651
 
11488
11652
  render() {
11489
- var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
11653
+ var _this$props$productsL, _this$props$productsL2, _window$Pelcro$site$r;
11490
11654
 
11491
11655
  const {
11492
11656
  disableGifting
@@ -11520,7 +11684,7 @@ class SelectModal extends React.Component {
11520
11684
  className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
11521
11685
  }, /*#__PURE__*/React__default['default'].createElement("h4", {
11522
11686
  className: "plc-text-2xl plc-font-semibold"
11523
- }, this.product && this.product.paywall.select_title || ((_window$Pelcro$produc2 = window.Pelcro.product.list()[0]) === null || _window$Pelcro$produc2 === void 0 ? void 0 : _window$Pelcro$produc2.paywall.select_title)), /*#__PURE__*/React__default['default'].createElement("p", null, this.product && this.product.paywall.select_subtitle || ((_window$Pelcro$produc3 = window.Pelcro.product.list()[0]) === null || _window$Pelcro$produc3 === void 0 ? void 0 : _window$Pelcro$produc3.paywall.select_subtitle))), /*#__PURE__*/React__default['default'].createElement("div", {
11687
+ }, this.product && this.product.paywall.select_title || ((_this$props$productsL = this.props.productsList[0]) === null || _this$props$productsL === void 0 ? void 0 : _this$props$productsL.paywall.select_title)), /*#__PURE__*/React__default['default'].createElement("p", null, this.product && this.product.paywall.select_subtitle || ((_this$props$productsL2 = this.props.productsList[0]) === null || _this$props$productsL2 === void 0 ? void 0 : _this$props$productsL2.paywall.select_subtitle))), /*#__PURE__*/React__default['default'].createElement("div", {
11524
11688
  className: "pelcro-select-products-wrapper"
11525
11689
  }, (_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.restrictive_paywall_metatags_enabled ? this.renderMatchingProductsFirst() : this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
11526
11690
  className: "plc-overflow-y-scroll plc-max-h-72 pelcro-select-plans-wrapper"
@@ -12684,20 +12848,21 @@ var es_12 = es.injectStripe;
12684
12848
  var es_13 = es.StripeProvider;
12685
12849
 
12686
12850
  /**
12687
- * @TODO: All subscription related business logic should end up moving
12851
+ * @TODO: All payment related business logic should end up moving
12688
12852
  * to this service, and out of react components.
12689
12853
  */
12690
12854
 
12691
12855
  /**
12692
- * Enum for subscription types
12856
+ * Enum for payment types
12693
12857
  * @readonly
12694
12858
  * @enum {string}
12695
12859
  */
12696
- const SUBSCRIPTION_TYPES = {
12860
+ const PAYMENT_TYPES = {
12697
12861
  CREATE_SUBSCRIPTION: "CREATE_SUBSCRIPTION",
12698
12862
  CREATE_GIFTED_SUBSCRIPTION: "CREATE_GIFTED_SUBSCRIPTION",
12699
12863
  RENEW_SUBSCRIPTION: "RENEW_SUBSCRIPTION",
12700
12864
  RENEW_GIFTED_SUBSCRIPTION: "RENEW_GIFTED_SUBSCRIPTION",
12865
+ PURCHASE_ECOMMERCE_ORDER: "PURCHASE_ECOMMERCE_ORDER",
12701
12866
  PAY_INVOICE: "PAY_INVOICE"
12702
12867
  };
12703
12868
 
@@ -12705,10 +12870,9 @@ var _isPaymentGatewayInvalid = /*#__PURE__*/new WeakMap();
12705
12870
 
12706
12871
  var _generateUserError = /*#__PURE__*/new WeakMap();
12707
12872
 
12708
- class Subscription {
12873
+ class Payment {
12709
12874
  /**
12710
- * Subscription service constructor
12711
- * @param {(StripeGateway|PaypalGateWay)} paymentGateway
12875
+ * @param {(StripeGateway|PaypalGateway|VantivGateway)} paymentGateway
12712
12876
  */
12713
12877
  constructor(paymentGateway) {
12714
12878
  _defineProperty$3(this, "execute", (options, callback) => {
@@ -12719,7 +12883,7 @@ class Subscription {
12719
12883
 
12720
12884
  if (!options.type) {
12721
12885
  callback(_classPrivateFieldGet(this, _generateUserError).call(this), null);
12722
- return console.error("No subscription type provided");
12886
+ return console.error("No payment type provided");
12723
12887
  } // delegate execution to paymentgateway
12724
12888
 
12725
12889
 
@@ -12729,7 +12893,7 @@ class Subscription {
12729
12893
  _isPaymentGatewayInvalid.set(this, {
12730
12894
  writable: true,
12731
12895
  value: gateway => {
12732
- return gateway && !(gateway instanceof StripeGateway) && gateway && !(gateway instanceof PaypalGateWay);
12896
+ return gateway && !(gateway instanceof StripeGateway || gateway instanceof PaypalGateway || gateway instanceof VantivGateway);
12733
12897
  }
12734
12898
  });
12735
12899
 
@@ -12737,21 +12901,21 @@ class Subscription {
12737
12901
  writable: true,
12738
12902
  value: () => {
12739
12903
  return {
12740
- error: new Error("An error has occured in the subscription service, please try again later")
12904
+ error: new Error("An error has occured in the payment service, please try again later")
12741
12905
  };
12742
12906
  }
12743
12907
  });
12744
12908
 
12745
12909
  if (_classPrivateFieldGet(this, _isPaymentGatewayInvalid).call(this, paymentGateway)) {
12746
12910
  this.paymentGateway = null;
12747
- console.error("Incompatible subscription gateway");
12911
+ console.error("Incompatible payment gateway");
12748
12912
  } else {
12749
12913
  this.paymentGateway = paymentGateway;
12750
12914
  }
12751
12915
  }
12752
12916
  /**
12753
- * @typedef subscriptionOptions
12754
- * @property {SUBSCRIPTION_TYPES} type
12917
+ * @typedef paymentOptions
12918
+ * @property {PAYMENT_TYPES} type
12755
12919
  * @property {string} token
12756
12920
  * @property {object} plan
12757
12921
  * @property {object} [product]
@@ -12762,6 +12926,7 @@ class Subscription {
12762
12926
  * @property {string} addressId
12763
12927
  * @property {number} invoiceId
12764
12928
  * @property {boolean} isExistingSource
12929
+ * @property {Array} items
12765
12930
  */
12766
12931
 
12767
12932
  /**
@@ -12772,8 +12937,8 @@ class Subscription {
12772
12937
  */
12773
12938
 
12774
12939
  /**
12775
- * Subscription execution method
12776
- * @param {subscriptionOptions} options subscription options
12940
+ * Payment execution method
12941
+ * @param {paymentOptions} options payment options
12777
12942
  * @param {executeCallback} callback
12778
12943
  * @return {void}
12779
12944
  */
@@ -12782,10 +12947,11 @@ class Subscription {
12782
12947
  }
12783
12948
  const PAYMENT_GATEWAYS_ENUM = {
12784
12949
  stripe: "stripe",
12785
- paypal: "braintree"
12950
+ paypal: "braintree",
12951
+ vantiv: "vantiv"
12786
12952
  };
12787
12953
  /**
12788
- * Subscription Strategies
12954
+ * Payment Strategies
12789
12955
  */
12790
12956
 
12791
12957
  /**
@@ -12802,6 +12968,8 @@ var _renewSubscription = /*#__PURE__*/new WeakMap();
12802
12968
 
12803
12969
  var _renewGiftedSubscription = /*#__PURE__*/new WeakMap();
12804
12970
 
12971
+ var _purchaseEcommerceOrder = /*#__PURE__*/new WeakMap();
12972
+
12805
12973
  var _payInvoice = /*#__PURE__*/new WeakMap();
12806
12974
 
12807
12975
  class StripeGateway {
@@ -12812,7 +12980,7 @@ class StripeGateway {
12812
12980
  });
12813
12981
 
12814
12982
  _defineProperty$3(this, "execute", (options, callback) => {
12815
- const types = SUBSCRIPTION_TYPES;
12983
+ const types = PAYMENT_TYPES;
12816
12984
 
12817
12985
  switch (options.type) {
12818
12986
  case types.CREATE_SUBSCRIPTION:
@@ -12827,11 +12995,14 @@ class StripeGateway {
12827
12995
  case types.RENEW_GIFTED_SUBSCRIPTION:
12828
12996
  return _classPrivateFieldGet(this, _renewGiftedSubscription).call(this, options, callback);
12829
12997
 
12998
+ case types.PURCHASE_ECOMMERCE_ORDER:
12999
+ return _classPrivateFieldGet(this, _purchaseEcommerceOrder).call(this, options, callback);
13000
+
12830
13001
  case types.PAY_INVOICE:
12831
13002
  return _classPrivateFieldGet(this, _payInvoice).call(this, options, callback);
12832
13003
 
12833
13004
  default:
12834
- console.error("Unsupported subscriptiion method: Stripe Gateway");
13005
+ console.error("Unsupported payment method: Stripe Gateway");
12835
13006
  }
12836
13007
  });
12837
13008
 
@@ -12853,6 +13024,7 @@ class StripeGateway {
12853
13024
  auth_token: window.Pelcro.user.read().auth_token,
12854
13025
  plan_id: plan.id,
12855
13026
  coupon_code: couponCode,
13027
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
12856
13028
  address_id: product.address_required ? addressId : null
12857
13029
  }, (err, res) => {
12858
13030
  callback(err, res);
@@ -12879,6 +13051,7 @@ class StripeGateway {
12879
13051
  auth_token: window.Pelcro.user.read().auth_token,
12880
13052
  plan_id: plan.id,
12881
13053
  coupon_code: couponCode,
13054
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
12882
13055
  gift_recipient_email: giftRecipient.email,
12883
13056
  gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
12884
13057
  gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
@@ -12906,6 +13079,7 @@ class StripeGateway {
12906
13079
  stripe_token: token,
12907
13080
  auth_token: window.Pelcro.user.read().auth_token,
12908
13081
  plan_id: plan.id,
13082
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
12909
13083
  coupon_code: couponCode,
12910
13084
  subscription_id: subscriptionIdToRenew,
12911
13085
  address_id: product.address_required ? addressId : null
@@ -12939,27 +13113,57 @@ class StripeGateway {
12939
13113
  }
12940
13114
  });
12941
13115
 
12942
- _payInvoice.set(this, {
13116
+ _purchaseEcommerceOrder.set(this, {
12943
13117
  writable: true,
12944
13118
  value: (options, callback) => {
12945
13119
  const {
12946
13120
  token,
12947
- invoiceId
13121
+ items,
13122
+ couponCode,
13123
+ addressId,
13124
+ isExistingSource
12948
13125
  } = options;
12949
- const params = options.isExistingSource ? {
12950
- source_id: token,
12951
- invoice_id: invoiceId
13126
+ const params = isExistingSource ? {
13127
+ source_id: token
12952
13128
  } : {
12953
13129
  payment_gateway: _classPrivateFieldGet(this, _paymentGateway),
12954
- gateway_token: token,
12955
- invoice_id: invoiceId
13130
+ gateway_token: token
12956
13131
  };
12957
- window.Pelcro.invoice.pay(params, (err, res) => {
13132
+ window.Pelcro.ecommerce.order.create({
13133
+ items,
13134
+ coupon_code: couponCode,
13135
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13136
+ ...params,
13137
+ ...(addressId && {
13138
+ address_id: addressId
13139
+ })
13140
+ }, (err, res) => {
12958
13141
  callback(err, res);
12959
13142
  });
12960
13143
  }
12961
13144
  });
12962
- }
13145
+
13146
+ _payInvoice.set(this, {
13147
+ writable: true,
13148
+ value: (options, callback) => {
13149
+ const {
13150
+ token,
13151
+ invoiceId
13152
+ } = options;
13153
+ const params = options.isExistingSource ? {
13154
+ source_id: token,
13155
+ invoice_id: invoiceId
13156
+ } : {
13157
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway),
13158
+ gateway_token: token,
13159
+ invoice_id: invoiceId
13160
+ };
13161
+ window.Pelcro.invoice.pay(params, (err, res) => {
13162
+ callback(err, res);
13163
+ });
13164
+ }
13165
+ });
13166
+ }
12963
13167
 
12964
13168
  }
12965
13169
  /**
@@ -12974,7 +13178,7 @@ var _createGiftedSubscription2 = /*#__PURE__*/new WeakMap();
12974
13178
 
12975
13179
  var _payInvoice2 = /*#__PURE__*/new WeakMap();
12976
13180
 
12977
- class PaypalGateWay {
13181
+ class PaypalGateway {
12978
13182
  constructor() {
12979
13183
  _paymentGateway2.set(this, {
12980
13184
  writable: true,
@@ -12982,7 +13186,7 @@ class PaypalGateWay {
12982
13186
  });
12983
13187
 
12984
13188
  _defineProperty$3(this, "execute", (options, callback) => {
12985
- const types = SUBSCRIPTION_TYPES;
13189
+ const types = PAYMENT_TYPES;
12986
13190
 
12987
13191
  switch (options.type) {
12988
13192
  case types.CREATE_SUBSCRIPTION:
@@ -13016,6 +13220,7 @@ class PaypalGateWay {
13016
13220
  payment_gateway: _classPrivateFieldGet(this, _paymentGateway2),
13017
13221
  auth_token: window.Pelcro.user.read().auth_token,
13018
13222
  plan_id: plan.id,
13223
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13019
13224
  coupon_code: couponCode,
13020
13225
  address_id: product.address_required ? addressId : null
13021
13226
  }, (err, res) => {
@@ -13043,6 +13248,7 @@ class PaypalGateWay {
13043
13248
  auth_token: window.Pelcro.user.read().auth_token,
13044
13249
  plan_id: plan.id,
13045
13250
  coupon_code: couponCode,
13251
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13046
13252
  gift_recipient_email: giftRecipient.email,
13047
13253
  gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
13048
13254
  gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
@@ -13075,6 +13281,241 @@ class PaypalGateWay {
13075
13281
 
13076
13282
  }
13077
13283
 
13284
+ var _paymentGateway3 = /*#__PURE__*/new WeakMap();
13285
+
13286
+ var _createSubscription3 = /*#__PURE__*/new WeakMap();
13287
+
13288
+ var _renewSubscription2 = /*#__PURE__*/new WeakMap();
13289
+
13290
+ var _createGiftedSubscription3 = /*#__PURE__*/new WeakMap();
13291
+
13292
+ var _renewGiftedSubscription2 = /*#__PURE__*/new WeakMap();
13293
+
13294
+ var _purchaseEcommerceOrder2 = /*#__PURE__*/new WeakMap();
13295
+
13296
+ var _payInvoice3 = /*#__PURE__*/new WeakMap();
13297
+
13298
+ class VantivGateway {
13299
+ constructor() {
13300
+ _paymentGateway3.set(this, {
13301
+ writable: true,
13302
+ value: PAYMENT_GATEWAYS_ENUM["vantiv"]
13303
+ });
13304
+
13305
+ _defineProperty$3(this, "execute", (options, callback) => {
13306
+ const types = PAYMENT_TYPES;
13307
+
13308
+ switch (options.type) {
13309
+ case types.CREATE_SUBSCRIPTION:
13310
+ return _classPrivateFieldGet(this, _createSubscription3).call(this, options, callback);
13311
+
13312
+ case types.RENEW_SUBSCRIPTION:
13313
+ return _classPrivateFieldGet(this, _renewSubscription2).call(this, options, callback);
13314
+
13315
+ case types.CREATE_GIFTED_SUBSCRIPTION:
13316
+ return _classPrivateFieldGet(this, _createGiftedSubscription3).call(this, options, callback);
13317
+
13318
+ case types.RENEW_GIFTED_SUBSCRIPTION:
13319
+ return _classPrivateFieldGet(this, _renewGiftedSubscription2).call(this, options, callback);
13320
+
13321
+ case types.PURCHASE_ECOMMERCE_ORDER:
13322
+ return _classPrivateFieldGet(this, _purchaseEcommerceOrder2).call(this, options, callback);
13323
+
13324
+ case types.PAY_INVOICE:
13325
+ return _classPrivateFieldGet(this, _payInvoice3).call(this, options, callback);
13326
+
13327
+ default:
13328
+ console.error("Unsupported payment method: vantiv Gateway");
13329
+ }
13330
+ });
13331
+
13332
+ _createSubscription3.set(this, {
13333
+ writable: true,
13334
+ value: (options, callback) => {
13335
+ const {
13336
+ token,
13337
+ plan,
13338
+ couponCode,
13339
+ product,
13340
+ quantity = 1,
13341
+ addressId,
13342
+ isExistingSource
13343
+ } = options;
13344
+ const params = isExistingSource ? {
13345
+ source_id: token
13346
+ } : {
13347
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13348
+ gateway_token: token
13349
+ };
13350
+ window.Pelcro.subscription.create({
13351
+ quantity,
13352
+ auth_token: window.Pelcro.user.read().auth_token,
13353
+ plan_id: plan.id,
13354
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13355
+ coupon_code: couponCode,
13356
+ address_id: product.address_required ? addressId : null,
13357
+ ...params
13358
+ }, (err, res) => {
13359
+ callback(err, res);
13360
+ });
13361
+ }
13362
+ });
13363
+
13364
+ _renewSubscription2.set(this, {
13365
+ writable: true,
13366
+ value: (options, callback) => {
13367
+ const {
13368
+ subscriptionIdToRenew,
13369
+ token,
13370
+ plan,
13371
+ couponCode,
13372
+ product,
13373
+ addressId,
13374
+ isExistingSource
13375
+ } = options;
13376
+ const params = isExistingSource ? {
13377
+ source_id: token
13378
+ } : {
13379
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13380
+ gateway_token: token
13381
+ };
13382
+ window.Pelcro.subscription.renew({
13383
+ auth_token: window.Pelcro.user.read().auth_token,
13384
+ plan_id: plan.id,
13385
+ coupon_code: couponCode,
13386
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13387
+ subscription_id: subscriptionIdToRenew,
13388
+ address_id: product.address_required ? addressId : null,
13389
+ ...params
13390
+ }, (err, res) => {
13391
+ callback(err, res);
13392
+ });
13393
+ }
13394
+ });
13395
+
13396
+ _createGiftedSubscription3.set(this, {
13397
+ writable: true,
13398
+ value: (options, callback) => {
13399
+ const {
13400
+ token,
13401
+ plan,
13402
+ couponCode,
13403
+ product,
13404
+ giftRecipient,
13405
+ quantity = 1,
13406
+ addressId,
13407
+ isExistingSource
13408
+ } = options;
13409
+ const params = isExistingSource ? {
13410
+ source_id: token
13411
+ } : {
13412
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13413
+ gateway_token: token
13414
+ };
13415
+ window.Pelcro.subscription.create({
13416
+ quantity,
13417
+ auth_token: window.Pelcro.user.read().auth_token,
13418
+ plan_id: plan.id,
13419
+ coupon_code: couponCode,
13420
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13421
+ gift_recipient_email: giftRecipient.email,
13422
+ gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
13423
+ gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
13424
+ gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
13425
+ gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
13426
+ address_id: product.address_required ? addressId : null,
13427
+ ...params
13428
+ }, (err, res) => {
13429
+ callback(err, res);
13430
+ });
13431
+ }
13432
+ });
13433
+
13434
+ _renewGiftedSubscription2.set(this, {
13435
+ writable: true,
13436
+ value: (options, callback) => {
13437
+ const {
13438
+ subscriptionIdToRenew,
13439
+ token,
13440
+ product,
13441
+ plan,
13442
+ couponCode,
13443
+ addressId,
13444
+ isExistingSource
13445
+ } = options;
13446
+ const params = isExistingSource ? {
13447
+ source_id: token
13448
+ } : {
13449
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13450
+ gateway_token: token
13451
+ };
13452
+ window.Pelcro.subscription.renewGift({
13453
+ auth_token: window.Pelcro.user.read().auth_token,
13454
+ plan_id: plan.id,
13455
+ coupon_code: couponCode,
13456
+ subscription_id: subscriptionIdToRenew,
13457
+ address_id: product.address_required ? addressId : null,
13458
+ ...params
13459
+ }, (err, res) => {
13460
+ callback(err, res);
13461
+ });
13462
+ }
13463
+ });
13464
+
13465
+ _purchaseEcommerceOrder2.set(this, {
13466
+ writable: true,
13467
+ value: (options, callback) => {
13468
+ const {
13469
+ token,
13470
+ items,
13471
+ couponCode,
13472
+ addressId,
13473
+ isExistingSource
13474
+ } = options;
13475
+ const params = isExistingSource ? {
13476
+ source_id: token
13477
+ } : {
13478
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13479
+ gateway_token: token
13480
+ };
13481
+ window.Pelcro.ecommerce.order.create({
13482
+ items,
13483
+ coupon_code: couponCode,
13484
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13485
+ ...params,
13486
+ ...(addressId && {
13487
+ address_id: addressId
13488
+ })
13489
+ }, (err, res) => {
13490
+ callback(err, res);
13491
+ });
13492
+ }
13493
+ });
13494
+
13495
+ _payInvoice3.set(this, {
13496
+ writable: true,
13497
+ value: (options, callback) => {
13498
+ const {
13499
+ token,
13500
+ invoiceId
13501
+ } = options;
13502
+ const params = options.isExistingSource ? {
13503
+ source_id: token,
13504
+ invoice_id: invoiceId
13505
+ } : {
13506
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13507
+ gateway_token: token,
13508
+ invoice_id: invoiceId
13509
+ };
13510
+ window.Pelcro.invoice.pay(params, (err, res) => {
13511
+ callback(err, res);
13512
+ });
13513
+ }
13514
+ });
13515
+ }
13516
+
13517
+ }
13518
+
13078
13519
  /**
13079
13520
  * @typedef {Object} PaymentStateType
13080
13521
  * @property {boolean} disableSubmit
@@ -13095,7 +13536,7 @@ class PaypalGateWay {
13095
13536
 
13096
13537
  /** @type {PaymentStateType} */
13097
13538
 
13098
- const initialState$f = {
13539
+ const initialState$g = {
13099
13540
  disableSubmit: false,
13100
13541
  isLoading: false,
13101
13542
  disableCouponButton: false,
@@ -13114,10 +13555,10 @@ const initialState$f = {
13114
13555
  content: ""
13115
13556
  }
13116
13557
  };
13117
- const store$f = /*#__PURE__*/React.createContext(initialState$f);
13558
+ const store$g = /*#__PURE__*/React.createContext(initialState$g);
13118
13559
  const {
13119
- Provider: Provider$f
13120
- } = store$f;
13560
+ Provider: Provider$g
13561
+ } = store$g;
13121
13562
 
13122
13563
  const PaymentMethodContainerWithoutStripe = ({
13123
13564
  style,
@@ -13130,7 +13571,7 @@ const PaymentMethodContainerWithoutStripe = ({
13130
13571
  onFailure = () => {},
13131
13572
  ...props
13132
13573
  }) => {
13133
- var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isRenewingGift, _props$invoice;
13574
+ var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice;
13134
13575
 
13135
13576
  const {
13136
13577
  t
@@ -13146,6 +13587,7 @@ const PaymentMethodContainerWithoutStripe = ({
13146
13587
  const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
13147
13588
  const selectedAddressId = (_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : pelcroStore.selectedAddressId;
13148
13589
  const giftRecipient = (_props$giftRecipient = props.giftRecipient) !== null && _props$giftRecipient !== void 0 ? _props$giftRecipient : pelcroStore.giftRecipient;
13590
+ const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
13149
13591
  const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
13150
13592
  const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
13151
13593
  React.useEffect(() => {
@@ -13162,6 +13604,203 @@ const PaymentMethodContainerWithoutStripe = ({
13162
13604
  updateTotalAmountWithTax();
13163
13605
  }, []);
13164
13606
 
13607
+ const submitUsingVantiv = () => {
13608
+ const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
13609
+
13610
+ if (isUsingExistingPaymentMethod) {
13611
+ // no need to create a new source using vantiv
13612
+ return handleVantivPayment(null);
13613
+ }
13614
+
13615
+ if (!vantivInstanceRef.current) {
13616
+ return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
13617
+ }
13618
+
13619
+ const orderId = `pelcro-${new Date().getTime()}`;
13620
+ /*
13621
+ calls handleVantivPayment to either handle a payment or update a source by simply creating a new source
13622
+ */
13623
+
13624
+ vantivInstanceRef.current.getPaypageRegistrationId({
13625
+ id: orderId,
13626
+ orderId: orderId
13627
+ });
13628
+ };
13629
+
13630
+ function handleVantivPayment(paymentRequest) {
13631
+ if (paymentRequest) {
13632
+ const SUCCESS_STATUS = "870";
13633
+
13634
+ if (paymentRequest.response !== SUCCESS_STATUS) {
13635
+ return handlePaymentError({
13636
+ error: new Error(paymentRequest.message)
13637
+ });
13638
+ }
13639
+ }
13640
+
13641
+ const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
13642
+
13643
+ if (type === "createPayment") {
13644
+ handleVantivSubscription();
13645
+ } else if (type === "orderCreate") {
13646
+ purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
13647
+ } else if (type === "invoicePayment") {
13648
+ payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
13649
+ } else if (type === "updatePaymentSource") {
13650
+ createNewVantivCard();
13651
+ }
13652
+
13653
+ function createNewVantivCard() {
13654
+ window.Pelcro.source.create({
13655
+ auth_token: window.Pelcro.user.read().auth_token,
13656
+ token: paymentRequest,
13657
+ gateway: "vantiv"
13658
+ }, (err, res) => {
13659
+ dispatch({
13660
+ type: DISABLE_SUBMIT,
13661
+ payload: false
13662
+ });
13663
+ dispatch({
13664
+ type: LOADING,
13665
+ payload: false
13666
+ });
13667
+
13668
+ if (err) {
13669
+ onFailure(err);
13670
+ return dispatch({
13671
+ type: SHOW_ALERT,
13672
+ payload: {
13673
+ type: "error",
13674
+ content: getErrorMessages(err)
13675
+ }
13676
+ });
13677
+ }
13678
+
13679
+ dispatch({
13680
+ type: SHOW_ALERT,
13681
+ payload: {
13682
+ type: "success",
13683
+ content: t("messages.sourceUpdated")
13684
+ }
13685
+ });
13686
+ onSuccess(res);
13687
+ });
13688
+ }
13689
+
13690
+ function handleVantivSubscription() {
13691
+ const payment = new Payment(new VantivGateway());
13692
+ const createSubscription = !isGift && !subscriptionIdToRenew;
13693
+ const renewSubscription = !isGift && subscriptionIdToRenew;
13694
+ const giftSubscriprition = isGift && !subscriptionIdToRenew;
13695
+ const renewGift = isRenewingGift;
13696
+ const {
13697
+ couponCode
13698
+ } = state;
13699
+
13700
+ if (renewGift) {
13701
+ return payment.execute({
13702
+ type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
13703
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13704
+ plan,
13705
+ couponCode,
13706
+ product,
13707
+ isExistingSource: isUsingExistingPaymentMethod,
13708
+ subscriptionIdToRenew,
13709
+ addressId: selectedAddressId
13710
+ }, (err, res) => {
13711
+ if (err) {
13712
+ return handlePaymentError(err);
13713
+ }
13714
+
13715
+ onSuccess(res);
13716
+ });
13717
+ } else if (giftSubscriprition) {
13718
+ return payment.execute({
13719
+ type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
13720
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13721
+ quantity: plan.quantity,
13722
+ plan,
13723
+ couponCode,
13724
+ product,
13725
+ isExistingSource: isUsingExistingPaymentMethod,
13726
+ giftRecipient,
13727
+ addressId: selectedAddressId
13728
+ }, (err, res) => {
13729
+ if (err) {
13730
+ return handlePaymentError(err);
13731
+ }
13732
+
13733
+ onSuccess(res);
13734
+ });
13735
+ } else if (renewSubscription) {
13736
+ return payment.execute({
13737
+ type: PAYMENT_TYPES.RENEW_SUBSCRIPTION,
13738
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13739
+ quantity: plan.quantity,
13740
+ plan,
13741
+ couponCode,
13742
+ product,
13743
+ isExistingSource: isUsingExistingPaymentMethod,
13744
+ subscriptionIdToRenew,
13745
+ addressId: selectedAddressId
13746
+ }, (err, res) => {
13747
+ if (err) {
13748
+ return handlePaymentError(err);
13749
+ }
13750
+
13751
+ onSuccess(res);
13752
+ });
13753
+ } else if (createSubscription) {
13754
+ return payment.execute({
13755
+ type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
13756
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13757
+ quantity: plan.quantity,
13758
+ plan,
13759
+ couponCode,
13760
+ product,
13761
+ isExistingSource: isUsingExistingPaymentMethod,
13762
+ addressId: selectedAddressId
13763
+ }, (err, res) => {
13764
+ if (err) {
13765
+ return handlePaymentError(err);
13766
+ }
13767
+
13768
+ onSuccess(res);
13769
+ });
13770
+ }
13771
+ }
13772
+ }
13773
+
13774
+ const vantivInstanceRef = React__default['default'].useRef(null);
13775
+ React.useEffect(() => {
13776
+ const cardProcessor = getSiteCardProcessor();
13777
+
13778
+ if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
13779
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
13780
+
13781
+ const payPageId = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings.pay_page_id;
13782
+ const reportGroup = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.report_group;
13783
+ vantivInstanceRef.current = new window.EprotectIframeClient({
13784
+ paypageId: payPageId,
13785
+ reportGroup: reportGroup,
13786
+ style: "pelcro",
13787
+ height: "245",
13788
+ timeout: 50000,
13789
+ div: "eProtectiframe",
13790
+ callback: handleVantivPayment,
13791
+ showCvv: true,
13792
+ numYears: 8,
13793
+ placeholderText: {
13794
+ cvv: "CVV",
13795
+ accountNumber: "1234 1234 1234 1234"
13796
+ },
13797
+ enhancedUxFeatures: {
13798
+ inlineFieldValidations: true
13799
+ }
13800
+ });
13801
+ }
13802
+ }, [selectedPaymentMethodId]);
13803
+
13165
13804
  const initPaymentRequest = (state, dispatch) => {
13166
13805
  try {
13167
13806
  const paymentRequest = stripe.paymentRequest({
@@ -13232,9 +13871,9 @@ const PaymentMethodContainerWithoutStripe = ({
13232
13871
 
13233
13872
 
13234
13873
  const updateTotalAmountWithTax = () => {
13235
- var _window$Pelcro$site$r;
13874
+ var _window$Pelcro$site$r3;
13236
13875
 
13237
- 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;
13876
+ 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;
13238
13877
 
13239
13878
  if (taxesEnabled && type === "createPayment") {
13240
13879
  dispatch({
@@ -13391,6 +14030,7 @@ const PaymentMethodContainerWithoutStripe = ({
13391
14030
  window.Pelcro.order.create({
13392
14031
  auth_token: window.Pelcro.user.read().auth_token,
13393
14032
  plan_id: plan.id,
14033
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13394
14034
  coupon_code: couponCode,
13395
14035
  address_id: selectedAddressId
13396
14036
  }, handleCouponResponse);
@@ -13472,6 +14112,7 @@ const PaymentMethodContainerWithoutStripe = ({
13472
14112
  stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
13473
14113
  auth_token: window.Pelcro.user.read().auth_token,
13474
14114
  plan_id: plan.id,
14115
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13475
14116
  quantity: plan.quantity,
13476
14117
  coupon_code: couponCode,
13477
14118
  gift_recipient_email: giftRecipient ? giftRecipient.email : null,
@@ -13543,6 +14184,7 @@ const PaymentMethodContainerWithoutStripe = ({
13543
14184
  stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
13544
14185
  auth_token: window.Pelcro.user.read().auth_token,
13545
14186
  plan_id: plan.id,
14187
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13546
14188
  coupon_code: couponCode,
13547
14189
  subscription_id: subscriptionIdToRenew,
13548
14190
  address_id: product.address_required ? selectedAddressId : null
@@ -13584,7 +14226,7 @@ const PaymentMethodContainerWithoutStripe = ({
13584
14226
 
13585
14227
 
13586
14228
  const handlePaypalSubscription = (state, paypalNonce) => {
13587
- const subscription = new Subscription(new PaypalGateWay());
14229
+ const payment = new Payment(new PaypalGateway());
13588
14230
  const {
13589
14231
  couponCode
13590
14232
  } = state;
@@ -13593,8 +14235,8 @@ const PaymentMethodContainerWithoutStripe = ({
13593
14235
  */
13594
14236
 
13595
14237
  if (giftRecipient) {
13596
- return subscription.execute({
13597
- type: SUBSCRIPTION_TYPES.CREATE_GIFTED_SUBSCRIPTION,
14238
+ return payment.execute({
14239
+ type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
13598
14240
  token: paypalNonce,
13599
14241
  quantity: plan.quantity,
13600
14242
  plan,
@@ -13627,8 +14269,8 @@ const PaymentMethodContainerWithoutStripe = ({
13627
14269
  });
13628
14270
  }
13629
14271
 
13630
- return subscription.execute({
13631
- type: SUBSCRIPTION_TYPES.CREATE_SUBSCRIPTION,
14272
+ return payment.execute({
14273
+ type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
13632
14274
  token: paypalNonce,
13633
14275
  quantity: plan.quantity,
13634
14276
  plan,
@@ -13660,7 +14302,7 @@ const PaymentMethodContainerWithoutStripe = ({
13660
14302
  });
13661
14303
  };
13662
14304
 
13663
- const purchase = (stripeSource, state, dispatch) => {
14305
+ const purchase = (gatewayService, gatewayToken, state, dispatch) => {
13664
14306
  const isQuickPurchase = !Array.isArray(order);
13665
14307
  const mappedOrderItems = isQuickPurchase ? [{
13666
14308
  sku_id: order.id,
@@ -13672,14 +14314,14 @@ const PaymentMethodContainerWithoutStripe = ({
13672
14314
  const {
13673
14315
  couponCode
13674
14316
  } = state;
13675
- window.Pelcro.ecommerce.order.create({
13676
- source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
13677
- stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
14317
+ const payment = new Payment(gatewayService);
14318
+ payment.execute({
14319
+ type: PAYMENT_TYPES.PURCHASE_ECOMMERCE_ORDER,
14320
+ token: gatewayToken,
14321
+ isExistingSource: Boolean(selectedPaymentMethodId),
13678
14322
  items: mappedOrderItems,
13679
- coupon_code: couponCode,
13680
- ...(selectedAddressId && {
13681
- address_id: selectedAddressId
13682
- })
14323
+ addressId: selectedAddressId,
14324
+ couponCode
13683
14325
  }, (err, res) => {
13684
14326
  dispatch({
13685
14327
  type: DISABLE_SUBMIT,
@@ -13717,9 +14359,9 @@ const PaymentMethodContainerWithoutStripe = ({
13717
14359
  };
13718
14360
 
13719
14361
  const payInvoice = (gatewayService, gatewayToken, dispatch) => {
13720
- const subscription = new Subscription(gatewayService);
13721
- return subscription.execute({
13722
- type: SUBSCRIPTION_TYPES.PAY_INVOICE,
14362
+ const payment = new Payment(gatewayService);
14363
+ return payment.execute({
14364
+ type: PAYMENT_TYPES.PAY_INVOICE,
13723
14365
  token: gatewayToken,
13724
14366
  isExistingSource: Boolean(selectedPaymentMethodId),
13725
14367
  invoiceId: invoice.id
@@ -13764,7 +14406,9 @@ const PaymentMethodContainerWithoutStripe = ({
13764
14406
 
13765
14407
  if ((source === null || source === void 0 ? void 0 : (_source$card2 = source.card) === null || _source$card2 === void 0 ? void 0 : _source$card2.three_d_secure) === "required") {
13766
14408
  return handlePaymentError({
13767
- message: t("messages.cardAuthNotSupported")
14409
+ error: {
14410
+ message: t("messages.cardAuthNotSupported")
14411
+ }
13768
14412
  });
13769
14413
  }
13770
14414
 
@@ -13879,13 +14523,13 @@ const PaymentMethodContainerWithoutStripe = ({
13879
14523
 
13880
14524
 
13881
14525
  const resolveTaxCalculation = () => {
13882
- var _window$Pelcro$site$r2;
14526
+ var _window$Pelcro$site$r4;
13883
14527
 
13884
14528
  if (type === "invoicePayment") {
13885
14529
  return new Promise(resolve => resolve());
13886
14530
  }
13887
14531
 
13888
- 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;
14532
+ const taxesEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.taxes_enabled;
13889
14533
  return new Promise((resolve, reject) => {
13890
14534
  // resolve early if taxes isn't enabled
13891
14535
  if (!taxesEnabled) {
@@ -13895,6 +14539,7 @@ const PaymentMethodContainerWithoutStripe = ({
13895
14539
  window.Pelcro.order.create({
13896
14540
  auth_token: window.Pelcro.user.read().auth_token,
13897
14541
  plan_id: plan.id,
14542
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13898
14543
  coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
13899
14544
  address_id: selectedAddressId
13900
14545
  }, (error, res) => {
@@ -13957,13 +14602,15 @@ const PaymentMethodContainerWithoutStripe = ({
13957
14602
  if (stripeSource && type === "createPayment") {
13958
14603
  subscribe(stripeSource, state, dispatch);
13959
14604
  } else if (stripeSource && type === "orderCreate") {
13960
- purchase(stripeSource, state, dispatch);
14605
+ purchase(new StripeGateway(), stripeSource.id, state, dispatch);
13961
14606
  } else if (stripeSource && type === "invoicePayment") {
13962
14607
  payInvoice(new StripeGateway(), stripeSource.id, dispatch);
13963
14608
  }
13964
14609
  };
13965
14610
 
13966
14611
  const handlePaymentError = error => {
14612
+ var _getErrorMessages;
14613
+
13967
14614
  if (error.type === "validation_error" && // Subscription creation & renewal
13968
14615
  type === "createPayment") {
13969
14616
  var _state$couponObject;
@@ -13982,7 +14629,7 @@ const PaymentMethodContainerWithoutStripe = ({
13982
14629
  type: SHOW_ALERT,
13983
14630
  payload: {
13984
14631
  type: "error",
13985
- content: error === null || error === void 0 ? void 0 : error.message
14632
+ content: (_getErrorMessages = getErrorMessages(error)) !== null && _getErrorMessages !== void 0 ? _getErrorMessages : error === null || error === void 0 ? void 0 : error.message
13986
14633
  }
13987
14634
  });
13988
14635
  dispatch({
@@ -14006,7 +14653,9 @@ const PaymentMethodContainerWithoutStripe = ({
14006
14653
 
14007
14654
  if ((source === null || source === void 0 ? void 0 : source.status) === "failed") {
14008
14655
  return handlePaymentError({
14009
- message: t("messages.cardAuthFailed")
14656
+ error: {
14657
+ message: t("messages.cardAuthFailed")
14658
+ }
14010
14659
  });
14011
14660
  }
14012
14661
 
@@ -14077,6 +14726,10 @@ const PaymentMethodContainerWithoutStripe = ({
14077
14726
  disableSubmit: true,
14078
14727
  isLoading: true
14079
14728
  }, (state, dispatch) => {
14729
+ if (getSiteCardProcessor() === "vantiv") {
14730
+ return submitUsingVantiv();
14731
+ }
14732
+
14080
14733
  if (selectedPaymentMethodId) {
14081
14734
  // pay with selected method (source) if exists already
14082
14735
  return handlePayment({
@@ -14086,16 +14739,16 @@ const PaymentMethodContainerWithoutStripe = ({
14086
14739
  }
14087
14740
 
14088
14741
  if (type === "updatePaymentSource") {
14089
- updatePaymentSource(state, dispatch);
14090
- } else {
14091
- submitPayment(state);
14742
+ return updatePaymentSource(state, dispatch);
14092
14743
  }
14744
+
14745
+ submitPayment(state);
14093
14746
  });
14094
14747
 
14095
14748
  case HANDLE_PAYPAL_SUBSCRIPTION:
14096
14749
  return lib_5(state, (state, dispatch) => {
14097
14750
  if (type === "invoicePayment") {
14098
- payInvoice(new PaypalGateWay(), action.payload, dispatch);
14751
+ payInvoice(new PaypalGateway(), action.payload, dispatch);
14099
14752
  } else {
14100
14753
  handlePaypalSubscription(state, action.payload);
14101
14754
  }
@@ -14157,21 +14810,21 @@ const PaymentMethodContainerWithoutStripe = ({
14157
14810
  default:
14158
14811
  return state;
14159
14812
  }
14160
- }, initialState$f);
14813
+ }, initialState$g);
14161
14814
  return /*#__PURE__*/React__default['default'].createElement("div", {
14162
14815
  style: { ...style
14163
14816
  },
14164
14817
  className: `pelcro-container pelcro-payment-container ${className}`
14165
- }, /*#__PURE__*/React__default['default'].createElement(Provider$f, {
14818
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$g, {
14166
14819
  value: {
14167
14820
  state,
14168
14821
  dispatch
14169
14822
  }
14170
14823
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
14171
- store: store$f,
14824
+ store: store$g,
14172
14825
  key: i
14173
14826
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
14174
- store: store$f
14827
+ store: store$g
14175
14828
  })));
14176
14829
  };
14177
14830
 
@@ -14193,7 +14846,7 @@ const PaymentMethodContainer = props => {
14193
14846
  stripeAccount: window.Pelcro.site.read().account_id,
14194
14847
  locale: getPageOrDefaultLanguage()
14195
14848
  }, /*#__PURE__*/React__default['default'].createElement(es_11, null, /*#__PURE__*/React__default['default'].createElement(UnwrappedForm, Object.assign({
14196
- store: store$f
14849
+ store: store$g
14197
14850
  }, props))));
14198
14851
  }
14199
14852
 
@@ -14246,7 +14899,7 @@ const PelcroPaymentRequestButton = props => {
14246
14899
  currentPlan,
14247
14900
  updatedPrice
14248
14901
  }
14249
- } = React.useContext(store$f);
14902
+ } = React.useContext(store$g);
14250
14903
 
14251
14904
  const updatePaymentRequest = () => {
14252
14905
  // Make sure payment request is up to date, eg. user added a coupon code.
@@ -14278,19 +14931,35 @@ const CheckoutForm = () => {
14278
14931
  const {
14279
14932
  selectedPaymentMethodId
14280
14933
  } = usePelcro();
14281
- return !selectedPaymentMethodId && /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(PelcroCardNumber, {
14282
- autoFocus: true
14283
- }), /*#__PURE__*/React__default['default'].createElement("img", {
14284
- alt: "credit_cards",
14285
- className: "plc-h-4 plc-w-auto plc-mt-2",
14286
- src: "https://js.pelcro.com/ui/plugin/main/images/credit_cards.png"
14287
- }), /*#__PURE__*/React__default['default'].createElement("div", {
14288
- className: "plc-flex plc-justify-between plc-my-2 plc-items-end"
14289
- }, /*#__PURE__*/React__default['default'].createElement("div", {
14290
- className: "plc-w-6/12 plc-pr-4"
14291
- }, /*#__PURE__*/React__default['default'].createElement(PelcroCardExpiry, null)), /*#__PURE__*/React__default['default'].createElement("div", {
14292
- className: "plc-w-6/12 plc-pl-4"
14293
- }, /*#__PURE__*/React__default['default'].createElement(PelcroCardCVC, null))));
14934
+ const cardProcessor = getSiteCardProcessor();
14935
+
14936
+ if (selectedPaymentMethodId) {
14937
+ return null;
14938
+ }
14939
+
14940
+ if (cardProcessor === "vantiv") {
14941
+ return /*#__PURE__*/React__default['default'].createElement("div", {
14942
+ id: "eProtectiframe"
14943
+ });
14944
+ }
14945
+
14946
+ if (cardProcessor === "stripe") {
14947
+ return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(PelcroCardNumber, {
14948
+ autoFocus: true
14949
+ }), /*#__PURE__*/React__default['default'].createElement("img", {
14950
+ alt: "credit_cards",
14951
+ className: "plc-w-auto plc-h-4 plc-mt-2",
14952
+ src: "https://js.pelcro.com/ui/plugin/main/images/credit_cards.png"
14953
+ }), /*#__PURE__*/React__default['default'].createElement("div", {
14954
+ className: "plc-flex plc-items-end plc-justify-between plc-my-2"
14955
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
14956
+ className: "plc-w-6/12 plc-pr-4"
14957
+ }, /*#__PURE__*/React__default['default'].createElement(PelcroCardExpiry, null)), /*#__PURE__*/React__default['default'].createElement("div", {
14958
+ className: "plc-w-6/12 plc-pl-4"
14959
+ }, /*#__PURE__*/React__default['default'].createElement(PelcroCardCVC, null))));
14960
+ }
14961
+
14962
+ return null;
14294
14963
  };
14295
14964
 
14296
14965
  const DiscountedPrice = props => {
@@ -14306,7 +14975,7 @@ const DiscountedPrice = props => {
14306
14975
  taxAmount,
14307
14976
  percentOff
14308
14977
  }
14309
- } = React.useContext(store$f);
14978
+ } = React.useContext(store$g);
14310
14979
  const {
14311
14980
  order,
14312
14981
  plan
@@ -14356,7 +15025,7 @@ const SubmitPaymentMethod = ({
14356
15025
  isLoading,
14357
15026
  updatedPrice
14358
15027
  }
14359
- } = React.useContext(store$f);
15028
+ } = React.useContext(store$g);
14360
15029
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
14361
15030
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
14362
15031
  const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
@@ -14377,17 +15046,17 @@ const SubmitPaymentMethod = ({
14377
15046
  }, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
14378
15047
  };
14379
15048
 
14380
- var _path$l;
15049
+ var _path$n;
14381
15050
 
14382
- 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); }
15051
+ 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); }
14383
15052
 
14384
15053
  function SvgArrowLeft(props) {
14385
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
15054
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
14386
15055
  xmlns: "http://www.w3.org/2000/svg",
14387
15056
  fill: "none",
14388
15057
  viewBox: "0 0 24 24",
14389
15058
  stroke: "currentColor"
14390
- }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
15059
+ }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
14391
15060
  strokeLinecap: "round",
14392
15061
  strokeLinejoin: "round",
14393
15062
  strokeWidth: 2,
@@ -14406,7 +15075,7 @@ const ApplyCouponButton = ({
14406
15075
  disableCouponButton
14407
15076
  },
14408
15077
  dispatch
14409
- } = React.useContext(store$f);
15078
+ } = React.useContext(store$g);
14410
15079
  const {
14411
15080
  t
14412
15081
  } = useTranslation("checkoutForm");
@@ -14440,7 +15109,7 @@ const CouponCodeField = props => {
14440
15109
  couponCode,
14441
15110
  couponError
14442
15111
  }
14443
- } = React.useContext(store$f);
15112
+ } = React.useContext(store$g);
14444
15113
 
14445
15114
  const onCouponCodeChange = e => {
14446
15115
  dispatch({
@@ -14469,17 +15138,17 @@ const CouponCodeField = props => {
14469
15138
  }, props));
14470
15139
  };
14471
15140
 
14472
- var _path$k;
15141
+ var _path$m;
14473
15142
 
14474
- 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); }
15143
+ 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); }
14475
15144
 
14476
15145
  function SvgTicket(props) {
14477
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
15146
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
14478
15147
  xmlns: "http://www.w3.org/2000/svg",
14479
15148
  fill: "none",
14480
15149
  viewBox: "0 0 24 24",
14481
15150
  stroke: "currentColor"
14482
- }, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
15151
+ }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
14483
15152
  strokeLinecap: "round",
14484
15153
  strokeLinejoin: "round",
14485
15154
  strokeWidth: 2,
@@ -14496,7 +15165,7 @@ const CouponCode = ({
14496
15165
  state: {
14497
15166
  enableCouponField
14498
15167
  }
14499
- } = React.useContext(store$f);
15168
+ } = React.useContext(store$g);
14500
15169
  const {
14501
15170
  t
14502
15171
  } = useTranslation("checkoutForm");
@@ -14753,7 +15422,7 @@ const PaypalSubscribeButton = props => {
14753
15422
  const {
14754
15423
  dispatch,
14755
15424
  state
14756
- } = React.useContext(store$f);
15425
+ } = React.useContext(store$g);
14757
15426
  const {
14758
15427
  product,
14759
15428
  plan,
@@ -14839,16 +15508,16 @@ const BankRedirection = () => {
14839
15508
  }));
14840
15509
  };
14841
15510
 
14842
- var _path$j;
15511
+ var _path$l;
14843
15512
 
14844
- 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); }
15513
+ 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); }
14845
15514
 
14846
15515
  function SvgLock(props) {
14847
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
15516
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
14848
15517
  xmlns: "http://www.w3.org/2000/svg",
14849
15518
  viewBox: "0 0 20 20",
14850
15519
  fill: "currentColor"
14851
- }, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
15520
+ }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
14852
15521
  fillRule: "evenodd",
14853
15522
  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",
14854
15523
  clipRule: "evenodd"
@@ -14865,7 +15534,7 @@ const SelectedPaymentMethod = () => {
14865
15534
  state: {
14866
15535
  isLoading
14867
15536
  }
14868
- } = React.useContext(store$f);
15537
+ } = React.useContext(store$g);
14869
15538
  const {
14870
15539
  switchView,
14871
15540
  selectedPaymentMethodId
@@ -14907,7 +15576,7 @@ const TaxAmount = () => {
14907
15576
  state: {
14908
15577
  taxAmount
14909
15578
  }
14910
- } = React.useContext(store$f);
15579
+ } = React.useContext(store$g);
14911
15580
  const {
14912
15581
  plan
14913
15582
  } = usePelcro();
@@ -14940,9 +15609,10 @@ function PaymentMethodView({
14940
15609
  const {
14941
15610
  t
14942
15611
  } = useTranslation("checkoutForm");
15612
+ const cardProcessor = getSiteCardProcessor();
14943
15613
  return /*#__PURE__*/React__default['default'].createElement("div", {
14944
15614
  className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
14945
- }, /*#__PURE__*/React__default['default'].createElement("div", {
15615
+ }, cardProcessor === "stripe" && /*#__PURE__*/React__default['default'].createElement("div", {
14946
15616
  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"
14947
15617
  }, /*#__PURE__*/React__default['default'].createElement(SvgLock, {
14948
15618
  className: "plc-w-5 plc-h-5 plc-mr-1"
@@ -15070,12 +15740,12 @@ function SubscriptionRenewModal({
15070
15740
  }
15071
15741
  SubscriptionRenewModal.viewId = "subscription-renew";
15072
15742
 
15073
- var _path$i;
15743
+ var _path$k;
15074
15744
 
15075
- 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); }
15745
+ 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); }
15076
15746
 
15077
15747
  function SvgGift(props) {
15078
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
15748
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
15079
15749
  className: "plc-w-6 plc-h-6 plc-mr-2",
15080
15750
  fill: "none",
15081
15751
  stroke: "currentColor",
@@ -15084,7 +15754,7 @@ function SvgGift(props) {
15084
15754
  strokeWidth: 2,
15085
15755
  viewBox: "0 0 24 24",
15086
15756
  xmlns: "http://www.w3.org/2000/svg"
15087
- }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
15757
+ }, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
15088
15758
  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"
15089
15759
  })));
15090
15760
  }
@@ -15425,7 +16095,7 @@ class DefaultNewsLetter extends React.Component {
15425
16095
 
15426
16096
  const NewsLetter = withTranslation("newsletter")(DefaultNewsLetter);
15427
16097
 
15428
- const initialState$e = {
16098
+ const initialState$f = {
15429
16099
  didSubToNewslettersBefore: false,
15430
16100
  newsletters: [],
15431
16101
  isListLoading: true,
@@ -15435,10 +16105,10 @@ const initialState$e = {
15435
16105
  content: ""
15436
16106
  }
15437
16107
  };
15438
- const store$e = /*#__PURE__*/React.createContext(initialState$e);
16108
+ const store$f = /*#__PURE__*/React.createContext(initialState$f);
15439
16109
  const {
15440
- Provider: Provider$e
15441
- } = store$e;
16110
+ Provider: Provider$f
16111
+ } = store$f;
15442
16112
 
15443
16113
  const NewsletterUpdateContainer = ({
15444
16114
  style,
@@ -15551,7 +16221,7 @@ const NewsletterUpdateContainer = ({
15551
16221
  default:
15552
16222
  return state;
15553
16223
  }
15554
- }, initialState$e);
16224
+ }, initialState$f);
15555
16225
  React.useEffect(() => {
15556
16226
  const getUserNewsletters = () => {
15557
16227
  var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
@@ -15595,7 +16265,7 @@ const NewsletterUpdateContainer = ({
15595
16265
  style: { ...style
15596
16266
  },
15597
16267
  className: `pelcro-container pelcro-newsletter-update-container ${className}`
15598
- }, /*#__PURE__*/React__default['default'].createElement(Provider$e, {
16268
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$f, {
15599
16269
  value: {
15600
16270
  state,
15601
16271
  dispatch
@@ -15603,12 +16273,12 @@ const NewsletterUpdateContainer = ({
15603
16273
  }, children.length ? children.map((child, i) => {
15604
16274
  if (child) {
15605
16275
  return /*#__PURE__*/React__default['default'].cloneElement(child, {
15606
- store: store$e,
16276
+ store: store$f,
15607
16277
  key: i
15608
16278
  });
15609
16279
  }
15610
16280
  }) : /*#__PURE__*/React__default['default'].cloneElement(children, {
15611
- store: store$e
16281
+ store: store$f
15612
16282
  })));
15613
16283
  };
15614
16284
 
@@ -15623,7 +16293,7 @@ const NewsletterUpdateButton = ({
15623
16293
  isSubmitting,
15624
16294
  isListLoading
15625
16295
  }
15626
- } = React.useContext(store$e);
16296
+ } = React.useContext(store$f);
15627
16297
  const {
15628
16298
  t
15629
16299
  } = useTranslation("newsletter");
@@ -15653,7 +16323,7 @@ const NewsletterUpdateList = () => {
15653
16323
  newsletters,
15654
16324
  isListLoading
15655
16325
  }
15656
- } = React.useContext(store$e);
16326
+ } = React.useContext(store$f);
15657
16327
 
15658
16328
  if (isListLoading) {
15659
16329
  return /*#__PURE__*/React__default['default'].createElement(Loader, {
@@ -15857,7 +16527,7 @@ function SubscriptionCreateModal({
15857
16527
  SubscriptionCreateModal.viewId = "subscription-create";
15858
16528
 
15859
16529
  var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
15860
- const initialState$d = {
16530
+ const initialState$e = {
15861
16531
  email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
15862
16532
  firstName: (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.first_name,
15863
16533
  lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
@@ -15870,10 +16540,10 @@ const initialState$d = {
15870
16540
  content: ""
15871
16541
  }
15872
16542
  };
15873
- const store$d = /*#__PURE__*/React.createContext(initialState$d);
16543
+ const store$e = /*#__PURE__*/React.createContext(initialState$e);
15874
16544
  const {
15875
- Provider: Provider$d
15876
- } = store$d;
16545
+ Provider: Provider$e
16546
+ } = store$e;
15877
16547
 
15878
16548
  const UserUpdateContainer = ({
15879
16549
  style,
@@ -16005,27 +16675,27 @@ const UserUpdateContainer = ({
16005
16675
  default:
16006
16676
  return state;
16007
16677
  }
16008
- }, initialState$d);
16678
+ }, initialState$e);
16009
16679
  return /*#__PURE__*/React__default['default'].createElement("div", {
16010
16680
  style: { ...style
16011
16681
  },
16012
16682
  className: `pelcro-container pelcro-user-update-container ${className}`
16013
- }, /*#__PURE__*/React__default['default'].createElement(Provider$d, {
16683
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$e, {
16014
16684
  value: {
16015
16685
  state,
16016
16686
  dispatch
16017
16687
  }
16018
16688
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
16019
- store: store$d,
16689
+ store: store$e,
16020
16690
  key: i
16021
16691
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
16022
- store: store$d
16692
+ store: store$e
16023
16693
  })));
16024
16694
  };
16025
16695
 
16026
16696
  const UserUpdateEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
16027
16697
  disabled: true,
16028
- store: store$d
16698
+ store: store$e
16029
16699
  }, props));
16030
16700
 
16031
16701
  const UserUpdateButton = ({
@@ -16038,7 +16708,7 @@ const UserUpdateButton = ({
16038
16708
  buttonDisabled
16039
16709
  },
16040
16710
  dispatch
16041
- } = React.useContext(store$d);
16711
+ } = React.useContext(store$e);
16042
16712
  const {
16043
16713
  t
16044
16714
  } = useTranslation("userEdit");
@@ -16055,11 +16725,11 @@ const UserUpdateButton = ({
16055
16725
  };
16056
16726
 
16057
16727
  const UserUpdateFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
16058
- store: store$d
16728
+ store: store$e
16059
16729
  }, props));
16060
16730
 
16061
16731
  const UserUpdateLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
16062
- store: store$d
16732
+ store: store$e
16063
16733
  }, props));
16064
16734
 
16065
16735
  function Phone({
@@ -16088,22 +16758,22 @@ function Phone({
16088
16758
  }
16089
16759
 
16090
16760
  const UserUpdatePhone = props => /*#__PURE__*/React__default['default'].createElement(Phone, Object.assign({
16091
- store: store$d
16761
+ store: store$e
16092
16762
  }, props));
16093
16763
 
16094
16764
  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";
16095
16765
 
16096
- var _path$h;
16766
+ var _path$j;
16097
16767
 
16098
- 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); }
16768
+ 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); }
16099
16769
 
16100
16770
  function SvgEdit(props) {
16101
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
16771
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
16102
16772
  className: "plc-w-6 plc-h-6",
16103
16773
  xmlns: "http://www.w3.org/2000/svg",
16104
16774
  viewBox: "0 0 20 20",
16105
16775
  fill: "currentColor"
16106
- }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
16776
+ }, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
16107
16777
  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"
16108
16778
  })));
16109
16779
  }
@@ -16235,16 +16905,16 @@ function DisplayName({
16235
16905
  }
16236
16906
 
16237
16907
  const UserUpdateDisplayName = props => /*#__PURE__*/React__default['default'].createElement(DisplayName, Object.assign({
16238
- store: store$d
16908
+ store: store$e
16239
16909
  }, props));
16240
16910
 
16241
16911
  const UserUpdateTextInput = props => {
16242
16912
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
16243
- store: store$d
16913
+ store: store$e
16244
16914
  }));
16245
16915
  };
16246
16916
 
16247
- const initialState$c = {
16917
+ const initialState$d = {
16248
16918
  isSubmitting: false,
16249
16919
  firstName: "",
16250
16920
  firstNameError: "",
@@ -16269,10 +16939,10 @@ const initialState$c = {
16269
16939
  content: ""
16270
16940
  }
16271
16941
  };
16272
- const store$c = /*#__PURE__*/React.createContext(initialState$c);
16942
+ const store$d = /*#__PURE__*/React.createContext(initialState$d);
16273
16943
  const {
16274
- Provider: Provider$c
16275
- } = store$c;
16944
+ Provider: Provider$d
16945
+ } = store$d;
16276
16946
 
16277
16947
  const getNewlyCreatedAddress = addresses => addresses[addresses.length - 1];
16278
16948
 
@@ -16479,7 +17149,7 @@ const AddressCreateContainer = ({
16479
17149
  default:
16480
17150
  return state;
16481
17151
  }
16482
- }, initialState$c);
17152
+ }, initialState$d);
16483
17153
  React.useEffect(() => {
16484
17154
  const getStates = () => {
16485
17155
  dispatch({
@@ -16511,16 +17181,16 @@ const AddressCreateContainer = ({
16511
17181
  style: { ...style
16512
17182
  },
16513
17183
  className: `pelcro-container pelcro-address-create-container ${className}`
16514
- }, /*#__PURE__*/React__default['default'].createElement(Provider$c, {
17184
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$d, {
16515
17185
  value: {
16516
17186
  state,
16517
17187
  dispatch
16518
17188
  }
16519
17189
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
16520
- store: store$c,
17190
+ store: store$d,
16521
17191
  key: i
16522
17192
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
16523
- store: store$c
17193
+ store: store$d
16524
17194
  })));
16525
17195
  };
16526
17196
 
@@ -16531,7 +17201,7 @@ function AddressCreateFirstName(props) {
16531
17201
  firstName,
16532
17202
  firstNameError
16533
17203
  }
16534
- } = React.useContext(store$c);
17204
+ } = React.useContext(store$d);
16535
17205
 
16536
17206
  const handleBlur = () => {
16537
17207
  return dispatch({
@@ -16574,7 +17244,7 @@ function AddressCreateLastName(props) {
16574
17244
  lastName,
16575
17245
  lastNameError
16576
17246
  }
16577
- } = React.useContext(store$c);
17247
+ } = React.useContext(store$d);
16578
17248
 
16579
17249
  const handleBlur = () => {
16580
17250
  return dispatch({
@@ -16617,7 +17287,7 @@ function AddressCreateLine1(props) {
16617
17287
  line1,
16618
17288
  line1Error
16619
17289
  }
16620
- } = React.useContext(store$c);
17290
+ } = React.useContext(store$d);
16621
17291
 
16622
17292
  const handleBlur = () => {
16623
17293
  return dispatch({
@@ -16660,7 +17330,7 @@ function AddressCreateCity(props) {
16660
17330
  city,
16661
17331
  cityError
16662
17332
  }
16663
- } = React.useContext(store$c);
17333
+ } = React.useContext(store$d);
16664
17334
 
16665
17335
  const handleBlur = () => {
16666
17336
  return dispatch({
@@ -16703,7 +17373,7 @@ function AddressCreatePostalCode(props) {
16703
17373
  postalCode,
16704
17374
  postalCodeError
16705
17375
  }
16706
- } = React.useContext(store$c);
17376
+ } = React.useContext(store$d);
16707
17377
 
16708
17378
  const handleBlur = () => {
16709
17379
  return dispatch({
@@ -16749,7 +17419,7 @@ const AddressCreateSubmit = ({
16749
17419
  state: {
16750
17420
  isSubmitting
16751
17421
  }
16752
- } = React.useContext(store$c);
17422
+ } = React.useContext(store$d);
16753
17423
  const {
16754
17424
  t
16755
17425
  } = useTranslation("address");
@@ -16860,7 +17530,7 @@ function CountrySelect({
16860
17530
  }
16861
17531
 
16862
17532
  const AddressCreateCountrySelect = props => /*#__PURE__*/React__default['default'].createElement(CountrySelect, Object.assign({
16863
- store: store$c
17533
+ store: store$d
16864
17534
  }, props));
16865
17535
 
16866
17536
  function StateSelect({
@@ -16948,7 +17618,7 @@ function StateSelect({
16948
17618
  }
16949
17619
 
16950
17620
  const AddressCreateStateSelect = props => /*#__PURE__*/React__default['default'].createElement(StateSelect, Object.assign({
16951
- store: store$c
17621
+ store: store$d
16952
17622
  }, props));
16953
17623
 
16954
17624
  const AddressCreateView = props => {
@@ -17053,18 +17723,18 @@ AddressCreateModal.viewId = "address-create";
17053
17723
 
17054
17724
  const AddressCreateTextInput = props => {
17055
17725
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
17056
- store: store$c
17726
+ store: store$d
17057
17727
  }));
17058
17728
  };
17059
17729
 
17060
17730
  const AddressCreateLine2 = props => {
17061
17731
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({
17062
17732
  fieldName: "line2",
17063
- store: store$c
17733
+ store: store$d
17064
17734
  }, props));
17065
17735
  };
17066
17736
 
17067
- const initialState$b = {
17737
+ const initialState$c = {
17068
17738
  isSubmitting: false,
17069
17739
  firstName: "",
17070
17740
  firstNameError: "",
@@ -17089,10 +17759,10 @@ const initialState$b = {
17089
17759
  content: ""
17090
17760
  }
17091
17761
  };
17092
- const store$b = /*#__PURE__*/React.createContext(initialState$b);
17762
+ const store$c = /*#__PURE__*/React.createContext(initialState$c);
17093
17763
  const {
17094
- Provider: Provider$b
17095
- } = store$b;
17764
+ Provider: Provider$c
17765
+ } = store$c;
17096
17766
 
17097
17767
  const AddressUpdateContainer = ({
17098
17768
  style,
@@ -17144,7 +17814,7 @@ const AddressUpdateContainer = ({
17144
17814
  const thisAddress = addresses[address];
17145
17815
 
17146
17816
  if (+thisAddress.id === +addressId) {
17147
- const newState = { ...initialState$b,
17817
+ const newState = { ...initialState$c,
17148
17818
  firstName: thisAddress.first_name,
17149
17819
  lastName: thisAddress.last_name,
17150
17820
  line1: thisAddress.line1,
@@ -17277,7 +17947,7 @@ const AddressUpdateContainer = ({
17277
17947
  default:
17278
17948
  return state;
17279
17949
  }
17280
- }, initialState$b);
17950
+ }, initialState$c);
17281
17951
  React.useEffect(() => {
17282
17952
  const getStates = () => {
17283
17953
  dispatch({
@@ -17309,21 +17979,21 @@ const AddressUpdateContainer = ({
17309
17979
  style: { ...style
17310
17980
  },
17311
17981
  className: `pelcro-container pelcro-address-update-container ${className}`
17312
- }, /*#__PURE__*/React__default['default'].createElement(Provider$b, {
17982
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$c, {
17313
17983
  value: {
17314
17984
  state,
17315
17985
  dispatch
17316
17986
  }
17317
17987
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
17318
- store: store$b,
17988
+ store: store$c,
17319
17989
  key: i
17320
17990
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
17321
- store: store$b
17991
+ store: store$c
17322
17992
  })));
17323
17993
  };
17324
17994
 
17325
17995
  const AddressUpdateCountrySelect = props => /*#__PURE__*/React__default['default'].createElement(CountrySelect, Object.assign({
17326
- store: store$b
17996
+ store: store$c
17327
17997
  }, props));
17328
17998
 
17329
17999
  function AddressUpdateFirstName(props) {
@@ -17333,7 +18003,7 @@ function AddressUpdateFirstName(props) {
17333
18003
  firstName,
17334
18004
  firstNameError
17335
18005
  }
17336
- } = React.useContext(store$b);
18006
+ } = React.useContext(store$c);
17337
18007
 
17338
18008
  const handleBlur = () => {
17339
18009
  return dispatch({
@@ -17376,7 +18046,7 @@ function AddressUpdateLastName(props) {
17376
18046
  lastName,
17377
18047
  lastNameError
17378
18048
  }
17379
- } = React.useContext(store$b);
18049
+ } = React.useContext(store$c);
17380
18050
 
17381
18051
  const handleBlur = () => {
17382
18052
  return dispatch({
@@ -17419,7 +18089,7 @@ function AddressUpdateLine1(props) {
17419
18089
  line1,
17420
18090
  line1Error
17421
18091
  }
17422
- } = React.useContext(store$b);
18092
+ } = React.useContext(store$c);
17423
18093
 
17424
18094
  const handleBlur = () => {
17425
18095
  return dispatch({
@@ -17459,7 +18129,7 @@ const AddressUpdateLine2 = props => {
17459
18129
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({
17460
18130
  fieldName: "line2"
17461
18131
  }, props, {
17462
- store: store$b
18132
+ store: store$c
17463
18133
  }));
17464
18134
  };
17465
18135
 
@@ -17470,7 +18140,7 @@ function AddressUpdateCity(props) {
17470
18140
  city,
17471
18141
  cityError
17472
18142
  }
17473
- } = React.useContext(store$b);
18143
+ } = React.useContext(store$c);
17474
18144
 
17475
18145
  const handleBlur = () => {
17476
18146
  return dispatch({
@@ -17513,7 +18183,7 @@ function AddressUpdatePostalCode(props) {
17513
18183
  postalCode,
17514
18184
  postalCodeError
17515
18185
  }
17516
- } = React.useContext(store$b);
18186
+ } = React.useContext(store$c);
17517
18187
 
17518
18188
  const handleBlur = () => {
17519
18189
  return dispatch({
@@ -17559,7 +18229,7 @@ const AddressUpdateSubmit = ({
17559
18229
  state: {
17560
18230
  isSubmitting
17561
18231
  }
17562
- } = React.useContext(store$b);
18232
+ } = React.useContext(store$c);
17563
18233
  const {
17564
18234
  t
17565
18235
  } = useTranslation("address");
@@ -17575,7 +18245,7 @@ const AddressUpdateSubmit = ({
17575
18245
  };
17576
18246
 
17577
18247
  const AddressUpdateStateSelect = props => /*#__PURE__*/React__default['default'].createElement(StateSelect, Object.assign({
17578
- store: store$b
18248
+ store: store$c
17579
18249
  }, props));
17580
18250
 
17581
18251
  const AddressUpdateView = props => {
@@ -17658,7 +18328,7 @@ AddressUpdateModal.viewId = "address-edit";
17658
18328
 
17659
18329
  const AddressUpdateTextInput = props => {
17660
18330
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
17661
- store: store$b
18331
+ store: store$c
17662
18332
  }));
17663
18333
  };
17664
18334
 
@@ -17741,7 +18411,7 @@ const PaymentMethodUpdateModal = props => {
17741
18411
  };
17742
18412
  PaymentMethodUpdateModal.viewId = "payment-method-update";
17743
18413
 
17744
- const initialState$a = {
18414
+ const initialState$b = {
17745
18415
  email: "",
17746
18416
  password: "",
17747
18417
  passwordError: null,
@@ -17754,10 +18424,10 @@ const initialState$a = {
17754
18424
  content: ""
17755
18425
  }
17756
18426
  };
17757
- const store$a = /*#__PURE__*/React.createContext(initialState$a);
18427
+ const store$b = /*#__PURE__*/React.createContext(initialState$b);
17758
18428
  const {
17759
- Provider: Provider$a
17760
- } = store$a;
18429
+ Provider: Provider$b
18430
+ } = store$b;
17761
18431
 
17762
18432
  const PasswordResetContainer = ({
17763
18433
  style,
@@ -17814,7 +18484,7 @@ const PasswordResetContainer = ({
17814
18484
  type: SET_EMAIL,
17815
18485
  payload: window.Pelcro.helpers.getURLParameter("email")
17816
18486
  });
17817
- initialState$a.email = window.Pelcro.helpers.getURLParameter("email");
18487
+ initialState$b.email = window.Pelcro.helpers.getURLParameter("email");
17818
18488
  dispatch({
17819
18489
  type: SET_TOKEN,
17820
18490
  payload: window.Pelcro.helpers.getURLParameter("token")
@@ -17874,26 +18544,26 @@ const PasswordResetContainer = ({
17874
18544
  default:
17875
18545
  return state;
17876
18546
  }
17877
- }, initialState$a);
18547
+ }, initialState$b);
17878
18548
  return /*#__PURE__*/React__default['default'].createElement("div", {
17879
18549
  style: { ...style
17880
18550
  },
17881
18551
  className: `pelcro-container pelcro-password-reset-container ${className}`
17882
- }, /*#__PURE__*/React__default['default'].createElement(Provider$a, {
18552
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$b, {
17883
18553
  value: {
17884
18554
  state,
17885
18555
  dispatch
17886
18556
  }
17887
18557
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
17888
- store: store$a,
18558
+ store: store$b,
17889
18559
  key: i
17890
18560
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
17891
- store: store$a
18561
+ store: store$b
17892
18562
  })));
17893
18563
  };
17894
18564
 
17895
18565
  const PasswordResetPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
17896
- store: store$a
18566
+ store: store$b
17897
18567
  }, props));
17898
18568
 
17899
18569
  const PasswordResetButton = ({
@@ -17906,7 +18576,7 @@ const PasswordResetButton = ({
17906
18576
  buttonDisabled
17907
18577
  },
17908
18578
  dispatch
17909
- } = React.useContext(store$a);
18579
+ } = React.useContext(store$b);
17910
18580
  const {
17911
18581
  t
17912
18582
  } = useTranslation("passwordReset");
@@ -17923,14 +18593,14 @@ const PasswordResetButton = ({
17923
18593
  };
17924
18594
 
17925
18595
  const PasswordResetEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
17926
- store: store$a
18596
+ store: store$b
17927
18597
  }, props, {
17928
18598
  value: window.Pelcro.helpers.getURLParameter("email"),
17929
18599
  disabled: true
17930
18600
  }));
17931
18601
 
17932
18602
  const PasswordResetConfirmPassword = props => /*#__PURE__*/React__default['default'].createElement(ConfirmPassword, Object.assign({
17933
- store: store$a
18603
+ store: store$b
17934
18604
  }, props));
17935
18605
 
17936
18606
  const PasswordResetView = props => {
@@ -17982,7 +18652,7 @@ const PasswordResetModal = ({
17982
18652
  };
17983
18653
  PasswordResetModal.viewId = "password-reset";
17984
18654
 
17985
- const initialState$9 = {
18655
+ const initialState$a = {
17986
18656
  email: "",
17987
18657
  emailError: null,
17988
18658
  buttonDisabled: false,
@@ -17991,10 +18661,10 @@ const initialState$9 = {
17991
18661
  content: ""
17992
18662
  }
17993
18663
  };
17994
- const store$9 = /*#__PURE__*/React.createContext(initialState$9);
18664
+ const store$a = /*#__PURE__*/React.createContext(initialState$a);
17995
18665
  const {
17996
- Provider: Provider$9
17997
- } = store$9;
18666
+ Provider: Provider$a
18667
+ } = store$a;
17998
18668
 
17999
18669
  const PasswordForgotContainer = ({
18000
18670
  style,
@@ -18072,21 +18742,21 @@ const PasswordForgotContainer = ({
18072
18742
  default:
18073
18743
  return state;
18074
18744
  }
18075
- }, initialState$9);
18745
+ }, initialState$a);
18076
18746
  return /*#__PURE__*/React__default['default'].createElement("div", {
18077
18747
  style: { ...style
18078
18748
  },
18079
18749
  className: `pelcro-container pelcro-password-forgot-container ${className}`
18080
- }, /*#__PURE__*/React__default['default'].createElement(Provider$9, {
18750
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$a, {
18081
18751
  value: {
18082
18752
  state,
18083
18753
  dispatch
18084
18754
  }
18085
18755
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
18086
- store: store$9,
18756
+ store: store$a,
18087
18757
  key: i
18088
18758
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
18089
- store: store$9
18759
+ store: store$a
18090
18760
  })));
18091
18761
  };
18092
18762
 
@@ -18102,7 +18772,7 @@ const PasswordForgotButton = ({
18102
18772
  emailError
18103
18773
  },
18104
18774
  dispatch
18105
- } = React.useContext(store$9);
18775
+ } = React.useContext(store$a);
18106
18776
  const {
18107
18777
  t
18108
18778
  } = useTranslation("passwordForgot");
@@ -18123,7 +18793,7 @@ const PasswordForgotButton = ({
18123
18793
  };
18124
18794
 
18125
18795
  const PasswordForgotEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
18126
- store: store$9
18796
+ store: store$a
18127
18797
  }, props));
18128
18798
 
18129
18799
  const PasswordForgotView = props => {
@@ -18173,7 +18843,7 @@ const PasswordForgotModal = ({
18173
18843
  };
18174
18844
  PasswordForgotModal.viewId = "password-forgot";
18175
18845
 
18176
- const initialState$8 = {
18846
+ const initialState$9 = {
18177
18847
  currentPassword: "",
18178
18848
  newPassword: "",
18179
18849
  confirmNewPassword: "",
@@ -18187,10 +18857,10 @@ const initialState$8 = {
18187
18857
  content: ""
18188
18858
  }
18189
18859
  };
18190
- const store$8 = /*#__PURE__*/React.createContext(initialState$8);
18860
+ const store$9 = /*#__PURE__*/React.createContext(initialState$9);
18191
18861
  const {
18192
- Provider: Provider$8
18193
- } = store$8;
18862
+ Provider: Provider$9
18863
+ } = store$9;
18194
18864
  const PasswordChangeContainer = ({
18195
18865
  style,
18196
18866
  className = "",
@@ -18342,21 +19012,21 @@ const PasswordChangeContainer = ({
18342
19012
  default:
18343
19013
  return state;
18344
19014
  }
18345
- }, initialState$8);
19015
+ }, initialState$9);
18346
19016
  return /*#__PURE__*/React__default['default'].createElement("div", {
18347
19017
  style: { ...style
18348
19018
  },
18349
19019
  className: `pelcro-container pelcro-password-change-container ${className}`
18350
- }, /*#__PURE__*/React__default['default'].createElement(Provider$8, {
19020
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$9, {
18351
19021
  value: {
18352
19022
  state,
18353
19023
  dispatch
18354
19024
  }
18355
19025
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
18356
- store: store$8,
19026
+ store: store$9,
18357
19027
  key: i
18358
19028
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
18359
- store: store$8
19029
+ store: store$9
18360
19030
  })));
18361
19031
  };
18362
19032
 
@@ -18367,7 +19037,7 @@ function PasswordChangeCurrentPassword(props) {
18367
19037
  currentPassword,
18368
19038
  currentPasswordError
18369
19039
  }
18370
- } = React.useContext(store$8);
19040
+ } = React.useContext(store$9);
18371
19041
  const handleBlur = React.useCallback(() => {
18372
19042
  return dispatch({
18373
19043
  type: VALIDATE_PASSWORD
@@ -18401,7 +19071,7 @@ function PasswordChangeNewPassword(props) {
18401
19071
  newPassword,
18402
19072
  newPasswordError
18403
19073
  }
18404
- } = React.useContext(store$8);
19074
+ } = React.useContext(store$9);
18405
19075
  const handleBlur = React.useCallback(() => {
18406
19076
  return dispatch({
18407
19077
  type: VALIDATE_NEW_PASSWORD
@@ -18435,7 +19105,7 @@ function PasswordChangeConfirmNewPassword(props) {
18435
19105
  confirmNewPassword,
18436
19106
  confirmNewPasswordError
18437
19107
  }
18438
- } = React.useContext(store$8);
19108
+ } = React.useContext(store$9);
18439
19109
  const handleBlur = React.useCallback(() => {
18440
19110
  return dispatch({
18441
19111
  type: VALIDATE_CONFIRM_NEW_PASSWORD
@@ -18476,7 +19146,7 @@ const PasswordChangeButton = ({
18476
19146
  confirmNewPasswordError
18477
19147
  },
18478
19148
  dispatch
18479
- } = React.useContext(store$8);
19149
+ } = React.useContext(store$9);
18480
19150
  const {
18481
19151
  t
18482
19152
  } = useTranslation("passwordChange");
@@ -18542,17 +19212,17 @@ const PasswordChangeModal = ({
18542
19212
  };
18543
19213
  PasswordChangeModal.viewId = "password-change";
18544
19214
 
18545
- const initialState$7 = {
19215
+ const initialState$8 = {
18546
19216
  buttonDisabled: false,
18547
19217
  alert: {
18548
19218
  type: "error",
18549
19219
  content: ""
18550
19220
  }
18551
19221
  };
18552
- const store$7 = /*#__PURE__*/React.createContext(initialState$7);
19222
+ const store$8 = /*#__PURE__*/React.createContext(initialState$8);
18553
19223
  const {
18554
- Provider: Provider$7
18555
- } = store$7;
19224
+ Provider: Provider$8
19225
+ } = store$8;
18556
19226
 
18557
19227
  const CartContainer = ({
18558
19228
  style,
@@ -18643,21 +19313,21 @@ const CartContainer = ({
18643
19313
  default:
18644
19314
  return state;
18645
19315
  }
18646
- }, initialState$7);
19316
+ }, initialState$8);
18647
19317
  return /*#__PURE__*/React__default['default'].createElement("div", {
18648
19318
  style: { ...style
18649
19319
  },
18650
19320
  className: `pelcro-container pelcro-cart-container ${className}`
18651
- }, /*#__PURE__*/React__default['default'].createElement(Provider$7, {
19321
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$8, {
18652
19322
  value: {
18653
19323
  state,
18654
19324
  dispatch
18655
19325
  }
18656
19326
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
18657
- store: store$7,
19327
+ store: store$8,
18658
19328
  key: i
18659
19329
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
18660
- store: store$7
19330
+ store: store$8
18661
19331
  })));
18662
19332
  };
18663
19333
 
@@ -18694,7 +19364,7 @@ const CartSubmit = ({
18694
19364
  buttonDisabled
18695
19365
  },
18696
19366
  dispatch
18697
- } = React.useContext(store$7);
19367
+ } = React.useContext(store$8);
18698
19368
  const {
18699
19369
  t
18700
19370
  } = useTranslation("cart");
@@ -18725,7 +19395,7 @@ const CartTotalPrice = () => {
18725
19395
  state: {
18726
19396
  alert
18727
19397
  }
18728
- } = React.useContext(store$7);
19398
+ } = React.useContext(store$8);
18729
19399
  const {
18730
19400
  cartItems
18731
19401
  } = usePelcro();
@@ -19038,7 +19708,7 @@ const OrderConfirmModal = props => {
19038
19708
  };
19039
19709
  OrderConfirmModal.viewId = "order-confirm";
19040
19710
 
19041
- const initialState$6 = {
19711
+ const initialState$7 = {
19042
19712
  email: "",
19043
19713
  firstName: "",
19044
19714
  lastName: "",
@@ -19050,10 +19720,10 @@ const initialState$6 = {
19050
19720
  content: ""
19051
19721
  }
19052
19722
  };
19053
- const store$6 = /*#__PURE__*/React.createContext(initialState$6);
19723
+ const store$7 = /*#__PURE__*/React.createContext(initialState$7);
19054
19724
  const {
19055
- Provider: Provider$6
19056
- } = store$6;
19725
+ Provider: Provider$7
19726
+ } = store$7;
19057
19727
 
19058
19728
  const GiftCreateContainer = ({
19059
19729
  style,
@@ -19157,21 +19827,21 @@ const GiftCreateContainer = ({
19157
19827
  default:
19158
19828
  return state;
19159
19829
  }
19160
- }, initialState$6);
19830
+ }, initialState$7);
19161
19831
  return /*#__PURE__*/React__default['default'].createElement("div", {
19162
19832
  style: { ...style
19163
19833
  },
19164
19834
  className: `pelcro-container pelcro-gift-create-container ${className}`
19165
- }, /*#__PURE__*/React__default['default'].createElement(Provider$6, {
19835
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$7, {
19166
19836
  value: {
19167
19837
  state,
19168
19838
  dispatch
19169
19839
  }
19170
19840
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
19171
- store: store$6,
19841
+ store: store$7,
19172
19842
  key: i
19173
19843
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
19174
- store: store$6
19844
+ store: store$7
19175
19845
  })));
19176
19846
  };
19177
19847
 
@@ -19185,7 +19855,7 @@ const GiftCreateSubmitButton = ({
19185
19855
  state: {
19186
19856
  disableSubmit
19187
19857
  }
19188
- } = React.useContext(store$6);
19858
+ } = React.useContext(store$7);
19189
19859
  const {
19190
19860
  t
19191
19861
  } = useTranslation("register");
@@ -19202,29 +19872,29 @@ const GiftCreateSubmitButton = ({
19202
19872
 
19203
19873
  const GiftCreateEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
19204
19874
  initWithUserEmail: false,
19205
- store: store$6
19875
+ store: store$7
19206
19876
  }, props));
19207
19877
 
19208
19878
  const GiftCreateFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
19209
- store: store$6
19879
+ store: store$7
19210
19880
  }, props));
19211
19881
 
19212
19882
  const GiftCreateLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
19213
- store: store$6
19883
+ store: store$7
19214
19884
  }, props));
19215
19885
 
19216
- var _path$g;
19886
+ var _path$i;
19217
19887
 
19218
- 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); }
19888
+ 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); }
19219
19889
 
19220
19890
  function SvgInfoCircle(props) {
19221
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
19891
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
19222
19892
  xmlns: "http://www.w3.org/2000/svg",
19223
19893
  className: "plc-w-5 plc-h-5",
19224
19894
  fill: "none",
19225
19895
  viewBox: "0 0 24 24",
19226
19896
  stroke: "currentColor"
19227
- }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
19897
+ }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
19228
19898
  strokeLinecap: "round",
19229
19899
  strokeLinejoin: "round",
19230
19900
  strokeWidth: 2,
@@ -19295,7 +19965,7 @@ const GiftCreateStartDate = props => {
19295
19965
  const {
19296
19966
  dispatch,
19297
19967
  state
19298
- } = React.useContext(store$6);
19968
+ } = React.useContext(store$7);
19299
19969
 
19300
19970
  const handleInputChange = value => {
19301
19971
  dispatch({
@@ -19368,7 +20038,7 @@ function GiftCreateMessage(props) {
19368
20038
  const {
19369
20039
  dispatch,
19370
20040
  state
19371
- } = React.useContext(store$6);
20041
+ } = React.useContext(store$7);
19372
20042
  const MAX_CHARS_COUNT = 200;
19373
20043
  const remainingCharsCount = (_ref = MAX_CHARS_COUNT - ((_state$giftMessage = state.giftMessage) === null || _state$giftMessage === void 0 ? void 0 : _state$giftMessage.length)) !== null && _ref !== void 0 ? _ref : 0;
19374
20044
 
@@ -19492,7 +20162,7 @@ const GiftCreateModal = ({
19492
20162
  };
19493
20163
  GiftCreateModal.viewId = "gift-create";
19494
20164
 
19495
- const initialState$5 = {
20165
+ const initialState$6 = {
19496
20166
  giftCode: "",
19497
20167
  buttonDisabled: true,
19498
20168
  alert: {
@@ -19500,10 +20170,10 @@ const initialState$5 = {
19500
20170
  content: ""
19501
20171
  }
19502
20172
  };
19503
- const store$5 = /*#__PURE__*/React.createContext(initialState$5);
20173
+ const store$6 = /*#__PURE__*/React.createContext(initialState$6);
19504
20174
  const {
19505
- Provider: Provider$5
19506
- } = store$5;
20175
+ Provider: Provider$6
20176
+ } = store$6;
19507
20177
 
19508
20178
  const GiftRedeemContainer = ({
19509
20179
  style,
@@ -19568,21 +20238,21 @@ const GiftRedeemContainer = ({
19568
20238
  default:
19569
20239
  return state;
19570
20240
  }
19571
- }, initialState$5);
20241
+ }, initialState$6);
19572
20242
  return /*#__PURE__*/React__default['default'].createElement("div", {
19573
20243
  style: { ...style
19574
20244
  },
19575
20245
  className: `pelcro-container pelcro-gift-redeem-container ${className}`
19576
- }, /*#__PURE__*/React__default['default'].createElement(Provider$5, {
20246
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$6, {
19577
20247
  value: {
19578
20248
  state,
19579
20249
  dispatch
19580
20250
  }
19581
20251
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
19582
- store: store$5,
20252
+ store: store$6,
19583
20253
  key: i
19584
20254
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
19585
- store: store$5
20255
+ store: store$6
19586
20256
  })));
19587
20257
  };
19588
20258
 
@@ -19619,7 +20289,7 @@ function GiftCode({
19619
20289
  }
19620
20290
 
19621
20291
  const GiftRedeemCode = props => /*#__PURE__*/React__default['default'].createElement(GiftCode, Object.assign({
19622
- store: store$5
20292
+ store: store$6
19623
20293
  }, props));
19624
20294
 
19625
20295
  const GiftRedeemSubmitButton = ({
@@ -19632,7 +20302,7 @@ const GiftRedeemSubmitButton = ({
19632
20302
  state: {
19633
20303
  disableSubmit
19634
20304
  }
19635
- } = React.useContext(store$5);
20305
+ } = React.useContext(store$6);
19636
20306
  const {
19637
20307
  t
19638
20308
  } = useTranslation("register");
@@ -19725,7 +20395,7 @@ const moveDefaultAddressToStart = addresses => {
19725
20395
  return [defaultAddress, ...addressesWithoutDefault];
19726
20396
  };
19727
20397
 
19728
- const initialState$4 = {
20398
+ const initialState$5 = {
19729
20399
  addresses: [],
19730
20400
  selectedAddressId: null,
19731
20401
  isSubmitting: false,
@@ -19734,10 +20404,10 @@ const initialState$4 = {
19734
20404
  content: ""
19735
20405
  }
19736
20406
  };
19737
- const store$4 = /*#__PURE__*/React.createContext(initialState$4);
20407
+ const store$5 = /*#__PURE__*/React.createContext(initialState$5);
19738
20408
  const {
19739
- Provider: Provider$4
19740
- } = store$4;
20409
+ Provider: Provider$5
20410
+ } = store$5;
19741
20411
 
19742
20412
  const AddressSelectContainer = ({
19743
20413
  style,
@@ -19832,7 +20502,7 @@ const AddressSelectContainer = ({
19832
20502
  default:
19833
20503
  return state;
19834
20504
  }
19835
- }, initialState$4);
20505
+ }, initialState$5);
19836
20506
  React.useEffect(() => {
19837
20507
  var _window$Pelcro$user$r;
19838
20508
 
@@ -19845,16 +20515,16 @@ const AddressSelectContainer = ({
19845
20515
  style: { ...style
19846
20516
  },
19847
20517
  className: `pelcro-container pelcro-address-select-container ${className}`
19848
- }, /*#__PURE__*/React__default['default'].createElement(Provider$4, {
20518
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$5, {
19849
20519
  value: {
19850
20520
  state,
19851
20521
  dispatch
19852
20522
  }
19853
20523
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
19854
- store: store$4,
20524
+ store: store$5,
19855
20525
  key: i
19856
20526
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
19857
- store: store$4
20527
+ store: store$5
19858
20528
  })));
19859
20529
  };
19860
20530
 
@@ -19865,7 +20535,7 @@ const AddressSelectList = () => {
19865
20535
  addresses,
19866
20536
  selectedAddressId
19867
20537
  }
19868
- } = React.useContext(store$4);
20538
+ } = React.useContext(store$5);
19869
20539
 
19870
20540
  const handleAddressSelect = event => {
19871
20541
  dispatch({
@@ -19909,7 +20579,7 @@ const AddressSelectSubmit = ({
19909
20579
  selectedAddressId,
19910
20580
  isSubmitting
19911
20581
  }
19912
- } = React.useContext(store$4);
20582
+ } = React.useContext(store$5);
19913
20583
  const {
19914
20584
  t
19915
20585
  } = useTranslation("address");
@@ -20005,7 +20675,7 @@ const moveDefaultPaymentMethodToStart = paymentMethods => {
20005
20675
  return [defaultPaymentMethod, ...paymentMethodsWithoutDefault];
20006
20676
  };
20007
20677
 
20008
- const initialState$3 = {
20678
+ const initialState$4 = {
20009
20679
  paymentMethods: [],
20010
20680
  selectedPaymentMethodId: null,
20011
20681
  isSubmitting: false,
@@ -20014,10 +20684,10 @@ const initialState$3 = {
20014
20684
  content: ""
20015
20685
  }
20016
20686
  };
20017
- const store$3 = /*#__PURE__*/React.createContext(initialState$3);
20687
+ const store$4 = /*#__PURE__*/React.createContext(initialState$4);
20018
20688
  const {
20019
- Provider: Provider$3
20020
- } = store$3;
20689
+ Provider: Provider$4
20690
+ } = store$4;
20021
20691
 
20022
20692
  const PaymentMethodSelectContainer = ({
20023
20693
  style,
@@ -20076,7 +20746,7 @@ const PaymentMethodSelectContainer = ({
20076
20746
  default:
20077
20747
  return state;
20078
20748
  }
20079
- }, initialState$3);
20749
+ }, initialState$4);
20080
20750
  React.useEffect(() => {
20081
20751
  var _window$Pelcro$user$r3;
20082
20752
 
@@ -20089,16 +20759,16 @@ const PaymentMethodSelectContainer = ({
20089
20759
  style: { ...style
20090
20760
  },
20091
20761
  className: `pelcro-container pelcro-payment-select-container ${className}`
20092
- }, /*#__PURE__*/React__default['default'].createElement(Provider$3, {
20762
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$4, {
20093
20763
  value: {
20094
20764
  state,
20095
20765
  dispatch
20096
20766
  }
20097
20767
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
20098
- store: store$3,
20768
+ store: store$4,
20099
20769
  key: i
20100
20770
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
20101
- store: store$3
20771
+ store: store$4
20102
20772
  })));
20103
20773
  };
20104
20774
 
@@ -20112,7 +20782,7 @@ const PaymentMethodSelectList = () => {
20112
20782
  paymentMethods,
20113
20783
  selectedPaymentMethodId
20114
20784
  }
20115
- } = React.useContext(store$3);
20785
+ } = React.useContext(store$4);
20116
20786
 
20117
20787
  const handlePaymentMethodSelect = event => {
20118
20788
  dispatch({
@@ -20162,7 +20832,7 @@ const PaymentMethodSelectSubmit = ({
20162
20832
  selectedPaymentMethodId,
20163
20833
  isSubmitting
20164
20834
  }
20165
- } = React.useContext(store$3);
20835
+ } = React.useContext(store$4);
20166
20836
  return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
20167
20837
  onClick: () => {
20168
20838
  dispatch({
@@ -20236,8 +20906,8 @@ const PaymentMethodSelectModal = ({
20236
20906
  };
20237
20907
  PaymentMethodSelectModal.viewId = "payment-method-select";
20238
20908
 
20239
- function _extends$h() {
20240
- _extends$h = Object.assign || function (target) {
20909
+ function _extends$j() {
20910
+ _extends$j = Object.assign || function (target) {
20241
20911
  for (var i = 1; i < arguments.length; i++) {
20242
20912
  var source = arguments[i];
20243
20913
 
@@ -20251,7 +20921,7 @@ function _extends$h() {
20251
20921
  return target;
20252
20922
  };
20253
20923
 
20254
- return _extends$h.apply(this, arguments);
20924
+ return _extends$j.apply(this, arguments);
20255
20925
  }
20256
20926
 
20257
20927
  function _objectWithoutPropertiesLoose(source, excluded) {
@@ -20435,7 +21105,7 @@ function render(props, propsBag, defaultTag, features, visible) {
20435
21105
  return match(strategy, (_match = {}, _match[RenderStrategy.Unmount] = function () {
20436
21106
  return null;
20437
21107
  }, _match[RenderStrategy.Hidden] = function () {
20438
- return _render(_extends$h({}, _rest, {
21108
+ return _render(_extends$j({}, _rest, {
20439
21109
  hidden: true,
20440
21110
  style: {
20441
21111
  display: 'none'
@@ -20963,7 +21633,7 @@ function TransitionChild(props) {
20963
21633
  var passthroughProps = rest;
20964
21634
  return React__default['default'].createElement(NestingContext.Provider, {
20965
21635
  value: nesting
20966
- }, render(_extends$h({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
21636
+ }, render(_extends$j({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
20967
21637
  }
20968
21638
 
20969
21639
  function Transition(props) {
@@ -21007,7 +21677,7 @@ function Transition(props) {
21007
21677
  value: nestingBag
21008
21678
  }, React__default['default'].createElement(TransitionContext.Provider, {
21009
21679
  value: transitionBag
21010
- }, render(_extends$h({}, sharedProps, {
21680
+ }, render(_extends$j({}, sharedProps, {
21011
21681
  as: React.Fragment,
21012
21682
  children: React__default['default'].createElement(TransitionChild, Object.assign({}, sharedProps, passthroughProps))
21013
21683
  }), propsBag, React.Fragment, TransitionChildRenderFeatures, state === TreeStates.Visible)));
@@ -21134,12 +21804,12 @@ var ActionTypes;
21134
21804
  })(ActionTypes || (ActionTypes = {}));
21135
21805
 
21136
21806
  (_reducers = {}, _reducers[ActionTypes.CloseMenu] = function (state) {
21137
- return _extends$h({}, state, {
21807
+ return _extends$j({}, state, {
21138
21808
  activeItemIndex: null,
21139
21809
  menuState: MenuStates.Closed
21140
21810
  });
21141
21811
  }, _reducers[ActionTypes.OpenMenu] = function (state) {
21142
- return _extends$h({}, state, {
21812
+ return _extends$j({}, state, {
21143
21813
  menuState: MenuStates.Open
21144
21814
  });
21145
21815
  }, _reducers[ActionTypes.GoToItem] = function (state, action) {
@@ -21158,7 +21828,7 @@ var ActionTypes;
21158
21828
  }
21159
21829
  });
21160
21830
  if (state.searchQuery === '' && state.activeItemIndex === activeItemIndex) return state;
21161
- return _extends$h({}, state, {
21831
+ return _extends$j({}, state, {
21162
21832
  searchQuery: '',
21163
21833
  activeItemIndex: activeItemIndex
21164
21834
  });
@@ -21169,19 +21839,19 @@ var ActionTypes;
21169
21839
 
21170
21840
  return ((_item$dataRef$current = item.dataRef.current.textValue) == null ? void 0 : _item$dataRef$current.startsWith(searchQuery)) && !item.dataRef.current.disabled;
21171
21841
  });
21172
- if (match === -1 || match === state.activeItemIndex) return _extends$h({}, state, {
21842
+ if (match === -1 || match === state.activeItemIndex) return _extends$j({}, state, {
21173
21843
  searchQuery: searchQuery
21174
21844
  });
21175
- return _extends$h({}, state, {
21845
+ return _extends$j({}, state, {
21176
21846
  searchQuery: searchQuery,
21177
21847
  activeItemIndex: match
21178
21848
  });
21179
21849
  }, _reducers[ActionTypes.ClearSearch] = function (state) {
21180
- return _extends$h({}, state, {
21850
+ return _extends$j({}, state, {
21181
21851
  searchQuery: ''
21182
21852
  });
21183
21853
  }, _reducers[ActionTypes.RegisterItem] = function (state, action) {
21184
- return _extends$h({}, state, {
21854
+ return _extends$j({}, state, {
21185
21855
  items: [].concat(state.items, [{
21186
21856
  id: action.id,
21187
21857
  dataRef: action.dataRef
@@ -21194,7 +21864,7 @@ var ActionTypes;
21194
21864
  return a.id === action.id;
21195
21865
  });
21196
21866
  if (idx !== -1) nextItems.splice(idx, 1);
21197
- return _extends$h({}, state, {
21867
+ return _extends$j({}, state, {
21198
21868
  items: nextItems,
21199
21869
  activeItemIndex: function () {
21200
21870
  if (idx === state.activeItemIndex) return null;
@@ -21233,19 +21903,19 @@ var ActionTypes$1;
21233
21903
  (_reducers$1 = {}, _reducers$1[ActionTypes$1.CloseListbox] = function (state) {
21234
21904
  if (state.disabled) return state;
21235
21905
  if (state.listboxState === ListboxStates.Closed) return state;
21236
- return _extends$h({}, state, {
21906
+ return _extends$j({}, state, {
21237
21907
  activeOptionIndex: null,
21238
21908
  listboxState: ListboxStates.Closed
21239
21909
  });
21240
21910
  }, _reducers$1[ActionTypes$1.OpenListbox] = function (state) {
21241
21911
  if (state.disabled) return state;
21242
21912
  if (state.listboxState === ListboxStates.Open) return state;
21243
- return _extends$h({}, state, {
21913
+ return _extends$j({}, state, {
21244
21914
  listboxState: ListboxStates.Open
21245
21915
  });
21246
21916
  }, _reducers$1[ActionTypes$1.SetDisabled] = function (state, action) {
21247
21917
  if (state.disabled === action.disabled) return state;
21248
- return _extends$h({}, state, {
21918
+ return _extends$j({}, state, {
21249
21919
  disabled: action.disabled
21250
21920
  });
21251
21921
  }, _reducers$1[ActionTypes$1.GoToOption] = function (state, action) {
@@ -21266,7 +21936,7 @@ var ActionTypes$1;
21266
21936
  }
21267
21937
  });
21268
21938
  if (state.searchQuery === '' && state.activeOptionIndex === activeOptionIndex) return state;
21269
- return _extends$h({}, state, {
21939
+ return _extends$j({}, state, {
21270
21940
  searchQuery: '',
21271
21941
  activeOptionIndex: activeOptionIndex
21272
21942
  });
@@ -21279,10 +21949,10 @@ var ActionTypes$1;
21279
21949
 
21280
21950
  return !option.dataRef.current.disabled && ((_option$dataRef$curre = option.dataRef.current.textValue) == null ? void 0 : _option$dataRef$curre.startsWith(searchQuery));
21281
21951
  });
21282
- if (match === -1 || match === state.activeOptionIndex) return _extends$h({}, state, {
21952
+ if (match === -1 || match === state.activeOptionIndex) return _extends$j({}, state, {
21283
21953
  searchQuery: searchQuery
21284
21954
  });
21285
- return _extends$h({}, state, {
21955
+ return _extends$j({}, state, {
21286
21956
  searchQuery: searchQuery,
21287
21957
  activeOptionIndex: match
21288
21958
  });
@@ -21290,11 +21960,11 @@ var ActionTypes$1;
21290
21960
  if (state.disabled) return state;
21291
21961
  if (state.listboxState === ListboxStates.Closed) return state;
21292
21962
  if (state.searchQuery === '') return state;
21293
- return _extends$h({}, state, {
21963
+ return _extends$j({}, state, {
21294
21964
  searchQuery: ''
21295
21965
  });
21296
21966
  }, _reducers$1[ActionTypes$1.RegisterOption] = function (state, action) {
21297
- return _extends$h({}, state, {
21967
+ return _extends$j({}, state, {
21298
21968
  options: [].concat(state.options, [{
21299
21969
  id: action.id,
21300
21970
  dataRef: action.dataRef
@@ -21307,7 +21977,7 @@ var ActionTypes$1;
21307
21977
  return a.id === action.id;
21308
21978
  });
21309
21979
  if (idx !== -1) nextOptions.splice(idx, 1);
21310
- return _extends$h({}, state, {
21980
+ return _extends$j({}, state, {
21311
21981
  options: nextOptions,
21312
21982
  activeOptionIndex: function () {
21313
21983
  if (idx === state.activeOptionIndex) return null;
@@ -21368,18 +22038,18 @@ const getPaymentCardIcon = name => {
21368
22038
  }));
21369
22039
  };
21370
22040
 
21371
- var _path$f;
22041
+ var _path$h;
21372
22042
 
21373
- 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); }
22043
+ 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); }
21374
22044
 
21375
22045
  function SvgChevronRight(props) {
21376
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
22046
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
21377
22047
  className: "plc-w-6 plc-h-6",
21378
22048
  xmlns: "http://www.w3.org/2000/svg",
21379
22049
  fill: "none",
21380
22050
  viewBox: "0 0 24 24",
21381
22051
  stroke: "currentColor"
21382
- }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
22052
+ }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
21383
22053
  strokeLinecap: "round",
21384
22054
  strokeLinejoin: "round",
21385
22055
  strokeWidth: 2,
@@ -21595,18 +22265,18 @@ const SavedItems = ({
21595
22265
  });
21596
22266
  };
21597
22267
 
21598
- var _path$e;
22268
+ var _path$g;
21599
22269
 
21600
- 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); }
22270
+ 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); }
21601
22271
 
21602
22272
  function SvgRefresh(props) {
21603
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
22273
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
21604
22274
  className: "plc-w-4 plc-h-4 plc-mr-1",
21605
22275
  xmlns: "http://www.w3.org/2000/svg",
21606
22276
  fill: "none",
21607
22277
  viewBox: "0 0 24 24",
21608
22278
  stroke: "currentColor"
21609
- }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
22279
+ }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
21610
22280
  strokeLinecap: "round",
21611
22281
  strokeLinejoin: "round",
21612
22282
  strokeWidth: 2,
@@ -21614,35 +22284,35 @@ function SvgRefresh(props) {
21614
22284
  })));
21615
22285
  }
21616
22286
 
21617
- var _path$d;
22287
+ var _path$f;
21618
22288
 
21619
- 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); }
22289
+ 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); }
21620
22290
 
21621
22291
  function SvgCalendar(props) {
21622
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
22292
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
21623
22293
  xmlns: "http://www.w3.org/2000/svg",
21624
22294
  className: "plc-h-4 plc-w-4 plc-mr-1",
21625
22295
  viewBox: "0 0 20 20",
21626
22296
  fill: "currentColor"
21627
- }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
22297
+ }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
21628
22298
  fillRule: "evenodd",
21629
22299
  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",
21630
22300
  clipRule: "evenodd"
21631
22301
  })));
21632
22302
  }
21633
22303
 
21634
- var _path$c;
22304
+ var _path$e;
21635
22305
 
21636
- 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); }
22306
+ 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); }
21637
22307
 
21638
22308
  function SvgPlus(props) {
21639
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
22309
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
21640
22310
  className: "plc-w-5 plc-h-5",
21641
22311
  xmlns: "http://www.w3.org/2000/svg",
21642
22312
  fill: "none",
21643
22313
  viewBox: "0 0 24 24",
21644
22314
  stroke: "currentColor"
21645
- }, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
22315
+ }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
21646
22316
  strokeLinecap: "round",
21647
22317
  strokeLinejoin: "round",
21648
22318
  strokeWidth: 2,
@@ -21650,17 +22320,17 @@ function SvgPlus(props) {
21650
22320
  })));
21651
22321
  }
21652
22322
 
21653
- var _path$b;
22323
+ var _path$d;
21654
22324
 
21655
- 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); }
22325
+ 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); }
21656
22326
 
21657
22327
  function SvgCheckMark(props) {
21658
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
22328
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
21659
22329
  className: "plc-w-4 plc-h-4 plc-mr-1",
21660
22330
  xmlns: "http://www.w3.org/2000/svg",
21661
22331
  viewBox: "0 0 20 20",
21662
22332
  fill: "currentColor"
21663
- }, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
22333
+ }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
21664
22334
  fillRule: "evenodd",
21665
22335
  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",
21666
22336
  clipRule: "evenodd"
@@ -21724,7 +22394,8 @@ const SubscriptionsItems = ({
21724
22394
  } = useTranslation("dashboard");
21725
22395
  const {
21726
22396
  switchView,
21727
- isAuthenticated
22397
+ switchToAddressView,
22398
+ switchToPaymentView
21728
22399
  } = usePelcro();
21729
22400
  const subs = getNonDonationSubs();
21730
22401
  if (subs.length === 0) return null;
@@ -21766,7 +22437,12 @@ const SubscriptionsItems = ({
21766
22437
  const plan = window.Pelcro.plan.getById(plan_id);
21767
22438
  setProductAndPlan(product, plan);
21768
22439
  setSubscriptionIdToRenew(sub.id);
21769
- setView("plan-select");
22440
+
22441
+ if (product.address_required) {
22442
+ return switchToAddressView();
22443
+ }
22444
+
22445
+ return switchToPaymentView();
21770
22446
  };
21771
22447
 
21772
22448
  const getPhases = () => {
@@ -21955,18 +22631,18 @@ Accordion.item = function AccordionItem({
21955
22631
  }, content)) : null;
21956
22632
  };
21957
22633
 
21958
- var _path$a;
22634
+ var _path$c;
21959
22635
 
21960
- 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); }
22636
+ 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); }
21961
22637
 
21962
22638
  function SvgExit(props) {
21963
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
22639
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
21964
22640
  className: "plc-w-6 plc-h-6",
21965
22641
  xmlns: "http://www.w3.org/2000/svg",
21966
22642
  fill: "none",
21967
22643
  viewBox: "0 0 24 24",
21968
22644
  stroke: "currentColor"
21969
- }, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
22645
+ }, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
21970
22646
  strokeLinecap: "round",
21971
22647
  strokeLinejoin: "round",
21972
22648
  strokeWidth: 2,
@@ -21974,17 +22650,17 @@ function SvgExit(props) {
21974
22650
  })));
21975
22651
  }
21976
22652
 
21977
- var _path$9;
22653
+ var _path$b;
21978
22654
 
21979
- 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); }
22655
+ 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); }
21980
22656
 
21981
22657
  function SvgUser(props) {
21982
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
22658
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
21983
22659
  xmlns: "http://www.w3.org/2000/svg",
21984
22660
  fill: "none",
21985
22661
  viewBox: "0 0 24 24",
21986
22662
  stroke: "currentColor"
21987
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
22663
+ }, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
21988
22664
  strokeLinecap: "round",
21989
22665
  strokeLinejoin: "round",
21990
22666
  strokeWidth: 2,
@@ -21992,18 +22668,18 @@ function SvgUser(props) {
21992
22668
  })));
21993
22669
  }
21994
22670
 
21995
- var _path$8;
22671
+ var _path$a;
21996
22672
 
21997
- 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); }
22673
+ 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); }
21998
22674
 
21999
22675
  function SvgNewsletter(props) {
22000
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
22676
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
22001
22677
  xmlns: "http://www.w3.org/2000/svg",
22002
22678
  className: "plc-h-5 plc-w-5",
22003
22679
  fill: "none",
22004
22680
  viewBox: "0 0 24 24",
22005
22681
  stroke: "currentColor"
22006
- }, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
22682
+ }, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
22007
22683
  strokeLinecap: "round",
22008
22684
  strokeLinejoin: "round",
22009
22685
  strokeWidth: 2,
@@ -22011,18 +22687,37 @@ function SvgNewsletter(props) {
22011
22687
  })));
22012
22688
  }
22013
22689
 
22014
- var _path$7;
22690
+ var _path$9;
22691
+
22692
+ 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); }
22015
22693
 
22016
- 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); }
22694
+ function SvgDocument(props) {
22695
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
22696
+ xmlns: "http://www.w3.org/2000/svg",
22697
+ className: "plc-h-6 plc-w-6 plc-mr-2",
22698
+ fill: "none",
22699
+ viewBox: "0 0 24 24",
22700
+ stroke: "currentColor"
22701
+ }, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
22702
+ strokeLinecap: "round",
22703
+ strokeLinejoin: "round",
22704
+ strokeWidth: 2,
22705
+ 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"
22706
+ })));
22707
+ }
22708
+
22709
+ var _path$8;
22710
+
22711
+ 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); }
22017
22712
 
22018
22713
  function SvgPaymentCard(props) {
22019
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
22714
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
22020
22715
  className: "plc-w-6 plc-h-6 plc-mr-2",
22021
22716
  xmlns: "http://www.w3.org/2000/svg",
22022
22717
  fill: "none",
22023
22718
  viewBox: "0 0 24 24",
22024
22719
  stroke: "currentColor"
22025
- }, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
22720
+ }, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
22026
22721
  strokeLinecap: "round",
22027
22722
  strokeLinejoin: "round",
22028
22723
  strokeWidth: 2,
@@ -22030,18 +22725,18 @@ function SvgPaymentCard(props) {
22030
22725
  })));
22031
22726
  }
22032
22727
 
22033
- var _path$6, _path2$1;
22728
+ var _path$7, _path2$1;
22034
22729
 
22035
- 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); }
22730
+ 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); }
22036
22731
 
22037
22732
  function SvgLocationPin(props) {
22038
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
22733
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
22039
22734
  className: "plc-w-6 plc-h-6 plc-mr-2",
22040
22735
  xmlns: "http://www.w3.org/2000/svg",
22041
22736
  fill: "none",
22042
22737
  viewBox: "0 0 24 24",
22043
22738
  stroke: "currentColor"
22044
- }, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
22739
+ }, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
22045
22740
  strokeLinecap: "round",
22046
22741
  strokeLinejoin: "round",
22047
22742
  strokeWidth: 2,
@@ -22056,10 +22751,10 @@ function SvgLocationPin(props) {
22056
22751
 
22057
22752
  var _switch;
22058
22753
 
22059
- 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); }
22754
+ 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); }
22060
22755
 
22061
22756
  function SvgSubscription(props) {
22062
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
22757
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
22063
22758
  xmlns: "http://www.w3.org/2000/svg",
22064
22759
  viewBox: "0 0 100 125",
22065
22760
  fill: "currentColor"
@@ -22074,18 +22769,18 @@ function SvgSubscription(props) {
22074
22769
  }))))));
22075
22770
  }
22076
22771
 
22077
- var _path$5;
22772
+ var _path$6;
22078
22773
 
22079
- 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); }
22774
+ 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); }
22080
22775
 
22081
22776
  function SvgShopping(props) {
22082
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
22777
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
22083
22778
  className: "plc-w-6 plc-h-6 plc-mr-2",
22084
22779
  xmlns: "http://www.w3.org/2000/svg",
22085
22780
  fill: "none",
22086
22781
  viewBox: "0 0 24 24",
22087
22782
  stroke: "currentColor"
22088
- }, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
22783
+ }, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
22089
22784
  strokeLinecap: "round",
22090
22785
  strokeLinejoin: "round",
22091
22786
  strokeWidth: 2,
@@ -22093,18 +22788,18 @@ function SvgShopping(props) {
22093
22788
  })));
22094
22789
  }
22095
22790
 
22096
- var _path$4;
22791
+ var _path$5;
22097
22792
 
22098
- 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); }
22793
+ 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); }
22099
22794
 
22100
22795
  function SvgBookmark(props) {
22101
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
22796
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
22102
22797
  className: "plc-w-6 plc-h-6 plc-mr-2",
22103
22798
  xmlns: "http://www.w3.org/2000/svg",
22104
22799
  fill: "none",
22105
22800
  viewBox: "0 0 24 24",
22106
22801
  stroke: "currentColor"
22107
- }, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
22802
+ }, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
22108
22803
  strokeLinecap: "round",
22109
22804
  strokeLinejoin: "round",
22110
22805
  strokeWidth: 2,
@@ -22112,33 +22807,33 @@ function SvgBookmark(props) {
22112
22807
  })));
22113
22808
  }
22114
22809
 
22115
- var _path$3;
22810
+ var _path$4;
22116
22811
 
22117
- 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); }
22812
+ 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); }
22118
22813
 
22119
22814
  function SvgKey(props) {
22120
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
22815
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
22121
22816
  xmlns: "http://www.w3.org/2000/svg",
22122
22817
  viewBox: "0 0 20 20",
22123
22818
  fill: "currentColor"
22124
- }, props), _path$3 || (_path$3 = /*#__PURE__*/React__namespace.createElement("path", {
22819
+ }, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
22125
22820
  fillRule: "evenodd",
22126
22821
  d: "M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z",
22127
22822
  clipRule: "evenodd"
22128
22823
  })));
22129
22824
  }
22130
22825
 
22131
- var _path$2;
22826
+ var _path$3;
22132
22827
 
22133
- 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); }
22828
+ 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); }
22134
22829
 
22135
22830
  function SvgDonate(props) {
22136
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
22831
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
22137
22832
  width: 24,
22138
22833
  height: 24,
22139
22834
  fill: "currentColor",
22140
22835
  xmlns: "http://www.w3.org/2000/svg"
22141
- }, props), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
22836
+ }, props), _path$3 || (_path$3 = /*#__PURE__*/React__namespace.createElement("path", {
22142
22837
  d: "M4 21h9.62a3.995 3.995 0 003.037-1.397l5.102-5.952a1 1 0 00-.442-1.6l-1.968-.656a3.043 3.043 0 00-2.823.503l-3.185 2.547-.617-1.235A3.98 3.98 0 009.146 11H4c-1.103 0-2 .897-2 2v6c0 1.103.897 2 2 2zm0-8h5.146c.763 0 1.448.423 1.789 1.105l.447.895H7v2h6.014a.996.996 0 00.442-.11l.003-.001.004-.002h.003l.002-.001h.004l.001-.001c.009.003.003-.001.003-.001.01 0 .002-.001.002-.001h.001l.002-.001.003-.001.002-.001.002-.001.003-.001.002-.001c.003 0 .001-.001.002-.001l.003-.002.002-.001.002-.001.003-.001.002-.001h.001l.002-.001h.001l.002-.001.002-.001c.009-.001.003-.001.003-.001l.002-.001a.915.915 0 00.11-.078l4.146-3.317c.262-.208.623-.273.94-.167l.557.186-4.133 4.823a2.029 2.029 0 01-1.52.688H4v-6zM16 2h-.017c-.163.002-1.006.039-1.983.705-.951-.648-1.774-.7-1.968-.704L12.002 2h-.004c-.801 0-1.555.313-2.119.878C9.313 3.445 9 4.198 9 5s.313 1.555.861 2.104l3.414 3.586a1.006 1.006 0 001.45-.001l3.396-3.568C18.688 6.555 19 5.802 19 5s-.313-1.555-.878-2.121A2.978 2.978 0 0016.002 2H16zm1 3c0 .267-.104.518-.311.725L14 8.55l-2.707-2.843C11.104 5.518 11 5.267 11 5s.104-.518.294-.708A.977.977 0 0111.979 4c.025.001.502.032 1.067.485.081.065.163.139.247.222l.707.707.707-.707c.084-.083.166-.157.247-.222.529-.425.976-.478 1.052-.484a.987.987 0 01.701.292c.189.189.293.44.293.707z"
22143
22838
  })));
22144
22839
  }
@@ -22174,17 +22869,149 @@ const DonationsMenu = () => {
22174
22869
  }), subscriptions));
22175
22870
  };
22176
22871
 
22177
- function getDonationSubs() {
22178
- var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r, _window$Pelcro$user$r2;
22872
+ function getDonationSubs() {
22873
+ var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r, _window$Pelcro$user$r2;
22874
+
22875
+ const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
22876
+ const canceledDonations = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
22877
+ return [...donations, ...canceledDonations];
22878
+ }
22879
+
22880
+ function formatStartDate(date) {
22881
+ const startDate = new Date(date);
22882
+ return new Intl.DateTimeFormat("en-CA").format(startDate);
22883
+ }
22884
+
22885
+ const InvoicesMenu = props => {
22886
+ const {
22887
+ t
22888
+ } = useTranslation("dashboard");
22889
+ return /*#__PURE__*/React__default['default'].createElement("table", {
22890
+ className: "plc-w-full plc-table-fixed"
22891
+ }, /*#__PURE__*/React__default['default'].createElement("thead", {
22892
+ className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
22893
+ }, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
22894
+ className: "plc-w-4/12 "
22895
+ }, t("labels.details")), /*#__PURE__*/React__default['default'].createElement("th", {
22896
+ className: "plc-w-4/12 "
22897
+ }, t("labels.status.title")), /*#__PURE__*/React__default['default'].createElement("th", {
22898
+ className: "plc-w-3/12 "
22899
+ }, t("labels.actions")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
22900
+ className: "plc-h-4"
22901
+ }), /*#__PURE__*/React__default['default'].createElement(InvoicesItems, props)));
22902
+ };
22903
+
22904
+ const InvoicesItems = () => {
22905
+ var _window$Pelcro$invoic, _window$Pelcro$invoic2;
22906
+
22907
+ const {
22908
+ t
22909
+ } = useTranslation("dashboard");
22910
+ const {
22911
+ setInvoice,
22912
+ switchView
22913
+ } = usePelcro();
22914
+ 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 : [];
22915
+
22916
+ const showInvoiceDetails = event => {
22917
+ if (setInvoice(event.target.dataset.id)) {
22918
+ switchView("invoice-details");
22919
+ }
22920
+ };
22921
+
22922
+ if (invoices.length === 0) return null;
22923
+ return invoices.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()).map(invoice => {
22924
+ const invoiceStatus = getInvoiceStatus(invoice);
22925
+ const formattedCreationDate = new Intl.DateTimeFormat("en-CA").format(new Date(invoice.created_at));
22926
+ return /*#__PURE__*/React__default['default'].createElement("tr", {
22927
+ key: invoice.id,
22928
+ className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50`
22929
+ }, /*#__PURE__*/React__default['default'].createElement("td", {
22930
+ className: "plc-truncate"
22931
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
22932
+ className: "plc-font-semibold plc-text-gray-500"
22933
+ }, `#${invoice.id}`), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
22934
+ className: "plc-text-sm plc-text-gray-500"
22935
+ }, getFormattedPriceByLocal(invoice.total, invoice.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
22936
+ className: "plc-text-sm plc-text-gray-500"
22937
+ }, formattedCreationDate)), /*#__PURE__*/React__default['default'].createElement("td", {
22938
+ className: "plc-py-2"
22939
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
22940
+ className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${invoiceStatus.bgColor} plc-uppercase ${invoiceStatus.textColor} plc-rounded-lg`
22941
+ }, invoiceStatus.icon, invoiceStatus.title)), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement(Button, {
22942
+ variant: "ghost",
22943
+ className: "plc-text-blue-400 focus:plc-ring-blue-400 pelcro-dashboard-view-invoice-button",
22944
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgDocument, {
22945
+ className: "plc-w-4 plc-h-4"
22946
+ }),
22947
+ onClick: showInvoiceDetails,
22948
+ "data-id": invoice.id
22949
+ }, t("labels.view"))));
22950
+ });
22951
+ };
22952
+
22953
+ function getInvoiceStatus(invoice) {
22954
+ const translations = i18next.t("dashboard:labels", {
22955
+ returnObjects: true
22956
+ });
22957
+
22958
+ switch (invoice.status) {
22959
+ case "paid":
22960
+ return {
22961
+ textColor: "plc-text-green-700",
22962
+ bgColor: "plc-bg-green-100",
22963
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgCheckMark, null),
22964
+ title: translations.paid
22965
+ };
22966
+
22967
+ case "past_due":
22968
+ return {
22969
+ textColor: "plc-text-orange-700",
22970
+ bgColor: "plc-bg-orange-100",
22971
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgExclamation, null),
22972
+ title: translations.pastDue
22973
+ };
22179
22974
 
22180
- const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
22181
- const canceledDonations = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
22182
- return [...donations, ...canceledDonations];
22183
- }
22975
+ case "open":
22976
+ return {
22977
+ textColor: "plc-text-yellow-700",
22978
+ bgColor: "plc-bg-yellow-100",
22979
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgExclamation, null),
22980
+ title: translations.open
22981
+ };
22184
22982
 
22185
- function formatStartDate(date) {
22186
- const startDate = new Date(date);
22187
- return new Intl.DateTimeFormat("en-CA").format(startDate);
22983
+ case "draft":
22984
+ return {
22985
+ textColor: "plc-text-blue-700",
22986
+ bgColor: "plc-bg-blue-100",
22987
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgEdit, null),
22988
+ title: translations.draft
22989
+ };
22990
+
22991
+ case "scheduled":
22992
+ return {
22993
+ textColor: "plc-text-blue-700",
22994
+ bgColor: "plc-bg-blue-100",
22995
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgCalendar, null),
22996
+ title: translations.scheduled
22997
+ };
22998
+
22999
+ case "uncollectible":
23000
+ return {
23001
+ textColor: "plc-text-red-700",
23002
+ bgColor: "plc-bg-red-100",
23003
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
23004
+ title: translations.uncollectible
23005
+ };
23006
+
23007
+ case "void":
23008
+ return {
23009
+ textColor: "plc-text-gray-700",
23010
+ bgColor: "plc-bg-gray-100",
23011
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
23012
+ title: translations.void
23013
+ };
23014
+ }
22188
23015
  }
22189
23016
 
22190
23017
  const SUB_MENUS = {
@@ -22333,9 +23160,10 @@ class Dashboard extends React.Component {
22333
23160
  }) => {
22334
23161
  if (isGift) {
22335
23162
  this.props.setProductAndPlan(null, null, true);
23163
+ return this.props.setView("plan-select");
22336
23164
  }
22337
23165
 
22338
- return this.props.setView("plan-select");
23166
+ return this.props.setView("subscription-options");
22339
23167
  });
22340
23168
 
22341
23169
  _defineProperty$3(this, "displayAddressCreate", () => {
@@ -22740,6 +23568,12 @@ class Dashboard extends React.Component {
22740
23568
  icon: /*#__PURE__*/React__default['default'].createElement(SvgShopping, null),
22741
23569
  title: this.locale("labels.orders.label"),
22742
23570
  content: /*#__PURE__*/React__default['default'].createElement(OrdersMenu, null)
23571
+ }), /*#__PURE__*/React__default['default'].createElement(Accordion.item, {
23572
+ show: hasInvoices(),
23573
+ name: SUB_MENUS.INVOICES,
23574
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgDocument, null),
23575
+ title: this.locale("labels.invoices"),
23576
+ content: /*#__PURE__*/React__default['default'].createElement(InvoicesMenu, null)
22743
23577
  }), /*#__PURE__*/React__default['default'].createElement(Accordion.item, {
22744
23578
  name: SUB_MENUS.SAVED_ITEMS,
22745
23579
  icon: /*#__PURE__*/React__default['default'].createElement(SvgBookmark, null),
@@ -22755,6 +23589,13 @@ class Dashboard extends React.Component {
22755
23589
 
22756
23590
  }
22757
23591
 
23592
+ function hasInvoices() {
23593
+ var _window$Pelcro$invoic, _window$Pelcro$invoic2;
23594
+
23595
+ 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 : [];
23596
+ return invoices.length > 0;
23597
+ }
23598
+
22758
23599
  function hasDonationSubs() {
22759
23600
  var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
22760
23601
 
@@ -22790,7 +23631,7 @@ const DashboardOpenButton = () => {
22790
23631
  };
22791
23632
  DashboardOpenButton.viewId = "dashboard-open";
22792
23633
 
22793
- const initialState$2 = {
23634
+ const initialState$3 = {
22794
23635
  imageSrc: null,
22795
23636
  crop: {
22796
23637
  x: 0,
@@ -22804,10 +23645,10 @@ const initialState$2 = {
22804
23645
  content: ""
22805
23646
  }
22806
23647
  };
22807
- const store$2 = /*#__PURE__*/React.createContext(initialState$2);
23648
+ const store$3 = /*#__PURE__*/React.createContext(initialState$3);
22808
23649
  const {
22809
- Provider: Provider$2
22810
- } = store$2;
23650
+ Provider: Provider$3
23651
+ } = store$3;
22811
23652
 
22812
23653
  const ProfilePicChangeContainer = ({
22813
23654
  style,
@@ -22941,21 +23782,21 @@ const ProfilePicChangeContainer = ({
22941
23782
  default:
22942
23783
  return state;
22943
23784
  }
22944
- }, initialState$2);
23785
+ }, initialState$3);
22945
23786
  return /*#__PURE__*/React__default['default'].createElement("div", {
22946
23787
  style: { ...style
22947
23788
  },
22948
23789
  className: `pelcro-container pelcro-profile-picture-container ${className}`
22949
- }, /*#__PURE__*/React__default['default'].createElement(Provider$2, {
23790
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$3, {
22950
23791
  value: {
22951
23792
  state,
22952
23793
  dispatch
22953
23794
  }
22954
23795
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
22955
- store: store$2,
23796
+ store: store$3,
22956
23797
  key: i
22957
23798
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
22958
- store: store$2
23799
+ store: store$3
22959
23800
  })));
22960
23801
  };
22961
23802
  /**
@@ -23017,7 +23858,7 @@ const ProfilePicChangeButton = ({
23017
23858
  isSubmitting
23018
23859
  },
23019
23860
  dispatch
23020
- } = React.useContext(store$2);
23861
+ } = React.useContext(store$3);
23021
23862
  const {
23022
23863
  t
23023
23864
  } = useTranslation("userEdit");
@@ -24385,7 +25226,7 @@ const ProfilePicChangeCropper = ({
24385
25226
  zoom
24386
25227
  },
24387
25228
  dispatch
24388
- } = React.useContext(store$2);
25229
+ } = React.useContext(store$3);
24389
25230
  return /*#__PURE__*/React__default['default'].createElement("div", {
24390
25231
  className: `plc-relative plc-w-full plc-h-52 sm:plc-h-96 ${className}`
24391
25232
  }, /*#__PURE__*/React__default['default'].createElement(Cropper, Object.assign({
@@ -24427,7 +25268,7 @@ const ProfilePicChangeZoom = ({
24427
25268
  zoom
24428
25269
  },
24429
25270
  dispatch
24430
- } = React.useContext(store$2);
25271
+ } = React.useContext(store$3);
24431
25272
  const {
24432
25273
  t
24433
25274
  } = useTranslation("userEdit");
@@ -24450,18 +25291,18 @@ const ProfilePicChangeZoom = ({
24450
25291
  }, otherProps)));
24451
25292
  };
24452
25293
 
24453
- var _path$1;
25294
+ var _path$2;
24454
25295
 
24455
- function _extends$1() { _extends$1 = 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$1.apply(this, arguments); }
25296
+ 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); }
24456
25297
 
24457
25298
  function SvgPhotograph(props) {
24458
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
25299
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
24459
25300
  xmlns: "http://www.w3.org/2000/svg",
24460
25301
  className: "plc-h-6 plc-w-6",
24461
25302
  fill: "none",
24462
25303
  viewBox: "0 0 24 24",
24463
25304
  stroke: "currentColor"
24464
- }, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
25305
+ }, props), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
24465
25306
  strokeLinecap: "round",
24466
25307
  strokeLinejoin: "round",
24467
25308
  strokeWidth: 2,
@@ -24479,7 +25320,7 @@ const ProfilePicChangeSelectButton = ({
24479
25320
  state: {
24480
25321
  isSubmitting
24481
25322
  }
24482
- } = React.useContext(store$2);
25323
+ } = React.useContext(store$3);
24483
25324
  const {
24484
25325
  t
24485
25326
  } = useTranslation("userEdit");
@@ -24521,7 +25362,7 @@ const ProfilePicChangeRemoveButton = ({
24521
25362
  state: {
24522
25363
  isSubmitting
24523
25364
  }
24524
- } = React.useContext(store$2);
25365
+ } = React.useContext(store$3);
24525
25366
  const {
24526
25367
  t
24527
25368
  } = useTranslation("userEdit");
@@ -24544,7 +25385,7 @@ const ProfilePicChangeWrapper = () => {
24544
25385
  state: {
24545
25386
  imageSrc
24546
25387
  }
24547
- } = React.useContext(store$2);
25388
+ } = React.useContext(store$3);
24548
25389
  const {
24549
25390
  t
24550
25391
  } = useTranslation("userEdit");
@@ -24606,17 +25447,17 @@ function ProfilePicChangeModal({
24606
25447
  }
24607
25448
  ProfilePicChangeModal.viewId = "profile-picture";
24608
25449
 
24609
- const initialState$1 = {
25450
+ const initialState$2 = {
24610
25451
  isSubmitting: false,
24611
25452
  alert: {
24612
25453
  type: "error",
24613
25454
  content: ""
24614
25455
  }
24615
25456
  };
24616
- const store$1 = /*#__PURE__*/React.createContext(initialState$1);
25457
+ const store$2 = /*#__PURE__*/React.createContext(initialState$2);
24617
25458
  const {
24618
- Provider: Provider$1
24619
- } = store$1;
25459
+ Provider: Provider$2
25460
+ } = store$2;
24620
25461
 
24621
25462
  const EmailVerifyContainer = ({
24622
25463
  style,
@@ -24679,21 +25520,21 @@ const EmailVerifyContainer = ({
24679
25520
  default:
24680
25521
  return state;
24681
25522
  }
24682
- }, initialState$1);
25523
+ }, initialState$2);
24683
25524
  return /*#__PURE__*/React__default['default'].createElement("div", {
24684
25525
  style: { ...style
24685
25526
  },
24686
25527
  className: `pelcro-container pelcro-email-verify-container ${className}`
24687
- }, /*#__PURE__*/React__default['default'].createElement(Provider$1, {
25528
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$2, {
24688
25529
  value: {
24689
25530
  state,
24690
25531
  dispatch
24691
25532
  }
24692
25533
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
24693
- store: store$1,
25534
+ store: store$2,
24694
25535
  key: i
24695
25536
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
24696
- store: store$1
25537
+ store: store$2
24697
25538
  })));
24698
25539
  };
24699
25540
 
@@ -24707,7 +25548,7 @@ const EmailVerifyResendButton = ({
24707
25548
  state: {
24708
25549
  isSubmitting
24709
25550
  }
24710
- } = React.useContext(store$1);
25551
+ } = React.useContext(store$2);
24711
25552
  const {
24712
25553
  t
24713
25554
  } = useTranslation("verifyEmail");
@@ -24722,16 +25563,16 @@ const EmailVerifyResendButton = ({
24722
25563
  }, otherProps), name !== null && name !== void 0 ? name : t("labels.resend"));
24723
25564
  };
24724
25565
 
24725
- var _path, _path2;
25566
+ var _path$1, _path2;
24726
25567
 
24727
- function _extends() { _extends = 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.apply(this, arguments); }
25568
+ function _extends$1() { _extends$1 = 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$1.apply(this, arguments); }
24728
25569
 
24729
25570
  function SvgEmailVerify(props) {
24730
- return /*#__PURE__*/React__namespace.createElement("svg", _extends({
25571
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
24731
25572
  className: "plc-w-6 plc-h-6",
24732
25573
  viewBox: "0 0 700 700",
24733
25574
  xmlns: "http://www.w3.org/2000/svg"
24734
- }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
25575
+ }, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
24735
25576
  d: "M583.01 231.93a15.008 15.008 0 00-.887-3.875c-.562-1.254-1.129-2.508-1.695-3.762a14.686 14.686 0 00-1.898-1.789c-.438-.437-.653-1.027-1.153-1.414l-56.266-44.164v-52.484a15.555 15.555 0 00-15.554-15.555H434.56l-74.945-58.895a15.547 15.547 0 00-19.227 0l-74.945 58.895h-70.996a15.555 15.555 0 00-15.555 15.555v52.484l-56.266 44.16c-.496.39-.715.996-1.152 1.43v.004a13.37 13.37 0 00-1.898 1.773c-.22.426-.414.86-.59 1.305a14.158 14.158 0 00-1.106 2.457 15.009 15.009 0 00-.886 3.875c0 .48-.329.918-.329 1.398l.004 264.45a15.555 15.555 0 0015.555 15.555h435.55a15.555 15.555 0 0015.555-15.555v-264.45c0-.48-.278-.918-.325-1.398zm-41.176.809l-20.723 14.809v-31.11zm-191.83-150.73l34.223 26.883h-68.445zm-140 57.992h280v124.45c.07 1.593.383 3.168.934 4.664l-140.93 100.66-140.46-100.33c.214-.77.37-1.555.464-2.348zm-31.109 107.55l-20.719-14.81 20.719-16.27zm-31.113 234.67V263.56l193.18 137.99a15.562 15.562 0 0018.078 0l193.18-137.99v218.66z"
24736
25577
  })), _path2 || (_path2 = /*#__PURE__*/React__namespace.createElement("path", {
24737
25578
  d: "M324.33 291.81a15.56 15.56 0 0020.582-.297l85.555-77.777a15.56 15.56 0 00-20.938-23.023l-75.398 68.539-44.023-37.723a15.54 15.54 0 00-11.46-4.106 15.553 15.553 0 00-8.758 27.718z"
@@ -24835,11 +25676,11 @@ const invoicePaymentSubmitButton = props => {
24835
25676
  return /*#__PURE__*/React__default['default'].createElement(SubmitPaymentMethod, props);
24836
25677
  };
24837
25678
 
24838
- const initialState = {};
24839
- const store = /*#__PURE__*/React.createContext(initialState);
25679
+ const initialState$1 = {};
25680
+ const store$1 = /*#__PURE__*/React.createContext(initialState$1);
24840
25681
  const {
24841
- Provider
24842
- } = store;
25682
+ Provider: Provider$1
25683
+ } = store$1;
24843
25684
 
24844
25685
  const InvoiceDetailsContainer = ({
24845
25686
  style,
@@ -24860,21 +25701,21 @@ const InvoiceDetailsContainer = ({
24860
25701
  default:
24861
25702
  return state;
24862
25703
  }
24863
- }, initialState);
25704
+ }, initialState$1);
24864
25705
  return /*#__PURE__*/React__default['default'].createElement("div", {
24865
25706
  style: { ...style
24866
25707
  },
24867
25708
  className: `pelcro-container pelcro-invoice-details-container ${className}`
24868
- }, /*#__PURE__*/React__default['default'].createElement(Provider, {
25709
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$1, {
24869
25710
  value: {
24870
25711
  state,
24871
25712
  dispatch
24872
25713
  }
24873
25714
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
24874
- store,
25715
+ store: store$1,
24875
25716
  key: i
24876
25717
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
24877
- store
25718
+ store: store$1
24878
25719
  })));
24879
25720
  };
24880
25721
 
@@ -24906,7 +25747,7 @@ const InvoiceDetailsPayButton = ({
24906
25747
  }) => {
24907
25748
  const {
24908
25749
  dispatch
24909
- } = React.useContext(store);
25750
+ } = React.useContext(store$1);
24910
25751
  const {
24911
25752
  t
24912
25753
  } = useTranslation("invoiceDetails");
@@ -24928,6 +25769,8 @@ const InvoiceDetailsView = props => {
24928
25769
  invoice
24929
25770
  } = usePelcro();
24930
25771
  const showPayButton = canPayInvoice(invoice);
25772
+ const showDownloadButton = Boolean(invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf);
25773
+ const hasPlanDetails = Boolean(invoice.plan);
24931
25774
  const creationDate = new Date(invoice === null || invoice === void 0 ? void 0 : invoice.created_at);
24932
25775
  const formattedCreationDate = new Intl.DateTimeFormat("en-CA").format(creationDate);
24933
25776
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -24945,7 +25788,7 @@ const InvoiceDetailsView = props => {
24945
25788
  className: "plc-font-bold pelcro-invoice-summary-title"
24946
25789
  }, t("labels.summary")), invoice && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("p", {
24947
25790
  className: "plc-mr-2 pelcro-invoice-creation-date"
24948
- }, `${t("labels.creationDate")} ${formattedCreationDate}`), /*#__PURE__*/React__default['default'].createElement("div", {
25791
+ }, `${t("labels.creationDate")} ${formattedCreationDate}`), hasPlanDetails && /*#__PURE__*/React__default['default'].createElement("div", {
24949
25792
  className: "plc-flex plc-items-center plc-pt-2 plc-mt-2 plc-border-t plc-border-gray-400 plc-min-h-12 plc-justify-between pelcro-invoice-plan-wrapper"
24950
25793
  }, /*#__PURE__*/React__default['default'].createElement("div", {
24951
25794
  className: "plc-break-words pelcro-invoice-plan-name"
@@ -24971,7 +25814,7 @@ const InvoiceDetailsView = props => {
24971
25814
  className: "plc-font-semibold pelcro-invoice-total"
24972
25815
  }, getFormattedPriceByLocal(invoice.amount_remaining, invoice.currency, getPageOrDefaultLanguage())))))), /*#__PURE__*/React__default['default'].createElement("div", {
24973
25816
  className: "plc-flex plc-items-center plc-justify-center plc-mt-4"
24974
- }, /*#__PURE__*/React__default['default'].createElement(InvoiceDetailsDownloadButton, {
25817
+ }, showDownloadButton && /*#__PURE__*/React__default['default'].createElement(InvoiceDetailsDownloadButton, {
24975
25818
  url: invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf,
24976
25819
  className: "plc-w-full plc-text-center"
24977
25820
  }), showPayButton && /*#__PURE__*/React__default['default'].createElement(InvoiceDetailsPayButton, {
@@ -25011,6 +25854,232 @@ const InvoiceDetailsModal = ({
25011
25854
  };
25012
25855
  InvoiceDetailsModal.viewId = "invoice-details";
25013
25856
 
25857
+ const initialState = {
25858
+ selectedOption: ""
25859
+ };
25860
+ const store = /*#__PURE__*/React.createContext(initialState);
25861
+ const {
25862
+ Provider
25863
+ } = store;
25864
+
25865
+ const SubscriptionOptionsContainer = ({
25866
+ style,
25867
+ className = "",
25868
+ onRenewSubSuccess = () => {},
25869
+ onNewSubSuccess = () => {},
25870
+ children,
25871
+ ...props
25872
+ }) => {
25873
+ const submit = ({
25874
+ selectedOption
25875
+ }, dispatch) => {
25876
+ if (selectedOption === "renew") return onRenewSubSuccess();
25877
+ if (selectedOption === "new") return onNewSubSuccess();
25878
+ };
25879
+
25880
+ const [state, dispatch] = useReducerWithSideEffects((state, action) => {
25881
+ switch (action.type) {
25882
+ case SWITCH_TO_NEW:
25883
+ return lib_7({ ...state,
25884
+ selectedOption: "new"
25885
+ });
25886
+
25887
+ case SWITCH_TO_RENEW:
25888
+ return lib_7({ ...state,
25889
+ selectedOption: "renew"
25890
+ });
25891
+
25892
+ case HANDLE_SUBMIT:
25893
+ return lib_4((state, dispatch) => submit(state));
25894
+
25895
+ default:
25896
+ return state;
25897
+ }
25898
+ }, initialState);
25899
+ return /*#__PURE__*/React__default['default'].createElement("div", {
25900
+ style: { ...style
25901
+ },
25902
+ className: `pelcro-container pelcro-subscription-options-container ${className}`
25903
+ }, /*#__PURE__*/React__default['default'].createElement(Provider, {
25904
+ value: {
25905
+ state,
25906
+ dispatch
25907
+ }
25908
+ }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
25909
+ store,
25910
+ key: i
25911
+ })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
25912
+ store
25913
+ })));
25914
+ };
25915
+
25916
+ var _path;
25917
+
25918
+ function _extends() { _extends = 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.apply(this, arguments); }
25919
+
25920
+ function SvgPlusCircle(props) {
25921
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends({
25922
+ xmlns: "http://www.w3.org/2000/svg",
25923
+ className: "plc-h-6 plc-w-6",
25924
+ fill: "none",
25925
+ viewBox: "0 0 24 24",
25926
+ stroke: "currentColor",
25927
+ strokeWidth: 2
25928
+ }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
25929
+ strokeLinecap: "round",
25930
+ strokeLinejoin: "round",
25931
+ d: "M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"
25932
+ })));
25933
+ }
25934
+
25935
+ const SubscriptionOptionsNewButton = ({
25936
+ name,
25937
+ onClick,
25938
+ ...otherProps
25939
+ }) => {
25940
+ const {
25941
+ dispatch,
25942
+ state: {
25943
+ selectedOption
25944
+ }
25945
+ } = React.useContext(store);
25946
+ const {
25947
+ t
25948
+ } = useTranslation("subscriptionOptions");
25949
+ const isChecked = selectedOption === "new";
25950
+ return /*#__PURE__*/React__default['default'].createElement(Radio, Object.assign({
25951
+ className: "plc-hidden pelcro-new-sub-option",
25952
+ labelClassName: `plc-flex plc-flex-col plc-items-center plc-justify-center plc-text-lg plc-font-semibold plc-ml-0 plc-w-52 plc-h-52 plc-text-black plc-p-2 hover:plc-bg-gray-200 pelcro-new-sub-option-label plc-border-2 plc-text-center ${isChecked ? "plc-border-black" : "plc-border-gray-300"}`,
25953
+ id: "pelcro-new-sub-option",
25954
+ name: "option",
25955
+ onChange: () => {
25956
+ dispatch({
25957
+ type: SWITCH_TO_NEW
25958
+ });
25959
+ onClick === null || onClick === void 0 ? void 0 : onClick();
25960
+ },
25961
+ checked: isChecked
25962
+ }, otherProps), name !== null && name !== void 0 ? name : t("addNew"), /*#__PURE__*/React__default['default'].createElement(SvgPlusCircle, {
25963
+ className: "plc-w-full plc-h-full plc-mr-0"
25964
+ }));
25965
+ };
25966
+
25967
+ const SubscriptionOptionsRenewButton = ({
25968
+ name,
25969
+ onClick,
25970
+ ...otherProps
25971
+ }) => {
25972
+ const {
25973
+ dispatch,
25974
+ state: {
25975
+ selectedOption
25976
+ }
25977
+ } = React.useContext(store);
25978
+ const {
25979
+ t
25980
+ } = useTranslation("subscriptionOptions");
25981
+ const isChecked = selectedOption === "renew";
25982
+ return /*#__PURE__*/React__default['default'].createElement(Radio, Object.assign({
25983
+ className: "plc-hidden pelcro-renew-sub-option",
25984
+ labelClassName: `plc-flex plc-flex-col plc-items-center plc-justify-center plc-text-lg plc-font-semibold plc-ml-0 plc-w-52 plc-h-52 plc-text-black plc-p-2 hover:plc-bg-gray-200 pelcro-renew-sub-option-label plc-border-2 plc-text-center ${isChecked ? "plc-border-black" : "plc-border-gray-300"}`,
25985
+ id: "pelcro-renew-sub-option",
25986
+ name: "option",
25987
+ onChange: () => {
25988
+ dispatch({
25989
+ type: SWITCH_TO_RENEW
25990
+ });
25991
+ onClick === null || onClick === void 0 ? void 0 : onClick();
25992
+ },
25993
+ checked: isChecked
25994
+ }, otherProps), name !== null && name !== void 0 ? name : t("renew"), /*#__PURE__*/React__default['default'].createElement(SvgRefresh, {
25995
+ className: "plc-w-full plc-h-full plc-mr-0"
25996
+ }));
25997
+ };
25998
+
25999
+ const SubscriptionOptionsSubmit = ({
26000
+ name,
26001
+ onClick,
26002
+ ...otherProps
26003
+ }) => {
26004
+ const {
26005
+ dispatch,
26006
+ state: {
26007
+ selectedOption
26008
+ }
26009
+ } = React.useContext(store);
26010
+ const {
26011
+ t
26012
+ } = useTranslation("subscriptionOptions");
26013
+ return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
26014
+ onClick: () => {
26015
+ dispatch({
26016
+ type: HANDLE_SUBMIT
26017
+ });
26018
+ onClick === null || onClick === void 0 ? void 0 : onClick();
26019
+ },
26020
+ disabled: !selectedOption
26021
+ }, otherProps), name !== null && name !== void 0 ? name : t("next"));
26022
+ };
26023
+
26024
+ const SubscriptionOptionsView = props => {
26025
+ const {
26026
+ t
26027
+ } = useTranslation("subscriptionOptions");
26028
+ return /*#__PURE__*/React__default['default'].createElement("div", {
26029
+ id: "pelcro-subscription-options-view"
26030
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
26031
+ className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
26032
+ }, /*#__PURE__*/React__default['default'].createElement("h4", {
26033
+ className: "plc-text-2xl plc-font-semibold"
26034
+ }, t("title")), /*#__PURE__*/React__default['default'].createElement("p", null, t("subtitle"))), /*#__PURE__*/React__default['default'].createElement("form", {
26035
+ action: "javascript:void(0);",
26036
+ className: "plc-mt-2 pelcro-form"
26037
+ }, /*#__PURE__*/React__default['default'].createElement(SubscriptionOptionsContainer, props, /*#__PURE__*/React__default['default'].createElement("div", {
26038
+ className: "plc-flex plc-justify-between plc-items-center"
26039
+ }, /*#__PURE__*/React__default['default'].createElement(SubscriptionOptionsRenewButton, null), /*#__PURE__*/React__default['default'].createElement(SubscriptionOptionsNewButton, null)), /*#__PURE__*/React__default['default'].createElement(SubscriptionOptionsSubmit, {
26040
+ role: "submit",
26041
+ className: "plc-mt-4 plc-w-full",
26042
+ name: t("next"),
26043
+ id: "pelcro-submit"
26044
+ }))));
26045
+ };
26046
+
26047
+ const SubscriptionOptionsModal = ({
26048
+ onDisplay,
26049
+ onClose,
26050
+ ...otherProps
26051
+ }) => {
26052
+ const {
26053
+ switchView,
26054
+ setProductsList
26055
+ } = usePelcro();
26056
+
26057
+ const onRenewSubSuccess = () => {
26058
+ var _otherProps$onRenewSu;
26059
+
26060
+ (_otherProps$onRenewSu = otherProps.onRenewSubSuccess) === null || _otherProps$onRenewSu === void 0 ? void 0 : _otherProps$onRenewSu.call(otherProps);
26061
+ setProductsList(getRenewableProducts());
26062
+ switchView("_plan-select-renew");
26063
+ };
26064
+
26065
+ const onNewSubSuccess = () => {
26066
+ var _otherProps$onNewSubS;
26067
+
26068
+ (_otherProps$onNewSubS = otherProps.onNewSubSuccess) === null || _otherProps$onNewSubS === void 0 ? void 0 : _otherProps$onNewSubS.call(otherProps);
26069
+ switchView("plan-select");
26070
+ };
26071
+
26072
+ return /*#__PURE__*/React__default['default'].createElement(Modal, {
26073
+ onDisplay: onDisplay,
26074
+ onClose: onClose,
26075
+ id: "pelcro-subscription-options-modal"
26076
+ }, /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(SubscriptionOptionsView, Object.assign({}, otherProps, {
26077
+ onNewSubSuccess: onNewSubSuccess,
26078
+ onRenewSubSuccess: onRenewSubSuccess
26079
+ }))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
26080
+ };
26081
+ SubscriptionOptionsModal.viewId = "subscription-options";
26082
+
25014
26083
  exports.AddressCreateCity = AddressCreateCity;
25015
26084
  exports.AddressCreateContainer = AddressCreateContainer;
25016
26085
  exports.AddressCreateCountrySelect = AddressCreateCountrySelect;
@@ -25188,6 +26257,12 @@ exports.SubmitPaymentMethod = SubmitPaymentMethod;
25188
26257
  exports.SubscriptionCreateContainer = SubscriptionCreateContainer;
25189
26258
  exports.SubscriptionCreateModal = SubscriptionCreateModal;
25190
26259
  exports.SubscriptionCreateView = SubscriptionCreateView;
26260
+ exports.SubscriptionOptionsContainer = SubscriptionOptionsContainer;
26261
+ exports.SubscriptionOptionsModal = SubscriptionOptionsModal;
26262
+ exports.SubscriptionOptionsNewButton = SubscriptionOptionsNewButton;
26263
+ exports.SubscriptionOptionsRenewButton = SubscriptionOptionsRenewButton;
26264
+ exports.SubscriptionOptionsSubmit = SubscriptionOptionsSubmit;
26265
+ exports.SubscriptionOptionsView = SubscriptionOptionsView;
25191
26266
  exports.SubscriptionRenewContainer = SubscriptionRenewContainer;
25192
26267
  exports.SubscriptionRenewModal = SubscriptionRenewModal;
25193
26268
  exports.SubscriptionRenewView = SubscriptionRenewView;