@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.esm.js CHANGED
@@ -3214,7 +3214,8 @@ function withTranslation(ns) {
3214
3214
  var validation$1 = {
3215
3215
  validEmail: "le courriel n’est pas valide",
3216
3216
  enterEmail: "Un courriel est requis.",
3217
- enterPassword: "Mot de passe requis."
3217
+ enterPassword: "Mot de passe requis.",
3218
+ confirmPassword: "Confirmer le mot de passe requis."
3218
3219
  };
3219
3220
  var buttons$9 = {
3220
3221
  account: "Accès abonné(e)s",
@@ -3302,7 +3303,8 @@ var common_fr = {
3302
3303
  var validation = {
3303
3304
  validEmail: "Email address is not valid.",
3304
3305
  enterEmail: "Email address is required.",
3305
- enterPassword: "Password is required."
3306
+ enterPassword: "Password is required.",
3307
+ confirmPassword: "Confirm password is required."
3306
3308
  };
3307
3309
  var buttons$8 = {
3308
3310
  account: "My account",
@@ -3434,7 +3436,7 @@ var paymentMethod_fr = {
3434
3436
  var title$f = "Enter your email to subscribe to our newsletter";
3435
3437
  var updateTitle$1 = "Update newsletter selections";
3436
3438
  var subtitle$7 = "We may use your email for other marketing communication";
3437
- var labels$p = {
3439
+ var labels$r = {
3438
3440
  submit: "Submit",
3439
3441
  firstName: "First name",
3440
3442
  lastName: "Last name",
@@ -3442,7 +3444,7 @@ var labels$p = {
3442
3444
  postalCode: "Postal code",
3443
3445
  required: "required"
3444
3446
  };
3445
- var messages$r = {
3447
+ var messages$t = {
3446
3448
  alreadyHaveAccount: "Already have an account?",
3447
3449
  success: "Newsletters were successfully updated",
3448
3450
  loginHere: "Login here.",
@@ -3453,14 +3455,14 @@ var newsletter_en = {
3453
3455
  title: title$f,
3454
3456
  updateTitle: updateTitle$1,
3455
3457
  subtitle: subtitle$7,
3456
- labels: labels$p,
3457
- messages: messages$r
3458
+ labels: labels$r,
3459
+ messages: messages$t
3458
3460
  };
3459
3461
 
3460
3462
  var title$e = "Entrez votre adresse courriel pour vous abonner à notre infolettre";
3461
3463
  var updateTitle = "Mettre à jour son choix d'infolettres";
3462
3464
  var subtitle$6 = "Nous pouvons utiliser votre adresse courriel pour d’autres communications marketing";
3463
- var labels$o = {
3465
+ var labels$q = {
3464
3466
  submit: "Lire l’article !",
3465
3467
  firstName: "Prénom",
3466
3468
  lastName: "Nom de famille",
@@ -3468,7 +3470,7 @@ var labels$o = {
3468
3470
  postalCode: "Code postal",
3469
3471
  required: "Champs obligatoires"
3470
3472
  };
3471
- var messages$q = {
3473
+ var messages$s = {
3472
3474
  alreadyHaveAccount: "Vous avez déjà un compte ?",
3473
3475
  success: "Votre choix d'infolettres à été mis à jour",
3474
3476
  loginHere: "Connectez-vous ici",
@@ -3479,14 +3481,14 @@ var newsletter_fr = {
3479
3481
  title: title$e,
3480
3482
  updateTitle: updateTitle,
3481
3483
  subtitle: subtitle$6,
3482
- labels: labels$o,
3483
- messages: messages$q
3484
+ labels: labels$q,
3485
+ messages: messages$s
3484
3486
  };
3485
3487
 
3486
- var labels$n = {
3488
+ var labels$p = {
3487
3489
  "continue": "Continue to content"
3488
3490
  };
3489
- var messages$p = {
3491
+ var messages$r = {
3490
3492
  yourFreeTrial: "Subscription successful!",
3491
3493
  youHaveAccess: "Hope you enjoy the subscription. Please contact us if you have any questions or concerns.",
3492
3494
  clickToLearn: {
@@ -3512,15 +3514,15 @@ var errors$9 = {
3512
3514
  "": ""
3513
3515
  };
3514
3516
  var success_en = {
3515
- labels: labels$n,
3516
- messages: messages$p,
3517
+ labels: labels$p,
3518
+ messages: messages$r,
3517
3519
  errors: errors$9
3518
3520
  };
3519
3521
 
3520
- var labels$m = {
3522
+ var labels$o = {
3521
3523
  "continue": "Abonnement réussi !"
3522
3524
  };
3523
- var messages$o = {
3525
+ var messages$q = {
3524
3526
  yourFreeTrial: "Votre essai gratuit vient de débuter",
3525
3527
  youHaveAccess: "Nous espérons que vous allez apprécier votre abonnement. Veuillez nous contacter si vous avez des questions ou des préoccupations.",
3526
3528
  clickToLearn: {
@@ -3546,12 +3548,12 @@ var errors$8 = {
3546
3548
  "": ""
3547
3549
  };
3548
3550
  var success_fr = {
3549
- labels: labels$m,
3550
- messages: messages$o,
3551
+ labels: labels$o,
3552
+ messages: messages$q,
3551
3553
  errors: errors$8
3552
3554
  };
3553
3555
 
3554
- var messages$n = {
3556
+ var messages$p = {
3555
3557
  freeVisits: "Free visits left:",
3556
3558
  subscribeNow: "Subscribe",
3557
3559
  alreadyHaveAccount: "Already have an account?",
@@ -3561,11 +3563,11 @@ var errors$7 = {
3561
3563
  "": ""
3562
3564
  };
3563
3565
  var meter_en = {
3564
- messages: messages$n,
3566
+ messages: messages$p,
3565
3567
  errors: errors$7
3566
3568
  };
3567
3569
 
3568
- var messages$m = {
3570
+ var messages$o = {
3569
3571
  freeVisits: "Visites gratuites restantes:",
3570
3572
  subscribeNow: "Abonnez-vous maintenant !",
3571
3573
  alreadyHaveAccount: "Vous avez déjà un compte ?",
@@ -3575,15 +3577,15 @@ var errors$6 = {
3575
3577
  "": ""
3576
3578
  };
3577
3579
  var meter_fr = {
3578
- messages: messages$m,
3580
+ messages: messages$o,
3579
3581
  errors: errors$6
3580
3582
  };
3581
3583
 
3582
- var messages$l = {
3584
+ var messages$n = {
3583
3585
  youAreSafe: "You're safe - PCI compliant 128 SSL by",
3584
3586
  bankRedirection: "Please hold, redirecting you to your bank."
3585
3587
  };
3586
- var labels$l = {
3588
+ var labels$n = {
3587
3589
  card: "Enter card number",
3588
3590
  date: "Expiration date",
3589
3591
  CVC: "CVC",
@@ -3602,15 +3604,15 @@ var labels$l = {
3602
3604
  removeCoupon: "REMOVE"
3603
3605
  };
3604
3606
  var checkoutForm_en = {
3605
- messages: messages$l,
3606
- labels: labels$l
3607
+ messages: messages$n,
3608
+ labels: labels$n
3607
3609
  };
3608
3610
 
3609
- var messages$k = {
3611
+ var messages$m = {
3610
3612
  youAreSafe: "Vous êtes en sécurité - PCI conforme 128 SSL par",
3611
3613
  bankRedirection: "Veuillez patienter, nous vous redirigeons vers votre banque."
3612
3614
  };
3613
- var labels$k = {
3615
+ var labels$m = {
3614
3616
  card: "Entrez le numéro de carte",
3615
3617
  date: "Date d’expiration",
3616
3618
  CVC: "CVC",
@@ -3629,8 +3631,8 @@ var labels$k = {
3629
3631
  removeCoupon: "RETIRER"
3630
3632
  };
3631
3633
  var checkoutForm_fr = {
3632
- messages: messages$k,
3633
- labels: labels$k
3634
+ messages: messages$m,
3635
+ labels: labels$m
3634
3636
  };
3635
3637
 
3636
3638
  var youAreSafe$1 = "You're safe - PCI compliant 128 SSL by";
@@ -3671,7 +3673,7 @@ var messages_fr = {
3671
3673
  zeroTotalInvoice: zeroTotalInvoice
3672
3674
  };
3673
3675
 
3674
- var labels$j = {
3676
+ var labels$l = {
3675
3677
  email: "Enter email",
3676
3678
  password: "Enter password",
3677
3679
  required: "required",
@@ -3679,7 +3681,7 @@ var labels$j = {
3679
3681
  passwordPlaceholder: "Password",
3680
3682
  login: "Login"
3681
3683
  };
3682
- var messages$j = {
3684
+ var messages$l = {
3683
3685
  loginTo: "Login to your account",
3684
3686
  welcome: "Welcome back, sign in with your existing account.",
3685
3687
  dontHaveAccount: "Don't have an account yet?",
@@ -3698,12 +3700,12 @@ var errors$5 = {
3698
3700
  "": ""
3699
3701
  };
3700
3702
  var login_en = {
3701
- labels: labels$j,
3702
- messages: messages$j,
3703
+ labels: labels$l,
3704
+ messages: messages$l,
3703
3705
  errors: errors$5
3704
3706
  };
3705
3707
 
3706
- var labels$i = {
3708
+ var labels$k = {
3707
3709
  email: "Entrez votre adresse courriel",
3708
3710
  password: "Entrez votre mot de passe",
3709
3711
  required: "Champs obligatoires",
@@ -3711,7 +3713,7 @@ var labels$i = {
3711
3713
  passwordPlaceholder: "Mot de passe",
3712
3714
  login: "Connexion"
3713
3715
  };
3714
- var messages$i = {
3716
+ var messages$k = {
3715
3717
  loginTo: "Connectez-vous à votre compte",
3716
3718
  welcome: "Bienvenue, connectez-vous avec votre compte existant.",
3717
3719
  dontHaveAccount: "Vous n’avez pas encore de compte ?",
@@ -3730,11 +3732,39 @@ var errors$4 = {
3730
3732
  "": ""
3731
3733
  };
3732
3734
  var login_fr = {
3733
- labels: labels$i,
3734
- messages: messages$i,
3735
+ labels: labels$k,
3736
+ messages: messages$k,
3735
3737
  errors: errors$4
3736
3738
  };
3737
3739
 
3740
+ var labels$j = {
3741
+ title: "Verifying Magin Link",
3742
+ instructions: "You're on your way!\nLet's confirm your email address.\nClick on the verification link we've sent to your email:",
3743
+ resend: "Resend email"
3744
+ };
3745
+ var messages$j = {
3746
+ resent: "Resent successfully",
3747
+ success: "Link verified successfully!"
3748
+ };
3749
+ var verifyLinkToken_en = {
3750
+ labels: labels$j,
3751
+ messages: messages$j
3752
+ };
3753
+
3754
+ var labels$i = {
3755
+ title: "Confirmez votre courriel",
3756
+ instructions: "Confirmez votre courriel.\nVeuillez cliquer sur le lien de vérification, qui vous a été envoyé à:",
3757
+ resend: "Renvoyer le courriel"
3758
+ };
3759
+ var messages$i = {
3760
+ resent: "Renvoyé avec succès",
3761
+ success: "Lien vérifiée avec succès"
3762
+ };
3763
+ var verifyLinkToken_fr = {
3764
+ labels: labels$i,
3765
+ messages: messages$i
3766
+ };
3767
+
3738
3768
  var title$d = "Create an account";
3739
3769
  var subtitle$5 = "Enter your email and password below";
3740
3770
  var labels$h = {
@@ -4654,17 +4684,17 @@ var invoiceDetails_en = {
4654
4684
  buttons: buttons$1
4655
4685
  };
4656
4686
 
4657
- var title = "Invoice details";
4687
+ var title = "Détails de la facture";
4658
4688
  var labels = {
4659
- summary: "Summary",
4689
+ summary: "Résumé",
4660
4690
  total: "Total",
4661
- amountPaid: "Amount paid",
4662
- amountDue: "Amount due",
4663
- creationDate: "Created on:"
4691
+ amountPaid: "Montant payé",
4692
+ amountDue: "Montant ",
4693
+ creationDate: "Créé le:"
4664
4694
  };
4665
4695
  var buttons = {
4666
- download: "Download",
4667
- pay: "Pay now"
4696
+ download: "Télécharger",
4697
+ pay: "Payer"
4668
4698
  };
4669
4699
  var invoiceDetails_fr = {
4670
4700
  title: title,
@@ -6021,7 +6051,7 @@ class PelcroActions {
6021
6051
  view,
6022
6052
  cartItems,
6023
6053
  ...otherStateFields
6024
- } = initialState$i;
6054
+ } = initialState$j;
6025
6055
  this.set(otherStateFields);
6026
6056
  });
6027
6057
 
@@ -6340,7 +6370,7 @@ class PelcroCallbacks {
6340
6370
 
6341
6371
  }
6342
6372
 
6343
- const initialState$i = {
6373
+ const initialState$j = {
6344
6374
  // View
6345
6375
  view: null,
6346
6376
  // Plans
@@ -6370,7 +6400,7 @@ const createPelcroStore = () => createStore(middleware_3((set, get) => {
6370
6400
  return {
6371
6401
  // Store setter
6372
6402
  set,
6373
- ...initialState$i,
6403
+ ...initialState$j,
6374
6404
  // State actions
6375
6405
  ...actions,
6376
6406
  // Callbacks
@@ -6406,6 +6436,19 @@ if (process.env.NODE_ENV === "development") {
6406
6436
  c$1("Pelcro Store", usePelcro);
6407
6437
  }
6408
6438
 
6439
+ /**
6440
+ * List of zero-decimal currencies.
6441
+ * @see https://stripe.com/docs/currencies#zero-decimal
6442
+ *
6443
+ */
6444
+
6445
+ const ZERO_DECIMAL_CURRENCIES = ['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'];
6446
+ /**
6447
+ * @param {string}
6448
+ * @return {boolean}
6449
+ */
6450
+
6451
+ const isCurrencyZeroDecimal = currency => ZERO_DECIMAL_CURRENCIES.includes(currency);
6409
6452
  const sortCountries = countries => {
6410
6453
  const sortable = [];
6411
6454
  delete countries.CA;
@@ -6492,7 +6535,7 @@ const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en") => {
6492
6535
  style: "currency",
6493
6536
  currency
6494
6537
  });
6495
- return formatter.format(amount / 100);
6538
+ return isCurrencyZeroDecimal(currency) ? formatter.format(amount) : formatter.format(amount / 100);
6496
6539
  };
6497
6540
  /** check wether or not the user have any addresses
6498
6541
  * @return {boolean} true if the user have at least one address, false otherwise
@@ -6509,7 +6552,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
6509
6552
  let totalWithoutDividingBy100 = 0;
6510
6553
 
6511
6554
  for (const item of items) {
6512
- totalWithoutDividingBy100 += parseFloat(item.price ? (item.price * item.quantity).toFixed(2) : item.amount.toFixed(2));
6555
+ totalWithoutDividingBy100 += parseFloat(item.price ? isCurrencyZeroDecimal(currency) ? item.price * item.quantity : (item.price * item.quantity).toFixed(2) : isCurrencyZeroDecimal(currency) ? item.amount : item.amount.toFixed(2));
6513
6556
  }
6514
6557
 
6515
6558
  return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
@@ -6521,7 +6564,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
6521
6564
  */
6522
6565
 
6523
6566
  const isValidViewFromURL = viewID => {
6524
- 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()) {
6567
+ 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()) {
6525
6568
  return true;
6526
6569
  }
6527
6570
 
@@ -6589,7 +6632,7 @@ const disableScroll = () => {
6589
6632
  }
6590
6633
  };
6591
6634
  const trackSubscriptionOnGA = () => {
6592
- 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;
6635
+ 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;
6593
6636
 
6594
6637
  const {
6595
6638
  product,
@@ -6610,13 +6653,14 @@ const trackSubscriptionOnGA = () => {
6610
6653
  return;
6611
6654
  }
6612
6655
 
6656
+ 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;
6613
6657
  ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
6614
- 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
6658
+ currencyCode: currencyCode
6615
6659
  });
6616
6660
  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", {
6617
6661
  id: lastSubscriptionId,
6618
6662
  affiliation: "Pelcro",
6619
- revenue: plan !== null && plan !== void 0 && plan.amount ? plan.amount / 100 : 0,
6663
+ revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
6620
6664
  coupon: couponCode
6621
6665
  });
6622
6666
  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", {
@@ -6624,7 +6668,7 @@ const trackSubscriptionOnGA = () => {
6624
6668
  name: product.name,
6625
6669
  category: product.description,
6626
6670
  variant: plan.nickname,
6627
- price: plan !== null && plan !== void 0 && plan.amount ? plan.amount / 100 : 0,
6671
+ price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
6628
6672
  quantity: 1
6629
6673
  });
6630
6674
  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");
@@ -6736,6 +6780,7 @@ const resources = {
6736
6780
  checkoutForm: checkoutForm_en,
6737
6781
  messages: messages_en,
6738
6782
  login: login_en,
6783
+ verifyLinkToken: verifyLinkToken_en,
6739
6784
  register: register_en,
6740
6785
  userEdit: userEdit_en,
6741
6786
  address: address_en,
@@ -6760,6 +6805,7 @@ const resources = {
6760
6805
  checkoutForm: checkoutForm_fr,
6761
6806
  messages: messages_fr,
6762
6807
  login: login_fr,
6808
+ verifyLinkToken: verifyLinkToken_fr,
6763
6809
  register: register_fr,
6764
6810
  userEdit: userEdit_fr,
6765
6811
  address: address_fr,
@@ -8619,13 +8665,21 @@ const getErrorMessages = error => {
8619
8665
  return error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : (_error$response4$data = _error$response4.data) === null || _error$response4$data === void 0 ? void 0 : (_error$response4$data2 = _error$response4$data.error) === null || _error$response4$data2 === void 0 ? void 0 : _error$response4$data2.message;
8620
8666
  }
8621
8667
 
8622
- const errorMessages = []; // enumerable error (ex: validation errors)
8668
+ 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) {
8669
+ var _error$response6, _error$response6$data;
8670
+
8671
+ const errorMessages = []; // enumerable error (ex: validation errors)
8623
8672
 
8624
- 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]) => {
8625
- errorMessages.push(errorMessage);
8626
- }); // convert to multiline string
8673
+ 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]) => {
8674
+ errorMessages.push(errorMessage);
8675
+ }); // convert to multiline string
8676
+
8677
+ return errorMessages.join("\n");
8678
+ }
8627
8679
 
8628
- return errorMessages.join("\n");
8680
+ if (error !== null && error !== void 0 && error.message) {
8681
+ return error.message;
8682
+ }
8629
8683
  };
8630
8684
  /**
8631
8685
  * Executes function after a wait time of inactivity
@@ -8657,7 +8711,7 @@ const debounce = (func, waitTime) => {
8657
8711
  function getSiteCardProcessor() {
8658
8712
  var _window$Pelcro$site$r;
8659
8713
 
8660
- if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_pay_page_id) {
8714
+ if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_gateway_settings) {
8661
8715
  return "vantiv";
8662
8716
  }
8663
8717
 
@@ -8753,7 +8807,7 @@ const loadPaymentSDKs = () => {
8753
8807
  } // Load Vantiv SDKs
8754
8808
 
8755
8809
 
8756
- const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_pay_page_id);
8810
+ const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
8757
8811
 
8758
8812
  if (supportsVantiv) {
8759
8813
  if (!window.jQuery) {
@@ -8761,7 +8815,10 @@ const loadPaymentSDKs = () => {
8761
8815
  }
8762
8816
 
8763
8817
  if (!window.EprotectIframeClient) {
8764
- window.Pelcro.helpers.loadSDK("https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js", "vantiv-eprotect-sdk");
8818
+ const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
8819
+ const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client4.min.js";
8820
+ const scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? PRODUCTION_URL : PRELIVE_URL;
8821
+ window.Pelcro.helpers.loadSDK(scriptUrlToUse, "vantiv-eprotect-sdk");
8765
8822
  }
8766
8823
  }
8767
8824
  };
@@ -8921,6 +8978,10 @@ const initViewFromURL = () => {
8921
8978
  return verifyEmailTokenFromUrl();
8922
8979
  }
8923
8980
 
8981
+ if (view === "passwordless-login") {
8982
+ return verifyLinkTokenFromUrl();
8983
+ }
8984
+
8924
8985
  if (view === "invoice-details") {
8925
8986
  return showInvoiceDetailsFromUrl();
8926
8987
  }
@@ -9101,6 +9162,18 @@ const verifyEmailTokenFromUrl = () => {
9101
9162
  });
9102
9163
  };
9103
9164
 
9165
+ const verifyLinkTokenFromUrl = () => {
9166
+ var _window$Pelcro$user$i, _window$Pelcro$user;
9167
+
9168
+ 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;
9169
+ const loginToken = window.Pelcro.helpers.getURLParameter("token");
9170
+ if (isAlreadyLoggedIn || !loginToken) return;
9171
+ const {
9172
+ switchView
9173
+ } = usePelcro.getStore();
9174
+ return switchView("passwordless-login");
9175
+ };
9176
+
9104
9177
  const showInvoiceDetailsFromUrl = () => {
9105
9178
  const {
9106
9179
  isAuthenticated,
@@ -9476,8 +9549,9 @@ const LOAD_PAYMENT_METHODS = "LOAD_PAYMENT_METHODS";
9476
9549
  const GET_NEWSLETTERS_FETCH = "GET_NEWSLETTERS_FETCH";
9477
9550
  const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
9478
9551
  const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
9552
+ const LINK_TOKEN_VERIFY = "LINK_TOKEN_VERIFY";
9479
9553
 
9480
- const initialState$h = {
9554
+ const initialState$i = {
9481
9555
  email: "",
9482
9556
  password: "",
9483
9557
  emailError: null,
@@ -9488,10 +9562,10 @@ const initialState$h = {
9488
9562
  content: ""
9489
9563
  }
9490
9564
  };
9491
- const store$h = /*#__PURE__*/createContext(initialState$h);
9565
+ const store$i = /*#__PURE__*/createContext(initialState$i);
9492
9566
  const {
9493
- Provider: Provider$h
9494
- } = store$h;
9567
+ Provider: Provider$i
9568
+ } = store$i;
9495
9569
 
9496
9570
  const LoginContainer = ({
9497
9571
  style,
@@ -9598,7 +9672,7 @@ const LoginContainer = ({
9598
9672
  });
9599
9673
 
9600
9674
  case RESET_LOGIN_FORM:
9601
- return initialState$h;
9675
+ return initialState$i;
9602
9676
 
9603
9677
  case DISABLE_LOGIN_BUTTON:
9604
9678
  return lib_7({ ...state,
@@ -9616,12 +9690,12 @@ const LoginContainer = ({
9616
9690
  default:
9617
9691
  return state;
9618
9692
  }
9619
- }, initialState$h);
9693
+ }, initialState$i);
9620
9694
  return /*#__PURE__*/React__default.createElement("div", {
9621
9695
  style: { ...style
9622
9696
  },
9623
9697
  className: `pelcro-container pelcro-login-container ${className}`
9624
- }, /*#__PURE__*/React__default.createElement(Provider$h, {
9698
+ }, /*#__PURE__*/React__default.createElement(Provider$i, {
9625
9699
  value: {
9626
9700
  state,
9627
9701
  dispatch
@@ -9629,12 +9703,12 @@ const LoginContainer = ({
9629
9703
  }, children.length ? children.map((child, i) => {
9630
9704
  if (child) {
9631
9705
  return /*#__PURE__*/React__default.cloneElement(child, {
9632
- store: store$h,
9706
+ store: store$i,
9633
9707
  key: i
9634
9708
  });
9635
9709
  }
9636
9710
  }) : /*#__PURE__*/React__default.cloneElement(children, {
9637
- store: store$h
9711
+ store: store$i
9638
9712
  })));
9639
9713
  };
9640
9714
 
@@ -9804,6 +9878,9 @@ function ConfirmPassword({
9804
9878
  store,
9805
9879
  ...otherProps
9806
9880
  }) {
9881
+ const {
9882
+ t
9883
+ } = useTranslation("common");
9807
9884
  const {
9808
9885
  dispatch,
9809
9886
  state: {
@@ -9828,7 +9905,7 @@ function ConfirmPassword({
9828
9905
  } else if (finishedTyping) {
9829
9906
  dispatch({
9830
9907
  type: SET_CONFIRM_PASSWORD_ERROR,
9831
- payload: "Confirm password is required."
9908
+ payload: t("validation.confirmPassword")
9832
9909
  });
9833
9910
  }
9834
9911
  }, [dispatch, password, finishedTyping]);
@@ -9879,7 +9956,7 @@ const LoginButton = ({
9879
9956
  buttonDisabled
9880
9957
  },
9881
9958
  dispatch
9882
- } = useContext(store$h);
9959
+ } = useContext(store$i);
9883
9960
  const {
9884
9961
  t
9885
9962
  } = useTranslation("login");
@@ -9900,11 +9977,11 @@ const LoginButton = ({
9900
9977
  };
9901
9978
 
9902
9979
  const LoginEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
9903
- store: store$h
9980
+ store: store$i
9904
9981
  }, props));
9905
9982
 
9906
9983
  const LoginPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
9907
- store: store$h
9984
+ store: store$i
9908
9985
  }, props));
9909
9986
 
9910
9987
  var _path$r;
@@ -9981,7 +10058,7 @@ var facebookLoginRenderProps = createCommonjsModule(function (module, exports) {
9981
10058
  var FacebookLogin = unwrapExports(facebookLoginRenderProps);
9982
10059
  facebookLoginRenderProps.FacebookLogin;
9983
10060
 
9984
- const initialState$g = {
10061
+ const initialState$h = {
9985
10062
  email: "",
9986
10063
  password: "",
9987
10064
  emailError: null,
@@ -9998,10 +10075,10 @@ const initialState$g = {
9998
10075
  content: ""
9999
10076
  }
10000
10077
  };
10001
- const store$g = /*#__PURE__*/createContext(initialState$g);
10078
+ const store$h = /*#__PURE__*/createContext(initialState$h);
10002
10079
  const {
10003
- Provider: Provider$g
10004
- } = store$g;
10080
+ Provider: Provider$h
10081
+ } = store$h;
10005
10082
 
10006
10083
  const RegisterContainer = ({
10007
10084
  style,
@@ -10184,7 +10261,7 @@ const RegisterContainer = ({
10184
10261
  });
10185
10262
 
10186
10263
  case RESET_LOGIN_FORM:
10187
- return initialState$g;
10264
+ return initialState$h;
10188
10265
 
10189
10266
  case DISABLE_REGISTRATION_BUTTON:
10190
10267
  return lib_7({ ...state,
@@ -10202,12 +10279,12 @@ const RegisterContainer = ({
10202
10279
  default:
10203
10280
  return state;
10204
10281
  }
10205
- }, initialState$g);
10282
+ }, initialState$h);
10206
10283
  return /*#__PURE__*/React__default.createElement("div", {
10207
10284
  style: { ...style
10208
10285
  },
10209
10286
  className: `pelcro-container pelcro-register-container ${className}`
10210
- }, /*#__PURE__*/React__default.createElement(Provider$g, {
10287
+ }, /*#__PURE__*/React__default.createElement(Provider$h, {
10211
10288
  value: {
10212
10289
  state,
10213
10290
  dispatch
@@ -10215,12 +10292,12 @@ const RegisterContainer = ({
10215
10292
  }, children.length ? children.map((child, i) => {
10216
10293
  if (child) {
10217
10294
  return /*#__PURE__*/React__default.cloneElement(child, {
10218
- store: store$g,
10295
+ store: store$h,
10219
10296
  key: i
10220
10297
  });
10221
10298
  }
10222
10299
  }) : /*#__PURE__*/React__default.cloneElement(children, {
10223
- store: store$g
10300
+ store: store$h
10224
10301
  })));
10225
10302
  };
10226
10303
  /**
@@ -10260,10 +10337,10 @@ const FacebookLoginButton = ({
10260
10337
  const facebookLoginEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id;
10261
10338
  const {
10262
10339
  dispatch: loginDispatch
10263
- } = useContext(store$h);
10340
+ } = useContext(store$i);
10264
10341
  const {
10265
10342
  dispatch: registerDispatch
10266
- } = useContext(store$g);
10343
+ } = useContext(store$h);
10267
10344
 
10268
10345
  const onSuccess = facebookUser => {
10269
10346
  loginDispatch === null || loginDispatch === void 0 ? void 0 : loginDispatch({
@@ -10350,10 +10427,10 @@ const GoogleLoginButton = ({
10350
10427
  const googleLoginEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.google_app_id;
10351
10428
  const {
10352
10429
  dispatch: loginDispatch
10353
- } = useContext(store$h);
10430
+ } = useContext(store$i);
10354
10431
  const {
10355
10432
  dispatch: registerDispatch
10356
- } = useContext(store$g);
10433
+ } = useContext(store$h);
10357
10434
 
10358
10435
  const onSuccess = response => {
10359
10436
  var _response$getAuthResp, _profile$getEmail, _profile$getGivenName, _profile$getFamilyNam, _profile$getEmail2, _profile$getGivenName2, _profile$getFamilyNam2;
@@ -10449,10 +10526,10 @@ const Auth0LoginButton = ({
10449
10526
  }, [auth0Enabled, auth0Loaded]);
10450
10527
  const {
10451
10528
  dispatch: loginDispatch
10452
- } = useContext(store$h);
10529
+ } = useContext(store$i);
10453
10530
  const {
10454
10531
  dispatch: registerDispatch
10455
- } = useContext(store$g);
10532
+ } = useContext(store$h);
10456
10533
 
10457
10534
  function handleClick() {
10458
10535
  var _auth0InstanceRef$cur, _auth0InstanceRef$cur2, _auth0InstanceRef$cur3;
@@ -10740,11 +10817,11 @@ function LoginModal({
10740
10817
  LoginModal.viewId = "login";
10741
10818
 
10742
10819
  const RegisterEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
10743
- store: store$g
10820
+ store: store$h
10744
10821
  }, props));
10745
10822
 
10746
10823
  const RegisterPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
10747
- store: store$g
10824
+ store: store$h
10748
10825
  }, props));
10749
10826
 
10750
10827
  const RegisterButton = ({
@@ -10764,7 +10841,7 @@ const RegisterButton = ({
10764
10841
  buttonDisabled
10765
10842
  },
10766
10843
  dispatch
10767
- } = useContext(store$g);
10844
+ } = useContext(store$h);
10768
10845
  const {
10769
10846
  t
10770
10847
  } = useTranslation("register");
@@ -10902,7 +10979,7 @@ function FirstName({
10902
10979
  }
10903
10980
 
10904
10981
  const RegisterFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
10905
- store: store$g
10982
+ store: store$h
10906
10983
  }, props));
10907
10984
 
10908
10985
  function LastName({
@@ -10933,7 +11010,7 @@ function LastName({
10933
11010
  }
10934
11011
 
10935
11012
  const RegisterLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
10936
- store: store$g
11013
+ store: store$h
10937
11014
  }, props));
10938
11015
 
10939
11016
  /**
@@ -11057,7 +11134,7 @@ function TextInput({
11057
11134
 
11058
11135
  const RegisterTextInput = props => {
11059
11136
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
11060
- store: store$g
11137
+ store: store$h
11061
11138
  }));
11062
11139
  };
11063
11140
 
@@ -12713,20 +12790,21 @@ var es_12 = es.injectStripe;
12713
12790
  var es_13 = es.StripeProvider;
12714
12791
 
12715
12792
  /**
12716
- * @TODO: All subscription related business logic should end up moving
12793
+ * @TODO: All payment related business logic should end up moving
12717
12794
  * to this service, and out of react components.
12718
12795
  */
12719
12796
 
12720
12797
  /**
12721
- * Enum for subscription types
12798
+ * Enum for payment types
12722
12799
  * @readonly
12723
12800
  * @enum {string}
12724
12801
  */
12725
- const SUBSCRIPTION_TYPES = {
12802
+ const PAYMENT_TYPES = {
12726
12803
  CREATE_SUBSCRIPTION: "CREATE_SUBSCRIPTION",
12727
12804
  CREATE_GIFTED_SUBSCRIPTION: "CREATE_GIFTED_SUBSCRIPTION",
12728
12805
  RENEW_SUBSCRIPTION: "RENEW_SUBSCRIPTION",
12729
12806
  RENEW_GIFTED_SUBSCRIPTION: "RENEW_GIFTED_SUBSCRIPTION",
12807
+ PURCHASE_ECOMMERCE_ORDER: "PURCHASE_ECOMMERCE_ORDER",
12730
12808
  PAY_INVOICE: "PAY_INVOICE"
12731
12809
  };
12732
12810
 
@@ -12734,9 +12812,8 @@ var _isPaymentGatewayInvalid = /*#__PURE__*/new WeakMap();
12734
12812
 
12735
12813
  var _generateUserError = /*#__PURE__*/new WeakMap();
12736
12814
 
12737
- class Subscription {
12815
+ class Payment {
12738
12816
  /**
12739
- * Subscription service constructor
12740
12817
  * @param {(StripeGateway|PaypalGateway|VantivGateway)} paymentGateway
12741
12818
  */
12742
12819
  constructor(paymentGateway) {
@@ -12748,7 +12825,7 @@ class Subscription {
12748
12825
 
12749
12826
  if (!options.type) {
12750
12827
  callback(_classPrivateFieldGet(this, _generateUserError).call(this), null);
12751
- return console.error("No subscription type provided");
12828
+ return console.error("No payment type provided");
12752
12829
  } // delegate execution to paymentgateway
12753
12830
 
12754
12831
 
@@ -12766,21 +12843,21 @@ class Subscription {
12766
12843
  writable: true,
12767
12844
  value: () => {
12768
12845
  return {
12769
- error: new Error("An error has occured in the subscription service, please try again later")
12846
+ error: new Error("An error has occured in the payment service, please try again later")
12770
12847
  };
12771
12848
  }
12772
12849
  });
12773
12850
 
12774
12851
  if (_classPrivateFieldGet(this, _isPaymentGatewayInvalid).call(this, paymentGateway)) {
12775
12852
  this.paymentGateway = null;
12776
- console.error("Incompatible subscription gateway");
12853
+ console.error("Incompatible payment gateway");
12777
12854
  } else {
12778
12855
  this.paymentGateway = paymentGateway;
12779
12856
  }
12780
12857
  }
12781
12858
  /**
12782
- * @typedef subscriptionOptions
12783
- * @property {SUBSCRIPTION_TYPES} type
12859
+ * @typedef paymentOptions
12860
+ * @property {PAYMENT_TYPES} type
12784
12861
  * @property {string} token
12785
12862
  * @property {object} plan
12786
12863
  * @property {object} [product]
@@ -12791,6 +12868,7 @@ class Subscription {
12791
12868
  * @property {string} addressId
12792
12869
  * @property {number} invoiceId
12793
12870
  * @property {boolean} isExistingSource
12871
+ * @property {Array} items
12794
12872
  */
12795
12873
 
12796
12874
  /**
@@ -12801,8 +12879,8 @@ class Subscription {
12801
12879
  */
12802
12880
 
12803
12881
  /**
12804
- * Subscription execution method
12805
- * @param {subscriptionOptions} options subscription options
12882
+ * Payment execution method
12883
+ * @param {paymentOptions} options payment options
12806
12884
  * @param {executeCallback} callback
12807
12885
  * @return {void}
12808
12886
  */
@@ -12815,7 +12893,7 @@ const PAYMENT_GATEWAYS_ENUM = {
12815
12893
  vantiv: "vantiv"
12816
12894
  };
12817
12895
  /**
12818
- * Subscription Strategies
12896
+ * Payment Strategies
12819
12897
  */
12820
12898
 
12821
12899
  /**
@@ -12832,6 +12910,8 @@ var _renewSubscription = /*#__PURE__*/new WeakMap();
12832
12910
 
12833
12911
  var _renewGiftedSubscription = /*#__PURE__*/new WeakMap();
12834
12912
 
12913
+ var _purchaseEcommerceOrder = /*#__PURE__*/new WeakMap();
12914
+
12835
12915
  var _payInvoice = /*#__PURE__*/new WeakMap();
12836
12916
 
12837
12917
  class StripeGateway {
@@ -12842,7 +12922,7 @@ class StripeGateway {
12842
12922
  });
12843
12923
 
12844
12924
  _defineProperty$3(this, "execute", (options, callback) => {
12845
- const types = SUBSCRIPTION_TYPES;
12925
+ const types = PAYMENT_TYPES;
12846
12926
 
12847
12927
  switch (options.type) {
12848
12928
  case types.CREATE_SUBSCRIPTION:
@@ -12857,11 +12937,14 @@ class StripeGateway {
12857
12937
  case types.RENEW_GIFTED_SUBSCRIPTION:
12858
12938
  return _classPrivateFieldGet(this, _renewGiftedSubscription).call(this, options, callback);
12859
12939
 
12940
+ case types.PURCHASE_ECOMMERCE_ORDER:
12941
+ return _classPrivateFieldGet(this, _purchaseEcommerceOrder).call(this, options, callback);
12942
+
12860
12943
  case types.PAY_INVOICE:
12861
12944
  return _classPrivateFieldGet(this, _payInvoice).call(this, options, callback);
12862
12945
 
12863
12946
  default:
12864
- console.error("Unsupported subscriptiion method: Stripe Gateway");
12947
+ console.error("Unsupported payment method: Stripe Gateway");
12865
12948
  }
12866
12949
  });
12867
12950
 
@@ -12883,6 +12966,7 @@ class StripeGateway {
12883
12966
  auth_token: window.Pelcro.user.read().auth_token,
12884
12967
  plan_id: plan.id,
12885
12968
  coupon_code: couponCode,
12969
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
12886
12970
  address_id: product.address_required ? addressId : null
12887
12971
  }, (err, res) => {
12888
12972
  callback(err, res);
@@ -12909,6 +12993,7 @@ class StripeGateway {
12909
12993
  auth_token: window.Pelcro.user.read().auth_token,
12910
12994
  plan_id: plan.id,
12911
12995
  coupon_code: couponCode,
12996
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
12912
12997
  gift_recipient_email: giftRecipient.email,
12913
12998
  gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
12914
12999
  gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
@@ -12936,6 +13021,7 @@ class StripeGateway {
12936
13021
  stripe_token: token,
12937
13022
  auth_token: window.Pelcro.user.read().auth_token,
12938
13023
  plan_id: plan.id,
13024
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
12939
13025
  coupon_code: couponCode,
12940
13026
  subscription_id: subscriptionIdToRenew,
12941
13027
  address_id: product.address_required ? addressId : null
@@ -12969,6 +13055,36 @@ class StripeGateway {
12969
13055
  }
12970
13056
  });
12971
13057
 
13058
+ _purchaseEcommerceOrder.set(this, {
13059
+ writable: true,
13060
+ value: (options, callback) => {
13061
+ const {
13062
+ token,
13063
+ items,
13064
+ couponCode,
13065
+ addressId,
13066
+ isExistingSource
13067
+ } = options;
13068
+ const params = isExistingSource ? {
13069
+ source_id: token
13070
+ } : {
13071
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway),
13072
+ gateway_token: token
13073
+ };
13074
+ window.Pelcro.ecommerce.order.create({
13075
+ items,
13076
+ coupon_code: couponCode,
13077
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13078
+ ...params,
13079
+ ...(addressId && {
13080
+ address_id: addressId
13081
+ })
13082
+ }, (err, res) => {
13083
+ callback(err, res);
13084
+ });
13085
+ }
13086
+ });
13087
+
12972
13088
  _payInvoice.set(this, {
12973
13089
  writable: true,
12974
13090
  value: (options, callback) => {
@@ -13012,7 +13128,7 @@ class PaypalGateway {
13012
13128
  });
13013
13129
 
13014
13130
  _defineProperty$3(this, "execute", (options, callback) => {
13015
- const types = SUBSCRIPTION_TYPES;
13131
+ const types = PAYMENT_TYPES;
13016
13132
 
13017
13133
  switch (options.type) {
13018
13134
  case types.CREATE_SUBSCRIPTION:
@@ -13046,6 +13162,7 @@ class PaypalGateway {
13046
13162
  payment_gateway: _classPrivateFieldGet(this, _paymentGateway2),
13047
13163
  auth_token: window.Pelcro.user.read().auth_token,
13048
13164
  plan_id: plan.id,
13165
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13049
13166
  coupon_code: couponCode,
13050
13167
  address_id: product.address_required ? addressId : null
13051
13168
  }, (err, res) => {
@@ -13073,6 +13190,7 @@ class PaypalGateway {
13073
13190
  auth_token: window.Pelcro.user.read().auth_token,
13074
13191
  plan_id: plan.id,
13075
13192
  coupon_code: couponCode,
13193
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13076
13194
  gift_recipient_email: giftRecipient.email,
13077
13195
  gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
13078
13196
  gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
@@ -13109,6 +13227,16 @@ var _paymentGateway3 = /*#__PURE__*/new WeakMap();
13109
13227
 
13110
13228
  var _createSubscription3 = /*#__PURE__*/new WeakMap();
13111
13229
 
13230
+ var _renewSubscription2 = /*#__PURE__*/new WeakMap();
13231
+
13232
+ var _createGiftedSubscription3 = /*#__PURE__*/new WeakMap();
13233
+
13234
+ var _renewGiftedSubscription2 = /*#__PURE__*/new WeakMap();
13235
+
13236
+ var _purchaseEcommerceOrder2 = /*#__PURE__*/new WeakMap();
13237
+
13238
+ var _payInvoice3 = /*#__PURE__*/new WeakMap();
13239
+
13112
13240
  class VantivGateway {
13113
13241
  constructor() {
13114
13242
  _paymentGateway3.set(this, {
@@ -13117,14 +13245,29 @@ class VantivGateway {
13117
13245
  });
13118
13246
 
13119
13247
  _defineProperty$3(this, "execute", (options, callback) => {
13120
- const types = SUBSCRIPTION_TYPES;
13248
+ const types = PAYMENT_TYPES;
13121
13249
 
13122
13250
  switch (options.type) {
13123
13251
  case types.CREATE_SUBSCRIPTION:
13124
13252
  return _classPrivateFieldGet(this, _createSubscription3).call(this, options, callback);
13125
13253
 
13254
+ case types.RENEW_SUBSCRIPTION:
13255
+ return _classPrivateFieldGet(this, _renewSubscription2).call(this, options, callback);
13256
+
13257
+ case types.CREATE_GIFTED_SUBSCRIPTION:
13258
+ return _classPrivateFieldGet(this, _createGiftedSubscription3).call(this, options, callback);
13259
+
13260
+ case types.RENEW_GIFTED_SUBSCRIPTION:
13261
+ return _classPrivateFieldGet(this, _renewGiftedSubscription2).call(this, options, callback);
13262
+
13263
+ case types.PURCHASE_ECOMMERCE_ORDER:
13264
+ return _classPrivateFieldGet(this, _purchaseEcommerceOrder2).call(this, options, callback);
13265
+
13266
+ case types.PAY_INVOICE:
13267
+ return _classPrivateFieldGet(this, _payInvoice3).call(this, options, callback);
13268
+
13126
13269
  default:
13127
- console.error("Unsupported subscriptiion method: vantiv Gateway");
13270
+ console.error("Unsupported payment method: vantiv Gateway");
13128
13271
  }
13129
13272
  });
13130
13273
 
@@ -13137,46 +13280,205 @@ class VantivGateway {
13137
13280
  couponCode,
13138
13281
  product,
13139
13282
  quantity = 1,
13140
- addressId
13283
+ addressId,
13284
+ isExistingSource
13141
13285
  } = options;
13286
+ const params = isExistingSource ? {
13287
+ source_id: token
13288
+ } : {
13289
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13290
+ gateway_token: token
13291
+ };
13142
13292
  window.Pelcro.subscription.create({
13143
13293
  quantity,
13144
- gateway_token: token,
13145
- payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13146
13294
  auth_token: window.Pelcro.user.read().auth_token,
13147
13295
  plan_id: plan.id,
13296
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13148
13297
  coupon_code: couponCode,
13149
- address_id: product.address_required ? addressId : null
13298
+ address_id: product.address_required ? addressId : null,
13299
+ ...params
13150
13300
  }, (err, res) => {
13151
13301
  callback(err, res);
13152
13302
  });
13153
13303
  }
13154
13304
  });
13155
- }
13156
13305
 
13157
- }
13306
+ _renewSubscription2.set(this, {
13307
+ writable: true,
13308
+ value: (options, callback) => {
13309
+ const {
13310
+ subscriptionIdToRenew,
13311
+ token,
13312
+ plan,
13313
+ couponCode,
13314
+ product,
13315
+ addressId,
13316
+ isExistingSource
13317
+ } = options;
13318
+ const params = isExistingSource ? {
13319
+ source_id: token
13320
+ } : {
13321
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13322
+ gateway_token: token
13323
+ };
13324
+ window.Pelcro.subscription.renew({
13325
+ auth_token: window.Pelcro.user.read().auth_token,
13326
+ plan_id: plan.id,
13327
+ coupon_code: couponCode,
13328
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13329
+ subscription_id: subscriptionIdToRenew,
13330
+ address_id: product.address_required ? addressId : null,
13331
+ ...params
13332
+ }, (err, res) => {
13333
+ callback(err, res);
13334
+ });
13335
+ }
13336
+ });
13158
13337
 
13159
- /**
13160
- * @typedef {Object} PaymentStateType
13161
- * @property {boolean} disableSubmit
13162
- * @property {boolean} isLoading
13163
- * @property {boolean} disableCouponButton
13164
- * @property {object} couponObject
13165
- * @property {string} couponCode
13166
- * @property {string} couponError
13167
- * @property {boolean} enableCouponField
13168
- * @property {string} percentOff
13169
- * @property {unknown} canMakePayment
13170
- * @property {unknown} paymentRequest
13171
- * @property {number} updatedPrice
13172
- * @property {number} taxAmount
13173
- * @property {object} currentPlan
13174
- * @property {object} alert
13175
- */
13338
+ _createGiftedSubscription3.set(this, {
13339
+ writable: true,
13340
+ value: (options, callback) => {
13341
+ const {
13342
+ token,
13343
+ plan,
13344
+ couponCode,
13345
+ product,
13346
+ giftRecipient,
13347
+ quantity = 1,
13348
+ addressId,
13349
+ isExistingSource
13350
+ } = options;
13351
+ const params = isExistingSource ? {
13352
+ source_id: token
13353
+ } : {
13354
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13355
+ gateway_token: token
13356
+ };
13357
+ window.Pelcro.subscription.create({
13358
+ quantity,
13359
+ auth_token: window.Pelcro.user.read().auth_token,
13360
+ plan_id: plan.id,
13361
+ coupon_code: couponCode,
13362
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13363
+ gift_recipient_email: giftRecipient.email,
13364
+ gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
13365
+ gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
13366
+ gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
13367
+ gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
13368
+ address_id: product.address_required ? addressId : null,
13369
+ ...params
13370
+ }, (err, res) => {
13371
+ callback(err, res);
13372
+ });
13373
+ }
13374
+ });
13176
13375
 
13177
- /** @type {PaymentStateType} */
13376
+ _renewGiftedSubscription2.set(this, {
13377
+ writable: true,
13378
+ value: (options, callback) => {
13379
+ const {
13380
+ subscriptionIdToRenew,
13381
+ token,
13382
+ product,
13383
+ plan,
13384
+ couponCode,
13385
+ addressId,
13386
+ isExistingSource
13387
+ } = options;
13388
+ const params = isExistingSource ? {
13389
+ source_id: token
13390
+ } : {
13391
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13392
+ gateway_token: token
13393
+ };
13394
+ window.Pelcro.subscription.renewGift({
13395
+ auth_token: window.Pelcro.user.read().auth_token,
13396
+ plan_id: plan.id,
13397
+ coupon_code: couponCode,
13398
+ subscription_id: subscriptionIdToRenew,
13399
+ address_id: product.address_required ? addressId : null,
13400
+ ...params
13401
+ }, (err, res) => {
13402
+ callback(err, res);
13403
+ });
13404
+ }
13405
+ });
13178
13406
 
13179
- const initialState$f = {
13407
+ _purchaseEcommerceOrder2.set(this, {
13408
+ writable: true,
13409
+ value: (options, callback) => {
13410
+ const {
13411
+ token,
13412
+ items,
13413
+ couponCode,
13414
+ addressId,
13415
+ isExistingSource
13416
+ } = options;
13417
+ const params = isExistingSource ? {
13418
+ source_id: token
13419
+ } : {
13420
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13421
+ gateway_token: token
13422
+ };
13423
+ window.Pelcro.ecommerce.order.create({
13424
+ items,
13425
+ coupon_code: couponCode,
13426
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13427
+ ...params,
13428
+ ...(addressId && {
13429
+ address_id: addressId
13430
+ })
13431
+ }, (err, res) => {
13432
+ callback(err, res);
13433
+ });
13434
+ }
13435
+ });
13436
+
13437
+ _payInvoice3.set(this, {
13438
+ writable: true,
13439
+ value: (options, callback) => {
13440
+ const {
13441
+ token,
13442
+ invoiceId
13443
+ } = options;
13444
+ const params = options.isExistingSource ? {
13445
+ source_id: token,
13446
+ invoice_id: invoiceId
13447
+ } : {
13448
+ payment_gateway: _classPrivateFieldGet(this, _paymentGateway3),
13449
+ gateway_token: token,
13450
+ invoice_id: invoiceId
13451
+ };
13452
+ window.Pelcro.invoice.pay(params, (err, res) => {
13453
+ callback(err, res);
13454
+ });
13455
+ }
13456
+ });
13457
+ }
13458
+
13459
+ }
13460
+
13461
+ /**
13462
+ * @typedef {Object} PaymentStateType
13463
+ * @property {boolean} disableSubmit
13464
+ * @property {boolean} isLoading
13465
+ * @property {boolean} disableCouponButton
13466
+ * @property {object} couponObject
13467
+ * @property {string} couponCode
13468
+ * @property {string} couponError
13469
+ * @property {boolean} enableCouponField
13470
+ * @property {string} percentOff
13471
+ * @property {unknown} canMakePayment
13472
+ * @property {unknown} paymentRequest
13473
+ * @property {number} updatedPrice
13474
+ * @property {number} taxAmount
13475
+ * @property {object} currentPlan
13476
+ * @property {object} alert
13477
+ */
13478
+
13479
+ /** @type {PaymentStateType} */
13480
+
13481
+ const initialState$g = {
13180
13482
  disableSubmit: false,
13181
13483
  isLoading: false,
13182
13484
  disableCouponButton: false,
@@ -13195,10 +13497,10 @@ const initialState$f = {
13195
13497
  content: ""
13196
13498
  }
13197
13499
  };
13198
- const store$f = /*#__PURE__*/createContext(initialState$f);
13500
+ const store$g = /*#__PURE__*/createContext(initialState$g);
13199
13501
  const {
13200
- Provider: Provider$f
13201
- } = store$f;
13502
+ Provider: Provider$g
13503
+ } = store$g;
13202
13504
 
13203
13505
  const PaymentMethodContainerWithoutStripe = ({
13204
13506
  style,
@@ -13211,7 +13513,7 @@ const PaymentMethodContainerWithoutStripe = ({
13211
13513
  onFailure = () => {},
13212
13514
  ...props
13213
13515
  }) => {
13214
- var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isRenewingGift, _props$invoice;
13516
+ var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice;
13215
13517
 
13216
13518
  const {
13217
13519
  t
@@ -13227,6 +13529,7 @@ const PaymentMethodContainerWithoutStripe = ({
13227
13529
  const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
13228
13530
  const selectedAddressId = (_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : pelcroStore.selectedAddressId;
13229
13531
  const giftRecipient = (_props$giftRecipient = props.giftRecipient) !== null && _props$giftRecipient !== void 0 ? _props$giftRecipient : pelcroStore.giftRecipient;
13532
+ const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
13230
13533
  const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
13231
13534
  const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
13232
13535
  useEffect(() => {
@@ -13243,60 +13546,185 @@ const PaymentMethodContainerWithoutStripe = ({
13243
13546
  updateTotalAmountWithTax();
13244
13547
  }, []);
13245
13548
 
13246
- function submitVantivPayment() {
13549
+ const submitUsingVantiv = () => {
13550
+ const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
13551
+
13552
+ if (isUsingExistingPaymentMethod) {
13553
+ // no need to create a new source using vantiv
13554
+ return handleVantivPayment(null);
13555
+ }
13556
+
13247
13557
  if (!vantivInstanceRef.current) {
13248
13558
  return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
13249
13559
  }
13250
13560
 
13251
- const orderId = `pelcro-${new Date().getTime()}`; // calls handleVantivPayment
13561
+ const orderId = `pelcro-${new Date().getTime()}`;
13562
+ /*
13563
+ calls handleVantivPayment to either handle a payment or update a source by simply creating a new source
13564
+ */
13252
13565
 
13253
13566
  vantivInstanceRef.current.getPaypageRegistrationId({
13254
13567
  id: orderId,
13255
13568
  orderId: orderId
13256
13569
  });
13257
- }
13570
+ };
13258
13571
 
13259
13572
  function handleVantivPayment(paymentRequest) {
13260
- const SUCCESS_STATUS = "870";
13573
+ if (paymentRequest) {
13574
+ const SUCCESS_STATUS = "870";
13575
+
13576
+ if (paymentRequest.response !== SUCCESS_STATUS) {
13577
+ return handlePaymentError({
13578
+ error: new Error(paymentRequest.message)
13579
+ });
13580
+ }
13581
+ }
13582
+
13583
+ const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
13584
+
13585
+ if (type === "createPayment") {
13586
+ handleVantivSubscription();
13587
+ } else if (type === "orderCreate") {
13588
+ purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
13589
+ } else if (type === "invoicePayment") {
13590
+ payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
13591
+ } else if (type === "updatePaymentSource") {
13592
+ createNewVantivCard();
13593
+ }
13594
+
13595
+ function createNewVantivCard() {
13596
+ window.Pelcro.source.create({
13597
+ auth_token: window.Pelcro.user.read().auth_token,
13598
+ token: paymentRequest,
13599
+ gateway: "vantiv"
13600
+ }, (err, res) => {
13601
+ dispatch({
13602
+ type: DISABLE_SUBMIT,
13603
+ payload: false
13604
+ });
13605
+ dispatch({
13606
+ type: LOADING,
13607
+ payload: false
13608
+ });
13609
+
13610
+ if (err) {
13611
+ onFailure(err);
13612
+ return dispatch({
13613
+ type: SHOW_ALERT,
13614
+ payload: {
13615
+ type: "error",
13616
+ content: getErrorMessages(err)
13617
+ }
13618
+ });
13619
+ }
13261
13620
 
13262
- if (paymentRequest.response !== SUCCESS_STATUS) {
13263
- return handlePaymentError({
13264
- error: new Error(paymentRequest.message)
13621
+ dispatch({
13622
+ type: SHOW_ALERT,
13623
+ payload: {
13624
+ type: "success",
13625
+ content: t("messages.sourceUpdated")
13626
+ }
13627
+ });
13628
+ onSuccess(res);
13265
13629
  });
13266
13630
  }
13267
13631
 
13268
- const subscription = new Subscription(new VantivGateway());
13269
- const {
13270
- couponCode
13271
- } = state;
13272
- return subscription.execute({
13273
- type: SUBSCRIPTION_TYPES.CREATE_SUBSCRIPTION,
13274
- token: paymentRequest,
13275
- quantity: plan.quantity,
13276
- plan,
13277
- couponCode,
13278
- product,
13279
- addressId: selectedAddressId
13280
- }, (err, res) => {
13281
- if (err) {
13282
- return handlePaymentError(err);
13283
- }
13632
+ function handleVantivSubscription() {
13633
+ const payment = new Payment(new VantivGateway());
13634
+ const createSubscription = !isGift && !subscriptionIdToRenew;
13635
+ const renewSubscription = !isGift && subscriptionIdToRenew;
13636
+ const giftSubscriprition = isGift && !subscriptionIdToRenew;
13637
+ const renewGift = isRenewingGift;
13638
+ const {
13639
+ couponCode
13640
+ } = state;
13284
13641
 
13285
- onSuccess(res);
13286
- });
13642
+ if (renewGift) {
13643
+ return payment.execute({
13644
+ type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
13645
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13646
+ plan,
13647
+ couponCode,
13648
+ product,
13649
+ isExistingSource: isUsingExistingPaymentMethod,
13650
+ subscriptionIdToRenew,
13651
+ addressId: selectedAddressId
13652
+ }, (err, res) => {
13653
+ if (err) {
13654
+ return handlePaymentError(err);
13655
+ }
13656
+
13657
+ onSuccess(res);
13658
+ });
13659
+ } else if (giftSubscriprition) {
13660
+ return payment.execute({
13661
+ type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
13662
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13663
+ quantity: plan.quantity,
13664
+ plan,
13665
+ couponCode,
13666
+ product,
13667
+ isExistingSource: isUsingExistingPaymentMethod,
13668
+ giftRecipient,
13669
+ addressId: selectedAddressId
13670
+ }, (err, res) => {
13671
+ if (err) {
13672
+ return handlePaymentError(err);
13673
+ }
13674
+
13675
+ onSuccess(res);
13676
+ });
13677
+ } else if (renewSubscription) {
13678
+ return payment.execute({
13679
+ type: PAYMENT_TYPES.RENEW_SUBSCRIPTION,
13680
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13681
+ quantity: plan.quantity,
13682
+ plan,
13683
+ couponCode,
13684
+ product,
13685
+ isExistingSource: isUsingExistingPaymentMethod,
13686
+ subscriptionIdToRenew,
13687
+ addressId: selectedAddressId
13688
+ }, (err, res) => {
13689
+ if (err) {
13690
+ return handlePaymentError(err);
13691
+ }
13692
+
13693
+ onSuccess(res);
13694
+ });
13695
+ } else if (createSubscription) {
13696
+ return payment.execute({
13697
+ type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
13698
+ token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
13699
+ quantity: plan.quantity,
13700
+ plan,
13701
+ couponCode,
13702
+ product,
13703
+ isExistingSource: isUsingExistingPaymentMethod,
13704
+ addressId: selectedAddressId
13705
+ }, (err, res) => {
13706
+ if (err) {
13707
+ return handlePaymentError(err);
13708
+ }
13709
+
13710
+ onSuccess(res);
13711
+ });
13712
+ }
13713
+ }
13287
13714
  }
13288
13715
 
13289
13716
  const vantivInstanceRef = React__default.useRef(null);
13290
13717
  useEffect(() => {
13291
13718
  const cardProcessor = getSiteCardProcessor();
13292
13719
 
13293
- if (cardProcessor === "vantiv") {
13294
- var _window$Pelcro$site$r;
13720
+ if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
13721
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2;
13295
13722
 
13296
- 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;
13723
+ 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;
13724
+ 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;
13297
13725
  vantivInstanceRef.current = new window.EprotectIframeClient({
13298
13726
  paypageId: payPageId,
13299
- reportGroup: payPageId,
13727
+ reportGroup: reportGroup,
13300
13728
  style: "pelcro",
13301
13729
  height: "245",
13302
13730
  timeout: 50000,
@@ -13313,7 +13741,7 @@ const PaymentMethodContainerWithoutStripe = ({
13313
13741
  }
13314
13742
  });
13315
13743
  }
13316
- }, []);
13744
+ }, [selectedPaymentMethodId]);
13317
13745
 
13318
13746
  const initPaymentRequest = (state, dispatch) => {
13319
13747
  try {
@@ -13385,9 +13813,9 @@ const PaymentMethodContainerWithoutStripe = ({
13385
13813
 
13386
13814
 
13387
13815
  const updateTotalAmountWithTax = () => {
13388
- var _window$Pelcro$site$r2;
13816
+ var _window$Pelcro$site$r3;
13389
13817
 
13390
- 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;
13818
+ 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;
13391
13819
 
13392
13820
  if (taxesEnabled && type === "createPayment") {
13393
13821
  dispatch({
@@ -13544,6 +13972,7 @@ const PaymentMethodContainerWithoutStripe = ({
13544
13972
  window.Pelcro.order.create({
13545
13973
  auth_token: window.Pelcro.user.read().auth_token,
13546
13974
  plan_id: plan.id,
13975
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13547
13976
  coupon_code: couponCode,
13548
13977
  address_id: selectedAddressId
13549
13978
  }, handleCouponResponse);
@@ -13625,6 +14054,7 @@ const PaymentMethodContainerWithoutStripe = ({
13625
14054
  stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
13626
14055
  auth_token: window.Pelcro.user.read().auth_token,
13627
14056
  plan_id: plan.id,
14057
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13628
14058
  quantity: plan.quantity,
13629
14059
  coupon_code: couponCode,
13630
14060
  gift_recipient_email: giftRecipient ? giftRecipient.email : null,
@@ -13696,6 +14126,7 @@ const PaymentMethodContainerWithoutStripe = ({
13696
14126
  stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
13697
14127
  auth_token: window.Pelcro.user.read().auth_token,
13698
14128
  plan_id: plan.id,
14129
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
13699
14130
  coupon_code: couponCode,
13700
14131
  subscription_id: subscriptionIdToRenew,
13701
14132
  address_id: product.address_required ? selectedAddressId : null
@@ -13737,7 +14168,7 @@ const PaymentMethodContainerWithoutStripe = ({
13737
14168
 
13738
14169
 
13739
14170
  const handlePaypalSubscription = (state, paypalNonce) => {
13740
- const subscription = new Subscription(new PaypalGateway());
14171
+ const payment = new Payment(new PaypalGateway());
13741
14172
  const {
13742
14173
  couponCode
13743
14174
  } = state;
@@ -13746,8 +14177,8 @@ const PaymentMethodContainerWithoutStripe = ({
13746
14177
  */
13747
14178
 
13748
14179
  if (giftRecipient) {
13749
- return subscription.execute({
13750
- type: SUBSCRIPTION_TYPES.CREATE_GIFTED_SUBSCRIPTION,
14180
+ return payment.execute({
14181
+ type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
13751
14182
  token: paypalNonce,
13752
14183
  quantity: plan.quantity,
13753
14184
  plan,
@@ -13780,8 +14211,8 @@ const PaymentMethodContainerWithoutStripe = ({
13780
14211
  });
13781
14212
  }
13782
14213
 
13783
- return subscription.execute({
13784
- type: SUBSCRIPTION_TYPES.CREATE_SUBSCRIPTION,
14214
+ return payment.execute({
14215
+ type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
13785
14216
  token: paypalNonce,
13786
14217
  quantity: plan.quantity,
13787
14218
  plan,
@@ -13813,7 +14244,7 @@ const PaymentMethodContainerWithoutStripe = ({
13813
14244
  });
13814
14245
  };
13815
14246
 
13816
- const purchase = (stripeSource, state, dispatch) => {
14247
+ const purchase = (gatewayService, gatewayToken, state, dispatch) => {
13817
14248
  const isQuickPurchase = !Array.isArray(order);
13818
14249
  const mappedOrderItems = isQuickPurchase ? [{
13819
14250
  sku_id: order.id,
@@ -13825,14 +14256,14 @@ const PaymentMethodContainerWithoutStripe = ({
13825
14256
  const {
13826
14257
  couponCode
13827
14258
  } = state;
13828
- window.Pelcro.ecommerce.order.create({
13829
- source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
13830
- stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
14259
+ const payment = new Payment(gatewayService);
14260
+ payment.execute({
14261
+ type: PAYMENT_TYPES.PURCHASE_ECOMMERCE_ORDER,
14262
+ token: gatewayToken,
14263
+ isExistingSource: Boolean(selectedPaymentMethodId),
13831
14264
  items: mappedOrderItems,
13832
- coupon_code: couponCode,
13833
- ...(selectedAddressId && {
13834
- address_id: selectedAddressId
13835
- })
14265
+ addressId: selectedAddressId,
14266
+ couponCode
13836
14267
  }, (err, res) => {
13837
14268
  dispatch({
13838
14269
  type: DISABLE_SUBMIT,
@@ -13870,9 +14301,9 @@ const PaymentMethodContainerWithoutStripe = ({
13870
14301
  };
13871
14302
 
13872
14303
  const payInvoice = (gatewayService, gatewayToken, dispatch) => {
13873
- const subscription = new Subscription(gatewayService);
13874
- return subscription.execute({
13875
- type: SUBSCRIPTION_TYPES.PAY_INVOICE,
14304
+ const payment = new Payment(gatewayService);
14305
+ return payment.execute({
14306
+ type: PAYMENT_TYPES.PAY_INVOICE,
13876
14307
  token: gatewayToken,
13877
14308
  isExistingSource: Boolean(selectedPaymentMethodId),
13878
14309
  invoiceId: invoice.id
@@ -13917,7 +14348,9 @@ const PaymentMethodContainerWithoutStripe = ({
13917
14348
 
13918
14349
  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") {
13919
14350
  return handlePaymentError({
13920
- message: t("messages.cardAuthNotSupported")
14351
+ error: {
14352
+ message: t("messages.cardAuthNotSupported")
14353
+ }
13921
14354
  });
13922
14355
  }
13923
14356
 
@@ -14032,13 +14465,13 @@ const PaymentMethodContainerWithoutStripe = ({
14032
14465
 
14033
14466
 
14034
14467
  const resolveTaxCalculation = () => {
14035
- var _window$Pelcro$site$r3;
14468
+ var _window$Pelcro$site$r4;
14036
14469
 
14037
14470
  if (type === "invoicePayment") {
14038
14471
  return new Promise(resolve => resolve());
14039
14472
  }
14040
14473
 
14041
- 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;
14474
+ 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;
14042
14475
  return new Promise((resolve, reject) => {
14043
14476
  // resolve early if taxes isn't enabled
14044
14477
  if (!taxesEnabled) {
@@ -14048,6 +14481,7 @@ const PaymentMethodContainerWithoutStripe = ({
14048
14481
  window.Pelcro.order.create({
14049
14482
  auth_token: window.Pelcro.user.read().auth_token,
14050
14483
  plan_id: plan.id,
14484
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
14051
14485
  coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
14052
14486
  address_id: selectedAddressId
14053
14487
  }, (error, res) => {
@@ -14110,7 +14544,7 @@ const PaymentMethodContainerWithoutStripe = ({
14110
14544
  if (stripeSource && type === "createPayment") {
14111
14545
  subscribe(stripeSource, state, dispatch);
14112
14546
  } else if (stripeSource && type === "orderCreate") {
14113
- purchase(stripeSource, state, dispatch);
14547
+ purchase(new StripeGateway(), stripeSource.id, state, dispatch);
14114
14548
  } else if (stripeSource && type === "invoicePayment") {
14115
14549
  payInvoice(new StripeGateway(), stripeSource.id, dispatch);
14116
14550
  }
@@ -14161,7 +14595,9 @@ const PaymentMethodContainerWithoutStripe = ({
14161
14595
 
14162
14596
  if ((source === null || source === void 0 ? void 0 : source.status) === "failed") {
14163
14597
  return handlePaymentError({
14164
- message: t("messages.cardAuthFailed")
14598
+ error: {
14599
+ message: t("messages.cardAuthFailed")
14600
+ }
14165
14601
  });
14166
14602
  }
14167
14603
 
@@ -14232,6 +14668,10 @@ const PaymentMethodContainerWithoutStripe = ({
14232
14668
  disableSubmit: true,
14233
14669
  isLoading: true
14234
14670
  }, (state, dispatch) => {
14671
+ if (getSiteCardProcessor() === "vantiv") {
14672
+ return submitUsingVantiv();
14673
+ }
14674
+
14235
14675
  if (selectedPaymentMethodId) {
14236
14676
  // pay with selected method (source) if exists already
14237
14677
  return handlePayment({
@@ -14244,10 +14684,6 @@ const PaymentMethodContainerWithoutStripe = ({
14244
14684
  return updatePaymentSource(state, dispatch);
14245
14685
  }
14246
14686
 
14247
- if (getSiteCardProcessor() === "vantiv") {
14248
- return submitVantivPayment();
14249
- }
14250
-
14251
14687
  submitPayment(state);
14252
14688
  });
14253
14689
 
@@ -14316,21 +14752,21 @@ const PaymentMethodContainerWithoutStripe = ({
14316
14752
  default:
14317
14753
  return state;
14318
14754
  }
14319
- }, initialState$f);
14755
+ }, initialState$g);
14320
14756
  return /*#__PURE__*/React__default.createElement("div", {
14321
14757
  style: { ...style
14322
14758
  },
14323
14759
  className: `pelcro-container pelcro-payment-container ${className}`
14324
- }, /*#__PURE__*/React__default.createElement(Provider$f, {
14760
+ }, /*#__PURE__*/React__default.createElement(Provider$g, {
14325
14761
  value: {
14326
14762
  state,
14327
14763
  dispatch
14328
14764
  }
14329
14765
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
14330
- store: store$f,
14766
+ store: store$g,
14331
14767
  key: i
14332
14768
  })) : /*#__PURE__*/React__default.cloneElement(children, {
14333
- store: store$f
14769
+ store: store$g
14334
14770
  })));
14335
14771
  };
14336
14772
 
@@ -14352,7 +14788,7 @@ const PaymentMethodContainer = props => {
14352
14788
  stripeAccount: window.Pelcro.site.read().account_id,
14353
14789
  locale: getPageOrDefaultLanguage()
14354
14790
  }, /*#__PURE__*/React__default.createElement(es_11, null, /*#__PURE__*/React__default.createElement(UnwrappedForm, Object.assign({
14355
- store: store$f
14791
+ store: store$g
14356
14792
  }, props))));
14357
14793
  }
14358
14794
 
@@ -14405,7 +14841,7 @@ const PelcroPaymentRequestButton = props => {
14405
14841
  currentPlan,
14406
14842
  updatedPrice
14407
14843
  }
14408
- } = useContext(store$f);
14844
+ } = useContext(store$g);
14409
14845
 
14410
14846
  const updatePaymentRequest = () => {
14411
14847
  // Make sure payment request is up to date, eg. user added a coupon code.
@@ -14481,7 +14917,7 @@ const DiscountedPrice = props => {
14481
14917
  taxAmount,
14482
14918
  percentOff
14483
14919
  }
14484
- } = useContext(store$f);
14920
+ } = useContext(store$g);
14485
14921
  const {
14486
14922
  order,
14487
14923
  plan
@@ -14531,7 +14967,7 @@ const SubmitPaymentMethod = ({
14531
14967
  isLoading,
14532
14968
  updatedPrice
14533
14969
  }
14534
- } = useContext(store$f);
14970
+ } = useContext(store$g);
14535
14971
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
14536
14972
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
14537
14973
  const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
@@ -14581,7 +15017,7 @@ const ApplyCouponButton = ({
14581
15017
  disableCouponButton
14582
15018
  },
14583
15019
  dispatch
14584
- } = useContext(store$f);
15020
+ } = useContext(store$g);
14585
15021
  const {
14586
15022
  t
14587
15023
  } = useTranslation("checkoutForm");
@@ -14615,7 +15051,7 @@ const CouponCodeField = props => {
14615
15051
  couponCode,
14616
15052
  couponError
14617
15053
  }
14618
- } = useContext(store$f);
15054
+ } = useContext(store$g);
14619
15055
 
14620
15056
  const onCouponCodeChange = e => {
14621
15057
  dispatch({
@@ -14671,7 +15107,7 @@ const CouponCode = ({
14671
15107
  state: {
14672
15108
  enableCouponField
14673
15109
  }
14674
- } = useContext(store$f);
15110
+ } = useContext(store$g);
14675
15111
  const {
14676
15112
  t
14677
15113
  } = useTranslation("checkoutForm");
@@ -14928,7 +15364,7 @@ const PaypalSubscribeButton = props => {
14928
15364
  const {
14929
15365
  dispatch,
14930
15366
  state
14931
- } = useContext(store$f);
15367
+ } = useContext(store$g);
14932
15368
  const {
14933
15369
  product,
14934
15370
  plan,
@@ -14943,7 +15379,7 @@ const PaypalSubscribeButton = props => {
14943
15379
  const selectedAddress = getAddressById((_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : selectedAddressId); // initialize paypal client, then render paypal button.
14944
15380
 
14945
15381
  const initializePaypal = async () => {
14946
- var _props$buttonElementI, _props$product$addres, _props$product, _props$plan2;
15382
+ var _props$buttonElementI, _props$product$addres, _props$product;
14947
15383
 
14948
15384
  const paypalCheckoutInstance = new PaypalClient({
14949
15385
  buttonElementID: (_props$buttonElementI = props.buttonElementID) !== null && _props$buttonElementI !== void 0 ? _props$buttonElementI : "pelcro-paypal-button",
@@ -14953,12 +15389,33 @@ const PaypalSubscribeButton = props => {
14953
15389
  displayName: props.merchantDisplayName,
14954
15390
  locale: props.locale,
14955
15391
  billingAgreementDescription: props.billingDescription
14956
- }); // Await building paypal instance
15392
+ });
15393
+
15394
+ const getProduct = () => {
15395
+ if (invoice) {
15396
+ invoice.plan = null;
15397
+
15398
+ if (invoice.plan) {
15399
+ return invoice.plan;
15400
+ } else {
15401
+ // standalone invoices dont have a plan
15402
+ return {
15403
+ currency: invoice.currency,
15404
+ nickname: `invoice #${invoice.id}`
15405
+ };
15406
+ }
15407
+ } else if (props.plan) {
15408
+ return props.plan;
15409
+ } else {
15410
+ return plan;
15411
+ }
15412
+ }; // Await building paypal instance
15413
+
14957
15414
 
14958
15415
  await paypalCheckoutInstance.build(); // Create paypal payment
14959
15416
 
14960
15417
  paypalCheckoutInstance.createPayment({
14961
- product: invoice ? invoice.plan : (_props$plan2 = props.plan) !== null && _props$plan2 !== void 0 ? _props$plan2 : plan,
15418
+ product: getProduct(),
14962
15419
  amount: updatedPrice,
14963
15420
  address: invoice ? null : selectedAddress,
14964
15421
  onButtonClick: () => {
@@ -15040,7 +15497,7 @@ const SelectedPaymentMethod = () => {
15040
15497
  state: {
15041
15498
  isLoading
15042
15499
  }
15043
- } = useContext(store$f);
15500
+ } = useContext(store$g);
15044
15501
  const {
15045
15502
  switchView,
15046
15503
  selectedPaymentMethodId
@@ -15082,7 +15539,7 @@ const TaxAmount = () => {
15082
15539
  state: {
15083
15540
  taxAmount
15084
15541
  }
15085
- } = useContext(store$f);
15542
+ } = useContext(store$g);
15086
15543
  const {
15087
15544
  plan
15088
15545
  } = usePelcro();
@@ -15601,7 +16058,7 @@ class DefaultNewsLetter extends Component {
15601
16058
 
15602
16059
  const NewsLetter = withTranslation("newsletter")(DefaultNewsLetter);
15603
16060
 
15604
- const initialState$e = {
16061
+ const initialState$f = {
15605
16062
  didSubToNewslettersBefore: false,
15606
16063
  newsletters: [],
15607
16064
  isListLoading: true,
@@ -15611,10 +16068,10 @@ const initialState$e = {
15611
16068
  content: ""
15612
16069
  }
15613
16070
  };
15614
- const store$e = /*#__PURE__*/createContext(initialState$e);
16071
+ const store$f = /*#__PURE__*/createContext(initialState$f);
15615
16072
  const {
15616
- Provider: Provider$e
15617
- } = store$e;
16073
+ Provider: Provider$f
16074
+ } = store$f;
15618
16075
 
15619
16076
  const NewsletterUpdateContainer = ({
15620
16077
  style,
@@ -15727,7 +16184,7 @@ const NewsletterUpdateContainer = ({
15727
16184
  default:
15728
16185
  return state;
15729
16186
  }
15730
- }, initialState$e);
16187
+ }, initialState$f);
15731
16188
  useEffect(() => {
15732
16189
  const getUserNewsletters = () => {
15733
16190
  var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
@@ -15771,7 +16228,7 @@ const NewsletterUpdateContainer = ({
15771
16228
  style: { ...style
15772
16229
  },
15773
16230
  className: `pelcro-container pelcro-newsletter-update-container ${className}`
15774
- }, /*#__PURE__*/React__default.createElement(Provider$e, {
16231
+ }, /*#__PURE__*/React__default.createElement(Provider$f, {
15775
16232
  value: {
15776
16233
  state,
15777
16234
  dispatch
@@ -15779,12 +16236,12 @@ const NewsletterUpdateContainer = ({
15779
16236
  }, children.length ? children.map((child, i) => {
15780
16237
  if (child) {
15781
16238
  return /*#__PURE__*/React__default.cloneElement(child, {
15782
- store: store$e,
16239
+ store: store$f,
15783
16240
  key: i
15784
16241
  });
15785
16242
  }
15786
16243
  }) : /*#__PURE__*/React__default.cloneElement(children, {
15787
- store: store$e
16244
+ store: store$f
15788
16245
  })));
15789
16246
  };
15790
16247
 
@@ -15799,7 +16256,7 @@ const NewsletterUpdateButton = ({
15799
16256
  isSubmitting,
15800
16257
  isListLoading
15801
16258
  }
15802
- } = useContext(store$e);
16259
+ } = useContext(store$f);
15803
16260
  const {
15804
16261
  t
15805
16262
  } = useTranslation("newsletter");
@@ -15829,7 +16286,7 @@ const NewsletterUpdateList = () => {
15829
16286
  newsletters,
15830
16287
  isListLoading
15831
16288
  }
15832
- } = useContext(store$e);
16289
+ } = useContext(store$f);
15833
16290
 
15834
16291
  if (isListLoading) {
15835
16292
  return /*#__PURE__*/React__default.createElement(Loader, {
@@ -16033,7 +16490,7 @@ function SubscriptionCreateModal({
16033
16490
  SubscriptionCreateModal.viewId = "subscription-create";
16034
16491
 
16035
16492
  var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
16036
- const initialState$d = {
16493
+ const initialState$e = {
16037
16494
  email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
16038
16495
  firstName: (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.first_name,
16039
16496
  lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
@@ -16046,10 +16503,10 @@ const initialState$d = {
16046
16503
  content: ""
16047
16504
  }
16048
16505
  };
16049
- const store$d = /*#__PURE__*/createContext(initialState$d);
16506
+ const store$e = /*#__PURE__*/createContext(initialState$e);
16050
16507
  const {
16051
- Provider: Provider$d
16052
- } = store$d;
16508
+ Provider: Provider$e
16509
+ } = store$e;
16053
16510
 
16054
16511
  const UserUpdateContainer = ({
16055
16512
  style,
@@ -16069,20 +16526,23 @@ const UserUpdateContainer = ({
16069
16526
  }, []);
16070
16527
 
16071
16528
  const loadUserDataIntoFields = () => {
16072
- var _window$Pelcro$user$r6, _window$Pelcro$user$r7, _window$Pelcro$user$r8, _window$Pelcro$user$r9;
16529
+ var _window$Pelcro$user$r6, _window$Pelcro$user$r7, _window$Pelcro$user$r8, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
16073
16530
 
16074
16531
  const fields = [{
16532
+ type: SET_EMAIL,
16533
+ payload: (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.email
16534
+ }, {
16075
16535
  type: SET_FIRST_NAME,
16076
- payload: (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.first_name
16536
+ payload: (_window$Pelcro$user$r7 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.first_name
16077
16537
  }, {
16078
16538
  type: SET_LAST_NAME,
16079
- payload: (_window$Pelcro$user$r7 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.last_name
16539
+ payload: (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.last_name
16080
16540
  }, {
16081
16541
  type: SET_DISPLAY_NAME,
16082
- payload: (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.display_name
16542
+ payload: (_window$Pelcro$user$r9 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r9 === void 0 ? void 0 : _window$Pelcro$user$r9.display_name
16083
16543
  }, {
16084
16544
  type: SET_PHONE,
16085
- payload: (_window$Pelcro$user$r9 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r9 === void 0 ? void 0 : _window$Pelcro$user$r9.phone
16545
+ payload: (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.phone
16086
16546
  }];
16087
16547
  fields.filter(field => Boolean(field.payload)).forEach(field => {
16088
16548
  dispatch(field);
@@ -16090,6 +16550,7 @@ const UserUpdateContainer = ({
16090
16550
  };
16091
16551
 
16092
16552
  const handleUpdateUser = ({
16553
+ email,
16093
16554
  firstName,
16094
16555
  lastName,
16095
16556
  phone,
@@ -16098,6 +16559,7 @@ const UserUpdateContainer = ({
16098
16559
  }, dispatch) => {
16099
16560
  window.Pelcro.user.update({
16100
16561
  auth_token: window.Pelcro.user.read().auth_token,
16562
+ email: email,
16101
16563
  first_name: firstName,
16102
16564
  last_name: lastName,
16103
16565
  display_name: displayName,
@@ -16143,6 +16605,11 @@ const UserUpdateContainer = ({
16143
16605
  }
16144
16606
  });
16145
16607
 
16608
+ case SET_EMAIL:
16609
+ return lib_7({ ...state,
16610
+ email: action.payload
16611
+ });
16612
+
16146
16613
  case SET_FIRST_NAME:
16147
16614
  return lib_7({ ...state,
16148
16615
  firstName: action.payload
@@ -16181,27 +16648,26 @@ const UserUpdateContainer = ({
16181
16648
  default:
16182
16649
  return state;
16183
16650
  }
16184
- }, initialState$d);
16651
+ }, initialState$e);
16185
16652
  return /*#__PURE__*/React__default.createElement("div", {
16186
16653
  style: { ...style
16187
16654
  },
16188
16655
  className: `pelcro-container pelcro-user-update-container ${className}`
16189
- }, /*#__PURE__*/React__default.createElement(Provider$d, {
16656
+ }, /*#__PURE__*/React__default.createElement(Provider$e, {
16190
16657
  value: {
16191
16658
  state,
16192
16659
  dispatch
16193
16660
  }
16194
16661
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
16195
- store: store$d,
16662
+ store: store$e,
16196
16663
  key: i
16197
16664
  })) : /*#__PURE__*/React__default.cloneElement(children, {
16198
- store: store$d
16665
+ store: store$e
16199
16666
  })));
16200
16667
  };
16201
16668
 
16202
16669
  const UserUpdateEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
16203
- disabled: true,
16204
- store: store$d
16670
+ store: store$e
16205
16671
  }, props));
16206
16672
 
16207
16673
  const UserUpdateButton = ({
@@ -16214,7 +16680,7 @@ const UserUpdateButton = ({
16214
16680
  buttonDisabled
16215
16681
  },
16216
16682
  dispatch
16217
- } = useContext(store$d);
16683
+ } = useContext(store$e);
16218
16684
  const {
16219
16685
  t
16220
16686
  } = useTranslation("userEdit");
@@ -16231,11 +16697,11 @@ const UserUpdateButton = ({
16231
16697
  };
16232
16698
 
16233
16699
  const UserUpdateFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
16234
- store: store$d
16700
+ store: store$e
16235
16701
  }, props));
16236
16702
 
16237
16703
  const UserUpdateLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
16238
- store: store$d
16704
+ store: store$e
16239
16705
  }, props));
16240
16706
 
16241
16707
  function Phone({
@@ -16264,7 +16730,7 @@ function Phone({
16264
16730
  }
16265
16731
 
16266
16732
  const UserUpdatePhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
16267
- store: store$d
16733
+ store: store$e
16268
16734
  }, props));
16269
16735
 
16270
16736
  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";
@@ -16302,7 +16768,7 @@ const UserUpdateProfilePic = ({
16302
16768
  onClick: onClick
16303
16769
  }, otherProps)), /*#__PURE__*/React__default.createElement(Button, {
16304
16770
  variant: "icon",
16305
- 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",
16771
+ 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",
16306
16772
  icon: /*#__PURE__*/React__default.createElement(SvgEdit, null),
16307
16773
  id: "pelcro-user-update-picture-button",
16308
16774
  onClick: onClick
@@ -16327,15 +16793,15 @@ const UserUpdateView = props => {
16327
16793
  }), /*#__PURE__*/React__default.createElement("div", {
16328
16794
  className: "plc-flex plc-items-start"
16329
16795
  }, /*#__PURE__*/React__default.createElement(UserUpdateEmail, {
16330
- label: t("labels.email")
16796
+ label: t("labels.email"),
16797
+ autoFocus: true
16331
16798
  })), /*#__PURE__*/React__default.createElement("div", {
16332
16799
  className: "plc-flex plc-items-start"
16333
16800
  }, /*#__PURE__*/React__default.createElement(UserUpdateFirstName, {
16334
16801
  autoComplete: "first-name",
16335
16802
  id: "pelcro-input-first-name",
16336
16803
  errorId: "pelcro-input-first-name-error",
16337
- label: t("labels.firstName"),
16338
- autoFocus: true
16804
+ label: t("labels.firstName")
16339
16805
  }), /*#__PURE__*/React__default.createElement(UserUpdateLastName, {
16340
16806
  wrapperClassName: "plc-ml-3",
16341
16807
  autoComplete: "last-name",
@@ -16411,16 +16877,16 @@ function DisplayName({
16411
16877
  }
16412
16878
 
16413
16879
  const UserUpdateDisplayName = props => /*#__PURE__*/React__default.createElement(DisplayName, Object.assign({
16414
- store: store$d
16880
+ store: store$e
16415
16881
  }, props));
16416
16882
 
16417
16883
  const UserUpdateTextInput = props => {
16418
16884
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
16419
- store: store$d
16885
+ store: store$e
16420
16886
  }));
16421
16887
  };
16422
16888
 
16423
- const initialState$c = {
16889
+ const initialState$d = {
16424
16890
  isSubmitting: false,
16425
16891
  firstName: "",
16426
16892
  firstNameError: "",
@@ -16445,10 +16911,10 @@ const initialState$c = {
16445
16911
  content: ""
16446
16912
  }
16447
16913
  };
16448
- const store$c = /*#__PURE__*/createContext(initialState$c);
16914
+ const store$d = /*#__PURE__*/createContext(initialState$d);
16449
16915
  const {
16450
- Provider: Provider$c
16451
- } = store$c;
16916
+ Provider: Provider$d
16917
+ } = store$d;
16452
16918
 
16453
16919
  const getNewlyCreatedAddress = addresses => addresses[addresses.length - 1];
16454
16920
 
@@ -16655,7 +17121,7 @@ const AddressCreateContainer = ({
16655
17121
  default:
16656
17122
  return state;
16657
17123
  }
16658
- }, initialState$c);
17124
+ }, initialState$d);
16659
17125
  useEffect(() => {
16660
17126
  const getStates = () => {
16661
17127
  dispatch({
@@ -16687,16 +17153,16 @@ const AddressCreateContainer = ({
16687
17153
  style: { ...style
16688
17154
  },
16689
17155
  className: `pelcro-container pelcro-address-create-container ${className}`
16690
- }, /*#__PURE__*/React__default.createElement(Provider$c, {
17156
+ }, /*#__PURE__*/React__default.createElement(Provider$d, {
16691
17157
  value: {
16692
17158
  state,
16693
17159
  dispatch
16694
17160
  }
16695
17161
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
16696
- store: store$c,
17162
+ store: store$d,
16697
17163
  key: i
16698
17164
  })) : /*#__PURE__*/React__default.cloneElement(children, {
16699
- store: store$c
17165
+ store: store$d
16700
17166
  })));
16701
17167
  };
16702
17168
 
@@ -16707,7 +17173,7 @@ function AddressCreateFirstName(props) {
16707
17173
  firstName,
16708
17174
  firstNameError
16709
17175
  }
16710
- } = useContext(store$c);
17176
+ } = useContext(store$d);
16711
17177
 
16712
17178
  const handleBlur = () => {
16713
17179
  return dispatch({
@@ -16750,7 +17216,7 @@ function AddressCreateLastName(props) {
16750
17216
  lastName,
16751
17217
  lastNameError
16752
17218
  }
16753
- } = useContext(store$c);
17219
+ } = useContext(store$d);
16754
17220
 
16755
17221
  const handleBlur = () => {
16756
17222
  return dispatch({
@@ -16793,7 +17259,7 @@ function AddressCreateLine1(props) {
16793
17259
  line1,
16794
17260
  line1Error
16795
17261
  }
16796
- } = useContext(store$c);
17262
+ } = useContext(store$d);
16797
17263
 
16798
17264
  const handleBlur = () => {
16799
17265
  return dispatch({
@@ -16836,7 +17302,7 @@ function AddressCreateCity(props) {
16836
17302
  city,
16837
17303
  cityError
16838
17304
  }
16839
- } = useContext(store$c);
17305
+ } = useContext(store$d);
16840
17306
 
16841
17307
  const handleBlur = () => {
16842
17308
  return dispatch({
@@ -16879,7 +17345,7 @@ function AddressCreatePostalCode(props) {
16879
17345
  postalCode,
16880
17346
  postalCodeError
16881
17347
  }
16882
- } = useContext(store$c);
17348
+ } = useContext(store$d);
16883
17349
 
16884
17350
  const handleBlur = () => {
16885
17351
  return dispatch({
@@ -16925,7 +17391,7 @@ const AddressCreateSubmit = ({
16925
17391
  state: {
16926
17392
  isSubmitting
16927
17393
  }
16928
- } = useContext(store$c);
17394
+ } = useContext(store$d);
16929
17395
  const {
16930
17396
  t
16931
17397
  } = useTranslation("address");
@@ -17036,7 +17502,7 @@ function CountrySelect({
17036
17502
  }
17037
17503
 
17038
17504
  const AddressCreateCountrySelect = props => /*#__PURE__*/React__default.createElement(CountrySelect, Object.assign({
17039
- store: store$c
17505
+ store: store$d
17040
17506
  }, props));
17041
17507
 
17042
17508
  function StateSelect({
@@ -17124,7 +17590,7 @@ function StateSelect({
17124
17590
  }
17125
17591
 
17126
17592
  const AddressCreateStateSelect = props => /*#__PURE__*/React__default.createElement(StateSelect, Object.assign({
17127
- store: store$c
17593
+ store: store$d
17128
17594
  }, props));
17129
17595
 
17130
17596
  const AddressCreateView = props => {
@@ -17229,18 +17695,18 @@ AddressCreateModal.viewId = "address-create";
17229
17695
 
17230
17696
  const AddressCreateTextInput = props => {
17231
17697
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
17232
- store: store$c
17698
+ store: store$d
17233
17699
  }));
17234
17700
  };
17235
17701
 
17236
17702
  const AddressCreateLine2 = props => {
17237
17703
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({
17238
17704
  fieldName: "line2",
17239
- store: store$c
17705
+ store: store$d
17240
17706
  }, props));
17241
17707
  };
17242
17708
 
17243
- const initialState$b = {
17709
+ const initialState$c = {
17244
17710
  isSubmitting: false,
17245
17711
  firstName: "",
17246
17712
  firstNameError: "",
@@ -17265,10 +17731,10 @@ const initialState$b = {
17265
17731
  content: ""
17266
17732
  }
17267
17733
  };
17268
- const store$b = /*#__PURE__*/createContext(initialState$b);
17734
+ const store$c = /*#__PURE__*/createContext(initialState$c);
17269
17735
  const {
17270
- Provider: Provider$b
17271
- } = store$b;
17736
+ Provider: Provider$c
17737
+ } = store$c;
17272
17738
 
17273
17739
  const AddressUpdateContainer = ({
17274
17740
  style,
@@ -17320,7 +17786,7 @@ const AddressUpdateContainer = ({
17320
17786
  const thisAddress = addresses[address];
17321
17787
 
17322
17788
  if (+thisAddress.id === +addressId) {
17323
- const newState = { ...initialState$b,
17789
+ const newState = { ...initialState$c,
17324
17790
  firstName: thisAddress.first_name,
17325
17791
  lastName: thisAddress.last_name,
17326
17792
  line1: thisAddress.line1,
@@ -17453,7 +17919,7 @@ const AddressUpdateContainer = ({
17453
17919
  default:
17454
17920
  return state;
17455
17921
  }
17456
- }, initialState$b);
17922
+ }, initialState$c);
17457
17923
  useEffect(() => {
17458
17924
  const getStates = () => {
17459
17925
  dispatch({
@@ -17485,21 +17951,21 @@ const AddressUpdateContainer = ({
17485
17951
  style: { ...style
17486
17952
  },
17487
17953
  className: `pelcro-container pelcro-address-update-container ${className}`
17488
- }, /*#__PURE__*/React__default.createElement(Provider$b, {
17954
+ }, /*#__PURE__*/React__default.createElement(Provider$c, {
17489
17955
  value: {
17490
17956
  state,
17491
17957
  dispatch
17492
17958
  }
17493
17959
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
17494
- store: store$b,
17960
+ store: store$c,
17495
17961
  key: i
17496
17962
  })) : /*#__PURE__*/React__default.cloneElement(children, {
17497
- store: store$b
17963
+ store: store$c
17498
17964
  })));
17499
17965
  };
17500
17966
 
17501
17967
  const AddressUpdateCountrySelect = props => /*#__PURE__*/React__default.createElement(CountrySelect, Object.assign({
17502
- store: store$b
17968
+ store: store$c
17503
17969
  }, props));
17504
17970
 
17505
17971
  function AddressUpdateFirstName(props) {
@@ -17509,7 +17975,7 @@ function AddressUpdateFirstName(props) {
17509
17975
  firstName,
17510
17976
  firstNameError
17511
17977
  }
17512
- } = useContext(store$b);
17978
+ } = useContext(store$c);
17513
17979
 
17514
17980
  const handleBlur = () => {
17515
17981
  return dispatch({
@@ -17552,7 +18018,7 @@ function AddressUpdateLastName(props) {
17552
18018
  lastName,
17553
18019
  lastNameError
17554
18020
  }
17555
- } = useContext(store$b);
18021
+ } = useContext(store$c);
17556
18022
 
17557
18023
  const handleBlur = () => {
17558
18024
  return dispatch({
@@ -17595,7 +18061,7 @@ function AddressUpdateLine1(props) {
17595
18061
  line1,
17596
18062
  line1Error
17597
18063
  }
17598
- } = useContext(store$b);
18064
+ } = useContext(store$c);
17599
18065
 
17600
18066
  const handleBlur = () => {
17601
18067
  return dispatch({
@@ -17635,7 +18101,7 @@ const AddressUpdateLine2 = props => {
17635
18101
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({
17636
18102
  fieldName: "line2"
17637
18103
  }, props, {
17638
- store: store$b
18104
+ store: store$c
17639
18105
  }));
17640
18106
  };
17641
18107
 
@@ -17646,7 +18112,7 @@ function AddressUpdateCity(props) {
17646
18112
  city,
17647
18113
  cityError
17648
18114
  }
17649
- } = useContext(store$b);
18115
+ } = useContext(store$c);
17650
18116
 
17651
18117
  const handleBlur = () => {
17652
18118
  return dispatch({
@@ -17689,7 +18155,7 @@ function AddressUpdatePostalCode(props) {
17689
18155
  postalCode,
17690
18156
  postalCodeError
17691
18157
  }
17692
- } = useContext(store$b);
18158
+ } = useContext(store$c);
17693
18159
 
17694
18160
  const handleBlur = () => {
17695
18161
  return dispatch({
@@ -17735,7 +18201,7 @@ const AddressUpdateSubmit = ({
17735
18201
  state: {
17736
18202
  isSubmitting
17737
18203
  }
17738
- } = useContext(store$b);
18204
+ } = useContext(store$c);
17739
18205
  const {
17740
18206
  t
17741
18207
  } = useTranslation("address");
@@ -17751,7 +18217,7 @@ const AddressUpdateSubmit = ({
17751
18217
  };
17752
18218
 
17753
18219
  const AddressUpdateStateSelect = props => /*#__PURE__*/React__default.createElement(StateSelect, Object.assign({
17754
- store: store$b
18220
+ store: store$c
17755
18221
  }, props));
17756
18222
 
17757
18223
  const AddressUpdateView = props => {
@@ -17834,7 +18300,7 @@ AddressUpdateModal.viewId = "address-edit";
17834
18300
 
17835
18301
  const AddressUpdateTextInput = props => {
17836
18302
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
17837
- store: store$b
18303
+ store: store$c
17838
18304
  }));
17839
18305
  };
17840
18306
 
@@ -17917,7 +18383,7 @@ const PaymentMethodUpdateModal = props => {
17917
18383
  };
17918
18384
  PaymentMethodUpdateModal.viewId = "payment-method-update";
17919
18385
 
17920
- const initialState$a = {
18386
+ const initialState$b = {
17921
18387
  email: "",
17922
18388
  password: "",
17923
18389
  passwordError: null,
@@ -17930,10 +18396,10 @@ const initialState$a = {
17930
18396
  content: ""
17931
18397
  }
17932
18398
  };
17933
- const store$a = /*#__PURE__*/createContext(initialState$a);
18399
+ const store$b = /*#__PURE__*/createContext(initialState$b);
17934
18400
  const {
17935
- Provider: Provider$a
17936
- } = store$a;
18401
+ Provider: Provider$b
18402
+ } = store$b;
17937
18403
 
17938
18404
  const PasswordResetContainer = ({
17939
18405
  style,
@@ -17990,7 +18456,7 @@ const PasswordResetContainer = ({
17990
18456
  type: SET_EMAIL,
17991
18457
  payload: window.Pelcro.helpers.getURLParameter("email")
17992
18458
  });
17993
- initialState$a.email = window.Pelcro.helpers.getURLParameter("email");
18459
+ initialState$b.email = window.Pelcro.helpers.getURLParameter("email");
17994
18460
  dispatch({
17995
18461
  type: SET_TOKEN,
17996
18462
  payload: window.Pelcro.helpers.getURLParameter("token")
@@ -18050,26 +18516,26 @@ const PasswordResetContainer = ({
18050
18516
  default:
18051
18517
  return state;
18052
18518
  }
18053
- }, initialState$a);
18519
+ }, initialState$b);
18054
18520
  return /*#__PURE__*/React__default.createElement("div", {
18055
18521
  style: { ...style
18056
18522
  },
18057
18523
  className: `pelcro-container pelcro-password-reset-container ${className}`
18058
- }, /*#__PURE__*/React__default.createElement(Provider$a, {
18524
+ }, /*#__PURE__*/React__default.createElement(Provider$b, {
18059
18525
  value: {
18060
18526
  state,
18061
18527
  dispatch
18062
18528
  }
18063
18529
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
18064
- store: store$a,
18530
+ store: store$b,
18065
18531
  key: i
18066
18532
  })) : /*#__PURE__*/React__default.cloneElement(children, {
18067
- store: store$a
18533
+ store: store$b
18068
18534
  })));
18069
18535
  };
18070
18536
 
18071
18537
  const PasswordResetPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
18072
- store: store$a
18538
+ store: store$b
18073
18539
  }, props));
18074
18540
 
18075
18541
  const PasswordResetButton = ({
@@ -18082,7 +18548,7 @@ const PasswordResetButton = ({
18082
18548
  buttonDisabled
18083
18549
  },
18084
18550
  dispatch
18085
- } = useContext(store$a);
18551
+ } = useContext(store$b);
18086
18552
  const {
18087
18553
  t
18088
18554
  } = useTranslation("passwordReset");
@@ -18099,14 +18565,14 @@ const PasswordResetButton = ({
18099
18565
  };
18100
18566
 
18101
18567
  const PasswordResetEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
18102
- store: store$a
18568
+ store: store$b
18103
18569
  }, props, {
18104
18570
  value: window.Pelcro.helpers.getURLParameter("email"),
18105
18571
  disabled: true
18106
18572
  }));
18107
18573
 
18108
18574
  const PasswordResetConfirmPassword = props => /*#__PURE__*/React__default.createElement(ConfirmPassword, Object.assign({
18109
- store: store$a
18575
+ store: store$b
18110
18576
  }, props));
18111
18577
 
18112
18578
  const PasswordResetView = props => {
@@ -18158,7 +18624,7 @@ const PasswordResetModal = ({
18158
18624
  };
18159
18625
  PasswordResetModal.viewId = "password-reset";
18160
18626
 
18161
- const initialState$9 = {
18627
+ const initialState$a = {
18162
18628
  email: "",
18163
18629
  emailError: null,
18164
18630
  buttonDisabled: false,
@@ -18167,10 +18633,10 @@ const initialState$9 = {
18167
18633
  content: ""
18168
18634
  }
18169
18635
  };
18170
- const store$9 = /*#__PURE__*/createContext(initialState$9);
18636
+ const store$a = /*#__PURE__*/createContext(initialState$a);
18171
18637
  const {
18172
- Provider: Provider$9
18173
- } = store$9;
18638
+ Provider: Provider$a
18639
+ } = store$a;
18174
18640
 
18175
18641
  const PasswordForgotContainer = ({
18176
18642
  style,
@@ -18248,21 +18714,21 @@ const PasswordForgotContainer = ({
18248
18714
  default:
18249
18715
  return state;
18250
18716
  }
18251
- }, initialState$9);
18717
+ }, initialState$a);
18252
18718
  return /*#__PURE__*/React__default.createElement("div", {
18253
18719
  style: { ...style
18254
18720
  },
18255
18721
  className: `pelcro-container pelcro-password-forgot-container ${className}`
18256
- }, /*#__PURE__*/React__default.createElement(Provider$9, {
18722
+ }, /*#__PURE__*/React__default.createElement(Provider$a, {
18257
18723
  value: {
18258
18724
  state,
18259
18725
  dispatch
18260
18726
  }
18261
18727
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
18262
- store: store$9,
18728
+ store: store$a,
18263
18729
  key: i
18264
18730
  })) : /*#__PURE__*/React__default.cloneElement(children, {
18265
- store: store$9
18731
+ store: store$a
18266
18732
  })));
18267
18733
  };
18268
18734
 
@@ -18278,7 +18744,7 @@ const PasswordForgotButton = ({
18278
18744
  emailError
18279
18745
  },
18280
18746
  dispatch
18281
- } = useContext(store$9);
18747
+ } = useContext(store$a);
18282
18748
  const {
18283
18749
  t
18284
18750
  } = useTranslation("passwordForgot");
@@ -18299,7 +18765,7 @@ const PasswordForgotButton = ({
18299
18765
  };
18300
18766
 
18301
18767
  const PasswordForgotEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
18302
- store: store$9
18768
+ store: store$a
18303
18769
  }, props));
18304
18770
 
18305
18771
  const PasswordForgotView = props => {
@@ -18349,7 +18815,7 @@ const PasswordForgotModal = ({
18349
18815
  };
18350
18816
  PasswordForgotModal.viewId = "password-forgot";
18351
18817
 
18352
- const initialState$8 = {
18818
+ const initialState$9 = {
18353
18819
  currentPassword: "",
18354
18820
  newPassword: "",
18355
18821
  confirmNewPassword: "",
@@ -18363,10 +18829,10 @@ const initialState$8 = {
18363
18829
  content: ""
18364
18830
  }
18365
18831
  };
18366
- const store$8 = /*#__PURE__*/createContext(initialState$8);
18832
+ const store$9 = /*#__PURE__*/createContext(initialState$9);
18367
18833
  const {
18368
- Provider: Provider$8
18369
- } = store$8;
18834
+ Provider: Provider$9
18835
+ } = store$9;
18370
18836
  const PasswordChangeContainer = ({
18371
18837
  style,
18372
18838
  className = "",
@@ -18518,21 +18984,21 @@ const PasswordChangeContainer = ({
18518
18984
  default:
18519
18985
  return state;
18520
18986
  }
18521
- }, initialState$8);
18987
+ }, initialState$9);
18522
18988
  return /*#__PURE__*/React__default.createElement("div", {
18523
18989
  style: { ...style
18524
18990
  },
18525
18991
  className: `pelcro-container pelcro-password-change-container ${className}`
18526
- }, /*#__PURE__*/React__default.createElement(Provider$8, {
18992
+ }, /*#__PURE__*/React__default.createElement(Provider$9, {
18527
18993
  value: {
18528
18994
  state,
18529
18995
  dispatch
18530
18996
  }
18531
18997
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
18532
- store: store$8,
18998
+ store: store$9,
18533
18999
  key: i
18534
19000
  })) : /*#__PURE__*/React__default.cloneElement(children, {
18535
- store: store$8
19001
+ store: store$9
18536
19002
  })));
18537
19003
  };
18538
19004
 
@@ -18543,7 +19009,7 @@ function PasswordChangeCurrentPassword(props) {
18543
19009
  currentPassword,
18544
19010
  currentPasswordError
18545
19011
  }
18546
- } = useContext(store$8);
19012
+ } = useContext(store$9);
18547
19013
  const handleBlur = useCallback(() => {
18548
19014
  return dispatch({
18549
19015
  type: VALIDATE_PASSWORD
@@ -18577,7 +19043,7 @@ function PasswordChangeNewPassword(props) {
18577
19043
  newPassword,
18578
19044
  newPasswordError
18579
19045
  }
18580
- } = useContext(store$8);
19046
+ } = useContext(store$9);
18581
19047
  const handleBlur = useCallback(() => {
18582
19048
  return dispatch({
18583
19049
  type: VALIDATE_NEW_PASSWORD
@@ -18611,7 +19077,7 @@ function PasswordChangeConfirmNewPassword(props) {
18611
19077
  confirmNewPassword,
18612
19078
  confirmNewPasswordError
18613
19079
  }
18614
- } = useContext(store$8);
19080
+ } = useContext(store$9);
18615
19081
  const handleBlur = useCallback(() => {
18616
19082
  return dispatch({
18617
19083
  type: VALIDATE_CONFIRM_NEW_PASSWORD
@@ -18652,7 +19118,7 @@ const PasswordChangeButton = ({
18652
19118
  confirmNewPasswordError
18653
19119
  },
18654
19120
  dispatch
18655
- } = useContext(store$8);
19121
+ } = useContext(store$9);
18656
19122
  const {
18657
19123
  t
18658
19124
  } = useTranslation("passwordChange");
@@ -18718,17 +19184,17 @@ const PasswordChangeModal = ({
18718
19184
  };
18719
19185
  PasswordChangeModal.viewId = "password-change";
18720
19186
 
18721
- const initialState$7 = {
19187
+ const initialState$8 = {
18722
19188
  buttonDisabled: false,
18723
19189
  alert: {
18724
19190
  type: "error",
18725
19191
  content: ""
18726
19192
  }
18727
19193
  };
18728
- const store$7 = /*#__PURE__*/createContext(initialState$7);
19194
+ const store$8 = /*#__PURE__*/createContext(initialState$8);
18729
19195
  const {
18730
- Provider: Provider$7
18731
- } = store$7;
19196
+ Provider: Provider$8
19197
+ } = store$8;
18732
19198
 
18733
19199
  const CartContainer = ({
18734
19200
  style,
@@ -18819,21 +19285,21 @@ const CartContainer = ({
18819
19285
  default:
18820
19286
  return state;
18821
19287
  }
18822
- }, initialState$7);
19288
+ }, initialState$8);
18823
19289
  return /*#__PURE__*/React__default.createElement("div", {
18824
19290
  style: { ...style
18825
19291
  },
18826
19292
  className: `pelcro-container pelcro-cart-container ${className}`
18827
- }, /*#__PURE__*/React__default.createElement(Provider$7, {
19293
+ }, /*#__PURE__*/React__default.createElement(Provider$8, {
18828
19294
  value: {
18829
19295
  state,
18830
19296
  dispatch
18831
19297
  }
18832
19298
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
18833
- store: store$7,
19299
+ store: store$8,
18834
19300
  key: i
18835
19301
  })) : /*#__PURE__*/React__default.cloneElement(children, {
18836
- store: store$7
19302
+ store: store$8
18837
19303
  })));
18838
19304
  };
18839
19305
 
@@ -18870,7 +19336,7 @@ const CartSubmit = ({
18870
19336
  buttonDisabled
18871
19337
  },
18872
19338
  dispatch
18873
- } = useContext(store$7);
19339
+ } = useContext(store$8);
18874
19340
  const {
18875
19341
  t
18876
19342
  } = useTranslation("cart");
@@ -18901,7 +19367,7 @@ const CartTotalPrice = () => {
18901
19367
  state: {
18902
19368
  alert
18903
19369
  }
18904
- } = useContext(store$7);
19370
+ } = useContext(store$8);
18905
19371
  const {
18906
19372
  cartItems
18907
19373
  } = usePelcro();
@@ -19214,7 +19680,7 @@ const OrderConfirmModal = props => {
19214
19680
  };
19215
19681
  OrderConfirmModal.viewId = "order-confirm";
19216
19682
 
19217
- const initialState$6 = {
19683
+ const initialState$7 = {
19218
19684
  email: "",
19219
19685
  firstName: "",
19220
19686
  lastName: "",
@@ -19226,10 +19692,10 @@ const initialState$6 = {
19226
19692
  content: ""
19227
19693
  }
19228
19694
  };
19229
- const store$6 = /*#__PURE__*/createContext(initialState$6);
19695
+ const store$7 = /*#__PURE__*/createContext(initialState$7);
19230
19696
  const {
19231
- Provider: Provider$6
19232
- } = store$6;
19697
+ Provider: Provider$7
19698
+ } = store$7;
19233
19699
 
19234
19700
  const GiftCreateContainer = ({
19235
19701
  style,
@@ -19333,21 +19799,21 @@ const GiftCreateContainer = ({
19333
19799
  default:
19334
19800
  return state;
19335
19801
  }
19336
- }, initialState$6);
19802
+ }, initialState$7);
19337
19803
  return /*#__PURE__*/React__default.createElement("div", {
19338
19804
  style: { ...style
19339
19805
  },
19340
19806
  className: `pelcro-container pelcro-gift-create-container ${className}`
19341
- }, /*#__PURE__*/React__default.createElement(Provider$6, {
19807
+ }, /*#__PURE__*/React__default.createElement(Provider$7, {
19342
19808
  value: {
19343
19809
  state,
19344
19810
  dispatch
19345
19811
  }
19346
19812
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
19347
- store: store$6,
19813
+ store: store$7,
19348
19814
  key: i
19349
19815
  })) : /*#__PURE__*/React__default.cloneElement(children, {
19350
- store: store$6
19816
+ store: store$7
19351
19817
  })));
19352
19818
  };
19353
19819
 
@@ -19361,7 +19827,7 @@ const GiftCreateSubmitButton = ({
19361
19827
  state: {
19362
19828
  disableSubmit
19363
19829
  }
19364
- } = useContext(store$6);
19830
+ } = useContext(store$7);
19365
19831
  const {
19366
19832
  t
19367
19833
  } = useTranslation("register");
@@ -19378,15 +19844,15 @@ const GiftCreateSubmitButton = ({
19378
19844
 
19379
19845
  const GiftCreateEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
19380
19846
  initWithUserEmail: false,
19381
- store: store$6
19847
+ store: store$7
19382
19848
  }, props));
19383
19849
 
19384
19850
  const GiftCreateFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
19385
- store: store$6
19851
+ store: store$7
19386
19852
  }, props));
19387
19853
 
19388
19854
  const GiftCreateLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
19389
- store: store$6
19855
+ store: store$7
19390
19856
  }, props));
19391
19857
 
19392
19858
  var _path$h;
@@ -19471,7 +19937,7 @@ const GiftCreateStartDate = props => {
19471
19937
  const {
19472
19938
  dispatch,
19473
19939
  state
19474
- } = useContext(store$6);
19940
+ } = useContext(store$7);
19475
19941
 
19476
19942
  const handleInputChange = value => {
19477
19943
  dispatch({
@@ -19544,7 +20010,7 @@ function GiftCreateMessage(props) {
19544
20010
  const {
19545
20011
  dispatch,
19546
20012
  state
19547
- } = useContext(store$6);
20013
+ } = useContext(store$7);
19548
20014
  const MAX_CHARS_COUNT = 200;
19549
20015
  const remainingCharsCount = (_ref = MAX_CHARS_COUNT - ((_state$giftMessage = state.giftMessage) === null || _state$giftMessage === void 0 ? void 0 : _state$giftMessage.length)) !== null && _ref !== void 0 ? _ref : 0;
19550
20016
 
@@ -19668,7 +20134,7 @@ const GiftCreateModal = ({
19668
20134
  };
19669
20135
  GiftCreateModal.viewId = "gift-create";
19670
20136
 
19671
- const initialState$5 = {
20137
+ const initialState$6 = {
19672
20138
  giftCode: "",
19673
20139
  buttonDisabled: true,
19674
20140
  alert: {
@@ -19676,10 +20142,10 @@ const initialState$5 = {
19676
20142
  content: ""
19677
20143
  }
19678
20144
  };
19679
- const store$5 = /*#__PURE__*/createContext(initialState$5);
20145
+ const store$6 = /*#__PURE__*/createContext(initialState$6);
19680
20146
  const {
19681
- Provider: Provider$5
19682
- } = store$5;
20147
+ Provider: Provider$6
20148
+ } = store$6;
19683
20149
 
19684
20150
  const GiftRedeemContainer = ({
19685
20151
  style,
@@ -19744,21 +20210,21 @@ const GiftRedeemContainer = ({
19744
20210
  default:
19745
20211
  return state;
19746
20212
  }
19747
- }, initialState$5);
20213
+ }, initialState$6);
19748
20214
  return /*#__PURE__*/React__default.createElement("div", {
19749
20215
  style: { ...style
19750
20216
  },
19751
20217
  className: `pelcro-container pelcro-gift-redeem-container ${className}`
19752
- }, /*#__PURE__*/React__default.createElement(Provider$5, {
20218
+ }, /*#__PURE__*/React__default.createElement(Provider$6, {
19753
20219
  value: {
19754
20220
  state,
19755
20221
  dispatch
19756
20222
  }
19757
20223
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
19758
- store: store$5,
20224
+ store: store$6,
19759
20225
  key: i
19760
20226
  })) : /*#__PURE__*/React__default.cloneElement(children, {
19761
- store: store$5
20227
+ store: store$6
19762
20228
  })));
19763
20229
  };
19764
20230
 
@@ -19795,7 +20261,7 @@ function GiftCode({
19795
20261
  }
19796
20262
 
19797
20263
  const GiftRedeemCode = props => /*#__PURE__*/React__default.createElement(GiftCode, Object.assign({
19798
- store: store$5
20264
+ store: store$6
19799
20265
  }, props));
19800
20266
 
19801
20267
  const GiftRedeemSubmitButton = ({
@@ -19808,7 +20274,7 @@ const GiftRedeemSubmitButton = ({
19808
20274
  state: {
19809
20275
  disableSubmit
19810
20276
  }
19811
- } = useContext(store$5);
20277
+ } = useContext(store$6);
19812
20278
  const {
19813
20279
  t
19814
20280
  } = useTranslation("register");
@@ -19901,7 +20367,7 @@ const moveDefaultAddressToStart = addresses => {
19901
20367
  return [defaultAddress, ...addressesWithoutDefault];
19902
20368
  };
19903
20369
 
19904
- const initialState$4 = {
20370
+ const initialState$5 = {
19905
20371
  addresses: [],
19906
20372
  selectedAddressId: null,
19907
20373
  isSubmitting: false,
@@ -19910,10 +20376,10 @@ const initialState$4 = {
19910
20376
  content: ""
19911
20377
  }
19912
20378
  };
19913
- const store$4 = /*#__PURE__*/createContext(initialState$4);
20379
+ const store$5 = /*#__PURE__*/createContext(initialState$5);
19914
20380
  const {
19915
- Provider: Provider$4
19916
- } = store$4;
20381
+ Provider: Provider$5
20382
+ } = store$5;
19917
20383
 
19918
20384
  const AddressSelectContainer = ({
19919
20385
  style,
@@ -20008,7 +20474,7 @@ const AddressSelectContainer = ({
20008
20474
  default:
20009
20475
  return state;
20010
20476
  }
20011
- }, initialState$4);
20477
+ }, initialState$5);
20012
20478
  useEffect(() => {
20013
20479
  var _window$Pelcro$user$r;
20014
20480
 
@@ -20021,16 +20487,16 @@ const AddressSelectContainer = ({
20021
20487
  style: { ...style
20022
20488
  },
20023
20489
  className: `pelcro-container pelcro-address-select-container ${className}`
20024
- }, /*#__PURE__*/React__default.createElement(Provider$4, {
20490
+ }, /*#__PURE__*/React__default.createElement(Provider$5, {
20025
20491
  value: {
20026
20492
  state,
20027
20493
  dispatch
20028
20494
  }
20029
20495
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
20030
- store: store$4,
20496
+ store: store$5,
20031
20497
  key: i
20032
20498
  })) : /*#__PURE__*/React__default.cloneElement(children, {
20033
- store: store$4
20499
+ store: store$5
20034
20500
  })));
20035
20501
  };
20036
20502
 
@@ -20041,7 +20507,7 @@ const AddressSelectList = () => {
20041
20507
  addresses,
20042
20508
  selectedAddressId
20043
20509
  }
20044
- } = useContext(store$4);
20510
+ } = useContext(store$5);
20045
20511
 
20046
20512
  const handleAddressSelect = event => {
20047
20513
  dispatch({
@@ -20085,7 +20551,7 @@ const AddressSelectSubmit = ({
20085
20551
  selectedAddressId,
20086
20552
  isSubmitting
20087
20553
  }
20088
- } = useContext(store$4);
20554
+ } = useContext(store$5);
20089
20555
  const {
20090
20556
  t
20091
20557
  } = useTranslation("address");
@@ -20181,7 +20647,7 @@ const moveDefaultPaymentMethodToStart = paymentMethods => {
20181
20647
  return [defaultPaymentMethod, ...paymentMethodsWithoutDefault];
20182
20648
  };
20183
20649
 
20184
- const initialState$3 = {
20650
+ const initialState$4 = {
20185
20651
  paymentMethods: [],
20186
20652
  selectedPaymentMethodId: null,
20187
20653
  isSubmitting: false,
@@ -20190,10 +20656,10 @@ const initialState$3 = {
20190
20656
  content: ""
20191
20657
  }
20192
20658
  };
20193
- const store$3 = /*#__PURE__*/createContext(initialState$3);
20659
+ const store$4 = /*#__PURE__*/createContext(initialState$4);
20194
20660
  const {
20195
- Provider: Provider$3
20196
- } = store$3;
20661
+ Provider: Provider$4
20662
+ } = store$4;
20197
20663
 
20198
20664
  const PaymentMethodSelectContainer = ({
20199
20665
  style,
@@ -20252,7 +20718,7 @@ const PaymentMethodSelectContainer = ({
20252
20718
  default:
20253
20719
  return state;
20254
20720
  }
20255
- }, initialState$3);
20721
+ }, initialState$4);
20256
20722
  useEffect(() => {
20257
20723
  var _window$Pelcro$user$r3;
20258
20724
 
@@ -20265,16 +20731,16 @@ const PaymentMethodSelectContainer = ({
20265
20731
  style: { ...style
20266
20732
  },
20267
20733
  className: `pelcro-container pelcro-payment-select-container ${className}`
20268
- }, /*#__PURE__*/React__default.createElement(Provider$3, {
20734
+ }, /*#__PURE__*/React__default.createElement(Provider$4, {
20269
20735
  value: {
20270
20736
  state,
20271
20737
  dispatch
20272
20738
  }
20273
20739
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
20274
- store: store$3,
20740
+ store: store$4,
20275
20741
  key: i
20276
20742
  })) : /*#__PURE__*/React__default.cloneElement(children, {
20277
- store: store$3
20743
+ store: store$4
20278
20744
  })));
20279
20745
  };
20280
20746
 
@@ -20288,7 +20754,7 @@ const PaymentMethodSelectList = () => {
20288
20754
  paymentMethods,
20289
20755
  selectedPaymentMethodId
20290
20756
  }
20291
- } = useContext(store$3);
20757
+ } = useContext(store$4);
20292
20758
 
20293
20759
  const handlePaymentMethodSelect = event => {
20294
20760
  dispatch({
@@ -20338,7 +20804,7 @@ const PaymentMethodSelectSubmit = ({
20338
20804
  selectedPaymentMethodId,
20339
20805
  isSubmitting
20340
20806
  }
20341
- } = useContext(store$3);
20807
+ } = useContext(store$4);
20342
20808
  return /*#__PURE__*/React__default.createElement(Button, Object.assign({
20343
20809
  onClick: () => {
20344
20810
  dispatch({
@@ -23130,7 +23596,7 @@ const DashboardOpenButton = () => {
23130
23596
  };
23131
23597
  DashboardOpenButton.viewId = "dashboard-open";
23132
23598
 
23133
- const initialState$2 = {
23599
+ const initialState$3 = {
23134
23600
  imageSrc: null,
23135
23601
  crop: {
23136
23602
  x: 0,
@@ -23144,10 +23610,10 @@ const initialState$2 = {
23144
23610
  content: ""
23145
23611
  }
23146
23612
  };
23147
- const store$2 = /*#__PURE__*/createContext(initialState$2);
23613
+ const store$3 = /*#__PURE__*/createContext(initialState$3);
23148
23614
  const {
23149
- Provider: Provider$2
23150
- } = store$2;
23615
+ Provider: Provider$3
23616
+ } = store$3;
23151
23617
 
23152
23618
  const ProfilePicChangeContainer = ({
23153
23619
  style,
@@ -23281,21 +23747,21 @@ const ProfilePicChangeContainer = ({
23281
23747
  default:
23282
23748
  return state;
23283
23749
  }
23284
- }, initialState$2);
23750
+ }, initialState$3);
23285
23751
  return /*#__PURE__*/React__default.createElement("div", {
23286
23752
  style: { ...style
23287
23753
  },
23288
23754
  className: `pelcro-container pelcro-profile-picture-container ${className}`
23289
- }, /*#__PURE__*/React__default.createElement(Provider$2, {
23755
+ }, /*#__PURE__*/React__default.createElement(Provider$3, {
23290
23756
  value: {
23291
23757
  state,
23292
23758
  dispatch
23293
23759
  }
23294
23760
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
23295
- store: store$2,
23761
+ store: store$3,
23296
23762
  key: i
23297
23763
  })) : /*#__PURE__*/React__default.cloneElement(children, {
23298
- store: store$2
23764
+ store: store$3
23299
23765
  })));
23300
23766
  };
23301
23767
  /**
@@ -23357,7 +23823,7 @@ const ProfilePicChangeButton = ({
23357
23823
  isSubmitting
23358
23824
  },
23359
23825
  dispatch
23360
- } = useContext(store$2);
23826
+ } = useContext(store$3);
23361
23827
  const {
23362
23828
  t
23363
23829
  } = useTranslation("userEdit");
@@ -24725,7 +25191,7 @@ const ProfilePicChangeCropper = ({
24725
25191
  zoom
24726
25192
  },
24727
25193
  dispatch
24728
- } = useContext(store$2);
25194
+ } = useContext(store$3);
24729
25195
  return /*#__PURE__*/React__default.createElement("div", {
24730
25196
  className: `plc-relative plc-w-full plc-h-52 sm:plc-h-96 ${className}`
24731
25197
  }, /*#__PURE__*/React__default.createElement(Cropper, Object.assign({
@@ -24767,7 +25233,7 @@ const ProfilePicChangeZoom = ({
24767
25233
  zoom
24768
25234
  },
24769
25235
  dispatch
24770
- } = useContext(store$2);
25236
+ } = useContext(store$3);
24771
25237
  const {
24772
25238
  t
24773
25239
  } = useTranslation("userEdit");
@@ -24819,7 +25285,7 @@ const ProfilePicChangeSelectButton = ({
24819
25285
  state: {
24820
25286
  isSubmitting
24821
25287
  }
24822
- } = useContext(store$2);
25288
+ } = useContext(store$3);
24823
25289
  const {
24824
25290
  t
24825
25291
  } = useTranslation("userEdit");
@@ -24861,7 +25327,7 @@ const ProfilePicChangeRemoveButton = ({
24861
25327
  state: {
24862
25328
  isSubmitting
24863
25329
  }
24864
- } = useContext(store$2);
25330
+ } = useContext(store$3);
24865
25331
  const {
24866
25332
  t
24867
25333
  } = useTranslation("userEdit");
@@ -24884,7 +25350,7 @@ const ProfilePicChangeWrapper = () => {
24884
25350
  state: {
24885
25351
  imageSrc
24886
25352
  }
24887
- } = useContext(store$2);
25353
+ } = useContext(store$3);
24888
25354
  const {
24889
25355
  t
24890
25356
  } = useTranslation("userEdit");
@@ -24946,17 +25412,17 @@ function ProfilePicChangeModal({
24946
25412
  }
24947
25413
  ProfilePicChangeModal.viewId = "profile-picture";
24948
25414
 
24949
- const initialState$1 = {
25415
+ const initialState$2 = {
24950
25416
  isSubmitting: false,
24951
25417
  alert: {
24952
25418
  type: "error",
24953
25419
  content: ""
24954
25420
  }
24955
25421
  };
24956
- const store$1 = /*#__PURE__*/createContext(initialState$1);
25422
+ const store$2 = /*#__PURE__*/createContext(initialState$2);
24957
25423
  const {
24958
- Provider: Provider$1
24959
- } = store$1;
25424
+ Provider: Provider$2
25425
+ } = store$2;
24960
25426
 
24961
25427
  const EmailVerifyContainer = ({
24962
25428
  style,
@@ -25019,21 +25485,21 @@ const EmailVerifyContainer = ({
25019
25485
  default:
25020
25486
  return state;
25021
25487
  }
25022
- }, initialState$1);
25488
+ }, initialState$2);
25023
25489
  return /*#__PURE__*/React__default.createElement("div", {
25024
25490
  style: { ...style
25025
25491
  },
25026
25492
  className: `pelcro-container pelcro-email-verify-container ${className}`
25027
- }, /*#__PURE__*/React__default.createElement(Provider$1, {
25493
+ }, /*#__PURE__*/React__default.createElement(Provider$2, {
25028
25494
  value: {
25029
25495
  state,
25030
25496
  dispatch
25031
25497
  }
25032
25498
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
25033
- store: store$1,
25499
+ store: store$2,
25034
25500
  key: i
25035
25501
  })) : /*#__PURE__*/React__default.cloneElement(children, {
25036
- store: store$1
25502
+ store: store$2
25037
25503
  })));
25038
25504
  };
25039
25505
 
@@ -25047,7 +25513,7 @@ const EmailVerifyResendButton = ({
25047
25513
  state: {
25048
25514
  isSubmitting
25049
25515
  }
25050
- } = useContext(store$1);
25516
+ } = useContext(store$2);
25051
25517
  const {
25052
25518
  t
25053
25519
  } = useTranslation("verifyEmail");
@@ -25122,6 +25588,170 @@ const EmailVerifyModal = ({
25122
25588
  };
25123
25589
  EmailVerifyModal.viewId = "email-verify";
25124
25590
 
25591
+ const initialState$1 = {
25592
+ isLoading: true,
25593
+ isTokenValid: false,
25594
+ alert: {
25595
+ type: "error",
25596
+ content: ""
25597
+ }
25598
+ };
25599
+ const store$1 = /*#__PURE__*/createContext(initialState$1);
25600
+ const {
25601
+ Provider: Provider$1
25602
+ } = store$1;
25603
+
25604
+ const VerifyLinkTokenContainer = ({
25605
+ style,
25606
+ className = "",
25607
+ onSuccess = () => {},
25608
+ onFailure = () => {},
25609
+ children
25610
+ }) => {
25611
+ const handleVerifyLinkToken = ({}, dispatch) => {
25612
+ const token = window.Pelcro.helpers.getURLParameter("token");
25613
+ window.Pelcro.user.verifyLoginToken({
25614
+ token
25615
+ }, (err, res) => {
25616
+ dispatch({
25617
+ type: LOADING,
25618
+ payload: false
25619
+ });
25620
+
25621
+ if (err) {
25622
+ dispatch({
25623
+ type: SHOW_ALERT,
25624
+ payload: {
25625
+ type: "error",
25626
+ content: getErrorMessages(err)
25627
+ }
25628
+ });
25629
+ onFailure(err);
25630
+ } else {
25631
+ onSuccess(res);
25632
+ }
25633
+ });
25634
+ };
25635
+
25636
+ const [state, dispatch] = useReducerWithSideEffects((state, action) => {
25637
+ switch (action.type) {
25638
+ case SHOW_ALERT:
25639
+ return lib_7({ ...state,
25640
+ alert: action.payload
25641
+ });
25642
+
25643
+ case LOADING:
25644
+ return lib_7({ ...state,
25645
+ isLoading: action.payload
25646
+ });
25647
+
25648
+ case LINK_TOKEN_VERIFY:
25649
+ return lib_5({ ...state,
25650
+ isLoading: true
25651
+ }, (state, dispatch) => handleVerifyLinkToken(state, dispatch));
25652
+
25653
+ default:
25654
+ return state;
25655
+ }
25656
+ }, initialState$1);
25657
+ return /*#__PURE__*/React__default.createElement("div", {
25658
+ style: { ...style
25659
+ },
25660
+ className: `pelcro-container pelcro-login-container ${className}`
25661
+ }, /*#__PURE__*/React__default.createElement(Provider$1, {
25662
+ value: {
25663
+ state,
25664
+ dispatch
25665
+ }
25666
+ }, children.length ? children.map((child, i) => {
25667
+ if (child) {
25668
+ return /*#__PURE__*/React__default.cloneElement(child, {
25669
+ store: store$1,
25670
+ key: i
25671
+ });
25672
+ }
25673
+ }) : /*#__PURE__*/React__default.cloneElement(children, {
25674
+ store: store$1
25675
+ })));
25676
+ };
25677
+
25678
+ const VerifyLinkTokenLoader = () => {
25679
+ useEffect(() => {
25680
+ dispatch({
25681
+ type: LINK_TOKEN_VERIFY
25682
+ });
25683
+ }, []);
25684
+ const {
25685
+ dispatch,
25686
+ state: {
25687
+ isLoading
25688
+ }
25689
+ } = useContext(store$1);
25690
+
25691
+ if (isLoading) {
25692
+ return /*#__PURE__*/React__default.createElement(Loader, {
25693
+ width: 60,
25694
+ height: 100
25695
+ });
25696
+ }
25697
+
25698
+ return /*#__PURE__*/React__default.createElement("div", {
25699
+ className: "plc-max-h-80 plc-overflow-y-auto pelcro-newsletters-wrapper"
25700
+ });
25701
+ };
25702
+
25703
+ /**
25704
+ *
25705
+ */
25706
+
25707
+ function VerifyLinkTokenView(props) {
25708
+ const {
25709
+ t
25710
+ } = useTranslation("verifyLinkToken");
25711
+ return /*#__PURE__*/React__default.createElement("div", {
25712
+ id: "pelcro-login-view"
25713
+ }, /*#__PURE__*/React__default.createElement("div", {
25714
+ className: "plc-mb-6 plc-text-2xl plc-font-semibold plc-text-center plc-text-gray-900 pelcro-title-wrapper"
25715
+ }, /*#__PURE__*/React__default.createElement("h4", null, t("labels.title"))), /*#__PURE__*/React__default.createElement("form", {
25716
+ action: "javascript:void(0);",
25717
+ className: "plc-mt-2 pelcro-form"
25718
+ }, /*#__PURE__*/React__default.createElement(VerifyLinkTokenContainer, props, /*#__PURE__*/React__default.createElement(VerifyLinkTokenLoader, null), /*#__PURE__*/React__default.createElement(AlertWithContext, null))));
25719
+ }
25720
+
25721
+ /**
25722
+ *
25723
+ */
25724
+
25725
+ function VerifyLinkTokenModal({
25726
+ onDisplay,
25727
+ onClose,
25728
+ ...props
25729
+ }) {
25730
+ const {
25731
+ t
25732
+ } = useTranslation("verifyLinkToken");
25733
+ const {
25734
+ resetView
25735
+ } = usePelcro();
25736
+
25737
+ const onSuccess = res => {
25738
+ var _props$onSuccess;
25739
+
25740
+ (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
25741
+ resetView();
25742
+ notify.success(t("messages.success"));
25743
+ };
25744
+
25745
+ return /*#__PURE__*/React__default.createElement(Modal, {
25746
+ id: "pelcro-login-modal",
25747
+ onDisplay: onDisplay,
25748
+ onClose: onClose
25749
+ }, /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(VerifyLinkTokenView, Object.assign({}, props, {
25750
+ onSuccess: onSuccess
25751
+ }))), /*#__PURE__*/React__default.createElement(ModalFooter, null, /*#__PURE__*/React__default.createElement(Authorship, null)));
25752
+ }
25753
+ VerifyLinkTokenModal.viewId = "passwordless-login";
25754
+
25125
25755
  const InvoicePaymentContainer = props => /*#__PURE__*/React__default.createElement(PaymentMethodContainer, Object.assign({
25126
25756
  type: "invoicePayment",
25127
25757
  className: "pelcro-invoice-payment-container"
@@ -25268,6 +25898,8 @@ const InvoiceDetailsView = props => {
25268
25898
  invoice
25269
25899
  } = usePelcro();
25270
25900
  const showPayButton = canPayInvoice(invoice);
25901
+ const showDownloadButton = Boolean(invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf);
25902
+ const hasPlanDetails = Boolean(invoice.plan);
25271
25903
  const creationDate = new Date(invoice === null || invoice === void 0 ? void 0 : invoice.created_at);
25272
25904
  const formattedCreationDate = new Intl.DateTimeFormat("en-CA").format(creationDate);
25273
25905
  return /*#__PURE__*/React__default.createElement("div", {
@@ -25285,7 +25917,7 @@ const InvoiceDetailsView = props => {
25285
25917
  className: "plc-font-bold pelcro-invoice-summary-title"
25286
25918
  }, t("labels.summary")), invoice && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("p", {
25287
25919
  className: "plc-mr-2 pelcro-invoice-creation-date"
25288
- }, `${t("labels.creationDate")} ${formattedCreationDate}`), /*#__PURE__*/React__default.createElement("div", {
25920
+ }, `${t("labels.creationDate")} ${formattedCreationDate}`), hasPlanDetails && /*#__PURE__*/React__default.createElement("div", {
25289
25921
  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"
25290
25922
  }, /*#__PURE__*/React__default.createElement("div", {
25291
25923
  className: "plc-break-words pelcro-invoice-plan-name"
@@ -25311,7 +25943,7 @@ const InvoiceDetailsView = props => {
25311
25943
  className: "plc-font-semibold pelcro-invoice-total"
25312
25944
  }, getFormattedPriceByLocal(invoice.amount_remaining, invoice.currency, getPageOrDefaultLanguage())))))), /*#__PURE__*/React__default.createElement("div", {
25313
25945
  className: "plc-flex plc-items-center plc-justify-center plc-mt-4"
25314
- }, /*#__PURE__*/React__default.createElement(InvoiceDetailsDownloadButton, {
25946
+ }, showDownloadButton && /*#__PURE__*/React__default.createElement(InvoiceDetailsDownloadButton, {
25315
25947
  url: invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf,
25316
25948
  className: "plc-w-full plc-text-center"
25317
25949
  }), showPayButton && /*#__PURE__*/React__default.createElement(InvoiceDetailsPayButton, {
@@ -25351,4 +25983,4 @@ const InvoiceDetailsModal = ({
25351
25983
  };
25352
25984
  InvoiceDetailsModal.viewId = "invoice-details";
25353
25985
 
25354
- export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCreateContainer, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
25986
+ export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCreateContainer, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };