@pelcro/react-pelcro-js 3.2.0-beta.1 → 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.esm.js CHANGED
@@ -3431,9 +3431,9 @@ var paymentMethod_fr = {
3431
3431
  select: select
3432
3432
  };
3433
3433
 
3434
- var title$f = "Enter your email to subscribe to our newsletter";
3434
+ var title$h = "Enter your email to subscribe to our newsletter";
3435
3435
  var updateTitle$1 = "Update newsletter selections";
3436
- var subtitle$7 = "We may use your email for other marketing communication";
3436
+ var subtitle$9 = "We may use your email for other marketing communication";
3437
3437
  var labels$p = {
3438
3438
  submit: "Submit",
3439
3439
  firstName: "First name",
@@ -3450,16 +3450,16 @@ var messages$r = {
3450
3450
  here: "here"
3451
3451
  };
3452
3452
  var newsletter_en = {
3453
- title: title$f,
3453
+ title: title$h,
3454
3454
  updateTitle: updateTitle$1,
3455
- subtitle: subtitle$7,
3455
+ subtitle: subtitle$9,
3456
3456
  labels: labels$p,
3457
3457
  messages: messages$r
3458
3458
  };
3459
3459
 
3460
- var title$e = "Entrez votre adresse courriel pour vous abonner à notre infolettre";
3460
+ var title$g = "Entrez votre adresse courriel pour vous abonner à notre infolettre";
3461
3461
  var updateTitle = "Mettre à jour son choix d'infolettres";
3462
- var subtitle$6 = "Nous pouvons utiliser votre adresse courriel pour d’autres communications marketing";
3462
+ var subtitle$8 = "Nous pouvons utiliser votre adresse courriel pour d’autres communications marketing";
3463
3463
  var labels$o = {
3464
3464
  submit: "Lire l’article !",
3465
3465
  firstName: "Prénom",
@@ -3476,9 +3476,9 @@ var messages$q = {
3476
3476
  here: "ici"
3477
3477
  };
3478
3478
  var newsletter_fr = {
3479
- title: title$e,
3479
+ title: title$g,
3480
3480
  updateTitle: updateTitle,
3481
- subtitle: subtitle$6,
3481
+ subtitle: subtitle$8,
3482
3482
  labels: labels$o,
3483
3483
  messages: messages$q
3484
3484
  };
@@ -3735,8 +3735,8 @@ var login_fr = {
3735
3735
  errors: errors$4
3736
3736
  };
3737
3737
 
3738
- var title$d = "Create an account";
3739
- var subtitle$5 = "Enter your email and password below";
3738
+ var title$f = "Create an account";
3739
+ var subtitle$7 = "Enter your email and password below";
3740
3740
  var labels$h = {
3741
3741
  signUpFacebook: "Sign up with Facebook",
3742
3742
  signUpGoogle: "Sign up with Google",
@@ -3821,8 +3821,8 @@ var redeem$1 = {
3821
3821
  }
3822
3822
  };
3823
3823
  var register_en = {
3824
- title: title$d,
3825
- subtitle: subtitle$5,
3824
+ title: title$f,
3825
+ subtitle: subtitle$7,
3826
3826
  labels: labels$h,
3827
3827
  messages: messages$h,
3828
3828
  errors: errors$3,
@@ -3830,8 +3830,8 @@ var register_en = {
3830
3830
  redeem: redeem$1
3831
3831
  };
3832
3832
 
3833
- var title$c = "Créer un compte";
3834
- var subtitle$4 = "Entrez votre courriel et votre mot de passe ci-dessous";
3833
+ var title$e = "Créer un compte";
3834
+ var subtitle$6 = "Entrez votre courriel et votre mot de passe ci-dessous";
3835
3835
  var labels$g = {
3836
3836
  signUpFacebook: "Inscrivez-vous avec Facebook",
3837
3837
  signUpGoogle: "Inscrivez-vous avec Google",
@@ -3917,8 +3917,8 @@ var redeem = {
3917
3917
  }
3918
3918
  };
3919
3919
  var register_fr = {
3920
- title: title$c,
3921
- subtitle: subtitle$4,
3920
+ title: title$e,
3921
+ subtitle: subtitle$6,
3922
3922
  labels: labels$g,
3923
3923
  messages: messages$g,
3924
3924
  errors: errors$2,
@@ -3978,7 +3978,7 @@ var userEdit_fr = {
3978
3978
  messages: messages$e
3979
3979
  };
3980
3980
 
3981
- var title$b = "Enter your shipping address";
3981
+ var title$d = "Enter your shipping address";
3982
3982
  var selectAddressTitle$1 = "Please select an address";
3983
3983
  var selectAddressSubtitle$1 = "Select one of your saved addresses, or add a new one";
3984
3984
  var labels$d = {
@@ -4001,7 +4001,7 @@ var messages$d = {
4001
4001
  subRedeemed: "Your subscription has been redeemed."
4002
4002
  };
4003
4003
  var address_en = {
4004
- title: title$b,
4004
+ title: title$d,
4005
4005
  selectAddressTitle: selectAddressTitle$1,
4006
4006
  selectAddressSubtitle: selectAddressSubtitle$1,
4007
4007
  labels: labels$d,
@@ -4009,7 +4009,7 @@ var address_en = {
4009
4009
  messages: messages$d
4010
4010
  };
4011
4011
 
4012
- var title$a = "Entrez votre adresse de livraison";
4012
+ var title$c = "Entrez votre adresse de livraison";
4013
4013
  var selectAddressTitle = "Veuillez sélectionner une adresse";
4014
4014
  var selectAddressSubtitle = "Choisissez l'une de vos adresses ou créez-en une nouvelle";
4015
4015
  var labels$c = {
@@ -4032,7 +4032,7 @@ var messages$c = {
4032
4032
  subRedeemed: "Votre abonnement a bien été activé."
4033
4033
  };
4034
4034
  var address_fr = {
4035
- title: title$a,
4035
+ title: title$c,
4036
4036
  selectAddressTitle: selectAddressTitle,
4037
4037
  selectAddressSubtitle: selectAddressSubtitle,
4038
4038
  labels: labels$c,
@@ -4040,8 +4040,8 @@ var address_fr = {
4040
4040
  messages: messages$c
4041
4041
  };
4042
4042
 
4043
- var title$9 = "Reset your password";
4044
- var subtitle$3 = "Enter a new password below";
4043
+ var title$b = "Reset your password";
4044
+ var subtitle$5 = "Enter a new password below";
4045
4045
  var email$3 = "Email";
4046
4046
  var password$3 = "Password";
4047
4047
  var confirmPassword$1 = "Confirm password";
@@ -4049,8 +4049,8 @@ var submit$5 = "Submit";
4049
4049
  var required$5 = "Required";
4050
4050
  var passwordUpdated$1 = "Password has been updated, please login with the new password";
4051
4051
  var passwordReset_en = {
4052
- title: title$9,
4053
- subtitle: subtitle$3,
4052
+ title: title$b,
4053
+ subtitle: subtitle$5,
4054
4054
  email: email$3,
4055
4055
  password: password$3,
4056
4056
  confirmPassword: confirmPassword$1,
@@ -4059,8 +4059,8 @@ var passwordReset_en = {
4059
4059
  passwordUpdated: passwordUpdated$1
4060
4060
  };
4061
4061
 
4062
- var title$8 = "Réinitialiser votre mot de passe";
4063
- var subtitle$2 = "Entrez un nouveau mot de passe ci-dessous";
4062
+ var title$a = "Réinitialiser votre mot de passe";
4063
+ var subtitle$4 = "Entrez un nouveau mot de passe ci-dessous";
4064
4064
  var email$2 = "Adresse courriel";
4065
4065
  var password$2 = "Mot de passe";
4066
4066
  var confirmPassword = "Confirmer le mot de passe";
@@ -4068,8 +4068,8 @@ var submit$4 = "Soumettre";
4068
4068
  var required$4 = "Champs obligatoires";
4069
4069
  var passwordUpdated = "Votre mot de passe a été mis à jour, veuillez vous connecter avec celui-ci";
4070
4070
  var passwordReset_fr = {
4071
- title: title$8,
4072
- subtitle: subtitle$2,
4071
+ title: title$a,
4072
+ subtitle: subtitle$4,
4073
4073
  email: email$2,
4074
4074
  password: password$2,
4075
4075
  confirmPassword: confirmPassword,
@@ -4078,7 +4078,7 @@ var passwordReset_fr = {
4078
4078
  passwordUpdated: passwordUpdated
4079
4079
  };
4080
4080
 
4081
- var title$7 = "Forgot your password?";
4081
+ var title$9 = "Forgot your password?";
4082
4082
  var email$1 = "Email";
4083
4083
  var password$1 = "Password";
4084
4084
  var submit$3 = "Submit";
@@ -4089,7 +4089,7 @@ var messages$b = {
4089
4089
  loginHere: "login here."
4090
4090
  };
4091
4091
  var passwordForgot_en = {
4092
- title: title$7,
4092
+ title: title$9,
4093
4093
  email: email$1,
4094
4094
  password: password$1,
4095
4095
  submit: submit$3,
@@ -4098,7 +4098,7 @@ var passwordForgot_en = {
4098
4098
  messages: messages$b
4099
4099
  };
4100
4100
 
4101
- var title$6 = "Mot de passe oublié ?";
4101
+ var title$8 = "Mot de passe oublié ?";
4102
4102
  var email = "Courriel";
4103
4103
  var password = "Mot de passe";
4104
4104
  var submit$2 = "Soumettre";
@@ -4109,7 +4109,7 @@ var messages$a = {
4109
4109
  loginHere: "Connectez-vous ici"
4110
4110
  };
4111
4111
  var passwordForgot_fr = {
4112
- title: title$6,
4112
+ title: title$8,
4113
4113
  email: email,
4114
4114
  password: password,
4115
4115
  submit: submit$2,
@@ -4118,7 +4118,7 @@ var passwordForgot_fr = {
4118
4118
  messages: messages$a
4119
4119
  };
4120
4120
 
4121
- var title$5 = "Change your password";
4121
+ var title$7 = "Change your password";
4122
4122
  var currentPassword$1 = "Current password";
4123
4123
  var newPassword$1 = "New password";
4124
4124
  var confirmNewPassword$1 = "Confirm new password";
@@ -4128,7 +4128,7 @@ var passwordChanged$1 = "Password has been changed, please login with the new pa
4128
4128
  var passwordsNotMatching$1 = "Passwords don't match";
4129
4129
  var weakPassword$1 = "Your password must contain at least 6 characters";
4130
4130
  var passwordChange_en = {
4131
- title: title$5,
4131
+ title: title$7,
4132
4132
  currentPassword: currentPassword$1,
4133
4133
  newPassword: newPassword$1,
4134
4134
  confirmNewPassword: confirmNewPassword$1,
@@ -4139,7 +4139,7 @@ var passwordChange_en = {
4139
4139
  weakPassword: weakPassword$1
4140
4140
  };
4141
4141
 
4142
- var title$4 = "Changez votre mot de passe";
4142
+ var title$6 = "Changez votre mot de passe";
4143
4143
  var currentPassword = "Mot de passe actuel";
4144
4144
  var newPassword = "Nouveau mot de passe";
4145
4145
  var confirmNewPassword = "Confirmer le nouveau mot de passe";
@@ -4149,7 +4149,7 @@ var passwordChanged = "Le mot de passe a été modifié, veuillez vous connecter
4149
4149
  var passwordsNotMatching = "Les mots de passe ne correspondent pas";
4150
4150
  var weakPassword = "Votre mot de passe doit contenir au moins 6";
4151
4151
  var passwordChange_fr = {
4152
- title: title$4,
4152
+ title: title$6,
4153
4153
  currentPassword: currentPassword,
4154
4154
  newPassword: newPassword,
4155
4155
  confirmNewPassword: confirmNewPassword,
@@ -4160,8 +4160,8 @@ var passwordChange_fr = {
4160
4160
  weakPassword: weakPassword
4161
4161
  };
4162
4162
 
4163
- var title$3 = "Votre panier";
4164
- var subtitle$1 = "Terminez votre achat ci-dessous";
4163
+ var title$5 = "Votre panier";
4164
+ var subtitle$3 = "Terminez votre achat ci-dessous";
4165
4165
  var name$1 = "Produit";
4166
4166
  var quantity$1 = "Quantité";
4167
4167
  var price$1 = "Prix";
@@ -4172,8 +4172,8 @@ var confirm$3 = "Passer à la caisse";
4172
4172
  var empty$1 = "Votre panier est vide.";
4173
4173
  var removeAll$1 = "Vider";
4174
4174
  var cart_fr = {
4175
- title: title$3,
4176
- subtitle: subtitle$1,
4175
+ title: title$5,
4176
+ subtitle: subtitle$3,
4177
4177
  name: name$1,
4178
4178
  quantity: quantity$1,
4179
4179
  price: price$1,
@@ -4185,8 +4185,8 @@ var cart_fr = {
4185
4185
  removeAll: removeAll$1
4186
4186
  };
4187
4187
 
4188
- var title$2 = "Your shopping cart";
4189
- var subtitle = "Comple your purchase below";
4188
+ var title$4 = "Your shopping cart";
4189
+ var subtitle$2 = "Comple your purchase below";
4190
4190
  var name = "Name";
4191
4191
  var quantity = "Quantity";
4192
4192
  var price = "Price";
@@ -4197,8 +4197,8 @@ var confirm$2 = "Checkout";
4197
4197
  var empty = "Your cart is empty.";
4198
4198
  var removeAll = "Remove all";
4199
4199
  var cart_en = {
4200
- title: title$2,
4201
- subtitle: subtitle,
4200
+ title: title$4,
4201
+ subtitle: subtitle$2,
4202
4202
  name: name,
4203
4203
  quantity: quantity,
4204
4204
  price: price,
@@ -4636,7 +4636,7 @@ var verifyEmail_fr = {
4636
4636
  messages: messages
4637
4637
  };
4638
4638
 
4639
- var title$1 = "Invoice details";
4639
+ var title$3 = "Invoice details";
4640
4640
  var labels$1 = {
4641
4641
  summary: "Summary",
4642
4642
  total: "Total",
@@ -4649,29 +4649,55 @@ var buttons$1 = {
4649
4649
  pay: "Pay now"
4650
4650
  };
4651
4651
  var invoiceDetails_en = {
4652
- title: title$1,
4652
+ title: title$3,
4653
4653
  labels: labels$1,
4654
4654
  buttons: buttons$1
4655
4655
  };
4656
4656
 
4657
- var title = "Invoice details";
4657
+ var title$2 = "Détails de la facture";
4658
4658
  var labels = {
4659
- summary: "Summary",
4659
+ summary: "Résumé",
4660
4660
  total: "Total",
4661
- amountPaid: "Amount paid",
4662
- amountDue: "Amount due",
4663
- creationDate: "Created on:"
4661
+ amountPaid: "Montant payé",
4662
+ amountDue: "Montant ",
4663
+ creationDate: "Créé le:"
4664
4664
  };
4665
4665
  var buttons = {
4666
- download: "Download",
4667
- pay: "Pay now"
4666
+ download: "Télécharger",
4667
+ pay: "Payer"
4668
4668
  };
4669
4669
  var invoiceDetails_fr = {
4670
- title: title,
4670
+ title: title$2,
4671
4671
  labels: labels,
4672
4672
  buttons: buttons
4673
4673
  };
4674
4674
 
4675
+ var title$1 = "Renewal options";
4676
+ var subtitle$1 = "Select one of the options below to continue";
4677
+ var next$1 = "Next";
4678
+ var addNew$1 = "Add Another Subscription";
4679
+ var renew$1 = "Renew Existing Subscription";
4680
+ var subscriptionOptions_en = {
4681
+ title: title$1,
4682
+ subtitle: subtitle$1,
4683
+ next: next$1,
4684
+ addNew: addNew$1,
4685
+ renew: renew$1
4686
+ };
4687
+
4688
+ var title = "Renewal options";
4689
+ var subtitle = "Select one of the options below to continue";
4690
+ var next = "Next";
4691
+ var addNew = "Add Another Subscription";
4692
+ var renew = "Renew Existing Subscription";
4693
+ var subscriptionOptions_fr = {
4694
+ title: title,
4695
+ subtitle: subtitle,
4696
+ next: next,
4697
+ addNew: addNew,
4698
+ renew: renew
4699
+ };
4700
+
4675
4701
  function create$1(createState) {
4676
4702
  let state;
4677
4703
  const listeners = new Set();
@@ -6021,7 +6047,7 @@ class PelcroActions {
6021
6047
  view,
6022
6048
  cartItems,
6023
6049
  ...otherStateFields
6024
- } = initialState$i;
6050
+ } = initialState$j;
6025
6051
  this.set(otherStateFields);
6026
6052
  });
6027
6053
 
@@ -6045,6 +6071,16 @@ class PelcroActions {
6045
6071
  });
6046
6072
  }
6047
6073
 
6074
+ if (view === "subscription-options") {
6075
+ const noRenewableProducts = getRenewableProducts().length === 0;
6076
+
6077
+ if (noRenewableProducts) {
6078
+ return this.set({
6079
+ view: "plan-select"
6080
+ });
6081
+ }
6082
+ }
6083
+
6048
6084
  this.set({
6049
6085
  view
6050
6086
  });
@@ -6119,6 +6155,26 @@ class PelcroActions {
6119
6155
  }
6120
6156
  });
6121
6157
 
6158
+ _defineProperty$3(this, "setProductsList", products => {
6159
+ if (!Array.isArray(products)) {
6160
+ return console.error(`setProductsList expects an array of products as an argument, got an argument of type ${typeof products} instead`);
6161
+ }
6162
+
6163
+ const allowedProducts = window.Pelcro.product.list();
6164
+ const validProducts = products.filter(product => {
6165
+ 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));
6166
+
6167
+ if (!isValidProduct) {
6168
+ 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);
6169
+ }
6170
+
6171
+ return isValidProduct;
6172
+ });
6173
+ this.set({
6174
+ productsList: validProducts
6175
+ });
6176
+ });
6177
+
6122
6178
  _defineProperty$3(this, "setProduct", id => {
6123
6179
  const product = window.Pelcro.product.getById(id);
6124
6180
  if (!product) return console.error("invalid product id");
@@ -6340,10 +6396,12 @@ class PelcroCallbacks {
6340
6396
 
6341
6397
  }
6342
6398
 
6343
- const initialState$i = {
6399
+ var _window$Pelcro$produc, _window$Pelcro;
6400
+ const initialState$j = {
6344
6401
  // View
6345
6402
  view: null,
6346
6403
  // Plans
6404
+ 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 : [],
6347
6405
  product: null,
6348
6406
  plan: null,
6349
6407
  isGift: false,
@@ -6370,7 +6428,7 @@ const createPelcroStore = () => createStore(middleware_3((set, get) => {
6370
6428
  return {
6371
6429
  // Store setter
6372
6430
  set,
6373
- ...initialState$i,
6431
+ ...initialState$j,
6374
6432
  // State actions
6375
6433
  ...actions,
6376
6434
  // Callbacks
@@ -6725,6 +6783,30 @@ function userMustVerifyEmail() {
6725
6783
  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;
6726
6784
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
6727
6785
  }
6786
+ function getRenewableProducts() {
6787
+ var _window$Pelcro$subscr, _window$Pelcro$subscr2;
6788
+
6789
+ 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 : [];
6790
+ const renewableProductsIds = [...new Set(renewableSubs.map(sub => sub.plan.product.id))];
6791
+ const renewablePlansIds = [...new Set(renewableSubs.map(sub => sub.plan.id))];
6792
+ const {
6793
+ productsList
6794
+ } = usePelcro.getStore();
6795
+ return productsList.map(product => {
6796
+ if (renewableProductsIds.includes(product.id)) {
6797
+ const renewablePlans = getRenewablePlansOnly(product);
6798
+ return { ...product,
6799
+ plans: renewablePlans
6800
+ };
6801
+ }
6802
+ }).filter(product => product);
6803
+
6804
+ function getRenewablePlansOnly(product) {
6805
+ var _product$plans$filter, _product$plans;
6806
+
6807
+ 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 : [];
6808
+ }
6809
+ }
6728
6810
 
6729
6811
  const resources = {
6730
6812
  en: {
@@ -6749,7 +6831,8 @@ const resources = {
6749
6831
  dashboard: dashboard_en,
6750
6832
  select: select_en,
6751
6833
  notification: notification_en,
6752
- invoiceDetails: invoiceDetails_en
6834
+ invoiceDetails: invoiceDetails_en,
6835
+ subscriptionOptions: subscriptionOptions_en
6753
6836
  },
6754
6837
  fr: {
6755
6838
  common: common_fr,
@@ -6773,7 +6856,8 @@ const resources = {
6773
6856
  dashboard: dashboard_fr,
6774
6857
  select: select_fr,
6775
6858
  notification: notification_fr,
6776
- invoiceDetails: invoiceDetails_fr
6859
+ invoiceDetails: invoiceDetails_fr,
6860
+ subscriptionOptions: subscriptionOptions_fr
6777
6861
  }
6778
6862
  }; // set UI language to the page language or default to the language in site settings
6779
6863
 
@@ -7064,8 +7148,8 @@ const saveToMetadataButton = new SaveToMetadataButtonClass();
7064
7148
 
7065
7149
  let e={data:""},t=t=>"undefined"!=typeof window?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||e,l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(})/g,a=/\/\*[^]*?\*\/|\s\s+|\n/g,n=(e,t)=>{let r,l="",a="",o="";for(let c in e){let s=e[c];"object"==typeof s?(r=t?t.replace(/([^,])+/g,e=>c.replace(/([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):c,a+="@"==c[0]?"f"==c[1]?n(s,c):c+"{"+n(s,"k"==c[1]?"":t)+"}":n(s,r)):"@"==c[0]&&"i"==c[1]?l=c+" "+s+";":(c=c.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=n.p?n.p(c,s):c+":"+s+";");}return o[0]?(r=t?t+"{"+o+"}":o,l+r+a):l+a},o={},c=e=>{let t="";for(let r in e)t+=r+("object"==typeof e[r]?c(e[r]):e[r]);return t},s=(e,t,r,s,i)=>{let p="object"==typeof e?c(e):e,u=o[p]||(o[p]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(p));if(!o[u]){let t="object"==typeof e?e:(e=>{let t,r=[{}];for(;t=l.exec(e.replace(a,""));)t[4]&&r.shift(),t[3]?r.unshift(r[0][t[3]]=r[0][t[3]]||{}):t[4]||(r[0][t[1]]=t[2]);return r[0]})(e);o[u]=n(i?{["@keyframes "+u]:t}:t,r?"":"."+u);}return ((e,t,r)=>{-1==t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(o[u],t,s),u},i=(e,t,r)=>e.reduce((e,l,a)=>{let o=t[a];if(o&&o.call){let e=o(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;o=t?"."+t:e&&"object"==typeof e?e.props?"":n(e,""):e;}return e+l+(null==o?"":o)},"");function p(e){let r=this||{},l=e.call?e(r.p):e;return s(l.unshift?l.raw?i(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>t?Object.assign(e,t.call?t(r.p):t):e,{}):l,t(r.target),r.g,r.o,r.k)}let u,f,d;p.bind({g:1});let b=p.bind({k:1});function h(e,t,r,l){n.p=t,u=e,f=r,d=l;}function y(e,t){let r=this||{};return function(){let l=arguments;function a(n,o){let c=Object.assign({},n),s=c.className||a.className;r.p=Object.assign({theme:f&&f()},c),r.o=/ *go\d+/.test(s),c.className=p.apply(r,l)+(s?" "+s:""),t&&(c.ref=o);let i=c.as||e;return d&&i[0]&&d(c),u(i,c)}return t?t(a):a}}
7066
7150
 
7067
- function _extends$y() {
7068
- _extends$y = Object.assign || function (target) {
7151
+ function _extends$A() {
7152
+ _extends$A = Object.assign || function (target) {
7069
7153
  for (var i = 1; i < arguments.length; i++) {
7070
7154
  var source = arguments[i];
7071
7155
 
@@ -7079,7 +7163,7 @@ function _extends$y() {
7079
7163
  return target;
7080
7164
  };
7081
7165
 
7082
- return _extends$y.apply(this, arguments);
7166
+ return _extends$A.apply(this, arguments);
7083
7167
  }
7084
7168
 
7085
7169
  function _taggedTemplateLiteralLoose(strings, raw) {
@@ -7169,7 +7253,7 @@ var clearFromRemoveQueue = function clearFromRemoveQueue(toastId) {
7169
7253
  var reducer = function reducer(state, action) {
7170
7254
  switch (action.type) {
7171
7255
  case ActionType.ADD_TOAST:
7172
- return _extends$y({}, state, {
7256
+ return _extends$A({}, state, {
7173
7257
  toasts: [action.toast].concat(state.toasts).slice(0, TOAST_LIMIT)
7174
7258
  });
7175
7259
 
@@ -7179,9 +7263,9 @@ var reducer = function reducer(state, action) {
7179
7263
  clearFromRemoveQueue(action.toast.id);
7180
7264
  }
7181
7265
 
7182
- return _extends$y({}, state, {
7266
+ return _extends$A({}, state, {
7183
7267
  toasts: state.toasts.map(function (t) {
7184
- return t.id === action.toast.id ? _extends$y({}, t, action.toast) : t;
7268
+ return t.id === action.toast.id ? _extends$A({}, t, action.toast) : t;
7185
7269
  })
7186
7270
  });
7187
7271
 
@@ -7208,9 +7292,9 @@ var reducer = function reducer(state, action) {
7208
7292
  });
7209
7293
  }
7210
7294
 
7211
- return _extends$y({}, state, {
7295
+ return _extends$A({}, state, {
7212
7296
  toasts: state.toasts.map(function (t) {
7213
- return t.id === toastId || toastId === undefined ? _extends$y({}, t, {
7297
+ return t.id === toastId || toastId === undefined ? _extends$A({}, t, {
7214
7298
  visible: false
7215
7299
  }) : t;
7216
7300
  })
@@ -7218,28 +7302,28 @@ var reducer = function reducer(state, action) {
7218
7302
 
7219
7303
  case ActionType.REMOVE_TOAST:
7220
7304
  if (action.toastId === undefined) {
7221
- return _extends$y({}, state, {
7305
+ return _extends$A({}, state, {
7222
7306
  toasts: []
7223
7307
  });
7224
7308
  }
7225
7309
 
7226
- return _extends$y({}, state, {
7310
+ return _extends$A({}, state, {
7227
7311
  toasts: state.toasts.filter(function (t) {
7228
7312
  return t.id !== action.toastId;
7229
7313
  })
7230
7314
  });
7231
7315
 
7232
7316
  case ActionType.START_PAUSE:
7233
- return _extends$y({}, state, {
7317
+ return _extends$A({}, state, {
7234
7318
  pausedAt: action.time
7235
7319
  });
7236
7320
 
7237
7321
  case ActionType.END_PAUSE:
7238
7322
  var diff = action.time - (state.pausedAt || 0);
7239
- return _extends$y({}, state, {
7323
+ return _extends$A({}, state, {
7240
7324
  pausedAt: undefined,
7241
7325
  toasts: state.toasts.map(function (t) {
7242
- return _extends$y({}, t, {
7326
+ return _extends$A({}, t, {
7243
7327
  pauseDuration: t.pauseDuration + diff
7244
7328
  });
7245
7329
  })
@@ -7286,12 +7370,12 @@ var useStore = function useStore(toastOptions) {
7286
7370
  var mergedToasts = state.toasts.map(function (t) {
7287
7371
  var _toastOptions$t$type, _toastOptions, _toastOptions$t$type2;
7288
7372
 
7289
- return _extends$y({}, toastOptions, toastOptions[t.type], t, {
7373
+ return _extends$A({}, toastOptions, toastOptions[t.type], t, {
7290
7374
  duration: t.duration || ((_toastOptions$t$type = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type.duration) || ((_toastOptions = toastOptions) == null ? void 0 : _toastOptions.duration) || defaultTimeouts[t.type],
7291
- style: _extends$y({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7375
+ style: _extends$A({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7292
7376
  });
7293
7377
  });
7294
- return _extends$y({}, state, {
7378
+ return _extends$A({}, state, {
7295
7379
  toasts: mergedToasts
7296
7380
  });
7297
7381
  };
@@ -7301,7 +7385,7 @@ var createToast = function createToast(message, type, opts) {
7301
7385
  type = 'blank';
7302
7386
  }
7303
7387
 
7304
- return _extends$y({
7388
+ return _extends$A({
7305
7389
  createdAt: Date.now(),
7306
7390
  visible: true,
7307
7391
  type: type,
@@ -7351,14 +7435,14 @@ toast.remove = function (toastId) {
7351
7435
  };
7352
7436
 
7353
7437
  toast.promise = function (promise, msgs, opts) {
7354
- var id = toast.loading(msgs.loading, _extends$y({}, opts, opts == null ? void 0 : opts.loading));
7438
+ var id = toast.loading(msgs.loading, _extends$A({}, opts, opts == null ? void 0 : opts.loading));
7355
7439
  promise.then(function (p) {
7356
- toast.success(resolveValue(msgs.success, p), _extends$y({
7440
+ toast.success(resolveValue(msgs.success, p), _extends$A({
7357
7441
  id: id
7358
7442
  }, opts, opts == null ? void 0 : opts.success));
7359
7443
  return p;
7360
7444
  })["catch"](function (e) {
7361
- toast.error(resolveValue(msgs.error, e), _extends$y({
7445
+ toast.error(resolveValue(msgs.error, e), _extends$A({
7362
7446
  id: id
7363
7447
  }, opts, opts == null ? void 0 : opts.error));
7364
7448
  });
@@ -7697,7 +7781,7 @@ var ToastBar = /*#__PURE__*/memo(function (_ref2) {
7697
7781
  var message = createElement(Message, Object.assign({}, toast.ariaProps), resolveValue(toast.message, toast));
7698
7782
  return createElement(ToastBarBase, {
7699
7783
  className: toast.className,
7700
- style: _extends$y({}, animationStyle, style, toast.style)
7784
+ style: _extends$A({}, animationStyle, style, toast.style)
7701
7785
  }, typeof children === 'function' ? children({
7702
7786
  icon: icon,
7703
7787
  message: message
@@ -7727,7 +7811,7 @@ var getPositionStyle = function getPositionStyle(position, offset) {
7727
7811
  } : position.includes('right') ? {
7728
7812
  justifyContent: 'flex-end'
7729
7813
  } : {};
7730
- return _extends$y({
7814
+ return _extends$A({
7731
7815
  left: 0,
7732
7816
  right: 0,
7733
7817
  display: 'flex',
@@ -7754,7 +7838,7 @@ var Toaster = function Toaster(_ref) {
7754
7838
  handlers = _useToaster.handlers;
7755
7839
 
7756
7840
  return createElement("div", {
7757
- style: _extends$y({
7841
+ style: _extends$A({
7758
7842
  position: 'fixed',
7759
7843
  zIndex: 9999,
7760
7844
  top: DEFAULT_OFFSET,
@@ -7789,82 +7873,82 @@ var Toaster = function Toaster(_ref) {
7789
7873
  }));
7790
7874
  };
7791
7875
 
7792
- var _path$v;
7876
+ var _path$x;
7793
7877
 
7794
- function _extends$x() { _extends$x = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$x.apply(this, arguments); }
7878
+ 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); }
7795
7879
 
7796
7880
  function SvgCheckSolid(props) {
7797
- return /*#__PURE__*/React.createElement("svg", _extends$x({
7881
+ return /*#__PURE__*/React.createElement("svg", _extends$z({
7798
7882
  xmlns: "http://www.w3.org/2000/svg",
7799
7883
  className: "h-5 w-5",
7800
7884
  viewBox: "0 0 20 20",
7801
7885
  fill: "currentColor"
7802
- }, props), _path$v || (_path$v = /*#__PURE__*/React.createElement("path", {
7886
+ }, props), _path$x || (_path$x = /*#__PURE__*/React.createElement("path", {
7803
7887
  fillRule: "evenodd",
7804
7888
  d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
7805
7889
  clipRule: "evenodd"
7806
7890
  })));
7807
7891
  }
7808
7892
 
7809
- var _path$u;
7893
+ var _path$w;
7810
7894
 
7811
- function _extends$w() { _extends$w = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$w.apply(this, arguments); }
7895
+ 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); }
7812
7896
 
7813
7897
  function SvgXIcon(props) {
7814
- return /*#__PURE__*/React.createElement("svg", _extends$w({
7898
+ return /*#__PURE__*/React.createElement("svg", _extends$y({
7815
7899
  xmlns: "http://www.w3.org/2000/svg",
7816
7900
  viewBox: "0 0 20 20",
7817
7901
  fill: "currentColor"
7818
- }, props), _path$u || (_path$u = /*#__PURE__*/React.createElement("path", {
7902
+ }, props), _path$w || (_path$w = /*#__PURE__*/React.createElement("path", {
7819
7903
  fill: "evenodd",
7820
7904
  d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
7821
7905
  clipRule: "evenodd"
7822
7906
  })));
7823
7907
  }
7824
7908
 
7825
- var _path$t;
7909
+ var _path$v;
7826
7910
 
7827
- function _extends$v() { _extends$v = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$v.apply(this, arguments); }
7911
+ 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); }
7828
7912
 
7829
7913
  function SvgXIconSolid(props) {
7830
- return /*#__PURE__*/React.createElement("svg", _extends$v({
7914
+ return /*#__PURE__*/React.createElement("svg", _extends$x({
7831
7915
  className: "plc-w-4 plc-h-4",
7832
7916
  fill: "currentColor",
7833
7917
  xmlns: "http://www.w3.org/2000/svg",
7834
7918
  viewBox: "0 0 100 100"
7835
- }, props), _path$t || (_path$t = /*#__PURE__*/React.createElement("path", {
7919
+ }, props), _path$v || (_path$v = /*#__PURE__*/React.createElement("path", {
7836
7920
  d: "M94.842 48.408c0 24.852-20.148 44.999-45.002 44.999-24.851 0-44.997-20.146-44.997-44.999 0-24.854 20.146-45 44.997-45 24.853 0 45.002 20.146 45.002 45zM71.073 64.841L54.73 48.497l16.344-16.344-4.979-4.979-16.343 16.345-16.343-16.344-4.799 4.799 16.344 16.344L28.61 64.661l4.979 4.978 16.344-16.344 16.343 16.344 4.797-4.798z"
7837
7921
  })));
7838
7922
  }
7839
7923
 
7840
- var _path$s;
7924
+ var _path$u;
7841
7925
 
7842
- function _extends$u() { _extends$u = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
7926
+ 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); }
7843
7927
 
7844
7928
  function SvgExclamation(props) {
7845
- return /*#__PURE__*/React.createElement("svg", _extends$u({
7929
+ return /*#__PURE__*/React.createElement("svg", _extends$w({
7846
7930
  className: "plc-w-4 plc-h-4 plc-mr-1",
7847
7931
  xmlns: "http://www.w3.org/2000/svg",
7848
7932
  viewBox: "0 0 20 20",
7849
7933
  fill: "currentColor"
7850
- }, props), _path$s || (_path$s = /*#__PURE__*/React.createElement("path", {
7934
+ }, props), _path$u || (_path$u = /*#__PURE__*/React.createElement("path", {
7851
7935
  fillRule: "evenodd",
7852
7936
  d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",
7853
7937
  clipRule: "evenodd"
7854
7938
  })));
7855
7939
  }
7856
7940
 
7857
- var _path$r, _path2$4;
7941
+ var _path$t, _path2$4;
7858
7942
 
7859
- function _extends$t() { _extends$t = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
7943
+ 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); }
7860
7944
 
7861
7945
  function SvgSpinner(props) {
7862
- return /*#__PURE__*/React.createElement("svg", _extends$t({
7946
+ return /*#__PURE__*/React.createElement("svg", _extends$v({
7863
7947
  className: "plc-animate-spin",
7864
7948
  viewBox: "0 0 24 24",
7865
7949
  fill: "currentColor",
7866
7950
  xmlns: "http://www.w3.org/2000/svg"
7867
- }, props), _path$r || (_path$r = /*#__PURE__*/React.createElement("path", {
7951
+ }, props), _path$t || (_path$t = /*#__PURE__*/React.createElement("path", {
7868
7952
  opacity: 0.2,
7869
7953
  fill: "evenodd",
7870
7954
  clipRule: "evenodd",
@@ -8154,7 +8238,9 @@ const init$1 = () => {
8154
8238
  return switchToAddressView();
8155
8239
  });
8156
8240
  } else {
8157
- pelcroSubscribeButtonsByClass[j].addEventListener("click", () => switchView("plan-select"));
8241
+ pelcroSubscribeButtonsByClass[j].addEventListener("click", () => {
8242
+ return switchView("subscription-options");
8243
+ });
8158
8244
  }
8159
8245
  }
8160
8246
  }
@@ -8316,7 +8402,8 @@ function Link({
8316
8402
  const init = () => {
8317
8403
  const {
8318
8404
  switchView,
8319
- set
8405
+ set,
8406
+ setProductsList
8320
8407
  } = usePelcro.getStore();
8321
8408
  const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
8322
8409
 
@@ -8367,7 +8454,8 @@ const init = () => {
8367
8454
  }
8368
8455
 
8369
8456
  notify.dismiss(NOTIFICATION_ID);
8370
- switchView("_plan-select-entitlements");
8457
+ setProductsList(window.Pelcro.product.getByEntitlements(entitlements));
8458
+ switchView("plan-select");
8371
8459
  }
8372
8460
  }, "Subscribe"), "now to get full page access.")), {
8373
8461
  className: "pelcro-notification-entitlement",
@@ -8619,6 +8707,10 @@ const getErrorMessages = error => {
8619
8707
  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;
8620
8708
  }
8621
8709
 
8710
+ if (error !== null && error !== void 0 && error.message) {
8711
+ return error.message;
8712
+ }
8713
+
8622
8714
  const errorMessages = []; // enumerable error (ex: validation errors)
8623
8715
 
8624
8716
  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]) => {
@@ -8657,7 +8749,7 @@ const debounce = (func, waitTime) => {
8657
8749
  function getSiteCardProcessor() {
8658
8750
  var _window$Pelcro$site$r;
8659
8751
 
8660
- if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_pay_page_id) {
8752
+ if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_gateway_settings) {
8661
8753
  return "vantiv";
8662
8754
  }
8663
8755
 
@@ -8753,7 +8845,7 @@ const loadPaymentSDKs = () => {
8753
8845
  } // Load Vantiv SDKs
8754
8846
 
8755
8847
 
8756
- const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_pay_page_id);
8848
+ const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
8757
8849
 
8758
8850
  if (supportsVantiv) {
8759
8851
  if (!window.jQuery) {
@@ -8761,7 +8853,10 @@ const loadPaymentSDKs = () => {
8761
8853
  }
8762
8854
 
8763
8855
  if (!window.EprotectIframeClient) {
8764
- window.Pelcro.helpers.loadSDK("https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js", "vantiv-eprotect-sdk");
8856
+ const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
8857
+ const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client4.min.js";
8858
+ const scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? PRODUCTION_URL : PRELIVE_URL;
8859
+ window.Pelcro.helpers.loadSDK(scriptUrlToUse, "vantiv-eprotect-sdk");
8765
8860
  }
8766
8861
  }
8767
8862
  };
@@ -8922,8 +9017,7 @@ const initViewFromURL = () => {
8922
9017
  }
8923
9018
 
8924
9019
  if (view === "invoice-details") {
8925
- // FIXME: commented out to remove from the release
8926
- return false; // return showInvoiceDetailsFromUrl();
9020
+ return showInvoiceDetailsFromUrl();
8927
9021
  }
8928
9022
 
8929
9023
  switchView(view);
@@ -9102,6 +9196,43 @@ const verifyEmailTokenFromUrl = () => {
9102
9196
  });
9103
9197
  };
9104
9198
 
9199
+ const showInvoiceDetailsFromUrl = () => {
9200
+ const {
9201
+ isAuthenticated,
9202
+ setInvoice,
9203
+ whenSiteReady,
9204
+ switchView
9205
+ } = usePelcro.getStore();
9206
+ whenSiteReady(() => {
9207
+ if (!isAuthenticated()) {
9208
+ return switchView("login");
9209
+ }
9210
+
9211
+ const invoiceId = window.Pelcro.helpers.getURLParameter("id");
9212
+ const wasSetSuccessfully = setInvoice(invoiceId);
9213
+
9214
+ if (!wasSetSuccessfully) {
9215
+ const errorMessage = i18next.t("messages:invalidInvoice", {
9216
+ returnObjects: true
9217
+ });
9218
+ return notify.error(errorMessage);
9219
+ }
9220
+
9221
+ const {
9222
+ invoice
9223
+ } = usePelcro.getStore();
9224
+
9225
+ if (invoice.total === 0) {
9226
+ const errorMessage = i18next.t("messages:zeroTotalInvoice", {
9227
+ returnObjects: true
9228
+ });
9229
+ return notify.error(errorMessage);
9230
+ }
9231
+
9232
+ return switchView("invoice-details");
9233
+ });
9234
+ };
9235
+
9105
9236
  const defaultOptions = {
9106
9237
  loadPaymentSDKs: true,
9107
9238
  loadAuth0SDK: true,
@@ -9159,7 +9290,7 @@ const PelcroModalController = ({
9159
9290
  type
9160
9291
  }) => (type === null || type === void 0 ? void 0 : type.viewId) === "dashboard-open"), React__default.Children.map(children, child => child).find(({
9161
9292
  type
9162
- }) => (type === null || type === void 0 ? void 0 : type.viewId) === "notification"), view === "_plan-select-entitlements" && React__default.Children.map(children, child => child).find(({
9293
+ }) => (type === null || type === void 0 ? void 0 : type.viewId) === "notification"), view === "_plan-select-renew" && React__default.Children.map(children, child => child).find(({
9163
9294
  type
9164
9295
  }) => (type === null || type === void 0 ? void 0 : type.viewId) === "plan-select"), React__default.Children.map(children, child => child).find(({
9165
9296
  type
@@ -9440,8 +9571,10 @@ const LOAD_PAYMENT_METHODS = "LOAD_PAYMENT_METHODS";
9440
9571
  const GET_NEWSLETTERS_FETCH = "GET_NEWSLETTERS_FETCH";
9441
9572
  const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
9442
9573
  const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
9574
+ const SWITCH_TO_RENEW = "SWITCH_TO_RENEW";
9575
+ const SWITCH_TO_NEW = "SWITCH_TO_NEW";
9443
9576
 
9444
- const initialState$h = {
9577
+ const initialState$i = {
9445
9578
  email: "",
9446
9579
  password: "",
9447
9580
  emailError: null,
@@ -9452,10 +9585,10 @@ const initialState$h = {
9452
9585
  content: ""
9453
9586
  }
9454
9587
  };
9455
- const store$h = /*#__PURE__*/createContext(initialState$h);
9588
+ const store$i = /*#__PURE__*/createContext(initialState$i);
9456
9589
  const {
9457
- Provider: Provider$h
9458
- } = store$h;
9590
+ Provider: Provider$i
9591
+ } = store$i;
9459
9592
 
9460
9593
  const LoginContainer = ({
9461
9594
  style,
@@ -9562,7 +9695,7 @@ const LoginContainer = ({
9562
9695
  });
9563
9696
 
9564
9697
  case RESET_LOGIN_FORM:
9565
- return initialState$h;
9698
+ return initialState$i;
9566
9699
 
9567
9700
  case DISABLE_LOGIN_BUTTON:
9568
9701
  return lib_7({ ...state,
@@ -9580,12 +9713,12 @@ const LoginContainer = ({
9580
9713
  default:
9581
9714
  return state;
9582
9715
  }
9583
- }, initialState$h);
9716
+ }, initialState$i);
9584
9717
  return /*#__PURE__*/React__default.createElement("div", {
9585
9718
  style: { ...style
9586
9719
  },
9587
9720
  className: `pelcro-container pelcro-login-container ${className}`
9588
- }, /*#__PURE__*/React__default.createElement(Provider$h, {
9721
+ }, /*#__PURE__*/React__default.createElement(Provider$i, {
9589
9722
  value: {
9590
9723
  state,
9591
9724
  dispatch
@@ -9593,12 +9726,12 @@ const LoginContainer = ({
9593
9726
  }, children.length ? children.map((child, i) => {
9594
9727
  if (child) {
9595
9728
  return /*#__PURE__*/React__default.cloneElement(child, {
9596
- store: store$h,
9729
+ store: store$i,
9597
9730
  key: i
9598
9731
  });
9599
9732
  }
9600
9733
  }) : /*#__PURE__*/React__default.cloneElement(children, {
9601
- store: store$h
9734
+ store: store$i
9602
9735
  })));
9603
9736
  };
9604
9737
 
@@ -9843,7 +9976,7 @@ const LoginButton = ({
9843
9976
  buttonDisabled
9844
9977
  },
9845
9978
  dispatch
9846
- } = useContext(store$h);
9979
+ } = useContext(store$i);
9847
9980
  const {
9848
9981
  t
9849
9982
  } = useTranslation("login");
@@ -9864,23 +9997,23 @@ const LoginButton = ({
9864
9997
  };
9865
9998
 
9866
9999
  const LoginEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
9867
- store: store$h
10000
+ store: store$i
9868
10001
  }, props));
9869
10002
 
9870
10003
  const LoginPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
9871
- store: store$h
10004
+ store: store$i
9872
10005
  }, props));
9873
10006
 
9874
- var _path$q;
10007
+ var _path$s;
9875
10008
 
9876
- 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); }
10009
+ 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); }
9877
10010
 
9878
10011
  function SvgCheck(props) {
9879
- return /*#__PURE__*/React.createElement("svg", _extends$s({
10012
+ return /*#__PURE__*/React.createElement("svg", _extends$u({
9880
10013
  xmlns: "http://www.w3.org/2000/svg",
9881
10014
  fill: "currentColor",
9882
10015
  viewBox: "0 0 20 20"
9883
- }, props), _path$q || (_path$q = /*#__PURE__*/React.createElement("path", {
10016
+ }, props), _path$s || (_path$s = /*#__PURE__*/React.createElement("path", {
9884
10017
  fillRule: "evenodd",
9885
10018
  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",
9886
10019
  clipRule: "evenodd"
@@ -9945,7 +10078,7 @@ var facebookLoginRenderProps = createCommonjsModule(function (module, exports) {
9945
10078
  var FacebookLogin = unwrapExports(facebookLoginRenderProps);
9946
10079
  facebookLoginRenderProps.FacebookLogin;
9947
10080
 
9948
- const initialState$g = {
10081
+ const initialState$h = {
9949
10082
  email: "",
9950
10083
  password: "",
9951
10084
  emailError: null,
@@ -9962,10 +10095,10 @@ const initialState$g = {
9962
10095
  content: ""
9963
10096
  }
9964
10097
  };
9965
- const store$g = /*#__PURE__*/createContext(initialState$g);
10098
+ const store$h = /*#__PURE__*/createContext(initialState$h);
9966
10099
  const {
9967
- Provider: Provider$g
9968
- } = store$g;
10100
+ Provider: Provider$h
10101
+ } = store$h;
9969
10102
 
9970
10103
  const RegisterContainer = ({
9971
10104
  style,
@@ -10148,7 +10281,7 @@ const RegisterContainer = ({
10148
10281
  });
10149
10282
 
10150
10283
  case RESET_LOGIN_FORM:
10151
- return initialState$g;
10284
+ return initialState$h;
10152
10285
 
10153
10286
  case DISABLE_REGISTRATION_BUTTON:
10154
10287
  return lib_7({ ...state,
@@ -10166,12 +10299,12 @@ const RegisterContainer = ({
10166
10299
  default:
10167
10300
  return state;
10168
10301
  }
10169
- }, initialState$g);
10302
+ }, initialState$h);
10170
10303
  return /*#__PURE__*/React__default.createElement("div", {
10171
10304
  style: { ...style
10172
10305
  },
10173
10306
  className: `pelcro-container pelcro-register-container ${className}`
10174
- }, /*#__PURE__*/React__default.createElement(Provider$g, {
10307
+ }, /*#__PURE__*/React__default.createElement(Provider$h, {
10175
10308
  value: {
10176
10309
  state,
10177
10310
  dispatch
@@ -10179,12 +10312,12 @@ const RegisterContainer = ({
10179
10312
  }, children.length ? children.map((child, i) => {
10180
10313
  if (child) {
10181
10314
  return /*#__PURE__*/React__default.cloneElement(child, {
10182
- store: store$g,
10315
+ store: store$h,
10183
10316
  key: i
10184
10317
  });
10185
10318
  }
10186
10319
  }) : /*#__PURE__*/React__default.cloneElement(children, {
10187
- store: store$g
10320
+ store: store$h
10188
10321
  })));
10189
10322
  };
10190
10323
  /**
@@ -10199,15 +10332,15 @@ function hasSecurityTokenEnabled$1() {
10199
10332
  return hasSecuritySdkLoaded;
10200
10333
  }
10201
10334
 
10202
- var _path$p;
10335
+ var _path$r;
10203
10336
 
10204
- 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); }
10337
+ 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); }
10205
10338
 
10206
10339
  function SvgFacebookLogo(props) {
10207
- return /*#__PURE__*/React.createElement("svg", _extends$r({
10340
+ return /*#__PURE__*/React.createElement("svg", _extends$t({
10208
10341
  xmlns: "http://www.w3.org/2000/svg",
10209
10342
  viewBox: "88.428 12.828 107.543 207.085"
10210
- }, props), _path$p || (_path$p = /*#__PURE__*/React.createElement("path", {
10343
+ }, props), _path$r || (_path$r = /*#__PURE__*/React.createElement("path", {
10211
10344
  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",
10212
10345
  fill: "#3c5a9a"
10213
10346
  })));
@@ -10224,10 +10357,10 @@ const FacebookLoginButton = ({
10224
10357
  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;
10225
10358
  const {
10226
10359
  dispatch: loginDispatch
10227
- } = useContext(store$h);
10360
+ } = useContext(store$i);
10228
10361
  const {
10229
10362
  dispatch: registerDispatch
10230
- } = useContext(store$g);
10363
+ } = useContext(store$h);
10231
10364
 
10232
10365
  const onSuccess = facebookUser => {
10233
10366
  loginDispatch === null || loginDispatch === void 0 ? void 0 : loginDispatch({
@@ -10280,15 +10413,15 @@ var googleLogin = createCommonjsModule(function (module, exports) {
10280
10413
  unwrapExports(googleLogin);
10281
10414
  var googleLogin_1 = googleLogin.GoogleLogin;
10282
10415
 
10283
- var _path$o, _path2$3, _path3$1, _path4;
10416
+ var _path$q, _path2$3, _path3$1, _path4;
10284
10417
 
10285
- 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); }
10418
+ 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); }
10286
10419
 
10287
10420
  function SvgGoogleLogo(props) {
10288
- return /*#__PURE__*/React.createElement("svg", _extends$q({
10421
+ return /*#__PURE__*/React.createElement("svg", _extends$s({
10289
10422
  viewBox: "0 0 24 24",
10290
10423
  xmlns: "http://www.w3.org/2000/svg"
10291
- }, props), _path$o || (_path$o = /*#__PURE__*/React.createElement("path", {
10424
+ }, props), _path$q || (_path$q = /*#__PURE__*/React.createElement("path", {
10292
10425
  fill: "#4285F4",
10293
10426
  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"
10294
10427
  })), _path2$3 || (_path2$3 = /*#__PURE__*/React.createElement("path", {
@@ -10314,10 +10447,10 @@ const GoogleLoginButton = ({
10314
10447
  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;
10315
10448
  const {
10316
10449
  dispatch: loginDispatch
10317
- } = useContext(store$h);
10450
+ } = useContext(store$i);
10318
10451
  const {
10319
10452
  dispatch: registerDispatch
10320
- } = useContext(store$g);
10453
+ } = useContext(store$h);
10321
10454
 
10322
10455
  const onSuccess = response => {
10323
10456
  var _response$getAuthResp, _profile$getEmail, _profile$getGivenName, _profile$getFamilyNam, _profile$getEmail2, _profile$getGivenName2, _profile$getFamilyNam2;
@@ -10365,15 +10498,15 @@ const GoogleLoginButton = ({
10365
10498
  }) : null;
10366
10499
  };
10367
10500
 
10368
- var _path$n;
10501
+ var _path$p;
10369
10502
 
10370
- 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); }
10503
+ 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); }
10371
10504
 
10372
10505
  function SvgAuth0Logo(props) {
10373
- return /*#__PURE__*/React.createElement("svg", _extends$p({
10506
+ return /*#__PURE__*/React.createElement("svg", _extends$r({
10374
10507
  viewBox: "0 0 256 285",
10375
10508
  xmlns: "http://www.w3.org/2000/svg"
10376
- }, props), _path$n || (_path$n = /*#__PURE__*/React.createElement("path", {
10509
+ }, props), _path$p || (_path$p = /*#__PURE__*/React.createElement("path", {
10377
10510
  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"
10378
10511
  })));
10379
10512
  }
@@ -10413,10 +10546,10 @@ const Auth0LoginButton = ({
10413
10546
  }, [auth0Enabled, auth0Loaded]);
10414
10547
  const {
10415
10548
  dispatch: loginDispatch
10416
- } = useContext(store$h);
10549
+ } = useContext(store$i);
10417
10550
  const {
10418
10551
  dispatch: registerDispatch
10419
- } = useContext(store$g);
10552
+ } = useContext(store$h);
10420
10553
 
10421
10554
  function handleClick() {
10422
10555
  var _auth0InstanceRef$cur, _auth0InstanceRef$cur2, _auth0InstanceRef$cur3;
@@ -10549,15 +10682,15 @@ function LoginView(props) {
10549
10682
  }, /*#__PURE__*/React__default.createElement(GoogleLoginButton, null), /*#__PURE__*/React__default.createElement(FacebookLoginButton, null), /*#__PURE__*/React__default.createElement(Auth0LoginButton, null))))));
10550
10683
  }
10551
10684
 
10552
- var _path$m, _path2$2, _path3;
10685
+ var _path$o, _path2$2, _path3;
10553
10686
 
10554
- 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); }
10687
+ 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); }
10555
10688
 
10556
10689
  function SvgPelcroAuthorship(props) {
10557
- return /*#__PURE__*/React.createElement("svg", _extends$o({
10690
+ return /*#__PURE__*/React.createElement("svg", _extends$q({
10558
10691
  xmlns: "http://www.w3.org/2000/svg",
10559
10692
  viewBox: "0 -80.652 497.072 179.991"
10560
- }, props), _path$m || (_path$m = /*#__PURE__*/React.createElement("path", {
10693
+ }, props), _path$o || (_path$o = /*#__PURE__*/React.createElement("path", {
10561
10694
  fill: "none",
10562
10695
  stroke: "#4a4a4a",
10563
10696
  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"
@@ -10704,11 +10837,11 @@ function LoginModal({
10704
10837
  LoginModal.viewId = "login";
10705
10838
 
10706
10839
  const RegisterEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
10707
- store: store$g
10840
+ store: store$h
10708
10841
  }, props));
10709
10842
 
10710
10843
  const RegisterPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
10711
- store: store$g
10844
+ store: store$h
10712
10845
  }, props));
10713
10846
 
10714
10847
  const RegisterButton = ({
@@ -10728,7 +10861,7 @@ const RegisterButton = ({
10728
10861
  buttonDisabled
10729
10862
  },
10730
10863
  dispatch
10731
- } = useContext(store$g);
10864
+ } = useContext(store$h);
10732
10865
  const {
10733
10866
  t
10734
10867
  } = useTranslation("register");
@@ -10866,7 +10999,7 @@ function FirstName({
10866
10999
  }
10867
11000
 
10868
11001
  const RegisterFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
10869
- store: store$g
11002
+ store: store$h
10870
11003
  }, props));
10871
11004
 
10872
11005
  function LastName({
@@ -10897,7 +11030,7 @@ function LastName({
10897
11030
  }
10898
11031
 
10899
11032
  const RegisterLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
10900
- store: store$g
11033
+ store: store$h
10901
11034
  }, props));
10902
11035
 
10903
11036
  /**
@@ -11021,7 +11154,7 @@ function TextInput({
11021
11154
 
11022
11155
  const RegisterTextInput = props => {
11023
11156
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
11024
- store: store$g
11157
+ store: store$h
11025
11158
  }));
11026
11159
  };
11027
11160
 
@@ -11168,6 +11301,7 @@ function SelectModalWithHook(props) {
11168
11301
  (_props$onDisplay = props.onDisplay) === null || _props$onDisplay === void 0 ? void 0 : _props$onDisplay.call(props);
11169
11302
  }, []);
11170
11303
  const {
11304
+ productsList,
11171
11305
  isGift,
11172
11306
  plan,
11173
11307
  product,
@@ -11177,11 +11311,12 @@ function SelectModalWithHook(props) {
11177
11311
  view,
11178
11312
  set
11179
11313
  } = usePelcro();
11180
- const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
11181
- const entitlements = entitlementsProtectedElements.length > 0 ? getEntitlementsFromElem(entitlementsProtectedElements[0]) : null;
11314
+ const isRenewingSub = view === "_plan-select-renew";
11182
11315
  return /*#__PURE__*/React__default.createElement(SelectModalWithTrans, {
11316
+ productsList: productsList,
11183
11317
  isGift: isGift,
11184
- disableGifting: isRenewingGift,
11318
+ disableGifting: isRenewingGift || isRenewingSub,
11319
+ isRenewingSub: isRenewingSub,
11185
11320
  plan: plan,
11186
11321
  product: product,
11187
11322
  onClose: () => {
@@ -11195,8 +11330,10 @@ function SelectModalWithHook(props) {
11195
11330
  plan,
11196
11331
  isGift
11197
11332
  }),
11198
- setView: switchView,
11199
- matchingEntitlements: view === "_plan-select-entitlements" ? entitlements : null
11333
+ setSubscriptionIdToRenew: subscriptionIdToRenew => set({
11334
+ subscriptionIdToRenew
11335
+ }),
11336
+ setView: switchView
11200
11337
  });
11201
11338
  }
11202
11339
  SelectModalWithHook.viewId = "plan-select";
@@ -11228,10 +11365,10 @@ class SelectModal extends Component {
11228
11365
  });
11229
11366
  }
11230
11367
 
11231
- if (this.state.productList.length === 1) {
11368
+ if (this.props.productsList.length === 1) {
11232
11369
  this.setState({
11233
- product: this.state.productList[0],
11234
- planList: this.state.productList[0].plans,
11370
+ product: this.props.productsList[0],
11371
+ planList: this.props.productsList[0].plans,
11235
11372
  mode: "plan"
11236
11373
  });
11237
11374
  }
@@ -11248,7 +11385,7 @@ class SelectModal extends Component {
11248
11385
  });
11249
11386
 
11250
11387
  _defineProperty$3(this, "onProductChange", e => {
11251
- const product = window.Pelcro.product.list()[e.target.selectedIndex];
11388
+ const product = productsList[e.target.selectedIndex];
11252
11389
  this.setState({
11253
11390
  product: product,
11254
11391
  plan: product.plans[0]
@@ -11314,7 +11451,7 @@ class SelectModal extends Component {
11314
11451
 
11315
11452
  _defineProperty$3(this, "renderProducts", () => {
11316
11453
  const userDidSelectProduct = Boolean(this.state.mode === "plan");
11317
- const productsToShow = userDidSelectProduct ? [this.state.product] : this.state.productList;
11454
+ const productsToShow = userDidSelectProduct ? [this.state.product] : this.props.productsList;
11318
11455
  return productsToShow.map((product, index) => {
11319
11456
  return this.renderOneProduct(product, index);
11320
11457
  });
@@ -11327,7 +11464,7 @@ class SelectModal extends Component {
11327
11464
  return this.renderOneProduct(this.state.product);
11328
11465
  }
11329
11466
 
11330
- const [productsThatMatchArticleTag, allProductsMinusMatched] = productsWithMatchedTaggedFirst(); // Render normal products if there are no available matching products
11467
+ const [productsThatMatchArticleTag, allProductsMinusMatched] = productsWithMatchedTaggedFirst(this.props.productsList); // Render normal products if there are no available matching products
11331
11468
 
11332
11469
  if (!(productsThatMatchArticleTag !== null && productsThatMatchArticleTag !== void 0 && productsThatMatchArticleTag.length)) {
11333
11470
  return this.renderProducts();
@@ -11343,10 +11480,7 @@ class SelectModal extends Component {
11343
11480
  className: "plc-text-sm plc-font-semibold"
11344
11481
  }, this.locale("labels.restrictiveArticles.or")), allProductsMinusMatched.map((product, index) => this.renderOneProduct(product, index))));
11345
11482
 
11346
- function productsWithMatchedTaggedFirst() {
11347
- var _window$Pelcro$produc;
11348
-
11349
- const allProducts = (_window$Pelcro$produc = window.Pelcro.product.list()) !== null && _window$Pelcro$produc !== void 0 ? _window$Pelcro$produc : [];
11483
+ function productsWithMatchedTaggedFirst(allProducts) {
11350
11484
  const productsThatMatchArticleTag = window.Pelcro.product.getByMatchingPageTags();
11351
11485
  const allProductsMinusMatched = allProducts.filter(product => !productsThatMatchArticleTag.some(matchedProduct => matchedProduct.id === product.id));
11352
11486
  return [productsThatMatchArticleTag, allProductsMinusMatched];
@@ -11380,7 +11514,7 @@ class SelectModal extends Component {
11380
11514
  _defineProperty$3(this, "selectProduct", e => {
11381
11515
  const id = e.target.dataset.key;
11382
11516
 
11383
- for (const product of this.state.productList) {
11517
+ for (const product of this.props.productsList) {
11384
11518
  if (+product.id === +id) {
11385
11519
  var _this$state$plan;
11386
11520
 
@@ -11433,6 +11567,14 @@ class SelectModal extends Component {
11433
11567
 
11434
11568
  _defineProperty$3(this, "submitOption", () => {
11435
11569
  this.props.setProductAndPlan(this.state.product, this.state.plan, this.state.isGift);
11570
+
11571
+ if (this.props.isRenewingSub) {
11572
+ var _matchingSub$id;
11573
+
11574
+ const matchingSub = window.Pelcro.subscription.list().find(sub => sub.plan.id === this.state.plan.id && sub.status === "active" && sub.cancel_at_period_end === 1);
11575
+ this.props.setSubscriptionIdToRenew((_matchingSub$id = matchingSub === null || matchingSub === void 0 ? void 0 : matchingSub.id) !== null && _matchingSub$id !== void 0 ? _matchingSub$id : null);
11576
+ }
11577
+
11436
11578
  const {
11437
11579
  product,
11438
11580
  isGift
@@ -11470,8 +11612,7 @@ class SelectModal extends Component {
11470
11612
  plan: {},
11471
11613
  isGift: props.isGift,
11472
11614
  disabled: true,
11473
- mode: "product",
11474
- productList: props.matchingEntitlements ? window.Pelcro.product.getByEntitlements(props.matchingEntitlements) : window.Pelcro.product.list()
11615
+ mode: "product"
11475
11616
  };
11476
11617
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
11477
11618
  this.locale = this.props.t;
@@ -11479,7 +11620,7 @@ class SelectModal extends Component {
11479
11620
  }
11480
11621
 
11481
11622
  render() {
11482
- var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
11623
+ var _this$props$productsL, _this$props$productsL2, _window$Pelcro$site$r;
11483
11624
 
11484
11625
  const {
11485
11626
  disableGifting
@@ -11513,7 +11654,7 @@ class SelectModal extends Component {
11513
11654
  className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
11514
11655
  }, /*#__PURE__*/React__default.createElement("h4", {
11515
11656
  className: "plc-text-2xl plc-font-semibold"
11516
- }, 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.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.createElement("div", {
11657
+ }, 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.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.createElement("div", {
11517
11658
  className: "pelcro-select-products-wrapper"
11518
11659
  }, (_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.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
11519
11660
  className: "plc-overflow-y-scroll plc-max-h-72 pelcro-select-plans-wrapper"
@@ -12677,20 +12818,21 @@ var es_12 = es.injectStripe;
12677
12818
  var es_13 = es.StripeProvider;
12678
12819
 
12679
12820
  /**
12680
- * @TODO: All subscription related business logic should end up moving
12821
+ * @TODO: All payment related business logic should end up moving
12681
12822
  * to this service, and out of react components.
12682
12823
  */
12683
12824
 
12684
12825
  /**
12685
- * Enum for subscription types
12826
+ * Enum for payment types
12686
12827
  * @readonly
12687
12828
  * @enum {string}
12688
12829
  */
12689
- const SUBSCRIPTION_TYPES = {
12830
+ const PAYMENT_TYPES = {
12690
12831
  CREATE_SUBSCRIPTION: "CREATE_SUBSCRIPTION",
12691
12832
  CREATE_GIFTED_SUBSCRIPTION: "CREATE_GIFTED_SUBSCRIPTION",
12692
12833
  RENEW_SUBSCRIPTION: "RENEW_SUBSCRIPTION",
12693
12834
  RENEW_GIFTED_SUBSCRIPTION: "RENEW_GIFTED_SUBSCRIPTION",
12835
+ PURCHASE_ECOMMERCE_ORDER: "PURCHASE_ECOMMERCE_ORDER",
12694
12836
  PAY_INVOICE: "PAY_INVOICE"
12695
12837
  };
12696
12838
 
@@ -12698,9 +12840,8 @@ var _isPaymentGatewayInvalid = /*#__PURE__*/new WeakMap();
12698
12840
 
12699
12841
  var _generateUserError = /*#__PURE__*/new WeakMap();
12700
12842
 
12701
- class Subscription {
12843
+ class Payment {
12702
12844
  /**
12703
- * Subscription service constructor
12704
12845
  * @param {(StripeGateway|PaypalGateway|VantivGateway)} paymentGateway
12705
12846
  */
12706
12847
  constructor(paymentGateway) {
@@ -12712,7 +12853,7 @@ class Subscription {
12712
12853
 
12713
12854
  if (!options.type) {
12714
12855
  callback(_classPrivateFieldGet(this, _generateUserError).call(this), null);
12715
- return console.error("No subscription type provided");
12856
+ return console.error("No payment type provided");
12716
12857
  } // delegate execution to paymentgateway
12717
12858
 
12718
12859
 
@@ -12730,21 +12871,21 @@ class Subscription {
12730
12871
  writable: true,
12731
12872
  value: () => {
12732
12873
  return {
12733
- error: new Error("An error has occured in the subscription service, please try again later")
12874
+ error: new Error("An error has occured in the payment service, please try again later")
12734
12875
  };
12735
12876
  }
12736
12877
  });
12737
12878
 
12738
12879
  if (_classPrivateFieldGet(this, _isPaymentGatewayInvalid).call(this, paymentGateway)) {
12739
12880
  this.paymentGateway = null;
12740
- console.error("Incompatible subscription gateway");
12881
+ console.error("Incompatible payment gateway");
12741
12882
  } else {
12742
12883
  this.paymentGateway = paymentGateway;
12743
12884
  }
12744
12885
  }
12745
12886
  /**
12746
- * @typedef subscriptionOptions
12747
- * @property {SUBSCRIPTION_TYPES} type
12887
+ * @typedef paymentOptions
12888
+ * @property {PAYMENT_TYPES} type
12748
12889
  * @property {string} token
12749
12890
  * @property {object} plan
12750
12891
  * @property {object} [product]
@@ -12755,6 +12896,7 @@ class Subscription {
12755
12896
  * @property {string} addressId
12756
12897
  * @property {number} invoiceId
12757
12898
  * @property {boolean} isExistingSource
12899
+ * @property {Array} items
12758
12900
  */
12759
12901
 
12760
12902
  /**
@@ -12765,8 +12907,8 @@ class Subscription {
12765
12907
  */
12766
12908
 
12767
12909
  /**
12768
- * Subscription execution method
12769
- * @param {subscriptionOptions} options subscription options
12910
+ * Payment execution method
12911
+ * @param {paymentOptions} options payment options
12770
12912
  * @param {executeCallback} callback
12771
12913
  * @return {void}
12772
12914
  */
@@ -12779,7 +12921,7 @@ const PAYMENT_GATEWAYS_ENUM = {
12779
12921
  vantiv: "vantiv"
12780
12922
  };
12781
12923
  /**
12782
- * Subscription Strategies
12924
+ * Payment Strategies
12783
12925
  */
12784
12926
 
12785
12927
  /**
@@ -12796,6 +12938,8 @@ var _renewSubscription = /*#__PURE__*/new WeakMap();
12796
12938
 
12797
12939
  var _renewGiftedSubscription = /*#__PURE__*/new WeakMap();
12798
12940
 
12941
+ var _purchaseEcommerceOrder = /*#__PURE__*/new WeakMap();
12942
+
12799
12943
  var _payInvoice = /*#__PURE__*/new WeakMap();
12800
12944
 
12801
12945
  class StripeGateway {
@@ -12806,7 +12950,7 @@ class StripeGateway {
12806
12950
  });
12807
12951
 
12808
12952
  _defineProperty$3(this, "execute", (options, callback) => {
12809
- const types = SUBSCRIPTION_TYPES;
12953
+ const types = PAYMENT_TYPES;
12810
12954
 
12811
12955
  switch (options.type) {
12812
12956
  case types.CREATE_SUBSCRIPTION:
@@ -12821,11 +12965,14 @@ class StripeGateway {
12821
12965
  case types.RENEW_GIFTED_SUBSCRIPTION:
12822
12966
  return _classPrivateFieldGet(this, _renewGiftedSubscription).call(this, options, callback);
12823
12967
 
12968
+ case types.PURCHASE_ECOMMERCE_ORDER:
12969
+ return _classPrivateFieldGet(this, _purchaseEcommerceOrder).call(this, options, callback);
12970
+
12824
12971
  case types.PAY_INVOICE:
12825
12972
  return _classPrivateFieldGet(this, _payInvoice).call(this, options, callback);
12826
12973
 
12827
12974
  default:
12828
- console.error("Unsupported subscriptiion method: Stripe Gateway");
12975
+ console.error("Unsupported payment method: Stripe Gateway");
12829
12976
  }
12830
12977
  });
12831
12978
 
@@ -12847,6 +12994,7 @@ class StripeGateway {
12847
12994
  auth_token: window.Pelcro.user.read().auth_token,
12848
12995
  plan_id: plan.id,
12849
12996
  coupon_code: couponCode,
12997
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
12850
12998
  address_id: product.address_required ? addressId : null
12851
12999
  }, (err, res) => {
12852
13000
  callback(err, res);
@@ -12873,6 +13021,7 @@ class StripeGateway {
12873
13021
  auth_token: window.Pelcro.user.read().auth_token,
12874
13022
  plan_id: plan.id,
12875
13023
  coupon_code: couponCode,
13024
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
12876
13025
  gift_recipient_email: giftRecipient.email,
12877
13026
  gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
12878
13027
  gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
@@ -12900,6 +13049,7 @@ class StripeGateway {
12900
13049
  stripe_token: token,
12901
13050
  auth_token: window.Pelcro.user.read().auth_token,
12902
13051
  plan_id: plan.id,
13052
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
12903
13053
  coupon_code: couponCode,
12904
13054
  subscription_id: subscriptionIdToRenew,
12905
13055
  address_id: product.address_required ? addressId : null
@@ -12933,6 +13083,36 @@ class StripeGateway {
12933
13083
  }
12934
13084
  });
12935
13085
 
13086
+ _purchaseEcommerceOrder.set(this, {
13087
+ writable: true,
13088
+ value: (options, callback) => {
13089
+ const {
13090
+ token,
13091
+ items,
13092
+ couponCode,
13093
+ addressId,
13094
+ isExistingSource
13095
+ } = options;
13096
+ const params = isExistingSource ? {
13097
+ source_id: token
13098
+ } : {
13099
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway),
13100
+ gateway_token: token
13101
+ };
13102
+ window.Pelcro.ecommerce.order.create({
13103
+ items,
13104
+ coupon_code: couponCode,
13105
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13106
+ ...params,
13107
+ ...(addressId && {
13108
+ address_id: addressId
13109
+ })
13110
+ }, (err, res) => {
13111
+ callback(err, res);
13112
+ });
13113
+ }
13114
+ });
13115
+
12936
13116
  _payInvoice.set(this, {
12937
13117
  writable: true,
12938
13118
  value: (options, callback) => {
@@ -12976,7 +13156,7 @@ class PaypalGateway {
12976
13156
  });
12977
13157
 
12978
13158
  _defineProperty$3(this, "execute", (options, callback) => {
12979
- const types = SUBSCRIPTION_TYPES;
13159
+ const types = PAYMENT_TYPES;
12980
13160
 
12981
13161
  switch (options.type) {
12982
13162
  case types.CREATE_SUBSCRIPTION:
@@ -13010,6 +13190,7 @@ class PaypalGateway {
13010
13190
  payment_gateway: _classPrivateFieldGet(this, _paymentGateway2),
13011
13191
  auth_token: window.Pelcro.user.read().auth_token,
13012
13192
  plan_id: plan.id,
13193
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13013
13194
  coupon_code: couponCode,
13014
13195
  address_id: product.address_required ? addressId : null
13015
13196
  }, (err, res) => {
@@ -13037,6 +13218,7 @@ class PaypalGateway {
13037
13218
  auth_token: window.Pelcro.user.read().auth_token,
13038
13219
  plan_id: plan.id,
13039
13220
  coupon_code: couponCode,
13221
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13040
13222
  gift_recipient_email: giftRecipient.email,
13041
13223
  gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
13042
13224
  gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
@@ -13073,6 +13255,16 @@ var _paymentGateway3 = /*#__PURE__*/new WeakMap();
13073
13255
 
13074
13256
  var _createSubscription3 = /*#__PURE__*/new WeakMap();
13075
13257
 
13258
+ var _renewSubscription2 = /*#__PURE__*/new WeakMap();
13259
+
13260
+ var _createGiftedSubscription3 = /*#__PURE__*/new WeakMap();
13261
+
13262
+ var _renewGiftedSubscription2 = /*#__PURE__*/new WeakMap();
13263
+
13264
+ var _purchaseEcommerceOrder2 = /*#__PURE__*/new WeakMap();
13265
+
13266
+ var _payInvoice3 = /*#__PURE__*/new WeakMap();
13267
+
13076
13268
  class VantivGateway {
13077
13269
  constructor() {
13078
13270
  _paymentGateway3.set(this, {
@@ -13081,16 +13273,31 @@ class VantivGateway {
13081
13273
  });
13082
13274
 
13083
13275
  _defineProperty$3(this, "execute", (options, callback) => {
13084
- const types = SUBSCRIPTION_TYPES;
13276
+ const types = PAYMENT_TYPES;
13085
13277
 
13086
13278
  switch (options.type) {
13087
13279
  case types.CREATE_SUBSCRIPTION:
13088
13280
  return _classPrivateFieldGet(this, _createSubscription3).call(this, options, callback);
13089
13281
 
13090
- default:
13091
- console.error("Unsupported subscriptiion method: vantiv Gateway");
13092
- }
13093
- });
13282
+ case types.RENEW_SUBSCRIPTION:
13283
+ return _classPrivateFieldGet(this, _renewSubscription2).call(this, options, callback);
13284
+
13285
+ case types.CREATE_GIFTED_SUBSCRIPTION:
13286
+ return _classPrivateFieldGet(this, _createGiftedSubscription3).call(this, options, callback);
13287
+
13288
+ case types.RENEW_GIFTED_SUBSCRIPTION:
13289
+ return _classPrivateFieldGet(this, _renewGiftedSubscription2).call(this, options, callback);
13290
+
13291
+ case types.PURCHASE_ECOMMERCE_ORDER:
13292
+ return _classPrivateFieldGet(this, _purchaseEcommerceOrder2).call(this, options, callback);
13293
+
13294
+ case types.PAY_INVOICE:
13295
+ return _classPrivateFieldGet(this, _payInvoice3).call(this, options, callback);
13296
+
13297
+ default:
13298
+ console.error("Unsupported payment method: vantiv Gateway");
13299
+ }
13300
+ });
13094
13301
 
13095
13302
  _createSubscription3.set(this, {
13096
13303
  writable: true,
@@ -13101,21 +13308,180 @@ class VantivGateway {
13101
13308
  couponCode,
13102
13309
  product,
13103
13310
  quantity = 1,
13104
- addressId
13311
+ addressId,
13312
+ isExistingSource
13105
13313
  } = options;
13314
+ const params = isExistingSource ? {
13315
+ source_id: token
13316
+ } : {
13317
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13318
+ gateway_token: token
13319
+ };
13106
13320
  window.Pelcro.subscription.create({
13107
13321
  quantity,
13108
- gateway_token: token,
13322
+ auth_token: window.Pelcro.user.read().auth_token,
13323
+ plan_id: plan.id,
13324
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13325
+ coupon_code: couponCode,
13326
+ address_id: product.address_required ? addressId : null,
13327
+ ...params
13328
+ }, (err, res) => {
13329
+ callback(err, res);
13330
+ });
13331
+ }
13332
+ });
13333
+
13334
+ _renewSubscription2.set(this, {
13335
+ writable: true,
13336
+ value: (options, callback) => {
13337
+ const {
13338
+ subscriptionIdToRenew,
13339
+ token,
13340
+ plan,
13341
+ couponCode,
13342
+ product,
13343
+ addressId,
13344
+ isExistingSource
13345
+ } = options;
13346
+ const params = isExistingSource ? {
13347
+ source_id: token
13348
+ } : {
13109
13349
  payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13350
+ gateway_token: token
13351
+ };
13352
+ window.Pelcro.subscription.renew({
13110
13353
  auth_token: window.Pelcro.user.read().auth_token,
13111
13354
  plan_id: plan.id,
13112
13355
  coupon_code: couponCode,
13113
- address_id: product.address_required ? addressId : null
13356
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13357
+ subscription_id: subscriptionIdToRenew,
13358
+ address_id: product.address_required ? addressId : null,
13359
+ ...params
13114
13360
  }, (err, res) => {
13115
13361
  callback(err, res);
13116
13362
  });
13117
13363
  }
13118
13364
  });
13365
+
13366
+ _createGiftedSubscription3.set(this, {
13367
+ writable: true,
13368
+ value: (options, callback) => {
13369
+ const {
13370
+ token,
13371
+ plan,
13372
+ couponCode,
13373
+ product,
13374
+ giftRecipient,
13375
+ quantity = 1,
13376
+ addressId,
13377
+ isExistingSource
13378
+ } = options;
13379
+ const params = isExistingSource ? {
13380
+ source_id: token
13381
+ } : {
13382
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13383
+ gateway_token: token
13384
+ };
13385
+ window.Pelcro.subscription.create({
13386
+ quantity,
13387
+ auth_token: window.Pelcro.user.read().auth_token,
13388
+ plan_id: plan.id,
13389
+ coupon_code: couponCode,
13390
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13391
+ gift_recipient_email: giftRecipient.email,
13392
+ gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
13393
+ gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
13394
+ gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
13395
+ gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
13396
+ address_id: product.address_required ? addressId : null,
13397
+ ...params
13398
+ }, (err, res) => {
13399
+ callback(err, res);
13400
+ });
13401
+ }
13402
+ });
13403
+
13404
+ _renewGiftedSubscription2.set(this, {
13405
+ writable: true,
13406
+ value: (options, callback) => {
13407
+ const {
13408
+ subscriptionIdToRenew,
13409
+ token,
13410
+ product,
13411
+ plan,
13412
+ couponCode,
13413
+ addressId,
13414
+ isExistingSource
13415
+ } = options;
13416
+ const params = isExistingSource ? {
13417
+ source_id: token
13418
+ } : {
13419
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13420
+ gateway_token: token
13421
+ };
13422
+ window.Pelcro.subscription.renewGift({
13423
+ auth_token: window.Pelcro.user.read().auth_token,
13424
+ plan_id: plan.id,
13425
+ coupon_code: couponCode,
13426
+ subscription_id: subscriptionIdToRenew,
13427
+ address_id: product.address_required ? addressId : null,
13428
+ ...params
13429
+ }, (err, res) => {
13430
+ callback(err, res);
13431
+ });
13432
+ }
13433
+ });
13434
+
13435
+ _purchaseEcommerceOrder2.set(this, {
13436
+ writable: true,
13437
+ value: (options, callback) => {
13438
+ const {
13439
+ token,
13440
+ items,
13441
+ couponCode,
13442
+ addressId,
13443
+ isExistingSource
13444
+ } = options;
13445
+ const params = isExistingSource ? {
13446
+ source_id: token
13447
+ } : {
13448
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13449
+ gateway_token: token
13450
+ };
13451
+ window.Pelcro.ecommerce.order.create({
13452
+ items,
13453
+ coupon_code: couponCode,
13454
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13455
+ ...params,
13456
+ ...(addressId && {
13457
+ address_id: addressId
13458
+ })
13459
+ }, (err, res) => {
13460
+ callback(err, res);
13461
+ });
13462
+ }
13463
+ });
13464
+
13465
+ _payInvoice3.set(this, {
13466
+ writable: true,
13467
+ value: (options, callback) => {
13468
+ const {
13469
+ token,
13470
+ invoiceId
13471
+ } = options;
13472
+ const params = options.isExistingSource ? {
13473
+ source_id: token,
13474
+ invoice_id: invoiceId
13475
+ } : {
13476
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13477
+ gateway_token: token,
13478
+ invoice_id: invoiceId
13479
+ };
13480
+ window.Pelcro.invoice.pay(params, (err, res) => {
13481
+ callback(err, res);
13482
+ });
13483
+ }
13484
+ });
13119
13485
  }
13120
13486
 
13121
13487
  }
@@ -13140,7 +13506,7 @@ class VantivGateway {
13140
13506
 
13141
13507
  /** @type {PaymentStateType} */
13142
13508
 
13143
- const initialState$f = {
13509
+ const initialState$g = {
13144
13510
  disableSubmit: false,
13145
13511
  isLoading: false,
13146
13512
  disableCouponButton: false,
@@ -13159,10 +13525,10 @@ const initialState$f = {
13159
13525
  content: ""
13160
13526
  }
13161
13527
  };
13162
- const store$f = /*#__PURE__*/createContext(initialState$f);
13528
+ const store$g = /*#__PURE__*/createContext(initialState$g);
13163
13529
  const {
13164
- Provider: Provider$f
13165
- } = store$f;
13530
+ Provider: Provider$g
13531
+ } = store$g;
13166
13532
 
13167
13533
  const PaymentMethodContainerWithoutStripe = ({
13168
13534
  style,
@@ -13175,7 +13541,7 @@ const PaymentMethodContainerWithoutStripe = ({
13175
13541
  onFailure = () => {},
13176
13542
  ...props
13177
13543
  }) => {
13178
- var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isRenewingGift, _props$invoice;
13544
+ var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice;
13179
13545
 
13180
13546
  const {
13181
13547
  t
@@ -13191,6 +13557,7 @@ const PaymentMethodContainerWithoutStripe = ({
13191
13557
  const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
13192
13558
  const selectedAddressId = (_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : pelcroStore.selectedAddressId;
13193
13559
  const giftRecipient = (_props$giftRecipient = props.giftRecipient) !== null && _props$giftRecipient !== void 0 ? _props$giftRecipient : pelcroStore.giftRecipient;
13560
+ const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
13194
13561
  const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
13195
13562
  const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
13196
13563
  useEffect(() => {
@@ -13207,60 +13574,185 @@ const PaymentMethodContainerWithoutStripe = ({
13207
13574
  updateTotalAmountWithTax();
13208
13575
  }, []);
13209
13576
 
13210
- function submitVantivPayment() {
13577
+ const submitUsingVantiv = () => {
13578
+ const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
13579
+
13580
+ if (isUsingExistingPaymentMethod) {
13581
+ // no need to create a new source using vantiv
13582
+ return handleVantivPayment(null);
13583
+ }
13584
+
13211
13585
  if (!vantivInstanceRef.current) {
13212
13586
  return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
13213
13587
  }
13214
13588
 
13215
- const orderId = `pelcro-${new Date().getTime()}`; // calls handleVantivPayment
13589
+ const orderId = `pelcro-${new Date().getTime()}`;
13590
+ /*
13591
+ calls handleVantivPayment to either handle a payment or update a source by simply creating a new source
13592
+ */
13216
13593
 
13217
13594
  vantivInstanceRef.current.getPaypageRegistrationId({
13218
13595
  id: orderId,
13219
13596
  orderId: orderId
13220
13597
  });
13221
- }
13598
+ };
13222
13599
 
13223
13600
  function handleVantivPayment(paymentRequest) {
13224
- const SUCCESS_STATUS = "870";
13601
+ if (paymentRequest) {
13602
+ const SUCCESS_STATUS = "870";
13225
13603
 
13226
- if (paymentRequest.response !== SUCCESS_STATUS) {
13227
- return handlePaymentError({
13228
- error: new Error(paymentRequest.message)
13604
+ if (paymentRequest.response !== SUCCESS_STATUS) {
13605
+ return handlePaymentError({
13606
+ error: new Error(paymentRequest.message)
13607
+ });
13608
+ }
13609
+ }
13610
+
13611
+ const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
13612
+
13613
+ if (type === "createPayment") {
13614
+ handleVantivSubscription();
13615
+ } else if (type === "orderCreate") {
13616
+ purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
13617
+ } else if (type === "invoicePayment") {
13618
+ payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
13619
+ } else if (type === "updatePaymentSource") {
13620
+ createNewVantivCard();
13621
+ }
13622
+
13623
+ function createNewVantivCard() {
13624
+ window.Pelcro.source.create({
13625
+ auth_token: window.Pelcro.user.read().auth_token,
13626
+ token: paymentRequest,
13627
+ gateway: "vantiv"
13628
+ }, (err, res) => {
13629
+ dispatch({
13630
+ type: DISABLE_SUBMIT,
13631
+ payload: false
13632
+ });
13633
+ dispatch({
13634
+ type: LOADING,
13635
+ payload: false
13636
+ });
13637
+
13638
+ if (err) {
13639
+ onFailure(err);
13640
+ return dispatch({
13641
+ type: SHOW_ALERT,
13642
+ payload: {
13643
+ type: "error",
13644
+ content: getErrorMessages(err)
13645
+ }
13646
+ });
13647
+ }
13648
+
13649
+ dispatch({
13650
+ type: SHOW_ALERT,
13651
+ payload: {
13652
+ type: "success",
13653
+ content: t("messages.sourceUpdated")
13654
+ }
13655
+ });
13656
+ onSuccess(res);
13229
13657
  });
13230
13658
  }
13231
13659
 
13232
- const subscription = new Subscription(new VantivGateway());
13233
- const {
13234
- couponCode
13235
- } = state;
13236
- return subscription.execute({
13237
- type: SUBSCRIPTION_TYPES.CREATE_SUBSCRIPTION,
13238
- token: paymentRequest,
13239
- quantity: plan.quantity,
13240
- plan,
13241
- couponCode,
13242
- product,
13243
- addressId: selectedAddressId
13244
- }, (err, res) => {
13245
- if (err) {
13246
- return handlePaymentError(err);
13247
- }
13660
+ function handleVantivSubscription() {
13661
+ const payment = new Payment(new VantivGateway());
13662
+ const createSubscription = !isGift && !subscriptionIdToRenew;
13663
+ const renewSubscription = !isGift && subscriptionIdToRenew;
13664
+ const giftSubscriprition = isGift && !subscriptionIdToRenew;
13665
+ const renewGift = isRenewingGift;
13666
+ const {
13667
+ couponCode
13668
+ } = state;
13248
13669
 
13249
- onSuccess(res);
13250
- });
13670
+ if (renewGift) {
13671
+ return payment.execute({
13672
+ type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
13673
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13674
+ plan,
13675
+ couponCode,
13676
+ product,
13677
+ isExistingSource: isUsingExistingPaymentMethod,
13678
+ subscriptionIdToRenew,
13679
+ addressId: selectedAddressId
13680
+ }, (err, res) => {
13681
+ if (err) {
13682
+ return handlePaymentError(err);
13683
+ }
13684
+
13685
+ onSuccess(res);
13686
+ });
13687
+ } else if (giftSubscriprition) {
13688
+ return payment.execute({
13689
+ type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
13690
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13691
+ quantity: plan.quantity,
13692
+ plan,
13693
+ couponCode,
13694
+ product,
13695
+ isExistingSource: isUsingExistingPaymentMethod,
13696
+ giftRecipient,
13697
+ addressId: selectedAddressId
13698
+ }, (err, res) => {
13699
+ if (err) {
13700
+ return handlePaymentError(err);
13701
+ }
13702
+
13703
+ onSuccess(res);
13704
+ });
13705
+ } else if (renewSubscription) {
13706
+ return payment.execute({
13707
+ type: PAYMENT_TYPES.RENEW_SUBSCRIPTION,
13708
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13709
+ quantity: plan.quantity,
13710
+ plan,
13711
+ couponCode,
13712
+ product,
13713
+ isExistingSource: isUsingExistingPaymentMethod,
13714
+ subscriptionIdToRenew,
13715
+ addressId: selectedAddressId
13716
+ }, (err, res) => {
13717
+ if (err) {
13718
+ return handlePaymentError(err);
13719
+ }
13720
+
13721
+ onSuccess(res);
13722
+ });
13723
+ } else if (createSubscription) {
13724
+ return payment.execute({
13725
+ type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
13726
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13727
+ quantity: plan.quantity,
13728
+ plan,
13729
+ couponCode,
13730
+ product,
13731
+ isExistingSource: isUsingExistingPaymentMethod,
13732
+ addressId: selectedAddressId
13733
+ }, (err, res) => {
13734
+ if (err) {
13735
+ return handlePaymentError(err);
13736
+ }
13737
+
13738
+ onSuccess(res);
13739
+ });
13740
+ }
13741
+ }
13251
13742
  }
13252
13743
 
13253
13744
  const vantivInstanceRef = React__default.useRef(null);
13254
13745
  useEffect(() => {
13255
13746
  const cardProcessor = getSiteCardProcessor();
13256
13747
 
13257
- if (cardProcessor === "vantiv") {
13258
- var _window$Pelcro$site$r;
13748
+ if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
13749
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
13259
13750
 
13260
- const payPageId = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_pay_page_id;
13751
+ 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;
13752
+ 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;
13261
13753
  vantivInstanceRef.current = new window.EprotectIframeClient({
13262
13754
  paypageId: payPageId,
13263
- reportGroup: payPageId,
13755
+ reportGroup: reportGroup,
13264
13756
  style: "pelcro",
13265
13757
  height: "245",
13266
13758
  timeout: 50000,
@@ -13277,7 +13769,7 @@ const PaymentMethodContainerWithoutStripe = ({
13277
13769
  }
13278
13770
  });
13279
13771
  }
13280
- }, []);
13772
+ }, [selectedPaymentMethodId]);
13281
13773
 
13282
13774
  const initPaymentRequest = (state, dispatch) => {
13283
13775
  try {
@@ -13349,9 +13841,9 @@ const PaymentMethodContainerWithoutStripe = ({
13349
13841
 
13350
13842
 
13351
13843
  const updateTotalAmountWithTax = () => {
13352
- var _window$Pelcro$site$r2;
13844
+ var _window$Pelcro$site$r3;
13353
13845
 
13354
- 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;
13846
+ 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;
13355
13847
 
13356
13848
  if (taxesEnabled && type === "createPayment") {
13357
13849
  dispatch({
@@ -13508,6 +14000,7 @@ const PaymentMethodContainerWithoutStripe = ({
13508
14000
  window.Pelcro.order.create({
13509
14001
  auth_token: window.Pelcro.user.read().auth_token,
13510
14002
  plan_id: plan.id,
14003
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13511
14004
  coupon_code: couponCode,
13512
14005
  address_id: selectedAddressId
13513
14006
  }, handleCouponResponse);
@@ -13589,6 +14082,7 @@ const PaymentMethodContainerWithoutStripe = ({
13589
14082
  stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
13590
14083
  auth_token: window.Pelcro.user.read().auth_token,
13591
14084
  plan_id: plan.id,
14085
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13592
14086
  quantity: plan.quantity,
13593
14087
  coupon_code: couponCode,
13594
14088
  gift_recipient_email: giftRecipient ? giftRecipient.email : null,
@@ -13660,6 +14154,7 @@ const PaymentMethodContainerWithoutStripe = ({
13660
14154
  stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
13661
14155
  auth_token: window.Pelcro.user.read().auth_token,
13662
14156
  plan_id: plan.id,
14157
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13663
14158
  coupon_code: couponCode,
13664
14159
  subscription_id: subscriptionIdToRenew,
13665
14160
  address_id: product.address_required ? selectedAddressId : null
@@ -13701,7 +14196,7 @@ const PaymentMethodContainerWithoutStripe = ({
13701
14196
 
13702
14197
 
13703
14198
  const handlePaypalSubscription = (state, paypalNonce) => {
13704
- const subscription = new Subscription(new PaypalGateway());
14199
+ const payment = new Payment(new PaypalGateway());
13705
14200
  const {
13706
14201
  couponCode
13707
14202
  } = state;
@@ -13710,8 +14205,8 @@ const PaymentMethodContainerWithoutStripe = ({
13710
14205
  */
13711
14206
 
13712
14207
  if (giftRecipient) {
13713
- return subscription.execute({
13714
- type: SUBSCRIPTION_TYPES.CREATE_GIFTED_SUBSCRIPTION,
14208
+ return payment.execute({
14209
+ type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
13715
14210
  token: paypalNonce,
13716
14211
  quantity: plan.quantity,
13717
14212
  plan,
@@ -13744,8 +14239,8 @@ const PaymentMethodContainerWithoutStripe = ({
13744
14239
  });
13745
14240
  }
13746
14241
 
13747
- return subscription.execute({
13748
- type: SUBSCRIPTION_TYPES.CREATE_SUBSCRIPTION,
14242
+ return payment.execute({
14243
+ type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
13749
14244
  token: paypalNonce,
13750
14245
  quantity: plan.quantity,
13751
14246
  plan,
@@ -13777,7 +14272,7 @@ const PaymentMethodContainerWithoutStripe = ({
13777
14272
  });
13778
14273
  };
13779
14274
 
13780
- const purchase = (stripeSource, state, dispatch) => {
14275
+ const purchase = (gatewayService, gatewayToken, state, dispatch) => {
13781
14276
  const isQuickPurchase = !Array.isArray(order);
13782
14277
  const mappedOrderItems = isQuickPurchase ? [{
13783
14278
  sku_id: order.id,
@@ -13789,14 +14284,14 @@ const PaymentMethodContainerWithoutStripe = ({
13789
14284
  const {
13790
14285
  couponCode
13791
14286
  } = state;
13792
- window.Pelcro.ecommerce.order.create({
13793
- source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
13794
- stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
14287
+ const payment = new Payment(gatewayService);
14288
+ payment.execute({
14289
+ type: PAYMENT_TYPES.PURCHASE_ECOMMERCE_ORDER,
14290
+ token: gatewayToken,
14291
+ isExistingSource: Boolean(selectedPaymentMethodId),
13795
14292
  items: mappedOrderItems,
13796
- coupon_code: couponCode,
13797
- ...(selectedAddressId && {
13798
- address_id: selectedAddressId
13799
- })
14293
+ addressId: selectedAddressId,
14294
+ couponCode
13800
14295
  }, (err, res) => {
13801
14296
  dispatch({
13802
14297
  type: DISABLE_SUBMIT,
@@ -13834,9 +14329,9 @@ const PaymentMethodContainerWithoutStripe = ({
13834
14329
  };
13835
14330
 
13836
14331
  const payInvoice = (gatewayService, gatewayToken, dispatch) => {
13837
- const subscription = new Subscription(gatewayService);
13838
- return subscription.execute({
13839
- type: SUBSCRIPTION_TYPES.PAY_INVOICE,
14332
+ const payment = new Payment(gatewayService);
14333
+ return payment.execute({
14334
+ type: PAYMENT_TYPES.PAY_INVOICE,
13840
14335
  token: gatewayToken,
13841
14336
  isExistingSource: Boolean(selectedPaymentMethodId),
13842
14337
  invoiceId: invoice.id
@@ -13881,7 +14376,9 @@ const PaymentMethodContainerWithoutStripe = ({
13881
14376
 
13882
14377
  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") {
13883
14378
  return handlePaymentError({
13884
- message: t("messages.cardAuthNotSupported")
14379
+ error: {
14380
+ message: t("messages.cardAuthNotSupported")
14381
+ }
13885
14382
  });
13886
14383
  }
13887
14384
 
@@ -13996,13 +14493,13 @@ const PaymentMethodContainerWithoutStripe = ({
13996
14493
 
13997
14494
 
13998
14495
  const resolveTaxCalculation = () => {
13999
- var _window$Pelcro$site$r3;
14496
+ var _window$Pelcro$site$r4;
14000
14497
 
14001
14498
  if (type === "invoicePayment") {
14002
14499
  return new Promise(resolve => resolve());
14003
14500
  }
14004
14501
 
14005
- 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;
14502
+ 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;
14006
14503
  return new Promise((resolve, reject) => {
14007
14504
  // resolve early if taxes isn't enabled
14008
14505
  if (!taxesEnabled) {
@@ -14012,6 +14509,7 @@ const PaymentMethodContainerWithoutStripe = ({
14012
14509
  window.Pelcro.order.create({
14013
14510
  auth_token: window.Pelcro.user.read().auth_token,
14014
14511
  plan_id: plan.id,
14512
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
14015
14513
  coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
14016
14514
  address_id: selectedAddressId
14017
14515
  }, (error, res) => {
@@ -14074,7 +14572,7 @@ const PaymentMethodContainerWithoutStripe = ({
14074
14572
  if (stripeSource && type === "createPayment") {
14075
14573
  subscribe(stripeSource, state, dispatch);
14076
14574
  } else if (stripeSource && type === "orderCreate") {
14077
- purchase(stripeSource, state, dispatch);
14575
+ purchase(new StripeGateway(), stripeSource.id, state, dispatch);
14078
14576
  } else if (stripeSource && type === "invoicePayment") {
14079
14577
  payInvoice(new StripeGateway(), stripeSource.id, dispatch);
14080
14578
  }
@@ -14125,7 +14623,9 @@ const PaymentMethodContainerWithoutStripe = ({
14125
14623
 
14126
14624
  if ((source === null || source === void 0 ? void 0 : source.status) === "failed") {
14127
14625
  return handlePaymentError({
14128
- message: t("messages.cardAuthFailed")
14626
+ error: {
14627
+ message: t("messages.cardAuthFailed")
14628
+ }
14129
14629
  });
14130
14630
  }
14131
14631
 
@@ -14196,6 +14696,10 @@ const PaymentMethodContainerWithoutStripe = ({
14196
14696
  disableSubmit: true,
14197
14697
  isLoading: true
14198
14698
  }, (state, dispatch) => {
14699
+ if (getSiteCardProcessor() === "vantiv") {
14700
+ return submitUsingVantiv();
14701
+ }
14702
+
14199
14703
  if (selectedPaymentMethodId) {
14200
14704
  // pay with selected method (source) if exists already
14201
14705
  return handlePayment({
@@ -14208,10 +14712,6 @@ const PaymentMethodContainerWithoutStripe = ({
14208
14712
  return updatePaymentSource(state, dispatch);
14209
14713
  }
14210
14714
 
14211
- if (getSiteCardProcessor() === "vantiv") {
14212
- return submitVantivPayment();
14213
- }
14214
-
14215
14715
  submitPayment(state);
14216
14716
  });
14217
14717
 
@@ -14280,21 +14780,21 @@ const PaymentMethodContainerWithoutStripe = ({
14280
14780
  default:
14281
14781
  return state;
14282
14782
  }
14283
- }, initialState$f);
14783
+ }, initialState$g);
14284
14784
  return /*#__PURE__*/React__default.createElement("div", {
14285
14785
  style: { ...style
14286
14786
  },
14287
14787
  className: `pelcro-container pelcro-payment-container ${className}`
14288
- }, /*#__PURE__*/React__default.createElement(Provider$f, {
14788
+ }, /*#__PURE__*/React__default.createElement(Provider$g, {
14289
14789
  value: {
14290
14790
  state,
14291
14791
  dispatch
14292
14792
  }
14293
14793
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
14294
- store: store$f,
14794
+ store: store$g,
14295
14795
  key: i
14296
14796
  })) : /*#__PURE__*/React__default.cloneElement(children, {
14297
- store: store$f
14797
+ store: store$g
14298
14798
  })));
14299
14799
  };
14300
14800
 
@@ -14316,7 +14816,7 @@ const PaymentMethodContainer = props => {
14316
14816
  stripeAccount: window.Pelcro.site.read().account_id,
14317
14817
  locale: getPageOrDefaultLanguage()
14318
14818
  }, /*#__PURE__*/React__default.createElement(es_11, null, /*#__PURE__*/React__default.createElement(UnwrappedForm, Object.assign({
14319
- store: store$f
14819
+ store: store$g
14320
14820
  }, props))));
14321
14821
  }
14322
14822
 
@@ -14369,7 +14869,7 @@ const PelcroPaymentRequestButton = props => {
14369
14869
  currentPlan,
14370
14870
  updatedPrice
14371
14871
  }
14372
- } = useContext(store$f);
14872
+ } = useContext(store$g);
14373
14873
 
14374
14874
  const updatePaymentRequest = () => {
14375
14875
  // Make sure payment request is up to date, eg. user added a coupon code.
@@ -14445,7 +14945,7 @@ const DiscountedPrice = props => {
14445
14945
  taxAmount,
14446
14946
  percentOff
14447
14947
  }
14448
- } = useContext(store$f);
14948
+ } = useContext(store$g);
14449
14949
  const {
14450
14950
  order,
14451
14951
  plan
@@ -14495,7 +14995,7 @@ const SubmitPaymentMethod = ({
14495
14995
  isLoading,
14496
14996
  updatedPrice
14497
14997
  }
14498
- } = useContext(store$f);
14998
+ } = useContext(store$g);
14499
14999
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
14500
15000
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
14501
15001
  const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
@@ -14516,17 +15016,17 @@ const SubmitPaymentMethod = ({
14516
15016
  }, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
14517
15017
  };
14518
15018
 
14519
- var _path$l;
15019
+ var _path$n;
14520
15020
 
14521
- 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); }
15021
+ 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); }
14522
15022
 
14523
15023
  function SvgArrowLeft(props) {
14524
- return /*#__PURE__*/React.createElement("svg", _extends$n({
15024
+ return /*#__PURE__*/React.createElement("svg", _extends$p({
14525
15025
  xmlns: "http://www.w3.org/2000/svg",
14526
15026
  fill: "none",
14527
15027
  viewBox: "0 0 24 24",
14528
15028
  stroke: "currentColor"
14529
- }, props), _path$l || (_path$l = /*#__PURE__*/React.createElement("path", {
15029
+ }, props), _path$n || (_path$n = /*#__PURE__*/React.createElement("path", {
14530
15030
  strokeLinecap: "round",
14531
15031
  strokeLinejoin: "round",
14532
15032
  strokeWidth: 2,
@@ -14545,7 +15045,7 @@ const ApplyCouponButton = ({
14545
15045
  disableCouponButton
14546
15046
  },
14547
15047
  dispatch
14548
- } = useContext(store$f);
15048
+ } = useContext(store$g);
14549
15049
  const {
14550
15050
  t
14551
15051
  } = useTranslation("checkoutForm");
@@ -14579,7 +15079,7 @@ const CouponCodeField = props => {
14579
15079
  couponCode,
14580
15080
  couponError
14581
15081
  }
14582
- } = useContext(store$f);
15082
+ } = useContext(store$g);
14583
15083
 
14584
15084
  const onCouponCodeChange = e => {
14585
15085
  dispatch({
@@ -14608,17 +15108,17 @@ const CouponCodeField = props => {
14608
15108
  }, props));
14609
15109
  };
14610
15110
 
14611
- var _path$k;
15111
+ var _path$m;
14612
15112
 
14613
- 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); }
15113
+ 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); }
14614
15114
 
14615
15115
  function SvgTicket(props) {
14616
- return /*#__PURE__*/React.createElement("svg", _extends$m({
15116
+ return /*#__PURE__*/React.createElement("svg", _extends$o({
14617
15117
  xmlns: "http://www.w3.org/2000/svg",
14618
15118
  fill: "none",
14619
15119
  viewBox: "0 0 24 24",
14620
15120
  stroke: "currentColor"
14621
- }, props), _path$k || (_path$k = /*#__PURE__*/React.createElement("path", {
15121
+ }, props), _path$m || (_path$m = /*#__PURE__*/React.createElement("path", {
14622
15122
  strokeLinecap: "round",
14623
15123
  strokeLinejoin: "round",
14624
15124
  strokeWidth: 2,
@@ -14635,7 +15135,7 @@ const CouponCode = ({
14635
15135
  state: {
14636
15136
  enableCouponField
14637
15137
  }
14638
- } = useContext(store$f);
15138
+ } = useContext(store$g);
14639
15139
  const {
14640
15140
  t
14641
15141
  } = useTranslation("checkoutForm");
@@ -14892,7 +15392,7 @@ const PaypalSubscribeButton = props => {
14892
15392
  const {
14893
15393
  dispatch,
14894
15394
  state
14895
- } = useContext(store$f);
15395
+ } = useContext(store$g);
14896
15396
  const {
14897
15397
  product,
14898
15398
  plan,
@@ -14978,16 +15478,16 @@ const BankRedirection = () => {
14978
15478
  }));
14979
15479
  };
14980
15480
 
14981
- var _path$j;
15481
+ var _path$l;
14982
15482
 
14983
- 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); }
15483
+ 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); }
14984
15484
 
14985
15485
  function SvgLock(props) {
14986
- return /*#__PURE__*/React.createElement("svg", _extends$l({
15486
+ return /*#__PURE__*/React.createElement("svg", _extends$n({
14987
15487
  xmlns: "http://www.w3.org/2000/svg",
14988
15488
  viewBox: "0 0 20 20",
14989
15489
  fill: "currentColor"
14990
- }, props), _path$j || (_path$j = /*#__PURE__*/React.createElement("path", {
15490
+ }, props), _path$l || (_path$l = /*#__PURE__*/React.createElement("path", {
14991
15491
  fillRule: "evenodd",
14992
15492
  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",
14993
15493
  clipRule: "evenodd"
@@ -15004,7 +15504,7 @@ const SelectedPaymentMethod = () => {
15004
15504
  state: {
15005
15505
  isLoading
15006
15506
  }
15007
- } = useContext(store$f);
15507
+ } = useContext(store$g);
15008
15508
  const {
15009
15509
  switchView,
15010
15510
  selectedPaymentMethodId
@@ -15046,7 +15546,7 @@ const TaxAmount = () => {
15046
15546
  state: {
15047
15547
  taxAmount
15048
15548
  }
15049
- } = useContext(store$f);
15549
+ } = useContext(store$g);
15050
15550
  const {
15051
15551
  plan
15052
15552
  } = usePelcro();
@@ -15210,12 +15710,12 @@ function SubscriptionRenewModal({
15210
15710
  }
15211
15711
  SubscriptionRenewModal.viewId = "subscription-renew";
15212
15712
 
15213
- var _path$i;
15713
+ var _path$k;
15214
15714
 
15215
- 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); }
15715
+ 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); }
15216
15716
 
15217
15717
  function SvgGift(props) {
15218
- return /*#__PURE__*/React.createElement("svg", _extends$k({
15718
+ return /*#__PURE__*/React.createElement("svg", _extends$m({
15219
15719
  className: "plc-w-6 plc-h-6 plc-mr-2",
15220
15720
  fill: "none",
15221
15721
  stroke: "currentColor",
@@ -15224,7 +15724,7 @@ function SvgGift(props) {
15224
15724
  strokeWidth: 2,
15225
15725
  viewBox: "0 0 24 24",
15226
15726
  xmlns: "http://www.w3.org/2000/svg"
15227
- }, props), _path$i || (_path$i = /*#__PURE__*/React.createElement("path", {
15727
+ }, props), _path$k || (_path$k = /*#__PURE__*/React.createElement("path", {
15228
15728
  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"
15229
15729
  })));
15230
15730
  }
@@ -15565,7 +16065,7 @@ class DefaultNewsLetter extends Component {
15565
16065
 
15566
16066
  const NewsLetter = withTranslation("newsletter")(DefaultNewsLetter);
15567
16067
 
15568
- const initialState$e = {
16068
+ const initialState$f = {
15569
16069
  didSubToNewslettersBefore: false,
15570
16070
  newsletters: [],
15571
16071
  isListLoading: true,
@@ -15575,10 +16075,10 @@ const initialState$e = {
15575
16075
  content: ""
15576
16076
  }
15577
16077
  };
15578
- const store$e = /*#__PURE__*/createContext(initialState$e);
16078
+ const store$f = /*#__PURE__*/createContext(initialState$f);
15579
16079
  const {
15580
- Provider: Provider$e
15581
- } = store$e;
16080
+ Provider: Provider$f
16081
+ } = store$f;
15582
16082
 
15583
16083
  const NewsletterUpdateContainer = ({
15584
16084
  style,
@@ -15691,7 +16191,7 @@ const NewsletterUpdateContainer = ({
15691
16191
  default:
15692
16192
  return state;
15693
16193
  }
15694
- }, initialState$e);
16194
+ }, initialState$f);
15695
16195
  useEffect(() => {
15696
16196
  const getUserNewsletters = () => {
15697
16197
  var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
@@ -15735,7 +16235,7 @@ const NewsletterUpdateContainer = ({
15735
16235
  style: { ...style
15736
16236
  },
15737
16237
  className: `pelcro-container pelcro-newsletter-update-container ${className}`
15738
- }, /*#__PURE__*/React__default.createElement(Provider$e, {
16238
+ }, /*#__PURE__*/React__default.createElement(Provider$f, {
15739
16239
  value: {
15740
16240
  state,
15741
16241
  dispatch
@@ -15743,12 +16243,12 @@ const NewsletterUpdateContainer = ({
15743
16243
  }, children.length ? children.map((child, i) => {
15744
16244
  if (child) {
15745
16245
  return /*#__PURE__*/React__default.cloneElement(child, {
15746
- store: store$e,
16246
+ store: store$f,
15747
16247
  key: i
15748
16248
  });
15749
16249
  }
15750
16250
  }) : /*#__PURE__*/React__default.cloneElement(children, {
15751
- store: store$e
16251
+ store: store$f
15752
16252
  })));
15753
16253
  };
15754
16254
 
@@ -15763,7 +16263,7 @@ const NewsletterUpdateButton = ({
15763
16263
  isSubmitting,
15764
16264
  isListLoading
15765
16265
  }
15766
- } = useContext(store$e);
16266
+ } = useContext(store$f);
15767
16267
  const {
15768
16268
  t
15769
16269
  } = useTranslation("newsletter");
@@ -15793,7 +16293,7 @@ const NewsletterUpdateList = () => {
15793
16293
  newsletters,
15794
16294
  isListLoading
15795
16295
  }
15796
- } = useContext(store$e);
16296
+ } = useContext(store$f);
15797
16297
 
15798
16298
  if (isListLoading) {
15799
16299
  return /*#__PURE__*/React__default.createElement(Loader, {
@@ -15997,7 +16497,7 @@ function SubscriptionCreateModal({
15997
16497
  SubscriptionCreateModal.viewId = "subscription-create";
15998
16498
 
15999
16499
  var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
16000
- const initialState$d = {
16500
+ const initialState$e = {
16001
16501
  email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
16002
16502
  firstName: (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.first_name,
16003
16503
  lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
@@ -16010,10 +16510,10 @@ const initialState$d = {
16010
16510
  content: ""
16011
16511
  }
16012
16512
  };
16013
- const store$d = /*#__PURE__*/createContext(initialState$d);
16513
+ const store$e = /*#__PURE__*/createContext(initialState$e);
16014
16514
  const {
16015
- Provider: Provider$d
16016
- } = store$d;
16515
+ Provider: Provider$e
16516
+ } = store$e;
16017
16517
 
16018
16518
  const UserUpdateContainer = ({
16019
16519
  style,
@@ -16145,27 +16645,27 @@ const UserUpdateContainer = ({
16145
16645
  default:
16146
16646
  return state;
16147
16647
  }
16148
- }, initialState$d);
16648
+ }, initialState$e);
16149
16649
  return /*#__PURE__*/React__default.createElement("div", {
16150
16650
  style: { ...style
16151
16651
  },
16152
16652
  className: `pelcro-container pelcro-user-update-container ${className}`
16153
- }, /*#__PURE__*/React__default.createElement(Provider$d, {
16653
+ }, /*#__PURE__*/React__default.createElement(Provider$e, {
16154
16654
  value: {
16155
16655
  state,
16156
16656
  dispatch
16157
16657
  }
16158
16658
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
16159
- store: store$d,
16659
+ store: store$e,
16160
16660
  key: i
16161
16661
  })) : /*#__PURE__*/React__default.cloneElement(children, {
16162
- store: store$d
16662
+ store: store$e
16163
16663
  })));
16164
16664
  };
16165
16665
 
16166
16666
  const UserUpdateEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
16167
16667
  disabled: true,
16168
- store: store$d
16668
+ store: store$e
16169
16669
  }, props));
16170
16670
 
16171
16671
  const UserUpdateButton = ({
@@ -16178,7 +16678,7 @@ const UserUpdateButton = ({
16178
16678
  buttonDisabled
16179
16679
  },
16180
16680
  dispatch
16181
- } = useContext(store$d);
16681
+ } = useContext(store$e);
16182
16682
  const {
16183
16683
  t
16184
16684
  } = useTranslation("userEdit");
@@ -16195,11 +16695,11 @@ const UserUpdateButton = ({
16195
16695
  };
16196
16696
 
16197
16697
  const UserUpdateFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
16198
- store: store$d
16698
+ store: store$e
16199
16699
  }, props));
16200
16700
 
16201
16701
  const UserUpdateLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
16202
- store: store$d
16702
+ store: store$e
16203
16703
  }, props));
16204
16704
 
16205
16705
  function Phone({
@@ -16228,22 +16728,22 @@ function Phone({
16228
16728
  }
16229
16729
 
16230
16730
  const UserUpdatePhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
16231
- store: store$d
16731
+ store: store$e
16232
16732
  }, props));
16233
16733
 
16234
16734
  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";
16235
16735
 
16236
- var _path$h;
16736
+ var _path$j;
16237
16737
 
16238
- 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); }
16738
+ 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); }
16239
16739
 
16240
16740
  function SvgEdit(props) {
16241
- return /*#__PURE__*/React.createElement("svg", _extends$j({
16741
+ return /*#__PURE__*/React.createElement("svg", _extends$l({
16242
16742
  className: "plc-w-6 plc-h-6",
16243
16743
  xmlns: "http://www.w3.org/2000/svg",
16244
16744
  viewBox: "0 0 20 20",
16245
16745
  fill: "currentColor"
16246
- }, props), _path$h || (_path$h = /*#__PURE__*/React.createElement("path", {
16746
+ }, props), _path$j || (_path$j = /*#__PURE__*/React.createElement("path", {
16247
16747
  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"
16248
16748
  })));
16249
16749
  }
@@ -16375,16 +16875,16 @@ function DisplayName({
16375
16875
  }
16376
16876
 
16377
16877
  const UserUpdateDisplayName = props => /*#__PURE__*/React__default.createElement(DisplayName, Object.assign({
16378
- store: store$d
16878
+ store: store$e
16379
16879
  }, props));
16380
16880
 
16381
16881
  const UserUpdateTextInput = props => {
16382
16882
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
16383
- store: store$d
16883
+ store: store$e
16384
16884
  }));
16385
16885
  };
16386
16886
 
16387
- const initialState$c = {
16887
+ const initialState$d = {
16388
16888
  isSubmitting: false,
16389
16889
  firstName: "",
16390
16890
  firstNameError: "",
@@ -16409,10 +16909,10 @@ const initialState$c = {
16409
16909
  content: ""
16410
16910
  }
16411
16911
  };
16412
- const store$c = /*#__PURE__*/createContext(initialState$c);
16912
+ const store$d = /*#__PURE__*/createContext(initialState$d);
16413
16913
  const {
16414
- Provider: Provider$c
16415
- } = store$c;
16914
+ Provider: Provider$d
16915
+ } = store$d;
16416
16916
 
16417
16917
  const getNewlyCreatedAddress = addresses => addresses[addresses.length - 1];
16418
16918
 
@@ -16619,7 +17119,7 @@ const AddressCreateContainer = ({
16619
17119
  default:
16620
17120
  return state;
16621
17121
  }
16622
- }, initialState$c);
17122
+ }, initialState$d);
16623
17123
  useEffect(() => {
16624
17124
  const getStates = () => {
16625
17125
  dispatch({
@@ -16651,16 +17151,16 @@ const AddressCreateContainer = ({
16651
17151
  style: { ...style
16652
17152
  },
16653
17153
  className: `pelcro-container pelcro-address-create-container ${className}`
16654
- }, /*#__PURE__*/React__default.createElement(Provider$c, {
17154
+ }, /*#__PURE__*/React__default.createElement(Provider$d, {
16655
17155
  value: {
16656
17156
  state,
16657
17157
  dispatch
16658
17158
  }
16659
17159
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
16660
- store: store$c,
17160
+ store: store$d,
16661
17161
  key: i
16662
17162
  })) : /*#__PURE__*/React__default.cloneElement(children, {
16663
- store: store$c
17163
+ store: store$d
16664
17164
  })));
16665
17165
  };
16666
17166
 
@@ -16671,7 +17171,7 @@ function AddressCreateFirstName(props) {
16671
17171
  firstName,
16672
17172
  firstNameError
16673
17173
  }
16674
- } = useContext(store$c);
17174
+ } = useContext(store$d);
16675
17175
 
16676
17176
  const handleBlur = () => {
16677
17177
  return dispatch({
@@ -16714,7 +17214,7 @@ function AddressCreateLastName(props) {
16714
17214
  lastName,
16715
17215
  lastNameError
16716
17216
  }
16717
- } = useContext(store$c);
17217
+ } = useContext(store$d);
16718
17218
 
16719
17219
  const handleBlur = () => {
16720
17220
  return dispatch({
@@ -16757,7 +17257,7 @@ function AddressCreateLine1(props) {
16757
17257
  line1,
16758
17258
  line1Error
16759
17259
  }
16760
- } = useContext(store$c);
17260
+ } = useContext(store$d);
16761
17261
 
16762
17262
  const handleBlur = () => {
16763
17263
  return dispatch({
@@ -16800,7 +17300,7 @@ function AddressCreateCity(props) {
16800
17300
  city,
16801
17301
  cityError
16802
17302
  }
16803
- } = useContext(store$c);
17303
+ } = useContext(store$d);
16804
17304
 
16805
17305
  const handleBlur = () => {
16806
17306
  return dispatch({
@@ -16843,7 +17343,7 @@ function AddressCreatePostalCode(props) {
16843
17343
  postalCode,
16844
17344
  postalCodeError
16845
17345
  }
16846
- } = useContext(store$c);
17346
+ } = useContext(store$d);
16847
17347
 
16848
17348
  const handleBlur = () => {
16849
17349
  return dispatch({
@@ -16889,7 +17389,7 @@ const AddressCreateSubmit = ({
16889
17389
  state: {
16890
17390
  isSubmitting
16891
17391
  }
16892
- } = useContext(store$c);
17392
+ } = useContext(store$d);
16893
17393
  const {
16894
17394
  t
16895
17395
  } = useTranslation("address");
@@ -17000,7 +17500,7 @@ function CountrySelect({
17000
17500
  }
17001
17501
 
17002
17502
  const AddressCreateCountrySelect = props => /*#__PURE__*/React__default.createElement(CountrySelect, Object.assign({
17003
- store: store$c
17503
+ store: store$d
17004
17504
  }, props));
17005
17505
 
17006
17506
  function StateSelect({
@@ -17088,7 +17588,7 @@ function StateSelect({
17088
17588
  }
17089
17589
 
17090
17590
  const AddressCreateStateSelect = props => /*#__PURE__*/React__default.createElement(StateSelect, Object.assign({
17091
- store: store$c
17591
+ store: store$d
17092
17592
  }, props));
17093
17593
 
17094
17594
  const AddressCreateView = props => {
@@ -17193,18 +17693,18 @@ AddressCreateModal.viewId = "address-create";
17193
17693
 
17194
17694
  const AddressCreateTextInput = props => {
17195
17695
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
17196
- store: store$c
17696
+ store: store$d
17197
17697
  }));
17198
17698
  };
17199
17699
 
17200
17700
  const AddressCreateLine2 = props => {
17201
17701
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({
17202
17702
  fieldName: "line2",
17203
- store: store$c
17703
+ store: store$d
17204
17704
  }, props));
17205
17705
  };
17206
17706
 
17207
- const initialState$b = {
17707
+ const initialState$c = {
17208
17708
  isSubmitting: false,
17209
17709
  firstName: "",
17210
17710
  firstNameError: "",
@@ -17229,10 +17729,10 @@ const initialState$b = {
17229
17729
  content: ""
17230
17730
  }
17231
17731
  };
17232
- const store$b = /*#__PURE__*/createContext(initialState$b);
17732
+ const store$c = /*#__PURE__*/createContext(initialState$c);
17233
17733
  const {
17234
- Provider: Provider$b
17235
- } = store$b;
17734
+ Provider: Provider$c
17735
+ } = store$c;
17236
17736
 
17237
17737
  const AddressUpdateContainer = ({
17238
17738
  style,
@@ -17284,7 +17784,7 @@ const AddressUpdateContainer = ({
17284
17784
  const thisAddress = addresses[address];
17285
17785
 
17286
17786
  if (+thisAddress.id === +addressId) {
17287
- const newState = { ...initialState$b,
17787
+ const newState = { ...initialState$c,
17288
17788
  firstName: thisAddress.first_name,
17289
17789
  lastName: thisAddress.last_name,
17290
17790
  line1: thisAddress.line1,
@@ -17417,7 +17917,7 @@ const AddressUpdateContainer = ({
17417
17917
  default:
17418
17918
  return state;
17419
17919
  }
17420
- }, initialState$b);
17920
+ }, initialState$c);
17421
17921
  useEffect(() => {
17422
17922
  const getStates = () => {
17423
17923
  dispatch({
@@ -17449,21 +17949,21 @@ const AddressUpdateContainer = ({
17449
17949
  style: { ...style
17450
17950
  },
17451
17951
  className: `pelcro-container pelcro-address-update-container ${className}`
17452
- }, /*#__PURE__*/React__default.createElement(Provider$b, {
17952
+ }, /*#__PURE__*/React__default.createElement(Provider$c, {
17453
17953
  value: {
17454
17954
  state,
17455
17955
  dispatch
17456
17956
  }
17457
17957
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
17458
- store: store$b,
17958
+ store: store$c,
17459
17959
  key: i
17460
17960
  })) : /*#__PURE__*/React__default.cloneElement(children, {
17461
- store: store$b
17961
+ store: store$c
17462
17962
  })));
17463
17963
  };
17464
17964
 
17465
17965
  const AddressUpdateCountrySelect = props => /*#__PURE__*/React__default.createElement(CountrySelect, Object.assign({
17466
- store: store$b
17966
+ store: store$c
17467
17967
  }, props));
17468
17968
 
17469
17969
  function AddressUpdateFirstName(props) {
@@ -17473,7 +17973,7 @@ function AddressUpdateFirstName(props) {
17473
17973
  firstName,
17474
17974
  firstNameError
17475
17975
  }
17476
- } = useContext(store$b);
17976
+ } = useContext(store$c);
17477
17977
 
17478
17978
  const handleBlur = () => {
17479
17979
  return dispatch({
@@ -17516,7 +18016,7 @@ function AddressUpdateLastName(props) {
17516
18016
  lastName,
17517
18017
  lastNameError
17518
18018
  }
17519
- } = useContext(store$b);
18019
+ } = useContext(store$c);
17520
18020
 
17521
18021
  const handleBlur = () => {
17522
18022
  return dispatch({
@@ -17559,7 +18059,7 @@ function AddressUpdateLine1(props) {
17559
18059
  line1,
17560
18060
  line1Error
17561
18061
  }
17562
- } = useContext(store$b);
18062
+ } = useContext(store$c);
17563
18063
 
17564
18064
  const handleBlur = () => {
17565
18065
  return dispatch({
@@ -17599,7 +18099,7 @@ const AddressUpdateLine2 = props => {
17599
18099
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({
17600
18100
  fieldName: "line2"
17601
18101
  }, props, {
17602
- store: store$b
18102
+ store: store$c
17603
18103
  }));
17604
18104
  };
17605
18105
 
@@ -17610,7 +18110,7 @@ function AddressUpdateCity(props) {
17610
18110
  city,
17611
18111
  cityError
17612
18112
  }
17613
- } = useContext(store$b);
18113
+ } = useContext(store$c);
17614
18114
 
17615
18115
  const handleBlur = () => {
17616
18116
  return dispatch({
@@ -17653,7 +18153,7 @@ function AddressUpdatePostalCode(props) {
17653
18153
  postalCode,
17654
18154
  postalCodeError
17655
18155
  }
17656
- } = useContext(store$b);
18156
+ } = useContext(store$c);
17657
18157
 
17658
18158
  const handleBlur = () => {
17659
18159
  return dispatch({
@@ -17699,7 +18199,7 @@ const AddressUpdateSubmit = ({
17699
18199
  state: {
17700
18200
  isSubmitting
17701
18201
  }
17702
- } = useContext(store$b);
18202
+ } = useContext(store$c);
17703
18203
  const {
17704
18204
  t
17705
18205
  } = useTranslation("address");
@@ -17715,7 +18215,7 @@ const AddressUpdateSubmit = ({
17715
18215
  };
17716
18216
 
17717
18217
  const AddressUpdateStateSelect = props => /*#__PURE__*/React__default.createElement(StateSelect, Object.assign({
17718
- store: store$b
18218
+ store: store$c
17719
18219
  }, props));
17720
18220
 
17721
18221
  const AddressUpdateView = props => {
@@ -17798,7 +18298,7 @@ AddressUpdateModal.viewId = "address-edit";
17798
18298
 
17799
18299
  const AddressUpdateTextInput = props => {
17800
18300
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
17801
- store: store$b
18301
+ store: store$c
17802
18302
  }));
17803
18303
  };
17804
18304
 
@@ -17881,7 +18381,7 @@ const PaymentMethodUpdateModal = props => {
17881
18381
  };
17882
18382
  PaymentMethodUpdateModal.viewId = "payment-method-update";
17883
18383
 
17884
- const initialState$a = {
18384
+ const initialState$b = {
17885
18385
  email: "",
17886
18386
  password: "",
17887
18387
  passwordError: null,
@@ -17894,10 +18394,10 @@ const initialState$a = {
17894
18394
  content: ""
17895
18395
  }
17896
18396
  };
17897
- const store$a = /*#__PURE__*/createContext(initialState$a);
18397
+ const store$b = /*#__PURE__*/createContext(initialState$b);
17898
18398
  const {
17899
- Provider: Provider$a
17900
- } = store$a;
18399
+ Provider: Provider$b
18400
+ } = store$b;
17901
18401
 
17902
18402
  const PasswordResetContainer = ({
17903
18403
  style,
@@ -17954,7 +18454,7 @@ const PasswordResetContainer = ({
17954
18454
  type: SET_EMAIL,
17955
18455
  payload: window.Pelcro.helpers.getURLParameter("email")
17956
18456
  });
17957
- initialState$a.email = window.Pelcro.helpers.getURLParameter("email");
18457
+ initialState$b.email = window.Pelcro.helpers.getURLParameter("email");
17958
18458
  dispatch({
17959
18459
  type: SET_TOKEN,
17960
18460
  payload: window.Pelcro.helpers.getURLParameter("token")
@@ -18014,26 +18514,26 @@ const PasswordResetContainer = ({
18014
18514
  default:
18015
18515
  return state;
18016
18516
  }
18017
- }, initialState$a);
18517
+ }, initialState$b);
18018
18518
  return /*#__PURE__*/React__default.createElement("div", {
18019
18519
  style: { ...style
18020
18520
  },
18021
18521
  className: `pelcro-container pelcro-password-reset-container ${className}`
18022
- }, /*#__PURE__*/React__default.createElement(Provider$a, {
18522
+ }, /*#__PURE__*/React__default.createElement(Provider$b, {
18023
18523
  value: {
18024
18524
  state,
18025
18525
  dispatch
18026
18526
  }
18027
18527
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
18028
- store: store$a,
18528
+ store: store$b,
18029
18529
  key: i
18030
18530
  })) : /*#__PURE__*/React__default.cloneElement(children, {
18031
- store: store$a
18531
+ store: store$b
18032
18532
  })));
18033
18533
  };
18034
18534
 
18035
18535
  const PasswordResetPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
18036
- store: store$a
18536
+ store: store$b
18037
18537
  }, props));
18038
18538
 
18039
18539
  const PasswordResetButton = ({
@@ -18046,7 +18546,7 @@ const PasswordResetButton = ({
18046
18546
  buttonDisabled
18047
18547
  },
18048
18548
  dispatch
18049
- } = useContext(store$a);
18549
+ } = useContext(store$b);
18050
18550
  const {
18051
18551
  t
18052
18552
  } = useTranslation("passwordReset");
@@ -18063,14 +18563,14 @@ const PasswordResetButton = ({
18063
18563
  };
18064
18564
 
18065
18565
  const PasswordResetEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
18066
- store: store$a
18566
+ store: store$b
18067
18567
  }, props, {
18068
18568
  value: window.Pelcro.helpers.getURLParameter("email"),
18069
18569
  disabled: true
18070
18570
  }));
18071
18571
 
18072
18572
  const PasswordResetConfirmPassword = props => /*#__PURE__*/React__default.createElement(ConfirmPassword, Object.assign({
18073
- store: store$a
18573
+ store: store$b
18074
18574
  }, props));
18075
18575
 
18076
18576
  const PasswordResetView = props => {
@@ -18122,7 +18622,7 @@ const PasswordResetModal = ({
18122
18622
  };
18123
18623
  PasswordResetModal.viewId = "password-reset";
18124
18624
 
18125
- const initialState$9 = {
18625
+ const initialState$a = {
18126
18626
  email: "",
18127
18627
  emailError: null,
18128
18628
  buttonDisabled: false,
@@ -18131,10 +18631,10 @@ const initialState$9 = {
18131
18631
  content: ""
18132
18632
  }
18133
18633
  };
18134
- const store$9 = /*#__PURE__*/createContext(initialState$9);
18634
+ const store$a = /*#__PURE__*/createContext(initialState$a);
18135
18635
  const {
18136
- Provider: Provider$9
18137
- } = store$9;
18636
+ Provider: Provider$a
18637
+ } = store$a;
18138
18638
 
18139
18639
  const PasswordForgotContainer = ({
18140
18640
  style,
@@ -18212,21 +18712,21 @@ const PasswordForgotContainer = ({
18212
18712
  default:
18213
18713
  return state;
18214
18714
  }
18215
- }, initialState$9);
18715
+ }, initialState$a);
18216
18716
  return /*#__PURE__*/React__default.createElement("div", {
18217
18717
  style: { ...style
18218
18718
  },
18219
18719
  className: `pelcro-container pelcro-password-forgot-container ${className}`
18220
- }, /*#__PURE__*/React__default.createElement(Provider$9, {
18720
+ }, /*#__PURE__*/React__default.createElement(Provider$a, {
18221
18721
  value: {
18222
18722
  state,
18223
18723
  dispatch
18224
18724
  }
18225
18725
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
18226
- store: store$9,
18726
+ store: store$a,
18227
18727
  key: i
18228
18728
  })) : /*#__PURE__*/React__default.cloneElement(children, {
18229
- store: store$9
18729
+ store: store$a
18230
18730
  })));
18231
18731
  };
18232
18732
 
@@ -18242,7 +18742,7 @@ const PasswordForgotButton = ({
18242
18742
  emailError
18243
18743
  },
18244
18744
  dispatch
18245
- } = useContext(store$9);
18745
+ } = useContext(store$a);
18246
18746
  const {
18247
18747
  t
18248
18748
  } = useTranslation("passwordForgot");
@@ -18263,7 +18763,7 @@ const PasswordForgotButton = ({
18263
18763
  };
18264
18764
 
18265
18765
  const PasswordForgotEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
18266
- store: store$9
18766
+ store: store$a
18267
18767
  }, props));
18268
18768
 
18269
18769
  const PasswordForgotView = props => {
@@ -18313,7 +18813,7 @@ const PasswordForgotModal = ({
18313
18813
  };
18314
18814
  PasswordForgotModal.viewId = "password-forgot";
18315
18815
 
18316
- const initialState$8 = {
18816
+ const initialState$9 = {
18317
18817
  currentPassword: "",
18318
18818
  newPassword: "",
18319
18819
  confirmNewPassword: "",
@@ -18327,10 +18827,10 @@ const initialState$8 = {
18327
18827
  content: ""
18328
18828
  }
18329
18829
  };
18330
- const store$8 = /*#__PURE__*/createContext(initialState$8);
18830
+ const store$9 = /*#__PURE__*/createContext(initialState$9);
18331
18831
  const {
18332
- Provider: Provider$8
18333
- } = store$8;
18832
+ Provider: Provider$9
18833
+ } = store$9;
18334
18834
  const PasswordChangeContainer = ({
18335
18835
  style,
18336
18836
  className = "",
@@ -18482,21 +18982,21 @@ const PasswordChangeContainer = ({
18482
18982
  default:
18483
18983
  return state;
18484
18984
  }
18485
- }, initialState$8);
18985
+ }, initialState$9);
18486
18986
  return /*#__PURE__*/React__default.createElement("div", {
18487
18987
  style: { ...style
18488
18988
  },
18489
18989
  className: `pelcro-container pelcro-password-change-container ${className}`
18490
- }, /*#__PURE__*/React__default.createElement(Provider$8, {
18990
+ }, /*#__PURE__*/React__default.createElement(Provider$9, {
18491
18991
  value: {
18492
18992
  state,
18493
18993
  dispatch
18494
18994
  }
18495
18995
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
18496
- store: store$8,
18996
+ store: store$9,
18497
18997
  key: i
18498
18998
  })) : /*#__PURE__*/React__default.cloneElement(children, {
18499
- store: store$8
18999
+ store: store$9
18500
19000
  })));
18501
19001
  };
18502
19002
 
@@ -18507,7 +19007,7 @@ function PasswordChangeCurrentPassword(props) {
18507
19007
  currentPassword,
18508
19008
  currentPasswordError
18509
19009
  }
18510
- } = useContext(store$8);
19010
+ } = useContext(store$9);
18511
19011
  const handleBlur = useCallback(() => {
18512
19012
  return dispatch({
18513
19013
  type: VALIDATE_PASSWORD
@@ -18541,7 +19041,7 @@ function PasswordChangeNewPassword(props) {
18541
19041
  newPassword,
18542
19042
  newPasswordError
18543
19043
  }
18544
- } = useContext(store$8);
19044
+ } = useContext(store$9);
18545
19045
  const handleBlur = useCallback(() => {
18546
19046
  return dispatch({
18547
19047
  type: VALIDATE_NEW_PASSWORD
@@ -18575,7 +19075,7 @@ function PasswordChangeConfirmNewPassword(props) {
18575
19075
  confirmNewPassword,
18576
19076
  confirmNewPasswordError
18577
19077
  }
18578
- } = useContext(store$8);
19078
+ } = useContext(store$9);
18579
19079
  const handleBlur = useCallback(() => {
18580
19080
  return dispatch({
18581
19081
  type: VALIDATE_CONFIRM_NEW_PASSWORD
@@ -18616,7 +19116,7 @@ const PasswordChangeButton = ({
18616
19116
  confirmNewPasswordError
18617
19117
  },
18618
19118
  dispatch
18619
- } = useContext(store$8);
19119
+ } = useContext(store$9);
18620
19120
  const {
18621
19121
  t
18622
19122
  } = useTranslation("passwordChange");
@@ -18682,17 +19182,17 @@ const PasswordChangeModal = ({
18682
19182
  };
18683
19183
  PasswordChangeModal.viewId = "password-change";
18684
19184
 
18685
- const initialState$7 = {
19185
+ const initialState$8 = {
18686
19186
  buttonDisabled: false,
18687
19187
  alert: {
18688
19188
  type: "error",
18689
19189
  content: ""
18690
19190
  }
18691
19191
  };
18692
- const store$7 = /*#__PURE__*/createContext(initialState$7);
19192
+ const store$8 = /*#__PURE__*/createContext(initialState$8);
18693
19193
  const {
18694
- Provider: Provider$7
18695
- } = store$7;
19194
+ Provider: Provider$8
19195
+ } = store$8;
18696
19196
 
18697
19197
  const CartContainer = ({
18698
19198
  style,
@@ -18783,21 +19283,21 @@ const CartContainer = ({
18783
19283
  default:
18784
19284
  return state;
18785
19285
  }
18786
- }, initialState$7);
19286
+ }, initialState$8);
18787
19287
  return /*#__PURE__*/React__default.createElement("div", {
18788
19288
  style: { ...style
18789
19289
  },
18790
19290
  className: `pelcro-container pelcro-cart-container ${className}`
18791
- }, /*#__PURE__*/React__default.createElement(Provider$7, {
19291
+ }, /*#__PURE__*/React__default.createElement(Provider$8, {
18792
19292
  value: {
18793
19293
  state,
18794
19294
  dispatch
18795
19295
  }
18796
19296
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
18797
- store: store$7,
19297
+ store: store$8,
18798
19298
  key: i
18799
19299
  })) : /*#__PURE__*/React__default.cloneElement(children, {
18800
- store: store$7
19300
+ store: store$8
18801
19301
  })));
18802
19302
  };
18803
19303
 
@@ -18834,7 +19334,7 @@ const CartSubmit = ({
18834
19334
  buttonDisabled
18835
19335
  },
18836
19336
  dispatch
18837
- } = useContext(store$7);
19337
+ } = useContext(store$8);
18838
19338
  const {
18839
19339
  t
18840
19340
  } = useTranslation("cart");
@@ -18865,7 +19365,7 @@ const CartTotalPrice = () => {
18865
19365
  state: {
18866
19366
  alert
18867
19367
  }
18868
- } = useContext(store$7);
19368
+ } = useContext(store$8);
18869
19369
  const {
18870
19370
  cartItems
18871
19371
  } = usePelcro();
@@ -19178,7 +19678,7 @@ const OrderConfirmModal = props => {
19178
19678
  };
19179
19679
  OrderConfirmModal.viewId = "order-confirm";
19180
19680
 
19181
- const initialState$6 = {
19681
+ const initialState$7 = {
19182
19682
  email: "",
19183
19683
  firstName: "",
19184
19684
  lastName: "",
@@ -19190,10 +19690,10 @@ const initialState$6 = {
19190
19690
  content: ""
19191
19691
  }
19192
19692
  };
19193
- const store$6 = /*#__PURE__*/createContext(initialState$6);
19693
+ const store$7 = /*#__PURE__*/createContext(initialState$7);
19194
19694
  const {
19195
- Provider: Provider$6
19196
- } = store$6;
19695
+ Provider: Provider$7
19696
+ } = store$7;
19197
19697
 
19198
19698
  const GiftCreateContainer = ({
19199
19699
  style,
@@ -19297,21 +19797,21 @@ const GiftCreateContainer = ({
19297
19797
  default:
19298
19798
  return state;
19299
19799
  }
19300
- }, initialState$6);
19800
+ }, initialState$7);
19301
19801
  return /*#__PURE__*/React__default.createElement("div", {
19302
19802
  style: { ...style
19303
19803
  },
19304
19804
  className: `pelcro-container pelcro-gift-create-container ${className}`
19305
- }, /*#__PURE__*/React__default.createElement(Provider$6, {
19805
+ }, /*#__PURE__*/React__default.createElement(Provider$7, {
19306
19806
  value: {
19307
19807
  state,
19308
19808
  dispatch
19309
19809
  }
19310
19810
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
19311
- store: store$6,
19811
+ store: store$7,
19312
19812
  key: i
19313
19813
  })) : /*#__PURE__*/React__default.cloneElement(children, {
19314
- store: store$6
19814
+ store: store$7
19315
19815
  })));
19316
19816
  };
19317
19817
 
@@ -19325,7 +19825,7 @@ const GiftCreateSubmitButton = ({
19325
19825
  state: {
19326
19826
  disableSubmit
19327
19827
  }
19328
- } = useContext(store$6);
19828
+ } = useContext(store$7);
19329
19829
  const {
19330
19830
  t
19331
19831
  } = useTranslation("register");
@@ -19342,29 +19842,29 @@ const GiftCreateSubmitButton = ({
19342
19842
 
19343
19843
  const GiftCreateEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
19344
19844
  initWithUserEmail: false,
19345
- store: store$6
19845
+ store: store$7
19346
19846
  }, props));
19347
19847
 
19348
19848
  const GiftCreateFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
19349
- store: store$6
19849
+ store: store$7
19350
19850
  }, props));
19351
19851
 
19352
19852
  const GiftCreateLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
19353
- store: store$6
19853
+ store: store$7
19354
19854
  }, props));
19355
19855
 
19356
- var _path$g;
19856
+ var _path$i;
19357
19857
 
19358
- 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); }
19858
+ 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); }
19359
19859
 
19360
19860
  function SvgInfoCircle(props) {
19361
- return /*#__PURE__*/React.createElement("svg", _extends$i({
19861
+ return /*#__PURE__*/React.createElement("svg", _extends$k({
19362
19862
  xmlns: "http://www.w3.org/2000/svg",
19363
19863
  className: "plc-w-5 plc-h-5",
19364
19864
  fill: "none",
19365
19865
  viewBox: "0 0 24 24",
19366
19866
  stroke: "currentColor"
19367
- }, props), _path$g || (_path$g = /*#__PURE__*/React.createElement("path", {
19867
+ }, props), _path$i || (_path$i = /*#__PURE__*/React.createElement("path", {
19368
19868
  strokeLinecap: "round",
19369
19869
  strokeLinejoin: "round",
19370
19870
  strokeWidth: 2,
@@ -19435,7 +19935,7 @@ const GiftCreateStartDate = props => {
19435
19935
  const {
19436
19936
  dispatch,
19437
19937
  state
19438
- } = useContext(store$6);
19938
+ } = useContext(store$7);
19439
19939
 
19440
19940
  const handleInputChange = value => {
19441
19941
  dispatch({
@@ -19508,7 +20008,7 @@ function GiftCreateMessage(props) {
19508
20008
  const {
19509
20009
  dispatch,
19510
20010
  state
19511
- } = useContext(store$6);
20011
+ } = useContext(store$7);
19512
20012
  const MAX_CHARS_COUNT = 200;
19513
20013
  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;
19514
20014
 
@@ -19632,7 +20132,7 @@ const GiftCreateModal = ({
19632
20132
  };
19633
20133
  GiftCreateModal.viewId = "gift-create";
19634
20134
 
19635
- const initialState$5 = {
20135
+ const initialState$6 = {
19636
20136
  giftCode: "",
19637
20137
  buttonDisabled: true,
19638
20138
  alert: {
@@ -19640,10 +20140,10 @@ const initialState$5 = {
19640
20140
  content: ""
19641
20141
  }
19642
20142
  };
19643
- const store$5 = /*#__PURE__*/createContext(initialState$5);
20143
+ const store$6 = /*#__PURE__*/createContext(initialState$6);
19644
20144
  const {
19645
- Provider: Provider$5
19646
- } = store$5;
20145
+ Provider: Provider$6
20146
+ } = store$6;
19647
20147
 
19648
20148
  const GiftRedeemContainer = ({
19649
20149
  style,
@@ -19708,21 +20208,21 @@ const GiftRedeemContainer = ({
19708
20208
  default:
19709
20209
  return state;
19710
20210
  }
19711
- }, initialState$5);
20211
+ }, initialState$6);
19712
20212
  return /*#__PURE__*/React__default.createElement("div", {
19713
20213
  style: { ...style
19714
20214
  },
19715
20215
  className: `pelcro-container pelcro-gift-redeem-container ${className}`
19716
- }, /*#__PURE__*/React__default.createElement(Provider$5, {
20216
+ }, /*#__PURE__*/React__default.createElement(Provider$6, {
19717
20217
  value: {
19718
20218
  state,
19719
20219
  dispatch
19720
20220
  }
19721
20221
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
19722
- store: store$5,
20222
+ store: store$6,
19723
20223
  key: i
19724
20224
  })) : /*#__PURE__*/React__default.cloneElement(children, {
19725
- store: store$5
20225
+ store: store$6
19726
20226
  })));
19727
20227
  };
19728
20228
 
@@ -19759,7 +20259,7 @@ function GiftCode({
19759
20259
  }
19760
20260
 
19761
20261
  const GiftRedeemCode = props => /*#__PURE__*/React__default.createElement(GiftCode, Object.assign({
19762
- store: store$5
20262
+ store: store$6
19763
20263
  }, props));
19764
20264
 
19765
20265
  const GiftRedeemSubmitButton = ({
@@ -19772,7 +20272,7 @@ const GiftRedeemSubmitButton = ({
19772
20272
  state: {
19773
20273
  disableSubmit
19774
20274
  }
19775
- } = useContext(store$5);
20275
+ } = useContext(store$6);
19776
20276
  const {
19777
20277
  t
19778
20278
  } = useTranslation("register");
@@ -19865,7 +20365,7 @@ const moveDefaultAddressToStart = addresses => {
19865
20365
  return [defaultAddress, ...addressesWithoutDefault];
19866
20366
  };
19867
20367
 
19868
- const initialState$4 = {
20368
+ const initialState$5 = {
19869
20369
  addresses: [],
19870
20370
  selectedAddressId: null,
19871
20371
  isSubmitting: false,
@@ -19874,10 +20374,10 @@ const initialState$4 = {
19874
20374
  content: ""
19875
20375
  }
19876
20376
  };
19877
- const store$4 = /*#__PURE__*/createContext(initialState$4);
20377
+ const store$5 = /*#__PURE__*/createContext(initialState$5);
19878
20378
  const {
19879
- Provider: Provider$4
19880
- } = store$4;
20379
+ Provider: Provider$5
20380
+ } = store$5;
19881
20381
 
19882
20382
  const AddressSelectContainer = ({
19883
20383
  style,
@@ -19972,7 +20472,7 @@ const AddressSelectContainer = ({
19972
20472
  default:
19973
20473
  return state;
19974
20474
  }
19975
- }, initialState$4);
20475
+ }, initialState$5);
19976
20476
  useEffect(() => {
19977
20477
  var _window$Pelcro$user$r;
19978
20478
 
@@ -19985,16 +20485,16 @@ const AddressSelectContainer = ({
19985
20485
  style: { ...style
19986
20486
  },
19987
20487
  className: `pelcro-container pelcro-address-select-container ${className}`
19988
- }, /*#__PURE__*/React__default.createElement(Provider$4, {
20488
+ }, /*#__PURE__*/React__default.createElement(Provider$5, {
19989
20489
  value: {
19990
20490
  state,
19991
20491
  dispatch
19992
20492
  }
19993
20493
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
19994
- store: store$4,
20494
+ store: store$5,
19995
20495
  key: i
19996
20496
  })) : /*#__PURE__*/React__default.cloneElement(children, {
19997
- store: store$4
20497
+ store: store$5
19998
20498
  })));
19999
20499
  };
20000
20500
 
@@ -20005,7 +20505,7 @@ const AddressSelectList = () => {
20005
20505
  addresses,
20006
20506
  selectedAddressId
20007
20507
  }
20008
- } = useContext(store$4);
20508
+ } = useContext(store$5);
20009
20509
 
20010
20510
  const handleAddressSelect = event => {
20011
20511
  dispatch({
@@ -20049,7 +20549,7 @@ const AddressSelectSubmit = ({
20049
20549
  selectedAddressId,
20050
20550
  isSubmitting
20051
20551
  }
20052
- } = useContext(store$4);
20552
+ } = useContext(store$5);
20053
20553
  const {
20054
20554
  t
20055
20555
  } = useTranslation("address");
@@ -20145,7 +20645,7 @@ const moveDefaultPaymentMethodToStart = paymentMethods => {
20145
20645
  return [defaultPaymentMethod, ...paymentMethodsWithoutDefault];
20146
20646
  };
20147
20647
 
20148
- const initialState$3 = {
20648
+ const initialState$4 = {
20149
20649
  paymentMethods: [],
20150
20650
  selectedPaymentMethodId: null,
20151
20651
  isSubmitting: false,
@@ -20154,10 +20654,10 @@ const initialState$3 = {
20154
20654
  content: ""
20155
20655
  }
20156
20656
  };
20157
- const store$3 = /*#__PURE__*/createContext(initialState$3);
20657
+ const store$4 = /*#__PURE__*/createContext(initialState$4);
20158
20658
  const {
20159
- Provider: Provider$3
20160
- } = store$3;
20659
+ Provider: Provider$4
20660
+ } = store$4;
20161
20661
 
20162
20662
  const PaymentMethodSelectContainer = ({
20163
20663
  style,
@@ -20216,7 +20716,7 @@ const PaymentMethodSelectContainer = ({
20216
20716
  default:
20217
20717
  return state;
20218
20718
  }
20219
- }, initialState$3);
20719
+ }, initialState$4);
20220
20720
  useEffect(() => {
20221
20721
  var _window$Pelcro$user$r3;
20222
20722
 
@@ -20229,16 +20729,16 @@ const PaymentMethodSelectContainer = ({
20229
20729
  style: { ...style
20230
20730
  },
20231
20731
  className: `pelcro-container pelcro-payment-select-container ${className}`
20232
- }, /*#__PURE__*/React__default.createElement(Provider$3, {
20732
+ }, /*#__PURE__*/React__default.createElement(Provider$4, {
20233
20733
  value: {
20234
20734
  state,
20235
20735
  dispatch
20236
20736
  }
20237
20737
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
20238
- store: store$3,
20738
+ store: store$4,
20239
20739
  key: i
20240
20740
  })) : /*#__PURE__*/React__default.cloneElement(children, {
20241
- store: store$3
20741
+ store: store$4
20242
20742
  })));
20243
20743
  };
20244
20744
 
@@ -20252,7 +20752,7 @@ const PaymentMethodSelectList = () => {
20252
20752
  paymentMethods,
20253
20753
  selectedPaymentMethodId
20254
20754
  }
20255
- } = useContext(store$3);
20755
+ } = useContext(store$4);
20256
20756
 
20257
20757
  const handlePaymentMethodSelect = event => {
20258
20758
  dispatch({
@@ -20302,7 +20802,7 @@ const PaymentMethodSelectSubmit = ({
20302
20802
  selectedPaymentMethodId,
20303
20803
  isSubmitting
20304
20804
  }
20305
- } = useContext(store$3);
20805
+ } = useContext(store$4);
20306
20806
  return /*#__PURE__*/React__default.createElement(Button, Object.assign({
20307
20807
  onClick: () => {
20308
20808
  dispatch({
@@ -20376,8 +20876,8 @@ const PaymentMethodSelectModal = ({
20376
20876
  };
20377
20877
  PaymentMethodSelectModal.viewId = "payment-method-select";
20378
20878
 
20379
- function _extends$h() {
20380
- _extends$h = Object.assign || function (target) {
20879
+ function _extends$j() {
20880
+ _extends$j = Object.assign || function (target) {
20381
20881
  for (var i = 1; i < arguments.length; i++) {
20382
20882
  var source = arguments[i];
20383
20883
 
@@ -20391,7 +20891,7 @@ function _extends$h() {
20391
20891
  return target;
20392
20892
  };
20393
20893
 
20394
- return _extends$h.apply(this, arguments);
20894
+ return _extends$j.apply(this, arguments);
20395
20895
  }
20396
20896
 
20397
20897
  function _objectWithoutPropertiesLoose(source, excluded) {
@@ -20575,7 +21075,7 @@ function render(props, propsBag, defaultTag, features, visible) {
20575
21075
  return match(strategy, (_match = {}, _match[RenderStrategy.Unmount] = function () {
20576
21076
  return null;
20577
21077
  }, _match[RenderStrategy.Hidden] = function () {
20578
- return _render(_extends$h({}, _rest, {
21078
+ return _render(_extends$j({}, _rest, {
20579
21079
  hidden: true,
20580
21080
  style: {
20581
21081
  display: 'none'
@@ -21103,7 +21603,7 @@ function TransitionChild(props) {
21103
21603
  var passthroughProps = rest;
21104
21604
  return React__default.createElement(NestingContext.Provider, {
21105
21605
  value: nesting
21106
- }, render(_extends$h({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
21606
+ }, render(_extends$j({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
21107
21607
  }
21108
21608
 
21109
21609
  function Transition(props) {
@@ -21147,7 +21647,7 @@ function Transition(props) {
21147
21647
  value: nestingBag
21148
21648
  }, React__default.createElement(TransitionContext.Provider, {
21149
21649
  value: transitionBag
21150
- }, render(_extends$h({}, sharedProps, {
21650
+ }, render(_extends$j({}, sharedProps, {
21151
21651
  as: Fragment,
21152
21652
  children: React__default.createElement(TransitionChild, Object.assign({}, sharedProps, passthroughProps))
21153
21653
  }), propsBag, Fragment, TransitionChildRenderFeatures, state === TreeStates.Visible)));
@@ -21274,12 +21774,12 @@ var ActionTypes;
21274
21774
  })(ActionTypes || (ActionTypes = {}));
21275
21775
 
21276
21776
  (_reducers = {}, _reducers[ActionTypes.CloseMenu] = function (state) {
21277
- return _extends$h({}, state, {
21777
+ return _extends$j({}, state, {
21278
21778
  activeItemIndex: null,
21279
21779
  menuState: MenuStates.Closed
21280
21780
  });
21281
21781
  }, _reducers[ActionTypes.OpenMenu] = function (state) {
21282
- return _extends$h({}, state, {
21782
+ return _extends$j({}, state, {
21283
21783
  menuState: MenuStates.Open
21284
21784
  });
21285
21785
  }, _reducers[ActionTypes.GoToItem] = function (state, action) {
@@ -21298,7 +21798,7 @@ var ActionTypes;
21298
21798
  }
21299
21799
  });
21300
21800
  if (state.searchQuery === '' && state.activeItemIndex === activeItemIndex) return state;
21301
- return _extends$h({}, state, {
21801
+ return _extends$j({}, state, {
21302
21802
  searchQuery: '',
21303
21803
  activeItemIndex: activeItemIndex
21304
21804
  });
@@ -21309,19 +21809,19 @@ var ActionTypes;
21309
21809
 
21310
21810
  return ((_item$dataRef$current = item.dataRef.current.textValue) == null ? void 0 : _item$dataRef$current.startsWith(searchQuery)) && !item.dataRef.current.disabled;
21311
21811
  });
21312
- if (match === -1 || match === state.activeItemIndex) return _extends$h({}, state, {
21812
+ if (match === -1 || match === state.activeItemIndex) return _extends$j({}, state, {
21313
21813
  searchQuery: searchQuery
21314
21814
  });
21315
- return _extends$h({}, state, {
21815
+ return _extends$j({}, state, {
21316
21816
  searchQuery: searchQuery,
21317
21817
  activeItemIndex: match
21318
21818
  });
21319
21819
  }, _reducers[ActionTypes.ClearSearch] = function (state) {
21320
- return _extends$h({}, state, {
21820
+ return _extends$j({}, state, {
21321
21821
  searchQuery: ''
21322
21822
  });
21323
21823
  }, _reducers[ActionTypes.RegisterItem] = function (state, action) {
21324
- return _extends$h({}, state, {
21824
+ return _extends$j({}, state, {
21325
21825
  items: [].concat(state.items, [{
21326
21826
  id: action.id,
21327
21827
  dataRef: action.dataRef
@@ -21334,7 +21834,7 @@ var ActionTypes;
21334
21834
  return a.id === action.id;
21335
21835
  });
21336
21836
  if (idx !== -1) nextItems.splice(idx, 1);
21337
- return _extends$h({}, state, {
21837
+ return _extends$j({}, state, {
21338
21838
  items: nextItems,
21339
21839
  activeItemIndex: function () {
21340
21840
  if (idx === state.activeItemIndex) return null;
@@ -21373,19 +21873,19 @@ var ActionTypes$1;
21373
21873
  (_reducers$1 = {}, _reducers$1[ActionTypes$1.CloseListbox] = function (state) {
21374
21874
  if (state.disabled) return state;
21375
21875
  if (state.listboxState === ListboxStates.Closed) return state;
21376
- return _extends$h({}, state, {
21876
+ return _extends$j({}, state, {
21377
21877
  activeOptionIndex: null,
21378
21878
  listboxState: ListboxStates.Closed
21379
21879
  });
21380
21880
  }, _reducers$1[ActionTypes$1.OpenListbox] = function (state) {
21381
21881
  if (state.disabled) return state;
21382
21882
  if (state.listboxState === ListboxStates.Open) return state;
21383
- return _extends$h({}, state, {
21883
+ return _extends$j({}, state, {
21384
21884
  listboxState: ListboxStates.Open
21385
21885
  });
21386
21886
  }, _reducers$1[ActionTypes$1.SetDisabled] = function (state, action) {
21387
21887
  if (state.disabled === action.disabled) return state;
21388
- return _extends$h({}, state, {
21888
+ return _extends$j({}, state, {
21389
21889
  disabled: action.disabled
21390
21890
  });
21391
21891
  }, _reducers$1[ActionTypes$1.GoToOption] = function (state, action) {
@@ -21406,7 +21906,7 @@ var ActionTypes$1;
21406
21906
  }
21407
21907
  });
21408
21908
  if (state.searchQuery === '' && state.activeOptionIndex === activeOptionIndex) return state;
21409
- return _extends$h({}, state, {
21909
+ return _extends$j({}, state, {
21410
21910
  searchQuery: '',
21411
21911
  activeOptionIndex: activeOptionIndex
21412
21912
  });
@@ -21419,10 +21919,10 @@ var ActionTypes$1;
21419
21919
 
21420
21920
  return !option.dataRef.current.disabled && ((_option$dataRef$curre = option.dataRef.current.textValue) == null ? void 0 : _option$dataRef$curre.startsWith(searchQuery));
21421
21921
  });
21422
- if (match === -1 || match === state.activeOptionIndex) return _extends$h({}, state, {
21922
+ if (match === -1 || match === state.activeOptionIndex) return _extends$j({}, state, {
21423
21923
  searchQuery: searchQuery
21424
21924
  });
21425
- return _extends$h({}, state, {
21925
+ return _extends$j({}, state, {
21426
21926
  searchQuery: searchQuery,
21427
21927
  activeOptionIndex: match
21428
21928
  });
@@ -21430,11 +21930,11 @@ var ActionTypes$1;
21430
21930
  if (state.disabled) return state;
21431
21931
  if (state.listboxState === ListboxStates.Closed) return state;
21432
21932
  if (state.searchQuery === '') return state;
21433
- return _extends$h({}, state, {
21933
+ return _extends$j({}, state, {
21434
21934
  searchQuery: ''
21435
21935
  });
21436
21936
  }, _reducers$1[ActionTypes$1.RegisterOption] = function (state, action) {
21437
- return _extends$h({}, state, {
21937
+ return _extends$j({}, state, {
21438
21938
  options: [].concat(state.options, [{
21439
21939
  id: action.id,
21440
21940
  dataRef: action.dataRef
@@ -21447,7 +21947,7 @@ var ActionTypes$1;
21447
21947
  return a.id === action.id;
21448
21948
  });
21449
21949
  if (idx !== -1) nextOptions.splice(idx, 1);
21450
- return _extends$h({}, state, {
21950
+ return _extends$j({}, state, {
21451
21951
  options: nextOptions,
21452
21952
  activeOptionIndex: function () {
21453
21953
  if (idx === state.activeOptionIndex) return null;
@@ -21508,18 +22008,18 @@ const getPaymentCardIcon = name => {
21508
22008
  }));
21509
22009
  };
21510
22010
 
21511
- var _path$f;
22011
+ var _path$h;
21512
22012
 
21513
- 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); }
22013
+ 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); }
21514
22014
 
21515
22015
  function SvgChevronRight(props) {
21516
- return /*#__PURE__*/React.createElement("svg", _extends$g({
22016
+ return /*#__PURE__*/React.createElement("svg", _extends$i({
21517
22017
  className: "plc-w-6 plc-h-6",
21518
22018
  xmlns: "http://www.w3.org/2000/svg",
21519
22019
  fill: "none",
21520
22020
  viewBox: "0 0 24 24",
21521
22021
  stroke: "currentColor"
21522
- }, props), _path$f || (_path$f = /*#__PURE__*/React.createElement("path", {
22022
+ }, props), _path$h || (_path$h = /*#__PURE__*/React.createElement("path", {
21523
22023
  strokeLinecap: "round",
21524
22024
  strokeLinejoin: "round",
21525
22025
  strokeWidth: 2,
@@ -21735,18 +22235,18 @@ const SavedItems = ({
21735
22235
  });
21736
22236
  };
21737
22237
 
21738
- var _path$e;
22238
+ var _path$g;
21739
22239
 
21740
- 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); }
22240
+ 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); }
21741
22241
 
21742
22242
  function SvgRefresh(props) {
21743
- return /*#__PURE__*/React.createElement("svg", _extends$f({
22243
+ return /*#__PURE__*/React.createElement("svg", _extends$h({
21744
22244
  className: "plc-w-4 plc-h-4 plc-mr-1",
21745
22245
  xmlns: "http://www.w3.org/2000/svg",
21746
22246
  fill: "none",
21747
22247
  viewBox: "0 0 24 24",
21748
22248
  stroke: "currentColor"
21749
- }, props), _path$e || (_path$e = /*#__PURE__*/React.createElement("path", {
22249
+ }, props), _path$g || (_path$g = /*#__PURE__*/React.createElement("path", {
21750
22250
  strokeLinecap: "round",
21751
22251
  strokeLinejoin: "round",
21752
22252
  strokeWidth: 2,
@@ -21754,35 +22254,35 @@ function SvgRefresh(props) {
21754
22254
  })));
21755
22255
  }
21756
22256
 
21757
- var _path$d;
22257
+ var _path$f;
21758
22258
 
21759
- 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); }
22259
+ 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); }
21760
22260
 
21761
22261
  function SvgCalendar(props) {
21762
- return /*#__PURE__*/React.createElement("svg", _extends$e({
22262
+ return /*#__PURE__*/React.createElement("svg", _extends$g({
21763
22263
  xmlns: "http://www.w3.org/2000/svg",
21764
22264
  className: "plc-h-4 plc-w-4 plc-mr-1",
21765
22265
  viewBox: "0 0 20 20",
21766
22266
  fill: "currentColor"
21767
- }, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
22267
+ }, props), _path$f || (_path$f = /*#__PURE__*/React.createElement("path", {
21768
22268
  fillRule: "evenodd",
21769
22269
  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",
21770
22270
  clipRule: "evenodd"
21771
22271
  })));
21772
22272
  }
21773
22273
 
21774
- var _path$c;
22274
+ var _path$e;
21775
22275
 
21776
- 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); }
22276
+ 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); }
21777
22277
 
21778
22278
  function SvgPlus(props) {
21779
- return /*#__PURE__*/React.createElement("svg", _extends$d({
22279
+ return /*#__PURE__*/React.createElement("svg", _extends$f({
21780
22280
  className: "plc-w-5 plc-h-5",
21781
22281
  xmlns: "http://www.w3.org/2000/svg",
21782
22282
  fill: "none",
21783
22283
  viewBox: "0 0 24 24",
21784
22284
  stroke: "currentColor"
21785
- }, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
22285
+ }, props), _path$e || (_path$e = /*#__PURE__*/React.createElement("path", {
21786
22286
  strokeLinecap: "round",
21787
22287
  strokeLinejoin: "round",
21788
22288
  strokeWidth: 2,
@@ -21790,17 +22290,17 @@ function SvgPlus(props) {
21790
22290
  })));
21791
22291
  }
21792
22292
 
21793
- var _path$b;
22293
+ var _path$d;
21794
22294
 
21795
- 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); }
22295
+ 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); }
21796
22296
 
21797
22297
  function SvgCheckMark(props) {
21798
- return /*#__PURE__*/React.createElement("svg", _extends$c({
22298
+ return /*#__PURE__*/React.createElement("svg", _extends$e({
21799
22299
  className: "plc-w-4 plc-h-4 plc-mr-1",
21800
22300
  xmlns: "http://www.w3.org/2000/svg",
21801
22301
  viewBox: "0 0 20 20",
21802
22302
  fill: "currentColor"
21803
- }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
22303
+ }, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
21804
22304
  fillRule: "evenodd",
21805
22305
  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",
21806
22306
  clipRule: "evenodd"
@@ -21864,7 +22364,8 @@ const SubscriptionsItems = ({
21864
22364
  } = useTranslation("dashboard");
21865
22365
  const {
21866
22366
  switchView,
21867
- isAuthenticated
22367
+ switchToAddressView,
22368
+ switchToPaymentView
21868
22369
  } = usePelcro();
21869
22370
  const subs = getNonDonationSubs();
21870
22371
  if (subs.length === 0) return null;
@@ -21906,7 +22407,12 @@ const SubscriptionsItems = ({
21906
22407
  const plan = window.Pelcro.plan.getById(plan_id);
21907
22408
  setProductAndPlan(product, plan);
21908
22409
  setSubscriptionIdToRenew(sub.id);
21909
- setView("plan-select");
22410
+
22411
+ if (product.address_required) {
22412
+ return switchToAddressView();
22413
+ }
22414
+
22415
+ return switchToPaymentView();
21910
22416
  };
21911
22417
 
21912
22418
  const getPhases = () => {
@@ -22095,18 +22601,18 @@ Accordion.item = function AccordionItem({
22095
22601
  }, content)) : null;
22096
22602
  };
22097
22603
 
22098
- var _path$a;
22604
+ var _path$c;
22099
22605
 
22100
- 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); }
22606
+ 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); }
22101
22607
 
22102
22608
  function SvgExit(props) {
22103
- return /*#__PURE__*/React.createElement("svg", _extends$b({
22609
+ return /*#__PURE__*/React.createElement("svg", _extends$d({
22104
22610
  className: "plc-w-6 plc-h-6",
22105
22611
  xmlns: "http://www.w3.org/2000/svg",
22106
22612
  fill: "none",
22107
22613
  viewBox: "0 0 24 24",
22108
22614
  stroke: "currentColor"
22109
- }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
22615
+ }, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
22110
22616
  strokeLinecap: "round",
22111
22617
  strokeLinejoin: "round",
22112
22618
  strokeWidth: 2,
@@ -22114,17 +22620,17 @@ function SvgExit(props) {
22114
22620
  })));
22115
22621
  }
22116
22622
 
22117
- var _path$9;
22623
+ var _path$b;
22118
22624
 
22119
- 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); }
22625
+ 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); }
22120
22626
 
22121
22627
  function SvgUser(props) {
22122
- return /*#__PURE__*/React.createElement("svg", _extends$a({
22628
+ return /*#__PURE__*/React.createElement("svg", _extends$c({
22123
22629
  xmlns: "http://www.w3.org/2000/svg",
22124
22630
  fill: "none",
22125
22631
  viewBox: "0 0 24 24",
22126
22632
  stroke: "currentColor"
22127
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
22633
+ }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
22128
22634
  strokeLinecap: "round",
22129
22635
  strokeLinejoin: "round",
22130
22636
  strokeWidth: 2,
@@ -22132,18 +22638,18 @@ function SvgUser(props) {
22132
22638
  })));
22133
22639
  }
22134
22640
 
22135
- var _path$8;
22641
+ var _path$a;
22136
22642
 
22137
- 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); }
22643
+ 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); }
22138
22644
 
22139
22645
  function SvgNewsletter(props) {
22140
- return /*#__PURE__*/React.createElement("svg", _extends$9({
22646
+ return /*#__PURE__*/React.createElement("svg", _extends$b({
22141
22647
  xmlns: "http://www.w3.org/2000/svg",
22142
22648
  className: "plc-h-5 plc-w-5",
22143
22649
  fill: "none",
22144
22650
  viewBox: "0 0 24 24",
22145
22651
  stroke: "currentColor"
22146
- }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
22652
+ }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
22147
22653
  strokeLinecap: "round",
22148
22654
  strokeLinejoin: "round",
22149
22655
  strokeWidth: 2,
@@ -22151,18 +22657,37 @@ function SvgNewsletter(props) {
22151
22657
  })));
22152
22658
  }
22153
22659
 
22154
- var _path$7;
22660
+ var _path$9;
22661
+
22662
+ 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); }
22155
22663
 
22156
- 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); }
22664
+ function SvgDocument(props) {
22665
+ return /*#__PURE__*/React.createElement("svg", _extends$a({
22666
+ xmlns: "http://www.w3.org/2000/svg",
22667
+ className: "plc-h-6 plc-w-6 plc-mr-2",
22668
+ fill: "none",
22669
+ viewBox: "0 0 24 24",
22670
+ stroke: "currentColor"
22671
+ }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
22672
+ strokeLinecap: "round",
22673
+ strokeLinejoin: "round",
22674
+ strokeWidth: 2,
22675
+ 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"
22676
+ })));
22677
+ }
22678
+
22679
+ var _path$8;
22680
+
22681
+ 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); }
22157
22682
 
22158
22683
  function SvgPaymentCard(props) {
22159
- return /*#__PURE__*/React.createElement("svg", _extends$8({
22684
+ return /*#__PURE__*/React.createElement("svg", _extends$9({
22160
22685
  className: "plc-w-6 plc-h-6 plc-mr-2",
22161
22686
  xmlns: "http://www.w3.org/2000/svg",
22162
22687
  fill: "none",
22163
22688
  viewBox: "0 0 24 24",
22164
22689
  stroke: "currentColor"
22165
- }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
22690
+ }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
22166
22691
  strokeLinecap: "round",
22167
22692
  strokeLinejoin: "round",
22168
22693
  strokeWidth: 2,
@@ -22170,18 +22695,18 @@ function SvgPaymentCard(props) {
22170
22695
  })));
22171
22696
  }
22172
22697
 
22173
- var _path$6, _path2$1;
22698
+ var _path$7, _path2$1;
22174
22699
 
22175
- 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); }
22700
+ 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); }
22176
22701
 
22177
22702
  function SvgLocationPin(props) {
22178
- return /*#__PURE__*/React.createElement("svg", _extends$7({
22703
+ return /*#__PURE__*/React.createElement("svg", _extends$8({
22179
22704
  className: "plc-w-6 plc-h-6 plc-mr-2",
22180
22705
  xmlns: "http://www.w3.org/2000/svg",
22181
22706
  fill: "none",
22182
22707
  viewBox: "0 0 24 24",
22183
22708
  stroke: "currentColor"
22184
- }, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
22709
+ }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
22185
22710
  strokeLinecap: "round",
22186
22711
  strokeLinejoin: "round",
22187
22712
  strokeWidth: 2,
@@ -22196,10 +22721,10 @@ function SvgLocationPin(props) {
22196
22721
 
22197
22722
  var _switch;
22198
22723
 
22199
- 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); }
22724
+ 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); }
22200
22725
 
22201
22726
  function SvgSubscription(props) {
22202
- return /*#__PURE__*/React.createElement("svg", _extends$6({
22727
+ return /*#__PURE__*/React.createElement("svg", _extends$7({
22203
22728
  xmlns: "http://www.w3.org/2000/svg",
22204
22729
  viewBox: "0 0 100 125",
22205
22730
  fill: "currentColor"
@@ -22214,18 +22739,18 @@ function SvgSubscription(props) {
22214
22739
  }))))));
22215
22740
  }
22216
22741
 
22217
- var _path$5;
22742
+ var _path$6;
22218
22743
 
22219
- 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); }
22744
+ 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); }
22220
22745
 
22221
22746
  function SvgShopping(props) {
22222
- return /*#__PURE__*/React.createElement("svg", _extends$5({
22747
+ return /*#__PURE__*/React.createElement("svg", _extends$6({
22223
22748
  className: "plc-w-6 plc-h-6 plc-mr-2",
22224
22749
  xmlns: "http://www.w3.org/2000/svg",
22225
22750
  fill: "none",
22226
22751
  viewBox: "0 0 24 24",
22227
22752
  stroke: "currentColor"
22228
- }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
22753
+ }, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
22229
22754
  strokeLinecap: "round",
22230
22755
  strokeLinejoin: "round",
22231
22756
  strokeWidth: 2,
@@ -22233,18 +22758,18 @@ function SvgShopping(props) {
22233
22758
  })));
22234
22759
  }
22235
22760
 
22236
- var _path$4;
22761
+ var _path$5;
22237
22762
 
22238
- 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); }
22763
+ 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); }
22239
22764
 
22240
22765
  function SvgBookmark(props) {
22241
- return /*#__PURE__*/React.createElement("svg", _extends$4({
22766
+ return /*#__PURE__*/React.createElement("svg", _extends$5({
22242
22767
  className: "plc-w-6 plc-h-6 plc-mr-2",
22243
22768
  xmlns: "http://www.w3.org/2000/svg",
22244
22769
  fill: "none",
22245
22770
  viewBox: "0 0 24 24",
22246
22771
  stroke: "currentColor"
22247
- }, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
22772
+ }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
22248
22773
  strokeLinecap: "round",
22249
22774
  strokeLinejoin: "round",
22250
22775
  strokeWidth: 2,
@@ -22252,33 +22777,33 @@ function SvgBookmark(props) {
22252
22777
  })));
22253
22778
  }
22254
22779
 
22255
- var _path$3;
22780
+ var _path$4;
22256
22781
 
22257
- 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); }
22782
+ 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); }
22258
22783
 
22259
22784
  function SvgKey(props) {
22260
- return /*#__PURE__*/React.createElement("svg", _extends$3({
22785
+ return /*#__PURE__*/React.createElement("svg", _extends$4({
22261
22786
  xmlns: "http://www.w3.org/2000/svg",
22262
22787
  viewBox: "0 0 20 20",
22263
22788
  fill: "currentColor"
22264
- }, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
22789
+ }, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
22265
22790
  fillRule: "evenodd",
22266
22791
  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",
22267
22792
  clipRule: "evenodd"
22268
22793
  })));
22269
22794
  }
22270
22795
 
22271
- var _path$2;
22796
+ var _path$3;
22272
22797
 
22273
- 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); }
22798
+ 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); }
22274
22799
 
22275
22800
  function SvgDonate(props) {
22276
- return /*#__PURE__*/React.createElement("svg", _extends$2({
22801
+ return /*#__PURE__*/React.createElement("svg", _extends$3({
22277
22802
  width: 24,
22278
22803
  height: 24,
22279
22804
  fill: "currentColor",
22280
22805
  xmlns: "http://www.w3.org/2000/svg"
22281
- }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
22806
+ }, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
22282
22807
  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"
22283
22808
  })));
22284
22809
  }
@@ -22314,17 +22839,149 @@ const DonationsMenu = () => {
22314
22839
  }), subscriptions));
22315
22840
  };
22316
22841
 
22317
- function getDonationSubs() {
22318
- var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r, _window$Pelcro$user$r2;
22842
+ function getDonationSubs() {
22843
+ var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r, _window$Pelcro$user$r2;
22844
+
22845
+ 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 : [];
22846
+ 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 : [];
22847
+ return [...donations, ...canceledDonations];
22848
+ }
22849
+
22850
+ function formatStartDate(date) {
22851
+ const startDate = new Date(date);
22852
+ return new Intl.DateTimeFormat("en-CA").format(startDate);
22853
+ }
22854
+
22855
+ const InvoicesMenu = props => {
22856
+ const {
22857
+ t
22858
+ } = useTranslation("dashboard");
22859
+ return /*#__PURE__*/React__default.createElement("table", {
22860
+ className: "plc-w-full plc-table-fixed"
22861
+ }, /*#__PURE__*/React__default.createElement("thead", {
22862
+ className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
22863
+ }, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
22864
+ className: "plc-w-4/12 "
22865
+ }, t("labels.details")), /*#__PURE__*/React__default.createElement("th", {
22866
+ className: "plc-w-4/12 "
22867
+ }, t("labels.status.title")), /*#__PURE__*/React__default.createElement("th", {
22868
+ className: "plc-w-3/12 "
22869
+ }, t("labels.actions")))), /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", {
22870
+ className: "plc-h-4"
22871
+ }), /*#__PURE__*/React__default.createElement(InvoicesItems, props)));
22872
+ };
22873
+
22874
+ const InvoicesItems = () => {
22875
+ var _window$Pelcro$invoic, _window$Pelcro$invoic2;
22876
+
22877
+ const {
22878
+ t
22879
+ } = useTranslation("dashboard");
22880
+ const {
22881
+ setInvoice,
22882
+ switchView
22883
+ } = usePelcro();
22884
+ 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 : [];
22885
+
22886
+ const showInvoiceDetails = event => {
22887
+ if (setInvoice(event.target.dataset.id)) {
22888
+ switchView("invoice-details");
22889
+ }
22890
+ };
22891
+
22892
+ if (invoices.length === 0) return null;
22893
+ return invoices.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()).map(invoice => {
22894
+ const invoiceStatus = getInvoiceStatus(invoice);
22895
+ const formattedCreationDate = new Intl.DateTimeFormat("en-CA").format(new Date(invoice.created_at));
22896
+ return /*#__PURE__*/React__default.createElement("tr", {
22897
+ key: invoice.id,
22898
+ className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50`
22899
+ }, /*#__PURE__*/React__default.createElement("td", {
22900
+ className: "plc-truncate"
22901
+ }, /*#__PURE__*/React__default.createElement("span", {
22902
+ className: "plc-font-semibold plc-text-gray-500"
22903
+ }, `#${invoice.id}`), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
22904
+ className: "plc-text-sm plc-text-gray-500"
22905
+ }, getFormattedPriceByLocal(invoice.total, invoice.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
22906
+ className: "plc-text-sm plc-text-gray-500"
22907
+ }, formattedCreationDate)), /*#__PURE__*/React__default.createElement("td", {
22908
+ className: "plc-py-2"
22909
+ }, /*#__PURE__*/React__default.createElement("span", {
22910
+ className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${invoiceStatus.bgColor} plc-uppercase ${invoiceStatus.textColor} plc-rounded-lg`
22911
+ }, invoiceStatus.icon, invoiceStatus.title)), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement(Button, {
22912
+ variant: "ghost",
22913
+ className: "plc-text-blue-400 focus:plc-ring-blue-400 pelcro-dashboard-view-invoice-button",
22914
+ icon: /*#__PURE__*/React__default.createElement(SvgDocument, {
22915
+ className: "plc-w-4 plc-h-4"
22916
+ }),
22917
+ onClick: showInvoiceDetails,
22918
+ "data-id": invoice.id
22919
+ }, t("labels.view"))));
22920
+ });
22921
+ };
22922
+
22923
+ function getInvoiceStatus(invoice) {
22924
+ const translations = i18next.t("dashboard:labels", {
22925
+ returnObjects: true
22926
+ });
22927
+
22928
+ switch (invoice.status) {
22929
+ case "paid":
22930
+ return {
22931
+ textColor: "plc-text-green-700",
22932
+ bgColor: "plc-bg-green-100",
22933
+ icon: /*#__PURE__*/React__default.createElement(SvgCheckMark, null),
22934
+ title: translations.paid
22935
+ };
22936
+
22937
+ case "past_due":
22938
+ return {
22939
+ textColor: "plc-text-orange-700",
22940
+ bgColor: "plc-bg-orange-100",
22941
+ icon: /*#__PURE__*/React__default.createElement(SvgExclamation, null),
22942
+ title: translations.pastDue
22943
+ };
22319
22944
 
22320
- 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 : [];
22321
- 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 : [];
22322
- return [...donations, ...canceledDonations];
22323
- }
22945
+ case "open":
22946
+ return {
22947
+ textColor: "plc-text-yellow-700",
22948
+ bgColor: "plc-bg-yellow-100",
22949
+ icon: /*#__PURE__*/React__default.createElement(SvgExclamation, null),
22950
+ title: translations.open
22951
+ };
22324
22952
 
22325
- function formatStartDate(date) {
22326
- const startDate = new Date(date);
22327
- return new Intl.DateTimeFormat("en-CA").format(startDate);
22953
+ case "draft":
22954
+ return {
22955
+ textColor: "plc-text-blue-700",
22956
+ bgColor: "plc-bg-blue-100",
22957
+ icon: /*#__PURE__*/React__default.createElement(SvgEdit, null),
22958
+ title: translations.draft
22959
+ };
22960
+
22961
+ case "scheduled":
22962
+ return {
22963
+ textColor: "plc-text-blue-700",
22964
+ bgColor: "plc-bg-blue-100",
22965
+ icon: /*#__PURE__*/React__default.createElement(SvgCalendar, null),
22966
+ title: translations.scheduled
22967
+ };
22968
+
22969
+ case "uncollectible":
22970
+ return {
22971
+ textColor: "plc-text-red-700",
22972
+ bgColor: "plc-bg-red-100",
22973
+ icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
22974
+ title: translations.uncollectible
22975
+ };
22976
+
22977
+ case "void":
22978
+ return {
22979
+ textColor: "plc-text-gray-700",
22980
+ bgColor: "plc-bg-gray-100",
22981
+ icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
22982
+ title: translations.void
22983
+ };
22984
+ }
22328
22985
  }
22329
22986
 
22330
22987
  const SUB_MENUS = {
@@ -22473,9 +23130,10 @@ class Dashboard extends Component {
22473
23130
  }) => {
22474
23131
  if (isGift) {
22475
23132
  this.props.setProductAndPlan(null, null, true);
23133
+ return this.props.setView("plan-select");
22476
23134
  }
22477
23135
 
22478
- return this.props.setView("plan-select");
23136
+ return this.props.setView("subscription-options");
22479
23137
  });
22480
23138
 
22481
23139
  _defineProperty$3(this, "displayAddressCreate", () => {
@@ -22880,6 +23538,12 @@ class Dashboard extends Component {
22880
23538
  icon: /*#__PURE__*/React__default.createElement(SvgShopping, null),
22881
23539
  title: this.locale("labels.orders.label"),
22882
23540
  content: /*#__PURE__*/React__default.createElement(OrdersMenu, null)
23541
+ }), /*#__PURE__*/React__default.createElement(Accordion.item, {
23542
+ show: hasInvoices(),
23543
+ name: SUB_MENUS.INVOICES,
23544
+ icon: /*#__PURE__*/React__default.createElement(SvgDocument, null),
23545
+ title: this.locale("labels.invoices"),
23546
+ content: /*#__PURE__*/React__default.createElement(InvoicesMenu, null)
22883
23547
  }), /*#__PURE__*/React__default.createElement(Accordion.item, {
22884
23548
  name: SUB_MENUS.SAVED_ITEMS,
22885
23549
  icon: /*#__PURE__*/React__default.createElement(SvgBookmark, null),
@@ -22895,6 +23559,13 @@ class Dashboard extends Component {
22895
23559
 
22896
23560
  }
22897
23561
 
23562
+ function hasInvoices() {
23563
+ var _window$Pelcro$invoic, _window$Pelcro$invoic2;
23564
+
23565
+ 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 : [];
23566
+ return invoices.length > 0;
23567
+ }
23568
+
22898
23569
  function hasDonationSubs() {
22899
23570
  var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
22900
23571
 
@@ -22930,7 +23601,7 @@ const DashboardOpenButton = () => {
22930
23601
  };
22931
23602
  DashboardOpenButton.viewId = "dashboard-open";
22932
23603
 
22933
- const initialState$2 = {
23604
+ const initialState$3 = {
22934
23605
  imageSrc: null,
22935
23606
  crop: {
22936
23607
  x: 0,
@@ -22944,10 +23615,10 @@ const initialState$2 = {
22944
23615
  content: ""
22945
23616
  }
22946
23617
  };
22947
- const store$2 = /*#__PURE__*/createContext(initialState$2);
23618
+ const store$3 = /*#__PURE__*/createContext(initialState$3);
22948
23619
  const {
22949
- Provider: Provider$2
22950
- } = store$2;
23620
+ Provider: Provider$3
23621
+ } = store$3;
22951
23622
 
22952
23623
  const ProfilePicChangeContainer = ({
22953
23624
  style,
@@ -23081,21 +23752,21 @@ const ProfilePicChangeContainer = ({
23081
23752
  default:
23082
23753
  return state;
23083
23754
  }
23084
- }, initialState$2);
23755
+ }, initialState$3);
23085
23756
  return /*#__PURE__*/React__default.createElement("div", {
23086
23757
  style: { ...style
23087
23758
  },
23088
23759
  className: `pelcro-container pelcro-profile-picture-container ${className}`
23089
- }, /*#__PURE__*/React__default.createElement(Provider$2, {
23760
+ }, /*#__PURE__*/React__default.createElement(Provider$3, {
23090
23761
  value: {
23091
23762
  state,
23092
23763
  dispatch
23093
23764
  }
23094
23765
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
23095
- store: store$2,
23766
+ store: store$3,
23096
23767
  key: i
23097
23768
  })) : /*#__PURE__*/React__default.cloneElement(children, {
23098
- store: store$2
23769
+ store: store$3
23099
23770
  })));
23100
23771
  };
23101
23772
  /**
@@ -23157,7 +23828,7 @@ const ProfilePicChangeButton = ({
23157
23828
  isSubmitting
23158
23829
  },
23159
23830
  dispatch
23160
- } = useContext(store$2);
23831
+ } = useContext(store$3);
23161
23832
  const {
23162
23833
  t
23163
23834
  } = useTranslation("userEdit");
@@ -24525,7 +25196,7 @@ const ProfilePicChangeCropper = ({
24525
25196
  zoom
24526
25197
  },
24527
25198
  dispatch
24528
- } = useContext(store$2);
25199
+ } = useContext(store$3);
24529
25200
  return /*#__PURE__*/React__default.createElement("div", {
24530
25201
  className: `plc-relative plc-w-full plc-h-52 sm:plc-h-96 ${className}`
24531
25202
  }, /*#__PURE__*/React__default.createElement(Cropper, Object.assign({
@@ -24567,7 +25238,7 @@ const ProfilePicChangeZoom = ({
24567
25238
  zoom
24568
25239
  },
24569
25240
  dispatch
24570
- } = useContext(store$2);
25241
+ } = useContext(store$3);
24571
25242
  const {
24572
25243
  t
24573
25244
  } = useTranslation("userEdit");
@@ -24590,18 +25261,18 @@ const ProfilePicChangeZoom = ({
24590
25261
  }, otherProps)));
24591
25262
  };
24592
25263
 
24593
- var _path$1;
25264
+ var _path$2;
24594
25265
 
24595
- 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); }
25266
+ 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); }
24596
25267
 
24597
25268
  function SvgPhotograph(props) {
24598
- return /*#__PURE__*/React.createElement("svg", _extends$1({
25269
+ return /*#__PURE__*/React.createElement("svg", _extends$2({
24599
25270
  xmlns: "http://www.w3.org/2000/svg",
24600
25271
  className: "plc-h-6 plc-w-6",
24601
25272
  fill: "none",
24602
25273
  viewBox: "0 0 24 24",
24603
25274
  stroke: "currentColor"
24604
- }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
25275
+ }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
24605
25276
  strokeLinecap: "round",
24606
25277
  strokeLinejoin: "round",
24607
25278
  strokeWidth: 2,
@@ -24619,7 +25290,7 @@ const ProfilePicChangeSelectButton = ({
24619
25290
  state: {
24620
25291
  isSubmitting
24621
25292
  }
24622
- } = useContext(store$2);
25293
+ } = useContext(store$3);
24623
25294
  const {
24624
25295
  t
24625
25296
  } = useTranslation("userEdit");
@@ -24661,7 +25332,7 @@ const ProfilePicChangeRemoveButton = ({
24661
25332
  state: {
24662
25333
  isSubmitting
24663
25334
  }
24664
- } = useContext(store$2);
25335
+ } = useContext(store$3);
24665
25336
  const {
24666
25337
  t
24667
25338
  } = useTranslation("userEdit");
@@ -24684,7 +25355,7 @@ const ProfilePicChangeWrapper = () => {
24684
25355
  state: {
24685
25356
  imageSrc
24686
25357
  }
24687
- } = useContext(store$2);
25358
+ } = useContext(store$3);
24688
25359
  const {
24689
25360
  t
24690
25361
  } = useTranslation("userEdit");
@@ -24746,17 +25417,17 @@ function ProfilePicChangeModal({
24746
25417
  }
24747
25418
  ProfilePicChangeModal.viewId = "profile-picture";
24748
25419
 
24749
- const initialState$1 = {
25420
+ const initialState$2 = {
24750
25421
  isSubmitting: false,
24751
25422
  alert: {
24752
25423
  type: "error",
24753
25424
  content: ""
24754
25425
  }
24755
25426
  };
24756
- const store$1 = /*#__PURE__*/createContext(initialState$1);
25427
+ const store$2 = /*#__PURE__*/createContext(initialState$2);
24757
25428
  const {
24758
- Provider: Provider$1
24759
- } = store$1;
25429
+ Provider: Provider$2
25430
+ } = store$2;
24760
25431
 
24761
25432
  const EmailVerifyContainer = ({
24762
25433
  style,
@@ -24819,21 +25490,21 @@ const EmailVerifyContainer = ({
24819
25490
  default:
24820
25491
  return state;
24821
25492
  }
24822
- }, initialState$1);
25493
+ }, initialState$2);
24823
25494
  return /*#__PURE__*/React__default.createElement("div", {
24824
25495
  style: { ...style
24825
25496
  },
24826
25497
  className: `pelcro-container pelcro-email-verify-container ${className}`
24827
- }, /*#__PURE__*/React__default.createElement(Provider$1, {
25498
+ }, /*#__PURE__*/React__default.createElement(Provider$2, {
24828
25499
  value: {
24829
25500
  state,
24830
25501
  dispatch
24831
25502
  }
24832
25503
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
24833
- store: store$1,
25504
+ store: store$2,
24834
25505
  key: i
24835
25506
  })) : /*#__PURE__*/React__default.cloneElement(children, {
24836
- store: store$1
25507
+ store: store$2
24837
25508
  })));
24838
25509
  };
24839
25510
 
@@ -24847,7 +25518,7 @@ const EmailVerifyResendButton = ({
24847
25518
  state: {
24848
25519
  isSubmitting
24849
25520
  }
24850
- } = useContext(store$1);
25521
+ } = useContext(store$2);
24851
25522
  const {
24852
25523
  t
24853
25524
  } = useTranslation("verifyEmail");
@@ -24862,16 +25533,16 @@ const EmailVerifyResendButton = ({
24862
25533
  }, otherProps), name !== null && name !== void 0 ? name : t("labels.resend"));
24863
25534
  };
24864
25535
 
24865
- var _path, _path2;
25536
+ var _path$1, _path2;
24866
25537
 
24867
- 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); }
25538
+ 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); }
24868
25539
 
24869
25540
  function SvgEmailVerify(props) {
24870
- return /*#__PURE__*/React.createElement("svg", _extends({
25541
+ return /*#__PURE__*/React.createElement("svg", _extends$1({
24871
25542
  className: "plc-w-6 plc-h-6",
24872
25543
  viewBox: "0 0 700 700",
24873
25544
  xmlns: "http://www.w3.org/2000/svg"
24874
- }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
25545
+ }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
24875
25546
  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"
24876
25547
  })), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
24877
25548
  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"
@@ -24975,11 +25646,11 @@ const invoicePaymentSubmitButton = props => {
24975
25646
  return /*#__PURE__*/React__default.createElement(SubmitPaymentMethod, props);
24976
25647
  };
24977
25648
 
24978
- const initialState = {};
24979
- const store = /*#__PURE__*/createContext(initialState);
25649
+ const initialState$1 = {};
25650
+ const store$1 = /*#__PURE__*/createContext(initialState$1);
24980
25651
  const {
24981
- Provider
24982
- } = store;
25652
+ Provider: Provider$1
25653
+ } = store$1;
24983
25654
 
24984
25655
  const InvoiceDetailsContainer = ({
24985
25656
  style,
@@ -25000,21 +25671,21 @@ const InvoiceDetailsContainer = ({
25000
25671
  default:
25001
25672
  return state;
25002
25673
  }
25003
- }, initialState);
25674
+ }, initialState$1);
25004
25675
  return /*#__PURE__*/React__default.createElement("div", {
25005
25676
  style: { ...style
25006
25677
  },
25007
25678
  className: `pelcro-container pelcro-invoice-details-container ${className}`
25008
- }, /*#__PURE__*/React__default.createElement(Provider, {
25679
+ }, /*#__PURE__*/React__default.createElement(Provider$1, {
25009
25680
  value: {
25010
25681
  state,
25011
25682
  dispatch
25012
25683
  }
25013
25684
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
25014
- store,
25685
+ store: store$1,
25015
25686
  key: i
25016
25687
  })) : /*#__PURE__*/React__default.cloneElement(children, {
25017
- store
25688
+ store: store$1
25018
25689
  })));
25019
25690
  };
25020
25691
 
@@ -25046,7 +25717,7 @@ const InvoiceDetailsPayButton = ({
25046
25717
  }) => {
25047
25718
  const {
25048
25719
  dispatch
25049
- } = useContext(store);
25720
+ } = useContext(store$1);
25050
25721
  const {
25051
25722
  t
25052
25723
  } = useTranslation("invoiceDetails");
@@ -25068,6 +25739,8 @@ const InvoiceDetailsView = props => {
25068
25739
  invoice
25069
25740
  } = usePelcro();
25070
25741
  const showPayButton = canPayInvoice(invoice);
25742
+ const showDownloadButton = Boolean(invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf);
25743
+ const hasPlanDetails = Boolean(invoice.plan);
25071
25744
  const creationDate = new Date(invoice === null || invoice === void 0 ? void 0 : invoice.created_at);
25072
25745
  const formattedCreationDate = new Intl.DateTimeFormat("en-CA").format(creationDate);
25073
25746
  return /*#__PURE__*/React__default.createElement("div", {
@@ -25085,7 +25758,7 @@ const InvoiceDetailsView = props => {
25085
25758
  className: "plc-font-bold pelcro-invoice-summary-title"
25086
25759
  }, t("labels.summary")), invoice && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("p", {
25087
25760
  className: "plc-mr-2 pelcro-invoice-creation-date"
25088
- }, `${t("labels.creationDate")} ${formattedCreationDate}`), /*#__PURE__*/React__default.createElement("div", {
25761
+ }, `${t("labels.creationDate")} ${formattedCreationDate}`), hasPlanDetails && /*#__PURE__*/React__default.createElement("div", {
25089
25762
  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"
25090
25763
  }, /*#__PURE__*/React__default.createElement("div", {
25091
25764
  className: "plc-break-words pelcro-invoice-plan-name"
@@ -25111,7 +25784,7 @@ const InvoiceDetailsView = props => {
25111
25784
  className: "plc-font-semibold pelcro-invoice-total"
25112
25785
  }, getFormattedPriceByLocal(invoice.amount_remaining, invoice.currency, getPageOrDefaultLanguage())))))), /*#__PURE__*/React__default.createElement("div", {
25113
25786
  className: "plc-flex plc-items-center plc-justify-center plc-mt-4"
25114
- }, /*#__PURE__*/React__default.createElement(InvoiceDetailsDownloadButton, {
25787
+ }, showDownloadButton && /*#__PURE__*/React__default.createElement(InvoiceDetailsDownloadButton, {
25115
25788
  url: invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf,
25116
25789
  className: "plc-w-full plc-text-center"
25117
25790
  }), showPayButton && /*#__PURE__*/React__default.createElement(InvoiceDetailsPayButton, {
@@ -25151,4 +25824,230 @@ const InvoiceDetailsModal = ({
25151
25824
  };
25152
25825
  InvoiceDetailsModal.viewId = "invoice-details";
25153
25826
 
25154
- export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCreateContainer, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
25827
+ const initialState = {
25828
+ selectedOption: ""
25829
+ };
25830
+ const store = /*#__PURE__*/createContext(initialState);
25831
+ const {
25832
+ Provider
25833
+ } = store;
25834
+
25835
+ const SubscriptionOptionsContainer = ({
25836
+ style,
25837
+ className = "",
25838
+ onRenewSubSuccess = () => {},
25839
+ onNewSubSuccess = () => {},
25840
+ children,
25841
+ ...props
25842
+ }) => {
25843
+ const submit = ({
25844
+ selectedOption
25845
+ }, dispatch) => {
25846
+ if (selectedOption === "renew") return onRenewSubSuccess();
25847
+ if (selectedOption === "new") return onNewSubSuccess();
25848
+ };
25849
+
25850
+ const [state, dispatch] = useReducerWithSideEffects((state, action) => {
25851
+ switch (action.type) {
25852
+ case SWITCH_TO_NEW:
25853
+ return lib_7({ ...state,
25854
+ selectedOption: "new"
25855
+ });
25856
+
25857
+ case SWITCH_TO_RENEW:
25858
+ return lib_7({ ...state,
25859
+ selectedOption: "renew"
25860
+ });
25861
+
25862
+ case HANDLE_SUBMIT:
25863
+ return lib_4((state, dispatch) => submit(state));
25864
+
25865
+ default:
25866
+ return state;
25867
+ }
25868
+ }, initialState);
25869
+ return /*#__PURE__*/React__default.createElement("div", {
25870
+ style: { ...style
25871
+ },
25872
+ className: `pelcro-container pelcro-subscription-options-container ${className}`
25873
+ }, /*#__PURE__*/React__default.createElement(Provider, {
25874
+ value: {
25875
+ state,
25876
+ dispatch
25877
+ }
25878
+ }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
25879
+ store,
25880
+ key: i
25881
+ })) : /*#__PURE__*/React__default.cloneElement(children, {
25882
+ store
25883
+ })));
25884
+ };
25885
+
25886
+ var _path;
25887
+
25888
+ 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); }
25889
+
25890
+ function SvgPlusCircle(props) {
25891
+ return /*#__PURE__*/React.createElement("svg", _extends({
25892
+ xmlns: "http://www.w3.org/2000/svg",
25893
+ className: "plc-h-6 plc-w-6",
25894
+ fill: "none",
25895
+ viewBox: "0 0 24 24",
25896
+ stroke: "currentColor",
25897
+ strokeWidth: 2
25898
+ }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
25899
+ strokeLinecap: "round",
25900
+ strokeLinejoin: "round",
25901
+ d: "M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"
25902
+ })));
25903
+ }
25904
+
25905
+ const SubscriptionOptionsNewButton = ({
25906
+ name,
25907
+ onClick,
25908
+ ...otherProps
25909
+ }) => {
25910
+ const {
25911
+ dispatch,
25912
+ state: {
25913
+ selectedOption
25914
+ }
25915
+ } = useContext(store);
25916
+ const {
25917
+ t
25918
+ } = useTranslation("subscriptionOptions");
25919
+ const isChecked = selectedOption === "new";
25920
+ return /*#__PURE__*/React__default.createElement(Radio, Object.assign({
25921
+ className: "plc-hidden pelcro-new-sub-option",
25922
+ 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"}`,
25923
+ id: "pelcro-new-sub-option",
25924
+ name: "option",
25925
+ onChange: () => {
25926
+ dispatch({
25927
+ type: SWITCH_TO_NEW
25928
+ });
25929
+ onClick === null || onClick === void 0 ? void 0 : onClick();
25930
+ },
25931
+ checked: isChecked
25932
+ }, otherProps), name !== null && name !== void 0 ? name : t("addNew"), /*#__PURE__*/React__default.createElement(SvgPlusCircle, {
25933
+ className: "plc-w-full plc-h-full plc-mr-0"
25934
+ }));
25935
+ };
25936
+
25937
+ const SubscriptionOptionsRenewButton = ({
25938
+ name,
25939
+ onClick,
25940
+ ...otherProps
25941
+ }) => {
25942
+ const {
25943
+ dispatch,
25944
+ state: {
25945
+ selectedOption
25946
+ }
25947
+ } = useContext(store);
25948
+ const {
25949
+ t
25950
+ } = useTranslation("subscriptionOptions");
25951
+ const isChecked = selectedOption === "renew";
25952
+ return /*#__PURE__*/React__default.createElement(Radio, Object.assign({
25953
+ className: "plc-hidden pelcro-renew-sub-option",
25954
+ 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"}`,
25955
+ id: "pelcro-renew-sub-option",
25956
+ name: "option",
25957
+ onChange: () => {
25958
+ dispatch({
25959
+ type: SWITCH_TO_RENEW
25960
+ });
25961
+ onClick === null || onClick === void 0 ? void 0 : onClick();
25962
+ },
25963
+ checked: isChecked
25964
+ }, otherProps), name !== null && name !== void 0 ? name : t("renew"), /*#__PURE__*/React__default.createElement(SvgRefresh, {
25965
+ className: "plc-w-full plc-h-full plc-mr-0"
25966
+ }));
25967
+ };
25968
+
25969
+ const SubscriptionOptionsSubmit = ({
25970
+ name,
25971
+ onClick,
25972
+ ...otherProps
25973
+ }) => {
25974
+ const {
25975
+ dispatch,
25976
+ state: {
25977
+ selectedOption
25978
+ }
25979
+ } = useContext(store);
25980
+ const {
25981
+ t
25982
+ } = useTranslation("subscriptionOptions");
25983
+ return /*#__PURE__*/React__default.createElement(Button, Object.assign({
25984
+ onClick: () => {
25985
+ dispatch({
25986
+ type: HANDLE_SUBMIT
25987
+ });
25988
+ onClick === null || onClick === void 0 ? void 0 : onClick();
25989
+ },
25990
+ disabled: !selectedOption
25991
+ }, otherProps), name !== null && name !== void 0 ? name : t("next"));
25992
+ };
25993
+
25994
+ const SubscriptionOptionsView = props => {
25995
+ const {
25996
+ t
25997
+ } = useTranslation("subscriptionOptions");
25998
+ return /*#__PURE__*/React__default.createElement("div", {
25999
+ id: "pelcro-subscription-options-view"
26000
+ }, /*#__PURE__*/React__default.createElement("div", {
26001
+ className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
26002
+ }, /*#__PURE__*/React__default.createElement("h4", {
26003
+ className: "plc-text-2xl plc-font-semibold"
26004
+ }, t("title")), /*#__PURE__*/React__default.createElement("p", null, t("subtitle"))), /*#__PURE__*/React__default.createElement("form", {
26005
+ action: "javascript:void(0);",
26006
+ className: "plc-mt-2 pelcro-form"
26007
+ }, /*#__PURE__*/React__default.createElement(SubscriptionOptionsContainer, props, /*#__PURE__*/React__default.createElement("div", {
26008
+ className: "plc-flex plc-justify-between plc-items-center"
26009
+ }, /*#__PURE__*/React__default.createElement(SubscriptionOptionsRenewButton, null), /*#__PURE__*/React__default.createElement(SubscriptionOptionsNewButton, null)), /*#__PURE__*/React__default.createElement(SubscriptionOptionsSubmit, {
26010
+ role: "submit",
26011
+ className: "plc-mt-4 plc-w-full",
26012
+ name: t("next"),
26013
+ id: "pelcro-submit"
26014
+ }))));
26015
+ };
26016
+
26017
+ const SubscriptionOptionsModal = ({
26018
+ onDisplay,
26019
+ onClose,
26020
+ ...otherProps
26021
+ }) => {
26022
+ const {
26023
+ switchView,
26024
+ setProductsList
26025
+ } = usePelcro();
26026
+
26027
+ const onRenewSubSuccess = () => {
26028
+ var _otherProps$onRenewSu;
26029
+
26030
+ (_otherProps$onRenewSu = otherProps.onRenewSubSuccess) === null || _otherProps$onRenewSu === void 0 ? void 0 : _otherProps$onRenewSu.call(otherProps);
26031
+ setProductsList(getRenewableProducts());
26032
+ switchView("_plan-select-renew");
26033
+ };
26034
+
26035
+ const onNewSubSuccess = () => {
26036
+ var _otherProps$onNewSubS;
26037
+
26038
+ (_otherProps$onNewSubS = otherProps.onNewSubSuccess) === null || _otherProps$onNewSubS === void 0 ? void 0 : _otherProps$onNewSubS.call(otherProps);
26039
+ switchView("plan-select");
26040
+ };
26041
+
26042
+ return /*#__PURE__*/React__default.createElement(Modal, {
26043
+ onDisplay: onDisplay,
26044
+ onClose: onClose,
26045
+ id: "pelcro-subscription-options-modal"
26046
+ }, /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(SubscriptionOptionsView, Object.assign({}, otherProps, {
26047
+ onNewSubSuccess: onNewSubSuccess,
26048
+ onRenewSubSuccess: onRenewSubSuccess
26049
+ }))), /*#__PURE__*/React__default.createElement(ModalFooter, null, /*#__PURE__*/React__default.createElement(Authorship, null)));
26050
+ };
26051
+ SubscriptionOptionsModal.viewId = "subscription-options";
26052
+
26053
+ export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCreateContainer, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionOptionsContainer, SubscriptionOptionsModal, SubscriptionOptionsNewButton, SubscriptionOptionsRenewButton, SubscriptionOptionsSubmit, SubscriptionOptionsView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };