@pelcro/react-pelcro-js 3.2.0-beta.2 → 3.2.0-beta.5

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,12 +4649,12 @@ 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 = "Invoice details";
4658
4658
  var labels = {
4659
4659
  summary: "Summary",
4660
4660
  total: "Total",
@@ -4667,11 +4667,37 @@ var buttons = {
4667
4667
  pay: "Pay now"
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$z() {
7068
- _extends$z = 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$z() {
7079
7163
  return target;
7080
7164
  };
7081
7165
 
7082
- return _extends$z.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$z({}, 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$z({}, state, {
7266
+ return _extends$A({}, state, {
7183
7267
  toasts: state.toasts.map(function (t) {
7184
- return t.id === action.toast.id ? _extends$z({}, 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$z({}, state, {
7295
+ return _extends$A({}, state, {
7212
7296
  toasts: state.toasts.map(function (t) {
7213
- return t.id === toastId || toastId === undefined ? _extends$z({}, 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$z({}, state, {
7305
+ return _extends$A({}, state, {
7222
7306
  toasts: []
7223
7307
  });
7224
7308
  }
7225
7309
 
7226
- return _extends$z({}, 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$z({}, 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$z({}, state, {
7323
+ return _extends$A({}, state, {
7240
7324
  pausedAt: undefined,
7241
7325
  toasts: state.toasts.map(function (t) {
7242
- return _extends$z({}, 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$z({}, 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$z({}, 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$z({}, 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$z({
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$z({}, 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$z({
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$z({
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$z({}, 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$z({
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$z({
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$w;
7876
+ var _path$x;
7793
7877
 
7794
- function _extends$y() { _extends$y = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$y.apply(this, arguments); }
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$y({
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$w || (_path$w = /*#__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$v;
7893
+ var _path$w;
7810
7894
 
7811
- function _extends$x() { _extends$x = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$x.apply(this, arguments); }
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$x({
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$v || (_path$v = /*#__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$u;
7909
+ var _path$v;
7826
7910
 
7827
- function _extends$w() { _extends$w = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$w.apply(this, arguments); }
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$w({
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$u || (_path$u = /*#__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$t;
7924
+ var _path$u;
7841
7925
 
7842
- function _extends$v() { _extends$v = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$v.apply(this, arguments); }
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$v({
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$t || (_path$t = /*#__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$s, _path2$4;
7941
+ var _path$t, _path2$4;
7858
7942
 
7859
- function _extends$u() { _extends$u = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
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$u({
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$s || (_path$s = /*#__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",
@@ -9195,7 +9283,7 @@ const PelcroModalController = ({
9195
9283
  type
9196
9284
  }) => (type === null || type === void 0 ? void 0 : type.viewId) === "dashboard-open"), React__default.Children.map(children, child => child).find(({
9197
9285
  type
9198
- }) => (type === null || type === void 0 ? void 0 : type.viewId) === "notification"), view === "_plan-select-entitlements" && React__default.Children.map(children, child => child).find(({
9286
+ }) => (type === null || type === void 0 ? void 0 : type.viewId) === "notification"), view === "_plan-select-renew" && React__default.Children.map(children, child => child).find(({
9199
9287
  type
9200
9288
  }) => (type === null || type === void 0 ? void 0 : type.viewId) === "plan-select"), React__default.Children.map(children, child => child).find(({
9201
9289
  type
@@ -9476,8 +9564,10 @@ const LOAD_PAYMENT_METHODS = "LOAD_PAYMENT_METHODS";
9476
9564
  const GET_NEWSLETTERS_FETCH = "GET_NEWSLETTERS_FETCH";
9477
9565
  const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
9478
9566
  const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
9567
+ const SWITCH_TO_RENEW = "SWITCH_TO_RENEW";
9568
+ const SWITCH_TO_NEW = "SWITCH_TO_NEW";
9479
9569
 
9480
- const initialState$h = {
9570
+ const initialState$i = {
9481
9571
  email: "",
9482
9572
  password: "",
9483
9573
  emailError: null,
@@ -9488,10 +9578,10 @@ const initialState$h = {
9488
9578
  content: ""
9489
9579
  }
9490
9580
  };
9491
- const store$h = /*#__PURE__*/createContext(initialState$h);
9581
+ const store$i = /*#__PURE__*/createContext(initialState$i);
9492
9582
  const {
9493
- Provider: Provider$h
9494
- } = store$h;
9583
+ Provider: Provider$i
9584
+ } = store$i;
9495
9585
 
9496
9586
  const LoginContainer = ({
9497
9587
  style,
@@ -9598,7 +9688,7 @@ const LoginContainer = ({
9598
9688
  });
9599
9689
 
9600
9690
  case RESET_LOGIN_FORM:
9601
- return initialState$h;
9691
+ return initialState$i;
9602
9692
 
9603
9693
  case DISABLE_LOGIN_BUTTON:
9604
9694
  return lib_7({ ...state,
@@ -9616,12 +9706,12 @@ const LoginContainer = ({
9616
9706
  default:
9617
9707
  return state;
9618
9708
  }
9619
- }, initialState$h);
9709
+ }, initialState$i);
9620
9710
  return /*#__PURE__*/React__default.createElement("div", {
9621
9711
  style: { ...style
9622
9712
  },
9623
9713
  className: `pelcro-container pelcro-login-container ${className}`
9624
- }, /*#__PURE__*/React__default.createElement(Provider$h, {
9714
+ }, /*#__PURE__*/React__default.createElement(Provider$i, {
9625
9715
  value: {
9626
9716
  state,
9627
9717
  dispatch
@@ -9629,12 +9719,12 @@ const LoginContainer = ({
9629
9719
  }, children.length ? children.map((child, i) => {
9630
9720
  if (child) {
9631
9721
  return /*#__PURE__*/React__default.cloneElement(child, {
9632
- store: store$h,
9722
+ store: store$i,
9633
9723
  key: i
9634
9724
  });
9635
9725
  }
9636
9726
  }) : /*#__PURE__*/React__default.cloneElement(children, {
9637
- store: store$h
9727
+ store: store$i
9638
9728
  })));
9639
9729
  };
9640
9730
 
@@ -9879,7 +9969,7 @@ const LoginButton = ({
9879
9969
  buttonDisabled
9880
9970
  },
9881
9971
  dispatch
9882
- } = useContext(store$h);
9972
+ } = useContext(store$i);
9883
9973
  const {
9884
9974
  t
9885
9975
  } = useTranslation("login");
@@ -9900,23 +9990,23 @@ const LoginButton = ({
9900
9990
  };
9901
9991
 
9902
9992
  const LoginEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
9903
- store: store$h
9993
+ store: store$i
9904
9994
  }, props));
9905
9995
 
9906
9996
  const LoginPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
9907
- store: store$h
9997
+ store: store$i
9908
9998
  }, props));
9909
9999
 
9910
- var _path$r;
10000
+ var _path$s;
9911
10001
 
9912
- function _extends$t() { _extends$t = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
10002
+ 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); }
9913
10003
 
9914
10004
  function SvgCheck(props) {
9915
- return /*#__PURE__*/React.createElement("svg", _extends$t({
10005
+ return /*#__PURE__*/React.createElement("svg", _extends$u({
9916
10006
  xmlns: "http://www.w3.org/2000/svg",
9917
10007
  fill: "currentColor",
9918
10008
  viewBox: "0 0 20 20"
9919
- }, props), _path$r || (_path$r = /*#__PURE__*/React.createElement("path", {
10009
+ }, props), _path$s || (_path$s = /*#__PURE__*/React.createElement("path", {
9920
10010
  fillRule: "evenodd",
9921
10011
  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",
9922
10012
  clipRule: "evenodd"
@@ -9981,7 +10071,7 @@ var facebookLoginRenderProps = createCommonjsModule(function (module, exports) {
9981
10071
  var FacebookLogin = unwrapExports(facebookLoginRenderProps);
9982
10072
  facebookLoginRenderProps.FacebookLogin;
9983
10073
 
9984
- const initialState$g = {
10074
+ const initialState$h = {
9985
10075
  email: "",
9986
10076
  password: "",
9987
10077
  emailError: null,
@@ -9998,10 +10088,10 @@ const initialState$g = {
9998
10088
  content: ""
9999
10089
  }
10000
10090
  };
10001
- const store$g = /*#__PURE__*/createContext(initialState$g);
10091
+ const store$h = /*#__PURE__*/createContext(initialState$h);
10002
10092
  const {
10003
- Provider: Provider$g
10004
- } = store$g;
10093
+ Provider: Provider$h
10094
+ } = store$h;
10005
10095
 
10006
10096
  const RegisterContainer = ({
10007
10097
  style,
@@ -10184,7 +10274,7 @@ const RegisterContainer = ({
10184
10274
  });
10185
10275
 
10186
10276
  case RESET_LOGIN_FORM:
10187
- return initialState$g;
10277
+ return initialState$h;
10188
10278
 
10189
10279
  case DISABLE_REGISTRATION_BUTTON:
10190
10280
  return lib_7({ ...state,
@@ -10202,12 +10292,12 @@ const RegisterContainer = ({
10202
10292
  default:
10203
10293
  return state;
10204
10294
  }
10205
- }, initialState$g);
10295
+ }, initialState$h);
10206
10296
  return /*#__PURE__*/React__default.createElement("div", {
10207
10297
  style: { ...style
10208
10298
  },
10209
10299
  className: `pelcro-container pelcro-register-container ${className}`
10210
- }, /*#__PURE__*/React__default.createElement(Provider$g, {
10300
+ }, /*#__PURE__*/React__default.createElement(Provider$h, {
10211
10301
  value: {
10212
10302
  state,
10213
10303
  dispatch
@@ -10215,12 +10305,12 @@ const RegisterContainer = ({
10215
10305
  }, children.length ? children.map((child, i) => {
10216
10306
  if (child) {
10217
10307
  return /*#__PURE__*/React__default.cloneElement(child, {
10218
- store: store$g,
10308
+ store: store$h,
10219
10309
  key: i
10220
10310
  });
10221
10311
  }
10222
10312
  }) : /*#__PURE__*/React__default.cloneElement(children, {
10223
- store: store$g
10313
+ store: store$h
10224
10314
  })));
10225
10315
  };
10226
10316
  /**
@@ -10235,15 +10325,15 @@ function hasSecurityTokenEnabled$1() {
10235
10325
  return hasSecuritySdkLoaded;
10236
10326
  }
10237
10327
 
10238
- var _path$q;
10328
+ var _path$r;
10239
10329
 
10240
- function _extends$s() { _extends$s = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
10330
+ 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); }
10241
10331
 
10242
10332
  function SvgFacebookLogo(props) {
10243
- return /*#__PURE__*/React.createElement("svg", _extends$s({
10333
+ return /*#__PURE__*/React.createElement("svg", _extends$t({
10244
10334
  xmlns: "http://www.w3.org/2000/svg",
10245
10335
  viewBox: "88.428 12.828 107.543 207.085"
10246
- }, props), _path$q || (_path$q = /*#__PURE__*/React.createElement("path", {
10336
+ }, props), _path$r || (_path$r = /*#__PURE__*/React.createElement("path", {
10247
10337
  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",
10248
10338
  fill: "#3c5a9a"
10249
10339
  })));
@@ -10260,10 +10350,10 @@ const FacebookLoginButton = ({
10260
10350
  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;
10261
10351
  const {
10262
10352
  dispatch: loginDispatch
10263
- } = useContext(store$h);
10353
+ } = useContext(store$i);
10264
10354
  const {
10265
10355
  dispatch: registerDispatch
10266
- } = useContext(store$g);
10356
+ } = useContext(store$h);
10267
10357
 
10268
10358
  const onSuccess = facebookUser => {
10269
10359
  loginDispatch === null || loginDispatch === void 0 ? void 0 : loginDispatch({
@@ -10316,15 +10406,15 @@ var googleLogin = createCommonjsModule(function (module, exports) {
10316
10406
  unwrapExports(googleLogin);
10317
10407
  var googleLogin_1 = googleLogin.GoogleLogin;
10318
10408
 
10319
- var _path$p, _path2$3, _path3$1, _path4;
10409
+ var _path$q, _path2$3, _path3$1, _path4;
10320
10410
 
10321
- function _extends$r() { _extends$r = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
10411
+ 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); }
10322
10412
 
10323
10413
  function SvgGoogleLogo(props) {
10324
- return /*#__PURE__*/React.createElement("svg", _extends$r({
10414
+ return /*#__PURE__*/React.createElement("svg", _extends$s({
10325
10415
  viewBox: "0 0 24 24",
10326
10416
  xmlns: "http://www.w3.org/2000/svg"
10327
- }, props), _path$p || (_path$p = /*#__PURE__*/React.createElement("path", {
10417
+ }, props), _path$q || (_path$q = /*#__PURE__*/React.createElement("path", {
10328
10418
  fill: "#4285F4",
10329
10419
  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"
10330
10420
  })), _path2$3 || (_path2$3 = /*#__PURE__*/React.createElement("path", {
@@ -10350,10 +10440,10 @@ const GoogleLoginButton = ({
10350
10440
  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;
10351
10441
  const {
10352
10442
  dispatch: loginDispatch
10353
- } = useContext(store$h);
10443
+ } = useContext(store$i);
10354
10444
  const {
10355
10445
  dispatch: registerDispatch
10356
- } = useContext(store$g);
10446
+ } = useContext(store$h);
10357
10447
 
10358
10448
  const onSuccess = response => {
10359
10449
  var _response$getAuthResp, _profile$getEmail, _profile$getGivenName, _profile$getFamilyNam, _profile$getEmail2, _profile$getGivenName2, _profile$getFamilyNam2;
@@ -10401,15 +10491,15 @@ const GoogleLoginButton = ({
10401
10491
  }) : null;
10402
10492
  };
10403
10493
 
10404
- var _path$o;
10494
+ var _path$p;
10405
10495
 
10406
- function _extends$q() { _extends$q = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
10496
+ 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); }
10407
10497
 
10408
10498
  function SvgAuth0Logo(props) {
10409
- return /*#__PURE__*/React.createElement("svg", _extends$q({
10499
+ return /*#__PURE__*/React.createElement("svg", _extends$r({
10410
10500
  viewBox: "0 0 256 285",
10411
10501
  xmlns: "http://www.w3.org/2000/svg"
10412
- }, props), _path$o || (_path$o = /*#__PURE__*/React.createElement("path", {
10502
+ }, props), _path$p || (_path$p = /*#__PURE__*/React.createElement("path", {
10413
10503
  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"
10414
10504
  })));
10415
10505
  }
@@ -10449,10 +10539,10 @@ const Auth0LoginButton = ({
10449
10539
  }, [auth0Enabled, auth0Loaded]);
10450
10540
  const {
10451
10541
  dispatch: loginDispatch
10452
- } = useContext(store$h);
10542
+ } = useContext(store$i);
10453
10543
  const {
10454
10544
  dispatch: registerDispatch
10455
- } = useContext(store$g);
10545
+ } = useContext(store$h);
10456
10546
 
10457
10547
  function handleClick() {
10458
10548
  var _auth0InstanceRef$cur, _auth0InstanceRef$cur2, _auth0InstanceRef$cur3;
@@ -10585,15 +10675,15 @@ function LoginView(props) {
10585
10675
  }, /*#__PURE__*/React__default.createElement(GoogleLoginButton, null), /*#__PURE__*/React__default.createElement(FacebookLoginButton, null), /*#__PURE__*/React__default.createElement(Auth0LoginButton, null))))));
10586
10676
  }
10587
10677
 
10588
- var _path$n, _path2$2, _path3;
10678
+ var _path$o, _path2$2, _path3;
10589
10679
 
10590
- function _extends$p() { _extends$p = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
10680
+ 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); }
10591
10681
 
10592
10682
  function SvgPelcroAuthorship(props) {
10593
- return /*#__PURE__*/React.createElement("svg", _extends$p({
10683
+ return /*#__PURE__*/React.createElement("svg", _extends$q({
10594
10684
  xmlns: "http://www.w3.org/2000/svg",
10595
10685
  viewBox: "0 -80.652 497.072 179.991"
10596
- }, props), _path$n || (_path$n = /*#__PURE__*/React.createElement("path", {
10686
+ }, props), _path$o || (_path$o = /*#__PURE__*/React.createElement("path", {
10597
10687
  fill: "none",
10598
10688
  stroke: "#4a4a4a",
10599
10689
  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"
@@ -10740,11 +10830,11 @@ function LoginModal({
10740
10830
  LoginModal.viewId = "login";
10741
10831
 
10742
10832
  const RegisterEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
10743
- store: store$g
10833
+ store: store$h
10744
10834
  }, props));
10745
10835
 
10746
10836
  const RegisterPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
10747
- store: store$g
10837
+ store: store$h
10748
10838
  }, props));
10749
10839
 
10750
10840
  const RegisterButton = ({
@@ -10764,7 +10854,7 @@ const RegisterButton = ({
10764
10854
  buttonDisabled
10765
10855
  },
10766
10856
  dispatch
10767
- } = useContext(store$g);
10857
+ } = useContext(store$h);
10768
10858
  const {
10769
10859
  t
10770
10860
  } = useTranslation("register");
@@ -10902,7 +10992,7 @@ function FirstName({
10902
10992
  }
10903
10993
 
10904
10994
  const RegisterFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
10905
- store: store$g
10995
+ store: store$h
10906
10996
  }, props));
10907
10997
 
10908
10998
  function LastName({
@@ -10933,7 +11023,7 @@ function LastName({
10933
11023
  }
10934
11024
 
10935
11025
  const RegisterLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
10936
- store: store$g
11026
+ store: store$h
10937
11027
  }, props));
10938
11028
 
10939
11029
  /**
@@ -11057,7 +11147,7 @@ function TextInput({
11057
11147
 
11058
11148
  const RegisterTextInput = props => {
11059
11149
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
11060
- store: store$g
11150
+ store: store$h
11061
11151
  }));
11062
11152
  };
11063
11153
 
@@ -11204,6 +11294,7 @@ function SelectModalWithHook(props) {
11204
11294
  (_props$onDisplay = props.onDisplay) === null || _props$onDisplay === void 0 ? void 0 : _props$onDisplay.call(props);
11205
11295
  }, []);
11206
11296
  const {
11297
+ productsList,
11207
11298
  isGift,
11208
11299
  plan,
11209
11300
  product,
@@ -11213,11 +11304,12 @@ function SelectModalWithHook(props) {
11213
11304
  view,
11214
11305
  set
11215
11306
  } = usePelcro();
11216
- const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
11217
- const entitlements = entitlementsProtectedElements.length > 0 ? getEntitlementsFromElem(entitlementsProtectedElements[0]) : null;
11307
+ const isRenewingSub = view === "_plan-select-renew";
11218
11308
  return /*#__PURE__*/React__default.createElement(SelectModalWithTrans, {
11309
+ productsList: productsList,
11219
11310
  isGift: isGift,
11220
- disableGifting: isRenewingGift,
11311
+ disableGifting: isRenewingGift || isRenewingSub,
11312
+ isRenewingSub: isRenewingSub,
11221
11313
  plan: plan,
11222
11314
  product: product,
11223
11315
  onClose: () => {
@@ -11231,8 +11323,10 @@ function SelectModalWithHook(props) {
11231
11323
  plan,
11232
11324
  isGift
11233
11325
  }),
11234
- setView: switchView,
11235
- matchingEntitlements: view === "_plan-select-entitlements" ? entitlements : null
11326
+ setSubscriptionIdToRenew: subscriptionIdToRenew => set({
11327
+ subscriptionIdToRenew
11328
+ }),
11329
+ setView: switchView
11236
11330
  });
11237
11331
  }
11238
11332
  SelectModalWithHook.viewId = "plan-select";
@@ -11264,10 +11358,10 @@ class SelectModal extends Component {
11264
11358
  });
11265
11359
  }
11266
11360
 
11267
- if (this.state.productList.length === 1) {
11361
+ if (this.props.productsList.length === 1) {
11268
11362
  this.setState({
11269
- product: this.state.productList[0],
11270
- planList: this.state.productList[0].plans,
11363
+ product: this.props.productsList[0],
11364
+ planList: this.props.productsList[0].plans,
11271
11365
  mode: "plan"
11272
11366
  });
11273
11367
  }
@@ -11284,7 +11378,7 @@ class SelectModal extends Component {
11284
11378
  });
11285
11379
 
11286
11380
  _defineProperty$3(this, "onProductChange", e => {
11287
- const product = window.Pelcro.product.list()[e.target.selectedIndex];
11381
+ const product = productsList[e.target.selectedIndex];
11288
11382
  this.setState({
11289
11383
  product: product,
11290
11384
  plan: product.plans[0]
@@ -11350,7 +11444,7 @@ class SelectModal extends Component {
11350
11444
 
11351
11445
  _defineProperty$3(this, "renderProducts", () => {
11352
11446
  const userDidSelectProduct = Boolean(this.state.mode === "plan");
11353
- const productsToShow = userDidSelectProduct ? [this.state.product] : this.state.productList;
11447
+ const productsToShow = userDidSelectProduct ? [this.state.product] : this.props.productsList;
11354
11448
  return productsToShow.map((product, index) => {
11355
11449
  return this.renderOneProduct(product, index);
11356
11450
  });
@@ -11363,7 +11457,7 @@ class SelectModal extends Component {
11363
11457
  return this.renderOneProduct(this.state.product);
11364
11458
  }
11365
11459
 
11366
- const [productsThatMatchArticleTag, allProductsMinusMatched] = productsWithMatchedTaggedFirst(); // Render normal products if there are no available matching products
11460
+ const [productsThatMatchArticleTag, allProductsMinusMatched] = productsWithMatchedTaggedFirst(this.props.productsList); // Render normal products if there are no available matching products
11367
11461
 
11368
11462
  if (!(productsThatMatchArticleTag !== null && productsThatMatchArticleTag !== void 0 && productsThatMatchArticleTag.length)) {
11369
11463
  return this.renderProducts();
@@ -11379,10 +11473,7 @@ class SelectModal extends Component {
11379
11473
  className: "plc-text-sm plc-font-semibold"
11380
11474
  }, this.locale("labels.restrictiveArticles.or")), allProductsMinusMatched.map((product, index) => this.renderOneProduct(product, index))));
11381
11475
 
11382
- function productsWithMatchedTaggedFirst() {
11383
- var _window$Pelcro$produc;
11384
-
11385
- const allProducts = (_window$Pelcro$produc = window.Pelcro.product.list()) !== null && _window$Pelcro$produc !== void 0 ? _window$Pelcro$produc : [];
11476
+ function productsWithMatchedTaggedFirst(allProducts) {
11386
11477
  const productsThatMatchArticleTag = window.Pelcro.product.getByMatchingPageTags();
11387
11478
  const allProductsMinusMatched = allProducts.filter(product => !productsThatMatchArticleTag.some(matchedProduct => matchedProduct.id === product.id));
11388
11479
  return [productsThatMatchArticleTag, allProductsMinusMatched];
@@ -11416,7 +11507,7 @@ class SelectModal extends Component {
11416
11507
  _defineProperty$3(this, "selectProduct", e => {
11417
11508
  const id = e.target.dataset.key;
11418
11509
 
11419
- for (const product of this.state.productList) {
11510
+ for (const product of this.props.productsList) {
11420
11511
  if (+product.id === +id) {
11421
11512
  var _this$state$plan;
11422
11513
 
@@ -11469,6 +11560,14 @@ class SelectModal extends Component {
11469
11560
 
11470
11561
  _defineProperty$3(this, "submitOption", () => {
11471
11562
  this.props.setProductAndPlan(this.state.product, this.state.plan, this.state.isGift);
11563
+
11564
+ if (this.props.isRenewingSub) {
11565
+ var _matchingSub$id;
11566
+
11567
+ const matchingSub = window.Pelcro.subscription.list().find(sub => sub.plan.id === this.state.plan.id && sub.status === "active" && sub.cancel_at_period_end === 1);
11568
+ this.props.setSubscriptionIdToRenew((_matchingSub$id = matchingSub === null || matchingSub === void 0 ? void 0 : matchingSub.id) !== null && _matchingSub$id !== void 0 ? _matchingSub$id : null);
11569
+ }
11570
+
11472
11571
  const {
11473
11572
  product,
11474
11573
  isGift
@@ -11506,8 +11605,7 @@ class SelectModal extends Component {
11506
11605
  plan: {},
11507
11606
  isGift: props.isGift,
11508
11607
  disabled: true,
11509
- mode: "product",
11510
- productList: props.matchingEntitlements ? window.Pelcro.product.getByEntitlements(props.matchingEntitlements) : window.Pelcro.product.list()
11608
+ mode: "product"
11511
11609
  };
11512
11610
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
11513
11611
  this.locale = this.props.t;
@@ -11515,7 +11613,7 @@ class SelectModal extends Component {
11515
11613
  }
11516
11614
 
11517
11615
  render() {
11518
- var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
11616
+ var _this$props$productsL, _this$props$productsL2, _window$Pelcro$site$r;
11519
11617
 
11520
11618
  const {
11521
11619
  disableGifting
@@ -11549,7 +11647,7 @@ class SelectModal extends Component {
11549
11647
  className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
11550
11648
  }, /*#__PURE__*/React__default.createElement("h4", {
11551
11649
  className: "plc-text-2xl plc-font-semibold"
11552
- }, 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", {
11650
+ }, 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", {
11553
11651
  className: "pelcro-select-products-wrapper"
11554
11652
  }, (_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", {
11555
11653
  className: "plc-overflow-y-scroll plc-max-h-72 pelcro-select-plans-wrapper"
@@ -12713,20 +12811,21 @@ var es_12 = es.injectStripe;
12713
12811
  var es_13 = es.StripeProvider;
12714
12812
 
12715
12813
  /**
12716
- * @TODO: All subscription related business logic should end up moving
12814
+ * @TODO: All payment related business logic should end up moving
12717
12815
  * to this service, and out of react components.
12718
12816
  */
12719
12817
 
12720
12818
  /**
12721
- * Enum for subscription types
12819
+ * Enum for payment types
12722
12820
  * @readonly
12723
12821
  * @enum {string}
12724
12822
  */
12725
- const SUBSCRIPTION_TYPES = {
12823
+ const PAYMENT_TYPES = {
12726
12824
  CREATE_SUBSCRIPTION: "CREATE_SUBSCRIPTION",
12727
12825
  CREATE_GIFTED_SUBSCRIPTION: "CREATE_GIFTED_SUBSCRIPTION",
12728
12826
  RENEW_SUBSCRIPTION: "RENEW_SUBSCRIPTION",
12729
12827
  RENEW_GIFTED_SUBSCRIPTION: "RENEW_GIFTED_SUBSCRIPTION",
12828
+ PURCHASE_ECOMMERCE_ORDER: "PURCHASE_ECOMMERCE_ORDER",
12730
12829
  PAY_INVOICE: "PAY_INVOICE"
12731
12830
  };
12732
12831
 
@@ -12734,9 +12833,8 @@ var _isPaymentGatewayInvalid = /*#__PURE__*/new WeakMap();
12734
12833
 
12735
12834
  var _generateUserError = /*#__PURE__*/new WeakMap();
12736
12835
 
12737
- class Subscription {
12836
+ class Payment {
12738
12837
  /**
12739
- * Subscription service constructor
12740
12838
  * @param {(StripeGateway|PaypalGateway|VantivGateway)} paymentGateway
12741
12839
  */
12742
12840
  constructor(paymentGateway) {
@@ -12748,7 +12846,7 @@ class Subscription {
12748
12846
 
12749
12847
  if (!options.type) {
12750
12848
  callback(_classPrivateFieldGet(this, _generateUserError).call(this), null);
12751
- return console.error("No subscription type provided");
12849
+ return console.error("No payment type provided");
12752
12850
  } // delegate execution to paymentgateway
12753
12851
 
12754
12852
 
@@ -12766,21 +12864,21 @@ class Subscription {
12766
12864
  writable: true,
12767
12865
  value: () => {
12768
12866
  return {
12769
- error: new Error("An error has occured in the subscription service, please try again later")
12867
+ error: new Error("An error has occured in the payment service, please try again later")
12770
12868
  };
12771
12869
  }
12772
12870
  });
12773
12871
 
12774
12872
  if (_classPrivateFieldGet(this, _isPaymentGatewayInvalid).call(this, paymentGateway)) {
12775
12873
  this.paymentGateway = null;
12776
- console.error("Incompatible subscription gateway");
12874
+ console.error("Incompatible payment gateway");
12777
12875
  } else {
12778
12876
  this.paymentGateway = paymentGateway;
12779
12877
  }
12780
12878
  }
12781
12879
  /**
12782
- * @typedef subscriptionOptions
12783
- * @property {SUBSCRIPTION_TYPES} type
12880
+ * @typedef paymentOptions
12881
+ * @property {PAYMENT_TYPES} type
12784
12882
  * @property {string} token
12785
12883
  * @property {object} plan
12786
12884
  * @property {object} [product]
@@ -12791,6 +12889,7 @@ class Subscription {
12791
12889
  * @property {string} addressId
12792
12890
  * @property {number} invoiceId
12793
12891
  * @property {boolean} isExistingSource
12892
+ * @property {Array} items
12794
12893
  */
12795
12894
 
12796
12895
  /**
@@ -12801,8 +12900,8 @@ class Subscription {
12801
12900
  */
12802
12901
 
12803
12902
  /**
12804
- * Subscription execution method
12805
- * @param {subscriptionOptions} options subscription options
12903
+ * Payment execution method
12904
+ * @param {paymentOptions} options payment options
12806
12905
  * @param {executeCallback} callback
12807
12906
  * @return {void}
12808
12907
  */
@@ -12815,7 +12914,7 @@ const PAYMENT_GATEWAYS_ENUM = {
12815
12914
  vantiv: "vantiv"
12816
12915
  };
12817
12916
  /**
12818
- * Subscription Strategies
12917
+ * Payment Strategies
12819
12918
  */
12820
12919
 
12821
12920
  /**
@@ -12832,6 +12931,8 @@ var _renewSubscription = /*#__PURE__*/new WeakMap();
12832
12931
 
12833
12932
  var _renewGiftedSubscription = /*#__PURE__*/new WeakMap();
12834
12933
 
12934
+ var _purchaseEcommerceOrder = /*#__PURE__*/new WeakMap();
12935
+
12835
12936
  var _payInvoice = /*#__PURE__*/new WeakMap();
12836
12937
 
12837
12938
  class StripeGateway {
@@ -12842,7 +12943,7 @@ class StripeGateway {
12842
12943
  });
12843
12944
 
12844
12945
  _defineProperty$3(this, "execute", (options, callback) => {
12845
- const types = SUBSCRIPTION_TYPES;
12946
+ const types = PAYMENT_TYPES;
12846
12947
 
12847
12948
  switch (options.type) {
12848
12949
  case types.CREATE_SUBSCRIPTION:
@@ -12857,11 +12958,14 @@ class StripeGateway {
12857
12958
  case types.RENEW_GIFTED_SUBSCRIPTION:
12858
12959
  return _classPrivateFieldGet(this, _renewGiftedSubscription).call(this, options, callback);
12859
12960
 
12961
+ case types.PURCHASE_ECOMMERCE_ORDER:
12962
+ return _classPrivateFieldGet(this, _purchaseEcommerceOrder).call(this, options, callback);
12963
+
12860
12964
  case types.PAY_INVOICE:
12861
12965
  return _classPrivateFieldGet(this, _payInvoice).call(this, options, callback);
12862
12966
 
12863
12967
  default:
12864
- console.error("Unsupported subscriptiion method: Stripe Gateway");
12968
+ console.error("Unsupported payment method: Stripe Gateway");
12865
12969
  }
12866
12970
  });
12867
12971
 
@@ -12969,6 +13073,35 @@ class StripeGateway {
12969
13073
  }
12970
13074
  });
12971
13075
 
13076
+ _purchaseEcommerceOrder.set(this, {
13077
+ writable: true,
13078
+ value: (options, callback) => {
13079
+ const {
13080
+ token,
13081
+ items,
13082
+ couponCode,
13083
+ addressId,
13084
+ isExistingSource
13085
+ } = options;
13086
+ const params = isExistingSource ? {
13087
+ source_id: token
13088
+ } : {
13089
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway),
13090
+ gateway_token: token
13091
+ };
13092
+ window.Pelcro.ecommerce.order.create({
13093
+ items,
13094
+ coupon_code: couponCode,
13095
+ ...params,
13096
+ ...(addressId && {
13097
+ address_id: addressId
13098
+ })
13099
+ }, (err, res) => {
13100
+ callback(err, res);
13101
+ });
13102
+ }
13103
+ });
13104
+
12972
13105
  _payInvoice.set(this, {
12973
13106
  writable: true,
12974
13107
  value: (options, callback) => {
@@ -13012,7 +13145,7 @@ class PaypalGateway {
13012
13145
  });
13013
13146
 
13014
13147
  _defineProperty$3(this, "execute", (options, callback) => {
13015
- const types = SUBSCRIPTION_TYPES;
13148
+ const types = PAYMENT_TYPES;
13016
13149
 
13017
13150
  switch (options.type) {
13018
13151
  case types.CREATE_SUBSCRIPTION:
@@ -13109,6 +13242,16 @@ var _paymentGateway3 = /*#__PURE__*/new WeakMap();
13109
13242
 
13110
13243
  var _createSubscription3 = /*#__PURE__*/new WeakMap();
13111
13244
 
13245
+ var _renewSubscription2 = /*#__PURE__*/new WeakMap();
13246
+
13247
+ var _createGiftedSubscription3 = /*#__PURE__*/new WeakMap();
13248
+
13249
+ var _renewGiftedSubscription2 = /*#__PURE__*/new WeakMap();
13250
+
13251
+ var _purchaseEcommerceOrder2 = /*#__PURE__*/new WeakMap();
13252
+
13253
+ var _payInvoice3 = /*#__PURE__*/new WeakMap();
13254
+
13112
13255
  class VantivGateway {
13113
13256
  constructor() {
13114
13257
  _paymentGateway3.set(this, {
@@ -13117,14 +13260,29 @@ class VantivGateway {
13117
13260
  });
13118
13261
 
13119
13262
  _defineProperty$3(this, "execute", (options, callback) => {
13120
- const types = SUBSCRIPTION_TYPES;
13263
+ const types = PAYMENT_TYPES;
13121
13264
 
13122
13265
  switch (options.type) {
13123
13266
  case types.CREATE_SUBSCRIPTION:
13124
13267
  return _classPrivateFieldGet(this, _createSubscription3).call(this, options, callback);
13125
13268
 
13269
+ case types.RENEW_SUBSCRIPTION:
13270
+ return _classPrivateFieldGet(this, _renewSubscription2).call(this, options, callback);
13271
+
13272
+ case types.CREATE_GIFTED_SUBSCRIPTION:
13273
+ return _classPrivateFieldGet(this, _createGiftedSubscription3).call(this, options, callback);
13274
+
13275
+ case types.RENEW_GIFTED_SUBSCRIPTION:
13276
+ return _classPrivateFieldGet(this, _renewGiftedSubscription2).call(this, options, callback);
13277
+
13278
+ case types.PURCHASE_ECOMMERCE_ORDER:
13279
+ return _classPrivateFieldGet(this, _purchaseEcommerceOrder2).call(this, options, callback);
13280
+
13281
+ case types.PAY_INVOICE:
13282
+ return _classPrivateFieldGet(this, _payInvoice3).call(this, options, callback);
13283
+
13126
13284
  default:
13127
- console.error("Unsupported subscriptiion method: vantiv Gateway");
13285
+ console.error("Unsupported payment method: vantiv Gateway");
13128
13286
  }
13129
13287
  });
13130
13288
 
@@ -13137,37 +13295,192 @@ class VantivGateway {
13137
13295
  couponCode,
13138
13296
  product,
13139
13297
  quantity = 1,
13140
- addressId
13298
+ addressId,
13299
+ isExistingSource
13141
13300
  } = options;
13301
+ const params = isExistingSource ? {
13302
+ source_id: token
13303
+ } : {
13304
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13305
+ gateway_token: token
13306
+ };
13142
13307
  window.Pelcro.subscription.create({
13143
13308
  quantity,
13144
- gateway_token: token,
13145
- payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13146
13309
  auth_token: window.Pelcro.user.read().auth_token,
13147
13310
  plan_id: plan.id,
13148
13311
  coupon_code: couponCode,
13149
- address_id: product.address_required ? addressId : null
13312
+ address_id: product.address_required ? addressId : null,
13313
+ ...params
13150
13314
  }, (err, res) => {
13151
13315
  callback(err, res);
13152
13316
  });
13153
13317
  }
13154
13318
  });
13155
- }
13156
-
13157
- }
13158
13319
 
13159
- /**
13160
- * @typedef {Object} PaymentStateType
13161
- * @property {boolean} disableSubmit
13162
- * @property {boolean} isLoading
13163
- * @property {boolean} disableCouponButton
13164
- * @property {object} couponObject
13165
- * @property {string} couponCode
13166
- * @property {string} couponError
13167
- * @property {boolean} enableCouponField
13168
- * @property {string} percentOff
13169
- * @property {unknown} canMakePayment
13170
- * @property {unknown} paymentRequest
13320
+ _renewSubscription2.set(this, {
13321
+ writable: true,
13322
+ value: (options, callback) => {
13323
+ const {
13324
+ subscriptionIdToRenew,
13325
+ token,
13326
+ plan,
13327
+ couponCode,
13328
+ product,
13329
+ addressId,
13330
+ isExistingSource
13331
+ } = options;
13332
+ const params = isExistingSource ? {
13333
+ source_id: token
13334
+ } : {
13335
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13336
+ gateway_token: token
13337
+ };
13338
+ window.Pelcro.subscription.renew({
13339
+ auth_token: window.Pelcro.user.read().auth_token,
13340
+ plan_id: plan.id,
13341
+ coupon_code: couponCode,
13342
+ subscription_id: subscriptionIdToRenew,
13343
+ address_id: product.address_required ? addressId : null,
13344
+ ...params
13345
+ }, (err, res) => {
13346
+ callback(err, res);
13347
+ });
13348
+ }
13349
+ });
13350
+
13351
+ _createGiftedSubscription3.set(this, {
13352
+ writable: true,
13353
+ value: (options, callback) => {
13354
+ const {
13355
+ token,
13356
+ plan,
13357
+ couponCode,
13358
+ product,
13359
+ giftRecipient,
13360
+ quantity = 1,
13361
+ addressId,
13362
+ isExistingSource
13363
+ } = options;
13364
+ const params = isExistingSource ? {
13365
+ source_id: token
13366
+ } : {
13367
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13368
+ gateway_token: token
13369
+ };
13370
+ window.Pelcro.subscription.create({
13371
+ quantity,
13372
+ auth_token: window.Pelcro.user.read().auth_token,
13373
+ plan_id: plan.id,
13374
+ coupon_code: couponCode,
13375
+ gift_recipient_email: giftRecipient.email,
13376
+ gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
13377
+ gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
13378
+ gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
13379
+ gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
13380
+ address_id: product.address_required ? addressId : null,
13381
+ ...params
13382
+ }, (err, res) => {
13383
+ callback(err, res);
13384
+ });
13385
+ }
13386
+ });
13387
+
13388
+ _renewGiftedSubscription2.set(this, {
13389
+ writable: true,
13390
+ value: (options, callback) => {
13391
+ const {
13392
+ subscriptionIdToRenew,
13393
+ token,
13394
+ product,
13395
+ plan,
13396
+ couponCode,
13397
+ addressId,
13398
+ isExistingSource
13399
+ } = options;
13400
+ const params = isExistingSource ? {
13401
+ source_id: token
13402
+ } : {
13403
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13404
+ gateway_token: token
13405
+ };
13406
+ window.Pelcro.subscription.renewGift({
13407
+ auth_token: window.Pelcro.user.read().auth_token,
13408
+ plan_id: plan.id,
13409
+ coupon_code: couponCode,
13410
+ subscription_id: subscriptionIdToRenew,
13411
+ address_id: product.address_required ? addressId : null,
13412
+ ...params
13413
+ }, (err, res) => {
13414
+ callback(err, res);
13415
+ });
13416
+ }
13417
+ });
13418
+
13419
+ _purchaseEcommerceOrder2.set(this, {
13420
+ writable: true,
13421
+ value: (options, callback) => {
13422
+ const {
13423
+ token,
13424
+ items,
13425
+ couponCode,
13426
+ addressId,
13427
+ isExistingSource
13428
+ } = options;
13429
+ const params = isExistingSource ? {
13430
+ source_id: token
13431
+ } : {
13432
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13433
+ gateway_token: token
13434
+ };
13435
+ window.Pelcro.ecommerce.order.create({
13436
+ items,
13437
+ coupon_code: couponCode,
13438
+ ...params,
13439
+ ...(addressId && {
13440
+ address_id: addressId
13441
+ })
13442
+ }, (err, res) => {
13443
+ callback(err, res);
13444
+ });
13445
+ }
13446
+ });
13447
+
13448
+ _payInvoice3.set(this, {
13449
+ writable: true,
13450
+ value: (options, callback) => {
13451
+ const {
13452
+ token,
13453
+ invoiceId
13454
+ } = options;
13455
+ const params = options.isExistingSource ? {
13456
+ source_id: token,
13457
+ invoice_id: invoiceId
13458
+ } : {
13459
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13460
+ gateway_token: token,
13461
+ invoice_id: invoiceId
13462
+ };
13463
+ window.Pelcro.invoice.pay(params, (err, res) => {
13464
+ callback(err, res);
13465
+ });
13466
+ }
13467
+ });
13468
+ }
13469
+
13470
+ }
13471
+
13472
+ /**
13473
+ * @typedef {Object} PaymentStateType
13474
+ * @property {boolean} disableSubmit
13475
+ * @property {boolean} isLoading
13476
+ * @property {boolean} disableCouponButton
13477
+ * @property {object} couponObject
13478
+ * @property {string} couponCode
13479
+ * @property {string} couponError
13480
+ * @property {boolean} enableCouponField
13481
+ * @property {string} percentOff
13482
+ * @property {unknown} canMakePayment
13483
+ * @property {unknown} paymentRequest
13171
13484
  * @property {number} updatedPrice
13172
13485
  * @property {number} taxAmount
13173
13486
  * @property {object} currentPlan
@@ -13176,7 +13489,7 @@ class VantivGateway {
13176
13489
 
13177
13490
  /** @type {PaymentStateType} */
13178
13491
 
13179
- const initialState$f = {
13492
+ const initialState$g = {
13180
13493
  disableSubmit: false,
13181
13494
  isLoading: false,
13182
13495
  disableCouponButton: false,
@@ -13195,10 +13508,10 @@ const initialState$f = {
13195
13508
  content: ""
13196
13509
  }
13197
13510
  };
13198
- const store$f = /*#__PURE__*/createContext(initialState$f);
13511
+ const store$g = /*#__PURE__*/createContext(initialState$g);
13199
13512
  const {
13200
- Provider: Provider$f
13201
- } = store$f;
13513
+ Provider: Provider$g
13514
+ } = store$g;
13202
13515
 
13203
13516
  const PaymentMethodContainerWithoutStripe = ({
13204
13517
  style,
@@ -13211,7 +13524,7 @@ const PaymentMethodContainerWithoutStripe = ({
13211
13524
  onFailure = () => {},
13212
13525
  ...props
13213
13526
  }) => {
13214
- var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isRenewingGift, _props$invoice;
13527
+ var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice;
13215
13528
 
13216
13529
  const {
13217
13530
  t
@@ -13227,6 +13540,7 @@ const PaymentMethodContainerWithoutStripe = ({
13227
13540
  const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
13228
13541
  const selectedAddressId = (_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : pelcroStore.selectedAddressId;
13229
13542
  const giftRecipient = (_props$giftRecipient = props.giftRecipient) !== null && _props$giftRecipient !== void 0 ? _props$giftRecipient : pelcroStore.giftRecipient;
13543
+ const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
13230
13544
  const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
13231
13545
  const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
13232
13546
  useEffect(() => {
@@ -13243,7 +13557,11 @@ const PaymentMethodContainerWithoutStripe = ({
13243
13557
  updateTotalAmountWithTax();
13244
13558
  }, []);
13245
13559
 
13246
- function submitVantivPayment() {
13560
+ const submitVantivPayment = () => {
13561
+ if (selectedPaymentMethodId) {
13562
+ return handleVantivPayment(null);
13563
+ }
13564
+
13247
13565
  if (!vantivInstanceRef.current) {
13248
13566
  return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
13249
13567
  }
@@ -13254,43 +13572,118 @@ const PaymentMethodContainerWithoutStripe = ({
13254
13572
  id: orderId,
13255
13573
  orderId: orderId
13256
13574
  });
13257
- }
13575
+ };
13258
13576
 
13259
13577
  function handleVantivPayment(paymentRequest) {
13260
- const SUCCESS_STATUS = "870";
13578
+ if (paymentRequest) {
13579
+ const SUCCESS_STATUS = "870";
13261
13580
 
13262
- if (paymentRequest.response !== SUCCESS_STATUS) {
13263
- return handlePaymentError({
13264
- error: new Error(paymentRequest.message)
13265
- });
13581
+ if (paymentRequest.response !== SUCCESS_STATUS) {
13582
+ return handlePaymentError({
13583
+ error: new Error(paymentRequest.message)
13584
+ });
13585
+ }
13266
13586
  }
13267
13587
 
13268
- const subscription = new Subscription(new VantivGateway());
13269
- const {
13270
- couponCode
13271
- } = state;
13272
- return subscription.execute({
13273
- type: SUBSCRIPTION_TYPES.CREATE_SUBSCRIPTION,
13274
- token: paymentRequest,
13275
- quantity: plan.quantity,
13276
- plan,
13277
- couponCode,
13278
- product,
13279
- addressId: selectedAddressId
13280
- }, (err, res) => {
13281
- if (err) {
13282
- return handlePaymentError(err);
13283
- }
13588
+ const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
13284
13589
 
13285
- onSuccess(res);
13286
- });
13590
+ if (type === "createPayment") {
13591
+ handleVantivSubscription();
13592
+ } else if (type === "orderCreate") {
13593
+ purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
13594
+ } else if (type === "invoicePayment") {
13595
+ payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
13596
+ }
13597
+
13598
+ function handleVantivSubscription() {
13599
+ const payment = new Payment(new VantivGateway());
13600
+ const createSubscription = !isGift && !subscriptionIdToRenew;
13601
+ const renewSubscription = !isGift && subscriptionIdToRenew;
13602
+ const giftSubscriprition = isGift && !subscriptionIdToRenew;
13603
+ const renewGift = isRenewingGift;
13604
+ const {
13605
+ couponCode
13606
+ } = state;
13607
+
13608
+ if (renewGift) {
13609
+ return payment.execute({
13610
+ type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
13611
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13612
+ plan,
13613
+ couponCode,
13614
+ product,
13615
+ isExistingSource: isUsingExistingPaymentMethod,
13616
+ subscriptionIdToRenew,
13617
+ addressId: selectedAddressId
13618
+ }, (err, res) => {
13619
+ if (err) {
13620
+ return handlePaymentError(err);
13621
+ }
13622
+
13623
+ onSuccess(res);
13624
+ });
13625
+ } else if (giftSubscriprition) {
13626
+ return payment.execute({
13627
+ type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
13628
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13629
+ quantity: plan.quantity,
13630
+ plan,
13631
+ couponCode,
13632
+ product,
13633
+ isExistingSource: isUsingExistingPaymentMethod,
13634
+ giftRecipient,
13635
+ addressId: selectedAddressId
13636
+ }, (err, res) => {
13637
+ if (err) {
13638
+ return handlePaymentError(err);
13639
+ }
13640
+
13641
+ onSuccess(res);
13642
+ });
13643
+ } else if (renewSubscription) {
13644
+ return payment.execute({
13645
+ type: PAYMENT_TYPES.RENEW_SUBSCRIPTION,
13646
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13647
+ quantity: plan.quantity,
13648
+ plan,
13649
+ couponCode,
13650
+ product,
13651
+ isExistingSource: isUsingExistingPaymentMethod,
13652
+ subscriptionIdToRenew,
13653
+ addressId: selectedAddressId
13654
+ }, (err, res) => {
13655
+ if (err) {
13656
+ return handlePaymentError(err);
13657
+ }
13658
+
13659
+ onSuccess(res);
13660
+ });
13661
+ } else if (createSubscription) {
13662
+ return payment.execute({
13663
+ type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
13664
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13665
+ quantity: plan.quantity,
13666
+ plan,
13667
+ couponCode,
13668
+ product,
13669
+ isExistingSource: isUsingExistingPaymentMethod,
13670
+ addressId: selectedAddressId
13671
+ }, (err, res) => {
13672
+ if (err) {
13673
+ return handlePaymentError(err);
13674
+ }
13675
+
13676
+ onSuccess(res);
13677
+ });
13678
+ }
13679
+ }
13287
13680
  }
13288
13681
 
13289
13682
  const vantivInstanceRef = React__default.useRef(null);
13290
13683
  useEffect(() => {
13291
13684
  const cardProcessor = getSiteCardProcessor();
13292
13685
 
13293
- if (cardProcessor === "vantiv") {
13686
+ if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
13294
13687
  var _window$Pelcro$site$r;
13295
13688
 
13296
13689
  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;
@@ -13313,7 +13706,7 @@ const PaymentMethodContainerWithoutStripe = ({
13313
13706
  }
13314
13707
  });
13315
13708
  }
13316
- }, []);
13709
+ }, [selectedPaymentMethodId]);
13317
13710
 
13318
13711
  const initPaymentRequest = (state, dispatch) => {
13319
13712
  try {
@@ -13737,7 +14130,7 @@ const PaymentMethodContainerWithoutStripe = ({
13737
14130
 
13738
14131
 
13739
14132
  const handlePaypalSubscription = (state, paypalNonce) => {
13740
- const subscription = new Subscription(new PaypalGateway());
14133
+ const payment = new Payment(new PaypalGateway());
13741
14134
  const {
13742
14135
  couponCode
13743
14136
  } = state;
@@ -13746,8 +14139,8 @@ const PaymentMethodContainerWithoutStripe = ({
13746
14139
  */
13747
14140
 
13748
14141
  if (giftRecipient) {
13749
- return subscription.execute({
13750
- type: SUBSCRIPTION_TYPES.CREATE_GIFTED_SUBSCRIPTION,
14142
+ return payment.execute({
14143
+ type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
13751
14144
  token: paypalNonce,
13752
14145
  quantity: plan.quantity,
13753
14146
  plan,
@@ -13780,8 +14173,8 @@ const PaymentMethodContainerWithoutStripe = ({
13780
14173
  });
13781
14174
  }
13782
14175
 
13783
- return subscription.execute({
13784
- type: SUBSCRIPTION_TYPES.CREATE_SUBSCRIPTION,
14176
+ return payment.execute({
14177
+ type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
13785
14178
  token: paypalNonce,
13786
14179
  quantity: plan.quantity,
13787
14180
  plan,
@@ -13813,7 +14206,7 @@ const PaymentMethodContainerWithoutStripe = ({
13813
14206
  });
13814
14207
  };
13815
14208
 
13816
- const purchase = (stripeSource, state, dispatch) => {
14209
+ const purchase = (gatewayService, gatewayToken, state, dispatch) => {
13817
14210
  const isQuickPurchase = !Array.isArray(order);
13818
14211
  const mappedOrderItems = isQuickPurchase ? [{
13819
14212
  sku_id: order.id,
@@ -13825,14 +14218,14 @@ const PaymentMethodContainerWithoutStripe = ({
13825
14218
  const {
13826
14219
  couponCode
13827
14220
  } = state;
13828
- window.Pelcro.ecommerce.order.create({
13829
- source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
13830
- stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
14221
+ const payment = new Payment(gatewayService);
14222
+ payment.execute({
14223
+ type: PAYMENT_TYPES.PURCHASE_ECOMMERCE_ORDER,
14224
+ token: gatewayToken,
14225
+ isExistingSource: Boolean(selectedPaymentMethodId),
13831
14226
  items: mappedOrderItems,
13832
- coupon_code: couponCode,
13833
- ...(selectedAddressId && {
13834
- address_id: selectedAddressId
13835
- })
14227
+ addressId: selectedAddressId,
14228
+ couponCode
13836
14229
  }, (err, res) => {
13837
14230
  dispatch({
13838
14231
  type: DISABLE_SUBMIT,
@@ -13870,9 +14263,9 @@ const PaymentMethodContainerWithoutStripe = ({
13870
14263
  };
13871
14264
 
13872
14265
  const payInvoice = (gatewayService, gatewayToken, dispatch) => {
13873
- const subscription = new Subscription(gatewayService);
13874
- return subscription.execute({
13875
- type: SUBSCRIPTION_TYPES.PAY_INVOICE,
14266
+ const payment = new Payment(gatewayService);
14267
+ return payment.execute({
14268
+ type: PAYMENT_TYPES.PAY_INVOICE,
13876
14269
  token: gatewayToken,
13877
14270
  isExistingSource: Boolean(selectedPaymentMethodId),
13878
14271
  invoiceId: invoice.id
@@ -14110,7 +14503,7 @@ const PaymentMethodContainerWithoutStripe = ({
14110
14503
  if (stripeSource && type === "createPayment") {
14111
14504
  subscribe(stripeSource, state, dispatch);
14112
14505
  } else if (stripeSource && type === "orderCreate") {
14113
- purchase(stripeSource, state, dispatch);
14506
+ purchase(new StripeGateway(), stripeSource.id, state, dispatch);
14114
14507
  } else if (stripeSource && type === "invoicePayment") {
14115
14508
  payInvoice(new StripeGateway(), stripeSource.id, dispatch);
14116
14509
  }
@@ -14232,6 +14625,10 @@ const PaymentMethodContainerWithoutStripe = ({
14232
14625
  disableSubmit: true,
14233
14626
  isLoading: true
14234
14627
  }, (state, dispatch) => {
14628
+ if (getSiteCardProcessor() === "vantiv") {
14629
+ return submitVantivPayment();
14630
+ }
14631
+
14235
14632
  if (selectedPaymentMethodId) {
14236
14633
  // pay with selected method (source) if exists already
14237
14634
  return handlePayment({
@@ -14244,10 +14641,6 @@ const PaymentMethodContainerWithoutStripe = ({
14244
14641
  return updatePaymentSource(state, dispatch);
14245
14642
  }
14246
14643
 
14247
- if (getSiteCardProcessor() === "vantiv") {
14248
- return submitVantivPayment();
14249
- }
14250
-
14251
14644
  submitPayment(state);
14252
14645
  });
14253
14646
 
@@ -14316,21 +14709,21 @@ const PaymentMethodContainerWithoutStripe = ({
14316
14709
  default:
14317
14710
  return state;
14318
14711
  }
14319
- }, initialState$f);
14712
+ }, initialState$g);
14320
14713
  return /*#__PURE__*/React__default.createElement("div", {
14321
14714
  style: { ...style
14322
14715
  },
14323
14716
  className: `pelcro-container pelcro-payment-container ${className}`
14324
- }, /*#__PURE__*/React__default.createElement(Provider$f, {
14717
+ }, /*#__PURE__*/React__default.createElement(Provider$g, {
14325
14718
  value: {
14326
14719
  state,
14327
14720
  dispatch
14328
14721
  }
14329
14722
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
14330
- store: store$f,
14723
+ store: store$g,
14331
14724
  key: i
14332
14725
  })) : /*#__PURE__*/React__default.cloneElement(children, {
14333
- store: store$f
14726
+ store: store$g
14334
14727
  })));
14335
14728
  };
14336
14729
 
@@ -14352,7 +14745,7 @@ const PaymentMethodContainer = props => {
14352
14745
  stripeAccount: window.Pelcro.site.read().account_id,
14353
14746
  locale: getPageOrDefaultLanguage()
14354
14747
  }, /*#__PURE__*/React__default.createElement(es_11, null, /*#__PURE__*/React__default.createElement(UnwrappedForm, Object.assign({
14355
- store: store$f
14748
+ store: store$g
14356
14749
  }, props))));
14357
14750
  }
14358
14751
 
@@ -14405,7 +14798,7 @@ const PelcroPaymentRequestButton = props => {
14405
14798
  currentPlan,
14406
14799
  updatedPrice
14407
14800
  }
14408
- } = useContext(store$f);
14801
+ } = useContext(store$g);
14409
14802
 
14410
14803
  const updatePaymentRequest = () => {
14411
14804
  // Make sure payment request is up to date, eg. user added a coupon code.
@@ -14481,7 +14874,7 @@ const DiscountedPrice = props => {
14481
14874
  taxAmount,
14482
14875
  percentOff
14483
14876
  }
14484
- } = useContext(store$f);
14877
+ } = useContext(store$g);
14485
14878
  const {
14486
14879
  order,
14487
14880
  plan
@@ -14531,7 +14924,7 @@ const SubmitPaymentMethod = ({
14531
14924
  isLoading,
14532
14925
  updatedPrice
14533
14926
  }
14534
- } = useContext(store$f);
14927
+ } = useContext(store$g);
14535
14928
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
14536
14929
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
14537
14930
  const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
@@ -14552,17 +14945,17 @@ const SubmitPaymentMethod = ({
14552
14945
  }, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
14553
14946
  };
14554
14947
 
14555
- var _path$m;
14948
+ var _path$n;
14556
14949
 
14557
- 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); }
14950
+ 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); }
14558
14951
 
14559
14952
  function SvgArrowLeft(props) {
14560
- return /*#__PURE__*/React.createElement("svg", _extends$o({
14953
+ return /*#__PURE__*/React.createElement("svg", _extends$p({
14561
14954
  xmlns: "http://www.w3.org/2000/svg",
14562
14955
  fill: "none",
14563
14956
  viewBox: "0 0 24 24",
14564
14957
  stroke: "currentColor"
14565
- }, props), _path$m || (_path$m = /*#__PURE__*/React.createElement("path", {
14958
+ }, props), _path$n || (_path$n = /*#__PURE__*/React.createElement("path", {
14566
14959
  strokeLinecap: "round",
14567
14960
  strokeLinejoin: "round",
14568
14961
  strokeWidth: 2,
@@ -14581,7 +14974,7 @@ const ApplyCouponButton = ({
14581
14974
  disableCouponButton
14582
14975
  },
14583
14976
  dispatch
14584
- } = useContext(store$f);
14977
+ } = useContext(store$g);
14585
14978
  const {
14586
14979
  t
14587
14980
  } = useTranslation("checkoutForm");
@@ -14615,7 +15008,7 @@ const CouponCodeField = props => {
14615
15008
  couponCode,
14616
15009
  couponError
14617
15010
  }
14618
- } = useContext(store$f);
15011
+ } = useContext(store$g);
14619
15012
 
14620
15013
  const onCouponCodeChange = e => {
14621
15014
  dispatch({
@@ -14644,17 +15037,17 @@ const CouponCodeField = props => {
14644
15037
  }, props));
14645
15038
  };
14646
15039
 
14647
- var _path$l;
15040
+ var _path$m;
14648
15041
 
14649
- 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); }
15042
+ 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); }
14650
15043
 
14651
15044
  function SvgTicket(props) {
14652
- return /*#__PURE__*/React.createElement("svg", _extends$n({
15045
+ return /*#__PURE__*/React.createElement("svg", _extends$o({
14653
15046
  xmlns: "http://www.w3.org/2000/svg",
14654
15047
  fill: "none",
14655
15048
  viewBox: "0 0 24 24",
14656
15049
  stroke: "currentColor"
14657
- }, props), _path$l || (_path$l = /*#__PURE__*/React.createElement("path", {
15050
+ }, props), _path$m || (_path$m = /*#__PURE__*/React.createElement("path", {
14658
15051
  strokeLinecap: "round",
14659
15052
  strokeLinejoin: "round",
14660
15053
  strokeWidth: 2,
@@ -14671,7 +15064,7 @@ const CouponCode = ({
14671
15064
  state: {
14672
15065
  enableCouponField
14673
15066
  }
14674
- } = useContext(store$f);
15067
+ } = useContext(store$g);
14675
15068
  const {
14676
15069
  t
14677
15070
  } = useTranslation("checkoutForm");
@@ -14928,7 +15321,7 @@ const PaypalSubscribeButton = props => {
14928
15321
  const {
14929
15322
  dispatch,
14930
15323
  state
14931
- } = useContext(store$f);
15324
+ } = useContext(store$g);
14932
15325
  const {
14933
15326
  product,
14934
15327
  plan,
@@ -15014,16 +15407,16 @@ const BankRedirection = () => {
15014
15407
  }));
15015
15408
  };
15016
15409
 
15017
- var _path$k;
15410
+ var _path$l;
15018
15411
 
15019
- 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); }
15412
+ 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); }
15020
15413
 
15021
15414
  function SvgLock(props) {
15022
- return /*#__PURE__*/React.createElement("svg", _extends$m({
15415
+ return /*#__PURE__*/React.createElement("svg", _extends$n({
15023
15416
  xmlns: "http://www.w3.org/2000/svg",
15024
15417
  viewBox: "0 0 20 20",
15025
15418
  fill: "currentColor"
15026
- }, props), _path$k || (_path$k = /*#__PURE__*/React.createElement("path", {
15419
+ }, props), _path$l || (_path$l = /*#__PURE__*/React.createElement("path", {
15027
15420
  fillRule: "evenodd",
15028
15421
  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",
15029
15422
  clipRule: "evenodd"
@@ -15040,7 +15433,7 @@ const SelectedPaymentMethod = () => {
15040
15433
  state: {
15041
15434
  isLoading
15042
15435
  }
15043
- } = useContext(store$f);
15436
+ } = useContext(store$g);
15044
15437
  const {
15045
15438
  switchView,
15046
15439
  selectedPaymentMethodId
@@ -15082,7 +15475,7 @@ const TaxAmount = () => {
15082
15475
  state: {
15083
15476
  taxAmount
15084
15477
  }
15085
- } = useContext(store$f);
15478
+ } = useContext(store$g);
15086
15479
  const {
15087
15480
  plan
15088
15481
  } = usePelcro();
@@ -15246,12 +15639,12 @@ function SubscriptionRenewModal({
15246
15639
  }
15247
15640
  SubscriptionRenewModal.viewId = "subscription-renew";
15248
15641
 
15249
- var _path$j;
15642
+ var _path$k;
15250
15643
 
15251
- 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); }
15644
+ 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); }
15252
15645
 
15253
15646
  function SvgGift(props) {
15254
- return /*#__PURE__*/React.createElement("svg", _extends$l({
15647
+ return /*#__PURE__*/React.createElement("svg", _extends$m({
15255
15648
  className: "plc-w-6 plc-h-6 plc-mr-2",
15256
15649
  fill: "none",
15257
15650
  stroke: "currentColor",
@@ -15260,7 +15653,7 @@ function SvgGift(props) {
15260
15653
  strokeWidth: 2,
15261
15654
  viewBox: "0 0 24 24",
15262
15655
  xmlns: "http://www.w3.org/2000/svg"
15263
- }, props), _path$j || (_path$j = /*#__PURE__*/React.createElement("path", {
15656
+ }, props), _path$k || (_path$k = /*#__PURE__*/React.createElement("path", {
15264
15657
  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"
15265
15658
  })));
15266
15659
  }
@@ -15601,7 +15994,7 @@ class DefaultNewsLetter extends Component {
15601
15994
 
15602
15995
  const NewsLetter = withTranslation("newsletter")(DefaultNewsLetter);
15603
15996
 
15604
- const initialState$e = {
15997
+ const initialState$f = {
15605
15998
  didSubToNewslettersBefore: false,
15606
15999
  newsletters: [],
15607
16000
  isListLoading: true,
@@ -15611,10 +16004,10 @@ const initialState$e = {
15611
16004
  content: ""
15612
16005
  }
15613
16006
  };
15614
- const store$e = /*#__PURE__*/createContext(initialState$e);
16007
+ const store$f = /*#__PURE__*/createContext(initialState$f);
15615
16008
  const {
15616
- Provider: Provider$e
15617
- } = store$e;
16009
+ Provider: Provider$f
16010
+ } = store$f;
15618
16011
 
15619
16012
  const NewsletterUpdateContainer = ({
15620
16013
  style,
@@ -15727,7 +16120,7 @@ const NewsletterUpdateContainer = ({
15727
16120
  default:
15728
16121
  return state;
15729
16122
  }
15730
- }, initialState$e);
16123
+ }, initialState$f);
15731
16124
  useEffect(() => {
15732
16125
  const getUserNewsletters = () => {
15733
16126
  var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
@@ -15771,7 +16164,7 @@ const NewsletterUpdateContainer = ({
15771
16164
  style: { ...style
15772
16165
  },
15773
16166
  className: `pelcro-container pelcro-newsletter-update-container ${className}`
15774
- }, /*#__PURE__*/React__default.createElement(Provider$e, {
16167
+ }, /*#__PURE__*/React__default.createElement(Provider$f, {
15775
16168
  value: {
15776
16169
  state,
15777
16170
  dispatch
@@ -15779,12 +16172,12 @@ const NewsletterUpdateContainer = ({
15779
16172
  }, children.length ? children.map((child, i) => {
15780
16173
  if (child) {
15781
16174
  return /*#__PURE__*/React__default.cloneElement(child, {
15782
- store: store$e,
16175
+ store: store$f,
15783
16176
  key: i
15784
16177
  });
15785
16178
  }
15786
16179
  }) : /*#__PURE__*/React__default.cloneElement(children, {
15787
- store: store$e
16180
+ store: store$f
15788
16181
  })));
15789
16182
  };
15790
16183
 
@@ -15799,7 +16192,7 @@ const NewsletterUpdateButton = ({
15799
16192
  isSubmitting,
15800
16193
  isListLoading
15801
16194
  }
15802
- } = useContext(store$e);
16195
+ } = useContext(store$f);
15803
16196
  const {
15804
16197
  t
15805
16198
  } = useTranslation("newsletter");
@@ -15829,7 +16222,7 @@ const NewsletterUpdateList = () => {
15829
16222
  newsletters,
15830
16223
  isListLoading
15831
16224
  }
15832
- } = useContext(store$e);
16225
+ } = useContext(store$f);
15833
16226
 
15834
16227
  if (isListLoading) {
15835
16228
  return /*#__PURE__*/React__default.createElement(Loader, {
@@ -16033,7 +16426,7 @@ function SubscriptionCreateModal({
16033
16426
  SubscriptionCreateModal.viewId = "subscription-create";
16034
16427
 
16035
16428
  var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
16036
- const initialState$d = {
16429
+ const initialState$e = {
16037
16430
  email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
16038
16431
  firstName: (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.first_name,
16039
16432
  lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
@@ -16046,10 +16439,10 @@ const initialState$d = {
16046
16439
  content: ""
16047
16440
  }
16048
16441
  };
16049
- const store$d = /*#__PURE__*/createContext(initialState$d);
16442
+ const store$e = /*#__PURE__*/createContext(initialState$e);
16050
16443
  const {
16051
- Provider: Provider$d
16052
- } = store$d;
16444
+ Provider: Provider$e
16445
+ } = store$e;
16053
16446
 
16054
16447
  const UserUpdateContainer = ({
16055
16448
  style,
@@ -16181,27 +16574,27 @@ const UserUpdateContainer = ({
16181
16574
  default:
16182
16575
  return state;
16183
16576
  }
16184
- }, initialState$d);
16577
+ }, initialState$e);
16185
16578
  return /*#__PURE__*/React__default.createElement("div", {
16186
16579
  style: { ...style
16187
16580
  },
16188
16581
  className: `pelcro-container pelcro-user-update-container ${className}`
16189
- }, /*#__PURE__*/React__default.createElement(Provider$d, {
16582
+ }, /*#__PURE__*/React__default.createElement(Provider$e, {
16190
16583
  value: {
16191
16584
  state,
16192
16585
  dispatch
16193
16586
  }
16194
16587
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
16195
- store: store$d,
16588
+ store: store$e,
16196
16589
  key: i
16197
16590
  })) : /*#__PURE__*/React__default.cloneElement(children, {
16198
- store: store$d
16591
+ store: store$e
16199
16592
  })));
16200
16593
  };
16201
16594
 
16202
16595
  const UserUpdateEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
16203
16596
  disabled: true,
16204
- store: store$d
16597
+ store: store$e
16205
16598
  }, props));
16206
16599
 
16207
16600
  const UserUpdateButton = ({
@@ -16214,7 +16607,7 @@ const UserUpdateButton = ({
16214
16607
  buttonDisabled
16215
16608
  },
16216
16609
  dispatch
16217
- } = useContext(store$d);
16610
+ } = useContext(store$e);
16218
16611
  const {
16219
16612
  t
16220
16613
  } = useTranslation("userEdit");
@@ -16231,11 +16624,11 @@ const UserUpdateButton = ({
16231
16624
  };
16232
16625
 
16233
16626
  const UserUpdateFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
16234
- store: store$d
16627
+ store: store$e
16235
16628
  }, props));
16236
16629
 
16237
16630
  const UserUpdateLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
16238
- store: store$d
16631
+ store: store$e
16239
16632
  }, props));
16240
16633
 
16241
16634
  function Phone({
@@ -16264,22 +16657,22 @@ function Phone({
16264
16657
  }
16265
16658
 
16266
16659
  const UserUpdatePhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
16267
- store: store$d
16660
+ store: store$e
16268
16661
  }, props));
16269
16662
 
16270
16663
  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";
16271
16664
 
16272
- var _path$i;
16665
+ var _path$j;
16273
16666
 
16274
- 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); }
16667
+ 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); }
16275
16668
 
16276
16669
  function SvgEdit(props) {
16277
- return /*#__PURE__*/React.createElement("svg", _extends$k({
16670
+ return /*#__PURE__*/React.createElement("svg", _extends$l({
16278
16671
  className: "plc-w-6 plc-h-6",
16279
16672
  xmlns: "http://www.w3.org/2000/svg",
16280
16673
  viewBox: "0 0 20 20",
16281
16674
  fill: "currentColor"
16282
- }, props), _path$i || (_path$i = /*#__PURE__*/React.createElement("path", {
16675
+ }, props), _path$j || (_path$j = /*#__PURE__*/React.createElement("path", {
16283
16676
  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"
16284
16677
  })));
16285
16678
  }
@@ -16411,16 +16804,16 @@ function DisplayName({
16411
16804
  }
16412
16805
 
16413
16806
  const UserUpdateDisplayName = props => /*#__PURE__*/React__default.createElement(DisplayName, Object.assign({
16414
- store: store$d
16807
+ store: store$e
16415
16808
  }, props));
16416
16809
 
16417
16810
  const UserUpdateTextInput = props => {
16418
16811
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
16419
- store: store$d
16812
+ store: store$e
16420
16813
  }));
16421
16814
  };
16422
16815
 
16423
- const initialState$c = {
16816
+ const initialState$d = {
16424
16817
  isSubmitting: false,
16425
16818
  firstName: "",
16426
16819
  firstNameError: "",
@@ -16445,10 +16838,10 @@ const initialState$c = {
16445
16838
  content: ""
16446
16839
  }
16447
16840
  };
16448
- const store$c = /*#__PURE__*/createContext(initialState$c);
16841
+ const store$d = /*#__PURE__*/createContext(initialState$d);
16449
16842
  const {
16450
- Provider: Provider$c
16451
- } = store$c;
16843
+ Provider: Provider$d
16844
+ } = store$d;
16452
16845
 
16453
16846
  const getNewlyCreatedAddress = addresses => addresses[addresses.length - 1];
16454
16847
 
@@ -16655,7 +17048,7 @@ const AddressCreateContainer = ({
16655
17048
  default:
16656
17049
  return state;
16657
17050
  }
16658
- }, initialState$c);
17051
+ }, initialState$d);
16659
17052
  useEffect(() => {
16660
17053
  const getStates = () => {
16661
17054
  dispatch({
@@ -16687,16 +17080,16 @@ const AddressCreateContainer = ({
16687
17080
  style: { ...style
16688
17081
  },
16689
17082
  className: `pelcro-container pelcro-address-create-container ${className}`
16690
- }, /*#__PURE__*/React__default.createElement(Provider$c, {
17083
+ }, /*#__PURE__*/React__default.createElement(Provider$d, {
16691
17084
  value: {
16692
17085
  state,
16693
17086
  dispatch
16694
17087
  }
16695
17088
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
16696
- store: store$c,
17089
+ store: store$d,
16697
17090
  key: i
16698
17091
  })) : /*#__PURE__*/React__default.cloneElement(children, {
16699
- store: store$c
17092
+ store: store$d
16700
17093
  })));
16701
17094
  };
16702
17095
 
@@ -16707,7 +17100,7 @@ function AddressCreateFirstName(props) {
16707
17100
  firstName,
16708
17101
  firstNameError
16709
17102
  }
16710
- } = useContext(store$c);
17103
+ } = useContext(store$d);
16711
17104
 
16712
17105
  const handleBlur = () => {
16713
17106
  return dispatch({
@@ -16750,7 +17143,7 @@ function AddressCreateLastName(props) {
16750
17143
  lastName,
16751
17144
  lastNameError
16752
17145
  }
16753
- } = useContext(store$c);
17146
+ } = useContext(store$d);
16754
17147
 
16755
17148
  const handleBlur = () => {
16756
17149
  return dispatch({
@@ -16793,7 +17186,7 @@ function AddressCreateLine1(props) {
16793
17186
  line1,
16794
17187
  line1Error
16795
17188
  }
16796
- } = useContext(store$c);
17189
+ } = useContext(store$d);
16797
17190
 
16798
17191
  const handleBlur = () => {
16799
17192
  return dispatch({
@@ -16836,7 +17229,7 @@ function AddressCreateCity(props) {
16836
17229
  city,
16837
17230
  cityError
16838
17231
  }
16839
- } = useContext(store$c);
17232
+ } = useContext(store$d);
16840
17233
 
16841
17234
  const handleBlur = () => {
16842
17235
  return dispatch({
@@ -16879,7 +17272,7 @@ function AddressCreatePostalCode(props) {
16879
17272
  postalCode,
16880
17273
  postalCodeError
16881
17274
  }
16882
- } = useContext(store$c);
17275
+ } = useContext(store$d);
16883
17276
 
16884
17277
  const handleBlur = () => {
16885
17278
  return dispatch({
@@ -16925,7 +17318,7 @@ const AddressCreateSubmit = ({
16925
17318
  state: {
16926
17319
  isSubmitting
16927
17320
  }
16928
- } = useContext(store$c);
17321
+ } = useContext(store$d);
16929
17322
  const {
16930
17323
  t
16931
17324
  } = useTranslation("address");
@@ -17036,7 +17429,7 @@ function CountrySelect({
17036
17429
  }
17037
17430
 
17038
17431
  const AddressCreateCountrySelect = props => /*#__PURE__*/React__default.createElement(CountrySelect, Object.assign({
17039
- store: store$c
17432
+ store: store$d
17040
17433
  }, props));
17041
17434
 
17042
17435
  function StateSelect({
@@ -17124,7 +17517,7 @@ function StateSelect({
17124
17517
  }
17125
17518
 
17126
17519
  const AddressCreateStateSelect = props => /*#__PURE__*/React__default.createElement(StateSelect, Object.assign({
17127
- store: store$c
17520
+ store: store$d
17128
17521
  }, props));
17129
17522
 
17130
17523
  const AddressCreateView = props => {
@@ -17229,18 +17622,18 @@ AddressCreateModal.viewId = "address-create";
17229
17622
 
17230
17623
  const AddressCreateTextInput = props => {
17231
17624
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
17232
- store: store$c
17625
+ store: store$d
17233
17626
  }));
17234
17627
  };
17235
17628
 
17236
17629
  const AddressCreateLine2 = props => {
17237
17630
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({
17238
17631
  fieldName: "line2",
17239
- store: store$c
17632
+ store: store$d
17240
17633
  }, props));
17241
17634
  };
17242
17635
 
17243
- const initialState$b = {
17636
+ const initialState$c = {
17244
17637
  isSubmitting: false,
17245
17638
  firstName: "",
17246
17639
  firstNameError: "",
@@ -17265,10 +17658,10 @@ const initialState$b = {
17265
17658
  content: ""
17266
17659
  }
17267
17660
  };
17268
- const store$b = /*#__PURE__*/createContext(initialState$b);
17661
+ const store$c = /*#__PURE__*/createContext(initialState$c);
17269
17662
  const {
17270
- Provider: Provider$b
17271
- } = store$b;
17663
+ Provider: Provider$c
17664
+ } = store$c;
17272
17665
 
17273
17666
  const AddressUpdateContainer = ({
17274
17667
  style,
@@ -17320,7 +17713,7 @@ const AddressUpdateContainer = ({
17320
17713
  const thisAddress = addresses[address];
17321
17714
 
17322
17715
  if (+thisAddress.id === +addressId) {
17323
- const newState = { ...initialState$b,
17716
+ const newState = { ...initialState$c,
17324
17717
  firstName: thisAddress.first_name,
17325
17718
  lastName: thisAddress.last_name,
17326
17719
  line1: thisAddress.line1,
@@ -17453,7 +17846,7 @@ const AddressUpdateContainer = ({
17453
17846
  default:
17454
17847
  return state;
17455
17848
  }
17456
- }, initialState$b);
17849
+ }, initialState$c);
17457
17850
  useEffect(() => {
17458
17851
  const getStates = () => {
17459
17852
  dispatch({
@@ -17485,21 +17878,21 @@ const AddressUpdateContainer = ({
17485
17878
  style: { ...style
17486
17879
  },
17487
17880
  className: `pelcro-container pelcro-address-update-container ${className}`
17488
- }, /*#__PURE__*/React__default.createElement(Provider$b, {
17881
+ }, /*#__PURE__*/React__default.createElement(Provider$c, {
17489
17882
  value: {
17490
17883
  state,
17491
17884
  dispatch
17492
17885
  }
17493
17886
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
17494
- store: store$b,
17887
+ store: store$c,
17495
17888
  key: i
17496
17889
  })) : /*#__PURE__*/React__default.cloneElement(children, {
17497
- store: store$b
17890
+ store: store$c
17498
17891
  })));
17499
17892
  };
17500
17893
 
17501
17894
  const AddressUpdateCountrySelect = props => /*#__PURE__*/React__default.createElement(CountrySelect, Object.assign({
17502
- store: store$b
17895
+ store: store$c
17503
17896
  }, props));
17504
17897
 
17505
17898
  function AddressUpdateFirstName(props) {
@@ -17509,7 +17902,7 @@ function AddressUpdateFirstName(props) {
17509
17902
  firstName,
17510
17903
  firstNameError
17511
17904
  }
17512
- } = useContext(store$b);
17905
+ } = useContext(store$c);
17513
17906
 
17514
17907
  const handleBlur = () => {
17515
17908
  return dispatch({
@@ -17552,7 +17945,7 @@ function AddressUpdateLastName(props) {
17552
17945
  lastName,
17553
17946
  lastNameError
17554
17947
  }
17555
- } = useContext(store$b);
17948
+ } = useContext(store$c);
17556
17949
 
17557
17950
  const handleBlur = () => {
17558
17951
  return dispatch({
@@ -17595,7 +17988,7 @@ function AddressUpdateLine1(props) {
17595
17988
  line1,
17596
17989
  line1Error
17597
17990
  }
17598
- } = useContext(store$b);
17991
+ } = useContext(store$c);
17599
17992
 
17600
17993
  const handleBlur = () => {
17601
17994
  return dispatch({
@@ -17635,7 +18028,7 @@ const AddressUpdateLine2 = props => {
17635
18028
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({
17636
18029
  fieldName: "line2"
17637
18030
  }, props, {
17638
- store: store$b
18031
+ store: store$c
17639
18032
  }));
17640
18033
  };
17641
18034
 
@@ -17646,7 +18039,7 @@ function AddressUpdateCity(props) {
17646
18039
  city,
17647
18040
  cityError
17648
18041
  }
17649
- } = useContext(store$b);
18042
+ } = useContext(store$c);
17650
18043
 
17651
18044
  const handleBlur = () => {
17652
18045
  return dispatch({
@@ -17689,7 +18082,7 @@ function AddressUpdatePostalCode(props) {
17689
18082
  postalCode,
17690
18083
  postalCodeError
17691
18084
  }
17692
- } = useContext(store$b);
18085
+ } = useContext(store$c);
17693
18086
 
17694
18087
  const handleBlur = () => {
17695
18088
  return dispatch({
@@ -17735,7 +18128,7 @@ const AddressUpdateSubmit = ({
17735
18128
  state: {
17736
18129
  isSubmitting
17737
18130
  }
17738
- } = useContext(store$b);
18131
+ } = useContext(store$c);
17739
18132
  const {
17740
18133
  t
17741
18134
  } = useTranslation("address");
@@ -17751,7 +18144,7 @@ const AddressUpdateSubmit = ({
17751
18144
  };
17752
18145
 
17753
18146
  const AddressUpdateStateSelect = props => /*#__PURE__*/React__default.createElement(StateSelect, Object.assign({
17754
- store: store$b
18147
+ store: store$c
17755
18148
  }, props));
17756
18149
 
17757
18150
  const AddressUpdateView = props => {
@@ -17834,7 +18227,7 @@ AddressUpdateModal.viewId = "address-edit";
17834
18227
 
17835
18228
  const AddressUpdateTextInput = props => {
17836
18229
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
17837
- store: store$b
18230
+ store: store$c
17838
18231
  }));
17839
18232
  };
17840
18233
 
@@ -17917,7 +18310,7 @@ const PaymentMethodUpdateModal = props => {
17917
18310
  };
17918
18311
  PaymentMethodUpdateModal.viewId = "payment-method-update";
17919
18312
 
17920
- const initialState$a = {
18313
+ const initialState$b = {
17921
18314
  email: "",
17922
18315
  password: "",
17923
18316
  passwordError: null,
@@ -17930,10 +18323,10 @@ const initialState$a = {
17930
18323
  content: ""
17931
18324
  }
17932
18325
  };
17933
- const store$a = /*#__PURE__*/createContext(initialState$a);
18326
+ const store$b = /*#__PURE__*/createContext(initialState$b);
17934
18327
  const {
17935
- Provider: Provider$a
17936
- } = store$a;
18328
+ Provider: Provider$b
18329
+ } = store$b;
17937
18330
 
17938
18331
  const PasswordResetContainer = ({
17939
18332
  style,
@@ -17990,7 +18383,7 @@ const PasswordResetContainer = ({
17990
18383
  type: SET_EMAIL,
17991
18384
  payload: window.Pelcro.helpers.getURLParameter("email")
17992
18385
  });
17993
- initialState$a.email = window.Pelcro.helpers.getURLParameter("email");
18386
+ initialState$b.email = window.Pelcro.helpers.getURLParameter("email");
17994
18387
  dispatch({
17995
18388
  type: SET_TOKEN,
17996
18389
  payload: window.Pelcro.helpers.getURLParameter("token")
@@ -18050,26 +18443,26 @@ const PasswordResetContainer = ({
18050
18443
  default:
18051
18444
  return state;
18052
18445
  }
18053
- }, initialState$a);
18446
+ }, initialState$b);
18054
18447
  return /*#__PURE__*/React__default.createElement("div", {
18055
18448
  style: { ...style
18056
18449
  },
18057
18450
  className: `pelcro-container pelcro-password-reset-container ${className}`
18058
- }, /*#__PURE__*/React__default.createElement(Provider$a, {
18451
+ }, /*#__PURE__*/React__default.createElement(Provider$b, {
18059
18452
  value: {
18060
18453
  state,
18061
18454
  dispatch
18062
18455
  }
18063
18456
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
18064
- store: store$a,
18457
+ store: store$b,
18065
18458
  key: i
18066
18459
  })) : /*#__PURE__*/React__default.cloneElement(children, {
18067
- store: store$a
18460
+ store: store$b
18068
18461
  })));
18069
18462
  };
18070
18463
 
18071
18464
  const PasswordResetPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
18072
- store: store$a
18465
+ store: store$b
18073
18466
  }, props));
18074
18467
 
18075
18468
  const PasswordResetButton = ({
@@ -18082,7 +18475,7 @@ const PasswordResetButton = ({
18082
18475
  buttonDisabled
18083
18476
  },
18084
18477
  dispatch
18085
- } = useContext(store$a);
18478
+ } = useContext(store$b);
18086
18479
  const {
18087
18480
  t
18088
18481
  } = useTranslation("passwordReset");
@@ -18099,14 +18492,14 @@ const PasswordResetButton = ({
18099
18492
  };
18100
18493
 
18101
18494
  const PasswordResetEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
18102
- store: store$a
18495
+ store: store$b
18103
18496
  }, props, {
18104
18497
  value: window.Pelcro.helpers.getURLParameter("email"),
18105
18498
  disabled: true
18106
18499
  }));
18107
18500
 
18108
18501
  const PasswordResetConfirmPassword = props => /*#__PURE__*/React__default.createElement(ConfirmPassword, Object.assign({
18109
- store: store$a
18502
+ store: store$b
18110
18503
  }, props));
18111
18504
 
18112
18505
  const PasswordResetView = props => {
@@ -18158,7 +18551,7 @@ const PasswordResetModal = ({
18158
18551
  };
18159
18552
  PasswordResetModal.viewId = "password-reset";
18160
18553
 
18161
- const initialState$9 = {
18554
+ const initialState$a = {
18162
18555
  email: "",
18163
18556
  emailError: null,
18164
18557
  buttonDisabled: false,
@@ -18167,10 +18560,10 @@ const initialState$9 = {
18167
18560
  content: ""
18168
18561
  }
18169
18562
  };
18170
- const store$9 = /*#__PURE__*/createContext(initialState$9);
18563
+ const store$a = /*#__PURE__*/createContext(initialState$a);
18171
18564
  const {
18172
- Provider: Provider$9
18173
- } = store$9;
18565
+ Provider: Provider$a
18566
+ } = store$a;
18174
18567
 
18175
18568
  const PasswordForgotContainer = ({
18176
18569
  style,
@@ -18248,21 +18641,21 @@ const PasswordForgotContainer = ({
18248
18641
  default:
18249
18642
  return state;
18250
18643
  }
18251
- }, initialState$9);
18644
+ }, initialState$a);
18252
18645
  return /*#__PURE__*/React__default.createElement("div", {
18253
18646
  style: { ...style
18254
18647
  },
18255
18648
  className: `pelcro-container pelcro-password-forgot-container ${className}`
18256
- }, /*#__PURE__*/React__default.createElement(Provider$9, {
18649
+ }, /*#__PURE__*/React__default.createElement(Provider$a, {
18257
18650
  value: {
18258
18651
  state,
18259
18652
  dispatch
18260
18653
  }
18261
18654
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
18262
- store: store$9,
18655
+ store: store$a,
18263
18656
  key: i
18264
18657
  })) : /*#__PURE__*/React__default.cloneElement(children, {
18265
- store: store$9
18658
+ store: store$a
18266
18659
  })));
18267
18660
  };
18268
18661
 
@@ -18278,7 +18671,7 @@ const PasswordForgotButton = ({
18278
18671
  emailError
18279
18672
  },
18280
18673
  dispatch
18281
- } = useContext(store$9);
18674
+ } = useContext(store$a);
18282
18675
  const {
18283
18676
  t
18284
18677
  } = useTranslation("passwordForgot");
@@ -18299,7 +18692,7 @@ const PasswordForgotButton = ({
18299
18692
  };
18300
18693
 
18301
18694
  const PasswordForgotEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
18302
- store: store$9
18695
+ store: store$a
18303
18696
  }, props));
18304
18697
 
18305
18698
  const PasswordForgotView = props => {
@@ -18349,7 +18742,7 @@ const PasswordForgotModal = ({
18349
18742
  };
18350
18743
  PasswordForgotModal.viewId = "password-forgot";
18351
18744
 
18352
- const initialState$8 = {
18745
+ const initialState$9 = {
18353
18746
  currentPassword: "",
18354
18747
  newPassword: "",
18355
18748
  confirmNewPassword: "",
@@ -18363,10 +18756,10 @@ const initialState$8 = {
18363
18756
  content: ""
18364
18757
  }
18365
18758
  };
18366
- const store$8 = /*#__PURE__*/createContext(initialState$8);
18759
+ const store$9 = /*#__PURE__*/createContext(initialState$9);
18367
18760
  const {
18368
- Provider: Provider$8
18369
- } = store$8;
18761
+ Provider: Provider$9
18762
+ } = store$9;
18370
18763
  const PasswordChangeContainer = ({
18371
18764
  style,
18372
18765
  className = "",
@@ -18518,21 +18911,21 @@ const PasswordChangeContainer = ({
18518
18911
  default:
18519
18912
  return state;
18520
18913
  }
18521
- }, initialState$8);
18914
+ }, initialState$9);
18522
18915
  return /*#__PURE__*/React__default.createElement("div", {
18523
18916
  style: { ...style
18524
18917
  },
18525
18918
  className: `pelcro-container pelcro-password-change-container ${className}`
18526
- }, /*#__PURE__*/React__default.createElement(Provider$8, {
18919
+ }, /*#__PURE__*/React__default.createElement(Provider$9, {
18527
18920
  value: {
18528
18921
  state,
18529
18922
  dispatch
18530
18923
  }
18531
18924
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
18532
- store: store$8,
18925
+ store: store$9,
18533
18926
  key: i
18534
18927
  })) : /*#__PURE__*/React__default.cloneElement(children, {
18535
- store: store$8
18928
+ store: store$9
18536
18929
  })));
18537
18930
  };
18538
18931
 
@@ -18543,7 +18936,7 @@ function PasswordChangeCurrentPassword(props) {
18543
18936
  currentPassword,
18544
18937
  currentPasswordError
18545
18938
  }
18546
- } = useContext(store$8);
18939
+ } = useContext(store$9);
18547
18940
  const handleBlur = useCallback(() => {
18548
18941
  return dispatch({
18549
18942
  type: VALIDATE_PASSWORD
@@ -18577,7 +18970,7 @@ function PasswordChangeNewPassword(props) {
18577
18970
  newPassword,
18578
18971
  newPasswordError
18579
18972
  }
18580
- } = useContext(store$8);
18973
+ } = useContext(store$9);
18581
18974
  const handleBlur = useCallback(() => {
18582
18975
  return dispatch({
18583
18976
  type: VALIDATE_NEW_PASSWORD
@@ -18611,7 +19004,7 @@ function PasswordChangeConfirmNewPassword(props) {
18611
19004
  confirmNewPassword,
18612
19005
  confirmNewPasswordError
18613
19006
  }
18614
- } = useContext(store$8);
19007
+ } = useContext(store$9);
18615
19008
  const handleBlur = useCallback(() => {
18616
19009
  return dispatch({
18617
19010
  type: VALIDATE_CONFIRM_NEW_PASSWORD
@@ -18652,7 +19045,7 @@ const PasswordChangeButton = ({
18652
19045
  confirmNewPasswordError
18653
19046
  },
18654
19047
  dispatch
18655
- } = useContext(store$8);
19048
+ } = useContext(store$9);
18656
19049
  const {
18657
19050
  t
18658
19051
  } = useTranslation("passwordChange");
@@ -18718,17 +19111,17 @@ const PasswordChangeModal = ({
18718
19111
  };
18719
19112
  PasswordChangeModal.viewId = "password-change";
18720
19113
 
18721
- const initialState$7 = {
19114
+ const initialState$8 = {
18722
19115
  buttonDisabled: false,
18723
19116
  alert: {
18724
19117
  type: "error",
18725
19118
  content: ""
18726
19119
  }
18727
19120
  };
18728
- const store$7 = /*#__PURE__*/createContext(initialState$7);
19121
+ const store$8 = /*#__PURE__*/createContext(initialState$8);
18729
19122
  const {
18730
- Provider: Provider$7
18731
- } = store$7;
19123
+ Provider: Provider$8
19124
+ } = store$8;
18732
19125
 
18733
19126
  const CartContainer = ({
18734
19127
  style,
@@ -18819,21 +19212,21 @@ const CartContainer = ({
18819
19212
  default:
18820
19213
  return state;
18821
19214
  }
18822
- }, initialState$7);
19215
+ }, initialState$8);
18823
19216
  return /*#__PURE__*/React__default.createElement("div", {
18824
19217
  style: { ...style
18825
19218
  },
18826
19219
  className: `pelcro-container pelcro-cart-container ${className}`
18827
- }, /*#__PURE__*/React__default.createElement(Provider$7, {
19220
+ }, /*#__PURE__*/React__default.createElement(Provider$8, {
18828
19221
  value: {
18829
19222
  state,
18830
19223
  dispatch
18831
19224
  }
18832
19225
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
18833
- store: store$7,
19226
+ store: store$8,
18834
19227
  key: i
18835
19228
  })) : /*#__PURE__*/React__default.cloneElement(children, {
18836
- store: store$7
19229
+ store: store$8
18837
19230
  })));
18838
19231
  };
18839
19232
 
@@ -18870,7 +19263,7 @@ const CartSubmit = ({
18870
19263
  buttonDisabled
18871
19264
  },
18872
19265
  dispatch
18873
- } = useContext(store$7);
19266
+ } = useContext(store$8);
18874
19267
  const {
18875
19268
  t
18876
19269
  } = useTranslation("cart");
@@ -18901,7 +19294,7 @@ const CartTotalPrice = () => {
18901
19294
  state: {
18902
19295
  alert
18903
19296
  }
18904
- } = useContext(store$7);
19297
+ } = useContext(store$8);
18905
19298
  const {
18906
19299
  cartItems
18907
19300
  } = usePelcro();
@@ -19214,7 +19607,7 @@ const OrderConfirmModal = props => {
19214
19607
  };
19215
19608
  OrderConfirmModal.viewId = "order-confirm";
19216
19609
 
19217
- const initialState$6 = {
19610
+ const initialState$7 = {
19218
19611
  email: "",
19219
19612
  firstName: "",
19220
19613
  lastName: "",
@@ -19226,10 +19619,10 @@ const initialState$6 = {
19226
19619
  content: ""
19227
19620
  }
19228
19621
  };
19229
- const store$6 = /*#__PURE__*/createContext(initialState$6);
19622
+ const store$7 = /*#__PURE__*/createContext(initialState$7);
19230
19623
  const {
19231
- Provider: Provider$6
19232
- } = store$6;
19624
+ Provider: Provider$7
19625
+ } = store$7;
19233
19626
 
19234
19627
  const GiftCreateContainer = ({
19235
19628
  style,
@@ -19333,21 +19726,21 @@ const GiftCreateContainer = ({
19333
19726
  default:
19334
19727
  return state;
19335
19728
  }
19336
- }, initialState$6);
19729
+ }, initialState$7);
19337
19730
  return /*#__PURE__*/React__default.createElement("div", {
19338
19731
  style: { ...style
19339
19732
  },
19340
19733
  className: `pelcro-container pelcro-gift-create-container ${className}`
19341
- }, /*#__PURE__*/React__default.createElement(Provider$6, {
19734
+ }, /*#__PURE__*/React__default.createElement(Provider$7, {
19342
19735
  value: {
19343
19736
  state,
19344
19737
  dispatch
19345
19738
  }
19346
19739
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
19347
- store: store$6,
19740
+ store: store$7,
19348
19741
  key: i
19349
19742
  })) : /*#__PURE__*/React__default.cloneElement(children, {
19350
- store: store$6
19743
+ store: store$7
19351
19744
  })));
19352
19745
  };
19353
19746
 
@@ -19361,7 +19754,7 @@ const GiftCreateSubmitButton = ({
19361
19754
  state: {
19362
19755
  disableSubmit
19363
19756
  }
19364
- } = useContext(store$6);
19757
+ } = useContext(store$7);
19365
19758
  const {
19366
19759
  t
19367
19760
  } = useTranslation("register");
@@ -19378,29 +19771,29 @@ const GiftCreateSubmitButton = ({
19378
19771
 
19379
19772
  const GiftCreateEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
19380
19773
  initWithUserEmail: false,
19381
- store: store$6
19774
+ store: store$7
19382
19775
  }, props));
19383
19776
 
19384
19777
  const GiftCreateFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
19385
- store: store$6
19778
+ store: store$7
19386
19779
  }, props));
19387
19780
 
19388
19781
  const GiftCreateLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
19389
- store: store$6
19782
+ store: store$7
19390
19783
  }, props));
19391
19784
 
19392
- var _path$h;
19785
+ var _path$i;
19393
19786
 
19394
- 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); }
19787
+ 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); }
19395
19788
 
19396
19789
  function SvgInfoCircle(props) {
19397
- return /*#__PURE__*/React.createElement("svg", _extends$j({
19790
+ return /*#__PURE__*/React.createElement("svg", _extends$k({
19398
19791
  xmlns: "http://www.w3.org/2000/svg",
19399
19792
  className: "plc-w-5 plc-h-5",
19400
19793
  fill: "none",
19401
19794
  viewBox: "0 0 24 24",
19402
19795
  stroke: "currentColor"
19403
- }, props), _path$h || (_path$h = /*#__PURE__*/React.createElement("path", {
19796
+ }, props), _path$i || (_path$i = /*#__PURE__*/React.createElement("path", {
19404
19797
  strokeLinecap: "round",
19405
19798
  strokeLinejoin: "round",
19406
19799
  strokeWidth: 2,
@@ -19471,7 +19864,7 @@ const GiftCreateStartDate = props => {
19471
19864
  const {
19472
19865
  dispatch,
19473
19866
  state
19474
- } = useContext(store$6);
19867
+ } = useContext(store$7);
19475
19868
 
19476
19869
  const handleInputChange = value => {
19477
19870
  dispatch({
@@ -19544,7 +19937,7 @@ function GiftCreateMessage(props) {
19544
19937
  const {
19545
19938
  dispatch,
19546
19939
  state
19547
- } = useContext(store$6);
19940
+ } = useContext(store$7);
19548
19941
  const MAX_CHARS_COUNT = 200;
19549
19942
  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;
19550
19943
 
@@ -19668,7 +20061,7 @@ const GiftCreateModal = ({
19668
20061
  };
19669
20062
  GiftCreateModal.viewId = "gift-create";
19670
20063
 
19671
- const initialState$5 = {
20064
+ const initialState$6 = {
19672
20065
  giftCode: "",
19673
20066
  buttonDisabled: true,
19674
20067
  alert: {
@@ -19676,10 +20069,10 @@ const initialState$5 = {
19676
20069
  content: ""
19677
20070
  }
19678
20071
  };
19679
- const store$5 = /*#__PURE__*/createContext(initialState$5);
20072
+ const store$6 = /*#__PURE__*/createContext(initialState$6);
19680
20073
  const {
19681
- Provider: Provider$5
19682
- } = store$5;
20074
+ Provider: Provider$6
20075
+ } = store$6;
19683
20076
 
19684
20077
  const GiftRedeemContainer = ({
19685
20078
  style,
@@ -19744,21 +20137,21 @@ const GiftRedeemContainer = ({
19744
20137
  default:
19745
20138
  return state;
19746
20139
  }
19747
- }, initialState$5);
20140
+ }, initialState$6);
19748
20141
  return /*#__PURE__*/React__default.createElement("div", {
19749
20142
  style: { ...style
19750
20143
  },
19751
20144
  className: `pelcro-container pelcro-gift-redeem-container ${className}`
19752
- }, /*#__PURE__*/React__default.createElement(Provider$5, {
20145
+ }, /*#__PURE__*/React__default.createElement(Provider$6, {
19753
20146
  value: {
19754
20147
  state,
19755
20148
  dispatch
19756
20149
  }
19757
20150
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
19758
- store: store$5,
20151
+ store: store$6,
19759
20152
  key: i
19760
20153
  })) : /*#__PURE__*/React__default.cloneElement(children, {
19761
- store: store$5
20154
+ store: store$6
19762
20155
  })));
19763
20156
  };
19764
20157
 
@@ -19795,7 +20188,7 @@ function GiftCode({
19795
20188
  }
19796
20189
 
19797
20190
  const GiftRedeemCode = props => /*#__PURE__*/React__default.createElement(GiftCode, Object.assign({
19798
- store: store$5
20191
+ store: store$6
19799
20192
  }, props));
19800
20193
 
19801
20194
  const GiftRedeemSubmitButton = ({
@@ -19808,7 +20201,7 @@ const GiftRedeemSubmitButton = ({
19808
20201
  state: {
19809
20202
  disableSubmit
19810
20203
  }
19811
- } = useContext(store$5);
20204
+ } = useContext(store$6);
19812
20205
  const {
19813
20206
  t
19814
20207
  } = useTranslation("register");
@@ -19901,7 +20294,7 @@ const moveDefaultAddressToStart = addresses => {
19901
20294
  return [defaultAddress, ...addressesWithoutDefault];
19902
20295
  };
19903
20296
 
19904
- const initialState$4 = {
20297
+ const initialState$5 = {
19905
20298
  addresses: [],
19906
20299
  selectedAddressId: null,
19907
20300
  isSubmitting: false,
@@ -19910,10 +20303,10 @@ const initialState$4 = {
19910
20303
  content: ""
19911
20304
  }
19912
20305
  };
19913
- const store$4 = /*#__PURE__*/createContext(initialState$4);
20306
+ const store$5 = /*#__PURE__*/createContext(initialState$5);
19914
20307
  const {
19915
- Provider: Provider$4
19916
- } = store$4;
20308
+ Provider: Provider$5
20309
+ } = store$5;
19917
20310
 
19918
20311
  const AddressSelectContainer = ({
19919
20312
  style,
@@ -20008,7 +20401,7 @@ const AddressSelectContainer = ({
20008
20401
  default:
20009
20402
  return state;
20010
20403
  }
20011
- }, initialState$4);
20404
+ }, initialState$5);
20012
20405
  useEffect(() => {
20013
20406
  var _window$Pelcro$user$r;
20014
20407
 
@@ -20021,16 +20414,16 @@ const AddressSelectContainer = ({
20021
20414
  style: { ...style
20022
20415
  },
20023
20416
  className: `pelcro-container pelcro-address-select-container ${className}`
20024
- }, /*#__PURE__*/React__default.createElement(Provider$4, {
20417
+ }, /*#__PURE__*/React__default.createElement(Provider$5, {
20025
20418
  value: {
20026
20419
  state,
20027
20420
  dispatch
20028
20421
  }
20029
20422
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
20030
- store: store$4,
20423
+ store: store$5,
20031
20424
  key: i
20032
20425
  })) : /*#__PURE__*/React__default.cloneElement(children, {
20033
- store: store$4
20426
+ store: store$5
20034
20427
  })));
20035
20428
  };
20036
20429
 
@@ -20041,7 +20434,7 @@ const AddressSelectList = () => {
20041
20434
  addresses,
20042
20435
  selectedAddressId
20043
20436
  }
20044
- } = useContext(store$4);
20437
+ } = useContext(store$5);
20045
20438
 
20046
20439
  const handleAddressSelect = event => {
20047
20440
  dispatch({
@@ -20085,7 +20478,7 @@ const AddressSelectSubmit = ({
20085
20478
  selectedAddressId,
20086
20479
  isSubmitting
20087
20480
  }
20088
- } = useContext(store$4);
20481
+ } = useContext(store$5);
20089
20482
  const {
20090
20483
  t
20091
20484
  } = useTranslation("address");
@@ -20181,7 +20574,7 @@ const moveDefaultPaymentMethodToStart = paymentMethods => {
20181
20574
  return [defaultPaymentMethod, ...paymentMethodsWithoutDefault];
20182
20575
  };
20183
20576
 
20184
- const initialState$3 = {
20577
+ const initialState$4 = {
20185
20578
  paymentMethods: [],
20186
20579
  selectedPaymentMethodId: null,
20187
20580
  isSubmitting: false,
@@ -20190,10 +20583,10 @@ const initialState$3 = {
20190
20583
  content: ""
20191
20584
  }
20192
20585
  };
20193
- const store$3 = /*#__PURE__*/createContext(initialState$3);
20586
+ const store$4 = /*#__PURE__*/createContext(initialState$4);
20194
20587
  const {
20195
- Provider: Provider$3
20196
- } = store$3;
20588
+ Provider: Provider$4
20589
+ } = store$4;
20197
20590
 
20198
20591
  const PaymentMethodSelectContainer = ({
20199
20592
  style,
@@ -20252,7 +20645,7 @@ const PaymentMethodSelectContainer = ({
20252
20645
  default:
20253
20646
  return state;
20254
20647
  }
20255
- }, initialState$3);
20648
+ }, initialState$4);
20256
20649
  useEffect(() => {
20257
20650
  var _window$Pelcro$user$r3;
20258
20651
 
@@ -20265,16 +20658,16 @@ const PaymentMethodSelectContainer = ({
20265
20658
  style: { ...style
20266
20659
  },
20267
20660
  className: `pelcro-container pelcro-payment-select-container ${className}`
20268
- }, /*#__PURE__*/React__default.createElement(Provider$3, {
20661
+ }, /*#__PURE__*/React__default.createElement(Provider$4, {
20269
20662
  value: {
20270
20663
  state,
20271
20664
  dispatch
20272
20665
  }
20273
20666
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
20274
- store: store$3,
20667
+ store: store$4,
20275
20668
  key: i
20276
20669
  })) : /*#__PURE__*/React__default.cloneElement(children, {
20277
- store: store$3
20670
+ store: store$4
20278
20671
  })));
20279
20672
  };
20280
20673
 
@@ -20288,7 +20681,7 @@ const PaymentMethodSelectList = () => {
20288
20681
  paymentMethods,
20289
20682
  selectedPaymentMethodId
20290
20683
  }
20291
- } = useContext(store$3);
20684
+ } = useContext(store$4);
20292
20685
 
20293
20686
  const handlePaymentMethodSelect = event => {
20294
20687
  dispatch({
@@ -20338,7 +20731,7 @@ const PaymentMethodSelectSubmit = ({
20338
20731
  selectedPaymentMethodId,
20339
20732
  isSubmitting
20340
20733
  }
20341
- } = useContext(store$3);
20734
+ } = useContext(store$4);
20342
20735
  return /*#__PURE__*/React__default.createElement(Button, Object.assign({
20343
20736
  onClick: () => {
20344
20737
  dispatch({
@@ -20412,8 +20805,8 @@ const PaymentMethodSelectModal = ({
20412
20805
  };
20413
20806
  PaymentMethodSelectModal.viewId = "payment-method-select";
20414
20807
 
20415
- function _extends$i() {
20416
- _extends$i = Object.assign || function (target) {
20808
+ function _extends$j() {
20809
+ _extends$j = Object.assign || function (target) {
20417
20810
  for (var i = 1; i < arguments.length; i++) {
20418
20811
  var source = arguments[i];
20419
20812
 
@@ -20427,7 +20820,7 @@ function _extends$i() {
20427
20820
  return target;
20428
20821
  };
20429
20822
 
20430
- return _extends$i.apply(this, arguments);
20823
+ return _extends$j.apply(this, arguments);
20431
20824
  }
20432
20825
 
20433
20826
  function _objectWithoutPropertiesLoose(source, excluded) {
@@ -20611,7 +21004,7 @@ function render(props, propsBag, defaultTag, features, visible) {
20611
21004
  return match(strategy, (_match = {}, _match[RenderStrategy.Unmount] = function () {
20612
21005
  return null;
20613
21006
  }, _match[RenderStrategy.Hidden] = function () {
20614
- return _render(_extends$i({}, _rest, {
21007
+ return _render(_extends$j({}, _rest, {
20615
21008
  hidden: true,
20616
21009
  style: {
20617
21010
  display: 'none'
@@ -21139,7 +21532,7 @@ function TransitionChild(props) {
21139
21532
  var passthroughProps = rest;
21140
21533
  return React__default.createElement(NestingContext.Provider, {
21141
21534
  value: nesting
21142
- }, render(_extends$i({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
21535
+ }, render(_extends$j({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
21143
21536
  }
21144
21537
 
21145
21538
  function Transition(props) {
@@ -21183,7 +21576,7 @@ function Transition(props) {
21183
21576
  value: nestingBag
21184
21577
  }, React__default.createElement(TransitionContext.Provider, {
21185
21578
  value: transitionBag
21186
- }, render(_extends$i({}, sharedProps, {
21579
+ }, render(_extends$j({}, sharedProps, {
21187
21580
  as: Fragment,
21188
21581
  children: React__default.createElement(TransitionChild, Object.assign({}, sharedProps, passthroughProps))
21189
21582
  }), propsBag, Fragment, TransitionChildRenderFeatures, state === TreeStates.Visible)));
@@ -21310,12 +21703,12 @@ var ActionTypes;
21310
21703
  })(ActionTypes || (ActionTypes = {}));
21311
21704
 
21312
21705
  (_reducers = {}, _reducers[ActionTypes.CloseMenu] = function (state) {
21313
- return _extends$i({}, state, {
21706
+ return _extends$j({}, state, {
21314
21707
  activeItemIndex: null,
21315
21708
  menuState: MenuStates.Closed
21316
21709
  });
21317
21710
  }, _reducers[ActionTypes.OpenMenu] = function (state) {
21318
- return _extends$i({}, state, {
21711
+ return _extends$j({}, state, {
21319
21712
  menuState: MenuStates.Open
21320
21713
  });
21321
21714
  }, _reducers[ActionTypes.GoToItem] = function (state, action) {
@@ -21334,7 +21727,7 @@ var ActionTypes;
21334
21727
  }
21335
21728
  });
21336
21729
  if (state.searchQuery === '' && state.activeItemIndex === activeItemIndex) return state;
21337
- return _extends$i({}, state, {
21730
+ return _extends$j({}, state, {
21338
21731
  searchQuery: '',
21339
21732
  activeItemIndex: activeItemIndex
21340
21733
  });
@@ -21345,19 +21738,19 @@ var ActionTypes;
21345
21738
 
21346
21739
  return ((_item$dataRef$current = item.dataRef.current.textValue) == null ? void 0 : _item$dataRef$current.startsWith(searchQuery)) && !item.dataRef.current.disabled;
21347
21740
  });
21348
- if (match === -1 || match === state.activeItemIndex) return _extends$i({}, state, {
21741
+ if (match === -1 || match === state.activeItemIndex) return _extends$j({}, state, {
21349
21742
  searchQuery: searchQuery
21350
21743
  });
21351
- return _extends$i({}, state, {
21744
+ return _extends$j({}, state, {
21352
21745
  searchQuery: searchQuery,
21353
21746
  activeItemIndex: match
21354
21747
  });
21355
21748
  }, _reducers[ActionTypes.ClearSearch] = function (state) {
21356
- return _extends$i({}, state, {
21749
+ return _extends$j({}, state, {
21357
21750
  searchQuery: ''
21358
21751
  });
21359
21752
  }, _reducers[ActionTypes.RegisterItem] = function (state, action) {
21360
- return _extends$i({}, state, {
21753
+ return _extends$j({}, state, {
21361
21754
  items: [].concat(state.items, [{
21362
21755
  id: action.id,
21363
21756
  dataRef: action.dataRef
@@ -21370,7 +21763,7 @@ var ActionTypes;
21370
21763
  return a.id === action.id;
21371
21764
  });
21372
21765
  if (idx !== -1) nextItems.splice(idx, 1);
21373
- return _extends$i({}, state, {
21766
+ return _extends$j({}, state, {
21374
21767
  items: nextItems,
21375
21768
  activeItemIndex: function () {
21376
21769
  if (idx === state.activeItemIndex) return null;
@@ -21409,19 +21802,19 @@ var ActionTypes$1;
21409
21802
  (_reducers$1 = {}, _reducers$1[ActionTypes$1.CloseListbox] = function (state) {
21410
21803
  if (state.disabled) return state;
21411
21804
  if (state.listboxState === ListboxStates.Closed) return state;
21412
- return _extends$i({}, state, {
21805
+ return _extends$j({}, state, {
21413
21806
  activeOptionIndex: null,
21414
21807
  listboxState: ListboxStates.Closed
21415
21808
  });
21416
21809
  }, _reducers$1[ActionTypes$1.OpenListbox] = function (state) {
21417
21810
  if (state.disabled) return state;
21418
21811
  if (state.listboxState === ListboxStates.Open) return state;
21419
- return _extends$i({}, state, {
21812
+ return _extends$j({}, state, {
21420
21813
  listboxState: ListboxStates.Open
21421
21814
  });
21422
21815
  }, _reducers$1[ActionTypes$1.SetDisabled] = function (state, action) {
21423
21816
  if (state.disabled === action.disabled) return state;
21424
- return _extends$i({}, state, {
21817
+ return _extends$j({}, state, {
21425
21818
  disabled: action.disabled
21426
21819
  });
21427
21820
  }, _reducers$1[ActionTypes$1.GoToOption] = function (state, action) {
@@ -21442,7 +21835,7 @@ var ActionTypes$1;
21442
21835
  }
21443
21836
  });
21444
21837
  if (state.searchQuery === '' && state.activeOptionIndex === activeOptionIndex) return state;
21445
- return _extends$i({}, state, {
21838
+ return _extends$j({}, state, {
21446
21839
  searchQuery: '',
21447
21840
  activeOptionIndex: activeOptionIndex
21448
21841
  });
@@ -21455,10 +21848,10 @@ var ActionTypes$1;
21455
21848
 
21456
21849
  return !option.dataRef.current.disabled && ((_option$dataRef$curre = option.dataRef.current.textValue) == null ? void 0 : _option$dataRef$curre.startsWith(searchQuery));
21457
21850
  });
21458
- if (match === -1 || match === state.activeOptionIndex) return _extends$i({}, state, {
21851
+ if (match === -1 || match === state.activeOptionIndex) return _extends$j({}, state, {
21459
21852
  searchQuery: searchQuery
21460
21853
  });
21461
- return _extends$i({}, state, {
21854
+ return _extends$j({}, state, {
21462
21855
  searchQuery: searchQuery,
21463
21856
  activeOptionIndex: match
21464
21857
  });
@@ -21466,11 +21859,11 @@ var ActionTypes$1;
21466
21859
  if (state.disabled) return state;
21467
21860
  if (state.listboxState === ListboxStates.Closed) return state;
21468
21861
  if (state.searchQuery === '') return state;
21469
- return _extends$i({}, state, {
21862
+ return _extends$j({}, state, {
21470
21863
  searchQuery: ''
21471
21864
  });
21472
21865
  }, _reducers$1[ActionTypes$1.RegisterOption] = function (state, action) {
21473
- return _extends$i({}, state, {
21866
+ return _extends$j({}, state, {
21474
21867
  options: [].concat(state.options, [{
21475
21868
  id: action.id,
21476
21869
  dataRef: action.dataRef
@@ -21483,7 +21876,7 @@ var ActionTypes$1;
21483
21876
  return a.id === action.id;
21484
21877
  });
21485
21878
  if (idx !== -1) nextOptions.splice(idx, 1);
21486
- return _extends$i({}, state, {
21879
+ return _extends$j({}, state, {
21487
21880
  options: nextOptions,
21488
21881
  activeOptionIndex: function () {
21489
21882
  if (idx === state.activeOptionIndex) return null;
@@ -21544,18 +21937,18 @@ const getPaymentCardIcon = name => {
21544
21937
  }));
21545
21938
  };
21546
21939
 
21547
- var _path$g;
21940
+ var _path$h;
21548
21941
 
21549
- 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); }
21942
+ 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); }
21550
21943
 
21551
21944
  function SvgChevronRight(props) {
21552
- return /*#__PURE__*/React.createElement("svg", _extends$h({
21945
+ return /*#__PURE__*/React.createElement("svg", _extends$i({
21553
21946
  className: "plc-w-6 plc-h-6",
21554
21947
  xmlns: "http://www.w3.org/2000/svg",
21555
21948
  fill: "none",
21556
21949
  viewBox: "0 0 24 24",
21557
21950
  stroke: "currentColor"
21558
- }, props), _path$g || (_path$g = /*#__PURE__*/React.createElement("path", {
21951
+ }, props), _path$h || (_path$h = /*#__PURE__*/React.createElement("path", {
21559
21952
  strokeLinecap: "round",
21560
21953
  strokeLinejoin: "round",
21561
21954
  strokeWidth: 2,
@@ -21771,18 +22164,18 @@ const SavedItems = ({
21771
22164
  });
21772
22165
  };
21773
22166
 
21774
- var _path$f;
22167
+ var _path$g;
21775
22168
 
21776
- 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); }
22169
+ 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); }
21777
22170
 
21778
22171
  function SvgRefresh(props) {
21779
- return /*#__PURE__*/React.createElement("svg", _extends$g({
22172
+ return /*#__PURE__*/React.createElement("svg", _extends$h({
21780
22173
  className: "plc-w-4 plc-h-4 plc-mr-1",
21781
22174
  xmlns: "http://www.w3.org/2000/svg",
21782
22175
  fill: "none",
21783
22176
  viewBox: "0 0 24 24",
21784
22177
  stroke: "currentColor"
21785
- }, props), _path$f || (_path$f = /*#__PURE__*/React.createElement("path", {
22178
+ }, props), _path$g || (_path$g = /*#__PURE__*/React.createElement("path", {
21786
22179
  strokeLinecap: "round",
21787
22180
  strokeLinejoin: "round",
21788
22181
  strokeWidth: 2,
@@ -21790,35 +22183,35 @@ function SvgRefresh(props) {
21790
22183
  })));
21791
22184
  }
21792
22185
 
21793
- var _path$e;
22186
+ var _path$f;
21794
22187
 
21795
- 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); }
22188
+ 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); }
21796
22189
 
21797
22190
  function SvgCalendar(props) {
21798
- return /*#__PURE__*/React.createElement("svg", _extends$f({
22191
+ return /*#__PURE__*/React.createElement("svg", _extends$g({
21799
22192
  xmlns: "http://www.w3.org/2000/svg",
21800
22193
  className: "plc-h-4 plc-w-4 plc-mr-1",
21801
22194
  viewBox: "0 0 20 20",
21802
22195
  fill: "currentColor"
21803
- }, props), _path$e || (_path$e = /*#__PURE__*/React.createElement("path", {
22196
+ }, props), _path$f || (_path$f = /*#__PURE__*/React.createElement("path", {
21804
22197
  fillRule: "evenodd",
21805
22198
  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",
21806
22199
  clipRule: "evenodd"
21807
22200
  })));
21808
22201
  }
21809
22202
 
21810
- var _path$d;
22203
+ var _path$e;
21811
22204
 
21812
- 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); }
22205
+ 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); }
21813
22206
 
21814
22207
  function SvgPlus(props) {
21815
- return /*#__PURE__*/React.createElement("svg", _extends$e({
22208
+ return /*#__PURE__*/React.createElement("svg", _extends$f({
21816
22209
  className: "plc-w-5 plc-h-5",
21817
22210
  xmlns: "http://www.w3.org/2000/svg",
21818
22211
  fill: "none",
21819
22212
  viewBox: "0 0 24 24",
21820
22213
  stroke: "currentColor"
21821
- }, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
22214
+ }, props), _path$e || (_path$e = /*#__PURE__*/React.createElement("path", {
21822
22215
  strokeLinecap: "round",
21823
22216
  strokeLinejoin: "round",
21824
22217
  strokeWidth: 2,
@@ -21826,17 +22219,17 @@ function SvgPlus(props) {
21826
22219
  })));
21827
22220
  }
21828
22221
 
21829
- var _path$c;
22222
+ var _path$d;
21830
22223
 
21831
- 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); }
22224
+ 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); }
21832
22225
 
21833
22226
  function SvgCheckMark(props) {
21834
- return /*#__PURE__*/React.createElement("svg", _extends$d({
22227
+ return /*#__PURE__*/React.createElement("svg", _extends$e({
21835
22228
  className: "plc-w-4 plc-h-4 plc-mr-1",
21836
22229
  xmlns: "http://www.w3.org/2000/svg",
21837
22230
  viewBox: "0 0 20 20",
21838
22231
  fill: "currentColor"
21839
- }, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
22232
+ }, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
21840
22233
  fillRule: "evenodd",
21841
22234
  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",
21842
22235
  clipRule: "evenodd"
@@ -21900,7 +22293,8 @@ const SubscriptionsItems = ({
21900
22293
  } = useTranslation("dashboard");
21901
22294
  const {
21902
22295
  switchView,
21903
- isAuthenticated
22296
+ switchToAddressView,
22297
+ switchToPaymentView
21904
22298
  } = usePelcro();
21905
22299
  const subs = getNonDonationSubs();
21906
22300
  if (subs.length === 0) return null;
@@ -21942,7 +22336,12 @@ const SubscriptionsItems = ({
21942
22336
  const plan = window.Pelcro.plan.getById(plan_id);
21943
22337
  setProductAndPlan(product, plan);
21944
22338
  setSubscriptionIdToRenew(sub.id);
21945
- setView("plan-select");
22339
+
22340
+ if (product.address_required) {
22341
+ return switchToAddressView();
22342
+ }
22343
+
22344
+ return switchToPaymentView();
21946
22345
  };
21947
22346
 
21948
22347
  const getPhases = () => {
@@ -22131,18 +22530,18 @@ Accordion.item = function AccordionItem({
22131
22530
  }, content)) : null;
22132
22531
  };
22133
22532
 
22134
- var _path$b;
22533
+ var _path$c;
22135
22534
 
22136
- 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); }
22535
+ 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); }
22137
22536
 
22138
22537
  function SvgExit(props) {
22139
- return /*#__PURE__*/React.createElement("svg", _extends$c({
22538
+ return /*#__PURE__*/React.createElement("svg", _extends$d({
22140
22539
  className: "plc-w-6 plc-h-6",
22141
22540
  xmlns: "http://www.w3.org/2000/svg",
22142
22541
  fill: "none",
22143
22542
  viewBox: "0 0 24 24",
22144
22543
  stroke: "currentColor"
22145
- }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
22544
+ }, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
22146
22545
  strokeLinecap: "round",
22147
22546
  strokeLinejoin: "round",
22148
22547
  strokeWidth: 2,
@@ -22150,17 +22549,17 @@ function SvgExit(props) {
22150
22549
  })));
22151
22550
  }
22152
22551
 
22153
- var _path$a;
22552
+ var _path$b;
22154
22553
 
22155
- 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); }
22554
+ 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); }
22156
22555
 
22157
22556
  function SvgUser(props) {
22158
- return /*#__PURE__*/React.createElement("svg", _extends$b({
22557
+ return /*#__PURE__*/React.createElement("svg", _extends$c({
22159
22558
  xmlns: "http://www.w3.org/2000/svg",
22160
22559
  fill: "none",
22161
22560
  viewBox: "0 0 24 24",
22162
22561
  stroke: "currentColor"
22163
- }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
22562
+ }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
22164
22563
  strokeLinecap: "round",
22165
22564
  strokeLinejoin: "round",
22166
22565
  strokeWidth: 2,
@@ -22168,18 +22567,18 @@ function SvgUser(props) {
22168
22567
  })));
22169
22568
  }
22170
22569
 
22171
- var _path$9;
22570
+ var _path$a;
22172
22571
 
22173
- 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); }
22572
+ 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); }
22174
22573
 
22175
22574
  function SvgNewsletter(props) {
22176
- return /*#__PURE__*/React.createElement("svg", _extends$a({
22575
+ return /*#__PURE__*/React.createElement("svg", _extends$b({
22177
22576
  xmlns: "http://www.w3.org/2000/svg",
22178
22577
  className: "plc-h-5 plc-w-5",
22179
22578
  fill: "none",
22180
22579
  viewBox: "0 0 24 24",
22181
22580
  stroke: "currentColor"
22182
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
22581
+ }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
22183
22582
  strokeLinecap: "round",
22184
22583
  strokeLinejoin: "round",
22185
22584
  strokeWidth: 2,
@@ -22187,18 +22586,18 @@ function SvgNewsletter(props) {
22187
22586
  })));
22188
22587
  }
22189
22588
 
22190
- var _path$8;
22589
+ var _path$9;
22191
22590
 
22192
- 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); }
22591
+ 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); }
22193
22592
 
22194
22593
  function SvgDocument(props) {
22195
- return /*#__PURE__*/React.createElement("svg", _extends$9({
22594
+ return /*#__PURE__*/React.createElement("svg", _extends$a({
22196
22595
  xmlns: "http://www.w3.org/2000/svg",
22197
22596
  className: "plc-h-6 plc-w-6 plc-mr-2",
22198
22597
  fill: "none",
22199
22598
  viewBox: "0 0 24 24",
22200
22599
  stroke: "currentColor"
22201
- }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
22600
+ }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
22202
22601
  strokeLinecap: "round",
22203
22602
  strokeLinejoin: "round",
22204
22603
  strokeWidth: 2,
@@ -22206,18 +22605,18 @@ function SvgDocument(props) {
22206
22605
  })));
22207
22606
  }
22208
22607
 
22209
- var _path$7;
22608
+ var _path$8;
22210
22609
 
22211
- 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); }
22610
+ 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); }
22212
22611
 
22213
22612
  function SvgPaymentCard(props) {
22214
- return /*#__PURE__*/React.createElement("svg", _extends$8({
22613
+ return /*#__PURE__*/React.createElement("svg", _extends$9({
22215
22614
  className: "plc-w-6 plc-h-6 plc-mr-2",
22216
22615
  xmlns: "http://www.w3.org/2000/svg",
22217
22616
  fill: "none",
22218
22617
  viewBox: "0 0 24 24",
22219
22618
  stroke: "currentColor"
22220
- }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
22619
+ }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
22221
22620
  strokeLinecap: "round",
22222
22621
  strokeLinejoin: "round",
22223
22622
  strokeWidth: 2,
@@ -22225,18 +22624,18 @@ function SvgPaymentCard(props) {
22225
22624
  })));
22226
22625
  }
22227
22626
 
22228
- var _path$6, _path2$1;
22627
+ var _path$7, _path2$1;
22229
22628
 
22230
- 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); }
22629
+ 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); }
22231
22630
 
22232
22631
  function SvgLocationPin(props) {
22233
- return /*#__PURE__*/React.createElement("svg", _extends$7({
22632
+ return /*#__PURE__*/React.createElement("svg", _extends$8({
22234
22633
  className: "plc-w-6 plc-h-6 plc-mr-2",
22235
22634
  xmlns: "http://www.w3.org/2000/svg",
22236
22635
  fill: "none",
22237
22636
  viewBox: "0 0 24 24",
22238
22637
  stroke: "currentColor"
22239
- }, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
22638
+ }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
22240
22639
  strokeLinecap: "round",
22241
22640
  strokeLinejoin: "round",
22242
22641
  strokeWidth: 2,
@@ -22251,10 +22650,10 @@ function SvgLocationPin(props) {
22251
22650
 
22252
22651
  var _switch;
22253
22652
 
22254
- 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); }
22653
+ 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); }
22255
22654
 
22256
22655
  function SvgSubscription(props) {
22257
- return /*#__PURE__*/React.createElement("svg", _extends$6({
22656
+ return /*#__PURE__*/React.createElement("svg", _extends$7({
22258
22657
  xmlns: "http://www.w3.org/2000/svg",
22259
22658
  viewBox: "0 0 100 125",
22260
22659
  fill: "currentColor"
@@ -22269,18 +22668,18 @@ function SvgSubscription(props) {
22269
22668
  }))))));
22270
22669
  }
22271
22670
 
22272
- var _path$5;
22671
+ var _path$6;
22273
22672
 
22274
- 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); }
22673
+ 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); }
22275
22674
 
22276
22675
  function SvgShopping(props) {
22277
- return /*#__PURE__*/React.createElement("svg", _extends$5({
22676
+ return /*#__PURE__*/React.createElement("svg", _extends$6({
22278
22677
  className: "plc-w-6 plc-h-6 plc-mr-2",
22279
22678
  xmlns: "http://www.w3.org/2000/svg",
22280
22679
  fill: "none",
22281
22680
  viewBox: "0 0 24 24",
22282
22681
  stroke: "currentColor"
22283
- }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
22682
+ }, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
22284
22683
  strokeLinecap: "round",
22285
22684
  strokeLinejoin: "round",
22286
22685
  strokeWidth: 2,
@@ -22288,18 +22687,18 @@ function SvgShopping(props) {
22288
22687
  })));
22289
22688
  }
22290
22689
 
22291
- var _path$4;
22690
+ var _path$5;
22292
22691
 
22293
- 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); }
22692
+ 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); }
22294
22693
 
22295
22694
  function SvgBookmark(props) {
22296
- return /*#__PURE__*/React.createElement("svg", _extends$4({
22695
+ return /*#__PURE__*/React.createElement("svg", _extends$5({
22297
22696
  className: "plc-w-6 plc-h-6 plc-mr-2",
22298
22697
  xmlns: "http://www.w3.org/2000/svg",
22299
22698
  fill: "none",
22300
22699
  viewBox: "0 0 24 24",
22301
22700
  stroke: "currentColor"
22302
- }, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
22701
+ }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
22303
22702
  strokeLinecap: "round",
22304
22703
  strokeLinejoin: "round",
22305
22704
  strokeWidth: 2,
@@ -22307,33 +22706,33 @@ function SvgBookmark(props) {
22307
22706
  })));
22308
22707
  }
22309
22708
 
22310
- var _path$3;
22709
+ var _path$4;
22311
22710
 
22312
- 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); }
22711
+ 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); }
22313
22712
 
22314
22713
  function SvgKey(props) {
22315
- return /*#__PURE__*/React.createElement("svg", _extends$3({
22714
+ return /*#__PURE__*/React.createElement("svg", _extends$4({
22316
22715
  xmlns: "http://www.w3.org/2000/svg",
22317
22716
  viewBox: "0 0 20 20",
22318
22717
  fill: "currentColor"
22319
- }, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
22718
+ }, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
22320
22719
  fillRule: "evenodd",
22321
22720
  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",
22322
22721
  clipRule: "evenodd"
22323
22722
  })));
22324
22723
  }
22325
22724
 
22326
- var _path$2;
22725
+ var _path$3;
22327
22726
 
22328
- 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); }
22727
+ 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); }
22329
22728
 
22330
22729
  function SvgDonate(props) {
22331
- return /*#__PURE__*/React.createElement("svg", _extends$2({
22730
+ return /*#__PURE__*/React.createElement("svg", _extends$3({
22332
22731
  width: 24,
22333
22732
  height: 24,
22334
22733
  fill: "currentColor",
22335
22734
  xmlns: "http://www.w3.org/2000/svg"
22336
- }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
22735
+ }, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
22337
22736
  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"
22338
22737
  })));
22339
22738
  }
@@ -22660,9 +23059,10 @@ class Dashboard extends Component {
22660
23059
  }) => {
22661
23060
  if (isGift) {
22662
23061
  this.props.setProductAndPlan(null, null, true);
23062
+ return this.props.setView("plan-select");
22663
23063
  }
22664
23064
 
22665
- return this.props.setView("plan-select");
23065
+ return this.props.setView("subscription-options");
22666
23066
  });
22667
23067
 
22668
23068
  _defineProperty$3(this, "displayAddressCreate", () => {
@@ -23130,7 +23530,7 @@ const DashboardOpenButton = () => {
23130
23530
  };
23131
23531
  DashboardOpenButton.viewId = "dashboard-open";
23132
23532
 
23133
- const initialState$2 = {
23533
+ const initialState$3 = {
23134
23534
  imageSrc: null,
23135
23535
  crop: {
23136
23536
  x: 0,
@@ -23144,10 +23544,10 @@ const initialState$2 = {
23144
23544
  content: ""
23145
23545
  }
23146
23546
  };
23147
- const store$2 = /*#__PURE__*/createContext(initialState$2);
23547
+ const store$3 = /*#__PURE__*/createContext(initialState$3);
23148
23548
  const {
23149
- Provider: Provider$2
23150
- } = store$2;
23549
+ Provider: Provider$3
23550
+ } = store$3;
23151
23551
 
23152
23552
  const ProfilePicChangeContainer = ({
23153
23553
  style,
@@ -23281,21 +23681,21 @@ const ProfilePicChangeContainer = ({
23281
23681
  default:
23282
23682
  return state;
23283
23683
  }
23284
- }, initialState$2);
23684
+ }, initialState$3);
23285
23685
  return /*#__PURE__*/React__default.createElement("div", {
23286
23686
  style: { ...style
23287
23687
  },
23288
23688
  className: `pelcro-container pelcro-profile-picture-container ${className}`
23289
- }, /*#__PURE__*/React__default.createElement(Provider$2, {
23689
+ }, /*#__PURE__*/React__default.createElement(Provider$3, {
23290
23690
  value: {
23291
23691
  state,
23292
23692
  dispatch
23293
23693
  }
23294
23694
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
23295
- store: store$2,
23695
+ store: store$3,
23296
23696
  key: i
23297
23697
  })) : /*#__PURE__*/React__default.cloneElement(children, {
23298
- store: store$2
23698
+ store: store$3
23299
23699
  })));
23300
23700
  };
23301
23701
  /**
@@ -23357,7 +23757,7 @@ const ProfilePicChangeButton = ({
23357
23757
  isSubmitting
23358
23758
  },
23359
23759
  dispatch
23360
- } = useContext(store$2);
23760
+ } = useContext(store$3);
23361
23761
  const {
23362
23762
  t
23363
23763
  } = useTranslation("userEdit");
@@ -24725,7 +25125,7 @@ const ProfilePicChangeCropper = ({
24725
25125
  zoom
24726
25126
  },
24727
25127
  dispatch
24728
- } = useContext(store$2);
25128
+ } = useContext(store$3);
24729
25129
  return /*#__PURE__*/React__default.createElement("div", {
24730
25130
  className: `plc-relative plc-w-full plc-h-52 sm:plc-h-96 ${className}`
24731
25131
  }, /*#__PURE__*/React__default.createElement(Cropper, Object.assign({
@@ -24767,7 +25167,7 @@ const ProfilePicChangeZoom = ({
24767
25167
  zoom
24768
25168
  },
24769
25169
  dispatch
24770
- } = useContext(store$2);
25170
+ } = useContext(store$3);
24771
25171
  const {
24772
25172
  t
24773
25173
  } = useTranslation("userEdit");
@@ -24790,18 +25190,18 @@ const ProfilePicChangeZoom = ({
24790
25190
  }, otherProps)));
24791
25191
  };
24792
25192
 
24793
- var _path$1;
25193
+ var _path$2;
24794
25194
 
24795
- 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); }
25195
+ 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); }
24796
25196
 
24797
25197
  function SvgPhotograph(props) {
24798
- return /*#__PURE__*/React.createElement("svg", _extends$1({
25198
+ return /*#__PURE__*/React.createElement("svg", _extends$2({
24799
25199
  xmlns: "http://www.w3.org/2000/svg",
24800
25200
  className: "plc-h-6 plc-w-6",
24801
25201
  fill: "none",
24802
25202
  viewBox: "0 0 24 24",
24803
25203
  stroke: "currentColor"
24804
- }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
25204
+ }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
24805
25205
  strokeLinecap: "round",
24806
25206
  strokeLinejoin: "round",
24807
25207
  strokeWidth: 2,
@@ -24819,7 +25219,7 @@ const ProfilePicChangeSelectButton = ({
24819
25219
  state: {
24820
25220
  isSubmitting
24821
25221
  }
24822
- } = useContext(store$2);
25222
+ } = useContext(store$3);
24823
25223
  const {
24824
25224
  t
24825
25225
  } = useTranslation("userEdit");
@@ -24861,7 +25261,7 @@ const ProfilePicChangeRemoveButton = ({
24861
25261
  state: {
24862
25262
  isSubmitting
24863
25263
  }
24864
- } = useContext(store$2);
25264
+ } = useContext(store$3);
24865
25265
  const {
24866
25266
  t
24867
25267
  } = useTranslation("userEdit");
@@ -24884,7 +25284,7 @@ const ProfilePicChangeWrapper = () => {
24884
25284
  state: {
24885
25285
  imageSrc
24886
25286
  }
24887
- } = useContext(store$2);
25287
+ } = useContext(store$3);
24888
25288
  const {
24889
25289
  t
24890
25290
  } = useTranslation("userEdit");
@@ -24946,17 +25346,17 @@ function ProfilePicChangeModal({
24946
25346
  }
24947
25347
  ProfilePicChangeModal.viewId = "profile-picture";
24948
25348
 
24949
- const initialState$1 = {
25349
+ const initialState$2 = {
24950
25350
  isSubmitting: false,
24951
25351
  alert: {
24952
25352
  type: "error",
24953
25353
  content: ""
24954
25354
  }
24955
25355
  };
24956
- const store$1 = /*#__PURE__*/createContext(initialState$1);
25356
+ const store$2 = /*#__PURE__*/createContext(initialState$2);
24957
25357
  const {
24958
- Provider: Provider$1
24959
- } = store$1;
25358
+ Provider: Provider$2
25359
+ } = store$2;
24960
25360
 
24961
25361
  const EmailVerifyContainer = ({
24962
25362
  style,
@@ -25019,21 +25419,21 @@ const EmailVerifyContainer = ({
25019
25419
  default:
25020
25420
  return state;
25021
25421
  }
25022
- }, initialState$1);
25422
+ }, initialState$2);
25023
25423
  return /*#__PURE__*/React__default.createElement("div", {
25024
25424
  style: { ...style
25025
25425
  },
25026
25426
  className: `pelcro-container pelcro-email-verify-container ${className}`
25027
- }, /*#__PURE__*/React__default.createElement(Provider$1, {
25427
+ }, /*#__PURE__*/React__default.createElement(Provider$2, {
25028
25428
  value: {
25029
25429
  state,
25030
25430
  dispatch
25031
25431
  }
25032
25432
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
25033
- store: store$1,
25433
+ store: store$2,
25034
25434
  key: i
25035
25435
  })) : /*#__PURE__*/React__default.cloneElement(children, {
25036
- store: store$1
25436
+ store: store$2
25037
25437
  })));
25038
25438
  };
25039
25439
 
@@ -25047,7 +25447,7 @@ const EmailVerifyResendButton = ({
25047
25447
  state: {
25048
25448
  isSubmitting
25049
25449
  }
25050
- } = useContext(store$1);
25450
+ } = useContext(store$2);
25051
25451
  const {
25052
25452
  t
25053
25453
  } = useTranslation("verifyEmail");
@@ -25062,16 +25462,16 @@ const EmailVerifyResendButton = ({
25062
25462
  }, otherProps), name !== null && name !== void 0 ? name : t("labels.resend"));
25063
25463
  };
25064
25464
 
25065
- var _path, _path2;
25465
+ var _path$1, _path2;
25066
25466
 
25067
- 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); }
25467
+ 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); }
25068
25468
 
25069
25469
  function SvgEmailVerify(props) {
25070
- return /*#__PURE__*/React.createElement("svg", _extends({
25470
+ return /*#__PURE__*/React.createElement("svg", _extends$1({
25071
25471
  className: "plc-w-6 plc-h-6",
25072
25472
  viewBox: "0 0 700 700",
25073
25473
  xmlns: "http://www.w3.org/2000/svg"
25074
- }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
25474
+ }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
25075
25475
  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"
25076
25476
  })), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
25077
25477
  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"
@@ -25175,11 +25575,11 @@ const invoicePaymentSubmitButton = props => {
25175
25575
  return /*#__PURE__*/React__default.createElement(SubmitPaymentMethod, props);
25176
25576
  };
25177
25577
 
25178
- const initialState = {};
25179
- const store = /*#__PURE__*/createContext(initialState);
25578
+ const initialState$1 = {};
25579
+ const store$1 = /*#__PURE__*/createContext(initialState$1);
25180
25580
  const {
25181
- Provider
25182
- } = store;
25581
+ Provider: Provider$1
25582
+ } = store$1;
25183
25583
 
25184
25584
  const InvoiceDetailsContainer = ({
25185
25585
  style,
@@ -25200,21 +25600,21 @@ const InvoiceDetailsContainer = ({
25200
25600
  default:
25201
25601
  return state;
25202
25602
  }
25203
- }, initialState);
25603
+ }, initialState$1);
25204
25604
  return /*#__PURE__*/React__default.createElement("div", {
25205
25605
  style: { ...style
25206
25606
  },
25207
25607
  className: `pelcro-container pelcro-invoice-details-container ${className}`
25208
- }, /*#__PURE__*/React__default.createElement(Provider, {
25608
+ }, /*#__PURE__*/React__default.createElement(Provider$1, {
25209
25609
  value: {
25210
25610
  state,
25211
25611
  dispatch
25212
25612
  }
25213
25613
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
25214
- store,
25614
+ store: store$1,
25215
25615
  key: i
25216
25616
  })) : /*#__PURE__*/React__default.cloneElement(children, {
25217
- store
25617
+ store: store$1
25218
25618
  })));
25219
25619
  };
25220
25620
 
@@ -25246,7 +25646,7 @@ const InvoiceDetailsPayButton = ({
25246
25646
  }) => {
25247
25647
  const {
25248
25648
  dispatch
25249
- } = useContext(store);
25649
+ } = useContext(store$1);
25250
25650
  const {
25251
25651
  t
25252
25652
  } = useTranslation("invoiceDetails");
@@ -25351,4 +25751,230 @@ const InvoiceDetailsModal = ({
25351
25751
  };
25352
25752
  InvoiceDetailsModal.viewId = "invoice-details";
25353
25753
 
25354
- 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 };
25754
+ const initialState = {
25755
+ selectedOption: ""
25756
+ };
25757
+ const store = /*#__PURE__*/createContext(initialState);
25758
+ const {
25759
+ Provider
25760
+ } = store;
25761
+
25762
+ const SubscriptionOptionsContainer = ({
25763
+ style,
25764
+ className = "",
25765
+ onRenewSubSuccess = () => {},
25766
+ onNewSubSuccess = () => {},
25767
+ children,
25768
+ ...props
25769
+ }) => {
25770
+ const submit = ({
25771
+ selectedOption
25772
+ }, dispatch) => {
25773
+ if (selectedOption === "renew") return onRenewSubSuccess();
25774
+ if (selectedOption === "new") return onNewSubSuccess();
25775
+ };
25776
+
25777
+ const [state, dispatch] = useReducerWithSideEffects((state, action) => {
25778
+ switch (action.type) {
25779
+ case SWITCH_TO_NEW:
25780
+ return lib_7({ ...state,
25781
+ selectedOption: "new"
25782
+ });
25783
+
25784
+ case SWITCH_TO_RENEW:
25785
+ return lib_7({ ...state,
25786
+ selectedOption: "renew"
25787
+ });
25788
+
25789
+ case HANDLE_SUBMIT:
25790
+ return lib_4((state, dispatch) => submit(state));
25791
+
25792
+ default:
25793
+ return state;
25794
+ }
25795
+ }, initialState);
25796
+ return /*#__PURE__*/React__default.createElement("div", {
25797
+ style: { ...style
25798
+ },
25799
+ className: `pelcro-container pelcro-subscription-options-container ${className}`
25800
+ }, /*#__PURE__*/React__default.createElement(Provider, {
25801
+ value: {
25802
+ state,
25803
+ dispatch
25804
+ }
25805
+ }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
25806
+ store,
25807
+ key: i
25808
+ })) : /*#__PURE__*/React__default.cloneElement(children, {
25809
+ store
25810
+ })));
25811
+ };
25812
+
25813
+ var _path;
25814
+
25815
+ 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); }
25816
+
25817
+ function SvgPlusCircle(props) {
25818
+ return /*#__PURE__*/React.createElement("svg", _extends({
25819
+ xmlns: "http://www.w3.org/2000/svg",
25820
+ className: "plc-h-6 plc-w-6",
25821
+ fill: "none",
25822
+ viewBox: "0 0 24 24",
25823
+ stroke: "currentColor",
25824
+ strokeWidth: 2
25825
+ }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
25826
+ strokeLinecap: "round",
25827
+ strokeLinejoin: "round",
25828
+ d: "M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"
25829
+ })));
25830
+ }
25831
+
25832
+ const SubscriptionOptionsNewButton = ({
25833
+ name,
25834
+ onClick,
25835
+ ...otherProps
25836
+ }) => {
25837
+ const {
25838
+ dispatch,
25839
+ state: {
25840
+ selectedOption
25841
+ }
25842
+ } = useContext(store);
25843
+ const {
25844
+ t
25845
+ } = useTranslation("subscriptionOptions");
25846
+ const isChecked = selectedOption === "new";
25847
+ return /*#__PURE__*/React__default.createElement(Radio, Object.assign({
25848
+ className: "plc-hidden pelcro-new-sub-option",
25849
+ 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"}`,
25850
+ id: "pelcro-new-sub-option",
25851
+ name: "option",
25852
+ onChange: () => {
25853
+ dispatch({
25854
+ type: SWITCH_TO_NEW
25855
+ });
25856
+ onClick === null || onClick === void 0 ? void 0 : onClick();
25857
+ },
25858
+ checked: isChecked
25859
+ }, otherProps), name !== null && name !== void 0 ? name : t("addNew"), /*#__PURE__*/React__default.createElement(SvgPlusCircle, {
25860
+ className: "plc-w-full plc-h-full plc-mr-0"
25861
+ }));
25862
+ };
25863
+
25864
+ const SubscriptionOptionsRenewButton = ({
25865
+ name,
25866
+ onClick,
25867
+ ...otherProps
25868
+ }) => {
25869
+ const {
25870
+ dispatch,
25871
+ state: {
25872
+ selectedOption
25873
+ }
25874
+ } = useContext(store);
25875
+ const {
25876
+ t
25877
+ } = useTranslation("subscriptionOptions");
25878
+ const isChecked = selectedOption === "renew";
25879
+ return /*#__PURE__*/React__default.createElement(Radio, Object.assign({
25880
+ className: "plc-hidden pelcro-renew-sub-option",
25881
+ 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"}`,
25882
+ id: "pelcro-renew-sub-option",
25883
+ name: "option",
25884
+ onChange: () => {
25885
+ dispatch({
25886
+ type: SWITCH_TO_RENEW
25887
+ });
25888
+ onClick === null || onClick === void 0 ? void 0 : onClick();
25889
+ },
25890
+ checked: isChecked
25891
+ }, otherProps), name !== null && name !== void 0 ? name : t("renew"), /*#__PURE__*/React__default.createElement(SvgRefresh, {
25892
+ className: "plc-w-full plc-h-full plc-mr-0"
25893
+ }));
25894
+ };
25895
+
25896
+ const SubscriptionOptionsSubmit = ({
25897
+ name,
25898
+ onClick,
25899
+ ...otherProps
25900
+ }) => {
25901
+ const {
25902
+ dispatch,
25903
+ state: {
25904
+ selectedOption
25905
+ }
25906
+ } = useContext(store);
25907
+ const {
25908
+ t
25909
+ } = useTranslation("subscriptionOptions");
25910
+ return /*#__PURE__*/React__default.createElement(Button, Object.assign({
25911
+ onClick: () => {
25912
+ dispatch({
25913
+ type: HANDLE_SUBMIT
25914
+ });
25915
+ onClick === null || onClick === void 0 ? void 0 : onClick();
25916
+ },
25917
+ disabled: !selectedOption
25918
+ }, otherProps), name !== null && name !== void 0 ? name : t("next"));
25919
+ };
25920
+
25921
+ const SubscriptionOptionsView = props => {
25922
+ const {
25923
+ t
25924
+ } = useTranslation("subscriptionOptions");
25925
+ return /*#__PURE__*/React__default.createElement("div", {
25926
+ id: "pelcro-subscription-options-view"
25927
+ }, /*#__PURE__*/React__default.createElement("div", {
25928
+ className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
25929
+ }, /*#__PURE__*/React__default.createElement("h4", {
25930
+ className: "plc-text-2xl plc-font-semibold"
25931
+ }, t("title")), /*#__PURE__*/React__default.createElement("p", null, t("subtitle"))), /*#__PURE__*/React__default.createElement("form", {
25932
+ action: "javascript:void(0);",
25933
+ className: "plc-mt-2 pelcro-form"
25934
+ }, /*#__PURE__*/React__default.createElement(SubscriptionOptionsContainer, props, /*#__PURE__*/React__default.createElement("div", {
25935
+ className: "plc-flex plc-justify-between plc-items-center"
25936
+ }, /*#__PURE__*/React__default.createElement(SubscriptionOptionsRenewButton, null), /*#__PURE__*/React__default.createElement(SubscriptionOptionsNewButton, null)), /*#__PURE__*/React__default.createElement(SubscriptionOptionsSubmit, {
25937
+ role: "submit",
25938
+ className: "plc-mt-4 plc-w-full",
25939
+ name: t("next"),
25940
+ id: "pelcro-submit"
25941
+ }))));
25942
+ };
25943
+
25944
+ const SubscriptionOptionsModal = ({
25945
+ onDisplay,
25946
+ onClose,
25947
+ ...otherProps
25948
+ }) => {
25949
+ const {
25950
+ switchView,
25951
+ setProductsList
25952
+ } = usePelcro();
25953
+
25954
+ const onRenewSubSuccess = () => {
25955
+ var _otherProps$onRenewSu;
25956
+
25957
+ (_otherProps$onRenewSu = otherProps.onRenewSubSuccess) === null || _otherProps$onRenewSu === void 0 ? void 0 : _otherProps$onRenewSu.call(otherProps);
25958
+ setProductsList(getRenewableProducts());
25959
+ switchView("_plan-select-renew");
25960
+ };
25961
+
25962
+ const onNewSubSuccess = () => {
25963
+ var _otherProps$onNewSubS;
25964
+
25965
+ (_otherProps$onNewSubS = otherProps.onNewSubSuccess) === null || _otherProps$onNewSubS === void 0 ? void 0 : _otherProps$onNewSubS.call(otherProps);
25966
+ switchView("plan-select");
25967
+ };
25968
+
25969
+ return /*#__PURE__*/React__default.createElement(Modal, {
25970
+ onDisplay: onDisplay,
25971
+ onClose: onClose,
25972
+ id: "pelcro-subscription-options-modal"
25973
+ }, /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(SubscriptionOptionsView, Object.assign({}, otherProps, {
25974
+ onNewSubSuccess: onNewSubSuccess,
25975
+ onRenewSubSuccess: onRenewSubSuccess
25976
+ }))), /*#__PURE__*/React__default.createElement(ModalFooter, null, /*#__PURE__*/React__default.createElement(Authorship, null)));
25977
+ };
25978
+ SubscriptionOptionsModal.viewId = "subscription-options";
25979
+
25980
+ 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 };