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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -3244,7 +3244,8 @@ function withTranslation(ns) {
3244
3244
  var validation$1 = {
3245
3245
  validEmail: "le courriel n’est pas valide",
3246
3246
  enterEmail: "Un courriel est requis.",
3247
- enterPassword: "Mot de passe requis."
3247
+ enterPassword: "Mot de passe requis.",
3248
+ confirmPassword: "Confirmer le mot de passe requis."
3248
3249
  };
3249
3250
  var buttons$9 = {
3250
3251
  account: "Accès abonné(e)s",
@@ -3332,7 +3333,8 @@ var common_fr = {
3332
3333
  var validation = {
3333
3334
  validEmail: "Email address is not valid.",
3334
3335
  enterEmail: "Email address is required.",
3335
- enterPassword: "Password is required."
3336
+ enterPassword: "Password is required.",
3337
+ confirmPassword: "Confirm password is required."
3336
3338
  };
3337
3339
  var buttons$8 = {
3338
3340
  account: "My account",
@@ -3464,7 +3466,7 @@ var paymentMethod_fr = {
3464
3466
  var title$f = "Enter your email to subscribe to our newsletter";
3465
3467
  var updateTitle$1 = "Update newsletter selections";
3466
3468
  var subtitle$7 = "We may use your email for other marketing communication";
3467
- var labels$p = {
3469
+ var labels$r = {
3468
3470
  submit: "Submit",
3469
3471
  firstName: "First name",
3470
3472
  lastName: "Last name",
@@ -3472,7 +3474,7 @@ var labels$p = {
3472
3474
  postalCode: "Postal code",
3473
3475
  required: "required"
3474
3476
  };
3475
- var messages$r = {
3477
+ var messages$t = {
3476
3478
  alreadyHaveAccount: "Already have an account?",
3477
3479
  success: "Newsletters were successfully updated",
3478
3480
  loginHere: "Login here.",
@@ -3483,14 +3485,14 @@ var newsletter_en = {
3483
3485
  title: title$f,
3484
3486
  updateTitle: updateTitle$1,
3485
3487
  subtitle: subtitle$7,
3486
- labels: labels$p,
3487
- messages: messages$r
3488
+ labels: labels$r,
3489
+ messages: messages$t
3488
3490
  };
3489
3491
 
3490
3492
  var title$e = "Entrez votre adresse courriel pour vous abonner à notre infolettre";
3491
3493
  var updateTitle = "Mettre à jour son choix d'infolettres";
3492
3494
  var subtitle$6 = "Nous pouvons utiliser votre adresse courriel pour d’autres communications marketing";
3493
- var labels$o = {
3495
+ var labels$q = {
3494
3496
  submit: "Lire l’article !",
3495
3497
  firstName: "Prénom",
3496
3498
  lastName: "Nom de famille",
@@ -3498,7 +3500,7 @@ var labels$o = {
3498
3500
  postalCode: "Code postal",
3499
3501
  required: "Champs obligatoires"
3500
3502
  };
3501
- var messages$q = {
3503
+ var messages$s = {
3502
3504
  alreadyHaveAccount: "Vous avez déjà un compte ?",
3503
3505
  success: "Votre choix d'infolettres à été mis à jour",
3504
3506
  loginHere: "Connectez-vous ici",
@@ -3509,14 +3511,14 @@ var newsletter_fr = {
3509
3511
  title: title$e,
3510
3512
  updateTitle: updateTitle,
3511
3513
  subtitle: subtitle$6,
3512
- labels: labels$o,
3513
- messages: messages$q
3514
+ labels: labels$q,
3515
+ messages: messages$s
3514
3516
  };
3515
3517
 
3516
- var labels$n = {
3518
+ var labels$p = {
3517
3519
  "continue": "Continue to content"
3518
3520
  };
3519
- var messages$p = {
3521
+ var messages$r = {
3520
3522
  yourFreeTrial: "Subscription successful!",
3521
3523
  youHaveAccess: "Hope you enjoy the subscription. Please contact us if you have any questions or concerns.",
3522
3524
  clickToLearn: {
@@ -3542,15 +3544,15 @@ var errors$9 = {
3542
3544
  "": ""
3543
3545
  };
3544
3546
  var success_en = {
3545
- labels: labels$n,
3546
- messages: messages$p,
3547
+ labels: labels$p,
3548
+ messages: messages$r,
3547
3549
  errors: errors$9
3548
3550
  };
3549
3551
 
3550
- var labels$m = {
3552
+ var labels$o = {
3551
3553
  "continue": "Abonnement réussi !"
3552
3554
  };
3553
- var messages$o = {
3555
+ var messages$q = {
3554
3556
  yourFreeTrial: "Votre essai gratuit vient de débuter",
3555
3557
  youHaveAccess: "Nous espérons que vous allez apprécier votre abonnement. Veuillez nous contacter si vous avez des questions ou des préoccupations.",
3556
3558
  clickToLearn: {
@@ -3576,12 +3578,12 @@ var errors$8 = {
3576
3578
  "": ""
3577
3579
  };
3578
3580
  var success_fr = {
3579
- labels: labels$m,
3580
- messages: messages$o,
3581
+ labels: labels$o,
3582
+ messages: messages$q,
3581
3583
  errors: errors$8
3582
3584
  };
3583
3585
 
3584
- var messages$n = {
3586
+ var messages$p = {
3585
3587
  freeVisits: "Free visits left:",
3586
3588
  subscribeNow: "Subscribe",
3587
3589
  alreadyHaveAccount: "Already have an account?",
@@ -3591,11 +3593,11 @@ var errors$7 = {
3591
3593
  "": ""
3592
3594
  };
3593
3595
  var meter_en = {
3594
- messages: messages$n,
3596
+ messages: messages$p,
3595
3597
  errors: errors$7
3596
3598
  };
3597
3599
 
3598
- var messages$m = {
3600
+ var messages$o = {
3599
3601
  freeVisits: "Visites gratuites restantes:",
3600
3602
  subscribeNow: "Abonnez-vous maintenant !",
3601
3603
  alreadyHaveAccount: "Vous avez déjà un compte ?",
@@ -3605,15 +3607,15 @@ var errors$6 = {
3605
3607
  "": ""
3606
3608
  };
3607
3609
  var meter_fr = {
3608
- messages: messages$m,
3610
+ messages: messages$o,
3609
3611
  errors: errors$6
3610
3612
  };
3611
3613
 
3612
- var messages$l = {
3614
+ var messages$n = {
3613
3615
  youAreSafe: "You're safe - PCI compliant 128 SSL by",
3614
3616
  bankRedirection: "Please hold, redirecting you to your bank."
3615
3617
  };
3616
- var labels$l = {
3618
+ var labels$n = {
3617
3619
  card: "Enter card number",
3618
3620
  date: "Expiration date",
3619
3621
  CVC: "CVC",
@@ -3632,15 +3634,15 @@ var labels$l = {
3632
3634
  removeCoupon: "REMOVE"
3633
3635
  };
3634
3636
  var checkoutForm_en = {
3635
- messages: messages$l,
3636
- labels: labels$l
3637
+ messages: messages$n,
3638
+ labels: labels$n
3637
3639
  };
3638
3640
 
3639
- var messages$k = {
3641
+ var messages$m = {
3640
3642
  youAreSafe: "Vous êtes en sécurité - PCI conforme 128 SSL par",
3641
3643
  bankRedirection: "Veuillez patienter, nous vous redirigeons vers votre banque."
3642
3644
  };
3643
- var labels$k = {
3645
+ var labels$m = {
3644
3646
  card: "Entrez le numéro de carte",
3645
3647
  date: "Date d’expiration",
3646
3648
  CVC: "CVC",
@@ -3659,8 +3661,8 @@ var labels$k = {
3659
3661
  removeCoupon: "RETIRER"
3660
3662
  };
3661
3663
  var checkoutForm_fr = {
3662
- messages: messages$k,
3663
- labels: labels$k
3664
+ messages: messages$m,
3665
+ labels: labels$m
3664
3666
  };
3665
3667
 
3666
3668
  var youAreSafe$1 = "You're safe - PCI compliant 128 SSL by";
@@ -3701,7 +3703,7 @@ var messages_fr = {
3701
3703
  zeroTotalInvoice: zeroTotalInvoice
3702
3704
  };
3703
3705
 
3704
- var labels$j = {
3706
+ var labels$l = {
3705
3707
  email: "Enter email",
3706
3708
  password: "Enter password",
3707
3709
  required: "required",
@@ -3709,7 +3711,7 @@ var labels$j = {
3709
3711
  passwordPlaceholder: "Password",
3710
3712
  login: "Login"
3711
3713
  };
3712
- var messages$j = {
3714
+ var messages$l = {
3713
3715
  loginTo: "Login to your account",
3714
3716
  welcome: "Welcome back, sign in with your existing account.",
3715
3717
  dontHaveAccount: "Don't have an account yet?",
@@ -3728,12 +3730,12 @@ var errors$5 = {
3728
3730
  "": ""
3729
3731
  };
3730
3732
  var login_en = {
3731
- labels: labels$j,
3732
- messages: messages$j,
3733
+ labels: labels$l,
3734
+ messages: messages$l,
3733
3735
  errors: errors$5
3734
3736
  };
3735
3737
 
3736
- var labels$i = {
3738
+ var labels$k = {
3737
3739
  email: "Entrez votre adresse courriel",
3738
3740
  password: "Entrez votre mot de passe",
3739
3741
  required: "Champs obligatoires",
@@ -3741,7 +3743,7 @@ var labels$i = {
3741
3743
  passwordPlaceholder: "Mot de passe",
3742
3744
  login: "Connexion"
3743
3745
  };
3744
- var messages$i = {
3746
+ var messages$k = {
3745
3747
  loginTo: "Connectez-vous à votre compte",
3746
3748
  welcome: "Bienvenue, connectez-vous avec votre compte existant.",
3747
3749
  dontHaveAccount: "Vous n’avez pas encore de compte ?",
@@ -3760,11 +3762,39 @@ var errors$4 = {
3760
3762
  "": ""
3761
3763
  };
3762
3764
  var login_fr = {
3763
- labels: labels$i,
3764
- messages: messages$i,
3765
+ labels: labels$k,
3766
+ messages: messages$k,
3765
3767
  errors: errors$4
3766
3768
  };
3767
3769
 
3770
+ var labels$j = {
3771
+ title: "Verifying Magin Link",
3772
+ instructions: "You're on your way!\nLet's confirm your email address.\nClick on the verification link we've sent to your email:",
3773
+ resend: "Resend email"
3774
+ };
3775
+ var messages$j = {
3776
+ resent: "Resent successfully",
3777
+ success: "Link verified successfully!"
3778
+ };
3779
+ var verifyLinkToken_en = {
3780
+ labels: labels$j,
3781
+ messages: messages$j
3782
+ };
3783
+
3784
+ var labels$i = {
3785
+ title: "Confirmez votre courriel",
3786
+ instructions: "Confirmez votre courriel.\nVeuillez cliquer sur le lien de vérification, qui vous a été envoyé à:",
3787
+ resend: "Renvoyer le courriel"
3788
+ };
3789
+ var messages$i = {
3790
+ resent: "Renvoyé avec succès",
3791
+ success: "Lien vérifiée avec succès"
3792
+ };
3793
+ var verifyLinkToken_fr = {
3794
+ labels: labels$i,
3795
+ messages: messages$i
3796
+ };
3797
+
3768
3798
  var title$d = "Create an account";
3769
3799
  var subtitle$5 = "Enter your email and password below";
3770
3800
  var labels$h = {
@@ -4684,17 +4714,17 @@ var invoiceDetails_en = {
4684
4714
  buttons: buttons$1
4685
4715
  };
4686
4716
 
4687
- var title = "Invoice details";
4717
+ var title = "Détails de la facture";
4688
4718
  var labels = {
4689
- summary: "Summary",
4719
+ summary: "Résumé",
4690
4720
  total: "Total",
4691
- amountPaid: "Amount paid",
4692
- amountDue: "Amount due",
4693
- creationDate: "Created on:"
4721
+ amountPaid: "Montant payé",
4722
+ amountDue: "Montant ",
4723
+ creationDate: "Créé le:"
4694
4724
  };
4695
4725
  var buttons = {
4696
- download: "Download",
4697
- pay: "Pay now"
4726
+ download: "Télécharger",
4727
+ pay: "Payer"
4698
4728
  };
4699
4729
  var invoiceDetails_fr = {
4700
4730
  title: title,
@@ -6051,7 +6081,7 @@ class PelcroActions {
6051
6081
  view,
6052
6082
  cartItems,
6053
6083
  ...otherStateFields
6054
- } = initialState$i;
6084
+ } = initialState$j;
6055
6085
  this.set(otherStateFields);
6056
6086
  });
6057
6087
 
@@ -6370,7 +6400,7 @@ class PelcroCallbacks {
6370
6400
 
6371
6401
  }
6372
6402
 
6373
- const initialState$i = {
6403
+ const initialState$j = {
6374
6404
  // View
6375
6405
  view: null,
6376
6406
  // Plans
@@ -6400,7 +6430,7 @@ const createPelcroStore = () => createStore(middleware_3((set, get) => {
6400
6430
  return {
6401
6431
  // Store setter
6402
6432
  set,
6403
- ...initialState$i,
6433
+ ...initialState$j,
6404
6434
  // State actions
6405
6435
  ...actions,
6406
6436
  // Callbacks
@@ -6436,6 +6466,19 @@ if (process.env.NODE_ENV === "development") {
6436
6466
  c$1("Pelcro Store", usePelcro);
6437
6467
  }
6438
6468
 
6469
+ /**
6470
+ * List of zero-decimal currencies.
6471
+ * @see https://stripe.com/docs/currencies#zero-decimal
6472
+ *
6473
+ */
6474
+
6475
+ const ZERO_DECIMAL_CURRENCIES = ['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'];
6476
+ /**
6477
+ * @param {string}
6478
+ * @return {boolean}
6479
+ */
6480
+
6481
+ const isCurrencyZeroDecimal = currency => ZERO_DECIMAL_CURRENCIES.includes(currency);
6439
6482
  const sortCountries = countries => {
6440
6483
  const sortable = [];
6441
6484
  delete countries.CA;
@@ -6522,7 +6565,7 @@ const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en") => {
6522
6565
  style: "currency",
6523
6566
  currency
6524
6567
  });
6525
- return formatter.format(amount / 100);
6568
+ return isCurrencyZeroDecimal(currency) ? formatter.format(amount) : formatter.format(amount / 100);
6526
6569
  };
6527
6570
  /** check wether or not the user have any addresses
6528
6571
  * @return {boolean} true if the user have at least one address, false otherwise
@@ -6539,7 +6582,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
6539
6582
  let totalWithoutDividingBy100 = 0;
6540
6583
 
6541
6584
  for (const item of items) {
6542
- totalWithoutDividingBy100 += parseFloat(item.price ? (item.price * item.quantity).toFixed(2) : item.amount.toFixed(2));
6585
+ totalWithoutDividingBy100 += parseFloat(item.price ? isCurrencyZeroDecimal(currency) ? item.price * item.quantity : (item.price * item.quantity).toFixed(2) : isCurrencyZeroDecimal(currency) ? item.amount : item.amount.toFixed(2));
6543
6586
  }
6544
6587
 
6545
6588
  return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
@@ -6551,7 +6594,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
6551
6594
  */
6552
6595
 
6553
6596
  const isValidViewFromURL = viewID => {
6554
- if (["login", "register", "plan-select", "gift-redeem", "password-forgot", "password-reset", "password-change", "payment-method-update", "user-edit", "newsletter", "address-create", "order-create", "cart", "email-verify", "invoice-details"].includes(viewID) || hasValidNewsletterUpdateUrl()) {
6597
+ if (["login", "register", "plan-select", "gift-redeem", "password-forgot", "password-reset", "password-change", "passwordless-login", "payment-method-update", "user-edit", "newsletter", "address-create", "order-create", "cart", "email-verify", "invoice-details"].includes(viewID) || hasValidNewsletterUpdateUrl()) {
6555
6598
  return true;
6556
6599
  }
6557
6600
 
@@ -6619,7 +6662,7 @@ const disableScroll = () => {
6619
6662
  }
6620
6663
  };
6621
6664
  const trackSubscriptionOnGA = () => {
6622
- var _ReactGA$set, _window$Pelcro$user$r5, _window$Pelcro$user$r6, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
6665
+ var _window$Pelcro$user$r5, _window$Pelcro$user$r6, _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
6623
6666
 
6624
6667
  const {
6625
6668
  product,
@@ -6640,13 +6683,14 @@ const trackSubscriptionOnGA = () => {
6640
6683
  return;
6641
6684
  }
6642
6685
 
6686
+ const currencyCode = (_window$Pelcro$user$r5 = (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.currency) !== null && _window$Pelcro$user$r5 !== void 0 ? _window$Pelcro$user$r5 : plan.currency;
6643
6687
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
6644
- currencyCode: (_window$Pelcro$user$r5 = (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.currency) !== null && _window$Pelcro$user$r5 !== void 0 ? _window$Pelcro$user$r5 : plan.currency
6688
+ currencyCode: currencyCode
6645
6689
  });
6646
6690
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$execu = _ReactGA$plugin.execute) === null || _ReactGA$plugin$execu === void 0 ? void 0 : _ReactGA$plugin$execu.call(_ReactGA$plugin, "ecommerce", "addTransaction", {
6647
6691
  id: lastSubscriptionId,
6648
6692
  affiliation: "Pelcro",
6649
- revenue: plan !== null && plan !== void 0 && plan.amount ? plan.amount / 100 : 0,
6693
+ revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
6650
6694
  coupon: couponCode
6651
6695
  });
6652
6696
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin2 = ReactGA.plugin) === null || _ReactGA$plugin2 === void 0 ? void 0 : (_ReactGA$plugin2$exec = _ReactGA$plugin2.execute) === null || _ReactGA$plugin2$exec === void 0 ? void 0 : _ReactGA$plugin2$exec.call(_ReactGA$plugin2, "ecommerce", "addItem", {
@@ -6654,7 +6698,7 @@ const trackSubscriptionOnGA = () => {
6654
6698
  name: product.name,
6655
6699
  category: product.description,
6656
6700
  variant: plan.nickname,
6657
- price: plan !== null && plan !== void 0 && plan.amount ? plan.amount / 100 : 0,
6701
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
6658
6702
  quantity: 1
6659
6703
  });
6660
6704
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin3 = ReactGA.plugin) === null || _ReactGA$plugin3 === void 0 ? void 0 : (_ReactGA$plugin3$exec = _ReactGA$plugin3.execute) === null || _ReactGA$plugin3$exec === void 0 ? void 0 : _ReactGA$plugin3$exec.call(_ReactGA$plugin3, "ecommerce", "send");
@@ -6766,6 +6810,7 @@ const resources = {
6766
6810
  checkoutForm: checkoutForm_en,
6767
6811
  messages: messages_en,
6768
6812
  login: login_en,
6813
+ verifyLinkToken: verifyLinkToken_en,
6769
6814
  register: register_en,
6770
6815
  userEdit: userEdit_en,
6771
6816
  address: address_en,
@@ -6790,6 +6835,7 @@ const resources = {
6790
6835
  checkoutForm: checkoutForm_fr,
6791
6836
  messages: messages_fr,
6792
6837
  login: login_fr,
6838
+ verifyLinkToken: verifyLinkToken_fr,
6793
6839
  register: register_fr,
6794
6840
  userEdit: userEdit_fr,
6795
6841
  address: address_fr,
@@ -8649,13 +8695,21 @@ const getErrorMessages = error => {
8649
8695
  return error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : (_error$response4$data = _error$response4.data) === null || _error$response4$data === void 0 ? void 0 : (_error$response4$data2 = _error$response4$data.error) === null || _error$response4$data2 === void 0 ? void 0 : _error$response4$data2.message;
8650
8696
  }
8651
8697
 
8652
- const errorMessages = []; // enumerable error (ex: validation errors)
8698
+ if (error !== null && error !== void 0 && (_error$response5 = error.response) !== null && _error$response5 !== void 0 && (_error$response5$data = _error$response5.data) !== null && _error$response5$data !== void 0 && _error$response5$data.errors) {
8699
+ var _error$response6, _error$response6$data;
8700
+
8701
+ const errorMessages = []; // enumerable error (ex: validation errors)
8653
8702
 
8654
- Object.values(error === null || error === void 0 ? void 0 : (_error$response5 = error.response) === null || _error$response5 === void 0 ? void 0 : (_error$response5$data = _error$response5.data) === null || _error$response5$data === void 0 ? void 0 : _error$response5$data.errors).forEach(([errorMessage]) => {
8655
- errorMessages.push(errorMessage);
8656
- }); // convert to multiline string
8703
+ Object.values(error === null || error === void 0 ? void 0 : (_error$response6 = error.response) === null || _error$response6 === void 0 ? void 0 : (_error$response6$data = _error$response6.data) === null || _error$response6$data === void 0 ? void 0 : _error$response6$data.errors).forEach(([errorMessage]) => {
8704
+ errorMessages.push(errorMessage);
8705
+ }); // convert to multiline string
8706
+
8707
+ return errorMessages.join("\n");
8708
+ }
8657
8709
 
8658
- return errorMessages.join("\n");
8710
+ if (error !== null && error !== void 0 && error.message) {
8711
+ return error.message;
8712
+ }
8659
8713
  };
8660
8714
  /**
8661
8715
  * Executes function after a wait time of inactivity
@@ -8687,7 +8741,7 @@ const debounce = (func, waitTime) => {
8687
8741
  function getSiteCardProcessor() {
8688
8742
  var _window$Pelcro$site$r;
8689
8743
 
8690
- if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_pay_page_id) {
8744
+ if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_gateway_settings) {
8691
8745
  return "vantiv";
8692
8746
  }
8693
8747
 
@@ -8783,7 +8837,7 @@ const loadPaymentSDKs = () => {
8783
8837
  } // Load Vantiv SDKs
8784
8838
 
8785
8839
 
8786
- const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_pay_page_id);
8840
+ const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
8787
8841
 
8788
8842
  if (supportsVantiv) {
8789
8843
  if (!window.jQuery) {
@@ -8791,7 +8845,10 @@ const loadPaymentSDKs = () => {
8791
8845
  }
8792
8846
 
8793
8847
  if (!window.EprotectIframeClient) {
8794
- window.Pelcro.helpers.loadSDK("https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js", "vantiv-eprotect-sdk");
8848
+ const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
8849
+ const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client4.min.js";
8850
+ const scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? PRODUCTION_URL : PRELIVE_URL;
8851
+ window.Pelcro.helpers.loadSDK(scriptUrlToUse, "vantiv-eprotect-sdk");
8795
8852
  }
8796
8853
  }
8797
8854
  };
@@ -8951,6 +9008,10 @@ const initViewFromURL = () => {
8951
9008
  return verifyEmailTokenFromUrl();
8952
9009
  }
8953
9010
 
9011
+ if (view === "passwordless-login") {
9012
+ return verifyLinkTokenFromUrl();
9013
+ }
9014
+
8954
9015
  if (view === "invoice-details") {
8955
9016
  return showInvoiceDetailsFromUrl();
8956
9017
  }
@@ -9131,6 +9192,18 @@ const verifyEmailTokenFromUrl = () => {
9131
9192
  });
9132
9193
  };
9133
9194
 
9195
+ const verifyLinkTokenFromUrl = () => {
9196
+ var _window$Pelcro$user$i, _window$Pelcro$user;
9197
+
9198
+ const isAlreadyLoggedIn = (_window$Pelcro$user$i = (_window$Pelcro$user = window.Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : _window$Pelcro$user.isAuthenticated()) !== null && _window$Pelcro$user$i !== void 0 ? _window$Pelcro$user$i : false;
9199
+ const loginToken = window.Pelcro.helpers.getURLParameter("token");
9200
+ if (isAlreadyLoggedIn || !loginToken) return;
9201
+ const {
9202
+ switchView
9203
+ } = usePelcro.getStore();
9204
+ return switchView("passwordless-login");
9205
+ };
9206
+
9134
9207
  const showInvoiceDetailsFromUrl = () => {
9135
9208
  const {
9136
9209
  isAuthenticated,
@@ -9506,8 +9579,9 @@ const LOAD_PAYMENT_METHODS = "LOAD_PAYMENT_METHODS";
9506
9579
  const GET_NEWSLETTERS_FETCH = "GET_NEWSLETTERS_FETCH";
9507
9580
  const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
9508
9581
  const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
9582
+ const LINK_TOKEN_VERIFY = "LINK_TOKEN_VERIFY";
9509
9583
 
9510
- const initialState$h = {
9584
+ const initialState$i = {
9511
9585
  email: "",
9512
9586
  password: "",
9513
9587
  emailError: null,
@@ -9518,10 +9592,10 @@ const initialState$h = {
9518
9592
  content: ""
9519
9593
  }
9520
9594
  };
9521
- const store$h = /*#__PURE__*/React.createContext(initialState$h);
9595
+ const store$i = /*#__PURE__*/React.createContext(initialState$i);
9522
9596
  const {
9523
- Provider: Provider$h
9524
- } = store$h;
9597
+ Provider: Provider$i
9598
+ } = store$i;
9525
9599
 
9526
9600
  const LoginContainer = ({
9527
9601
  style,
@@ -9628,7 +9702,7 @@ const LoginContainer = ({
9628
9702
  });
9629
9703
 
9630
9704
  case RESET_LOGIN_FORM:
9631
- return initialState$h;
9705
+ return initialState$i;
9632
9706
 
9633
9707
  case DISABLE_LOGIN_BUTTON:
9634
9708
  return lib_7({ ...state,
@@ -9646,12 +9720,12 @@ const LoginContainer = ({
9646
9720
  default:
9647
9721
  return state;
9648
9722
  }
9649
- }, initialState$h);
9723
+ }, initialState$i);
9650
9724
  return /*#__PURE__*/React__default['default'].createElement("div", {
9651
9725
  style: { ...style
9652
9726
  },
9653
9727
  className: `pelcro-container pelcro-login-container ${className}`
9654
- }, /*#__PURE__*/React__default['default'].createElement(Provider$h, {
9728
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$i, {
9655
9729
  value: {
9656
9730
  state,
9657
9731
  dispatch
@@ -9659,12 +9733,12 @@ const LoginContainer = ({
9659
9733
  }, children.length ? children.map((child, i) => {
9660
9734
  if (child) {
9661
9735
  return /*#__PURE__*/React__default['default'].cloneElement(child, {
9662
- store: store$h,
9736
+ store: store$i,
9663
9737
  key: i
9664
9738
  });
9665
9739
  }
9666
9740
  }) : /*#__PURE__*/React__default['default'].cloneElement(children, {
9667
- store: store$h
9741
+ store: store$i
9668
9742
  })));
9669
9743
  };
9670
9744
 
@@ -9834,6 +9908,9 @@ function ConfirmPassword({
9834
9908
  store,
9835
9909
  ...otherProps
9836
9910
  }) {
9911
+ const {
9912
+ t
9913
+ } = useTranslation("common");
9837
9914
  const {
9838
9915
  dispatch,
9839
9916
  state: {
@@ -9858,7 +9935,7 @@ function ConfirmPassword({
9858
9935
  } else if (finishedTyping) {
9859
9936
  dispatch({
9860
9937
  type: SET_CONFIRM_PASSWORD_ERROR,
9861
- payload: "Confirm password is required."
9938
+ payload: t("validation.confirmPassword")
9862
9939
  });
9863
9940
  }
9864
9941
  }, [dispatch, password, finishedTyping]);
@@ -9909,7 +9986,7 @@ const LoginButton = ({
9909
9986
  buttonDisabled
9910
9987
  },
9911
9988
  dispatch
9912
- } = React.useContext(store$h);
9989
+ } = React.useContext(store$i);
9913
9990
  const {
9914
9991
  t
9915
9992
  } = useTranslation("login");
@@ -9930,11 +10007,11 @@ const LoginButton = ({
9930
10007
  };
9931
10008
 
9932
10009
  const LoginEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
9933
- store: store$h
10010
+ store: store$i
9934
10011
  }, props));
9935
10012
 
9936
10013
  const LoginPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
9937
- store: store$h
10014
+ store: store$i
9938
10015
  }, props));
9939
10016
 
9940
10017
  var _path$r;
@@ -10011,7 +10088,7 @@ var facebookLoginRenderProps = createCommonjsModule(function (module, exports) {
10011
10088
  var FacebookLogin = unwrapExports(facebookLoginRenderProps);
10012
10089
  facebookLoginRenderProps.FacebookLogin;
10013
10090
 
10014
- const initialState$g = {
10091
+ const initialState$h = {
10015
10092
  email: "",
10016
10093
  password: "",
10017
10094
  emailError: null,
@@ -10028,10 +10105,10 @@ const initialState$g = {
10028
10105
  content: ""
10029
10106
  }
10030
10107
  };
10031
- const store$g = /*#__PURE__*/React.createContext(initialState$g);
10108
+ const store$h = /*#__PURE__*/React.createContext(initialState$h);
10032
10109
  const {
10033
- Provider: Provider$g
10034
- } = store$g;
10110
+ Provider: Provider$h
10111
+ } = store$h;
10035
10112
 
10036
10113
  const RegisterContainer = ({
10037
10114
  style,
@@ -10214,7 +10291,7 @@ const RegisterContainer = ({
10214
10291
  });
10215
10292
 
10216
10293
  case RESET_LOGIN_FORM:
10217
- return initialState$g;
10294
+ return initialState$h;
10218
10295
 
10219
10296
  case DISABLE_REGISTRATION_BUTTON:
10220
10297
  return lib_7({ ...state,
@@ -10232,12 +10309,12 @@ const RegisterContainer = ({
10232
10309
  default:
10233
10310
  return state;
10234
10311
  }
10235
- }, initialState$g);
10312
+ }, initialState$h);
10236
10313
  return /*#__PURE__*/React__default['default'].createElement("div", {
10237
10314
  style: { ...style
10238
10315
  },
10239
10316
  className: `pelcro-container pelcro-register-container ${className}`
10240
- }, /*#__PURE__*/React__default['default'].createElement(Provider$g, {
10317
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$h, {
10241
10318
  value: {
10242
10319
  state,
10243
10320
  dispatch
@@ -10245,12 +10322,12 @@ const RegisterContainer = ({
10245
10322
  }, children.length ? children.map((child, i) => {
10246
10323
  if (child) {
10247
10324
  return /*#__PURE__*/React__default['default'].cloneElement(child, {
10248
- store: store$g,
10325
+ store: store$h,
10249
10326
  key: i
10250
10327
  });
10251
10328
  }
10252
10329
  }) : /*#__PURE__*/React__default['default'].cloneElement(children, {
10253
- store: store$g
10330
+ store: store$h
10254
10331
  })));
10255
10332
  };
10256
10333
  /**
@@ -10290,10 +10367,10 @@ const FacebookLoginButton = ({
10290
10367
  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;
10291
10368
  const {
10292
10369
  dispatch: loginDispatch
10293
- } = React.useContext(store$h);
10370
+ } = React.useContext(store$i);
10294
10371
  const {
10295
10372
  dispatch: registerDispatch
10296
- } = React.useContext(store$g);
10373
+ } = React.useContext(store$h);
10297
10374
 
10298
10375
  const onSuccess = facebookUser => {
10299
10376
  loginDispatch === null || loginDispatch === void 0 ? void 0 : loginDispatch({
@@ -10380,10 +10457,10 @@ const GoogleLoginButton = ({
10380
10457
  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;
10381
10458
  const {
10382
10459
  dispatch: loginDispatch
10383
- } = React.useContext(store$h);
10460
+ } = React.useContext(store$i);
10384
10461
  const {
10385
10462
  dispatch: registerDispatch
10386
- } = React.useContext(store$g);
10463
+ } = React.useContext(store$h);
10387
10464
 
10388
10465
  const onSuccess = response => {
10389
10466
  var _response$getAuthResp, _profile$getEmail, _profile$getGivenName, _profile$getFamilyNam, _profile$getEmail2, _profile$getGivenName2, _profile$getFamilyNam2;
@@ -10479,10 +10556,10 @@ const Auth0LoginButton = ({
10479
10556
  }, [auth0Enabled, auth0Loaded]);
10480
10557
  const {
10481
10558
  dispatch: loginDispatch
10482
- } = React.useContext(store$h);
10559
+ } = React.useContext(store$i);
10483
10560
  const {
10484
10561
  dispatch: registerDispatch
10485
- } = React.useContext(store$g);
10562
+ } = React.useContext(store$h);
10486
10563
 
10487
10564
  function handleClick() {
10488
10565
  var _auth0InstanceRef$cur, _auth0InstanceRef$cur2, _auth0InstanceRef$cur3;
@@ -10770,11 +10847,11 @@ function LoginModal({
10770
10847
  LoginModal.viewId = "login";
10771
10848
 
10772
10849
  const RegisterEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
10773
- store: store$g
10850
+ store: store$h
10774
10851
  }, props));
10775
10852
 
10776
10853
  const RegisterPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
10777
- store: store$g
10854
+ store: store$h
10778
10855
  }, props));
10779
10856
 
10780
10857
  const RegisterButton = ({
@@ -10794,7 +10871,7 @@ const RegisterButton = ({
10794
10871
  buttonDisabled
10795
10872
  },
10796
10873
  dispatch
10797
- } = React.useContext(store$g);
10874
+ } = React.useContext(store$h);
10798
10875
  const {
10799
10876
  t
10800
10877
  } = useTranslation("register");
@@ -10932,7 +11009,7 @@ function FirstName({
10932
11009
  }
10933
11010
 
10934
11011
  const RegisterFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
10935
- store: store$g
11012
+ store: store$h
10936
11013
  }, props));
10937
11014
 
10938
11015
  function LastName({
@@ -10963,7 +11040,7 @@ function LastName({
10963
11040
  }
10964
11041
 
10965
11042
  const RegisterLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
10966
- store: store$g
11043
+ store: store$h
10967
11044
  }, props));
10968
11045
 
10969
11046
  /**
@@ -11087,7 +11164,7 @@ function TextInput({
11087
11164
 
11088
11165
  const RegisterTextInput = props => {
11089
11166
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
11090
- store: store$g
11167
+ store: store$h
11091
11168
  }));
11092
11169
  };
11093
11170
 
@@ -12743,20 +12820,21 @@ var es_12 = es.injectStripe;
12743
12820
  var es_13 = es.StripeProvider;
12744
12821
 
12745
12822
  /**
12746
- * @TODO: All subscription related business logic should end up moving
12823
+ * @TODO: All payment related business logic should end up moving
12747
12824
  * to this service, and out of react components.
12748
12825
  */
12749
12826
 
12750
12827
  /**
12751
- * Enum for subscription types
12828
+ * Enum for payment types
12752
12829
  * @readonly
12753
12830
  * @enum {string}
12754
12831
  */
12755
- const SUBSCRIPTION_TYPES = {
12832
+ const PAYMENT_TYPES = {
12756
12833
  CREATE_SUBSCRIPTION: "CREATE_SUBSCRIPTION",
12757
12834
  CREATE_GIFTED_SUBSCRIPTION: "CREATE_GIFTED_SUBSCRIPTION",
12758
12835
  RENEW_SUBSCRIPTION: "RENEW_SUBSCRIPTION",
12759
12836
  RENEW_GIFTED_SUBSCRIPTION: "RENEW_GIFTED_SUBSCRIPTION",
12837
+ PURCHASE_ECOMMERCE_ORDER: "PURCHASE_ECOMMERCE_ORDER",
12760
12838
  PAY_INVOICE: "PAY_INVOICE"
12761
12839
  };
12762
12840
 
@@ -12764,9 +12842,8 @@ var _isPaymentGatewayInvalid = /*#__PURE__*/new WeakMap();
12764
12842
 
12765
12843
  var _generateUserError = /*#__PURE__*/new WeakMap();
12766
12844
 
12767
- class Subscription {
12845
+ class Payment {
12768
12846
  /**
12769
- * Subscription service constructor
12770
12847
  * @param {(StripeGateway|PaypalGateway|VantivGateway)} paymentGateway
12771
12848
  */
12772
12849
  constructor(paymentGateway) {
@@ -12778,7 +12855,7 @@ class Subscription {
12778
12855
 
12779
12856
  if (!options.type) {
12780
12857
  callback(_classPrivateFieldGet(this, _generateUserError).call(this), null);
12781
- return console.error("No subscription type provided");
12858
+ return console.error("No payment type provided");
12782
12859
  } // delegate execution to paymentgateway
12783
12860
 
12784
12861
 
@@ -12796,21 +12873,21 @@ class Subscription {
12796
12873
  writable: true,
12797
12874
  value: () => {
12798
12875
  return {
12799
- error: new Error("An error has occured in the subscription service, please try again later")
12876
+ error: new Error("An error has occured in the payment service, please try again later")
12800
12877
  };
12801
12878
  }
12802
12879
  });
12803
12880
 
12804
12881
  if (_classPrivateFieldGet(this, _isPaymentGatewayInvalid).call(this, paymentGateway)) {
12805
12882
  this.paymentGateway = null;
12806
- console.error("Incompatible subscription gateway");
12883
+ console.error("Incompatible payment gateway");
12807
12884
  } else {
12808
12885
  this.paymentGateway = paymentGateway;
12809
12886
  }
12810
12887
  }
12811
12888
  /**
12812
- * @typedef subscriptionOptions
12813
- * @property {SUBSCRIPTION_TYPES} type
12889
+ * @typedef paymentOptions
12890
+ * @property {PAYMENT_TYPES} type
12814
12891
  * @property {string} token
12815
12892
  * @property {object} plan
12816
12893
  * @property {object} [product]
@@ -12821,6 +12898,7 @@ class Subscription {
12821
12898
  * @property {string} addressId
12822
12899
  * @property {number} invoiceId
12823
12900
  * @property {boolean} isExistingSource
12901
+ * @property {Array} items
12824
12902
  */
12825
12903
 
12826
12904
  /**
@@ -12831,8 +12909,8 @@ class Subscription {
12831
12909
  */
12832
12910
 
12833
12911
  /**
12834
- * Subscription execution method
12835
- * @param {subscriptionOptions} options subscription options
12912
+ * Payment execution method
12913
+ * @param {paymentOptions} options payment options
12836
12914
  * @param {executeCallback} callback
12837
12915
  * @return {void}
12838
12916
  */
@@ -12845,7 +12923,7 @@ const PAYMENT_GATEWAYS_ENUM = {
12845
12923
  vantiv: "vantiv"
12846
12924
  };
12847
12925
  /**
12848
- * Subscription Strategies
12926
+ * Payment Strategies
12849
12927
  */
12850
12928
 
12851
12929
  /**
@@ -12862,6 +12940,8 @@ var _renewSubscription = /*#__PURE__*/new WeakMap();
12862
12940
 
12863
12941
  var _renewGiftedSubscription = /*#__PURE__*/new WeakMap();
12864
12942
 
12943
+ var _purchaseEcommerceOrder = /*#__PURE__*/new WeakMap();
12944
+
12865
12945
  var _payInvoice = /*#__PURE__*/new WeakMap();
12866
12946
 
12867
12947
  class StripeGateway {
@@ -12872,7 +12952,7 @@ class StripeGateway {
12872
12952
  });
12873
12953
 
12874
12954
  _defineProperty$3(this, "execute", (options, callback) => {
12875
- const types = SUBSCRIPTION_TYPES;
12955
+ const types = PAYMENT_TYPES;
12876
12956
 
12877
12957
  switch (options.type) {
12878
12958
  case types.CREATE_SUBSCRIPTION:
@@ -12887,11 +12967,14 @@ class StripeGateway {
12887
12967
  case types.RENEW_GIFTED_SUBSCRIPTION:
12888
12968
  return _classPrivateFieldGet(this, _renewGiftedSubscription).call(this, options, callback);
12889
12969
 
12970
+ case types.PURCHASE_ECOMMERCE_ORDER:
12971
+ return _classPrivateFieldGet(this, _purchaseEcommerceOrder).call(this, options, callback);
12972
+
12890
12973
  case types.PAY_INVOICE:
12891
12974
  return _classPrivateFieldGet(this, _payInvoice).call(this, options, callback);
12892
12975
 
12893
12976
  default:
12894
- console.error("Unsupported subscriptiion method: Stripe Gateway");
12977
+ console.error("Unsupported payment method: Stripe Gateway");
12895
12978
  }
12896
12979
  });
12897
12980
 
@@ -12913,6 +12996,7 @@ class StripeGateway {
12913
12996
  auth_token: window.Pelcro.user.read().auth_token,
12914
12997
  plan_id: plan.id,
12915
12998
  coupon_code: couponCode,
12999
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
12916
13000
  address_id: product.address_required ? addressId : null
12917
13001
  }, (err, res) => {
12918
13002
  callback(err, res);
@@ -12939,6 +13023,7 @@ class StripeGateway {
12939
13023
  auth_token: window.Pelcro.user.read().auth_token,
12940
13024
  plan_id: plan.id,
12941
13025
  coupon_code: couponCode,
13026
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
12942
13027
  gift_recipient_email: giftRecipient.email,
12943
13028
  gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
12944
13029
  gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
@@ -12966,6 +13051,7 @@ class StripeGateway {
12966
13051
  stripe_token: token,
12967
13052
  auth_token: window.Pelcro.user.read().auth_token,
12968
13053
  plan_id: plan.id,
13054
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
12969
13055
  coupon_code: couponCode,
12970
13056
  subscription_id: subscriptionIdToRenew,
12971
13057
  address_id: product.address_required ? addressId : null
@@ -12999,6 +13085,36 @@ class StripeGateway {
12999
13085
  }
13000
13086
  });
13001
13087
 
13088
+ _purchaseEcommerceOrder.set(this, {
13089
+ writable: true,
13090
+ value: (options, callback) => {
13091
+ const {
13092
+ token,
13093
+ items,
13094
+ couponCode,
13095
+ addressId,
13096
+ isExistingSource
13097
+ } = options;
13098
+ const params = isExistingSource ? {
13099
+ source_id: token
13100
+ } : {
13101
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway),
13102
+ gateway_token: token
13103
+ };
13104
+ window.Pelcro.ecommerce.order.create({
13105
+ items,
13106
+ coupon_code: couponCode,
13107
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13108
+ ...params,
13109
+ ...(addressId && {
13110
+ address_id: addressId
13111
+ })
13112
+ }, (err, res) => {
13113
+ callback(err, res);
13114
+ });
13115
+ }
13116
+ });
13117
+
13002
13118
  _payInvoice.set(this, {
13003
13119
  writable: true,
13004
13120
  value: (options, callback) => {
@@ -13042,7 +13158,7 @@ class PaypalGateway {
13042
13158
  });
13043
13159
 
13044
13160
  _defineProperty$3(this, "execute", (options, callback) => {
13045
- const types = SUBSCRIPTION_TYPES;
13161
+ const types = PAYMENT_TYPES;
13046
13162
 
13047
13163
  switch (options.type) {
13048
13164
  case types.CREATE_SUBSCRIPTION:
@@ -13076,6 +13192,7 @@ class PaypalGateway {
13076
13192
  payment_gateway: _classPrivateFieldGet(this, _paymentGateway2),
13077
13193
  auth_token: window.Pelcro.user.read().auth_token,
13078
13194
  plan_id: plan.id,
13195
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13079
13196
  coupon_code: couponCode,
13080
13197
  address_id: product.address_required ? addressId : null
13081
13198
  }, (err, res) => {
@@ -13103,6 +13220,7 @@ class PaypalGateway {
13103
13220
  auth_token: window.Pelcro.user.read().auth_token,
13104
13221
  plan_id: plan.id,
13105
13222
  coupon_code: couponCode,
13223
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13106
13224
  gift_recipient_email: giftRecipient.email,
13107
13225
  gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
13108
13226
  gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
@@ -13139,6 +13257,16 @@ var _paymentGateway3 = /*#__PURE__*/new WeakMap();
13139
13257
 
13140
13258
  var _createSubscription3 = /*#__PURE__*/new WeakMap();
13141
13259
 
13260
+ var _renewSubscription2 = /*#__PURE__*/new WeakMap();
13261
+
13262
+ var _createGiftedSubscription3 = /*#__PURE__*/new WeakMap();
13263
+
13264
+ var _renewGiftedSubscription2 = /*#__PURE__*/new WeakMap();
13265
+
13266
+ var _purchaseEcommerceOrder2 = /*#__PURE__*/new WeakMap();
13267
+
13268
+ var _payInvoice3 = /*#__PURE__*/new WeakMap();
13269
+
13142
13270
  class VantivGateway {
13143
13271
  constructor() {
13144
13272
  _paymentGateway3.set(this, {
@@ -13147,14 +13275,29 @@ class VantivGateway {
13147
13275
  });
13148
13276
 
13149
13277
  _defineProperty$3(this, "execute", (options, callback) => {
13150
- const types = SUBSCRIPTION_TYPES;
13278
+ const types = PAYMENT_TYPES;
13151
13279
 
13152
13280
  switch (options.type) {
13153
13281
  case types.CREATE_SUBSCRIPTION:
13154
13282
  return _classPrivateFieldGet(this, _createSubscription3).call(this, options, callback);
13155
13283
 
13284
+ case types.RENEW_SUBSCRIPTION:
13285
+ return _classPrivateFieldGet(this, _renewSubscription2).call(this, options, callback);
13286
+
13287
+ case types.CREATE_GIFTED_SUBSCRIPTION:
13288
+ return _classPrivateFieldGet(this, _createGiftedSubscription3).call(this, options, callback);
13289
+
13290
+ case types.RENEW_GIFTED_SUBSCRIPTION:
13291
+ return _classPrivateFieldGet(this, _renewGiftedSubscription2).call(this, options, callback);
13292
+
13293
+ case types.PURCHASE_ECOMMERCE_ORDER:
13294
+ return _classPrivateFieldGet(this, _purchaseEcommerceOrder2).call(this, options, callback);
13295
+
13296
+ case types.PAY_INVOICE:
13297
+ return _classPrivateFieldGet(this, _payInvoice3).call(this, options, callback);
13298
+
13156
13299
  default:
13157
- console.error("Unsupported subscriptiion method: vantiv Gateway");
13300
+ console.error("Unsupported payment method: vantiv Gateway");
13158
13301
  }
13159
13302
  });
13160
13303
 
@@ -13167,46 +13310,205 @@ class VantivGateway {
13167
13310
  couponCode,
13168
13311
  product,
13169
13312
  quantity = 1,
13170
- addressId
13313
+ addressId,
13314
+ isExistingSource
13171
13315
  } = options;
13316
+ const params = isExistingSource ? {
13317
+ source_id: token
13318
+ } : {
13319
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13320
+ gateway_token: token
13321
+ };
13172
13322
  window.Pelcro.subscription.create({
13173
13323
  quantity,
13174
- gateway_token: token,
13175
- payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13176
13324
  auth_token: window.Pelcro.user.read().auth_token,
13177
13325
  plan_id: plan.id,
13326
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13178
13327
  coupon_code: couponCode,
13179
- address_id: product.address_required ? addressId : null
13328
+ address_id: product.address_required ? addressId : null,
13329
+ ...params
13180
13330
  }, (err, res) => {
13181
13331
  callback(err, res);
13182
13332
  });
13183
13333
  }
13184
13334
  });
13185
- }
13186
13335
 
13187
- }
13336
+ _renewSubscription2.set(this, {
13337
+ writable: true,
13338
+ value: (options, callback) => {
13339
+ const {
13340
+ subscriptionIdToRenew,
13341
+ token,
13342
+ plan,
13343
+ couponCode,
13344
+ product,
13345
+ addressId,
13346
+ isExistingSource
13347
+ } = options;
13348
+ const params = isExistingSource ? {
13349
+ source_id: token
13350
+ } : {
13351
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13352
+ gateway_token: token
13353
+ };
13354
+ window.Pelcro.subscription.renew({
13355
+ auth_token: window.Pelcro.user.read().auth_token,
13356
+ plan_id: plan.id,
13357
+ coupon_code: couponCode,
13358
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13359
+ subscription_id: subscriptionIdToRenew,
13360
+ address_id: product.address_required ? addressId : null,
13361
+ ...params
13362
+ }, (err, res) => {
13363
+ callback(err, res);
13364
+ });
13365
+ }
13366
+ });
13188
13367
 
13189
- /**
13190
- * @typedef {Object} PaymentStateType
13191
- * @property {boolean} disableSubmit
13192
- * @property {boolean} isLoading
13193
- * @property {boolean} disableCouponButton
13194
- * @property {object} couponObject
13195
- * @property {string} couponCode
13196
- * @property {string} couponError
13197
- * @property {boolean} enableCouponField
13198
- * @property {string} percentOff
13199
- * @property {unknown} canMakePayment
13200
- * @property {unknown} paymentRequest
13201
- * @property {number} updatedPrice
13202
- * @property {number} taxAmount
13203
- * @property {object} currentPlan
13204
- * @property {object} alert
13205
- */
13368
+ _createGiftedSubscription3.set(this, {
13369
+ writable: true,
13370
+ value: (options, callback) => {
13371
+ const {
13372
+ token,
13373
+ plan,
13374
+ couponCode,
13375
+ product,
13376
+ giftRecipient,
13377
+ quantity = 1,
13378
+ addressId,
13379
+ isExistingSource
13380
+ } = options;
13381
+ const params = isExistingSource ? {
13382
+ source_id: token
13383
+ } : {
13384
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13385
+ gateway_token: token
13386
+ };
13387
+ window.Pelcro.subscription.create({
13388
+ quantity,
13389
+ auth_token: window.Pelcro.user.read().auth_token,
13390
+ plan_id: plan.id,
13391
+ coupon_code: couponCode,
13392
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13393
+ gift_recipient_email: giftRecipient.email,
13394
+ gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
13395
+ gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
13396
+ gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
13397
+ gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
13398
+ address_id: product.address_required ? addressId : null,
13399
+ ...params
13400
+ }, (err, res) => {
13401
+ callback(err, res);
13402
+ });
13403
+ }
13404
+ });
13206
13405
 
13207
- /** @type {PaymentStateType} */
13406
+ _renewGiftedSubscription2.set(this, {
13407
+ writable: true,
13408
+ value: (options, callback) => {
13409
+ const {
13410
+ subscriptionIdToRenew,
13411
+ token,
13412
+ product,
13413
+ plan,
13414
+ couponCode,
13415
+ addressId,
13416
+ isExistingSource
13417
+ } = options;
13418
+ const params = isExistingSource ? {
13419
+ source_id: token
13420
+ } : {
13421
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13422
+ gateway_token: token
13423
+ };
13424
+ window.Pelcro.subscription.renewGift({
13425
+ auth_token: window.Pelcro.user.read().auth_token,
13426
+ plan_id: plan.id,
13427
+ coupon_code: couponCode,
13428
+ subscription_id: subscriptionIdToRenew,
13429
+ address_id: product.address_required ? addressId : null,
13430
+ ...params
13431
+ }, (err, res) => {
13432
+ callback(err, res);
13433
+ });
13434
+ }
13435
+ });
13208
13436
 
13209
- const initialState$f = {
13437
+ _purchaseEcommerceOrder2.set(this, {
13438
+ writable: true,
13439
+ value: (options, callback) => {
13440
+ const {
13441
+ token,
13442
+ items,
13443
+ couponCode,
13444
+ addressId,
13445
+ isExistingSource
13446
+ } = options;
13447
+ const params = isExistingSource ? {
13448
+ source_id: token
13449
+ } : {
13450
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13451
+ gateway_token: token
13452
+ };
13453
+ window.Pelcro.ecommerce.order.create({
13454
+ items,
13455
+ coupon_code: couponCode,
13456
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13457
+ ...params,
13458
+ ...(addressId && {
13459
+ address_id: addressId
13460
+ })
13461
+ }, (err, res) => {
13462
+ callback(err, res);
13463
+ });
13464
+ }
13465
+ });
13466
+
13467
+ _payInvoice3.set(this, {
13468
+ writable: true,
13469
+ value: (options, callback) => {
13470
+ const {
13471
+ token,
13472
+ invoiceId
13473
+ } = options;
13474
+ const params = options.isExistingSource ? {
13475
+ source_id: token,
13476
+ invoice_id: invoiceId
13477
+ } : {
13478
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13479
+ gateway_token: token,
13480
+ invoice_id: invoiceId
13481
+ };
13482
+ window.Pelcro.invoice.pay(params, (err, res) => {
13483
+ callback(err, res);
13484
+ });
13485
+ }
13486
+ });
13487
+ }
13488
+
13489
+ }
13490
+
13491
+ /**
13492
+ * @typedef {Object} PaymentStateType
13493
+ * @property {boolean} disableSubmit
13494
+ * @property {boolean} isLoading
13495
+ * @property {boolean} disableCouponButton
13496
+ * @property {object} couponObject
13497
+ * @property {string} couponCode
13498
+ * @property {string} couponError
13499
+ * @property {boolean} enableCouponField
13500
+ * @property {string} percentOff
13501
+ * @property {unknown} canMakePayment
13502
+ * @property {unknown} paymentRequest
13503
+ * @property {number} updatedPrice
13504
+ * @property {number} taxAmount
13505
+ * @property {object} currentPlan
13506
+ * @property {object} alert
13507
+ */
13508
+
13509
+ /** @type {PaymentStateType} */
13510
+
13511
+ const initialState$g = {
13210
13512
  disableSubmit: false,
13211
13513
  isLoading: false,
13212
13514
  disableCouponButton: false,
@@ -13225,10 +13527,10 @@ const initialState$f = {
13225
13527
  content: ""
13226
13528
  }
13227
13529
  };
13228
- const store$f = /*#__PURE__*/React.createContext(initialState$f);
13530
+ const store$g = /*#__PURE__*/React.createContext(initialState$g);
13229
13531
  const {
13230
- Provider: Provider$f
13231
- } = store$f;
13532
+ Provider: Provider$g
13533
+ } = store$g;
13232
13534
 
13233
13535
  const PaymentMethodContainerWithoutStripe = ({
13234
13536
  style,
@@ -13241,7 +13543,7 @@ const PaymentMethodContainerWithoutStripe = ({
13241
13543
  onFailure = () => {},
13242
13544
  ...props
13243
13545
  }) => {
13244
- var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isRenewingGift, _props$invoice;
13546
+ var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice;
13245
13547
 
13246
13548
  const {
13247
13549
  t
@@ -13257,6 +13559,7 @@ const PaymentMethodContainerWithoutStripe = ({
13257
13559
  const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
13258
13560
  const selectedAddressId = (_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : pelcroStore.selectedAddressId;
13259
13561
  const giftRecipient = (_props$giftRecipient = props.giftRecipient) !== null && _props$giftRecipient !== void 0 ? _props$giftRecipient : pelcroStore.giftRecipient;
13562
+ const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
13260
13563
  const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
13261
13564
  const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
13262
13565
  React.useEffect(() => {
@@ -13273,60 +13576,185 @@ const PaymentMethodContainerWithoutStripe = ({
13273
13576
  updateTotalAmountWithTax();
13274
13577
  }, []);
13275
13578
 
13276
- function submitVantivPayment() {
13579
+ const submitUsingVantiv = () => {
13580
+ const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
13581
+
13582
+ if (isUsingExistingPaymentMethod) {
13583
+ // no need to create a new source using vantiv
13584
+ return handleVantivPayment(null);
13585
+ }
13586
+
13277
13587
  if (!vantivInstanceRef.current) {
13278
13588
  return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
13279
13589
  }
13280
13590
 
13281
- const orderId = `pelcro-${new Date().getTime()}`; // calls handleVantivPayment
13591
+ const orderId = `pelcro-${new Date().getTime()}`;
13592
+ /*
13593
+ calls handleVantivPayment to either handle a payment or update a source by simply creating a new source
13594
+ */
13282
13595
 
13283
13596
  vantivInstanceRef.current.getPaypageRegistrationId({
13284
13597
  id: orderId,
13285
13598
  orderId: orderId
13286
13599
  });
13287
- }
13600
+ };
13288
13601
 
13289
13602
  function handleVantivPayment(paymentRequest) {
13290
- const SUCCESS_STATUS = "870";
13603
+ if (paymentRequest) {
13604
+ const SUCCESS_STATUS = "870";
13605
+
13606
+ if (paymentRequest.response !== SUCCESS_STATUS) {
13607
+ return handlePaymentError({
13608
+ error: new Error(paymentRequest.message)
13609
+ });
13610
+ }
13611
+ }
13612
+
13613
+ const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
13614
+
13615
+ if (type === "createPayment") {
13616
+ handleVantivSubscription();
13617
+ } else if (type === "orderCreate") {
13618
+ purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
13619
+ } else if (type === "invoicePayment") {
13620
+ payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
13621
+ } else if (type === "updatePaymentSource") {
13622
+ createNewVantivCard();
13623
+ }
13624
+
13625
+ function createNewVantivCard() {
13626
+ window.Pelcro.source.create({
13627
+ auth_token: window.Pelcro.user.read().auth_token,
13628
+ token: paymentRequest,
13629
+ gateway: "vantiv"
13630
+ }, (err, res) => {
13631
+ dispatch({
13632
+ type: DISABLE_SUBMIT,
13633
+ payload: false
13634
+ });
13635
+ dispatch({
13636
+ type: LOADING,
13637
+ payload: false
13638
+ });
13639
+
13640
+ if (err) {
13641
+ onFailure(err);
13642
+ return dispatch({
13643
+ type: SHOW_ALERT,
13644
+ payload: {
13645
+ type: "error",
13646
+ content: getErrorMessages(err)
13647
+ }
13648
+ });
13649
+ }
13291
13650
 
13292
- if (paymentRequest.response !== SUCCESS_STATUS) {
13293
- return handlePaymentError({
13294
- error: new Error(paymentRequest.message)
13651
+ dispatch({
13652
+ type: SHOW_ALERT,
13653
+ payload: {
13654
+ type: "success",
13655
+ content: t("messages.sourceUpdated")
13656
+ }
13657
+ });
13658
+ onSuccess(res);
13295
13659
  });
13296
13660
  }
13297
13661
 
13298
- const subscription = new Subscription(new VantivGateway());
13299
- const {
13300
- couponCode
13301
- } = state;
13302
- return subscription.execute({
13303
- type: SUBSCRIPTION_TYPES.CREATE_SUBSCRIPTION,
13304
- token: paymentRequest,
13305
- quantity: plan.quantity,
13306
- plan,
13307
- couponCode,
13308
- product,
13309
- addressId: selectedAddressId
13310
- }, (err, res) => {
13311
- if (err) {
13312
- return handlePaymentError(err);
13313
- }
13662
+ function handleVantivSubscription() {
13663
+ const payment = new Payment(new VantivGateway());
13664
+ const createSubscription = !isGift && !subscriptionIdToRenew;
13665
+ const renewSubscription = !isGift && subscriptionIdToRenew;
13666
+ const giftSubscriprition = isGift && !subscriptionIdToRenew;
13667
+ const renewGift = isRenewingGift;
13668
+ const {
13669
+ couponCode
13670
+ } = state;
13314
13671
 
13315
- onSuccess(res);
13316
- });
13672
+ if (renewGift) {
13673
+ return payment.execute({
13674
+ type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
13675
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13676
+ plan,
13677
+ couponCode,
13678
+ product,
13679
+ isExistingSource: isUsingExistingPaymentMethod,
13680
+ subscriptionIdToRenew,
13681
+ addressId: selectedAddressId
13682
+ }, (err, res) => {
13683
+ if (err) {
13684
+ return handlePaymentError(err);
13685
+ }
13686
+
13687
+ onSuccess(res);
13688
+ });
13689
+ } else if (giftSubscriprition) {
13690
+ return payment.execute({
13691
+ type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
13692
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13693
+ quantity: plan.quantity,
13694
+ plan,
13695
+ couponCode,
13696
+ product,
13697
+ isExistingSource: isUsingExistingPaymentMethod,
13698
+ giftRecipient,
13699
+ addressId: selectedAddressId
13700
+ }, (err, res) => {
13701
+ if (err) {
13702
+ return handlePaymentError(err);
13703
+ }
13704
+
13705
+ onSuccess(res);
13706
+ });
13707
+ } else if (renewSubscription) {
13708
+ return payment.execute({
13709
+ type: PAYMENT_TYPES.RENEW_SUBSCRIPTION,
13710
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13711
+ quantity: plan.quantity,
13712
+ plan,
13713
+ couponCode,
13714
+ product,
13715
+ isExistingSource: isUsingExistingPaymentMethod,
13716
+ subscriptionIdToRenew,
13717
+ addressId: selectedAddressId
13718
+ }, (err, res) => {
13719
+ if (err) {
13720
+ return handlePaymentError(err);
13721
+ }
13722
+
13723
+ onSuccess(res);
13724
+ });
13725
+ } else if (createSubscription) {
13726
+ return payment.execute({
13727
+ type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
13728
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13729
+ quantity: plan.quantity,
13730
+ plan,
13731
+ couponCode,
13732
+ product,
13733
+ isExistingSource: isUsingExistingPaymentMethod,
13734
+ addressId: selectedAddressId
13735
+ }, (err, res) => {
13736
+ if (err) {
13737
+ return handlePaymentError(err);
13738
+ }
13739
+
13740
+ onSuccess(res);
13741
+ });
13742
+ }
13743
+ }
13317
13744
  }
13318
13745
 
13319
13746
  const vantivInstanceRef = React__default['default'].useRef(null);
13320
13747
  React.useEffect(() => {
13321
13748
  const cardProcessor = getSiteCardProcessor();
13322
13749
 
13323
- if (cardProcessor === "vantiv") {
13324
- var _window$Pelcro$site$r;
13750
+ if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
13751
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
13325
13752
 
13326
- 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;
13753
+ const payPageId = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings.pay_page_id;
13754
+ const reportGroup = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.report_group;
13327
13755
  vantivInstanceRef.current = new window.EprotectIframeClient({
13328
13756
  paypageId: payPageId,
13329
- reportGroup: payPageId,
13757
+ reportGroup: reportGroup,
13330
13758
  style: "pelcro",
13331
13759
  height: "245",
13332
13760
  timeout: 50000,
@@ -13343,7 +13771,7 @@ const PaymentMethodContainerWithoutStripe = ({
13343
13771
  }
13344
13772
  });
13345
13773
  }
13346
- }, []);
13774
+ }, [selectedPaymentMethodId]);
13347
13775
 
13348
13776
  const initPaymentRequest = (state, dispatch) => {
13349
13777
  try {
@@ -13415,9 +13843,9 @@ const PaymentMethodContainerWithoutStripe = ({
13415
13843
 
13416
13844
 
13417
13845
  const updateTotalAmountWithTax = () => {
13418
- var _window$Pelcro$site$r2;
13846
+ var _window$Pelcro$site$r3;
13419
13847
 
13420
- const taxesEnabled = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.taxes_enabled;
13848
+ const taxesEnabled = (_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.taxes_enabled;
13421
13849
 
13422
13850
  if (taxesEnabled && type === "createPayment") {
13423
13851
  dispatch({
@@ -13574,6 +14002,7 @@ const PaymentMethodContainerWithoutStripe = ({
13574
14002
  window.Pelcro.order.create({
13575
14003
  auth_token: window.Pelcro.user.read().auth_token,
13576
14004
  plan_id: plan.id,
14005
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13577
14006
  coupon_code: couponCode,
13578
14007
  address_id: selectedAddressId
13579
14008
  }, handleCouponResponse);
@@ -13655,6 +14084,7 @@ const PaymentMethodContainerWithoutStripe = ({
13655
14084
  stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
13656
14085
  auth_token: window.Pelcro.user.read().auth_token,
13657
14086
  plan_id: plan.id,
14087
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13658
14088
  quantity: plan.quantity,
13659
14089
  coupon_code: couponCode,
13660
14090
  gift_recipient_email: giftRecipient ? giftRecipient.email : null,
@@ -13726,6 +14156,7 @@ const PaymentMethodContainerWithoutStripe = ({
13726
14156
  stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
13727
14157
  auth_token: window.Pelcro.user.read().auth_token,
13728
14158
  plan_id: plan.id,
14159
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13729
14160
  coupon_code: couponCode,
13730
14161
  subscription_id: subscriptionIdToRenew,
13731
14162
  address_id: product.address_required ? selectedAddressId : null
@@ -13767,7 +14198,7 @@ const PaymentMethodContainerWithoutStripe = ({
13767
14198
 
13768
14199
 
13769
14200
  const handlePaypalSubscription = (state, paypalNonce) => {
13770
- const subscription = new Subscription(new PaypalGateway());
14201
+ const payment = new Payment(new PaypalGateway());
13771
14202
  const {
13772
14203
  couponCode
13773
14204
  } = state;
@@ -13776,8 +14207,8 @@ const PaymentMethodContainerWithoutStripe = ({
13776
14207
  */
13777
14208
 
13778
14209
  if (giftRecipient) {
13779
- return subscription.execute({
13780
- type: SUBSCRIPTION_TYPES.CREATE_GIFTED_SUBSCRIPTION,
14210
+ return payment.execute({
14211
+ type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
13781
14212
  token: paypalNonce,
13782
14213
  quantity: plan.quantity,
13783
14214
  plan,
@@ -13810,8 +14241,8 @@ const PaymentMethodContainerWithoutStripe = ({
13810
14241
  });
13811
14242
  }
13812
14243
 
13813
- return subscription.execute({
13814
- type: SUBSCRIPTION_TYPES.CREATE_SUBSCRIPTION,
14244
+ return payment.execute({
14245
+ type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
13815
14246
  token: paypalNonce,
13816
14247
  quantity: plan.quantity,
13817
14248
  plan,
@@ -13843,7 +14274,7 @@ const PaymentMethodContainerWithoutStripe = ({
13843
14274
  });
13844
14275
  };
13845
14276
 
13846
- const purchase = (stripeSource, state, dispatch) => {
14277
+ const purchase = (gatewayService, gatewayToken, state, dispatch) => {
13847
14278
  const isQuickPurchase = !Array.isArray(order);
13848
14279
  const mappedOrderItems = isQuickPurchase ? [{
13849
14280
  sku_id: order.id,
@@ -13855,14 +14286,14 @@ const PaymentMethodContainerWithoutStripe = ({
13855
14286
  const {
13856
14287
  couponCode
13857
14288
  } = state;
13858
- window.Pelcro.ecommerce.order.create({
13859
- source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
13860
- stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
14289
+ const payment = new Payment(gatewayService);
14290
+ payment.execute({
14291
+ type: PAYMENT_TYPES.PURCHASE_ECOMMERCE_ORDER,
14292
+ token: gatewayToken,
14293
+ isExistingSource: Boolean(selectedPaymentMethodId),
13861
14294
  items: mappedOrderItems,
13862
- coupon_code: couponCode,
13863
- ...(selectedAddressId && {
13864
- address_id: selectedAddressId
13865
- })
14295
+ addressId: selectedAddressId,
14296
+ couponCode
13866
14297
  }, (err, res) => {
13867
14298
  dispatch({
13868
14299
  type: DISABLE_SUBMIT,
@@ -13900,9 +14331,9 @@ const PaymentMethodContainerWithoutStripe = ({
13900
14331
  };
13901
14332
 
13902
14333
  const payInvoice = (gatewayService, gatewayToken, dispatch) => {
13903
- const subscription = new Subscription(gatewayService);
13904
- return subscription.execute({
13905
- type: SUBSCRIPTION_TYPES.PAY_INVOICE,
14334
+ const payment = new Payment(gatewayService);
14335
+ return payment.execute({
14336
+ type: PAYMENT_TYPES.PAY_INVOICE,
13906
14337
  token: gatewayToken,
13907
14338
  isExistingSource: Boolean(selectedPaymentMethodId),
13908
14339
  invoiceId: invoice.id
@@ -13947,7 +14378,9 @@ const PaymentMethodContainerWithoutStripe = ({
13947
14378
 
13948
14379
  if ((source === null || source === void 0 ? void 0 : (_source$card2 = source.card) === null || _source$card2 === void 0 ? void 0 : _source$card2.three_d_secure) === "required") {
13949
14380
  return handlePaymentError({
13950
- message: t("messages.cardAuthNotSupported")
14381
+ error: {
14382
+ message: t("messages.cardAuthNotSupported")
14383
+ }
13951
14384
  });
13952
14385
  }
13953
14386
 
@@ -14062,13 +14495,13 @@ const PaymentMethodContainerWithoutStripe = ({
14062
14495
 
14063
14496
 
14064
14497
  const resolveTaxCalculation = () => {
14065
- var _window$Pelcro$site$r3;
14498
+ var _window$Pelcro$site$r4;
14066
14499
 
14067
14500
  if (type === "invoicePayment") {
14068
14501
  return new Promise(resolve => resolve());
14069
14502
  }
14070
14503
 
14071
- const taxesEnabled = (_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.taxes_enabled;
14504
+ const taxesEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.taxes_enabled;
14072
14505
  return new Promise((resolve, reject) => {
14073
14506
  // resolve early if taxes isn't enabled
14074
14507
  if (!taxesEnabled) {
@@ -14078,6 +14511,7 @@ const PaymentMethodContainerWithoutStripe = ({
14078
14511
  window.Pelcro.order.create({
14079
14512
  auth_token: window.Pelcro.user.read().auth_token,
14080
14513
  plan_id: plan.id,
14514
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
14081
14515
  coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
14082
14516
  address_id: selectedAddressId
14083
14517
  }, (error, res) => {
@@ -14140,7 +14574,7 @@ const PaymentMethodContainerWithoutStripe = ({
14140
14574
  if (stripeSource && type === "createPayment") {
14141
14575
  subscribe(stripeSource, state, dispatch);
14142
14576
  } else if (stripeSource && type === "orderCreate") {
14143
- purchase(stripeSource, state, dispatch);
14577
+ purchase(new StripeGateway(), stripeSource.id, state, dispatch);
14144
14578
  } else if (stripeSource && type === "invoicePayment") {
14145
14579
  payInvoice(new StripeGateway(), stripeSource.id, dispatch);
14146
14580
  }
@@ -14191,7 +14625,9 @@ const PaymentMethodContainerWithoutStripe = ({
14191
14625
 
14192
14626
  if ((source === null || source === void 0 ? void 0 : source.status) === "failed") {
14193
14627
  return handlePaymentError({
14194
- message: t("messages.cardAuthFailed")
14628
+ error: {
14629
+ message: t("messages.cardAuthFailed")
14630
+ }
14195
14631
  });
14196
14632
  }
14197
14633
 
@@ -14262,6 +14698,10 @@ const PaymentMethodContainerWithoutStripe = ({
14262
14698
  disableSubmit: true,
14263
14699
  isLoading: true
14264
14700
  }, (state, dispatch) => {
14701
+ if (getSiteCardProcessor() === "vantiv") {
14702
+ return submitUsingVantiv();
14703
+ }
14704
+
14265
14705
  if (selectedPaymentMethodId) {
14266
14706
  // pay with selected method (source) if exists already
14267
14707
  return handlePayment({
@@ -14274,10 +14714,6 @@ const PaymentMethodContainerWithoutStripe = ({
14274
14714
  return updatePaymentSource(state, dispatch);
14275
14715
  }
14276
14716
 
14277
- if (getSiteCardProcessor() === "vantiv") {
14278
- return submitVantivPayment();
14279
- }
14280
-
14281
14717
  submitPayment(state);
14282
14718
  });
14283
14719
 
@@ -14346,21 +14782,21 @@ const PaymentMethodContainerWithoutStripe = ({
14346
14782
  default:
14347
14783
  return state;
14348
14784
  }
14349
- }, initialState$f);
14785
+ }, initialState$g);
14350
14786
  return /*#__PURE__*/React__default['default'].createElement("div", {
14351
14787
  style: { ...style
14352
14788
  },
14353
14789
  className: `pelcro-container pelcro-payment-container ${className}`
14354
- }, /*#__PURE__*/React__default['default'].createElement(Provider$f, {
14790
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$g, {
14355
14791
  value: {
14356
14792
  state,
14357
14793
  dispatch
14358
14794
  }
14359
14795
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
14360
- store: store$f,
14796
+ store: store$g,
14361
14797
  key: i
14362
14798
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
14363
- store: store$f
14799
+ store: store$g
14364
14800
  })));
14365
14801
  };
14366
14802
 
@@ -14382,7 +14818,7 @@ const PaymentMethodContainer = props => {
14382
14818
  stripeAccount: window.Pelcro.site.read().account_id,
14383
14819
  locale: getPageOrDefaultLanguage()
14384
14820
  }, /*#__PURE__*/React__default['default'].createElement(es_11, null, /*#__PURE__*/React__default['default'].createElement(UnwrappedForm, Object.assign({
14385
- store: store$f
14821
+ store: store$g
14386
14822
  }, props))));
14387
14823
  }
14388
14824
 
@@ -14435,7 +14871,7 @@ const PelcroPaymentRequestButton = props => {
14435
14871
  currentPlan,
14436
14872
  updatedPrice
14437
14873
  }
14438
- } = React.useContext(store$f);
14874
+ } = React.useContext(store$g);
14439
14875
 
14440
14876
  const updatePaymentRequest = () => {
14441
14877
  // Make sure payment request is up to date, eg. user added a coupon code.
@@ -14511,7 +14947,7 @@ const DiscountedPrice = props => {
14511
14947
  taxAmount,
14512
14948
  percentOff
14513
14949
  }
14514
- } = React.useContext(store$f);
14950
+ } = React.useContext(store$g);
14515
14951
  const {
14516
14952
  order,
14517
14953
  plan
@@ -14561,7 +14997,7 @@ const SubmitPaymentMethod = ({
14561
14997
  isLoading,
14562
14998
  updatedPrice
14563
14999
  }
14564
- } = React.useContext(store$f);
15000
+ } = React.useContext(store$g);
14565
15001
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
14566
15002
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
14567
15003
  const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
@@ -14611,7 +15047,7 @@ const ApplyCouponButton = ({
14611
15047
  disableCouponButton
14612
15048
  },
14613
15049
  dispatch
14614
- } = React.useContext(store$f);
15050
+ } = React.useContext(store$g);
14615
15051
  const {
14616
15052
  t
14617
15053
  } = useTranslation("checkoutForm");
@@ -14645,7 +15081,7 @@ const CouponCodeField = props => {
14645
15081
  couponCode,
14646
15082
  couponError
14647
15083
  }
14648
- } = React.useContext(store$f);
15084
+ } = React.useContext(store$g);
14649
15085
 
14650
15086
  const onCouponCodeChange = e => {
14651
15087
  dispatch({
@@ -14701,7 +15137,7 @@ const CouponCode = ({
14701
15137
  state: {
14702
15138
  enableCouponField
14703
15139
  }
14704
- } = React.useContext(store$f);
15140
+ } = React.useContext(store$g);
14705
15141
  const {
14706
15142
  t
14707
15143
  } = useTranslation("checkoutForm");
@@ -14958,7 +15394,7 @@ const PaypalSubscribeButton = props => {
14958
15394
  const {
14959
15395
  dispatch,
14960
15396
  state
14961
- } = React.useContext(store$f);
15397
+ } = React.useContext(store$g);
14962
15398
  const {
14963
15399
  product,
14964
15400
  plan,
@@ -14973,7 +15409,7 @@ const PaypalSubscribeButton = props => {
14973
15409
  const selectedAddress = getAddressById((_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : selectedAddressId); // initialize paypal client, then render paypal button.
14974
15410
 
14975
15411
  const initializePaypal = async () => {
14976
- var _props$buttonElementI, _props$product$addres, _props$product, _props$plan2;
15412
+ var _props$buttonElementI, _props$product$addres, _props$product;
14977
15413
 
14978
15414
  const paypalCheckoutInstance = new PaypalClient({
14979
15415
  buttonElementID: (_props$buttonElementI = props.buttonElementID) !== null && _props$buttonElementI !== void 0 ? _props$buttonElementI : "pelcro-paypal-button",
@@ -14983,12 +15419,33 @@ const PaypalSubscribeButton = props => {
14983
15419
  displayName: props.merchantDisplayName,
14984
15420
  locale: props.locale,
14985
15421
  billingAgreementDescription: props.billingDescription
14986
- }); // Await building paypal instance
15422
+ });
15423
+
15424
+ const getProduct = () => {
15425
+ if (invoice) {
15426
+ invoice.plan = null;
15427
+
15428
+ if (invoice.plan) {
15429
+ return invoice.plan;
15430
+ } else {
15431
+ // standalone invoices dont have a plan
15432
+ return {
15433
+ currency: invoice.currency,
15434
+ nickname: `invoice #${invoice.id}`
15435
+ };
15436
+ }
15437
+ } else if (props.plan) {
15438
+ return props.plan;
15439
+ } else {
15440
+ return plan;
15441
+ }
15442
+ }; // Await building paypal instance
15443
+
14987
15444
 
14988
15445
  await paypalCheckoutInstance.build(); // Create paypal payment
14989
15446
 
14990
15447
  paypalCheckoutInstance.createPayment({
14991
- product: invoice ? invoice.plan : (_props$plan2 = props.plan) !== null && _props$plan2 !== void 0 ? _props$plan2 : plan,
15448
+ product: getProduct(),
14992
15449
  amount: updatedPrice,
14993
15450
  address: invoice ? null : selectedAddress,
14994
15451
  onButtonClick: () => {
@@ -15070,7 +15527,7 @@ const SelectedPaymentMethod = () => {
15070
15527
  state: {
15071
15528
  isLoading
15072
15529
  }
15073
- } = React.useContext(store$f);
15530
+ } = React.useContext(store$g);
15074
15531
  const {
15075
15532
  switchView,
15076
15533
  selectedPaymentMethodId
@@ -15112,7 +15569,7 @@ const TaxAmount = () => {
15112
15569
  state: {
15113
15570
  taxAmount
15114
15571
  }
15115
- } = React.useContext(store$f);
15572
+ } = React.useContext(store$g);
15116
15573
  const {
15117
15574
  plan
15118
15575
  } = usePelcro();
@@ -15631,7 +16088,7 @@ class DefaultNewsLetter extends React.Component {
15631
16088
 
15632
16089
  const NewsLetter = withTranslation("newsletter")(DefaultNewsLetter);
15633
16090
 
15634
- const initialState$e = {
16091
+ const initialState$f = {
15635
16092
  didSubToNewslettersBefore: false,
15636
16093
  newsletters: [],
15637
16094
  isListLoading: true,
@@ -15641,10 +16098,10 @@ const initialState$e = {
15641
16098
  content: ""
15642
16099
  }
15643
16100
  };
15644
- const store$e = /*#__PURE__*/React.createContext(initialState$e);
16101
+ const store$f = /*#__PURE__*/React.createContext(initialState$f);
15645
16102
  const {
15646
- Provider: Provider$e
15647
- } = store$e;
16103
+ Provider: Provider$f
16104
+ } = store$f;
15648
16105
 
15649
16106
  const NewsletterUpdateContainer = ({
15650
16107
  style,
@@ -15757,7 +16214,7 @@ const NewsletterUpdateContainer = ({
15757
16214
  default:
15758
16215
  return state;
15759
16216
  }
15760
- }, initialState$e);
16217
+ }, initialState$f);
15761
16218
  React.useEffect(() => {
15762
16219
  const getUserNewsletters = () => {
15763
16220
  var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
@@ -15801,7 +16258,7 @@ const NewsletterUpdateContainer = ({
15801
16258
  style: { ...style
15802
16259
  },
15803
16260
  className: `pelcro-container pelcro-newsletter-update-container ${className}`
15804
- }, /*#__PURE__*/React__default['default'].createElement(Provider$e, {
16261
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$f, {
15805
16262
  value: {
15806
16263
  state,
15807
16264
  dispatch
@@ -15809,12 +16266,12 @@ const NewsletterUpdateContainer = ({
15809
16266
  }, children.length ? children.map((child, i) => {
15810
16267
  if (child) {
15811
16268
  return /*#__PURE__*/React__default['default'].cloneElement(child, {
15812
- store: store$e,
16269
+ store: store$f,
15813
16270
  key: i
15814
16271
  });
15815
16272
  }
15816
16273
  }) : /*#__PURE__*/React__default['default'].cloneElement(children, {
15817
- store: store$e
16274
+ store: store$f
15818
16275
  })));
15819
16276
  };
15820
16277
 
@@ -15829,7 +16286,7 @@ const NewsletterUpdateButton = ({
15829
16286
  isSubmitting,
15830
16287
  isListLoading
15831
16288
  }
15832
- } = React.useContext(store$e);
16289
+ } = React.useContext(store$f);
15833
16290
  const {
15834
16291
  t
15835
16292
  } = useTranslation("newsletter");
@@ -15859,7 +16316,7 @@ const NewsletterUpdateList = () => {
15859
16316
  newsletters,
15860
16317
  isListLoading
15861
16318
  }
15862
- } = React.useContext(store$e);
16319
+ } = React.useContext(store$f);
15863
16320
 
15864
16321
  if (isListLoading) {
15865
16322
  return /*#__PURE__*/React__default['default'].createElement(Loader, {
@@ -16063,7 +16520,7 @@ function SubscriptionCreateModal({
16063
16520
  SubscriptionCreateModal.viewId = "subscription-create";
16064
16521
 
16065
16522
  var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
16066
- const initialState$d = {
16523
+ const initialState$e = {
16067
16524
  email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
16068
16525
  firstName: (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.first_name,
16069
16526
  lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
@@ -16076,10 +16533,10 @@ const initialState$d = {
16076
16533
  content: ""
16077
16534
  }
16078
16535
  };
16079
- const store$d = /*#__PURE__*/React.createContext(initialState$d);
16536
+ const store$e = /*#__PURE__*/React.createContext(initialState$e);
16080
16537
  const {
16081
- Provider: Provider$d
16082
- } = store$d;
16538
+ Provider: Provider$e
16539
+ } = store$e;
16083
16540
 
16084
16541
  const UserUpdateContainer = ({
16085
16542
  style,
@@ -16099,20 +16556,23 @@ const UserUpdateContainer = ({
16099
16556
  }, []);
16100
16557
 
16101
16558
  const loadUserDataIntoFields = () => {
16102
- var _window$Pelcro$user$r6, _window$Pelcro$user$r7, _window$Pelcro$user$r8, _window$Pelcro$user$r9;
16559
+ var _window$Pelcro$user$r6, _window$Pelcro$user$r7, _window$Pelcro$user$r8, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
16103
16560
 
16104
16561
  const fields = [{
16562
+ type: SET_EMAIL,
16563
+ payload: (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.email
16564
+ }, {
16105
16565
  type: SET_FIRST_NAME,
16106
- payload: (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.first_name
16566
+ payload: (_window$Pelcro$user$r7 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.first_name
16107
16567
  }, {
16108
16568
  type: SET_LAST_NAME,
16109
- payload: (_window$Pelcro$user$r7 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.last_name
16569
+ payload: (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.last_name
16110
16570
  }, {
16111
16571
  type: SET_DISPLAY_NAME,
16112
- payload: (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.display_name
16572
+ payload: (_window$Pelcro$user$r9 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r9 === void 0 ? void 0 : _window$Pelcro$user$r9.display_name
16113
16573
  }, {
16114
16574
  type: SET_PHONE,
16115
- payload: (_window$Pelcro$user$r9 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r9 === void 0 ? void 0 : _window$Pelcro$user$r9.phone
16575
+ payload: (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.phone
16116
16576
  }];
16117
16577
  fields.filter(field => Boolean(field.payload)).forEach(field => {
16118
16578
  dispatch(field);
@@ -16120,6 +16580,7 @@ const UserUpdateContainer = ({
16120
16580
  };
16121
16581
 
16122
16582
  const handleUpdateUser = ({
16583
+ email,
16123
16584
  firstName,
16124
16585
  lastName,
16125
16586
  phone,
@@ -16128,6 +16589,7 @@ const UserUpdateContainer = ({
16128
16589
  }, dispatch) => {
16129
16590
  window.Pelcro.user.update({
16130
16591
  auth_token: window.Pelcro.user.read().auth_token,
16592
+ email: email,
16131
16593
  first_name: firstName,
16132
16594
  last_name: lastName,
16133
16595
  display_name: displayName,
@@ -16173,6 +16635,11 @@ const UserUpdateContainer = ({
16173
16635
  }
16174
16636
  });
16175
16637
 
16638
+ case SET_EMAIL:
16639
+ return lib_7({ ...state,
16640
+ email: action.payload
16641
+ });
16642
+
16176
16643
  case SET_FIRST_NAME:
16177
16644
  return lib_7({ ...state,
16178
16645
  firstName: action.payload
@@ -16211,27 +16678,26 @@ const UserUpdateContainer = ({
16211
16678
  default:
16212
16679
  return state;
16213
16680
  }
16214
- }, initialState$d);
16681
+ }, initialState$e);
16215
16682
  return /*#__PURE__*/React__default['default'].createElement("div", {
16216
16683
  style: { ...style
16217
16684
  },
16218
16685
  className: `pelcro-container pelcro-user-update-container ${className}`
16219
- }, /*#__PURE__*/React__default['default'].createElement(Provider$d, {
16686
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$e, {
16220
16687
  value: {
16221
16688
  state,
16222
16689
  dispatch
16223
16690
  }
16224
16691
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
16225
- store: store$d,
16692
+ store: store$e,
16226
16693
  key: i
16227
16694
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
16228
- store: store$d
16695
+ store: store$e
16229
16696
  })));
16230
16697
  };
16231
16698
 
16232
16699
  const UserUpdateEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
16233
- disabled: true,
16234
- store: store$d
16700
+ store: store$e
16235
16701
  }, props));
16236
16702
 
16237
16703
  const UserUpdateButton = ({
@@ -16244,7 +16710,7 @@ const UserUpdateButton = ({
16244
16710
  buttonDisabled
16245
16711
  },
16246
16712
  dispatch
16247
- } = React.useContext(store$d);
16713
+ } = React.useContext(store$e);
16248
16714
  const {
16249
16715
  t
16250
16716
  } = useTranslation("userEdit");
@@ -16261,11 +16727,11 @@ const UserUpdateButton = ({
16261
16727
  };
16262
16728
 
16263
16729
  const UserUpdateFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
16264
- store: store$d
16730
+ store: store$e
16265
16731
  }, props));
16266
16732
 
16267
16733
  const UserUpdateLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
16268
- store: store$d
16734
+ store: store$e
16269
16735
  }, props));
16270
16736
 
16271
16737
  function Phone({
@@ -16294,7 +16760,7 @@ function Phone({
16294
16760
  }
16295
16761
 
16296
16762
  const UserUpdatePhone = props => /*#__PURE__*/React__default['default'].createElement(Phone, Object.assign({
16297
- store: store$d
16763
+ store: store$e
16298
16764
  }, props));
16299
16765
 
16300
16766
  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";
@@ -16332,7 +16798,7 @@ const UserUpdateProfilePic = ({
16332
16798
  onClick: onClick
16333
16799
  }, otherProps)), /*#__PURE__*/React__default['default'].createElement(Button, {
16334
16800
  variant: "icon",
16335
- className: "plc-absolute plc-bg-gray-500 plc-text-white plc-w-10 plc-h-10 plc-top-24 plc-right-2 hover:plc-bg-gray-600",
16801
+ className: "plc-absolute plc-bg-gray-500 plc-text-white plc-w-10 plc-h-10 plc-top-24 plc-right-2 hover:plc-bg-gray-600 hover:plc-text-white",
16336
16802
  icon: /*#__PURE__*/React__default['default'].createElement(SvgEdit, null),
16337
16803
  id: "pelcro-user-update-picture-button",
16338
16804
  onClick: onClick
@@ -16357,15 +16823,15 @@ const UserUpdateView = props => {
16357
16823
  }), /*#__PURE__*/React__default['default'].createElement("div", {
16358
16824
  className: "plc-flex plc-items-start"
16359
16825
  }, /*#__PURE__*/React__default['default'].createElement(UserUpdateEmail, {
16360
- label: t("labels.email")
16826
+ label: t("labels.email"),
16827
+ autoFocus: true
16361
16828
  })), /*#__PURE__*/React__default['default'].createElement("div", {
16362
16829
  className: "plc-flex plc-items-start"
16363
16830
  }, /*#__PURE__*/React__default['default'].createElement(UserUpdateFirstName, {
16364
16831
  autoComplete: "first-name",
16365
16832
  id: "pelcro-input-first-name",
16366
16833
  errorId: "pelcro-input-first-name-error",
16367
- label: t("labels.firstName"),
16368
- autoFocus: true
16834
+ label: t("labels.firstName")
16369
16835
  }), /*#__PURE__*/React__default['default'].createElement(UserUpdateLastName, {
16370
16836
  wrapperClassName: "plc-ml-3",
16371
16837
  autoComplete: "last-name",
@@ -16441,16 +16907,16 @@ function DisplayName({
16441
16907
  }
16442
16908
 
16443
16909
  const UserUpdateDisplayName = props => /*#__PURE__*/React__default['default'].createElement(DisplayName, Object.assign({
16444
- store: store$d
16910
+ store: store$e
16445
16911
  }, props));
16446
16912
 
16447
16913
  const UserUpdateTextInput = props => {
16448
16914
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
16449
- store: store$d
16915
+ store: store$e
16450
16916
  }));
16451
16917
  };
16452
16918
 
16453
- const initialState$c = {
16919
+ const initialState$d = {
16454
16920
  isSubmitting: false,
16455
16921
  firstName: "",
16456
16922
  firstNameError: "",
@@ -16475,10 +16941,10 @@ const initialState$c = {
16475
16941
  content: ""
16476
16942
  }
16477
16943
  };
16478
- const store$c = /*#__PURE__*/React.createContext(initialState$c);
16944
+ const store$d = /*#__PURE__*/React.createContext(initialState$d);
16479
16945
  const {
16480
- Provider: Provider$c
16481
- } = store$c;
16946
+ Provider: Provider$d
16947
+ } = store$d;
16482
16948
 
16483
16949
  const getNewlyCreatedAddress = addresses => addresses[addresses.length - 1];
16484
16950
 
@@ -16685,7 +17151,7 @@ const AddressCreateContainer = ({
16685
17151
  default:
16686
17152
  return state;
16687
17153
  }
16688
- }, initialState$c);
17154
+ }, initialState$d);
16689
17155
  React.useEffect(() => {
16690
17156
  const getStates = () => {
16691
17157
  dispatch({
@@ -16717,16 +17183,16 @@ const AddressCreateContainer = ({
16717
17183
  style: { ...style
16718
17184
  },
16719
17185
  className: `pelcro-container pelcro-address-create-container ${className}`
16720
- }, /*#__PURE__*/React__default['default'].createElement(Provider$c, {
17186
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$d, {
16721
17187
  value: {
16722
17188
  state,
16723
17189
  dispatch
16724
17190
  }
16725
17191
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
16726
- store: store$c,
17192
+ store: store$d,
16727
17193
  key: i
16728
17194
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
16729
- store: store$c
17195
+ store: store$d
16730
17196
  })));
16731
17197
  };
16732
17198
 
@@ -16737,7 +17203,7 @@ function AddressCreateFirstName(props) {
16737
17203
  firstName,
16738
17204
  firstNameError
16739
17205
  }
16740
- } = React.useContext(store$c);
17206
+ } = React.useContext(store$d);
16741
17207
 
16742
17208
  const handleBlur = () => {
16743
17209
  return dispatch({
@@ -16780,7 +17246,7 @@ function AddressCreateLastName(props) {
16780
17246
  lastName,
16781
17247
  lastNameError
16782
17248
  }
16783
- } = React.useContext(store$c);
17249
+ } = React.useContext(store$d);
16784
17250
 
16785
17251
  const handleBlur = () => {
16786
17252
  return dispatch({
@@ -16823,7 +17289,7 @@ function AddressCreateLine1(props) {
16823
17289
  line1,
16824
17290
  line1Error
16825
17291
  }
16826
- } = React.useContext(store$c);
17292
+ } = React.useContext(store$d);
16827
17293
 
16828
17294
  const handleBlur = () => {
16829
17295
  return dispatch({
@@ -16866,7 +17332,7 @@ function AddressCreateCity(props) {
16866
17332
  city,
16867
17333
  cityError
16868
17334
  }
16869
- } = React.useContext(store$c);
17335
+ } = React.useContext(store$d);
16870
17336
 
16871
17337
  const handleBlur = () => {
16872
17338
  return dispatch({
@@ -16909,7 +17375,7 @@ function AddressCreatePostalCode(props) {
16909
17375
  postalCode,
16910
17376
  postalCodeError
16911
17377
  }
16912
- } = React.useContext(store$c);
17378
+ } = React.useContext(store$d);
16913
17379
 
16914
17380
  const handleBlur = () => {
16915
17381
  return dispatch({
@@ -16955,7 +17421,7 @@ const AddressCreateSubmit = ({
16955
17421
  state: {
16956
17422
  isSubmitting
16957
17423
  }
16958
- } = React.useContext(store$c);
17424
+ } = React.useContext(store$d);
16959
17425
  const {
16960
17426
  t
16961
17427
  } = useTranslation("address");
@@ -17066,7 +17532,7 @@ function CountrySelect({
17066
17532
  }
17067
17533
 
17068
17534
  const AddressCreateCountrySelect = props => /*#__PURE__*/React__default['default'].createElement(CountrySelect, Object.assign({
17069
- store: store$c
17535
+ store: store$d
17070
17536
  }, props));
17071
17537
 
17072
17538
  function StateSelect({
@@ -17154,7 +17620,7 @@ function StateSelect({
17154
17620
  }
17155
17621
 
17156
17622
  const AddressCreateStateSelect = props => /*#__PURE__*/React__default['default'].createElement(StateSelect, Object.assign({
17157
- store: store$c
17623
+ store: store$d
17158
17624
  }, props));
17159
17625
 
17160
17626
  const AddressCreateView = props => {
@@ -17259,18 +17725,18 @@ AddressCreateModal.viewId = "address-create";
17259
17725
 
17260
17726
  const AddressCreateTextInput = props => {
17261
17727
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
17262
- store: store$c
17728
+ store: store$d
17263
17729
  }));
17264
17730
  };
17265
17731
 
17266
17732
  const AddressCreateLine2 = props => {
17267
17733
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({
17268
17734
  fieldName: "line2",
17269
- store: store$c
17735
+ store: store$d
17270
17736
  }, props));
17271
17737
  };
17272
17738
 
17273
- const initialState$b = {
17739
+ const initialState$c = {
17274
17740
  isSubmitting: false,
17275
17741
  firstName: "",
17276
17742
  firstNameError: "",
@@ -17295,10 +17761,10 @@ const initialState$b = {
17295
17761
  content: ""
17296
17762
  }
17297
17763
  };
17298
- const store$b = /*#__PURE__*/React.createContext(initialState$b);
17764
+ const store$c = /*#__PURE__*/React.createContext(initialState$c);
17299
17765
  const {
17300
- Provider: Provider$b
17301
- } = store$b;
17766
+ Provider: Provider$c
17767
+ } = store$c;
17302
17768
 
17303
17769
  const AddressUpdateContainer = ({
17304
17770
  style,
@@ -17350,7 +17816,7 @@ const AddressUpdateContainer = ({
17350
17816
  const thisAddress = addresses[address];
17351
17817
 
17352
17818
  if (+thisAddress.id === +addressId) {
17353
- const newState = { ...initialState$b,
17819
+ const newState = { ...initialState$c,
17354
17820
  firstName: thisAddress.first_name,
17355
17821
  lastName: thisAddress.last_name,
17356
17822
  line1: thisAddress.line1,
@@ -17483,7 +17949,7 @@ const AddressUpdateContainer = ({
17483
17949
  default:
17484
17950
  return state;
17485
17951
  }
17486
- }, initialState$b);
17952
+ }, initialState$c);
17487
17953
  React.useEffect(() => {
17488
17954
  const getStates = () => {
17489
17955
  dispatch({
@@ -17515,21 +17981,21 @@ const AddressUpdateContainer = ({
17515
17981
  style: { ...style
17516
17982
  },
17517
17983
  className: `pelcro-container pelcro-address-update-container ${className}`
17518
- }, /*#__PURE__*/React__default['default'].createElement(Provider$b, {
17984
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$c, {
17519
17985
  value: {
17520
17986
  state,
17521
17987
  dispatch
17522
17988
  }
17523
17989
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
17524
- store: store$b,
17990
+ store: store$c,
17525
17991
  key: i
17526
17992
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
17527
- store: store$b
17993
+ store: store$c
17528
17994
  })));
17529
17995
  };
17530
17996
 
17531
17997
  const AddressUpdateCountrySelect = props => /*#__PURE__*/React__default['default'].createElement(CountrySelect, Object.assign({
17532
- store: store$b
17998
+ store: store$c
17533
17999
  }, props));
17534
18000
 
17535
18001
  function AddressUpdateFirstName(props) {
@@ -17539,7 +18005,7 @@ function AddressUpdateFirstName(props) {
17539
18005
  firstName,
17540
18006
  firstNameError
17541
18007
  }
17542
- } = React.useContext(store$b);
18008
+ } = React.useContext(store$c);
17543
18009
 
17544
18010
  const handleBlur = () => {
17545
18011
  return dispatch({
@@ -17582,7 +18048,7 @@ function AddressUpdateLastName(props) {
17582
18048
  lastName,
17583
18049
  lastNameError
17584
18050
  }
17585
- } = React.useContext(store$b);
18051
+ } = React.useContext(store$c);
17586
18052
 
17587
18053
  const handleBlur = () => {
17588
18054
  return dispatch({
@@ -17625,7 +18091,7 @@ function AddressUpdateLine1(props) {
17625
18091
  line1,
17626
18092
  line1Error
17627
18093
  }
17628
- } = React.useContext(store$b);
18094
+ } = React.useContext(store$c);
17629
18095
 
17630
18096
  const handleBlur = () => {
17631
18097
  return dispatch({
@@ -17665,7 +18131,7 @@ const AddressUpdateLine2 = props => {
17665
18131
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({
17666
18132
  fieldName: "line2"
17667
18133
  }, props, {
17668
- store: store$b
18134
+ store: store$c
17669
18135
  }));
17670
18136
  };
17671
18137
 
@@ -17676,7 +18142,7 @@ function AddressUpdateCity(props) {
17676
18142
  city,
17677
18143
  cityError
17678
18144
  }
17679
- } = React.useContext(store$b);
18145
+ } = React.useContext(store$c);
17680
18146
 
17681
18147
  const handleBlur = () => {
17682
18148
  return dispatch({
@@ -17719,7 +18185,7 @@ function AddressUpdatePostalCode(props) {
17719
18185
  postalCode,
17720
18186
  postalCodeError
17721
18187
  }
17722
- } = React.useContext(store$b);
18188
+ } = React.useContext(store$c);
17723
18189
 
17724
18190
  const handleBlur = () => {
17725
18191
  return dispatch({
@@ -17765,7 +18231,7 @@ const AddressUpdateSubmit = ({
17765
18231
  state: {
17766
18232
  isSubmitting
17767
18233
  }
17768
- } = React.useContext(store$b);
18234
+ } = React.useContext(store$c);
17769
18235
  const {
17770
18236
  t
17771
18237
  } = useTranslation("address");
@@ -17781,7 +18247,7 @@ const AddressUpdateSubmit = ({
17781
18247
  };
17782
18248
 
17783
18249
  const AddressUpdateStateSelect = props => /*#__PURE__*/React__default['default'].createElement(StateSelect, Object.assign({
17784
- store: store$b
18250
+ store: store$c
17785
18251
  }, props));
17786
18252
 
17787
18253
  const AddressUpdateView = props => {
@@ -17864,7 +18330,7 @@ AddressUpdateModal.viewId = "address-edit";
17864
18330
 
17865
18331
  const AddressUpdateTextInput = props => {
17866
18332
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
17867
- store: store$b
18333
+ store: store$c
17868
18334
  }));
17869
18335
  };
17870
18336
 
@@ -17947,7 +18413,7 @@ const PaymentMethodUpdateModal = props => {
17947
18413
  };
17948
18414
  PaymentMethodUpdateModal.viewId = "payment-method-update";
17949
18415
 
17950
- const initialState$a = {
18416
+ const initialState$b = {
17951
18417
  email: "",
17952
18418
  password: "",
17953
18419
  passwordError: null,
@@ -17960,10 +18426,10 @@ const initialState$a = {
17960
18426
  content: ""
17961
18427
  }
17962
18428
  };
17963
- const store$a = /*#__PURE__*/React.createContext(initialState$a);
18429
+ const store$b = /*#__PURE__*/React.createContext(initialState$b);
17964
18430
  const {
17965
- Provider: Provider$a
17966
- } = store$a;
18431
+ Provider: Provider$b
18432
+ } = store$b;
17967
18433
 
17968
18434
  const PasswordResetContainer = ({
17969
18435
  style,
@@ -18020,7 +18486,7 @@ const PasswordResetContainer = ({
18020
18486
  type: SET_EMAIL,
18021
18487
  payload: window.Pelcro.helpers.getURLParameter("email")
18022
18488
  });
18023
- initialState$a.email = window.Pelcro.helpers.getURLParameter("email");
18489
+ initialState$b.email = window.Pelcro.helpers.getURLParameter("email");
18024
18490
  dispatch({
18025
18491
  type: SET_TOKEN,
18026
18492
  payload: window.Pelcro.helpers.getURLParameter("token")
@@ -18080,26 +18546,26 @@ const PasswordResetContainer = ({
18080
18546
  default:
18081
18547
  return state;
18082
18548
  }
18083
- }, initialState$a);
18549
+ }, initialState$b);
18084
18550
  return /*#__PURE__*/React__default['default'].createElement("div", {
18085
18551
  style: { ...style
18086
18552
  },
18087
18553
  className: `pelcro-container pelcro-password-reset-container ${className}`
18088
- }, /*#__PURE__*/React__default['default'].createElement(Provider$a, {
18554
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$b, {
18089
18555
  value: {
18090
18556
  state,
18091
18557
  dispatch
18092
18558
  }
18093
18559
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
18094
- store: store$a,
18560
+ store: store$b,
18095
18561
  key: i
18096
18562
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
18097
- store: store$a
18563
+ store: store$b
18098
18564
  })));
18099
18565
  };
18100
18566
 
18101
18567
  const PasswordResetPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
18102
- store: store$a
18568
+ store: store$b
18103
18569
  }, props));
18104
18570
 
18105
18571
  const PasswordResetButton = ({
@@ -18112,7 +18578,7 @@ const PasswordResetButton = ({
18112
18578
  buttonDisabled
18113
18579
  },
18114
18580
  dispatch
18115
- } = React.useContext(store$a);
18581
+ } = React.useContext(store$b);
18116
18582
  const {
18117
18583
  t
18118
18584
  } = useTranslation("passwordReset");
@@ -18129,14 +18595,14 @@ const PasswordResetButton = ({
18129
18595
  };
18130
18596
 
18131
18597
  const PasswordResetEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
18132
- store: store$a
18598
+ store: store$b
18133
18599
  }, props, {
18134
18600
  value: window.Pelcro.helpers.getURLParameter("email"),
18135
18601
  disabled: true
18136
18602
  }));
18137
18603
 
18138
18604
  const PasswordResetConfirmPassword = props => /*#__PURE__*/React__default['default'].createElement(ConfirmPassword, Object.assign({
18139
- store: store$a
18605
+ store: store$b
18140
18606
  }, props));
18141
18607
 
18142
18608
  const PasswordResetView = props => {
@@ -18188,7 +18654,7 @@ const PasswordResetModal = ({
18188
18654
  };
18189
18655
  PasswordResetModal.viewId = "password-reset";
18190
18656
 
18191
- const initialState$9 = {
18657
+ const initialState$a = {
18192
18658
  email: "",
18193
18659
  emailError: null,
18194
18660
  buttonDisabled: false,
@@ -18197,10 +18663,10 @@ const initialState$9 = {
18197
18663
  content: ""
18198
18664
  }
18199
18665
  };
18200
- const store$9 = /*#__PURE__*/React.createContext(initialState$9);
18666
+ const store$a = /*#__PURE__*/React.createContext(initialState$a);
18201
18667
  const {
18202
- Provider: Provider$9
18203
- } = store$9;
18668
+ Provider: Provider$a
18669
+ } = store$a;
18204
18670
 
18205
18671
  const PasswordForgotContainer = ({
18206
18672
  style,
@@ -18278,21 +18744,21 @@ const PasswordForgotContainer = ({
18278
18744
  default:
18279
18745
  return state;
18280
18746
  }
18281
- }, initialState$9);
18747
+ }, initialState$a);
18282
18748
  return /*#__PURE__*/React__default['default'].createElement("div", {
18283
18749
  style: { ...style
18284
18750
  },
18285
18751
  className: `pelcro-container pelcro-password-forgot-container ${className}`
18286
- }, /*#__PURE__*/React__default['default'].createElement(Provider$9, {
18752
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$a, {
18287
18753
  value: {
18288
18754
  state,
18289
18755
  dispatch
18290
18756
  }
18291
18757
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
18292
- store: store$9,
18758
+ store: store$a,
18293
18759
  key: i
18294
18760
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
18295
- store: store$9
18761
+ store: store$a
18296
18762
  })));
18297
18763
  };
18298
18764
 
@@ -18308,7 +18774,7 @@ const PasswordForgotButton = ({
18308
18774
  emailError
18309
18775
  },
18310
18776
  dispatch
18311
- } = React.useContext(store$9);
18777
+ } = React.useContext(store$a);
18312
18778
  const {
18313
18779
  t
18314
18780
  } = useTranslation("passwordForgot");
@@ -18329,7 +18795,7 @@ const PasswordForgotButton = ({
18329
18795
  };
18330
18796
 
18331
18797
  const PasswordForgotEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
18332
- store: store$9
18798
+ store: store$a
18333
18799
  }, props));
18334
18800
 
18335
18801
  const PasswordForgotView = props => {
@@ -18379,7 +18845,7 @@ const PasswordForgotModal = ({
18379
18845
  };
18380
18846
  PasswordForgotModal.viewId = "password-forgot";
18381
18847
 
18382
- const initialState$8 = {
18848
+ const initialState$9 = {
18383
18849
  currentPassword: "",
18384
18850
  newPassword: "",
18385
18851
  confirmNewPassword: "",
@@ -18393,10 +18859,10 @@ const initialState$8 = {
18393
18859
  content: ""
18394
18860
  }
18395
18861
  };
18396
- const store$8 = /*#__PURE__*/React.createContext(initialState$8);
18862
+ const store$9 = /*#__PURE__*/React.createContext(initialState$9);
18397
18863
  const {
18398
- Provider: Provider$8
18399
- } = store$8;
18864
+ Provider: Provider$9
18865
+ } = store$9;
18400
18866
  const PasswordChangeContainer = ({
18401
18867
  style,
18402
18868
  className = "",
@@ -18548,21 +19014,21 @@ const PasswordChangeContainer = ({
18548
19014
  default:
18549
19015
  return state;
18550
19016
  }
18551
- }, initialState$8);
19017
+ }, initialState$9);
18552
19018
  return /*#__PURE__*/React__default['default'].createElement("div", {
18553
19019
  style: { ...style
18554
19020
  },
18555
19021
  className: `pelcro-container pelcro-password-change-container ${className}`
18556
- }, /*#__PURE__*/React__default['default'].createElement(Provider$8, {
19022
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$9, {
18557
19023
  value: {
18558
19024
  state,
18559
19025
  dispatch
18560
19026
  }
18561
19027
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
18562
- store: store$8,
19028
+ store: store$9,
18563
19029
  key: i
18564
19030
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
18565
- store: store$8
19031
+ store: store$9
18566
19032
  })));
18567
19033
  };
18568
19034
 
@@ -18573,7 +19039,7 @@ function PasswordChangeCurrentPassword(props) {
18573
19039
  currentPassword,
18574
19040
  currentPasswordError
18575
19041
  }
18576
- } = React.useContext(store$8);
19042
+ } = React.useContext(store$9);
18577
19043
  const handleBlur = React.useCallback(() => {
18578
19044
  return dispatch({
18579
19045
  type: VALIDATE_PASSWORD
@@ -18607,7 +19073,7 @@ function PasswordChangeNewPassword(props) {
18607
19073
  newPassword,
18608
19074
  newPasswordError
18609
19075
  }
18610
- } = React.useContext(store$8);
19076
+ } = React.useContext(store$9);
18611
19077
  const handleBlur = React.useCallback(() => {
18612
19078
  return dispatch({
18613
19079
  type: VALIDATE_NEW_PASSWORD
@@ -18641,7 +19107,7 @@ function PasswordChangeConfirmNewPassword(props) {
18641
19107
  confirmNewPassword,
18642
19108
  confirmNewPasswordError
18643
19109
  }
18644
- } = React.useContext(store$8);
19110
+ } = React.useContext(store$9);
18645
19111
  const handleBlur = React.useCallback(() => {
18646
19112
  return dispatch({
18647
19113
  type: VALIDATE_CONFIRM_NEW_PASSWORD
@@ -18682,7 +19148,7 @@ const PasswordChangeButton = ({
18682
19148
  confirmNewPasswordError
18683
19149
  },
18684
19150
  dispatch
18685
- } = React.useContext(store$8);
19151
+ } = React.useContext(store$9);
18686
19152
  const {
18687
19153
  t
18688
19154
  } = useTranslation("passwordChange");
@@ -18748,17 +19214,17 @@ const PasswordChangeModal = ({
18748
19214
  };
18749
19215
  PasswordChangeModal.viewId = "password-change";
18750
19216
 
18751
- const initialState$7 = {
19217
+ const initialState$8 = {
18752
19218
  buttonDisabled: false,
18753
19219
  alert: {
18754
19220
  type: "error",
18755
19221
  content: ""
18756
19222
  }
18757
19223
  };
18758
- const store$7 = /*#__PURE__*/React.createContext(initialState$7);
19224
+ const store$8 = /*#__PURE__*/React.createContext(initialState$8);
18759
19225
  const {
18760
- Provider: Provider$7
18761
- } = store$7;
19226
+ Provider: Provider$8
19227
+ } = store$8;
18762
19228
 
18763
19229
  const CartContainer = ({
18764
19230
  style,
@@ -18849,21 +19315,21 @@ const CartContainer = ({
18849
19315
  default:
18850
19316
  return state;
18851
19317
  }
18852
- }, initialState$7);
19318
+ }, initialState$8);
18853
19319
  return /*#__PURE__*/React__default['default'].createElement("div", {
18854
19320
  style: { ...style
18855
19321
  },
18856
19322
  className: `pelcro-container pelcro-cart-container ${className}`
18857
- }, /*#__PURE__*/React__default['default'].createElement(Provider$7, {
19323
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$8, {
18858
19324
  value: {
18859
19325
  state,
18860
19326
  dispatch
18861
19327
  }
18862
19328
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
18863
- store: store$7,
19329
+ store: store$8,
18864
19330
  key: i
18865
19331
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
18866
- store: store$7
19332
+ store: store$8
18867
19333
  })));
18868
19334
  };
18869
19335
 
@@ -18900,7 +19366,7 @@ const CartSubmit = ({
18900
19366
  buttonDisabled
18901
19367
  },
18902
19368
  dispatch
18903
- } = React.useContext(store$7);
19369
+ } = React.useContext(store$8);
18904
19370
  const {
18905
19371
  t
18906
19372
  } = useTranslation("cart");
@@ -18931,7 +19397,7 @@ const CartTotalPrice = () => {
18931
19397
  state: {
18932
19398
  alert
18933
19399
  }
18934
- } = React.useContext(store$7);
19400
+ } = React.useContext(store$8);
18935
19401
  const {
18936
19402
  cartItems
18937
19403
  } = usePelcro();
@@ -19244,7 +19710,7 @@ const OrderConfirmModal = props => {
19244
19710
  };
19245
19711
  OrderConfirmModal.viewId = "order-confirm";
19246
19712
 
19247
- const initialState$6 = {
19713
+ const initialState$7 = {
19248
19714
  email: "",
19249
19715
  firstName: "",
19250
19716
  lastName: "",
@@ -19256,10 +19722,10 @@ const initialState$6 = {
19256
19722
  content: ""
19257
19723
  }
19258
19724
  };
19259
- const store$6 = /*#__PURE__*/React.createContext(initialState$6);
19725
+ const store$7 = /*#__PURE__*/React.createContext(initialState$7);
19260
19726
  const {
19261
- Provider: Provider$6
19262
- } = store$6;
19727
+ Provider: Provider$7
19728
+ } = store$7;
19263
19729
 
19264
19730
  const GiftCreateContainer = ({
19265
19731
  style,
@@ -19363,21 +19829,21 @@ const GiftCreateContainer = ({
19363
19829
  default:
19364
19830
  return state;
19365
19831
  }
19366
- }, initialState$6);
19832
+ }, initialState$7);
19367
19833
  return /*#__PURE__*/React__default['default'].createElement("div", {
19368
19834
  style: { ...style
19369
19835
  },
19370
19836
  className: `pelcro-container pelcro-gift-create-container ${className}`
19371
- }, /*#__PURE__*/React__default['default'].createElement(Provider$6, {
19837
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$7, {
19372
19838
  value: {
19373
19839
  state,
19374
19840
  dispatch
19375
19841
  }
19376
19842
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
19377
- store: store$6,
19843
+ store: store$7,
19378
19844
  key: i
19379
19845
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
19380
- store: store$6
19846
+ store: store$7
19381
19847
  })));
19382
19848
  };
19383
19849
 
@@ -19391,7 +19857,7 @@ const GiftCreateSubmitButton = ({
19391
19857
  state: {
19392
19858
  disableSubmit
19393
19859
  }
19394
- } = React.useContext(store$6);
19860
+ } = React.useContext(store$7);
19395
19861
  const {
19396
19862
  t
19397
19863
  } = useTranslation("register");
@@ -19408,15 +19874,15 @@ const GiftCreateSubmitButton = ({
19408
19874
 
19409
19875
  const GiftCreateEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
19410
19876
  initWithUserEmail: false,
19411
- store: store$6
19877
+ store: store$7
19412
19878
  }, props));
19413
19879
 
19414
19880
  const GiftCreateFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
19415
- store: store$6
19881
+ store: store$7
19416
19882
  }, props));
19417
19883
 
19418
19884
  const GiftCreateLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
19419
- store: store$6
19885
+ store: store$7
19420
19886
  }, props));
19421
19887
 
19422
19888
  var _path$h;
@@ -19501,7 +19967,7 @@ const GiftCreateStartDate = props => {
19501
19967
  const {
19502
19968
  dispatch,
19503
19969
  state
19504
- } = React.useContext(store$6);
19970
+ } = React.useContext(store$7);
19505
19971
 
19506
19972
  const handleInputChange = value => {
19507
19973
  dispatch({
@@ -19574,7 +20040,7 @@ function GiftCreateMessage(props) {
19574
20040
  const {
19575
20041
  dispatch,
19576
20042
  state
19577
- } = React.useContext(store$6);
20043
+ } = React.useContext(store$7);
19578
20044
  const MAX_CHARS_COUNT = 200;
19579
20045
  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;
19580
20046
 
@@ -19698,7 +20164,7 @@ const GiftCreateModal = ({
19698
20164
  };
19699
20165
  GiftCreateModal.viewId = "gift-create";
19700
20166
 
19701
- const initialState$5 = {
20167
+ const initialState$6 = {
19702
20168
  giftCode: "",
19703
20169
  buttonDisabled: true,
19704
20170
  alert: {
@@ -19706,10 +20172,10 @@ const initialState$5 = {
19706
20172
  content: ""
19707
20173
  }
19708
20174
  };
19709
- const store$5 = /*#__PURE__*/React.createContext(initialState$5);
20175
+ const store$6 = /*#__PURE__*/React.createContext(initialState$6);
19710
20176
  const {
19711
- Provider: Provider$5
19712
- } = store$5;
20177
+ Provider: Provider$6
20178
+ } = store$6;
19713
20179
 
19714
20180
  const GiftRedeemContainer = ({
19715
20181
  style,
@@ -19774,21 +20240,21 @@ const GiftRedeemContainer = ({
19774
20240
  default:
19775
20241
  return state;
19776
20242
  }
19777
- }, initialState$5);
20243
+ }, initialState$6);
19778
20244
  return /*#__PURE__*/React__default['default'].createElement("div", {
19779
20245
  style: { ...style
19780
20246
  },
19781
20247
  className: `pelcro-container pelcro-gift-redeem-container ${className}`
19782
- }, /*#__PURE__*/React__default['default'].createElement(Provider$5, {
20248
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$6, {
19783
20249
  value: {
19784
20250
  state,
19785
20251
  dispatch
19786
20252
  }
19787
20253
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
19788
- store: store$5,
20254
+ store: store$6,
19789
20255
  key: i
19790
20256
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
19791
- store: store$5
20257
+ store: store$6
19792
20258
  })));
19793
20259
  };
19794
20260
 
@@ -19825,7 +20291,7 @@ function GiftCode({
19825
20291
  }
19826
20292
 
19827
20293
  const GiftRedeemCode = props => /*#__PURE__*/React__default['default'].createElement(GiftCode, Object.assign({
19828
- store: store$5
20294
+ store: store$6
19829
20295
  }, props));
19830
20296
 
19831
20297
  const GiftRedeemSubmitButton = ({
@@ -19838,7 +20304,7 @@ const GiftRedeemSubmitButton = ({
19838
20304
  state: {
19839
20305
  disableSubmit
19840
20306
  }
19841
- } = React.useContext(store$5);
20307
+ } = React.useContext(store$6);
19842
20308
  const {
19843
20309
  t
19844
20310
  } = useTranslation("register");
@@ -19931,7 +20397,7 @@ const moveDefaultAddressToStart = addresses => {
19931
20397
  return [defaultAddress, ...addressesWithoutDefault];
19932
20398
  };
19933
20399
 
19934
- const initialState$4 = {
20400
+ const initialState$5 = {
19935
20401
  addresses: [],
19936
20402
  selectedAddressId: null,
19937
20403
  isSubmitting: false,
@@ -19940,10 +20406,10 @@ const initialState$4 = {
19940
20406
  content: ""
19941
20407
  }
19942
20408
  };
19943
- const store$4 = /*#__PURE__*/React.createContext(initialState$4);
20409
+ const store$5 = /*#__PURE__*/React.createContext(initialState$5);
19944
20410
  const {
19945
- Provider: Provider$4
19946
- } = store$4;
20411
+ Provider: Provider$5
20412
+ } = store$5;
19947
20413
 
19948
20414
  const AddressSelectContainer = ({
19949
20415
  style,
@@ -20038,7 +20504,7 @@ const AddressSelectContainer = ({
20038
20504
  default:
20039
20505
  return state;
20040
20506
  }
20041
- }, initialState$4);
20507
+ }, initialState$5);
20042
20508
  React.useEffect(() => {
20043
20509
  var _window$Pelcro$user$r;
20044
20510
 
@@ -20051,16 +20517,16 @@ const AddressSelectContainer = ({
20051
20517
  style: { ...style
20052
20518
  },
20053
20519
  className: `pelcro-container pelcro-address-select-container ${className}`
20054
- }, /*#__PURE__*/React__default['default'].createElement(Provider$4, {
20520
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$5, {
20055
20521
  value: {
20056
20522
  state,
20057
20523
  dispatch
20058
20524
  }
20059
20525
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
20060
- store: store$4,
20526
+ store: store$5,
20061
20527
  key: i
20062
20528
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
20063
- store: store$4
20529
+ store: store$5
20064
20530
  })));
20065
20531
  };
20066
20532
 
@@ -20071,7 +20537,7 @@ const AddressSelectList = () => {
20071
20537
  addresses,
20072
20538
  selectedAddressId
20073
20539
  }
20074
- } = React.useContext(store$4);
20540
+ } = React.useContext(store$5);
20075
20541
 
20076
20542
  const handleAddressSelect = event => {
20077
20543
  dispatch({
@@ -20115,7 +20581,7 @@ const AddressSelectSubmit = ({
20115
20581
  selectedAddressId,
20116
20582
  isSubmitting
20117
20583
  }
20118
- } = React.useContext(store$4);
20584
+ } = React.useContext(store$5);
20119
20585
  const {
20120
20586
  t
20121
20587
  } = useTranslation("address");
@@ -20211,7 +20677,7 @@ const moveDefaultPaymentMethodToStart = paymentMethods => {
20211
20677
  return [defaultPaymentMethod, ...paymentMethodsWithoutDefault];
20212
20678
  };
20213
20679
 
20214
- const initialState$3 = {
20680
+ const initialState$4 = {
20215
20681
  paymentMethods: [],
20216
20682
  selectedPaymentMethodId: null,
20217
20683
  isSubmitting: false,
@@ -20220,10 +20686,10 @@ const initialState$3 = {
20220
20686
  content: ""
20221
20687
  }
20222
20688
  };
20223
- const store$3 = /*#__PURE__*/React.createContext(initialState$3);
20689
+ const store$4 = /*#__PURE__*/React.createContext(initialState$4);
20224
20690
  const {
20225
- Provider: Provider$3
20226
- } = store$3;
20691
+ Provider: Provider$4
20692
+ } = store$4;
20227
20693
 
20228
20694
  const PaymentMethodSelectContainer = ({
20229
20695
  style,
@@ -20282,7 +20748,7 @@ const PaymentMethodSelectContainer = ({
20282
20748
  default:
20283
20749
  return state;
20284
20750
  }
20285
- }, initialState$3);
20751
+ }, initialState$4);
20286
20752
  React.useEffect(() => {
20287
20753
  var _window$Pelcro$user$r3;
20288
20754
 
@@ -20295,16 +20761,16 @@ const PaymentMethodSelectContainer = ({
20295
20761
  style: { ...style
20296
20762
  },
20297
20763
  className: `pelcro-container pelcro-payment-select-container ${className}`
20298
- }, /*#__PURE__*/React__default['default'].createElement(Provider$3, {
20764
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$4, {
20299
20765
  value: {
20300
20766
  state,
20301
20767
  dispatch
20302
20768
  }
20303
20769
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
20304
- store: store$3,
20770
+ store: store$4,
20305
20771
  key: i
20306
20772
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
20307
- store: store$3
20773
+ store: store$4
20308
20774
  })));
20309
20775
  };
20310
20776
 
@@ -20318,7 +20784,7 @@ const PaymentMethodSelectList = () => {
20318
20784
  paymentMethods,
20319
20785
  selectedPaymentMethodId
20320
20786
  }
20321
- } = React.useContext(store$3);
20787
+ } = React.useContext(store$4);
20322
20788
 
20323
20789
  const handlePaymentMethodSelect = event => {
20324
20790
  dispatch({
@@ -20368,7 +20834,7 @@ const PaymentMethodSelectSubmit = ({
20368
20834
  selectedPaymentMethodId,
20369
20835
  isSubmitting
20370
20836
  }
20371
- } = React.useContext(store$3);
20837
+ } = React.useContext(store$4);
20372
20838
  return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
20373
20839
  onClick: () => {
20374
20840
  dispatch({
@@ -23160,7 +23626,7 @@ const DashboardOpenButton = () => {
23160
23626
  };
23161
23627
  DashboardOpenButton.viewId = "dashboard-open";
23162
23628
 
23163
- const initialState$2 = {
23629
+ const initialState$3 = {
23164
23630
  imageSrc: null,
23165
23631
  crop: {
23166
23632
  x: 0,
@@ -23174,10 +23640,10 @@ const initialState$2 = {
23174
23640
  content: ""
23175
23641
  }
23176
23642
  };
23177
- const store$2 = /*#__PURE__*/React.createContext(initialState$2);
23643
+ const store$3 = /*#__PURE__*/React.createContext(initialState$3);
23178
23644
  const {
23179
- Provider: Provider$2
23180
- } = store$2;
23645
+ Provider: Provider$3
23646
+ } = store$3;
23181
23647
 
23182
23648
  const ProfilePicChangeContainer = ({
23183
23649
  style,
@@ -23311,21 +23777,21 @@ const ProfilePicChangeContainer = ({
23311
23777
  default:
23312
23778
  return state;
23313
23779
  }
23314
- }, initialState$2);
23780
+ }, initialState$3);
23315
23781
  return /*#__PURE__*/React__default['default'].createElement("div", {
23316
23782
  style: { ...style
23317
23783
  },
23318
23784
  className: `pelcro-container pelcro-profile-picture-container ${className}`
23319
- }, /*#__PURE__*/React__default['default'].createElement(Provider$2, {
23785
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$3, {
23320
23786
  value: {
23321
23787
  state,
23322
23788
  dispatch
23323
23789
  }
23324
23790
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
23325
- store: store$2,
23791
+ store: store$3,
23326
23792
  key: i
23327
23793
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
23328
- store: store$2
23794
+ store: store$3
23329
23795
  })));
23330
23796
  };
23331
23797
  /**
@@ -23387,7 +23853,7 @@ const ProfilePicChangeButton = ({
23387
23853
  isSubmitting
23388
23854
  },
23389
23855
  dispatch
23390
- } = React.useContext(store$2);
23856
+ } = React.useContext(store$3);
23391
23857
  const {
23392
23858
  t
23393
23859
  } = useTranslation("userEdit");
@@ -24755,7 +25221,7 @@ const ProfilePicChangeCropper = ({
24755
25221
  zoom
24756
25222
  },
24757
25223
  dispatch
24758
- } = React.useContext(store$2);
25224
+ } = React.useContext(store$3);
24759
25225
  return /*#__PURE__*/React__default['default'].createElement("div", {
24760
25226
  className: `plc-relative plc-w-full plc-h-52 sm:plc-h-96 ${className}`
24761
25227
  }, /*#__PURE__*/React__default['default'].createElement(Cropper, Object.assign({
@@ -24797,7 +25263,7 @@ const ProfilePicChangeZoom = ({
24797
25263
  zoom
24798
25264
  },
24799
25265
  dispatch
24800
- } = React.useContext(store$2);
25266
+ } = React.useContext(store$3);
24801
25267
  const {
24802
25268
  t
24803
25269
  } = useTranslation("userEdit");
@@ -24849,7 +25315,7 @@ const ProfilePicChangeSelectButton = ({
24849
25315
  state: {
24850
25316
  isSubmitting
24851
25317
  }
24852
- } = React.useContext(store$2);
25318
+ } = React.useContext(store$3);
24853
25319
  const {
24854
25320
  t
24855
25321
  } = useTranslation("userEdit");
@@ -24891,7 +25357,7 @@ const ProfilePicChangeRemoveButton = ({
24891
25357
  state: {
24892
25358
  isSubmitting
24893
25359
  }
24894
- } = React.useContext(store$2);
25360
+ } = React.useContext(store$3);
24895
25361
  const {
24896
25362
  t
24897
25363
  } = useTranslation("userEdit");
@@ -24914,7 +25380,7 @@ const ProfilePicChangeWrapper = () => {
24914
25380
  state: {
24915
25381
  imageSrc
24916
25382
  }
24917
- } = React.useContext(store$2);
25383
+ } = React.useContext(store$3);
24918
25384
  const {
24919
25385
  t
24920
25386
  } = useTranslation("userEdit");
@@ -24976,17 +25442,17 @@ function ProfilePicChangeModal({
24976
25442
  }
24977
25443
  ProfilePicChangeModal.viewId = "profile-picture";
24978
25444
 
24979
- const initialState$1 = {
25445
+ const initialState$2 = {
24980
25446
  isSubmitting: false,
24981
25447
  alert: {
24982
25448
  type: "error",
24983
25449
  content: ""
24984
25450
  }
24985
25451
  };
24986
- const store$1 = /*#__PURE__*/React.createContext(initialState$1);
25452
+ const store$2 = /*#__PURE__*/React.createContext(initialState$2);
24987
25453
  const {
24988
- Provider: Provider$1
24989
- } = store$1;
25454
+ Provider: Provider$2
25455
+ } = store$2;
24990
25456
 
24991
25457
  const EmailVerifyContainer = ({
24992
25458
  style,
@@ -25049,21 +25515,21 @@ const EmailVerifyContainer = ({
25049
25515
  default:
25050
25516
  return state;
25051
25517
  }
25052
- }, initialState$1);
25518
+ }, initialState$2);
25053
25519
  return /*#__PURE__*/React__default['default'].createElement("div", {
25054
25520
  style: { ...style
25055
25521
  },
25056
25522
  className: `pelcro-container pelcro-email-verify-container ${className}`
25057
- }, /*#__PURE__*/React__default['default'].createElement(Provider$1, {
25523
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$2, {
25058
25524
  value: {
25059
25525
  state,
25060
25526
  dispatch
25061
25527
  }
25062
25528
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
25063
- store: store$1,
25529
+ store: store$2,
25064
25530
  key: i
25065
25531
  })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
25066
- store: store$1
25532
+ store: store$2
25067
25533
  })));
25068
25534
  };
25069
25535
 
@@ -25077,7 +25543,7 @@ const EmailVerifyResendButton = ({
25077
25543
  state: {
25078
25544
  isSubmitting
25079
25545
  }
25080
- } = React.useContext(store$1);
25546
+ } = React.useContext(store$2);
25081
25547
  const {
25082
25548
  t
25083
25549
  } = useTranslation("verifyEmail");
@@ -25152,6 +25618,170 @@ const EmailVerifyModal = ({
25152
25618
  };
25153
25619
  EmailVerifyModal.viewId = "email-verify";
25154
25620
 
25621
+ const initialState$1 = {
25622
+ isLoading: true,
25623
+ isTokenValid: false,
25624
+ alert: {
25625
+ type: "error",
25626
+ content: ""
25627
+ }
25628
+ };
25629
+ const store$1 = /*#__PURE__*/React.createContext(initialState$1);
25630
+ const {
25631
+ Provider: Provider$1
25632
+ } = store$1;
25633
+
25634
+ const VerifyLinkTokenContainer = ({
25635
+ style,
25636
+ className = "",
25637
+ onSuccess = () => {},
25638
+ onFailure = () => {},
25639
+ children
25640
+ }) => {
25641
+ const handleVerifyLinkToken = ({}, dispatch) => {
25642
+ const token = window.Pelcro.helpers.getURLParameter("token");
25643
+ window.Pelcro.user.verifyLoginToken({
25644
+ token
25645
+ }, (err, res) => {
25646
+ dispatch({
25647
+ type: LOADING,
25648
+ payload: false
25649
+ });
25650
+
25651
+ if (err) {
25652
+ dispatch({
25653
+ type: SHOW_ALERT,
25654
+ payload: {
25655
+ type: "error",
25656
+ content: getErrorMessages(err)
25657
+ }
25658
+ });
25659
+ onFailure(err);
25660
+ } else {
25661
+ onSuccess(res);
25662
+ }
25663
+ });
25664
+ };
25665
+
25666
+ const [state, dispatch] = useReducerWithSideEffects((state, action) => {
25667
+ switch (action.type) {
25668
+ case SHOW_ALERT:
25669
+ return lib_7({ ...state,
25670
+ alert: action.payload
25671
+ });
25672
+
25673
+ case LOADING:
25674
+ return lib_7({ ...state,
25675
+ isLoading: action.payload
25676
+ });
25677
+
25678
+ case LINK_TOKEN_VERIFY:
25679
+ return lib_5({ ...state,
25680
+ isLoading: true
25681
+ }, (state, dispatch) => handleVerifyLinkToken(state, dispatch));
25682
+
25683
+ default:
25684
+ return state;
25685
+ }
25686
+ }, initialState$1);
25687
+ return /*#__PURE__*/React__default['default'].createElement("div", {
25688
+ style: { ...style
25689
+ },
25690
+ className: `pelcro-container pelcro-login-container ${className}`
25691
+ }, /*#__PURE__*/React__default['default'].createElement(Provider$1, {
25692
+ value: {
25693
+ state,
25694
+ dispatch
25695
+ }
25696
+ }, children.length ? children.map((child, i) => {
25697
+ if (child) {
25698
+ return /*#__PURE__*/React__default['default'].cloneElement(child, {
25699
+ store: store$1,
25700
+ key: i
25701
+ });
25702
+ }
25703
+ }) : /*#__PURE__*/React__default['default'].cloneElement(children, {
25704
+ store: store$1
25705
+ })));
25706
+ };
25707
+
25708
+ const VerifyLinkTokenLoader = () => {
25709
+ React.useEffect(() => {
25710
+ dispatch({
25711
+ type: LINK_TOKEN_VERIFY
25712
+ });
25713
+ }, []);
25714
+ const {
25715
+ dispatch,
25716
+ state: {
25717
+ isLoading
25718
+ }
25719
+ } = React.useContext(store$1);
25720
+
25721
+ if (isLoading) {
25722
+ return /*#__PURE__*/React__default['default'].createElement(Loader, {
25723
+ width: 60,
25724
+ height: 100
25725
+ });
25726
+ }
25727
+
25728
+ return /*#__PURE__*/React__default['default'].createElement("div", {
25729
+ className: "plc-max-h-80 plc-overflow-y-auto pelcro-newsletters-wrapper"
25730
+ });
25731
+ };
25732
+
25733
+ /**
25734
+ *
25735
+ */
25736
+
25737
+ function VerifyLinkTokenView(props) {
25738
+ const {
25739
+ t
25740
+ } = useTranslation("verifyLinkToken");
25741
+ return /*#__PURE__*/React__default['default'].createElement("div", {
25742
+ id: "pelcro-login-view"
25743
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
25744
+ className: "plc-mb-6 plc-text-2xl plc-font-semibold plc-text-center plc-text-gray-900 pelcro-title-wrapper"
25745
+ }, /*#__PURE__*/React__default['default'].createElement("h4", null, t("labels.title"))), /*#__PURE__*/React__default['default'].createElement("form", {
25746
+ action: "javascript:void(0);",
25747
+ className: "plc-mt-2 pelcro-form"
25748
+ }, /*#__PURE__*/React__default['default'].createElement(VerifyLinkTokenContainer, props, /*#__PURE__*/React__default['default'].createElement(VerifyLinkTokenLoader, null), /*#__PURE__*/React__default['default'].createElement(AlertWithContext, null))));
25749
+ }
25750
+
25751
+ /**
25752
+ *
25753
+ */
25754
+
25755
+ function VerifyLinkTokenModal({
25756
+ onDisplay,
25757
+ onClose,
25758
+ ...props
25759
+ }) {
25760
+ const {
25761
+ t
25762
+ } = useTranslation("verifyLinkToken");
25763
+ const {
25764
+ resetView
25765
+ } = usePelcro();
25766
+
25767
+ const onSuccess = res => {
25768
+ var _props$onSuccess;
25769
+
25770
+ (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
25771
+ resetView();
25772
+ notify.success(t("messages.success"));
25773
+ };
25774
+
25775
+ return /*#__PURE__*/React__default['default'].createElement(Modal, {
25776
+ id: "pelcro-login-modal",
25777
+ onDisplay: onDisplay,
25778
+ onClose: onClose
25779
+ }, /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(VerifyLinkTokenView, Object.assign({}, props, {
25780
+ onSuccess: onSuccess
25781
+ }))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
25782
+ }
25783
+ VerifyLinkTokenModal.viewId = "passwordless-login";
25784
+
25155
25785
  const InvoicePaymentContainer = props => /*#__PURE__*/React__default['default'].createElement(PaymentMethodContainer, Object.assign({
25156
25786
  type: "invoicePayment",
25157
25787
  className: "pelcro-invoice-payment-container"
@@ -25298,6 +25928,8 @@ const InvoiceDetailsView = props => {
25298
25928
  invoice
25299
25929
  } = usePelcro();
25300
25930
  const showPayButton = canPayInvoice(invoice);
25931
+ const showDownloadButton = Boolean(invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf);
25932
+ const hasPlanDetails = Boolean(invoice.plan);
25301
25933
  const creationDate = new Date(invoice === null || invoice === void 0 ? void 0 : invoice.created_at);
25302
25934
  const formattedCreationDate = new Intl.DateTimeFormat("en-CA").format(creationDate);
25303
25935
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -25315,7 +25947,7 @@ const InvoiceDetailsView = props => {
25315
25947
  className: "plc-font-bold pelcro-invoice-summary-title"
25316
25948
  }, t("labels.summary")), invoice && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("p", {
25317
25949
  className: "plc-mr-2 pelcro-invoice-creation-date"
25318
- }, `${t("labels.creationDate")} ${formattedCreationDate}`), /*#__PURE__*/React__default['default'].createElement("div", {
25950
+ }, `${t("labels.creationDate")} ${formattedCreationDate}`), hasPlanDetails && /*#__PURE__*/React__default['default'].createElement("div", {
25319
25951
  className: "plc-flex plc-items-center plc-pt-2 plc-mt-2 plc-border-t plc-border-gray-400 plc-min-h-12 plc-justify-between pelcro-invoice-plan-wrapper"
25320
25952
  }, /*#__PURE__*/React__default['default'].createElement("div", {
25321
25953
  className: "plc-break-words pelcro-invoice-plan-name"
@@ -25341,7 +25973,7 @@ const InvoiceDetailsView = props => {
25341
25973
  className: "plc-font-semibold pelcro-invoice-total"
25342
25974
  }, getFormattedPriceByLocal(invoice.amount_remaining, invoice.currency, getPageOrDefaultLanguage())))))), /*#__PURE__*/React__default['default'].createElement("div", {
25343
25975
  className: "plc-flex plc-items-center plc-justify-center plc-mt-4"
25344
- }, /*#__PURE__*/React__default['default'].createElement(InvoiceDetailsDownloadButton, {
25976
+ }, showDownloadButton && /*#__PURE__*/React__default['default'].createElement(InvoiceDetailsDownloadButton, {
25345
25977
  url: invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf,
25346
25978
  className: "plc-w-full plc-text-center"
25347
25979
  }), showPayButton && /*#__PURE__*/React__default['default'].createElement(InvoiceDetailsPayButton, {
@@ -25575,6 +26207,10 @@ exports.UserUpdatePhone = UserUpdatePhone;
25575
26207
  exports.UserUpdateProfilePic = UserUpdateProfilePic;
25576
26208
  exports.UserUpdateTextInput = UserUpdateTextInput;
25577
26209
  exports.UserUpdateView = UserUpdateView;
26210
+ exports.VerifyLinkTokenContainer = VerifyLinkTokenContainer;
26211
+ exports.VerifyLinkTokenLoader = VerifyLinkTokenLoader;
26212
+ exports.VerifyLinkTokenModal = VerifyLinkTokenModal;
26213
+ exports.VerifyLinkTokenView = VerifyLinkTokenView;
25578
26214
  exports.authenticatedButtons = authenticatedButtons;
25579
26215
  exports.i18n = i18next;
25580
26216
  exports.initButtons = init$1;