@pelcro/react-pelcro-js 2.4.0 → 2.6.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1408 -499
- package/dist/index.esm.js +1402 -500
- package/dist/pelcro.css +133 -0
- package/package.json +2 -4
package/dist/index.cjs.js
CHANGED
|
@@ -3462,6 +3462,7 @@ var paymentMethod_fr = {
|
|
|
3462
3462
|
};
|
|
3463
3463
|
|
|
3464
3464
|
var title$d = "Enter your email to subscribe to our newsletter";
|
|
3465
|
+
var updateTitle$1 = "Update newsletter selections";
|
|
3465
3466
|
var subtitle$7 = "We may use your email for other marketing communication";
|
|
3466
3467
|
var labels$l = {
|
|
3467
3468
|
submit: "Submit",
|
|
@@ -3473,22 +3474,21 @@ var labels$l = {
|
|
|
3473
3474
|
};
|
|
3474
3475
|
var messages$p = {
|
|
3475
3476
|
alreadyHaveAccount: "Already have an account?",
|
|
3477
|
+
success: "Newsletters were successfully updated",
|
|
3476
3478
|
loginHere: "Login here.",
|
|
3477
3479
|
createAnAccount: " Create an account by clicking ",
|
|
3478
3480
|
here: "here"
|
|
3479
3481
|
};
|
|
3480
|
-
var errors$b = {
|
|
3481
|
-
"": ""
|
|
3482
|
-
};
|
|
3483
3482
|
var newsletter_en = {
|
|
3484
3483
|
title: title$d,
|
|
3484
|
+
updateTitle: updateTitle$1,
|
|
3485
3485
|
subtitle: subtitle$7,
|
|
3486
3486
|
labels: labels$l,
|
|
3487
|
-
messages: messages$p
|
|
3488
|
-
errors: errors$b
|
|
3487
|
+
messages: messages$p
|
|
3489
3488
|
};
|
|
3490
3489
|
|
|
3491
3490
|
var title$c = "Entrez votre adresse courriel pour vous abonner à notre infolettre";
|
|
3491
|
+
var updateTitle = "Mettre à jour son choix d'infolettres";
|
|
3492
3492
|
var subtitle$6 = "Nous pouvons utiliser votre adresse courriel pour d’autres communications marketing";
|
|
3493
3493
|
var labels$k = {
|
|
3494
3494
|
submit: "Lire l’article !",
|
|
@@ -3500,19 +3500,17 @@ var labels$k = {
|
|
|
3500
3500
|
};
|
|
3501
3501
|
var messages$o = {
|
|
3502
3502
|
alreadyHaveAccount: "Vous avez déjà un compte ?",
|
|
3503
|
+
success: "Votre choix d'infolettres à été mis à jour",
|
|
3503
3504
|
loginHere: "Connectez-vous ici",
|
|
3504
3505
|
createAnAccount: " Créez un compte en cliquant ",
|
|
3505
3506
|
here: "ici"
|
|
3506
3507
|
};
|
|
3507
|
-
var errors$a = {
|
|
3508
|
-
"": ""
|
|
3509
|
-
};
|
|
3510
3508
|
var newsletter_fr = {
|
|
3511
3509
|
title: title$c,
|
|
3510
|
+
updateTitle: updateTitle,
|
|
3512
3511
|
subtitle: subtitle$6,
|
|
3513
3512
|
labels: labels$k,
|
|
3514
|
-
messages: messages$o
|
|
3515
|
-
errors: errors$a
|
|
3513
|
+
messages: messages$o
|
|
3516
3514
|
};
|
|
3517
3515
|
|
|
3518
3516
|
var labels$j = {
|
|
@@ -3621,7 +3619,8 @@ var labels$h = {
|
|
|
3621
3619
|
code: "Coupon code",
|
|
3622
3620
|
"for": "for",
|
|
3623
3621
|
interval: "{{count}} {{interval}}",
|
|
3624
|
-
interval_plural: "{{count}} {{interval}}s"
|
|
3622
|
+
interval_plural: "{{count}} {{interval}}s",
|
|
3623
|
+
tax: "+ Tax"
|
|
3625
3624
|
};
|
|
3626
3625
|
var checkoutForm_en = {
|
|
3627
3626
|
messages: messages$j,
|
|
@@ -3646,7 +3645,8 @@ var labels$g = {
|
|
|
3646
3645
|
code: "Code promo",
|
|
3647
3646
|
"for": "pour",
|
|
3648
3647
|
interval: "{{count}} {{interval}}",
|
|
3649
|
-
interval_plural: "{{count}} {{interval}}s"
|
|
3648
|
+
interval_plural: "{{count}} {{interval}}s",
|
|
3649
|
+
tax: "+ Taxe"
|
|
3650
3650
|
};
|
|
3651
3651
|
var checkoutForm_fr = {
|
|
3652
3652
|
messages: messages$i,
|
|
@@ -3658,12 +3658,14 @@ var cancel$1 = "Cancel your subscription online at anytime.";
|
|
|
3658
3658
|
var giftSent$1 = "Subscription gift has been sent to";
|
|
3659
3659
|
var successfully$1 = "successfully";
|
|
3660
3660
|
var entitlement$1 = "Some of the content on this page is available with one or more of our plans. <1>Subscribe</1> now to get full page access.";
|
|
3661
|
+
var recaptcha$1 = "This site is protected by reCAPTCHA and the Google <1>Privacy Policy</1> and <3>Terms of Service</3> apply.";
|
|
3661
3662
|
var messages_en = {
|
|
3662
3663
|
youAreSafe: youAreSafe$1,
|
|
3663
3664
|
cancel: cancel$1,
|
|
3664
3665
|
giftSent: giftSent$1,
|
|
3665
3666
|
successfully: successfully$1,
|
|
3666
|
-
entitlement: entitlement$1
|
|
3667
|
+
entitlement: entitlement$1,
|
|
3668
|
+
recaptcha: recaptcha$1
|
|
3667
3669
|
};
|
|
3668
3670
|
|
|
3669
3671
|
var youAreSafe = "Vous êtes en sécurité - PCI conforme 128 SSL par";
|
|
@@ -3671,12 +3673,14 @@ var cancel = "Annuler votre abonnement en ligne à tout moment.";
|
|
|
3671
3673
|
var giftSent = "Le cadeau d’abonnement a été envoyé à";
|
|
3672
3674
|
var successfully = "avec succès.";
|
|
3673
3675
|
var entitlement = "Une partie du contenu de cette page est disponible sous un ou plusieurs de nos plans. <1>Abonnez-vous</1> à l'un de nos plans disponibles pour accéder à plus de contenu";
|
|
3676
|
+
var recaptcha = "Ce site est protégé par reCAPTCHA - les <1>règles de confidentialité</1> Google ainsi que les <3>conditions d'utilisation</3> s'appliquent.";
|
|
3674
3677
|
var messages_fr = {
|
|
3675
3678
|
youAreSafe: youAreSafe,
|
|
3676
3679
|
cancel: cancel,
|
|
3677
3680
|
giftSent: giftSent,
|
|
3678
3681
|
successfully: successfully,
|
|
3679
|
-
entitlement: entitlement
|
|
3682
|
+
entitlement: entitlement,
|
|
3683
|
+
recaptcha: recaptcha
|
|
3680
3684
|
};
|
|
3681
3685
|
|
|
3682
3686
|
var labels$f = {
|
|
@@ -4359,7 +4363,8 @@ var labels$3 = {
|
|
|
4359
4363
|
title: "Status",
|
|
4360
4364
|
active: "Active",
|
|
4361
4365
|
inTrial: "In trial",
|
|
4362
|
-
endingSoon: "Ending soon"
|
|
4366
|
+
endingSoon: "Ending soon",
|
|
4367
|
+
scheduled: "Scheduled"
|
|
4363
4368
|
},
|
|
4364
4369
|
shipments: "Shipments remaining",
|
|
4365
4370
|
logout: "Logout",
|
|
@@ -4375,6 +4380,7 @@ var labels$3 = {
|
|
|
4375
4380
|
profile: "Profile",
|
|
4376
4381
|
updateProfile: "Edit profile",
|
|
4377
4382
|
changePassword: "Change password",
|
|
4383
|
+
editNewsletters: "Edit newsletters",
|
|
4378
4384
|
edit: "Edit",
|
|
4379
4385
|
gifts: "Gifts",
|
|
4380
4386
|
redeemGift: "Redeem gift",
|
|
@@ -4384,6 +4390,7 @@ var labels$3 = {
|
|
|
4384
4390
|
paymentSource: "Payment cards",
|
|
4385
4391
|
actions: "Actions",
|
|
4386
4392
|
expiresOn: "Ends",
|
|
4393
|
+
startsOn: "Starts",
|
|
4387
4394
|
renewsOn: "Renews",
|
|
4388
4395
|
canceledOn: "Canceled on",
|
|
4389
4396
|
recipient: "Recipient",
|
|
@@ -4435,7 +4442,8 @@ var labels$2 = {
|
|
|
4435
4442
|
title: "Statut",
|
|
4436
4443
|
active: "Active",
|
|
4437
4444
|
inTrial: "Dans l'essai",
|
|
4438
|
-
endingSoon: "Fin bientôt"
|
|
4445
|
+
endingSoon: "Fin bientôt",
|
|
4446
|
+
scheduled: "Programmé"
|
|
4439
4447
|
},
|
|
4440
4448
|
shipments: "Expéditions restantes",
|
|
4441
4449
|
logout: "Déconnexion",
|
|
@@ -4451,6 +4459,7 @@ var labels$2 = {
|
|
|
4451
4459
|
profile: "Profil",
|
|
4452
4460
|
updateProfile: "Mettre à jour le profil",
|
|
4453
4461
|
changePassword: "Changer le mot de passe",
|
|
4462
|
+
editNewsletters: "Modifier les newsletters",
|
|
4454
4463
|
edit: "Modifier",
|
|
4455
4464
|
gifts: "Cadeaux",
|
|
4456
4465
|
redeemGift: "Échanger un cadeau",
|
|
@@ -4460,6 +4469,7 @@ var labels$2 = {
|
|
|
4460
4469
|
paymentSource: "Sources de paiement",
|
|
4461
4470
|
actions: "Actes",
|
|
4462
4471
|
expiresOn: "Expire le",
|
|
4472
|
+
startsOn: "Débute le",
|
|
4463
4473
|
renewsOn: "Renouvelle le",
|
|
4464
4474
|
canceledOn: "Annulé le",
|
|
4465
4475
|
recipient: "Destinataire",
|
|
@@ -4492,7 +4502,7 @@ var messages$2 = {
|
|
|
4492
4502
|
isSureToCancel: "Êtes-vous certain de vouloir annuler votre abonnement?",
|
|
4493
4503
|
loading: "Annulation de l'abonnement",
|
|
4494
4504
|
success: "L'abonnement a été annulé avec succès",
|
|
4495
|
-
error: "Une
|
|
4505
|
+
error: "Une erreur s'est produite lors de l'annulation de l'abonnement"
|
|
4496
4506
|
}
|
|
4497
4507
|
};
|
|
4498
4508
|
var dashboard_fr = {
|
|
@@ -5927,7 +5937,7 @@ class PelcroActions {
|
|
|
5927
5937
|
view,
|
|
5928
5938
|
cartItems,
|
|
5929
5939
|
...otherStateFields
|
|
5930
|
-
} = initialState$
|
|
5940
|
+
} = initialState$g;
|
|
5931
5941
|
this.set(otherStateFields);
|
|
5932
5942
|
});
|
|
5933
5943
|
|
|
@@ -6217,7 +6227,7 @@ class PelcroCallbacks {
|
|
|
6217
6227
|
|
|
6218
6228
|
}
|
|
6219
6229
|
|
|
6220
|
-
const initialState$
|
|
6230
|
+
const initialState$g = {
|
|
6221
6231
|
// View
|
|
6222
6232
|
view: null,
|
|
6223
6233
|
// Plans
|
|
@@ -6245,7 +6255,7 @@ const createPelcroStore = () => createStore(middleware_3((set, get) => {
|
|
|
6245
6255
|
return {
|
|
6246
6256
|
// Store setter
|
|
6247
6257
|
set,
|
|
6248
|
-
...initialState$
|
|
6258
|
+
...initialState$g,
|
|
6249
6259
|
// State actions
|
|
6250
6260
|
...actions,
|
|
6251
6261
|
// Callbacks
|
|
@@ -6325,13 +6335,34 @@ const getAddressById = id => {
|
|
|
6325
6335
|
};
|
|
6326
6336
|
/**
|
|
6327
6337
|
* Transforms locale names stored in our backend like
|
|
6328
|
-
* "en_US" into the
|
|
6338
|
+
* "en_US" into the standard accepted in core i18n methods: "en-US"
|
|
6329
6339
|
* @param {string} localeName
|
|
6330
6340
|
* @return {string | undefined}
|
|
6331
6341
|
* @example getCanonicalLocaleFormat("en_US") => "en-US"
|
|
6332
6342
|
*/
|
|
6333
6343
|
|
|
6334
6344
|
const getCanonicalLocaleFormat = localeName => localeName === null || localeName === void 0 ? void 0 : localeName.replace("_", "-");
|
|
6345
|
+
/**
|
|
6346
|
+
* @param {string} localeName
|
|
6347
|
+
* @return {string | undefined}
|
|
6348
|
+
* @example getLanguageWithoutRegion("en-US") => "en"
|
|
6349
|
+
*/
|
|
6350
|
+
|
|
6351
|
+
const getLanguageWithoutRegion = localeName => {
|
|
6352
|
+
var _getCanonicalLocaleFo;
|
|
6353
|
+
|
|
6354
|
+
return (_getCanonicalLocaleFo = getCanonicalLocaleFormat(localeName)) === null || _getCanonicalLocaleFo === void 0 ? void 0 : _getCanonicalLocaleFo.split("-")[0];
|
|
6355
|
+
};
|
|
6356
|
+
/**
|
|
6357
|
+
* Gets the current page language or fallbacks to site default
|
|
6358
|
+
* @return {string | undefined}
|
|
6359
|
+
*/
|
|
6360
|
+
|
|
6361
|
+
const getPageOrDefaultLanguage = () => {
|
|
6362
|
+
var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
6363
|
+
|
|
6364
|
+
return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.call(_window$Pelcro$site)) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.default_locale);
|
|
6365
|
+
};
|
|
6335
6366
|
/**
|
|
6336
6367
|
* Returns a formatted price string depending on locale
|
|
6337
6368
|
* @param {number} amount
|
|
@@ -6341,7 +6372,7 @@ const getCanonicalLocaleFormat = localeName => localeName === null || localeName
|
|
|
6341
6372
|
* @example getFormattedPriceByLocal(10, 'USD', 'en-US') => "$10.00"
|
|
6342
6373
|
*/
|
|
6343
6374
|
|
|
6344
|
-
const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en
|
|
6375
|
+
const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en") => {
|
|
6345
6376
|
const formatter = new Intl.NumberFormat(getCanonicalLocaleFormat(locale), {
|
|
6346
6377
|
style: "currency",
|
|
6347
6378
|
currency
|
|
@@ -6366,8 +6397,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
6366
6397
|
totalWithoutDividingBy100 += parseFloat(item.price ? (item.price * item.quantity).toFixed(2) : item.amount.toFixed(2));
|
|
6367
6398
|
}
|
|
6368
6399
|
|
|
6369
|
-
|
|
6370
|
-
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, locale);
|
|
6400
|
+
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
6371
6401
|
};
|
|
6372
6402
|
/**
|
|
6373
6403
|
* returns true if the URL contains a supported view trigger URL
|
|
@@ -6376,11 +6406,43 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
6376
6406
|
*/
|
|
6377
6407
|
|
|
6378
6408
|
const isValidViewFromURL = viewID => {
|
|
6379
|
-
if (["login", "register", "plan-select", "gift-redeem", "password-forgot", "password-reset", "password-change", "payment-method-update", "user-edit", "newsletter", "address-create", "order-create", "cart"].includes(viewID)) {
|
|
6409
|
+
if (["login", "register", "plan-select", "gift-redeem", "password-forgot", "password-reset", "password-change", "payment-method-update", "user-edit", "newsletter", "address-create", "order-create", "cart"].includes(viewID) || hasValidNewsletterUpdateUrl()) {
|
|
6380
6410
|
return true;
|
|
6381
6411
|
}
|
|
6382
6412
|
|
|
6383
6413
|
return false;
|
|
6414
|
+
/**
|
|
6415
|
+
*
|
|
6416
|
+
*/
|
|
6417
|
+
|
|
6418
|
+
function hasValidNewsletterUpdateUrl() {
|
|
6419
|
+
var _window$Pelcro2, _window$Pelcro2$uiSet;
|
|
6420
|
+
|
|
6421
|
+
if (viewID !== "newsletter-update") return false;
|
|
6422
|
+
const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
|
|
6423
|
+
const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
|
|
6424
|
+
|
|
6425
|
+
if (!siteHasNewslettersDefined) {
|
|
6426
|
+
return false;
|
|
6427
|
+
}
|
|
6428
|
+
|
|
6429
|
+
const queryParamEmail = window.Pelcro.helpers.getURLParameter("email");
|
|
6430
|
+
|
|
6431
|
+
if (queryParamEmail && window.Pelcro.user.isAuthenticated()) {
|
|
6432
|
+
var _window$Pelcro$user$r4;
|
|
6433
|
+
|
|
6434
|
+
if (queryParamEmail !== ((_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.email)) {
|
|
6435
|
+
console.error("email query parameter and user account email are different, url email query parameter must match user email if user is logged in");
|
|
6436
|
+
return false;
|
|
6437
|
+
}
|
|
6438
|
+
}
|
|
6439
|
+
|
|
6440
|
+
if (!queryParamEmail && !window.Pelcro.user.isAuthenticated()) {
|
|
6441
|
+
return false;
|
|
6442
|
+
}
|
|
6443
|
+
|
|
6444
|
+
return true;
|
|
6445
|
+
}
|
|
6384
6446
|
};
|
|
6385
6447
|
/**
|
|
6386
6448
|
* Returns the current stable viewID from all old variations
|
|
@@ -6412,7 +6474,7 @@ const disableScroll = () => {
|
|
|
6412
6474
|
}
|
|
6413
6475
|
};
|
|
6414
6476
|
const trackSubscriptionOnGA = () => {
|
|
6415
|
-
var _ReactGA$set, _window$Pelcro$user$
|
|
6477
|
+
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;
|
|
6416
6478
|
|
|
6417
6479
|
const {
|
|
6418
6480
|
product,
|
|
@@ -6434,7 +6496,7 @@ const trackSubscriptionOnGA = () => {
|
|
|
6434
6496
|
}
|
|
6435
6497
|
|
|
6436
6498
|
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
|
|
6437
|
-
currencyCode: (_window$Pelcro$user$
|
|
6499
|
+
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
|
|
6438
6500
|
});
|
|
6439
6501
|
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", {
|
|
6440
6502
|
id: lastSubscriptionId,
|
|
@@ -6462,9 +6524,9 @@ const trackSubscriptionOnGA = () => {
|
|
|
6462
6524
|
*/
|
|
6463
6525
|
|
|
6464
6526
|
const userHasPaymentMethod = () => {
|
|
6465
|
-
var _window$Pelcro$user$
|
|
6527
|
+
var _window$Pelcro$user$r7, _window$Pelcro$user$r8;
|
|
6466
6528
|
|
|
6467
|
-
const sources = (_window$Pelcro$user$
|
|
6529
|
+
const sources = (_window$Pelcro$user$r7 = (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.sources) !== null && _window$Pelcro$user$r7 !== void 0 ? _window$Pelcro$user$r7 : [];
|
|
6468
6530
|
return sources.length > 0;
|
|
6469
6531
|
};
|
|
6470
6532
|
/**
|
|
@@ -6530,10 +6592,20 @@ const getPaymentCardIcon$1 = name => {
|
|
|
6530
6592
|
d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"
|
|
6531
6593
|
}));
|
|
6532
6594
|
};
|
|
6595
|
+
/**
|
|
6596
|
+
* Gets the current date with time set to 0
|
|
6597
|
+
* @param {Date} dateObject
|
|
6598
|
+
* @return {Date}
|
|
6599
|
+
*/
|
|
6600
|
+
|
|
6601
|
+
function getDateWithoutTime(dateObject) {
|
|
6602
|
+
const date = new Date(dateObject.getTime());
|
|
6603
|
+
date.setHours(0, 0, 0, 0);
|
|
6604
|
+
return date;
|
|
6605
|
+
}
|
|
6533
6606
|
|
|
6534
|
-
var _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
6535
6607
|
const resources = {
|
|
6536
|
-
|
|
6608
|
+
en: {
|
|
6537
6609
|
common: common_en,
|
|
6538
6610
|
paymentMethod: paymentMethod_en,
|
|
6539
6611
|
newsletter: newsletter_en,
|
|
@@ -6555,7 +6627,7 @@ const resources = {
|
|
|
6555
6627
|
select: select_en,
|
|
6556
6628
|
notification: notification_en
|
|
6557
6629
|
},
|
|
6558
|
-
|
|
6630
|
+
fr: {
|
|
6559
6631
|
common: common_fr,
|
|
6560
6632
|
paymentMethod: paymentMethod_fr,
|
|
6561
6633
|
newsletter: newsletter_fr,
|
|
@@ -6577,13 +6649,14 @@ const resources = {
|
|
|
6577
6649
|
select: select_fr,
|
|
6578
6650
|
notification: notification_fr
|
|
6579
6651
|
}
|
|
6580
|
-
};
|
|
6581
|
-
|
|
6582
|
-
|
|
6652
|
+
}; // set UI language to the page language or default to the language in site settings
|
|
6653
|
+
|
|
6654
|
+
const locale = getPageOrDefaultLanguage();
|
|
6583
6655
|
i18next.use(initReactI18next) // passes i18n down to react-i18next,
|
|
6584
6656
|
.init({
|
|
6585
6657
|
resources,
|
|
6586
|
-
lng:
|
|
6658
|
+
lng: locale,
|
|
6659
|
+
fallbackLng: "en",
|
|
6587
6660
|
// debug: true,
|
|
6588
6661
|
interpolation: {
|
|
6589
6662
|
escapeValue: false // react already safes from xss
|
|
@@ -6594,6 +6667,16 @@ i18next.use(initReactI18next) // passes i18n down to react-i18next,
|
|
|
6594
6667
|
|
|
6595
6668
|
}
|
|
6596
6669
|
});
|
|
6670
|
+
const pageLanguageObserver = new MutationObserver(mutationsList => {
|
|
6671
|
+
mutationsList.forEach(mutationRecord => {
|
|
6672
|
+
if (mutationRecord.attributeName === "lang") {
|
|
6673
|
+
i18next.changeLanguage(window.Pelcro.helpers.getHtmlLanguageAttribute());
|
|
6674
|
+
}
|
|
6675
|
+
});
|
|
6676
|
+
});
|
|
6677
|
+
pageLanguageObserver.observe(document.documentElement, {
|
|
6678
|
+
attributes: true
|
|
6679
|
+
});
|
|
6597
6680
|
|
|
6598
6681
|
function _classPrivateFieldGet(receiver, privateMap) {
|
|
6599
6682
|
var descriptor = privateMap.get(receiver);
|
|
@@ -6846,8 +6929,8 @@ const saveToMetadataButton = new SaveToMetadataButtonClass();
|
|
|
6846
6929
|
|
|
6847
6930
|
let e={data:""},t=t=>"undefined"!=typeof window?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||e,l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(})/g,a=/\/\*[^]*?\*\/|\s\s+|\n/g,n=(e,t)=>{let r,l="",a="",o="";for(let c in e){let s=e[c];"object"==typeof s?(r=t?t.replace(/([^,])+/g,e=>c.replace(/([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):c,a+="@"==c[0]?"f"==c[1]?n(s,c):c+"{"+n(s,"k"==c[1]?"":t)+"}":n(s,r)):"@"==c[0]&&"i"==c[1]?l=c+" "+s+";":(c=c.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=n.p?n.p(c,s):c+":"+s+";");}return o[0]?(r=t?t+"{"+o+"}":o,l+r+a):l+a},o={},c=e=>{let t="";for(let r in e)t+=r+("object"==typeof e[r]?c(e[r]):e[r]);return t},s=(e,t,r,s,i)=>{let p="object"==typeof e?c(e):e,u=o[p]||(o[p]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(p));if(!o[u]){let t="object"==typeof e?e:(e=>{let t,r=[{}];for(;t=l.exec(e.replace(a,""));)t[4]&&r.shift(),t[3]?r.unshift(r[0][t[3]]=r[0][t[3]]||{}):t[4]||(r[0][t[1]]=t[2]);return r[0]})(e);o[u]=n(i?{["@keyframes "+u]:t}:t,r?"":"."+u);}return ((e,t,r)=>{-1==t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(o[u],t,s),u},i=(e,t,r)=>e.reduce((e,l,a)=>{let o=t[a];if(o&&o.call){let e=o(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;o=t?"."+t:e&&"object"==typeof e?e.props?"":n(e,""):e;}return e+l+(null==o?"":o)},"");function p(e){let r=this||{},l=e.call?e(r.p):e;return s(l.unshift?l.raw?i(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>t?Object.assign(e,t.call?t(r.p):t):e,{}):l,t(r.target),r.g,r.o,r.k)}let u,f,d;p.bind({g:1});let b=p.bind({k:1});function h(e,t,r,l){n.p=t,u=e,f=r,d=l;}function y(e,t){let r=this||{};return function(){let l=arguments;function a(n,o){let c=Object.assign({},n),s=c.className||a.className;r.p=Object.assign({theme:f&&f()},c),r.o=/ *go\d+/.test(s),c.className=p.apply(r,l)+(s?" "+s:""),t&&(c.ref=o);let i=c.as||e;return d&&i[0]&&d(c),u(i,c)}return t?t(a):a}}
|
|
6848
6931
|
|
|
6849
|
-
function _extends$
|
|
6850
|
-
_extends$
|
|
6932
|
+
function _extends$v() {
|
|
6933
|
+
_extends$v = Object.assign || function (target) {
|
|
6851
6934
|
for (var i = 1; i < arguments.length; i++) {
|
|
6852
6935
|
var source = arguments[i];
|
|
6853
6936
|
|
|
@@ -6861,7 +6944,7 @@ function _extends$t() {
|
|
|
6861
6944
|
return target;
|
|
6862
6945
|
};
|
|
6863
6946
|
|
|
6864
|
-
return _extends$
|
|
6947
|
+
return _extends$v.apply(this, arguments);
|
|
6865
6948
|
}
|
|
6866
6949
|
|
|
6867
6950
|
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
@@ -6951,7 +7034,7 @@ var clearFromRemoveQueue = function clearFromRemoveQueue(toastId) {
|
|
|
6951
7034
|
var reducer = function reducer(state, action) {
|
|
6952
7035
|
switch (action.type) {
|
|
6953
7036
|
case ActionType.ADD_TOAST:
|
|
6954
|
-
return _extends$
|
|
7037
|
+
return _extends$v({}, state, {
|
|
6955
7038
|
toasts: [action.toast].concat(state.toasts).slice(0, TOAST_LIMIT)
|
|
6956
7039
|
});
|
|
6957
7040
|
|
|
@@ -6961,9 +7044,9 @@ var reducer = function reducer(state, action) {
|
|
|
6961
7044
|
clearFromRemoveQueue(action.toast.id);
|
|
6962
7045
|
}
|
|
6963
7046
|
|
|
6964
|
-
return _extends$
|
|
7047
|
+
return _extends$v({}, state, {
|
|
6965
7048
|
toasts: state.toasts.map(function (t) {
|
|
6966
|
-
return t.id === action.toast.id ? _extends$
|
|
7049
|
+
return t.id === action.toast.id ? _extends$v({}, t, action.toast) : t;
|
|
6967
7050
|
})
|
|
6968
7051
|
});
|
|
6969
7052
|
|
|
@@ -6990,9 +7073,9 @@ var reducer = function reducer(state, action) {
|
|
|
6990
7073
|
});
|
|
6991
7074
|
}
|
|
6992
7075
|
|
|
6993
|
-
return _extends$
|
|
7076
|
+
return _extends$v({}, state, {
|
|
6994
7077
|
toasts: state.toasts.map(function (t) {
|
|
6995
|
-
return t.id === toastId || toastId === undefined ? _extends$
|
|
7078
|
+
return t.id === toastId || toastId === undefined ? _extends$v({}, t, {
|
|
6996
7079
|
visible: false
|
|
6997
7080
|
}) : t;
|
|
6998
7081
|
})
|
|
@@ -7000,28 +7083,28 @@ var reducer = function reducer(state, action) {
|
|
|
7000
7083
|
|
|
7001
7084
|
case ActionType.REMOVE_TOAST:
|
|
7002
7085
|
if (action.toastId === undefined) {
|
|
7003
|
-
return _extends$
|
|
7086
|
+
return _extends$v({}, state, {
|
|
7004
7087
|
toasts: []
|
|
7005
7088
|
});
|
|
7006
7089
|
}
|
|
7007
7090
|
|
|
7008
|
-
return _extends$
|
|
7091
|
+
return _extends$v({}, state, {
|
|
7009
7092
|
toasts: state.toasts.filter(function (t) {
|
|
7010
7093
|
return t.id !== action.toastId;
|
|
7011
7094
|
})
|
|
7012
7095
|
});
|
|
7013
7096
|
|
|
7014
7097
|
case ActionType.START_PAUSE:
|
|
7015
|
-
return _extends$
|
|
7098
|
+
return _extends$v({}, state, {
|
|
7016
7099
|
pausedAt: action.time
|
|
7017
7100
|
});
|
|
7018
7101
|
|
|
7019
7102
|
case ActionType.END_PAUSE:
|
|
7020
7103
|
var diff = action.time - (state.pausedAt || 0);
|
|
7021
|
-
return _extends$
|
|
7104
|
+
return _extends$v({}, state, {
|
|
7022
7105
|
pausedAt: undefined,
|
|
7023
7106
|
toasts: state.toasts.map(function (t) {
|
|
7024
|
-
return _extends$
|
|
7107
|
+
return _extends$v({}, t, {
|
|
7025
7108
|
pauseDuration: t.pauseDuration + diff
|
|
7026
7109
|
});
|
|
7027
7110
|
})
|
|
@@ -7068,12 +7151,12 @@ var useStore = function useStore(toastOptions) {
|
|
|
7068
7151
|
var mergedToasts = state.toasts.map(function (t) {
|
|
7069
7152
|
var _toastOptions$t$type, _toastOptions, _toastOptions$t$type2;
|
|
7070
7153
|
|
|
7071
|
-
return _extends$
|
|
7154
|
+
return _extends$v({}, toastOptions, toastOptions[t.type], t, {
|
|
7072
7155
|
duration: t.duration || ((_toastOptions$t$type = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type.duration) || ((_toastOptions = toastOptions) == null ? void 0 : _toastOptions.duration) || defaultTimeouts[t.type],
|
|
7073
|
-
style: _extends$
|
|
7156
|
+
style: _extends$v({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
|
|
7074
7157
|
});
|
|
7075
7158
|
});
|
|
7076
|
-
return _extends$
|
|
7159
|
+
return _extends$v({}, state, {
|
|
7077
7160
|
toasts: mergedToasts
|
|
7078
7161
|
});
|
|
7079
7162
|
};
|
|
@@ -7083,7 +7166,7 @@ var createToast = function createToast(message, type, opts) {
|
|
|
7083
7166
|
type = 'blank';
|
|
7084
7167
|
}
|
|
7085
7168
|
|
|
7086
|
-
return _extends$
|
|
7169
|
+
return _extends$v({
|
|
7087
7170
|
createdAt: Date.now(),
|
|
7088
7171
|
visible: true,
|
|
7089
7172
|
type: type,
|
|
@@ -7133,14 +7216,14 @@ toast.remove = function (toastId) {
|
|
|
7133
7216
|
};
|
|
7134
7217
|
|
|
7135
7218
|
toast.promise = function (promise, msgs, opts) {
|
|
7136
|
-
var id = toast.loading(msgs.loading, _extends$
|
|
7219
|
+
var id = toast.loading(msgs.loading, _extends$v({}, opts, opts == null ? void 0 : opts.loading));
|
|
7137
7220
|
promise.then(function (p) {
|
|
7138
|
-
toast.success(resolveValue(msgs.success, p), _extends$
|
|
7221
|
+
toast.success(resolveValue(msgs.success, p), _extends$v({
|
|
7139
7222
|
id: id
|
|
7140
7223
|
}, opts, opts == null ? void 0 : opts.success));
|
|
7141
7224
|
return p;
|
|
7142
7225
|
})["catch"](function (e) {
|
|
7143
|
-
toast.error(resolveValue(msgs.error, e), _extends$
|
|
7226
|
+
toast.error(resolveValue(msgs.error, e), _extends$v({
|
|
7144
7227
|
id: id
|
|
7145
7228
|
}, opts, opts == null ? void 0 : opts.error));
|
|
7146
7229
|
});
|
|
@@ -7479,7 +7562,7 @@ var ToastBar = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
7479
7562
|
var message = React.createElement(Message, Object.assign({}, toast.ariaProps), resolveValue(toast.message, toast));
|
|
7480
7563
|
return React.createElement(ToastBarBase, {
|
|
7481
7564
|
className: toast.className,
|
|
7482
|
-
style: _extends$
|
|
7565
|
+
style: _extends$v({}, animationStyle, style, toast.style)
|
|
7483
7566
|
}, typeof children === 'function' ? children({
|
|
7484
7567
|
icon: icon,
|
|
7485
7568
|
message: message
|
|
@@ -7509,7 +7592,7 @@ var getPositionStyle = function getPositionStyle(position, offset) {
|
|
|
7509
7592
|
} : position.includes('right') ? {
|
|
7510
7593
|
justifyContent: 'flex-end'
|
|
7511
7594
|
} : {};
|
|
7512
|
-
return _extends$
|
|
7595
|
+
return _extends$v({
|
|
7513
7596
|
left: 0,
|
|
7514
7597
|
right: 0,
|
|
7515
7598
|
display: 'flex',
|
|
@@ -7536,7 +7619,7 @@ var Toaster = function Toaster(_ref) {
|
|
|
7536
7619
|
handlers = _useToaster.handlers;
|
|
7537
7620
|
|
|
7538
7621
|
return React.createElement("div", {
|
|
7539
|
-
style: _extends$
|
|
7622
|
+
style: _extends$v({
|
|
7540
7623
|
position: 'fixed',
|
|
7541
7624
|
zIndex: 9999,
|
|
7542
7625
|
top: DEFAULT_OFFSET,
|
|
@@ -7571,82 +7654,82 @@ var Toaster = function Toaster(_ref) {
|
|
|
7571
7654
|
}));
|
|
7572
7655
|
};
|
|
7573
7656
|
|
|
7574
|
-
var _path$
|
|
7657
|
+
var _path$s;
|
|
7575
7658
|
|
|
7576
|
-
function _extends$
|
|
7659
|
+
function _extends$u() { _extends$u = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
|
|
7577
7660
|
|
|
7578
7661
|
function SvgCheckSolid(props) {
|
|
7579
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
7662
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$u({
|
|
7580
7663
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7581
7664
|
className: "h-5 w-5",
|
|
7582
7665
|
viewBox: "0 0 20 20",
|
|
7583
7666
|
fill: "currentColor"
|
|
7584
|
-
}, props), _path$
|
|
7667
|
+
}, props), _path$s || (_path$s = /*#__PURE__*/React__namespace.createElement("path", {
|
|
7585
7668
|
fillRule: "evenodd",
|
|
7586
7669
|
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
|
|
7587
7670
|
clipRule: "evenodd"
|
|
7588
7671
|
})));
|
|
7589
7672
|
}
|
|
7590
7673
|
|
|
7591
|
-
var _path$
|
|
7674
|
+
var _path$r;
|
|
7592
7675
|
|
|
7593
|
-
function _extends$
|
|
7676
|
+
function _extends$t() { _extends$t = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
|
|
7594
7677
|
|
|
7595
7678
|
function SvgXIcon(props) {
|
|
7596
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
7679
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
|
|
7597
7680
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7598
7681
|
viewBox: "0 0 20 20",
|
|
7599
7682
|
fill: "currentColor"
|
|
7600
|
-
}, props), _path$
|
|
7683
|
+
}, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
|
|
7601
7684
|
fill: "evenodd",
|
|
7602
7685
|
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
|
7603
7686
|
clipRule: "evenodd"
|
|
7604
7687
|
})));
|
|
7605
7688
|
}
|
|
7606
7689
|
|
|
7607
|
-
var _path$
|
|
7690
|
+
var _path$q;
|
|
7608
7691
|
|
|
7609
|
-
function _extends$
|
|
7692
|
+
function _extends$s() { _extends$s = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
|
|
7610
7693
|
|
|
7611
7694
|
function SvgXIconSolid(props) {
|
|
7612
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
7695
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
|
|
7613
7696
|
className: "plc-w-4 plc-h-4",
|
|
7614
7697
|
fill: "currentColor",
|
|
7615
7698
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7616
7699
|
viewBox: "0 0 100 100"
|
|
7617
|
-
}, props), _path$
|
|
7700
|
+
}, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
|
|
7618
7701
|
d: "M94.842 48.408c0 24.852-20.148 44.999-45.002 44.999-24.851 0-44.997-20.146-44.997-44.999 0-24.854 20.146-45 44.997-45 24.853 0 45.002 20.146 45.002 45zM71.073 64.841L54.73 48.497l16.344-16.344-4.979-4.979-16.343 16.345-16.343-16.344-4.799 4.799 16.344 16.344L28.61 64.661l4.979 4.978 16.344-16.344 16.343 16.344 4.797-4.798z"
|
|
7619
7702
|
})));
|
|
7620
7703
|
}
|
|
7621
7704
|
|
|
7622
|
-
var _path$
|
|
7705
|
+
var _path$p;
|
|
7623
7706
|
|
|
7624
|
-
function _extends$
|
|
7707
|
+
function _extends$r() { _extends$r = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
|
|
7625
7708
|
|
|
7626
7709
|
function SvgExclamation(props) {
|
|
7627
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
7710
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
|
|
7628
7711
|
className: "plc-w-4 plc-h-4 plc-mr-1",
|
|
7629
7712
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7630
7713
|
viewBox: "0 0 20 20",
|
|
7631
7714
|
fill: "currentColor"
|
|
7632
|
-
}, props), _path$
|
|
7715
|
+
}, props), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
|
|
7633
7716
|
fillRule: "evenodd",
|
|
7634
7717
|
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",
|
|
7635
7718
|
clipRule: "evenodd"
|
|
7636
7719
|
})));
|
|
7637
7720
|
}
|
|
7638
7721
|
|
|
7639
|
-
var _path$
|
|
7722
|
+
var _path$o, _path2$3;
|
|
7640
7723
|
|
|
7641
|
-
function _extends$
|
|
7724
|
+
function _extends$q() { _extends$q = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
|
|
7642
7725
|
|
|
7643
7726
|
function SvgSpinner(props) {
|
|
7644
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
7727
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
|
|
7645
7728
|
className: "plc-animate-spin",
|
|
7646
7729
|
viewBox: "0 0 24 24",
|
|
7647
7730
|
fill: "currentColor",
|
|
7648
7731
|
xmlns: "http://www.w3.org/2000/svg"
|
|
7649
|
-
}, props), _path$
|
|
7732
|
+
}, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
|
|
7650
7733
|
opacity: 0.2,
|
|
7651
7734
|
fill: "evenodd",
|
|
7652
7735
|
clipRule: "evenodd",
|
|
@@ -7872,6 +7955,16 @@ const init$1 = () => {
|
|
|
7872
7955
|
}
|
|
7873
7956
|
}
|
|
7874
7957
|
|
|
7958
|
+
const pelcroUpdateNewslettersButtons = document.getElementsByClassName("pelcro-update-newsletters-button");
|
|
7959
|
+
|
|
7960
|
+
if (pelcroUpdateNewslettersButtons.length !== 0) {
|
|
7961
|
+
for (let i = 0; i < pelcroUpdateNewslettersButtons.length; i++) {
|
|
7962
|
+
pelcroUpdateNewslettersButtons[i].addEventListener("click", () => {
|
|
7963
|
+
switchView("newsletter-update");
|
|
7964
|
+
});
|
|
7965
|
+
}
|
|
7966
|
+
}
|
|
7967
|
+
|
|
7875
7968
|
const pelcroCartButtonsByClass = document.getElementsByClassName("pelcro-cart-button");
|
|
7876
7969
|
|
|
7877
7970
|
if (pelcroCartButtonsByClass.length !== 0) {
|
|
@@ -8197,6 +8290,175 @@ function shouldBlurContent(entitlements) {
|
|
|
8197
8290
|
return entitlements.every(entitlement => !window.Pelcro.user.isEntitledTo(entitlement));
|
|
8198
8291
|
}
|
|
8199
8292
|
|
|
8293
|
+
var pure$1 = createCommonjsModule(function (module, exports) {
|
|
8294
|
+
|
|
8295
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8296
|
+
|
|
8297
|
+
function _typeof(obj) {
|
|
8298
|
+
"@babel/helpers - typeof";
|
|
8299
|
+
|
|
8300
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
8301
|
+
_typeof = function (obj) {
|
|
8302
|
+
return typeof obj;
|
|
8303
|
+
};
|
|
8304
|
+
} else {
|
|
8305
|
+
_typeof = function (obj) {
|
|
8306
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
8307
|
+
};
|
|
8308
|
+
}
|
|
8309
|
+
|
|
8310
|
+
return _typeof(obj);
|
|
8311
|
+
}
|
|
8312
|
+
|
|
8313
|
+
var V3_URL = 'https://js.stripe.com/v3';
|
|
8314
|
+
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
8315
|
+
var EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
|
|
8316
|
+
var findScript = function findScript() {
|
|
8317
|
+
var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
|
|
8318
|
+
|
|
8319
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
8320
|
+
var script = scripts[i];
|
|
8321
|
+
|
|
8322
|
+
if (!V3_URL_REGEX.test(script.src)) {
|
|
8323
|
+
continue;
|
|
8324
|
+
}
|
|
8325
|
+
|
|
8326
|
+
return script;
|
|
8327
|
+
}
|
|
8328
|
+
|
|
8329
|
+
return null;
|
|
8330
|
+
};
|
|
8331
|
+
|
|
8332
|
+
var injectScript = function injectScript(params) {
|
|
8333
|
+
var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
|
|
8334
|
+
var script = document.createElement('script');
|
|
8335
|
+
script.src = "".concat(V3_URL).concat(queryString);
|
|
8336
|
+
var headOrBody = document.head || document.body;
|
|
8337
|
+
|
|
8338
|
+
if (!headOrBody) {
|
|
8339
|
+
throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
|
|
8340
|
+
}
|
|
8341
|
+
|
|
8342
|
+
headOrBody.appendChild(script);
|
|
8343
|
+
return script;
|
|
8344
|
+
};
|
|
8345
|
+
|
|
8346
|
+
var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
8347
|
+
if (!stripe || !stripe._registerWrapper) {
|
|
8348
|
+
return;
|
|
8349
|
+
}
|
|
8350
|
+
|
|
8351
|
+
stripe._registerWrapper({
|
|
8352
|
+
name: 'stripe-js',
|
|
8353
|
+
version: "1.21.1",
|
|
8354
|
+
startTime: startTime
|
|
8355
|
+
});
|
|
8356
|
+
};
|
|
8357
|
+
|
|
8358
|
+
var stripePromise = null;
|
|
8359
|
+
var loadScript = function loadScript(params) {
|
|
8360
|
+
// Ensure that we only attempt to load Stripe.js at most once
|
|
8361
|
+
if (stripePromise !== null) {
|
|
8362
|
+
return stripePromise;
|
|
8363
|
+
}
|
|
8364
|
+
|
|
8365
|
+
stripePromise = new Promise(function (resolve, reject) {
|
|
8366
|
+
if (typeof window === 'undefined') {
|
|
8367
|
+
// Resolve to null when imported server side. This makes the module
|
|
8368
|
+
// safe to import in an isomorphic code base.
|
|
8369
|
+
resolve(null);
|
|
8370
|
+
return;
|
|
8371
|
+
}
|
|
8372
|
+
|
|
8373
|
+
if (window.Stripe && params) {
|
|
8374
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
8375
|
+
}
|
|
8376
|
+
|
|
8377
|
+
if (window.Stripe) {
|
|
8378
|
+
resolve(window.Stripe);
|
|
8379
|
+
return;
|
|
8380
|
+
}
|
|
8381
|
+
|
|
8382
|
+
try {
|
|
8383
|
+
var script = findScript();
|
|
8384
|
+
|
|
8385
|
+
if (script && params) {
|
|
8386
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
8387
|
+
} else if (!script) {
|
|
8388
|
+
script = injectScript(params);
|
|
8389
|
+
}
|
|
8390
|
+
|
|
8391
|
+
script.addEventListener('load', function () {
|
|
8392
|
+
if (window.Stripe) {
|
|
8393
|
+
resolve(window.Stripe);
|
|
8394
|
+
} else {
|
|
8395
|
+
reject(new Error('Stripe.js not available'));
|
|
8396
|
+
}
|
|
8397
|
+
});
|
|
8398
|
+
script.addEventListener('error', function () {
|
|
8399
|
+
reject(new Error('Failed to load Stripe.js'));
|
|
8400
|
+
});
|
|
8401
|
+
} catch (error) {
|
|
8402
|
+
reject(error);
|
|
8403
|
+
return;
|
|
8404
|
+
}
|
|
8405
|
+
});
|
|
8406
|
+
return stripePromise;
|
|
8407
|
+
};
|
|
8408
|
+
var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
8409
|
+
if (maybeStripe === null) {
|
|
8410
|
+
return null;
|
|
8411
|
+
}
|
|
8412
|
+
|
|
8413
|
+
var stripe = maybeStripe.apply(undefined, args);
|
|
8414
|
+
registerWrapper(stripe, startTime);
|
|
8415
|
+
return stripe;
|
|
8416
|
+
};
|
|
8417
|
+
var validateLoadParams = function validateLoadParams(params) {
|
|
8418
|
+
var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
|
|
8419
|
+
|
|
8420
|
+
if (params === null || _typeof(params) !== 'object') {
|
|
8421
|
+
throw new Error(errorMessage);
|
|
8422
|
+
}
|
|
8423
|
+
|
|
8424
|
+
if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === 'boolean') {
|
|
8425
|
+
return params;
|
|
8426
|
+
}
|
|
8427
|
+
|
|
8428
|
+
throw new Error(errorMessage);
|
|
8429
|
+
};
|
|
8430
|
+
|
|
8431
|
+
var loadParams;
|
|
8432
|
+
var loadStripeCalled = false;
|
|
8433
|
+
var loadStripe = function loadStripe() {
|
|
8434
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8435
|
+
args[_key] = arguments[_key];
|
|
8436
|
+
}
|
|
8437
|
+
|
|
8438
|
+
loadStripeCalled = true;
|
|
8439
|
+
var startTime = Date.now();
|
|
8440
|
+
return loadScript(loadParams).then(function (maybeStripe) {
|
|
8441
|
+
return initStripe(maybeStripe, args, startTime);
|
|
8442
|
+
});
|
|
8443
|
+
};
|
|
8444
|
+
|
|
8445
|
+
loadStripe.setLoadParameters = function (params) {
|
|
8446
|
+
if (loadStripeCalled) {
|
|
8447
|
+
throw new Error('You cannot change load parameters after calling loadStripe');
|
|
8448
|
+
}
|
|
8449
|
+
|
|
8450
|
+
loadParams = validateLoadParams(params);
|
|
8451
|
+
};
|
|
8452
|
+
|
|
8453
|
+
exports.loadStripe = loadStripe;
|
|
8454
|
+
});
|
|
8455
|
+
|
|
8456
|
+
unwrapExports(pure$1);
|
|
8457
|
+
pure$1.loadStripe;
|
|
8458
|
+
|
|
8459
|
+
var pure = pure$1;
|
|
8460
|
+
var pure_1 = pure.loadStripe;
|
|
8461
|
+
|
|
8200
8462
|
/**
|
|
8201
8463
|
* @typedef {Object} OptionsType
|
|
8202
8464
|
* @property {boolean} loadPaymentSDKs
|
|
@@ -8222,6 +8484,7 @@ const optionsController = options => {
|
|
|
8222
8484
|
enableURLTriggers: initViewFromURL,
|
|
8223
8485
|
enableTheme: applyPelcroTheme,
|
|
8224
8486
|
enablePaywalls: initPaywalls,
|
|
8487
|
+
loadSecuritySDK: initSecuritySdk,
|
|
8225
8488
|
enableGoogleAnalytics: initGATracking
|
|
8226
8489
|
}; // Only execute enabled options
|
|
8227
8490
|
|
|
@@ -8266,8 +8529,15 @@ const initPaywalls = () => {
|
|
|
8266
8529
|
}
|
|
8267
8530
|
};
|
|
8268
8531
|
const loadPaymentSDKs = () => {
|
|
8269
|
-
//
|
|
8270
|
-
|
|
8532
|
+
// Lazy load stripe's SDK
|
|
8533
|
+
const {
|
|
8534
|
+
whenUserReady
|
|
8535
|
+
} = usePelcro.getStore();
|
|
8536
|
+
whenUserReady(() => {
|
|
8537
|
+
if (!window.Stripe) {
|
|
8538
|
+
pure_1(window.Pelcro.environment.stripe);
|
|
8539
|
+
}
|
|
8540
|
+
}); // Load PayPal SDK's
|
|
8271
8541
|
|
|
8272
8542
|
const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
|
|
8273
8543
|
|
|
@@ -8276,6 +8546,18 @@ const loadPaymentSDKs = () => {
|
|
|
8276
8546
|
window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.69.0/js/paypal-checkout.min.js", "braintree-paypal-sdk");
|
|
8277
8547
|
}
|
|
8278
8548
|
};
|
|
8549
|
+
const initSecuritySdk = () => {
|
|
8550
|
+
const {
|
|
8551
|
+
whenSiteReady
|
|
8552
|
+
} = usePelcro.getStore();
|
|
8553
|
+
whenSiteReady(() => {
|
|
8554
|
+
var _window$Pelcro$site$r2;
|
|
8555
|
+
|
|
8556
|
+
const securityKey = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.security_key;
|
|
8557
|
+
if (!securityKey) return;
|
|
8558
|
+
window.Pelcro.helpers.loadSDK(`https://www.google.com/recaptcha/enterprise.js?render=${securityKey}`, "pelcro-security-enteprise");
|
|
8559
|
+
});
|
|
8560
|
+
};
|
|
8279
8561
|
const initGATracking = () => {
|
|
8280
8562
|
var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
|
|
8281
8563
|
|
|
@@ -8362,9 +8644,9 @@ const applyPelcroTheme = () => {
|
|
|
8362
8644
|
};
|
|
8363
8645
|
|
|
8364
8646
|
whenSiteReady(() => {
|
|
8365
|
-
var _window$Pelcro$site$
|
|
8647
|
+
var _window$Pelcro$site$r3, _window$Pelcro$site$r4;
|
|
8366
8648
|
|
|
8367
|
-
const primaryColorHex = (_window$Pelcro$site$
|
|
8649
|
+
const primaryColorHex = (_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : (_window$Pelcro$site$r4 = _window$Pelcro$site$r3.design_settings) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.primary_color;
|
|
8368
8650
|
|
|
8369
8651
|
if (!primaryColorHex) {
|
|
8370
8652
|
return;
|
|
@@ -8563,6 +8845,7 @@ const defaultOptions = {
|
|
|
8563
8845
|
enableURLTriggers: true,
|
|
8564
8846
|
enableTheme: true,
|
|
8565
8847
|
enablePaywalls: true,
|
|
8848
|
+
loadSecuritySDK: true,
|
|
8566
8849
|
enableGoogleAnalytics: false
|
|
8567
8850
|
};
|
|
8568
8851
|
const PelcroModalController = ({
|
|
@@ -8861,6 +9144,7 @@ const GET_STATES_SUCCESS = "GET_STATES_SUCCESS";
|
|
|
8861
9144
|
const GET_STATES_FETCH = "GET_STATES_FETCH";
|
|
8862
9145
|
const HANDLE_SUBMIT = "HANDLE_SUBMIT";
|
|
8863
9146
|
const SET_UPDATED_PRICE = "SET_UPDATED_PRICE";
|
|
9147
|
+
const SET_TAX_AMOUNT = "SET_TAX_AMOUNT";
|
|
8864
9148
|
const SET_CAN_MAKE_PAYMENT = "SET_CAN_MAKE_PAYMENT";
|
|
8865
9149
|
const SET_PAYMENT_REQUEST = "SET_PAYMENT_REQUEST";
|
|
8866
9150
|
const INIT_CONTAINER = "INIT_CONTAINER";
|
|
@@ -8889,6 +9173,9 @@ const SET_IMAGE_SRC = "SET_IMAGE_SRC";
|
|
|
8889
9173
|
const PASSWORD_CHANGE_SUCCESS = "PASSWORD_CHANGE_SUCCESS";
|
|
8890
9174
|
const SELECT_PAYMENT_METHOD = "SELECT_PAYMENT_METHOD";
|
|
8891
9175
|
const LOAD_PAYMENT_METHODS = "LOAD_PAYMENT_METHODS";
|
|
9176
|
+
const GET_NEWSLETTERS_FETCH = "GET_NEWSLETTERS_FETCH";
|
|
9177
|
+
const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
|
|
9178
|
+
const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
|
|
8892
9179
|
|
|
8893
9180
|
/**
|
|
8894
9181
|
* Extracts error message from the response error object
|
|
@@ -8950,7 +9237,7 @@ const debounce = (func, waitTime) => {
|
|
|
8950
9237
|
};
|
|
8951
9238
|
};
|
|
8952
9239
|
|
|
8953
|
-
const initialState$
|
|
9240
|
+
const initialState$f = {
|
|
8954
9241
|
email: "",
|
|
8955
9242
|
password: "",
|
|
8956
9243
|
emailError: null,
|
|
@@ -8961,10 +9248,10 @@ const initialState$e = {
|
|
|
8961
9248
|
content: ""
|
|
8962
9249
|
}
|
|
8963
9250
|
};
|
|
8964
|
-
const store$
|
|
9251
|
+
const store$f = /*#__PURE__*/React.createContext(initialState$f);
|
|
8965
9252
|
const {
|
|
8966
|
-
Provider: Provider$
|
|
8967
|
-
} = store$
|
|
9253
|
+
Provider: Provider$f
|
|
9254
|
+
} = store$f;
|
|
8968
9255
|
|
|
8969
9256
|
const LoginContainer = ({
|
|
8970
9257
|
style,
|
|
@@ -9071,7 +9358,7 @@ const LoginContainer = ({
|
|
|
9071
9358
|
});
|
|
9072
9359
|
|
|
9073
9360
|
case RESET_LOGIN_FORM:
|
|
9074
|
-
return initialState$
|
|
9361
|
+
return initialState$f;
|
|
9075
9362
|
|
|
9076
9363
|
case DISABLE_LOGIN_BUTTON:
|
|
9077
9364
|
return lib_7({ ...state,
|
|
@@ -9089,12 +9376,12 @@ const LoginContainer = ({
|
|
|
9089
9376
|
default:
|
|
9090
9377
|
return state;
|
|
9091
9378
|
}
|
|
9092
|
-
}, initialState$
|
|
9379
|
+
}, initialState$f);
|
|
9093
9380
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
9094
9381
|
style: { ...style
|
|
9095
9382
|
},
|
|
9096
9383
|
className: `pelcro-container pelcro-login-container ${className}`
|
|
9097
|
-
}, /*#__PURE__*/React__default['default'].createElement(Provider$
|
|
9384
|
+
}, /*#__PURE__*/React__default['default'].createElement(Provider$f, {
|
|
9098
9385
|
value: {
|
|
9099
9386
|
state,
|
|
9100
9387
|
dispatch
|
|
@@ -9102,12 +9389,12 @@ const LoginContainer = ({
|
|
|
9102
9389
|
}, children.length ? children.map((child, i) => {
|
|
9103
9390
|
if (child) {
|
|
9104
9391
|
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
9105
|
-
store: store$
|
|
9392
|
+
store: store$f,
|
|
9106
9393
|
key: i
|
|
9107
9394
|
});
|
|
9108
9395
|
}
|
|
9109
9396
|
}) : /*#__PURE__*/React__default['default'].cloneElement(children, {
|
|
9110
|
-
store: store$
|
|
9397
|
+
store: store$f
|
|
9111
9398
|
})));
|
|
9112
9399
|
};
|
|
9113
9400
|
|
|
@@ -9352,7 +9639,7 @@ const LoginButton = ({
|
|
|
9352
9639
|
buttonDisabled
|
|
9353
9640
|
},
|
|
9354
9641
|
dispatch
|
|
9355
|
-
} = React.useContext(store$
|
|
9642
|
+
} = React.useContext(store$f);
|
|
9356
9643
|
const {
|
|
9357
9644
|
t
|
|
9358
9645
|
} = useTranslation("login");
|
|
@@ -9373,23 +9660,23 @@ const LoginButton = ({
|
|
|
9373
9660
|
};
|
|
9374
9661
|
|
|
9375
9662
|
const LoginEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
|
|
9376
|
-
store: store$
|
|
9663
|
+
store: store$f
|
|
9377
9664
|
}, props));
|
|
9378
9665
|
|
|
9379
9666
|
const LoginPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
|
|
9380
|
-
store: store$
|
|
9667
|
+
store: store$f
|
|
9381
9668
|
}, props));
|
|
9382
9669
|
|
|
9383
|
-
var _path$
|
|
9670
|
+
var _path$n;
|
|
9384
9671
|
|
|
9385
|
-
function _extends$
|
|
9672
|
+
function _extends$p() { _extends$p = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
|
|
9386
9673
|
|
|
9387
9674
|
function SvgCheck(props) {
|
|
9388
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
9675
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
|
|
9389
9676
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9390
9677
|
fill: "currentColor",
|
|
9391
9678
|
viewBox: "0 0 20 20"
|
|
9392
|
-
}, props), _path$
|
|
9679
|
+
}, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
|
|
9393
9680
|
fillRule: "evenodd",
|
|
9394
9681
|
d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
|
|
9395
9682
|
clipRule: "evenodd"
|
|
@@ -9454,7 +9741,7 @@ var facebookLoginRenderProps = createCommonjsModule(function (module, exports) {
|
|
|
9454
9741
|
var FacebookLogin = unwrapExports(facebookLoginRenderProps);
|
|
9455
9742
|
facebookLoginRenderProps.FacebookLogin;
|
|
9456
9743
|
|
|
9457
|
-
const initialState$
|
|
9744
|
+
const initialState$e = {
|
|
9458
9745
|
email: "",
|
|
9459
9746
|
password: "",
|
|
9460
9747
|
emailError: null,
|
|
@@ -9471,10 +9758,10 @@ const initialState$d = {
|
|
|
9471
9758
|
content: ""
|
|
9472
9759
|
}
|
|
9473
9760
|
};
|
|
9474
|
-
const store$
|
|
9761
|
+
const store$e = /*#__PURE__*/React.createContext(initialState$e);
|
|
9475
9762
|
const {
|
|
9476
|
-
Provider: Provider$
|
|
9477
|
-
} = store$
|
|
9763
|
+
Provider: Provider$e
|
|
9764
|
+
} = store$e;
|
|
9478
9765
|
|
|
9479
9766
|
const RegisterContainer = ({
|
|
9480
9767
|
style,
|
|
@@ -9499,35 +9786,53 @@ const RegisterContainer = ({
|
|
|
9499
9786
|
jobTitle,
|
|
9500
9787
|
selectFields
|
|
9501
9788
|
} = filteredData;
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
dispatch({
|
|
9514
|
-
type: DISABLE_REGISTRATION_BUTTON,
|
|
9515
|
-
payload: false
|
|
9789
|
+
|
|
9790
|
+
if (!hasSecurityTokenEnabled$1()) {
|
|
9791
|
+
sendRegisterRequest();
|
|
9792
|
+
return;
|
|
9793
|
+
}
|
|
9794
|
+
|
|
9795
|
+
window.grecaptcha.enterprise.ready(async () => {
|
|
9796
|
+
var _window$Pelcro$site$r;
|
|
9797
|
+
|
|
9798
|
+
const token = await window.grecaptcha.enterprise.execute((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.security_key, {
|
|
9799
|
+
action: "register"
|
|
9516
9800
|
});
|
|
9801
|
+
sendRegisterRequest(token);
|
|
9802
|
+
});
|
|
9517
9803
|
|
|
9518
|
-
|
|
9804
|
+
function sendRegisterRequest(securityToken) {
|
|
9805
|
+
window.Pelcro.user.register({
|
|
9806
|
+
email,
|
|
9807
|
+
password,
|
|
9808
|
+
first_name: firstName,
|
|
9809
|
+
last_name: lastName,
|
|
9810
|
+
security_token: securityToken,
|
|
9811
|
+
metadata: {
|
|
9812
|
+
organization,
|
|
9813
|
+
jobTitle,
|
|
9814
|
+
...selectFields
|
|
9815
|
+
}
|
|
9816
|
+
}, (err, res) => {
|
|
9519
9817
|
dispatch({
|
|
9520
|
-
type:
|
|
9521
|
-
payload:
|
|
9522
|
-
type: "error",
|
|
9523
|
-
content: getErrorMessages(err)
|
|
9524
|
-
}
|
|
9818
|
+
type: DISABLE_REGISTRATION_BUTTON,
|
|
9819
|
+
payload: false
|
|
9525
9820
|
});
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9821
|
+
|
|
9822
|
+
if (err) {
|
|
9823
|
+
dispatch({
|
|
9824
|
+
type: SHOW_ALERT,
|
|
9825
|
+
payload: {
|
|
9826
|
+
type: "error",
|
|
9827
|
+
content: getErrorMessages(err)
|
|
9828
|
+
}
|
|
9829
|
+
});
|
|
9830
|
+
onFailure(err);
|
|
9831
|
+
} else {
|
|
9832
|
+
onSuccess(res);
|
|
9833
|
+
}
|
|
9834
|
+
});
|
|
9835
|
+
}
|
|
9531
9836
|
};
|
|
9532
9837
|
|
|
9533
9838
|
const handleSocialLogin = ({
|
|
@@ -9639,7 +9944,7 @@ const RegisterContainer = ({
|
|
|
9639
9944
|
});
|
|
9640
9945
|
|
|
9641
9946
|
case RESET_LOGIN_FORM:
|
|
9642
|
-
return initialState$
|
|
9947
|
+
return initialState$e;
|
|
9643
9948
|
|
|
9644
9949
|
case DISABLE_REGISTRATION_BUTTON:
|
|
9645
9950
|
return lib_7({ ...state,
|
|
@@ -9657,12 +9962,12 @@ const RegisterContainer = ({
|
|
|
9657
9962
|
default:
|
|
9658
9963
|
return state;
|
|
9659
9964
|
}
|
|
9660
|
-
}, initialState$
|
|
9965
|
+
}, initialState$e);
|
|
9661
9966
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
9662
9967
|
style: { ...style
|
|
9663
9968
|
},
|
|
9664
9969
|
className: `pelcro-container pelcro-register-container ${className}`
|
|
9665
|
-
}, /*#__PURE__*/React__default['default'].createElement(Provider$
|
|
9970
|
+
}, /*#__PURE__*/React__default['default'].createElement(Provider$e, {
|
|
9666
9971
|
value: {
|
|
9667
9972
|
state,
|
|
9668
9973
|
dispatch
|
|
@@ -9670,24 +9975,33 @@ const RegisterContainer = ({
|
|
|
9670
9975
|
}, children.length ? children.map((child, i) => {
|
|
9671
9976
|
if (child) {
|
|
9672
9977
|
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
9673
|
-
store: store$
|
|
9978
|
+
store: store$e,
|
|
9674
9979
|
key: i
|
|
9675
9980
|
});
|
|
9676
9981
|
}
|
|
9677
9982
|
}) : /*#__PURE__*/React__default['default'].cloneElement(children, {
|
|
9678
|
-
store: store$
|
|
9983
|
+
store: store$e
|
|
9679
9984
|
})));
|
|
9680
9985
|
};
|
|
9986
|
+
/**
|
|
9987
|
+
* Checks if the current site has security token enabled
|
|
9988
|
+
* @return {boolean}
|
|
9989
|
+
*/
|
|
9681
9990
|
|
|
9682
|
-
|
|
9991
|
+
function hasSecurityTokenEnabled$1() {
|
|
9992
|
+
const hasSecuritySdkLoaded = Boolean(window.grecaptcha);
|
|
9993
|
+
return hasSecuritySdkLoaded;
|
|
9994
|
+
}
|
|
9683
9995
|
|
|
9684
|
-
|
|
9996
|
+
var _path$m;
|
|
9997
|
+
|
|
9998
|
+
function _extends$o() { _extends$o = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
|
|
9685
9999
|
|
|
9686
10000
|
function SvgFacebookLogo(props) {
|
|
9687
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
10001
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
|
|
9688
10002
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9689
10003
|
viewBox: "88.428 12.828 107.543 207.085"
|
|
9690
|
-
}, props), _path$
|
|
10004
|
+
}, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
|
|
9691
10005
|
d: "M158.232 219.912v-94.461h31.707l4.747-36.813h-36.454V65.134c0-10.658 2.96-17.922 18.245-17.922l19.494-.009V14.278c-3.373-.447-14.944-1.449-28.406-1.449-28.106 0-47.348 17.155-47.348 48.661v27.149H88.428v36.813h31.788v94.461l38.016-.001z",
|
|
9692
10006
|
fill: "#3c5a9a"
|
|
9693
10007
|
})));
|
|
@@ -9699,15 +10013,15 @@ const FacebookLoginButton = ({
|
|
|
9699
10013
|
labelClassName = "",
|
|
9700
10014
|
iconClassName = ""
|
|
9701
10015
|
}) => {
|
|
9702
|
-
var _window$Pelcro$site$r
|
|
10016
|
+
var _window$Pelcro$site$r;
|
|
9703
10017
|
|
|
9704
10018
|
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;
|
|
9705
10019
|
const {
|
|
9706
10020
|
dispatch: loginDispatch
|
|
9707
|
-
} = React.useContext(store$
|
|
10021
|
+
} = React.useContext(store$f);
|
|
9708
10022
|
const {
|
|
9709
10023
|
dispatch: registerDispatch
|
|
9710
|
-
} = React.useContext(store$
|
|
10024
|
+
} = React.useContext(store$e);
|
|
9711
10025
|
|
|
9712
10026
|
const onSuccess = facebookUser => {
|
|
9713
10027
|
loginDispatch === null || loginDispatch === void 0 ? void 0 : loginDispatch({
|
|
@@ -9738,7 +10052,7 @@ const FacebookLoginButton = ({
|
|
|
9738
10052
|
|
|
9739
10053
|
return facebookLoginEnabled ? /*#__PURE__*/React__default['default'].createElement(FacebookLogin, {
|
|
9740
10054
|
appId: window.Pelcro.site.read().facebook_app_id,
|
|
9741
|
-
language: (
|
|
10055
|
+
language: getPageOrDefaultLanguage(),
|
|
9742
10056
|
fields: "first_name,last_name,email,picture",
|
|
9743
10057
|
callback: onSuccess,
|
|
9744
10058
|
onFailure: onFailure,
|
|
@@ -9760,15 +10074,15 @@ var googleLogin = createCommonjsModule(function (module, exports) {
|
|
|
9760
10074
|
unwrapExports(googleLogin);
|
|
9761
10075
|
var googleLogin_1 = googleLogin.GoogleLogin;
|
|
9762
10076
|
|
|
9763
|
-
var _path$
|
|
10077
|
+
var _path$l, _path2$2, _path3$1, _path4;
|
|
9764
10078
|
|
|
9765
|
-
function _extends$
|
|
10079
|
+
function _extends$n() { _extends$n = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
|
|
9766
10080
|
|
|
9767
10081
|
function SvgGoogleLogo(props) {
|
|
9768
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
10082
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
|
|
9769
10083
|
viewBox: "0 0 24 24",
|
|
9770
10084
|
xmlns: "http://www.w3.org/2000/svg"
|
|
9771
|
-
}, props), _path$
|
|
10085
|
+
}, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
|
|
9772
10086
|
fill: "#4285F4",
|
|
9773
10087
|
d: "M23.745 12.27c0-.79-.07-1.54-.19-2.27h-11.3v4.51h6.47c-.29 1.48-1.14 2.73-2.4 3.58v3h3.86c2.26-2.09 3.56-5.17 3.56-8.82z"
|
|
9774
10088
|
})), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
@@ -9794,10 +10108,10 @@ const GoogleLoginButton = ({
|
|
|
9794
10108
|
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;
|
|
9795
10109
|
const {
|
|
9796
10110
|
dispatch: loginDispatch
|
|
9797
|
-
} = React.useContext(store$
|
|
10111
|
+
} = React.useContext(store$f);
|
|
9798
10112
|
const {
|
|
9799
10113
|
dispatch: registerDispatch
|
|
9800
|
-
} = React.useContext(store$
|
|
10114
|
+
} = React.useContext(store$e);
|
|
9801
10115
|
|
|
9802
10116
|
const onSuccess = response => {
|
|
9803
10117
|
var _response$getAuthResp, _profile$getEmail, _profile$getGivenName, _profile$getFamilyNam, _profile$getEmail2, _profile$getGivenName2, _profile$getFamilyNam2;
|
|
@@ -9902,15 +10216,15 @@ function LoginView(props) {
|
|
|
9902
10216
|
}, /*#__PURE__*/React__default['default'].createElement(GoogleLoginButton, null), /*#__PURE__*/React__default['default'].createElement(FacebookLoginButton, null))))));
|
|
9903
10217
|
}
|
|
9904
10218
|
|
|
9905
|
-
var _path$
|
|
10219
|
+
var _path$k, _path2$1, _path3;
|
|
9906
10220
|
|
|
9907
|
-
function _extends$
|
|
10221
|
+
function _extends$m() { _extends$m = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$m.apply(this, arguments); }
|
|
9908
10222
|
|
|
9909
10223
|
function SvgPelcroAuthorship(props) {
|
|
9910
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
10224
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
|
|
9911
10225
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9912
10226
|
viewBox: "0 -80.652 497.072 179.991"
|
|
9913
|
-
}, props), _path$
|
|
10227
|
+
}, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
|
|
9914
10228
|
fill: "none",
|
|
9915
10229
|
stroke: "#4a4a4a",
|
|
9916
10230
|
d: "M487.89 42.299c0 13.158-10.671 23.829-23.829 23.829H37.074c-13.162 0-23.832-10.671-23.832-23.829v-63.552c0-13.158 10.67-23.831 23.832-23.831H464.06c13.158 0 23.829 10.672 23.829 23.831l.001 63.552z"
|
|
@@ -10057,18 +10371,21 @@ function LoginModal({
|
|
|
10057
10371
|
LoginModal.viewId = "login";
|
|
10058
10372
|
|
|
10059
10373
|
const RegisterEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
|
|
10060
|
-
store: store$
|
|
10374
|
+
store: store$e
|
|
10061
10375
|
}, props));
|
|
10062
10376
|
|
|
10063
10377
|
const RegisterPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
|
|
10064
|
-
store: store$
|
|
10378
|
+
store: store$e
|
|
10065
10379
|
}, props));
|
|
10066
10380
|
|
|
10067
10381
|
const RegisterButton = ({
|
|
10068
10382
|
name,
|
|
10069
10383
|
onClick,
|
|
10384
|
+
className,
|
|
10070
10385
|
...otherProps
|
|
10071
10386
|
}) => {
|
|
10387
|
+
var _window$Pelcro$site$r;
|
|
10388
|
+
|
|
10072
10389
|
const {
|
|
10073
10390
|
state: {
|
|
10074
10391
|
emailError,
|
|
@@ -10078,7 +10395,7 @@ const RegisterButton = ({
|
|
|
10078
10395
|
buttonDisabled
|
|
10079
10396
|
},
|
|
10080
10397
|
dispatch
|
|
10081
|
-
} = React.useContext(store$
|
|
10398
|
+
} = React.useContext(store$e);
|
|
10082
10399
|
const {
|
|
10083
10400
|
t
|
|
10084
10401
|
} = useTranslation("register");
|
|
@@ -10094,7 +10411,10 @@ const RegisterButton = ({
|
|
|
10094
10411
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
10095
10412
|
},
|
|
10096
10413
|
disabled: isDisabled,
|
|
10097
|
-
isLoading: buttonDisabled
|
|
10414
|
+
isLoading: buttonDisabled,
|
|
10415
|
+
className: `${className} g-recaptcha`,
|
|
10416
|
+
"data-action": "register",
|
|
10417
|
+
"data-sitekey": (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.security_key
|
|
10098
10418
|
}, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
|
|
10099
10419
|
};
|
|
10100
10420
|
|
|
@@ -10213,7 +10533,7 @@ function FirstName({
|
|
|
10213
10533
|
}
|
|
10214
10534
|
|
|
10215
10535
|
const RegisterFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
|
|
10216
|
-
store: store$
|
|
10536
|
+
store: store$e
|
|
10217
10537
|
}, props));
|
|
10218
10538
|
|
|
10219
10539
|
function LastName({
|
|
@@ -10244,7 +10564,7 @@ function LastName({
|
|
|
10244
10564
|
}
|
|
10245
10565
|
|
|
10246
10566
|
const RegisterLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
|
|
10247
|
-
store: store$
|
|
10567
|
+
store: store$e
|
|
10248
10568
|
}, props));
|
|
10249
10569
|
|
|
10250
10570
|
/**
|
|
@@ -10298,7 +10618,17 @@ function RegisterView(props) {
|
|
|
10298
10618
|
className: "plc-w-full plc-mt-2",
|
|
10299
10619
|
id: "pelcro-submit",
|
|
10300
10620
|
name: t("messages.createAccount")
|
|
10301
|
-
}),
|
|
10621
|
+
}), hasSecurityTokenEnabled() && /*#__PURE__*/React__default['default'].createElement("p", {
|
|
10622
|
+
className: "plc-text-sm plc-text-gray-500 plc-mt-1"
|
|
10623
|
+
}, /*#__PURE__*/React__default['default'].createElement(Trans, {
|
|
10624
|
+
i18nKey: "messages:recaptcha"
|
|
10625
|
+
}, "This site is protected by reCAPTCHA and the Google", /*#__PURE__*/React__default['default'].createElement(Link, {
|
|
10626
|
+
href: "https://policies.google.com/privacy",
|
|
10627
|
+
className: "plc-text-sm plc-text-gray-500"
|
|
10628
|
+
}, "Privacy Policy"), "and", /*#__PURE__*/React__default['default'].createElement(Link, {
|
|
10629
|
+
href: "https://policies.google.com/terms",
|
|
10630
|
+
className: "plc-text-sm plc-text-gray-500"
|
|
10631
|
+
}, "Terms of Service"), "apply.")), socialLoginEnabled && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
10302
10632
|
className: "plc-mt-5"
|
|
10303
10633
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
10304
10634
|
className: "plc-flex plc-items-center plc-justify-between "
|
|
@@ -10312,6 +10642,16 @@ function RegisterView(props) {
|
|
|
10312
10642
|
className: "plc-flex plc-justify-center plc-px-5 plc-mt-1 plc-space-x-3"
|
|
10313
10643
|
}, /*#__PURE__*/React__default['default'].createElement(GoogleLoginButton, null), /*#__PURE__*/React__default['default'].createElement(FacebookLoginButton, null))))));
|
|
10314
10644
|
}
|
|
10645
|
+
/**
|
|
10646
|
+
* Checks if the current site has security token enabled
|
|
10647
|
+
* @return {boolean}
|
|
10648
|
+
*/
|
|
10649
|
+
|
|
10650
|
+
function hasSecurityTokenEnabled() {
|
|
10651
|
+
var _window$Pelcro$site, _window$Pelcro$site$r3;
|
|
10652
|
+
|
|
10653
|
+
return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r3 = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.security_key);
|
|
10654
|
+
}
|
|
10315
10655
|
|
|
10316
10656
|
function TextInput({
|
|
10317
10657
|
store,
|
|
@@ -10348,7 +10688,7 @@ function TextInput({
|
|
|
10348
10688
|
|
|
10349
10689
|
const RegisterTextInput = props => {
|
|
10350
10690
|
return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
|
|
10351
|
-
store: store$
|
|
10691
|
+
store: store$e
|
|
10352
10692
|
}));
|
|
10353
10693
|
};
|
|
10354
10694
|
|
|
@@ -12313,13 +12653,14 @@ class PaypalGateWay {
|
|
|
12313
12653
|
* @property {unknown} canMakePayment
|
|
12314
12654
|
* @property {unknown} paymentRequest
|
|
12315
12655
|
* @property {number} updatedPrice
|
|
12656
|
+
* @property {number} taxAmount
|
|
12316
12657
|
* @property {object} currentPlan
|
|
12317
12658
|
* @property {object} alert
|
|
12318
12659
|
*/
|
|
12319
12660
|
|
|
12320
12661
|
/** @type {PaymentStateType} */
|
|
12321
12662
|
|
|
12322
|
-
const initialState$
|
|
12663
|
+
const initialState$d = {
|
|
12323
12664
|
disableSubmit: false,
|
|
12324
12665
|
isLoading: false,
|
|
12325
12666
|
disableCouponButton: false,
|
|
@@ -12331,16 +12672,17 @@ const initialState$c = {
|
|
|
12331
12672
|
canMakePayment: false,
|
|
12332
12673
|
paymentRequest: null,
|
|
12333
12674
|
updatedPrice: null,
|
|
12675
|
+
taxAmount: null,
|
|
12334
12676
|
currentPlan: null,
|
|
12335
12677
|
alert: {
|
|
12336
12678
|
type: "error",
|
|
12337
12679
|
content: ""
|
|
12338
12680
|
}
|
|
12339
12681
|
};
|
|
12340
|
-
const store$
|
|
12682
|
+
const store$d = /*#__PURE__*/React.createContext(initialState$d);
|
|
12341
12683
|
const {
|
|
12342
|
-
Provider: Provider$
|
|
12343
|
-
} = store$
|
|
12684
|
+
Provider: Provider$d
|
|
12685
|
+
} = store$d;
|
|
12344
12686
|
|
|
12345
12687
|
const PaymentMethodContainerWithoutStripe = ({
|
|
12346
12688
|
style,
|
|
@@ -12381,6 +12723,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12381
12723
|
dispatch({
|
|
12382
12724
|
type: INIT_CONTAINER
|
|
12383
12725
|
});
|
|
12726
|
+
updateTotalAmountWithTax();
|
|
12384
12727
|
}, []);
|
|
12385
12728
|
|
|
12386
12729
|
const initPaymentRequest = (state, dispatch) => {
|
|
@@ -12447,6 +12790,45 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12447
12790
|
console.log("Google Pay/Apple pay isn't available in this country");
|
|
12448
12791
|
}
|
|
12449
12792
|
};
|
|
12793
|
+
/**
|
|
12794
|
+
* Updates the total amount after adding taxes only if site taxes are enabled
|
|
12795
|
+
*/
|
|
12796
|
+
|
|
12797
|
+
|
|
12798
|
+
const updateTotalAmountWithTax = () => {
|
|
12799
|
+
var _window$Pelcro$site$r;
|
|
12800
|
+
|
|
12801
|
+
const taxesEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.taxes_enabled;
|
|
12802
|
+
|
|
12803
|
+
if (taxesEnabled && type === "createPayment") {
|
|
12804
|
+
dispatch({
|
|
12805
|
+
type: DISABLE_SUBMIT,
|
|
12806
|
+
payload: true
|
|
12807
|
+
});
|
|
12808
|
+
resolveTaxCalculation().then(res => {
|
|
12809
|
+
if (res) {
|
|
12810
|
+
dispatch({
|
|
12811
|
+
type: SET_TAX_AMOUNT,
|
|
12812
|
+
payload: res.taxAmount
|
|
12813
|
+
});
|
|
12814
|
+
dispatch({
|
|
12815
|
+
type: SET_UPDATED_PRICE,
|
|
12816
|
+
payload: res.totalAmountWithTax
|
|
12817
|
+
});
|
|
12818
|
+
dispatch({
|
|
12819
|
+
type: UPDATE_PAYMENT_REQUEST
|
|
12820
|
+
});
|
|
12821
|
+
}
|
|
12822
|
+
}).catch(error => {
|
|
12823
|
+
handlePaymentError(error);
|
|
12824
|
+
}).finally(() => {
|
|
12825
|
+
dispatch({
|
|
12826
|
+
type: DISABLE_SUBMIT,
|
|
12827
|
+
payload: false
|
|
12828
|
+
});
|
|
12829
|
+
});
|
|
12830
|
+
}
|
|
12831
|
+
};
|
|
12450
12832
|
|
|
12451
12833
|
const onApplyCouponCode = (state, dispatch) => {
|
|
12452
12834
|
const {
|
|
@@ -12473,6 +12855,10 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12473
12855
|
});
|
|
12474
12856
|
}
|
|
12475
12857
|
|
|
12858
|
+
dispatch({
|
|
12859
|
+
type: SET_COUPON_ERROR,
|
|
12860
|
+
payload: ""
|
|
12861
|
+
});
|
|
12476
12862
|
dispatch({
|
|
12477
12863
|
type: SHOW_ALERT,
|
|
12478
12864
|
payload: {
|
|
@@ -12488,6 +12874,10 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12488
12874
|
type: SET_PERCENT_OFF,
|
|
12489
12875
|
payload: `${(_res$data$coupon = res.data.coupon) === null || _res$data$coupon === void 0 ? void 0 : _res$data$coupon.percent_off}%`
|
|
12490
12876
|
});
|
|
12877
|
+
dispatch({
|
|
12878
|
+
type: SET_TAX_AMOUNT,
|
|
12879
|
+
payload: res.data.taxes
|
|
12880
|
+
});
|
|
12491
12881
|
dispatch({
|
|
12492
12882
|
type: SET_UPDATED_PRICE,
|
|
12493
12883
|
payload: res.data.total
|
|
@@ -12497,6 +12887,29 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12497
12887
|
});
|
|
12498
12888
|
};
|
|
12499
12889
|
|
|
12890
|
+
if ((couponCode === null || couponCode === void 0 ? void 0 : couponCode.trim()) === "") {
|
|
12891
|
+
dispatch({
|
|
12892
|
+
type: SET_COUPON,
|
|
12893
|
+
payload: null
|
|
12894
|
+
});
|
|
12895
|
+
dispatch({
|
|
12896
|
+
type: SET_PERCENT_OFF,
|
|
12897
|
+
payload: ""
|
|
12898
|
+
});
|
|
12899
|
+
dispatch({
|
|
12900
|
+
type: SET_UPDATED_PRICE,
|
|
12901
|
+
payload: null
|
|
12902
|
+
});
|
|
12903
|
+
dispatch({
|
|
12904
|
+
type: SET_TAX_AMOUNT,
|
|
12905
|
+
payload: null
|
|
12906
|
+
});
|
|
12907
|
+
dispatch({
|
|
12908
|
+
type: UPDATE_PAYMENT_REQUEST
|
|
12909
|
+
});
|
|
12910
|
+
updateTotalAmountWithTax();
|
|
12911
|
+
}
|
|
12912
|
+
|
|
12500
12913
|
if (couponCode !== null && couponCode !== void 0 && couponCode.trim()) {
|
|
12501
12914
|
dispatch({
|
|
12502
12915
|
type: DISABLE_COUPON_BUTTON,
|
|
@@ -12883,16 +13296,20 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12883
13296
|
const totalAmount = (_ref = (_state$updatedPrice = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref !== void 0 ? _ref : getOrderItemsTotal();
|
|
12884
13297
|
|
|
12885
13298
|
if ((source === null || source === void 0 ? void 0 : (_source$card3 = source.card) === null || _source$card3 === void 0 ? void 0 : _source$card3.three_d_secure) === "required" && totalAmount > 0) {
|
|
12886
|
-
return resolveTaxCalculation().then(
|
|
12887
|
-
|
|
12888
|
-
error
|
|
12889
|
-
}) => {
|
|
12890
|
-
if (error) {
|
|
12891
|
-
return handlePaymentError(error);
|
|
12892
|
-
}
|
|
13299
|
+
return resolveTaxCalculation().then(res => {
|
|
13300
|
+
var _res$totalAmountWithT;
|
|
12893
13301
|
|
|
12894
|
-
|
|
12895
|
-
|
|
13302
|
+
return generate3DSecureSource(source, (_res$totalAmountWithT = res === null || res === void 0 ? void 0 : res.totalAmountWithTax) !== null && _res$totalAmountWithT !== void 0 ? _res$totalAmountWithT : totalAmount).then(({
|
|
13303
|
+
source,
|
|
13304
|
+
error
|
|
13305
|
+
}) => {
|
|
13306
|
+
if (error) {
|
|
13307
|
+
return handlePaymentError(error);
|
|
13308
|
+
}
|
|
13309
|
+
|
|
13310
|
+
toggleAuthenticationPendingView(true, source);
|
|
13311
|
+
});
|
|
13312
|
+
});
|
|
12896
13313
|
}
|
|
12897
13314
|
|
|
12898
13315
|
return handlePayment(source);
|
|
@@ -12901,15 +13318,15 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12901
13318
|
});
|
|
12902
13319
|
};
|
|
12903
13320
|
/**
|
|
12904
|
-
* Resolves with the total
|
|
13321
|
+
* Resolves with the total & tax amount incase taxes enabled by site
|
|
12905
13322
|
* @return {Promise}
|
|
12906
13323
|
*/
|
|
12907
13324
|
|
|
12908
13325
|
|
|
12909
13326
|
const resolveTaxCalculation = () => {
|
|
12910
|
-
var _window$Pelcro$site$
|
|
13327
|
+
var _window$Pelcro$site$r2;
|
|
12911
13328
|
|
|
12912
|
-
const taxesEnabled = (_window$Pelcro$site$
|
|
13329
|
+
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;
|
|
12913
13330
|
return new Promise((resolve, reject) => {
|
|
12914
13331
|
// resolve early if taxes isn't enabled
|
|
12915
13332
|
if (!taxesEnabled) {
|
|
@@ -12922,14 +13339,18 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12922
13339
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
12923
13340
|
address_id: selectedAddressId
|
|
12924
13341
|
}, (error, res) => {
|
|
12925
|
-
var _res$data;
|
|
13342
|
+
var _res$data, _res$data2;
|
|
12926
13343
|
|
|
12927
13344
|
if (error) {
|
|
12928
13345
|
return reject(error);
|
|
12929
13346
|
}
|
|
12930
13347
|
|
|
12931
|
-
const
|
|
12932
|
-
|
|
13348
|
+
const taxAmount = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.taxes;
|
|
13349
|
+
const totalAmountWithTax = (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.total;
|
|
13350
|
+
resolve({
|
|
13351
|
+
totalAmountWithTax,
|
|
13352
|
+
taxAmount
|
|
13353
|
+
});
|
|
12933
13354
|
});
|
|
12934
13355
|
});
|
|
12935
13356
|
};
|
|
@@ -12984,13 +13405,13 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12984
13405
|
const handlePaymentError = error => {
|
|
12985
13406
|
if (error.type === "validation_error" && // Subscription creation & renewal
|
|
12986
13407
|
type === "createPayment") {
|
|
12987
|
-
var _state$
|
|
13408
|
+
var _state$couponObject;
|
|
12988
13409
|
|
|
12989
13410
|
const {
|
|
12990
13411
|
updatedPrice
|
|
12991
13412
|
} = state; // When price is 0, we allow submitting without card info
|
|
12992
13413
|
|
|
12993
|
-
if (updatedPrice === 0 && ((_state$
|
|
13414
|
+
if (updatedPrice === 0 && ((_state$couponObject = state.couponObject) === null || _state$couponObject === void 0 ? void 0 : _state$couponObject.duration) === "forever") {
|
|
12994
13415
|
return subscribe({}, state, dispatch);
|
|
12995
13416
|
}
|
|
12996
13417
|
}
|
|
@@ -13118,6 +13539,11 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13118
13539
|
updatedPrice: action.payload
|
|
13119
13540
|
});
|
|
13120
13541
|
|
|
13542
|
+
case SET_TAX_AMOUNT:
|
|
13543
|
+
return lib_7({ ...state,
|
|
13544
|
+
taxAmount: action.payload
|
|
13545
|
+
});
|
|
13546
|
+
|
|
13121
13547
|
case SET_CAN_MAKE_PAYMENT:
|
|
13122
13548
|
return lib_7({ ...state,
|
|
13123
13549
|
canMakePayment: action.payload
|
|
@@ -13135,7 +13561,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13135
13561
|
|
|
13136
13562
|
case SET_COUPON:
|
|
13137
13563
|
return lib_7({ ...state,
|
|
13138
|
-
|
|
13564
|
+
couponObject: action.payload
|
|
13139
13565
|
});
|
|
13140
13566
|
|
|
13141
13567
|
case SET_COUPON_ERROR:
|
|
@@ -13161,34 +13587,43 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13161
13587
|
default:
|
|
13162
13588
|
return state;
|
|
13163
13589
|
}
|
|
13164
|
-
}, initialState$
|
|
13590
|
+
}, initialState$d);
|
|
13165
13591
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
13166
13592
|
style: { ...style
|
|
13167
13593
|
},
|
|
13168
13594
|
className: `pelcro-container pelcro-payment-container ${className}`
|
|
13169
|
-
}, /*#__PURE__*/React__default['default'].createElement(Provider$
|
|
13595
|
+
}, /*#__PURE__*/React__default['default'].createElement(Provider$d, {
|
|
13170
13596
|
value: {
|
|
13171
13597
|
state,
|
|
13172
13598
|
dispatch
|
|
13173
13599
|
}
|
|
13174
13600
|
}, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
13175
|
-
store: store$
|
|
13601
|
+
store: store$d,
|
|
13176
13602
|
key: i
|
|
13177
13603
|
})) : /*#__PURE__*/React__default['default'].cloneElement(children, {
|
|
13178
|
-
store: store$
|
|
13604
|
+
store: store$d
|
|
13179
13605
|
})));
|
|
13180
13606
|
};
|
|
13181
13607
|
|
|
13182
13608
|
const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
|
|
13183
13609
|
|
|
13184
13610
|
const PaymentMethodContainer = props => {
|
|
13185
|
-
|
|
13611
|
+
const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
|
|
13612
|
+
React.useEffect(() => {
|
|
13613
|
+
if (!window.Stripe) {
|
|
13614
|
+
document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
|
|
13615
|
+
setIsStripeLoaded(true);
|
|
13616
|
+
});
|
|
13617
|
+
}
|
|
13618
|
+
}, []);
|
|
13619
|
+
|
|
13620
|
+
if (isStripeLoaded) {
|
|
13186
13621
|
return /*#__PURE__*/React__default['default'].createElement(es_13, {
|
|
13187
13622
|
apiKey: window.Pelcro.environment.stripe,
|
|
13188
13623
|
stripeAccount: window.Pelcro.site.read().account_id,
|
|
13189
|
-
locale:
|
|
13624
|
+
locale: getPageOrDefaultLanguage()
|
|
13190
13625
|
}, /*#__PURE__*/React__default['default'].createElement(es_11, null, /*#__PURE__*/React__default['default'].createElement(UnwrappedForm, Object.assign({
|
|
13191
|
-
store: store$
|
|
13626
|
+
store: store$d
|
|
13192
13627
|
}, props))));
|
|
13193
13628
|
}
|
|
13194
13629
|
|
|
@@ -13241,7 +13676,7 @@ const PelcroPaymentRequestButton = props => {
|
|
|
13241
13676
|
currentPlan,
|
|
13242
13677
|
updatedPrice
|
|
13243
13678
|
}
|
|
13244
|
-
} = React.useContext(store$
|
|
13679
|
+
} = React.useContext(store$d);
|
|
13245
13680
|
|
|
13246
13681
|
const updatePaymentRequest = () => {
|
|
13247
13682
|
// Make sure payment request is up to date, eg. user added a coupon code.
|
|
@@ -13294,24 +13729,25 @@ const DiscountedPrice = props => {
|
|
|
13294
13729
|
const {
|
|
13295
13730
|
state: {
|
|
13296
13731
|
updatedPrice,
|
|
13732
|
+
taxAmount,
|
|
13297
13733
|
percentOff
|
|
13298
13734
|
}
|
|
13299
|
-
} = React.useContext(store$
|
|
13300
|
-
const {
|
|
13301
|
-
default_locale
|
|
13302
|
-
} = Pelcro.site.read();
|
|
13735
|
+
} = React.useContext(store$d);
|
|
13303
13736
|
const {
|
|
13304
13737
|
order,
|
|
13305
13738
|
plan
|
|
13306
13739
|
} = usePelcro();
|
|
13307
13740
|
const ecommOrderCurrency = (_order$currency = order === null || order === void 0 ? void 0 : order.currency) !== null && _order$currency !== void 0 ? _order$currency : order === null || order === void 0 ? void 0 : (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency;
|
|
13308
13741
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
13309
|
-
const
|
|
13742
|
+
const discountedPriceWithoutTax = updatedPrice - taxAmount;
|
|
13743
|
+
const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
13310
13744
|
|
|
13311
13745
|
if (percentOff) {
|
|
13312
13746
|
return /*#__PURE__*/React__default['default'].createElement("div", Object.assign({
|
|
13313
|
-
className: "plc-
|
|
13314
|
-
}, props), "(-", percentOff, ") ",
|
|
13747
|
+
className: "plc-flex plc-justify-center plc-mt-2 pelcro-discount"
|
|
13748
|
+
}, props), "(-", percentOff, ")", " ", /*#__PURE__*/React__default['default'].createElement("span", {
|
|
13749
|
+
className: "plc-font-bold pelcro-discounted-price"
|
|
13750
|
+
}, priceFormatted));
|
|
13315
13751
|
}
|
|
13316
13752
|
|
|
13317
13753
|
return "";
|
|
@@ -13336,13 +13772,10 @@ const SubmitPaymentMethod = ({
|
|
|
13336
13772
|
isLoading,
|
|
13337
13773
|
updatedPrice
|
|
13338
13774
|
}
|
|
13339
|
-
} = React.useContext(store$
|
|
13340
|
-
const {
|
|
13341
|
-
default_locale
|
|
13342
|
-
} = Pelcro.site.read();
|
|
13775
|
+
} = React.useContext(store$d);
|
|
13343
13776
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
13344
13777
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
13345
|
-
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency,
|
|
13778
|
+
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
13346
13779
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
13347
13780
|
role: "submit",
|
|
13348
13781
|
className: "plc-w-full plc-py-3",
|
|
@@ -13360,17 +13793,17 @@ const SubmitPaymentMethod = ({
|
|
|
13360
13793
|
}, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
|
|
13361
13794
|
};
|
|
13362
13795
|
|
|
13363
|
-
var _path$
|
|
13796
|
+
var _path$j;
|
|
13364
13797
|
|
|
13365
|
-
function _extends$
|
|
13798
|
+
function _extends$l() { _extends$l = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$l.apply(this, arguments); }
|
|
13366
13799
|
|
|
13367
13800
|
function SvgArrowLeft(props) {
|
|
13368
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
13801
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
|
|
13369
13802
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13370
13803
|
fill: "none",
|
|
13371
13804
|
viewBox: "0 0 24 24",
|
|
13372
13805
|
stroke: "currentColor"
|
|
13373
|
-
}, props), _path$
|
|
13806
|
+
}, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
|
|
13374
13807
|
strokeLinecap: "round",
|
|
13375
13808
|
strokeLinejoin: "round",
|
|
13376
13809
|
strokeWidth: 2,
|
|
@@ -13389,7 +13822,7 @@ const ApplyCouponButton = ({
|
|
|
13389
13822
|
disableCouponButton
|
|
13390
13823
|
},
|
|
13391
13824
|
dispatch
|
|
13392
|
-
} = React.useContext(store$
|
|
13825
|
+
} = React.useContext(store$d);
|
|
13393
13826
|
const {
|
|
13394
13827
|
t
|
|
13395
13828
|
} = useTranslation("checkoutForm");
|
|
@@ -13423,7 +13856,7 @@ const CouponCodeField = props => {
|
|
|
13423
13856
|
couponCode,
|
|
13424
13857
|
couponError
|
|
13425
13858
|
}
|
|
13426
|
-
} = React.useContext(store$
|
|
13859
|
+
} = React.useContext(store$d);
|
|
13427
13860
|
|
|
13428
13861
|
const onCouponCodeChange = e => {
|
|
13429
13862
|
dispatch({
|
|
@@ -13441,6 +13874,7 @@ const CouponCodeField = props => {
|
|
|
13441
13874
|
|
|
13442
13875
|
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
13443
13876
|
className: "plc-h-12",
|
|
13877
|
+
wrapperClassName: "plc-mb-1",
|
|
13444
13878
|
errorClassName: "plc-h-12 sm:plc-h-8",
|
|
13445
13879
|
error: couponError,
|
|
13446
13880
|
"aria-label": t("labels.code"),
|
|
@@ -13451,17 +13885,17 @@ const CouponCodeField = props => {
|
|
|
13451
13885
|
}, props));
|
|
13452
13886
|
};
|
|
13453
13887
|
|
|
13454
|
-
var _path$
|
|
13888
|
+
var _path$i;
|
|
13455
13889
|
|
|
13456
|
-
function _extends$
|
|
13890
|
+
function _extends$k() { _extends$k = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); }
|
|
13457
13891
|
|
|
13458
13892
|
function SvgTicket(props) {
|
|
13459
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
13893
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
|
|
13460
13894
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13461
13895
|
fill: "none",
|
|
13462
13896
|
viewBox: "0 0 24 24",
|
|
13463
13897
|
stroke: "currentColor"
|
|
13464
|
-
}, props), _path$
|
|
13898
|
+
}, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
|
|
13465
13899
|
strokeLinecap: "round",
|
|
13466
13900
|
strokeLinejoin: "round",
|
|
13467
13901
|
strokeWidth: 2,
|
|
@@ -13478,7 +13912,7 @@ const CouponCode = ({
|
|
|
13478
13912
|
state: {
|
|
13479
13913
|
enableCouponField
|
|
13480
13914
|
}
|
|
13481
|
-
} = React.useContext(store$
|
|
13915
|
+
} = React.useContext(store$d);
|
|
13482
13916
|
const {
|
|
13483
13917
|
t
|
|
13484
13918
|
} = useTranslation("checkoutForm");
|
|
@@ -13492,16 +13926,16 @@ const CouponCode = ({
|
|
|
13492
13926
|
};
|
|
13493
13927
|
|
|
13494
13928
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
13495
|
-
className: "plc-
|
|
13929
|
+
className: "plc-mt-4"
|
|
13496
13930
|
}, /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
13497
|
-
className: "plc-text-base plc-text-gray-500",
|
|
13931
|
+
className: "plc-mb-2 plc-text-base plc-text-gray-500",
|
|
13498
13932
|
variant: "ghost",
|
|
13499
13933
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgTicket, {
|
|
13500
13934
|
className: "plc-w-5 plc-h-5 plc-mr-2"
|
|
13501
13935
|
}),
|
|
13502
13936
|
onClick: showCouponField
|
|
13503
13937
|
}, otherProps), !enableCouponField ? t("labels.addCode") : t("labels.hideCode")), enableCouponField && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
13504
|
-
className: "plc-flex plc-w-full plc-
|
|
13938
|
+
className: "plc-flex plc-w-full plc-mt-2 pelcro-apply-coupon-wrapper"
|
|
13505
13939
|
}, /*#__PURE__*/React__default['default'].createElement(CouponCodeField, null), /*#__PURE__*/React__default['default'].createElement(ApplyCouponButton, null)));
|
|
13506
13940
|
};
|
|
13507
13941
|
|
|
@@ -13586,7 +14020,7 @@ class PaypalClient {
|
|
|
13586
14020
|
this.paypalButton = window.paypal.Buttons({
|
|
13587
14021
|
fundingSource: window.paypal.FUNDING.PAYPAL,
|
|
13588
14022
|
// button locale
|
|
13589
|
-
locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale :
|
|
14023
|
+
locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale : getPageOrDefaultLanguage(),
|
|
13590
14024
|
// button style
|
|
13591
14025
|
style: (_this$config$style = this.config.style) !== null && _this$config$style !== void 0 ? _this$config$style : defaultButtonStyle,
|
|
13592
14026
|
// create payment handler
|
|
@@ -13683,7 +14117,7 @@ class PaypalClient {
|
|
|
13683
14117
|
} : undefined,
|
|
13684
14118
|
shippingAddressEditable: this.config.shippingAddressEditable,
|
|
13685
14119
|
displayName: (_this$config$displayN = this.config.displayName) !== null && _this$config$displayN !== void 0 ? _this$config$displayN : this.siteInfo.name,
|
|
13686
|
-
locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 :
|
|
14120
|
+
locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 : getPageOrDefaultLanguage()
|
|
13687
14121
|
};
|
|
13688
14122
|
}
|
|
13689
14123
|
});
|
|
@@ -13692,7 +14126,7 @@ class PaypalClient {
|
|
|
13692
14126
|
writable: true,
|
|
13693
14127
|
value: () => {
|
|
13694
14128
|
const totalAmount = (this.product.quantity || 1) * this.amount;
|
|
13695
|
-
const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency,
|
|
14129
|
+
const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency, getPageOrDefaultLanguage());
|
|
13696
14130
|
const autoRenewed = this.product.auto_renew;
|
|
13697
14131
|
const {
|
|
13698
14132
|
interval,
|
|
@@ -13735,7 +14169,7 @@ const PaypalSubscribeButton = props => {
|
|
|
13735
14169
|
const {
|
|
13736
14170
|
dispatch,
|
|
13737
14171
|
state
|
|
13738
|
-
} = React.useContext(store$
|
|
14172
|
+
} = React.useContext(store$d);
|
|
13739
14173
|
const {
|
|
13740
14174
|
product,
|
|
13741
14175
|
plan,
|
|
@@ -13820,16 +14254,16 @@ const BankRedirection = () => {
|
|
|
13820
14254
|
}));
|
|
13821
14255
|
};
|
|
13822
14256
|
|
|
13823
|
-
var _path$
|
|
14257
|
+
var _path$h;
|
|
13824
14258
|
|
|
13825
|
-
function _extends$
|
|
14259
|
+
function _extends$j() { _extends$j = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
|
|
13826
14260
|
|
|
13827
14261
|
function SvgLock(props) {
|
|
13828
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
14262
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
|
|
13829
14263
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13830
14264
|
viewBox: "0 0 20 20",
|
|
13831
14265
|
fill: "currentColor"
|
|
13832
|
-
}, props), _path$
|
|
14266
|
+
}, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
|
|
13833
14267
|
fillRule: "evenodd",
|
|
13834
14268
|
d: "M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",
|
|
13835
14269
|
clipRule: "evenodd"
|
|
@@ -13846,7 +14280,7 @@ const SelectedPaymentMethod = () => {
|
|
|
13846
14280
|
state: {
|
|
13847
14281
|
isLoading
|
|
13848
14282
|
}
|
|
13849
|
-
} = React.useContext(store$
|
|
14283
|
+
} = React.useContext(store$d);
|
|
13850
14284
|
const {
|
|
13851
14285
|
switchView,
|
|
13852
14286
|
selectedPaymentMethodId
|
|
@@ -13878,6 +14312,34 @@ const SelectedPaymentMethod = () => {
|
|
|
13878
14312
|
}, t("select.buttons.changePaymentMethod")))));
|
|
13879
14313
|
};
|
|
13880
14314
|
|
|
14315
|
+
const TaxAmount = () => {
|
|
14316
|
+
var _plan$quantity;
|
|
14317
|
+
|
|
14318
|
+
const {
|
|
14319
|
+
t
|
|
14320
|
+
} = useTranslation("checkoutForm");
|
|
14321
|
+
const {
|
|
14322
|
+
state: {
|
|
14323
|
+
taxAmount
|
|
14324
|
+
}
|
|
14325
|
+
} = React.useContext(store$d);
|
|
14326
|
+
const {
|
|
14327
|
+
plan
|
|
14328
|
+
} = usePelcro();
|
|
14329
|
+
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
14330
|
+
const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
14331
|
+
|
|
14332
|
+
if (taxAmount) {
|
|
14333
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
14334
|
+
className: "plc-text-center pelcro-tax-amount"
|
|
14335
|
+
}, t("labels.tax"), " ", /*#__PURE__*/React__default['default'].createElement("span", {
|
|
14336
|
+
className: "plc-font-bold"
|
|
14337
|
+
}, priceFormatted));
|
|
14338
|
+
}
|
|
14339
|
+
|
|
14340
|
+
return null;
|
|
14341
|
+
};
|
|
14342
|
+
|
|
13881
14343
|
/**
|
|
13882
14344
|
*
|
|
13883
14345
|
*/
|
|
@@ -13914,7 +14376,9 @@ function PaymentMethodView({
|
|
|
13914
14376
|
onFailure: onFailure
|
|
13915
14377
|
}, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
|
|
13916
14378
|
className: "plc-mb-2"
|
|
13917
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), /*#__PURE__*/React__default['default'].createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default['default'].createElement(
|
|
14379
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), /*#__PURE__*/React__default['default'].createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
14380
|
+
className: "plc-mb-2"
|
|
14381
|
+
}, /*#__PURE__*/React__default['default'].createElement(CouponCode, null), /*#__PURE__*/React__default['default'].createElement(DiscountedPrice, null)), /*#__PURE__*/React__default['default'].createElement(TaxAmount, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
13918
14382
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
13919
14383
|
}, /*#__PURE__*/React__default['default'].createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)))))));
|
|
13920
14384
|
}
|
|
@@ -14021,12 +14485,12 @@ function SubscriptionRenewModal({
|
|
|
14021
14485
|
}
|
|
14022
14486
|
SubscriptionRenewModal.viewId = "subscription-renew";
|
|
14023
14487
|
|
|
14024
|
-
var _path$
|
|
14488
|
+
var _path$g;
|
|
14025
14489
|
|
|
14026
|
-
function _extends$
|
|
14490
|
+
function _extends$i() { _extends$i = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
|
|
14027
14491
|
|
|
14028
14492
|
function SvgGift(props) {
|
|
14029
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
14493
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
|
|
14030
14494
|
className: "plc-w-6 plc-h-6 plc-mr-2",
|
|
14031
14495
|
fill: "none",
|
|
14032
14496
|
stroke: "currentColor",
|
|
@@ -14035,7 +14499,7 @@ function SvgGift(props) {
|
|
|
14035
14499
|
strokeWidth: 2,
|
|
14036
14500
|
viewBox: "0 0 24 24",
|
|
14037
14501
|
xmlns: "http://www.w3.org/2000/svg"
|
|
14038
|
-
}, props), _path$
|
|
14502
|
+
}, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
|
|
14039
14503
|
d: "M20 12v10H4V12M2 7h20v5H2zM12 22V7M12 7H7.5a2.5 2.5 0 010-5C11 2 12 7 12 7zM12 7h4.5a2.5 2.5 0 000-5C13 2 12 7 12 7z"
|
|
14040
14504
|
})));
|
|
14041
14505
|
}
|
|
@@ -14366,44 +14830,330 @@ class DefaultNewsLetter extends React.Component {
|
|
|
14366
14830
|
|
|
14367
14831
|
const NewsLetter = withTranslation("newsletter")(DefaultNewsLetter);
|
|
14368
14832
|
|
|
14369
|
-
const
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
isAuthenticated
|
|
14379
|
-
} = usePelcro();
|
|
14380
|
-
const paywallProduct = product !== null && product !== void 0 ? product : window.Pelcro.paywall.getProduct();
|
|
14381
|
-
const visitsLeft = window.Pelcro.paywall.freeVisitsLeft();
|
|
14382
|
-
const title = `${paywallProduct === null || paywallProduct === void 0 ? void 0 : (_paywallProduct$paywa = paywallProduct.paywall) === null || _paywallProduct$paywa === void 0 ? void 0 : _paywallProduct$paywa.meter_title}: ${visitsLeft}`;
|
|
14383
|
-
const subtitle = paywallProduct === null || paywallProduct === void 0 ? void 0 : (_paywallProduct$paywa2 = paywallProduct.paywall) === null || _paywallProduct$paywa2 === void 0 ? void 0 : _paywallProduct$paywa2.meter_subtitle;
|
|
14384
|
-
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
14385
|
-
className: "plc-mb-2 plc-text-2xl plc-font-semibold plc-text-gray-600"
|
|
14386
|
-
}, title), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
14387
|
-
className: "plc-text-sm plc-text-gray-600"
|
|
14388
|
-
}, subtitle, " ", /*#__PURE__*/React__default['default'].createElement(Link, {
|
|
14389
|
-
className: "plc-ml-1",
|
|
14390
|
-
onClick: () => switchView("plan-select")
|
|
14391
|
-
}, t("messages.subscribeNow")), !isAuthenticated() && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", null, t("messages.alreadyHaveAccount") + " ", /*#__PURE__*/React__default['default'].createElement(Link, {
|
|
14392
|
-
className: "plc-ml-1",
|
|
14393
|
-
onClick: () => switchView("login")
|
|
14394
|
-
}, t("messages.loginHere"))))));
|
|
14833
|
+
const initialState$c = {
|
|
14834
|
+
didSubToNewslettersBefore: false,
|
|
14835
|
+
newsletters: [],
|
|
14836
|
+
isListLoading: true,
|
|
14837
|
+
isSubmitting: false,
|
|
14838
|
+
alert: {
|
|
14839
|
+
type: "error",
|
|
14840
|
+
content: ""
|
|
14841
|
+
}
|
|
14395
14842
|
};
|
|
14843
|
+
const store$c = /*#__PURE__*/React.createContext(initialState$c);
|
|
14844
|
+
const {
|
|
14845
|
+
Provider: Provider$c
|
|
14846
|
+
} = store$c;
|
|
14396
14847
|
|
|
14397
|
-
|
|
14398
|
-
|
|
14399
|
-
|
|
14400
|
-
|
|
14401
|
-
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
|
|
14405
|
-
|
|
14406
|
-
|
|
14848
|
+
const NewsletterUpdateContainer = ({
|
|
14849
|
+
style,
|
|
14850
|
+
className = "",
|
|
14851
|
+
onSuccess = () => {},
|
|
14852
|
+
onFailure = () => {},
|
|
14853
|
+
children
|
|
14854
|
+
}) => {
|
|
14855
|
+
const [t] = useTranslation("newsletter");
|
|
14856
|
+
|
|
14857
|
+
const handleSubmit = ({
|
|
14858
|
+
newsletters,
|
|
14859
|
+
didSubToNewslettersBefore
|
|
14860
|
+
}, dispatch) => {
|
|
14861
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
14862
|
+
|
|
14863
|
+
const callback = (err, res) => {
|
|
14864
|
+
dispatch({
|
|
14865
|
+
type: LOADING,
|
|
14866
|
+
payload: false
|
|
14867
|
+
});
|
|
14868
|
+
|
|
14869
|
+
if (err) {
|
|
14870
|
+
dispatch({
|
|
14871
|
+
type: SHOW_ALERT,
|
|
14872
|
+
payload: {
|
|
14873
|
+
type: "error",
|
|
14874
|
+
content: getErrorMessages(err)
|
|
14875
|
+
}
|
|
14876
|
+
});
|
|
14877
|
+
onFailure(err);
|
|
14878
|
+
} else {
|
|
14879
|
+
if (!didSubToNewslettersBefore) {
|
|
14880
|
+
dispatch({
|
|
14881
|
+
type: SWITCH_TO_UPDATE
|
|
14882
|
+
});
|
|
14883
|
+
}
|
|
14884
|
+
|
|
14885
|
+
dispatch({
|
|
14886
|
+
type: SHOW_ALERT,
|
|
14887
|
+
payload: {
|
|
14888
|
+
type: "success",
|
|
14889
|
+
content: t("messages.success")
|
|
14890
|
+
}
|
|
14891
|
+
});
|
|
14892
|
+
onSuccess(res);
|
|
14893
|
+
}
|
|
14894
|
+
};
|
|
14895
|
+
|
|
14896
|
+
const requestData = {
|
|
14897
|
+
email: (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.email) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : window.Pelcro.helpers.getURLParameter("email"),
|
|
14898
|
+
source: "web",
|
|
14899
|
+
lists: newsletters.filter(newsletter => newsletter.selected).map(newsletter => newsletter.id).join(",")
|
|
14900
|
+
};
|
|
14901
|
+
|
|
14902
|
+
if (didSubToNewslettersBefore) {
|
|
14903
|
+
window.Pelcro.newsletter.update(requestData, callback);
|
|
14904
|
+
} else {
|
|
14905
|
+
window.Pelcro.newsletter.create(requestData, callback);
|
|
14906
|
+
}
|
|
14907
|
+
};
|
|
14908
|
+
|
|
14909
|
+
const [state, dispatch] = useReducerWithSideEffects((state, action) => {
|
|
14910
|
+
switch (action.type) {
|
|
14911
|
+
case GET_NEWSLETTERS_FETCH:
|
|
14912
|
+
return lib_7({ ...state,
|
|
14913
|
+
isListLoading: true
|
|
14914
|
+
});
|
|
14915
|
+
|
|
14916
|
+
case GET_NEWSLETTERS_SUCCESS:
|
|
14917
|
+
return lib_7({ ...state,
|
|
14918
|
+
newsletters: action.payload.newsletters,
|
|
14919
|
+
didSubToNewslettersBefore: action.payload.didSubToNewslettersBefore,
|
|
14920
|
+
isListLoading: false
|
|
14921
|
+
});
|
|
14922
|
+
|
|
14923
|
+
case SET_SELECT:
|
|
14924
|
+
return lib_7({ ...state,
|
|
14925
|
+
newsletters: state.newsletters.map(newsletter => {
|
|
14926
|
+
if (newsletter.id === action.payload) {
|
|
14927
|
+
return { ...newsletter,
|
|
14928
|
+
selected: !newsletter.selected
|
|
14929
|
+
};
|
|
14930
|
+
}
|
|
14931
|
+
|
|
14932
|
+
return newsletter;
|
|
14933
|
+
})
|
|
14934
|
+
});
|
|
14935
|
+
|
|
14936
|
+
case SWITCH_TO_UPDATE:
|
|
14937
|
+
return lib_7({ ...state,
|
|
14938
|
+
didSubToNewslettersBefore: true
|
|
14939
|
+
});
|
|
14940
|
+
|
|
14941
|
+
case SHOW_ALERT:
|
|
14942
|
+
return lib_7({ ...state,
|
|
14943
|
+
alert: action.payload
|
|
14944
|
+
});
|
|
14945
|
+
|
|
14946
|
+
case LOADING:
|
|
14947
|
+
return lib_7({ ...state,
|
|
14948
|
+
isSubmitting: action.payload
|
|
14949
|
+
});
|
|
14950
|
+
|
|
14951
|
+
case HANDLE_SUBMIT:
|
|
14952
|
+
return lib_5({ ...state,
|
|
14953
|
+
isSubmitting: true
|
|
14954
|
+
}, (state, dispatch) => handleSubmit(state, dispatch));
|
|
14955
|
+
|
|
14956
|
+
default:
|
|
14957
|
+
return state;
|
|
14958
|
+
}
|
|
14959
|
+
}, initialState$c);
|
|
14960
|
+
React.useEffect(() => {
|
|
14961
|
+
const getUserNewsletters = () => {
|
|
14962
|
+
var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
|
|
14963
|
+
|
|
14964
|
+
dispatch({
|
|
14965
|
+
type: GET_NEWSLETTERS_FETCH
|
|
14966
|
+
});
|
|
14967
|
+
const email = (_window$Pelcro$user$r3 = (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.email) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : window.Pelcro.helpers.getURLParameter("email");
|
|
14968
|
+
window.Pelcro.newsletter.getByEmail(email, (err, res) => {
|
|
14969
|
+
var _window$Pelcro$uiSett, _window$Pelcro, _window$Pelcro$uiSett2, _res$data$lists$split, _res$data$lists;
|
|
14970
|
+
|
|
14971
|
+
if (err) {
|
|
14972
|
+
return dispatch({
|
|
14973
|
+
type: SHOW_ALERT,
|
|
14974
|
+
payload: {
|
|
14975
|
+
type: "error",
|
|
14976
|
+
content: getErrorMessages(err)
|
|
14977
|
+
}
|
|
14978
|
+
});
|
|
14979
|
+
}
|
|
14980
|
+
|
|
14981
|
+
const newsletters = (_window$Pelcro$uiSett = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett2 = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett2 === void 0 ? void 0 : _window$Pelcro$uiSett2.newsletters) !== null && _window$Pelcro$uiSett !== void 0 ? _window$Pelcro$uiSett : [];
|
|
14982
|
+
const selectedNewsletters = (_res$data$lists$split = (_res$data$lists = res.data.lists) === null || _res$data$lists === void 0 ? void 0 : _res$data$lists.split(",")) !== null && _res$data$lists$split !== void 0 ? _res$data$lists$split : [];
|
|
14983
|
+
const allNewslettersWithSelectedField = newsletters.map(newsletter => ({ ...newsletter,
|
|
14984
|
+
id: String(newsletter.id),
|
|
14985
|
+
selected: selectedNewsletters.includes(String(newsletter.id))
|
|
14986
|
+
}));
|
|
14987
|
+
dispatch({
|
|
14988
|
+
type: GET_NEWSLETTERS_SUCCESS,
|
|
14989
|
+
payload: {
|
|
14990
|
+
newsletters: allNewslettersWithSelectedField,
|
|
14991
|
+
didSubToNewslettersBefore: Boolean(res.data.email)
|
|
14992
|
+
}
|
|
14993
|
+
});
|
|
14994
|
+
});
|
|
14995
|
+
};
|
|
14996
|
+
|
|
14997
|
+
getUserNewsletters();
|
|
14998
|
+
}, []);
|
|
14999
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
15000
|
+
style: { ...style
|
|
15001
|
+
},
|
|
15002
|
+
className: `pelcro-container pelcro-newsletter-update-container ${className}`
|
|
15003
|
+
}, /*#__PURE__*/React__default['default'].createElement(Provider$c, {
|
|
15004
|
+
value: {
|
|
15005
|
+
state,
|
|
15006
|
+
dispatch
|
|
15007
|
+
}
|
|
15008
|
+
}, children.length ? children.map((child, i) => {
|
|
15009
|
+
if (child) {
|
|
15010
|
+
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
15011
|
+
store: store$c,
|
|
15012
|
+
key: i
|
|
15013
|
+
});
|
|
15014
|
+
}
|
|
15015
|
+
}) : /*#__PURE__*/React__default['default'].cloneElement(children, {
|
|
15016
|
+
store: store$c
|
|
15017
|
+
})));
|
|
15018
|
+
};
|
|
15019
|
+
|
|
15020
|
+
const NewsletterUpdateButton = ({
|
|
15021
|
+
name,
|
|
15022
|
+
onClick,
|
|
15023
|
+
...otherProps
|
|
15024
|
+
}) => {
|
|
15025
|
+
const {
|
|
15026
|
+
dispatch,
|
|
15027
|
+
state: {
|
|
15028
|
+
isSubmitting,
|
|
15029
|
+
isListLoading
|
|
15030
|
+
}
|
|
15031
|
+
} = React.useContext(store$c);
|
|
15032
|
+
const {
|
|
15033
|
+
t
|
|
15034
|
+
} = useTranslation("newsletter");
|
|
15035
|
+
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
15036
|
+
onClick: () => {
|
|
15037
|
+
dispatch({
|
|
15038
|
+
type: HANDLE_SUBMIT
|
|
15039
|
+
});
|
|
15040
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
15041
|
+
},
|
|
15042
|
+
disabled: isListLoading,
|
|
15043
|
+
isLoading: isSubmitting
|
|
15044
|
+
}, otherProps), name !== null && name !== void 0 ? name : t("labels.submit"));
|
|
15045
|
+
};
|
|
15046
|
+
|
|
15047
|
+
const NewsletterUpdateList = () => {
|
|
15048
|
+
const handleSelectNewsletter = event => {
|
|
15049
|
+
dispatch({
|
|
15050
|
+
type: SET_SELECT,
|
|
15051
|
+
payload: event.target.value
|
|
15052
|
+
});
|
|
15053
|
+
};
|
|
15054
|
+
|
|
15055
|
+
const {
|
|
15056
|
+
dispatch,
|
|
15057
|
+
state: {
|
|
15058
|
+
newsletters,
|
|
15059
|
+
isListLoading
|
|
15060
|
+
}
|
|
15061
|
+
} = React.useContext(store$c);
|
|
15062
|
+
|
|
15063
|
+
if (isListLoading) {
|
|
15064
|
+
return /*#__PURE__*/React__default['default'].createElement(Loader, {
|
|
15065
|
+
width: 60,
|
|
15066
|
+
height: 100
|
|
15067
|
+
});
|
|
15068
|
+
}
|
|
15069
|
+
|
|
15070
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
15071
|
+
className: "plc-max-h-80 plc-overflow-y-auto pelcro-newsletters-wrapper"
|
|
15072
|
+
}, newsletters.map(newsletter => /*#__PURE__*/React__default['default'].createElement("div", {
|
|
15073
|
+
key: newsletter.id,
|
|
15074
|
+
className: "plc-p-2 plc-mx-3 plc-mt-2 plc-border plc-border-gray-400 plc-border-solid plc-rounded plc-text-gray-900 pelcro-newsletter-wrapper"
|
|
15075
|
+
}, /*#__PURE__*/React__default['default'].createElement(Checkbox, {
|
|
15076
|
+
className: "pelcro-select-newsletter-checkbox",
|
|
15077
|
+
labelClassName: "plc-cursor-pointer plc-w-full",
|
|
15078
|
+
id: `pelcro-newsletter-update-${newsletter.id}`,
|
|
15079
|
+
checked: newsletter.selected,
|
|
15080
|
+
value: newsletter.id,
|
|
15081
|
+
onChange: handleSelectNewsletter
|
|
15082
|
+
}, newsletter.label))));
|
|
15083
|
+
};
|
|
15084
|
+
|
|
15085
|
+
const NewsletterUpdateView = props => {
|
|
15086
|
+
const {
|
|
15087
|
+
t
|
|
15088
|
+
} = useTranslation("newsletter");
|
|
15089
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
15090
|
+
id: "pelcro-newsletter-update-view"
|
|
15091
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
15092
|
+
className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
15093
|
+
}, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
15094
|
+
className: "plc-text-2xl plc-font-semibold"
|
|
15095
|
+
}, t("updateTitle"))), /*#__PURE__*/React__default['default'].createElement("form", {
|
|
15096
|
+
action: "javascript:void(0);",
|
|
15097
|
+
className: "plc-mt-2 pelcro-form"
|
|
15098
|
+
}, /*#__PURE__*/React__default['default'].createElement(NewsletterUpdateContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, null), /*#__PURE__*/React__default['default'].createElement(NewsletterUpdateList, null), /*#__PURE__*/React__default['default'].createElement(NewsletterUpdateButton, {
|
|
15099
|
+
role: "submit",
|
|
15100
|
+
className: "plc-mt-4 plc-w-full",
|
|
15101
|
+
name: t("labels.submit"),
|
|
15102
|
+
id: "pelcro-submit"
|
|
15103
|
+
}))));
|
|
15104
|
+
};
|
|
15105
|
+
|
|
15106
|
+
const NewsletterUpdateModal = ({
|
|
15107
|
+
onDisplay,
|
|
15108
|
+
onClose,
|
|
15109
|
+
...otherProps
|
|
15110
|
+
}) => {
|
|
15111
|
+
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
15112
|
+
id: "pelcro-newsletter-update-modal",
|
|
15113
|
+
onDisplay: onDisplay,
|
|
15114
|
+
onClose: onClose
|
|
15115
|
+
}, /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(NewsletterUpdateView, otherProps)), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
|
|
15116
|
+
};
|
|
15117
|
+
NewsletterUpdateModal.viewId = "newsletter-update";
|
|
15118
|
+
|
|
15119
|
+
const MeterView = () => {
|
|
15120
|
+
var _paywallProduct$paywa, _paywallProduct$paywa2;
|
|
15121
|
+
|
|
15122
|
+
const {
|
|
15123
|
+
t
|
|
15124
|
+
} = useTranslation("meter");
|
|
15125
|
+
const {
|
|
15126
|
+
switchView,
|
|
15127
|
+
product,
|
|
15128
|
+
isAuthenticated
|
|
15129
|
+
} = usePelcro();
|
|
15130
|
+
const paywallProduct = product !== null && product !== void 0 ? product : window.Pelcro.paywall.getProduct();
|
|
15131
|
+
const visitsLeft = window.Pelcro.paywall.freeVisitsLeft();
|
|
15132
|
+
const title = `${paywallProduct === null || paywallProduct === void 0 ? void 0 : (_paywallProduct$paywa = paywallProduct.paywall) === null || _paywallProduct$paywa === void 0 ? void 0 : _paywallProduct$paywa.meter_title}: ${visitsLeft}`;
|
|
15133
|
+
const subtitle = paywallProduct === null || paywallProduct === void 0 ? void 0 : (_paywallProduct$paywa2 = paywallProduct.paywall) === null || _paywallProduct$paywa2 === void 0 ? void 0 : _paywallProduct$paywa2.meter_subtitle;
|
|
15134
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
15135
|
+
className: "plc-mb-2 plc-text-2xl plc-font-semibold plc-text-gray-600"
|
|
15136
|
+
}, title), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
15137
|
+
className: "plc-text-sm plc-text-gray-600"
|
|
15138
|
+
}, subtitle, " ", /*#__PURE__*/React__default['default'].createElement(Link, {
|
|
15139
|
+
className: "plc-ml-1",
|
|
15140
|
+
onClick: () => switchView("plan-select")
|
|
15141
|
+
}, t("messages.subscribeNow")), !isAuthenticated() && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", null, t("messages.alreadyHaveAccount") + " ", /*#__PURE__*/React__default['default'].createElement(Link, {
|
|
15142
|
+
className: "plc-ml-1",
|
|
15143
|
+
onClick: () => switchView("login")
|
|
15144
|
+
}, t("messages.loginHere"))))));
|
|
15145
|
+
};
|
|
15146
|
+
|
|
15147
|
+
// Meter view.
|
|
15148
|
+
const MeterModal = props => {
|
|
15149
|
+
const {
|
|
15150
|
+
resetView
|
|
15151
|
+
} = usePelcro();
|
|
15152
|
+
React.useEffect(() => {
|
|
15153
|
+
var _props$onDisplay;
|
|
15154
|
+
|
|
15155
|
+
(_props$onDisplay = props.onDisplay) === null || _props$onDisplay === void 0 ? void 0 : _props$onDisplay.call(props);
|
|
15156
|
+
}, []);
|
|
14407
15157
|
|
|
14408
15158
|
const onClose = () => {
|
|
14409
15159
|
var _props$onClose;
|
|
@@ -14417,7 +15167,7 @@ const MeterModal = props => {
|
|
|
14417
15167
|
className: "plc-fixed plc-bottom-0 plc-right-0 plc-w-full plc-p-4 plc-bg-white plc-border-t-4 plc-rounded plc-shadow-md motion-safe:plc-animate-slideInBottom sm:plc-m-4 sm:plc-max-w-md plc-z-max plc-border-primary-500"
|
|
14418
15168
|
}, /*#__PURE__*/React__default['default'].createElement("button", {
|
|
14419
15169
|
type: "button",
|
|
14420
|
-
className: "plc-absolute plc-top-0 plc-text-2xl plc-text-gray-500 plc-right-1 pelcro-close-btn",
|
|
15170
|
+
className: "plc-absolute plc-top-0 plc-text-2xl plc-text-gray-500 hover:plc-text-black focus:plc-text-black plc-right-1 plc-border-0 plc-bg-transparent hover:plc-bg-transparent focus:plc-bg-transparent pelcro-close-btn",
|
|
14421
15171
|
"aria-label": "Close",
|
|
14422
15172
|
onClick: onClose
|
|
14423
15173
|
}, /*#__PURE__*/React__default['default'].createElement("span", null, "\xD7")), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(MeterView, props)));
|
|
@@ -14450,10 +15200,7 @@ const SubscriptionCreateView = ({
|
|
|
14450
15200
|
interval,
|
|
14451
15201
|
count: interval_count
|
|
14452
15202
|
});
|
|
14453
|
-
const
|
|
14454
|
-
default_locale
|
|
14455
|
-
} = Pelcro.site.read();
|
|
14456
|
-
const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
|
|
15203
|
+
const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
14457
15204
|
return /*#__PURE__*/React__default['default'].createElement("p", {
|
|
14458
15205
|
className: "plc-text-gray-600"
|
|
14459
15206
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
@@ -14753,17 +15500,17 @@ const UserUpdatePhone = props => /*#__PURE__*/React__default['default'].createEl
|
|
|
14753
15500
|
|
|
14754
15501
|
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";
|
|
14755
15502
|
|
|
14756
|
-
var _path$
|
|
15503
|
+
var _path$f;
|
|
14757
15504
|
|
|
14758
|
-
function _extends$
|
|
15505
|
+
function _extends$h() { _extends$h = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
|
|
14759
15506
|
|
|
14760
15507
|
function SvgEdit(props) {
|
|
14761
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
15508
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
|
|
14762
15509
|
className: "plc-w-6 plc-h-6",
|
|
14763
15510
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14764
15511
|
viewBox: "0 0 20 20",
|
|
14765
15512
|
fill: "currentColor"
|
|
14766
|
-
}, props), _path$
|
|
15513
|
+
}, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
|
|
14767
15514
|
d: "M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zm-2.207 2.207L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"
|
|
14768
15515
|
})));
|
|
14769
15516
|
}
|
|
@@ -17630,7 +18377,6 @@ const OrderConfirmModal = props => {
|
|
|
17630
18377
|
const userOrders = window.Pelcro.user.read().orders;
|
|
17631
18378
|
const latestOrder = userOrders === null || userOrders === void 0 ? void 0 : userOrders[userOrders.length - 1];
|
|
17632
18379
|
const latestOrderDiscount = latestOrder === null || latestOrder === void 0 ? void 0 : (_latestOrder$coupon = latestOrder.coupon) === null || _latestOrder$coupon === void 0 ? void 0 : _latestOrder$coupon.percent_off;
|
|
17633
|
-
const locale = window.Pelcro.site.read().default_locale;
|
|
17634
18380
|
const {
|
|
17635
18381
|
t
|
|
17636
18382
|
} = useTranslation("shop");
|
|
@@ -17689,7 +18435,7 @@ const OrderConfirmModal = props => {
|
|
|
17689
18435
|
className: "plc-mr-1 pelcro-summary-total-text"
|
|
17690
18436
|
}, t("labels.total")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
17691
18437
|
className: "pelcro-summary-total"
|
|
17692
|
-
}, latestOrderDiscount && `(-${latestOrderDiscount}%) `, getFormattedPriceByLocal(latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.amount, latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.currency,
|
|
18438
|
+
}, latestOrderDiscount && `(-${latestOrderDiscount}%) `, getFormattedPriceByLocal(latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.amount, latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17693
18439
|
className: "plc-flex plc-justify-center plc-mt-6"
|
|
17694
18440
|
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
17695
18441
|
id: "pelcro-submit",
|
|
@@ -17751,9 +18497,9 @@ const GiftCreateContainer = ({
|
|
|
17751
18497
|
}
|
|
17752
18498
|
|
|
17753
18499
|
if (giftRecipient.startDate) {
|
|
17754
|
-
const nowDate = new Date();
|
|
17755
|
-
const yearFromNowDate = new Date(new Date().setFullYear(nowDate.getFullYear() + 1));
|
|
17756
|
-
const submittedDate = new Date(giftRecipient.startDate);
|
|
18500
|
+
const nowDate = getDateWithoutTime(new Date());
|
|
18501
|
+
const yearFromNowDate = getDateWithoutTime(new Date(new Date().setFullYear(nowDate.getFullYear() + 1)));
|
|
18502
|
+
const submittedDate = getDateWithoutTime(new Date(giftRecipient.startDate));
|
|
17757
18503
|
|
|
17758
18504
|
if (submittedDate < nowDate || submittedDate > yearFromNowDate) {
|
|
17759
18505
|
dispatch({
|
|
@@ -17874,18 +18620,18 @@ const GiftCreateLastName = props => /*#__PURE__*/React__default['default'].creat
|
|
|
17874
18620
|
store: store$4
|
|
17875
18621
|
}, props));
|
|
17876
18622
|
|
|
17877
|
-
var _path$
|
|
18623
|
+
var _path$e;
|
|
17878
18624
|
|
|
17879
|
-
function _extends$
|
|
18625
|
+
function _extends$g() { _extends$g = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
|
|
17880
18626
|
|
|
17881
18627
|
function SvgInfoCircle(props) {
|
|
17882
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
18628
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
|
|
17883
18629
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17884
18630
|
className: "plc-w-5 plc-h-5",
|
|
17885
18631
|
fill: "none",
|
|
17886
18632
|
viewBox: "0 0 24 24",
|
|
17887
18633
|
stroke: "currentColor"
|
|
17888
|
-
}, props), _path$
|
|
18634
|
+
}, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
|
|
17889
18635
|
strokeLinecap: "round",
|
|
17890
18636
|
strokeLinejoin: "round",
|
|
17891
18637
|
strokeWidth: 2,
|
|
@@ -18872,8 +19618,8 @@ const PaymentMethodSelectModal = ({
|
|
|
18872
19618
|
};
|
|
18873
19619
|
PaymentMethodSelectModal.viewId = "payment-method-select";
|
|
18874
19620
|
|
|
18875
|
-
function _extends$
|
|
18876
|
-
_extends$
|
|
19621
|
+
function _extends$f() {
|
|
19622
|
+
_extends$f = Object.assign || function (target) {
|
|
18877
19623
|
for (var i = 1; i < arguments.length; i++) {
|
|
18878
19624
|
var source = arguments[i];
|
|
18879
19625
|
|
|
@@ -18887,7 +19633,7 @@ function _extends$d() {
|
|
|
18887
19633
|
return target;
|
|
18888
19634
|
};
|
|
18889
19635
|
|
|
18890
|
-
return _extends$
|
|
19636
|
+
return _extends$f.apply(this, arguments);
|
|
18891
19637
|
}
|
|
18892
19638
|
|
|
18893
19639
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
@@ -19071,7 +19817,7 @@ function render(props, propsBag, defaultTag, features, visible) {
|
|
|
19071
19817
|
return match(strategy, (_match = {}, _match[RenderStrategy.Unmount] = function () {
|
|
19072
19818
|
return null;
|
|
19073
19819
|
}, _match[RenderStrategy.Hidden] = function () {
|
|
19074
|
-
return _render(_extends$
|
|
19820
|
+
return _render(_extends$f({}, _rest, {
|
|
19075
19821
|
hidden: true,
|
|
19076
19822
|
style: {
|
|
19077
19823
|
display: 'none'
|
|
@@ -19599,7 +20345,7 @@ function TransitionChild(props) {
|
|
|
19599
20345
|
var passthroughProps = rest;
|
|
19600
20346
|
return React__default['default'].createElement(NestingContext.Provider, {
|
|
19601
20347
|
value: nesting
|
|
19602
|
-
}, render(_extends$
|
|
20348
|
+
}, render(_extends$f({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
|
|
19603
20349
|
}
|
|
19604
20350
|
|
|
19605
20351
|
function Transition(props) {
|
|
@@ -19643,7 +20389,7 @@ function Transition(props) {
|
|
|
19643
20389
|
value: nestingBag
|
|
19644
20390
|
}, React__default['default'].createElement(TransitionContext.Provider, {
|
|
19645
20391
|
value: transitionBag
|
|
19646
|
-
}, render(_extends$
|
|
20392
|
+
}, render(_extends$f({}, sharedProps, {
|
|
19647
20393
|
as: React.Fragment,
|
|
19648
20394
|
children: React__default['default'].createElement(TransitionChild, Object.assign({}, sharedProps, passthroughProps))
|
|
19649
20395
|
}), propsBag, React.Fragment, TransitionChildRenderFeatures, state === TreeStates.Visible)));
|
|
@@ -19770,12 +20516,12 @@ var ActionTypes;
|
|
|
19770
20516
|
})(ActionTypes || (ActionTypes = {}));
|
|
19771
20517
|
|
|
19772
20518
|
(_reducers = {}, _reducers[ActionTypes.CloseMenu] = function (state) {
|
|
19773
|
-
return _extends$
|
|
20519
|
+
return _extends$f({}, state, {
|
|
19774
20520
|
activeItemIndex: null,
|
|
19775
20521
|
menuState: MenuStates.Closed
|
|
19776
20522
|
});
|
|
19777
20523
|
}, _reducers[ActionTypes.OpenMenu] = function (state) {
|
|
19778
|
-
return _extends$
|
|
20524
|
+
return _extends$f({}, state, {
|
|
19779
20525
|
menuState: MenuStates.Open
|
|
19780
20526
|
});
|
|
19781
20527
|
}, _reducers[ActionTypes.GoToItem] = function (state, action) {
|
|
@@ -19794,7 +20540,7 @@ var ActionTypes;
|
|
|
19794
20540
|
}
|
|
19795
20541
|
});
|
|
19796
20542
|
if (state.searchQuery === '' && state.activeItemIndex === activeItemIndex) return state;
|
|
19797
|
-
return _extends$
|
|
20543
|
+
return _extends$f({}, state, {
|
|
19798
20544
|
searchQuery: '',
|
|
19799
20545
|
activeItemIndex: activeItemIndex
|
|
19800
20546
|
});
|
|
@@ -19805,19 +20551,19 @@ var ActionTypes;
|
|
|
19805
20551
|
|
|
19806
20552
|
return ((_item$dataRef$current = item.dataRef.current.textValue) == null ? void 0 : _item$dataRef$current.startsWith(searchQuery)) && !item.dataRef.current.disabled;
|
|
19807
20553
|
});
|
|
19808
|
-
if (match === -1 || match === state.activeItemIndex) return _extends$
|
|
20554
|
+
if (match === -1 || match === state.activeItemIndex) return _extends$f({}, state, {
|
|
19809
20555
|
searchQuery: searchQuery
|
|
19810
20556
|
});
|
|
19811
|
-
return _extends$
|
|
20557
|
+
return _extends$f({}, state, {
|
|
19812
20558
|
searchQuery: searchQuery,
|
|
19813
20559
|
activeItemIndex: match
|
|
19814
20560
|
});
|
|
19815
20561
|
}, _reducers[ActionTypes.ClearSearch] = function (state) {
|
|
19816
|
-
return _extends$
|
|
20562
|
+
return _extends$f({}, state, {
|
|
19817
20563
|
searchQuery: ''
|
|
19818
20564
|
});
|
|
19819
20565
|
}, _reducers[ActionTypes.RegisterItem] = function (state, action) {
|
|
19820
|
-
return _extends$
|
|
20566
|
+
return _extends$f({}, state, {
|
|
19821
20567
|
items: [].concat(state.items, [{
|
|
19822
20568
|
id: action.id,
|
|
19823
20569
|
dataRef: action.dataRef
|
|
@@ -19830,7 +20576,7 @@ var ActionTypes;
|
|
|
19830
20576
|
return a.id === action.id;
|
|
19831
20577
|
});
|
|
19832
20578
|
if (idx !== -1) nextItems.splice(idx, 1);
|
|
19833
|
-
return _extends$
|
|
20579
|
+
return _extends$f({}, state, {
|
|
19834
20580
|
items: nextItems,
|
|
19835
20581
|
activeItemIndex: function () {
|
|
19836
20582
|
if (idx === state.activeItemIndex) return null;
|
|
@@ -19869,19 +20615,19 @@ var ActionTypes$1;
|
|
|
19869
20615
|
(_reducers$1 = {}, _reducers$1[ActionTypes$1.CloseListbox] = function (state) {
|
|
19870
20616
|
if (state.disabled) return state;
|
|
19871
20617
|
if (state.listboxState === ListboxStates.Closed) return state;
|
|
19872
|
-
return _extends$
|
|
20618
|
+
return _extends$f({}, state, {
|
|
19873
20619
|
activeOptionIndex: null,
|
|
19874
20620
|
listboxState: ListboxStates.Closed
|
|
19875
20621
|
});
|
|
19876
20622
|
}, _reducers$1[ActionTypes$1.OpenListbox] = function (state) {
|
|
19877
20623
|
if (state.disabled) return state;
|
|
19878
20624
|
if (state.listboxState === ListboxStates.Open) return state;
|
|
19879
|
-
return _extends$
|
|
20625
|
+
return _extends$f({}, state, {
|
|
19880
20626
|
listboxState: ListboxStates.Open
|
|
19881
20627
|
});
|
|
19882
20628
|
}, _reducers$1[ActionTypes$1.SetDisabled] = function (state, action) {
|
|
19883
20629
|
if (state.disabled === action.disabled) return state;
|
|
19884
|
-
return _extends$
|
|
20630
|
+
return _extends$f({}, state, {
|
|
19885
20631
|
disabled: action.disabled
|
|
19886
20632
|
});
|
|
19887
20633
|
}, _reducers$1[ActionTypes$1.GoToOption] = function (state, action) {
|
|
@@ -19902,7 +20648,7 @@ var ActionTypes$1;
|
|
|
19902
20648
|
}
|
|
19903
20649
|
});
|
|
19904
20650
|
if (state.searchQuery === '' && state.activeOptionIndex === activeOptionIndex) return state;
|
|
19905
|
-
return _extends$
|
|
20651
|
+
return _extends$f({}, state, {
|
|
19906
20652
|
searchQuery: '',
|
|
19907
20653
|
activeOptionIndex: activeOptionIndex
|
|
19908
20654
|
});
|
|
@@ -19915,10 +20661,10 @@ var ActionTypes$1;
|
|
|
19915
20661
|
|
|
19916
20662
|
return !option.dataRef.current.disabled && ((_option$dataRef$curre = option.dataRef.current.textValue) == null ? void 0 : _option$dataRef$curre.startsWith(searchQuery));
|
|
19917
20663
|
});
|
|
19918
|
-
if (match === -1 || match === state.activeOptionIndex) return _extends$
|
|
20664
|
+
if (match === -1 || match === state.activeOptionIndex) return _extends$f({}, state, {
|
|
19919
20665
|
searchQuery: searchQuery
|
|
19920
20666
|
});
|
|
19921
|
-
return _extends$
|
|
20667
|
+
return _extends$f({}, state, {
|
|
19922
20668
|
searchQuery: searchQuery,
|
|
19923
20669
|
activeOptionIndex: match
|
|
19924
20670
|
});
|
|
@@ -19926,11 +20672,11 @@ var ActionTypes$1;
|
|
|
19926
20672
|
if (state.disabled) return state;
|
|
19927
20673
|
if (state.listboxState === ListboxStates.Closed) return state;
|
|
19928
20674
|
if (state.searchQuery === '') return state;
|
|
19929
|
-
return _extends$
|
|
20675
|
+
return _extends$f({}, state, {
|
|
19930
20676
|
searchQuery: ''
|
|
19931
20677
|
});
|
|
19932
20678
|
}, _reducers$1[ActionTypes$1.RegisterOption] = function (state, action) {
|
|
19933
|
-
return _extends$
|
|
20679
|
+
return _extends$f({}, state, {
|
|
19934
20680
|
options: [].concat(state.options, [{
|
|
19935
20681
|
id: action.id,
|
|
19936
20682
|
dataRef: action.dataRef
|
|
@@ -19943,7 +20689,7 @@ var ActionTypes$1;
|
|
|
19943
20689
|
return a.id === action.id;
|
|
19944
20690
|
});
|
|
19945
20691
|
if (idx !== -1) nextOptions.splice(idx, 1);
|
|
19946
|
-
return _extends$
|
|
20692
|
+
return _extends$f({}, state, {
|
|
19947
20693
|
options: nextOptions,
|
|
19948
20694
|
activeOptionIndex: function () {
|
|
19949
20695
|
if (idx === state.activeOptionIndex) return null;
|
|
@@ -20004,18 +20750,18 @@ const getPaymentCardIcon = name => {
|
|
|
20004
20750
|
}));
|
|
20005
20751
|
};
|
|
20006
20752
|
|
|
20007
|
-
var _path$
|
|
20753
|
+
var _path$d;
|
|
20008
20754
|
|
|
20009
|
-
function _extends$
|
|
20755
|
+
function _extends$e() { _extends$e = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
|
|
20010
20756
|
|
|
20011
20757
|
function SvgChevronRight(props) {
|
|
20012
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
20758
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
|
|
20013
20759
|
className: "plc-w-6 plc-h-6",
|
|
20014
20760
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20015
20761
|
fill: "none",
|
|
20016
20762
|
viewBox: "0 0 24 24",
|
|
20017
20763
|
stroke: "currentColor"
|
|
20018
|
-
}, props), _path$
|
|
20764
|
+
}, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20019
20765
|
strokeLinecap: "round",
|
|
20020
20766
|
strokeLinejoin: "round",
|
|
20021
20767
|
strokeWidth: 2,
|
|
@@ -20058,7 +20804,6 @@ const OrderItems = ({
|
|
|
20058
20804
|
const {
|
|
20059
20805
|
t
|
|
20060
20806
|
} = useTranslation("dashboard");
|
|
20061
|
-
const site = window.Pelcro.site.read();
|
|
20062
20807
|
return !(orders !== null && orders !== void 0 && orders.length) ? /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20063
20808
|
colSpan: "3",
|
|
20064
20809
|
className: "plc-text-center plc-text-gray-500"
|
|
@@ -20074,7 +20819,7 @@ const OrderItems = ({
|
|
|
20074
20819
|
className: "plc-py-4 plc-pl-2"
|
|
20075
20820
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20076
20821
|
className: "plc-text-xl plc-font-semibold "
|
|
20077
|
-
}, getFormattedPriceByLocal(order.amount, order.currency,
|
|
20822
|
+
}, getFormattedPriceByLocal(order.amount, order.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20078
20823
|
className: "plc-text-xs plc-text-gray-400 plc-uppercase"
|
|
20079
20824
|
}, t("labels.orders.itemsAmount", {
|
|
20080
20825
|
count: getItemsAmount(order.id)
|
|
@@ -20103,7 +20848,7 @@ const OrderItems = ({
|
|
|
20103
20848
|
className: ""
|
|
20104
20849
|
}, item.product_sku_name))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20105
20850
|
className: "plc-font-semibold"
|
|
20106
|
-
}, getFormattedPriceByLocal(item.amount, order.currency,
|
|
20851
|
+
}, getFormattedPriceByLocal(item.amount, order.currency, getPageOrDefaultLanguage()))));
|
|
20107
20852
|
}), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20108
20853
|
colSpan: "3"
|
|
20109
20854
|
}, /*#__PURE__*/React__default['default'].createElement("hr", {
|
|
@@ -20232,9 +20977,267 @@ const SavedItems = ({
|
|
|
20232
20977
|
});
|
|
20233
20978
|
};
|
|
20234
20979
|
|
|
20235
|
-
|
|
20236
|
-
|
|
20237
|
-
|
|
20980
|
+
var _path$c;
|
|
20981
|
+
|
|
20982
|
+
function _extends$d() { _extends$d = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
|
|
20983
|
+
|
|
20984
|
+
function SvgRefresh(props) {
|
|
20985
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
|
|
20986
|
+
className: "plc-w-4 plc-h-4 plc-mr-1",
|
|
20987
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20988
|
+
fill: "none",
|
|
20989
|
+
viewBox: "0 0 24 24",
|
|
20990
|
+
stroke: "currentColor"
|
|
20991
|
+
}, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20992
|
+
strokeLinecap: "round",
|
|
20993
|
+
strokeLinejoin: "round",
|
|
20994
|
+
strokeWidth: 2,
|
|
20995
|
+
d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
|
|
20996
|
+
})));
|
|
20997
|
+
}
|
|
20998
|
+
|
|
20999
|
+
var _path$b;
|
|
21000
|
+
|
|
21001
|
+
function _extends$c() { _extends$c = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
|
|
21002
|
+
|
|
21003
|
+
function SvgCalendar(props) {
|
|
21004
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
|
|
21005
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21006
|
+
className: "plc-h-4 plc-w-4 plc-mr-1",
|
|
21007
|
+
viewBox: "0 0 20 20",
|
|
21008
|
+
fill: "currentColor"
|
|
21009
|
+
}, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
|
|
21010
|
+
fillRule: "evenodd",
|
|
21011
|
+
d: "M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",
|
|
21012
|
+
clipRule: "evenodd"
|
|
21013
|
+
})));
|
|
21014
|
+
}
|
|
21015
|
+
|
|
21016
|
+
var _path$a;
|
|
21017
|
+
|
|
21018
|
+
function _extends$b() { _extends$b = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
|
|
21019
|
+
|
|
21020
|
+
function SvgPlus(props) {
|
|
21021
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
|
|
21022
|
+
className: "plc-w-5 plc-h-5",
|
|
21023
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21024
|
+
fill: "none",
|
|
21025
|
+
viewBox: "0 0 24 24",
|
|
21026
|
+
stroke: "currentColor"
|
|
21027
|
+
}, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
|
|
21028
|
+
strokeLinecap: "round",
|
|
21029
|
+
strokeLinejoin: "round",
|
|
21030
|
+
strokeWidth: 2,
|
|
21031
|
+
d: "M12 6v6m0 0v6m0-6h6m-6 0H6"
|
|
21032
|
+
})));
|
|
21033
|
+
}
|
|
21034
|
+
|
|
21035
|
+
var _path$9;
|
|
21036
|
+
|
|
21037
|
+
function _extends$a() { _extends$a = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
|
|
21038
|
+
|
|
21039
|
+
function SvgCheckMark(props) {
|
|
21040
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
|
|
21041
|
+
className: "plc-w-4 plc-h-4 plc-mr-1",
|
|
21042
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21043
|
+
viewBox: "0 0 20 20",
|
|
21044
|
+
fill: "currentColor"
|
|
21045
|
+
}, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
21046
|
+
fillRule: "evenodd",
|
|
21047
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
|
|
21048
|
+
clipRule: "evenodd"
|
|
21049
|
+
})));
|
|
21050
|
+
}
|
|
21051
|
+
|
|
21052
|
+
const SubscriptionsMenu = props => {
|
|
21053
|
+
const {
|
|
21054
|
+
t
|
|
21055
|
+
} = useTranslation("dashboard");
|
|
21056
|
+
return /*#__PURE__*/React__default['default'].createElement("table", {
|
|
21057
|
+
className: "plc-w-full plc-table-fixed"
|
|
21058
|
+
}, /*#__PURE__*/React__default['default'].createElement("thead", {
|
|
21059
|
+
className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
|
|
21060
|
+
}, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
|
|
21061
|
+
className: "plc-w-3/12 "
|
|
21062
|
+
}, t("labels.plan")), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
21063
|
+
className: "plc-w-4/12 "
|
|
21064
|
+
}, t("labels.status.title")), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
21065
|
+
className: "plc-w-3/12 "
|
|
21066
|
+
}, t("labels.actions")), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
21067
|
+
className: "plc-w-2/12 "
|
|
21068
|
+
}))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
21069
|
+
className: "plc-h-4"
|
|
21070
|
+
})), /*#__PURE__*/React__default['default'].createElement(Accordion, null, /*#__PURE__*/React__default['default'].createElement(SubscriptionsItems, props)), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21071
|
+
colSpan: "4",
|
|
21072
|
+
className: "plc-p-1"
|
|
21073
|
+
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21074
|
+
variant: "ghost",
|
|
21075
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgPlus, {
|
|
21076
|
+
className: "plc-w-4 plc-h-4 plc-mr-1"
|
|
21077
|
+
}),
|
|
21078
|
+
className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
|
|
21079
|
+
onClick: props.displayProductSelect
|
|
21080
|
+
}, t("labels.addSubscription")))), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21081
|
+
colSpan: "4",
|
|
21082
|
+
className: "plc-p-1"
|
|
21083
|
+
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21084
|
+
variant: "ghost",
|
|
21085
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgGift, {
|
|
21086
|
+
className: "plc-w-4 plc-h-4 plc-mr-1"
|
|
21087
|
+
}),
|
|
21088
|
+
className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
|
|
21089
|
+
onClick: props.displayRedeem
|
|
21090
|
+
}, t("labels.redeemGift"))))));
|
|
21091
|
+
};
|
|
21092
|
+
const SubscriptionsItems = ({
|
|
21093
|
+
onClose,
|
|
21094
|
+
cancelSubscription,
|
|
21095
|
+
reactivateSubscription,
|
|
21096
|
+
setProductAndPlan,
|
|
21097
|
+
setSubscriptionIdToRenew,
|
|
21098
|
+
setView,
|
|
21099
|
+
getSubscriptionStatus,
|
|
21100
|
+
disableSubmit,
|
|
21101
|
+
activeMenu,
|
|
21102
|
+
toggleActiveMenu
|
|
21103
|
+
}) => {
|
|
21104
|
+
const {
|
|
21105
|
+
t
|
|
21106
|
+
} = useTranslation("dashboard");
|
|
21107
|
+
const subs = window.Pelcro.subscription.list();
|
|
21108
|
+
if (!subs || subs.length === 0) return null;
|
|
21109
|
+
return window.Pelcro.subscription.list().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
|
|
21110
|
+
const isActive = activeMenu === sub.id; // Cancel button click handlers
|
|
21111
|
+
|
|
21112
|
+
const onCancelClick = () => {
|
|
21113
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
21114
|
+
notify.confirm((onSuccess, onFailure) => {
|
|
21115
|
+
cancelSubscription(sub.id, onSuccess, onFailure);
|
|
21116
|
+
}, {
|
|
21117
|
+
confirmMessage: t("messages.subCancellation.isSureToCancel"),
|
|
21118
|
+
loadingMessage: t("messages.subCancellation.loading"),
|
|
21119
|
+
successMessage: t("messages.subCancellation.success"),
|
|
21120
|
+
errorMessage: t("messages.subCancellation.error")
|
|
21121
|
+
}, {
|
|
21122
|
+
closeButtonLabel: t("labels.subCancellation.goBack")
|
|
21123
|
+
});
|
|
21124
|
+
}; // Reactivate button click handlers
|
|
21125
|
+
|
|
21126
|
+
|
|
21127
|
+
const onReactivateClick = () => {
|
|
21128
|
+
reactivateSubscription(sub.id);
|
|
21129
|
+
}; // Renew click
|
|
21130
|
+
|
|
21131
|
+
|
|
21132
|
+
const onRenewClick = () => {
|
|
21133
|
+
const product_id = sub.plan.product.id;
|
|
21134
|
+
const plan_id = sub.plan.id;
|
|
21135
|
+
const product = window.Pelcro.product.getById(product_id);
|
|
21136
|
+
const plan = window.Pelcro.plan.getById(plan_id);
|
|
21137
|
+
setProductAndPlan(product, plan);
|
|
21138
|
+
setSubscriptionIdToRenew(sub.id);
|
|
21139
|
+
setView("plan-select");
|
|
21140
|
+
};
|
|
21141
|
+
|
|
21142
|
+
const getPhases = () => {
|
|
21143
|
+
if (!sub.schedule) return [];
|
|
21144
|
+
const currentPhaseStartDate = sub.schedule.current_phase.start_date;
|
|
21145
|
+
const currentPhase = sub.schedule.phases.find(phase => {
|
|
21146
|
+
return phase.start_date === currentPhaseStartDate;
|
|
21147
|
+
});
|
|
21148
|
+
const futurePhases = sub.schedule.phases.filter(phase => {
|
|
21149
|
+
return phase.start_date > currentPhaseStartDate;
|
|
21150
|
+
});
|
|
21151
|
+
return [currentPhase, ...futurePhases];
|
|
21152
|
+
};
|
|
21153
|
+
|
|
21154
|
+
const hasPhases = getPhases().length > 0;
|
|
21155
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, {
|
|
21156
|
+
key: sub.id
|
|
21157
|
+
}, /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
21158
|
+
onClick: () => toggleActiveMenu(sub.id),
|
|
21159
|
+
key: sub.id,
|
|
21160
|
+
className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header ${isActive ? "plc-bg-gray-100" : "hover:plc-bg-gray-50"}`
|
|
21161
|
+
}, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21162
|
+
className: "plc-truncate"
|
|
21163
|
+
}, sub.plan.nickname && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21164
|
+
className: "plc-font-semibold plc-text-gray-500"
|
|
21165
|
+
}, sub.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21166
|
+
className: "plc-text-xs plc-text-gray-400"
|
|
21167
|
+
}, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21168
|
+
className: "plc-py-2"
|
|
21169
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21170
|
+
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getSubscriptionStatus(sub).bgColor} plc-uppercase ${getSubscriptionStatus(sub).textColor} plc-rounded-lg`
|
|
21171
|
+
}, getSubscriptionStatus(sub).icon, getSubscriptionStatus(sub).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21172
|
+
className: "plc-text-xs plc-text-gray-500"
|
|
21173
|
+
}, sub.status && /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21174
|
+
className: "plc-inline-block plc-mt-1 plc-underline"
|
|
21175
|
+
}, getSubscriptionStatus(sub).content), /*#__PURE__*/React__default['default'].createElement("br", null), sub.shipments_remaining ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21176
|
+
className: "plc-inline-block plc-mt-1"
|
|
21177
|
+
}, sub.shipments_remaining, " ", t("labels.shipments")) : null)), /*#__PURE__*/React__default['default'].createElement("td", null, sub.cancel_at_period_end === 0 && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21178
|
+
variant: "ghost",
|
|
21179
|
+
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
|
|
21180
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
|
|
21181
|
+
onClick: onCancelClick,
|
|
21182
|
+
disabled: disableSubmit,
|
|
21183
|
+
"data-key": sub.id
|
|
21184
|
+
}, t("labels.unsubscribe")), sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21185
|
+
variant: "ghost",
|
|
21186
|
+
className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
|
|
21187
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
21188
|
+
onClick: onReactivateClick,
|
|
21189
|
+
disabled: disableSubmit,
|
|
21190
|
+
"data-key": sub.id
|
|
21191
|
+
}, t("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21192
|
+
variant: "ghost",
|
|
21193
|
+
className: "plc-text-blue-400 pelcro-dashboard-sub-renew-button",
|
|
21194
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
21195
|
+
onClick: onRenewClick,
|
|
21196
|
+
disabled: disableSubmit,
|
|
21197
|
+
"data-key": sub.id
|
|
21198
|
+
}, t("labels.renew"))), /*#__PURE__*/React__default['default'].createElement("td", null, hasPhases && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21199
|
+
className: `plc-flex plc-items-center plc-justify-center plc-transition-transform plc-ease-out plc-transform plc-rounded-full plc-w-7 plc-h-7 ${isActive ? "plc-flex plc-place-items-center plc-w-7 plc-h-7 plc-p-1 plc-bg-primary-400 plc-rounded-full" : "accordion-chevron"}`
|
|
21200
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21201
|
+
className: `plc-transition plc-ease-out ${isActive && "plc-text-white plc-transform plc-rotate-90"}`
|
|
21202
|
+
}, /*#__PURE__*/React__default['default'].createElement(SvgChevronRight, null)))))), /*#__PURE__*/React__default['default'].createElement("tbody", null, isActive && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, getPhases().map((phase, i) => {
|
|
21203
|
+
var _phase$plans;
|
|
21204
|
+
|
|
21205
|
+
const plan = (_phase$plans = phase.plans) === null || _phase$plans === void 0 ? void 0 : _phase$plans[0].plan;
|
|
21206
|
+
const isCurrentPhase = i === 0;
|
|
21207
|
+
const startDate = new Date(Number(`${phase.start_date}000`));
|
|
21208
|
+
const endDate = new Date(Number(`${phase.end_date}000`));
|
|
21209
|
+
const formattedStartDate = new Intl.DateTimeFormat("en-CA").format(startDate);
|
|
21210
|
+
const formattedEndDate = new Intl.DateTimeFormat("en-CA").format(endDate);
|
|
21211
|
+
const startDateString = `${t("labels.startsOn")} ${formattedStartDate}`;
|
|
21212
|
+
const endDateString = `${t("labels.expiresOn")} ${formattedEndDate}`;
|
|
21213
|
+
return /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
21214
|
+
key: `${phase.start_date}-${phase.end_date}`,
|
|
21215
|
+
className: "pelcro-sub-phase-row plc-w-full plc-align-middle"
|
|
21216
|
+
}, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21217
|
+
className: "plc-truncate"
|
|
21218
|
+
}, plan.nickname && /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21219
|
+
className: "plc-font-semibold plc-text-gray-500"
|
|
21220
|
+
}, plan.nickname)), /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21221
|
+
className: "plc-py-2"
|
|
21222
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21223
|
+
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold plc-uppercase plc-rounded-lg ${isCurrentPhase ? "plc-text-green-700 plc-bg-green-100" : "plc-text-blue-700 plc-bg-blue-100"}
|
|
21224
|
+
`
|
|
21225
|
+
}, isCurrentPhase ? /*#__PURE__*/React__default['default'].createElement(SvgCheckMark, null) : /*#__PURE__*/React__default['default'].createElement(SvgCalendar, null), isCurrentPhase ? t("labels.status.active") : t("labels.status.scheduled")), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21226
|
+
className: "plc-text-xs plc-text-gray-500"
|
|
21227
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21228
|
+
className: "plc-inline-block plc-mt-1 plc-underline"
|
|
21229
|
+
}, isCurrentPhase ? endDateString : startDateString))));
|
|
21230
|
+
}), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21231
|
+
colSpan: "4"
|
|
21232
|
+
}, /*#__PURE__*/React__default['default'].createElement("hr", {
|
|
21233
|
+
className: "plc-mt-4"
|
|
21234
|
+
}))))));
|
|
21235
|
+
});
|
|
21236
|
+
};
|
|
21237
|
+
|
|
21238
|
+
/**
|
|
21239
|
+
* @typedef {Object} AccordionPropsType
|
|
21240
|
+
* @property {string} initialActiveMenu the initial active menu
|
|
20238
21241
|
*/
|
|
20239
21242
|
|
|
20240
21243
|
/**
|
|
@@ -20258,7 +21261,7 @@ const Accordion = ({
|
|
|
20258
21261
|
};
|
|
20259
21262
|
|
|
20260
21263
|
return React__default['default'].Children.map(children, (child, i) => {
|
|
20261
|
-
if (child.type === Accordion.item || child.type === OrderItems || child.type === SavedItems) {
|
|
21264
|
+
if (child.type === Accordion.item || child.type === OrderItems || child.type === SavedItems || child.type === SubscriptionsItems) {
|
|
20262
21265
|
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
20263
21266
|
activeMenu,
|
|
20264
21267
|
toggleActiveMenu,
|
|
@@ -20314,18 +21317,18 @@ Accordion.item = function AccordionItem({
|
|
|
20314
21317
|
}, content)) : null;
|
|
20315
21318
|
};
|
|
20316
21319
|
|
|
20317
|
-
var _path$
|
|
21320
|
+
var _path$8;
|
|
20318
21321
|
|
|
20319
|
-
function _extends$
|
|
21322
|
+
function _extends$9() { _extends$9 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
|
|
20320
21323
|
|
|
20321
21324
|
function SvgExit(props) {
|
|
20322
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
21325
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
|
|
20323
21326
|
className: "plc-w-6 plc-h-6",
|
|
20324
21327
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20325
21328
|
fill: "none",
|
|
20326
21329
|
viewBox: "0 0 24 24",
|
|
20327
21330
|
stroke: "currentColor"
|
|
20328
|
-
}, props), _path$
|
|
21331
|
+
}, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20329
21332
|
strokeLinecap: "round",
|
|
20330
21333
|
strokeLinejoin: "round",
|
|
20331
21334
|
strokeWidth: 2,
|
|
@@ -20333,34 +21336,17 @@ function SvgExit(props) {
|
|
|
20333
21336
|
})));
|
|
20334
21337
|
}
|
|
20335
21338
|
|
|
20336
|
-
var _path$
|
|
20337
|
-
|
|
20338
|
-
function _extends$a() { _extends$a = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
|
|
20339
|
-
|
|
20340
|
-
function SvgCheckMark(props) {
|
|
20341
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
|
|
20342
|
-
className: "plc-w-4 plc-h-4 plc-mr-1",
|
|
20343
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20344
|
-
viewBox: "0 0 20 20",
|
|
20345
|
-
fill: "currentColor"
|
|
20346
|
-
}, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20347
|
-
fillRule: "evenodd",
|
|
20348
|
-
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
|
|
20349
|
-
clipRule: "evenodd"
|
|
20350
|
-
})));
|
|
20351
|
-
}
|
|
20352
|
-
|
|
20353
|
-
var _path$8;
|
|
21339
|
+
var _path$7;
|
|
20354
21340
|
|
|
20355
|
-
function _extends$
|
|
21341
|
+
function _extends$8() { _extends$8 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
|
|
20356
21342
|
|
|
20357
21343
|
function SvgUser(props) {
|
|
20358
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
21344
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
|
|
20359
21345
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20360
21346
|
fill: "none",
|
|
20361
21347
|
viewBox: "0 0 24 24",
|
|
20362
21348
|
stroke: "currentColor"
|
|
20363
|
-
}, props), _path$
|
|
21349
|
+
}, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20364
21350
|
strokeLinecap: "round",
|
|
20365
21351
|
strokeLinejoin: "round",
|
|
20366
21352
|
strokeWidth: 2,
|
|
@@ -20368,37 +21354,37 @@ function SvgUser(props) {
|
|
|
20368
21354
|
})));
|
|
20369
21355
|
}
|
|
20370
21356
|
|
|
20371
|
-
var _path$
|
|
21357
|
+
var _path$6;
|
|
20372
21358
|
|
|
20373
|
-
function _extends$
|
|
21359
|
+
function _extends$7() { _extends$7 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
|
|
20374
21360
|
|
|
20375
|
-
function
|
|
20376
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
20377
|
-
className: "plc-w-4 plc-h-4 plc-mr-1",
|
|
21361
|
+
function SvgNewsletter(props) {
|
|
21362
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
|
|
20378
21363
|
xmlns: "http://www.w3.org/2000/svg",
|
|
21364
|
+
className: "plc-h-5 plc-w-5",
|
|
20379
21365
|
fill: "none",
|
|
20380
21366
|
viewBox: "0 0 24 24",
|
|
20381
21367
|
stroke: "currentColor"
|
|
20382
|
-
}, props), _path$
|
|
21368
|
+
}, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20383
21369
|
strokeLinecap: "round",
|
|
20384
21370
|
strokeLinejoin: "round",
|
|
20385
21371
|
strokeWidth: 2,
|
|
20386
|
-
d: "
|
|
21372
|
+
d: "M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z"
|
|
20387
21373
|
})));
|
|
20388
21374
|
}
|
|
20389
21375
|
|
|
20390
|
-
var _path$
|
|
21376
|
+
var _path$5;
|
|
20391
21377
|
|
|
20392
|
-
function _extends$
|
|
21378
|
+
function _extends$6() { _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
|
|
20393
21379
|
|
|
20394
21380
|
function SvgPaymentCard(props) {
|
|
20395
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
21381
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
|
|
20396
21382
|
className: "plc-w-6 plc-h-6 plc-mr-2",
|
|
20397
21383
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20398
21384
|
fill: "none",
|
|
20399
21385
|
viewBox: "0 0 24 24",
|
|
20400
21386
|
stroke: "currentColor"
|
|
20401
|
-
}, props), _path$
|
|
21387
|
+
}, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20402
21388
|
strokeLinecap: "round",
|
|
20403
21389
|
strokeLinejoin: "round",
|
|
20404
21390
|
strokeWidth: 2,
|
|
@@ -20406,18 +21392,18 @@ function SvgPaymentCard(props) {
|
|
|
20406
21392
|
})));
|
|
20407
21393
|
}
|
|
20408
21394
|
|
|
20409
|
-
var _path$
|
|
21395
|
+
var _path$4, _path2;
|
|
20410
21396
|
|
|
20411
|
-
function _extends$
|
|
21397
|
+
function _extends$5() { _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
|
|
20412
21398
|
|
|
20413
21399
|
function SvgLocationPin(props) {
|
|
20414
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
21400
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
|
|
20415
21401
|
className: "plc-w-6 plc-h-6 plc-mr-2",
|
|
20416
21402
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20417
21403
|
fill: "none",
|
|
20418
21404
|
viewBox: "0 0 24 24",
|
|
20419
21405
|
stroke: "currentColor"
|
|
20420
|
-
}, props), _path$
|
|
21406
|
+
}, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20421
21407
|
strokeLinecap: "round",
|
|
20422
21408
|
strokeLinejoin: "round",
|
|
20423
21409
|
strokeWidth: 2,
|
|
@@ -20432,10 +21418,10 @@ function SvgLocationPin(props) {
|
|
|
20432
21418
|
|
|
20433
21419
|
var _switch;
|
|
20434
21420
|
|
|
20435
|
-
function _extends$
|
|
21421
|
+
function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
|
|
20436
21422
|
|
|
20437
21423
|
function SvgSubscription(props) {
|
|
20438
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
21424
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
|
|
20439
21425
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20440
21426
|
viewBox: "0 0 100 125",
|
|
20441
21427
|
fill: "currentColor"
|
|
@@ -20450,30 +21436,11 @@ function SvgSubscription(props) {
|
|
|
20450
21436
|
}))))));
|
|
20451
21437
|
}
|
|
20452
21438
|
|
|
20453
|
-
var _path$4;
|
|
20454
|
-
|
|
20455
|
-
function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
|
|
20456
|
-
|
|
20457
|
-
function SvgShopping(props) {
|
|
20458
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
|
|
20459
|
-
className: "plc-w-6 plc-h-6 plc-mr-2",
|
|
20460
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20461
|
-
fill: "none",
|
|
20462
|
-
viewBox: "0 0 24 24",
|
|
20463
|
-
stroke: "currentColor"
|
|
20464
|
-
}, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20465
|
-
strokeLinecap: "round",
|
|
20466
|
-
strokeLinejoin: "round",
|
|
20467
|
-
strokeWidth: 2,
|
|
20468
|
-
d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"
|
|
20469
|
-
})));
|
|
20470
|
-
}
|
|
20471
|
-
|
|
20472
21439
|
var _path$3;
|
|
20473
21440
|
|
|
20474
21441
|
function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
|
|
20475
21442
|
|
|
20476
|
-
function
|
|
21443
|
+
function SvgShopping(props) {
|
|
20477
21444
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
|
|
20478
21445
|
className: "plc-w-6 plc-h-6 plc-mr-2",
|
|
20479
21446
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -20484,7 +21451,7 @@ function SvgBookmark(props) {
|
|
|
20484
21451
|
strokeLinecap: "round",
|
|
20485
21452
|
strokeLinejoin: "round",
|
|
20486
21453
|
strokeWidth: 2,
|
|
20487
|
-
d: "
|
|
21454
|
+
d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"
|
|
20488
21455
|
})));
|
|
20489
21456
|
}
|
|
20490
21457
|
|
|
@@ -20492,9 +21459,9 @@ var _path$2;
|
|
|
20492
21459
|
|
|
20493
21460
|
function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
20494
21461
|
|
|
20495
|
-
function
|
|
21462
|
+
function SvgBookmark(props) {
|
|
20496
21463
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
|
|
20497
|
-
className: "plc-w-
|
|
21464
|
+
className: "plc-w-6 plc-h-6 plc-mr-2",
|
|
20498
21465
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20499
21466
|
fill: "none",
|
|
20500
21467
|
viewBox: "0 0 24 24",
|
|
@@ -20503,7 +21470,7 @@ function SvgPlus(props) {
|
|
|
20503
21470
|
strokeLinecap: "round",
|
|
20504
21471
|
strokeLinejoin: "round",
|
|
20505
21472
|
strokeWidth: 2,
|
|
20506
|
-
d: "
|
|
21473
|
+
d: "M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"
|
|
20507
21474
|
})));
|
|
20508
21475
|
}
|
|
20509
21476
|
|
|
@@ -20603,6 +21570,24 @@ class Dashboard extends React.Component {
|
|
|
20603
21570
|
});
|
|
20604
21571
|
});
|
|
20605
21572
|
|
|
21573
|
+
_defineProperty$3(this, "componentWillUnmount", () => {
|
|
21574
|
+
document.removeEventListener("click", this.hideMenuIfClickedOutside);
|
|
21575
|
+
});
|
|
21576
|
+
|
|
21577
|
+
_defineProperty$3(this, "initializeHideMenuHandler", () => {
|
|
21578
|
+
document.addEventListener("click", this.hideMenuIfClickedOutside);
|
|
21579
|
+
});
|
|
21580
|
+
|
|
21581
|
+
_defineProperty$3(this, "hideMenuIfClickedOutside", event => {
|
|
21582
|
+
const didClickOutsideMenu = this.state.isOpen && this.menuRef.current && !this.menuRef.current.contains(event.target);
|
|
21583
|
+
|
|
21584
|
+
if (didClickOutsideMenu) {
|
|
21585
|
+
this.setState({
|
|
21586
|
+
isOpen: false
|
|
21587
|
+
});
|
|
21588
|
+
}
|
|
21589
|
+
});
|
|
21590
|
+
|
|
20606
21591
|
_defineProperty$3(this, "cancelSubscription", (subscription_id, onSuccess, onFailure) => {
|
|
20607
21592
|
// disable the Login button to prevent repeated clicks
|
|
20608
21593
|
window.Pelcro.subscription.cancel({
|
|
@@ -20640,6 +21625,10 @@ class Dashboard extends React.Component {
|
|
|
20640
21625
|
return this.props.setView("password-change");
|
|
20641
21626
|
});
|
|
20642
21627
|
|
|
21628
|
+
_defineProperty$3(this, "displayNewsletterUpdate", () => {
|
|
21629
|
+
return this.props.setView("newsletter-update");
|
|
21630
|
+
});
|
|
21631
|
+
|
|
20643
21632
|
_defineProperty$3(this, "displayProductSelect", ({
|
|
20644
21633
|
isGift
|
|
20645
21634
|
}) => {
|
|
@@ -20745,116 +21734,6 @@ class Dashboard extends React.Component {
|
|
|
20745
21734
|
};
|
|
20746
21735
|
});
|
|
20747
21736
|
|
|
20748
|
-
_defineProperty$3(this, "renderSubscriptions", () => {
|
|
20749
|
-
var _this$state$subscript;
|
|
20750
|
-
|
|
20751
|
-
const subscriptions = (_this$state$subscript = this.state.subscriptions) === null || _this$state$subscript === void 0 ? void 0 : _this$state$subscript.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
|
|
20752
|
-
// Cancel button click handlers
|
|
20753
|
-
const onCancelClick = () => {
|
|
20754
|
-
this.props.onClose();
|
|
20755
|
-
notify.confirm((onSuccess, onFailure) => {
|
|
20756
|
-
this.cancelSubscription(sub.id, onSuccess, onFailure);
|
|
20757
|
-
}, {
|
|
20758
|
-
confirmMessage: this.locale("messages.subCancellation.isSureToCancel"),
|
|
20759
|
-
loadingMessage: this.locale("messages.subCancellation.loading"),
|
|
20760
|
-
successMessage: this.locale("messages.subCancellation.success"),
|
|
20761
|
-
errorMessage: this.locale("messages.subCancellation.error")
|
|
20762
|
-
}, {
|
|
20763
|
-
closeButtonLabel: this.locale("labels.subCancellation.goBack")
|
|
20764
|
-
});
|
|
20765
|
-
}; // Reactivate button click handlers
|
|
20766
|
-
|
|
20767
|
-
|
|
20768
|
-
const onReactivateClick = () => {
|
|
20769
|
-
this.reactivateSubscription(sub.id);
|
|
20770
|
-
}; // Renew click
|
|
20771
|
-
|
|
20772
|
-
|
|
20773
|
-
const onRenewClick = () => {
|
|
20774
|
-
const product_id = sub.plan.product.id;
|
|
20775
|
-
const plan_id = sub.plan.id;
|
|
20776
|
-
const product = window.Pelcro.product.getById(product_id);
|
|
20777
|
-
const plan = window.Pelcro.plan.getById(plan_id);
|
|
20778
|
-
this.props.setProductAndPlan(product, plan);
|
|
20779
|
-
this.props.setSubscriptionIdToRenew(sub.id);
|
|
20780
|
-
this.props.setView("plan-select");
|
|
20781
|
-
};
|
|
20782
|
-
|
|
20783
|
-
return /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
20784
|
-
key: "dashboard-subscription-" + sub.id,
|
|
20785
|
-
className: "plc-w-full plc-align-top"
|
|
20786
|
-
}, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20787
|
-
className: "plc-truncate"
|
|
20788
|
-
}, sub.plan.nickname && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20789
|
-
className: "plc-font-semibold plc-text-gray-500"
|
|
20790
|
-
}, sub.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20791
|
-
className: "plc-text-xs plc-text-gray-400"
|
|
20792
|
-
}, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency, this.site.default_locale)))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20793
|
-
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${this.getSubscriptionStatus(sub).bgColor} plc-uppercase ${this.getSubscriptionStatus(sub).textColor} plc-rounded-lg`
|
|
20794
|
-
}, this.getSubscriptionStatus(sub).icon, this.getSubscriptionStatus(sub).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20795
|
-
className: "plc-mb-4 plc-text-xs plc-text-gray-500"
|
|
20796
|
-
}, sub.status && /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20797
|
-
className: "plc-inline-block plc-mt-1 plc-underline"
|
|
20798
|
-
}, this.getSubscriptionStatus(sub).content), /*#__PURE__*/React__default['default'].createElement("br", null), sub.shipments_remaining ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20799
|
-
className: "plc-inline-block plc-mt-1"
|
|
20800
|
-
}, sub.shipments_remaining, " ", this.locale("labels.shipments")) : null)), /*#__PURE__*/React__default['default'].createElement("td", null, sub.cancel_at_period_end === 0 && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
20801
|
-
variant: "ghost",
|
|
20802
|
-
className: "plc-text-red-500 focus:plc-ring-red-500",
|
|
20803
|
-
icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
|
|
20804
|
-
onClick: onCancelClick,
|
|
20805
|
-
disabled: this.state.disableSubmit,
|
|
20806
|
-
"data-key": sub.id
|
|
20807
|
-
}, this.locale("labels.unsubscribe")), sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
20808
|
-
variant: "ghost",
|
|
20809
|
-
className: "plc-text-green-400 focus:plc-ring-green-300",
|
|
20810
|
-
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
20811
|
-
onClick: onReactivateClick,
|
|
20812
|
-
disabled: this.state.disableSubmit,
|
|
20813
|
-
"data-key": sub.id
|
|
20814
|
-
}, this.locale("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
20815
|
-
variant: "ghost",
|
|
20816
|
-
className: "plc-text-blue-400",
|
|
20817
|
-
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
20818
|
-
onClick: onRenewClick,
|
|
20819
|
-
disabled: this.state.disableSubmit,
|
|
20820
|
-
"data-key": sub.id
|
|
20821
|
-
}, this.locale("labels.renew"))));
|
|
20822
|
-
});
|
|
20823
|
-
return /*#__PURE__*/React__default['default'].createElement("table", {
|
|
20824
|
-
className: "plc-w-full plc-table-fixed"
|
|
20825
|
-
}, /*#__PURE__*/React__default['default'].createElement("thead", {
|
|
20826
|
-
className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
|
|
20827
|
-
}, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
|
|
20828
|
-
className: "plc-w-5/12 "
|
|
20829
|
-
}, this.locale("labels.plan")), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
20830
|
-
className: "plc-w-4/12 "
|
|
20831
|
-
}, this.locale("labels.status.title")), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
20832
|
-
className: "plc-w-3/12 "
|
|
20833
|
-
}, this.locale("labels.actions")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
20834
|
-
className: "plc-h-4"
|
|
20835
|
-
}), subscriptions, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20836
|
-
colSpan: "4",
|
|
20837
|
-
className: "plc-p-1"
|
|
20838
|
-
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
20839
|
-
variant: "ghost",
|
|
20840
|
-
icon: /*#__PURE__*/React__default['default'].createElement(SvgPlus, {
|
|
20841
|
-
className: "plc-w-4 plc-h-4 plc-mr-1"
|
|
20842
|
-
}),
|
|
20843
|
-
className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
|
|
20844
|
-
onClick: this.displayProductSelect
|
|
20845
|
-
}, this.locale("labels.addSubscription")))), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20846
|
-
colSpan: "4",
|
|
20847
|
-
className: "plc-p-1"
|
|
20848
|
-
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
20849
|
-
variant: "ghost",
|
|
20850
|
-
icon: /*#__PURE__*/React__default['default'].createElement(SvgGift, {
|
|
20851
|
-
className: "plc-w-4 plc-h-4 plc-mr-1"
|
|
20852
|
-
}),
|
|
20853
|
-
className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
|
|
20854
|
-
onClick: this.displayRedeem
|
|
20855
|
-
}, this.locale("labels.redeemGift"))))));
|
|
20856
|
-
});
|
|
20857
|
-
|
|
20858
21737
|
_defineProperty$3(this, "renderGiftRecipients", () => {
|
|
20859
21738
|
var _giftRecipients$sort, _giftRecipients$sort$;
|
|
20860
21739
|
|
|
@@ -20892,7 +21771,7 @@ class Dashboard extends React.Component {
|
|
|
20892
21771
|
className: "plc-font-semibold plc-text-gray-500"
|
|
20893
21772
|
}, recipient.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20894
21773
|
className: "plc-text-xs plc-text-gray-400"
|
|
20895
|
-
}, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency,
|
|
21774
|
+
}, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency, getPageOrDefaultLanguage())))), recipient.status && /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20896
21775
|
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${this.getSubscriptionStatus(recipient).bgColor} plc-uppercase ${this.getSubscriptionStatus(recipient).textColor} plc-rounded-lg`
|
|
20897
21776
|
}, this.getSubscriptionStatus(recipient).icon, this.getSubscriptionStatus(recipient).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20898
21777
|
className: "plc-mb-4 plc-text-xs plc-text-gray-500"
|
|
@@ -20994,28 +21873,33 @@ class Dashboard extends React.Component {
|
|
|
20994
21873
|
this.site = window.Pelcro.site.read();
|
|
20995
21874
|
this.locale = this.props.t;
|
|
20996
21875
|
this.user = window.Pelcro.user.read();
|
|
21876
|
+
this.menuRef = /*#__PURE__*/React__default['default'].createRef();
|
|
20997
21877
|
}
|
|
20998
21878
|
|
|
20999
21879
|
render() {
|
|
21000
|
-
var _window$Pelcro$user$r3, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
|
|
21880
|
+
var _window$Pelcro$user$r3, _window$Pelcro, _window$Pelcro$uiSett, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
|
|
21001
21881
|
|
|
21002
21882
|
const {
|
|
21003
21883
|
isOpen
|
|
21004
21884
|
} = this.state;
|
|
21005
21885
|
const userHasName = this.user.first_name || this.user.last_name;
|
|
21006
21886
|
const profilePicture = (_window$Pelcro$user$r3 = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : userSolidIcon;
|
|
21887
|
+
const newsletters = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.newsletters;
|
|
21888
|
+
const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
|
|
21007
21889
|
return /*#__PURE__*/React__default['default'].createElement(Transition, {
|
|
21008
21890
|
className: "plc-fixed plc-inset-y-0 plc-right-0 plc-h-full plc-max-w-xl plc-overflow-y-auto plc-text-left plc-bg-white plc-shadow-xl plc-z-max",
|
|
21009
21891
|
show: isOpen,
|
|
21010
21892
|
enter: "plc-transform plc-transition plc-duration-500",
|
|
21011
21893
|
enterFrom: "plc-translate-x-full",
|
|
21012
21894
|
enterTo: "plc-translate-x-0",
|
|
21895
|
+
afterEnter: this.initializeHideMenuHandler,
|
|
21013
21896
|
leave: "plc-transform plc-transition plc-duration-500",
|
|
21014
21897
|
leaveFrom: "plc-translate-x-0",
|
|
21015
21898
|
leaveTo: "plc-translate-x-full",
|
|
21016
21899
|
afterLeave: this.props.onClose
|
|
21017
21900
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21018
|
-
id: "pelcro-view-dashboard"
|
|
21901
|
+
id: "pelcro-view-dashboard",
|
|
21902
|
+
ref: this.menuRef
|
|
21019
21903
|
}, /*#__PURE__*/React__default['default'].createElement("header", {
|
|
21020
21904
|
className: "plc-flex plc-flex-col plc-p-4 plc-pl-2 plc-min-h-40 sm:plc-pr-8 plc-bg-primary-500"
|
|
21021
21905
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -21078,7 +21962,14 @@ class Dashboard extends React.Component {
|
|
|
21078
21962
|
}),
|
|
21079
21963
|
className: "plc-text-sm plc-text-gray-500 hover:plc-text-primary-700",
|
|
21080
21964
|
onClick: this.displayChangePassword
|
|
21081
|
-
}, this.locale("labels.changePassword"))
|
|
21965
|
+
}, this.locale("labels.changePassword")), siteHasNewslettersDefined && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21966
|
+
variant: "ghost",
|
|
21967
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgNewsletter, {
|
|
21968
|
+
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
21969
|
+
}),
|
|
21970
|
+
className: "plc-text-sm plc-text-gray-500 hover:plc-text-primary-700",
|
|
21971
|
+
onClick: this.displayNewsletterUpdate
|
|
21972
|
+
}, this.locale("labels.editNewsletters")))
|
|
21082
21973
|
}), /*#__PURE__*/React__default['default'].createElement(Accordion.item, {
|
|
21083
21974
|
name: SUB_MENUS.PAYMENT_CARDS,
|
|
21084
21975
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgPaymentCard, null),
|
|
@@ -21117,7 +22008,18 @@ class Dashboard extends React.Component {
|
|
|
21117
22008
|
className: "plc-w-10 plc-h-10 plc-pt-2 plc-pr-1 plc--ml-2"
|
|
21118
22009
|
}),
|
|
21119
22010
|
title: this.locale("labels.subscriptions"),
|
|
21120
|
-
content:
|
|
22011
|
+
content: /*#__PURE__*/React__default['default'].createElement(SubscriptionsMenu, {
|
|
22012
|
+
onClose: this.props.onClose,
|
|
22013
|
+
cancelSubscription: this.cancelSubscription,
|
|
22014
|
+
reactivateSubscription: this.reactivateSubscription,
|
|
22015
|
+
setProductAndPlan: this.props.setProductAndPlan,
|
|
22016
|
+
setSubscriptionIdToRenew: this.props.setSubscriptionIdToRenew,
|
|
22017
|
+
setView: this.props.setView,
|
|
22018
|
+
getSubscriptionStatus: this.getSubscriptionStatus,
|
|
22019
|
+
disableSubmit: this.state.disableSubmit,
|
|
22020
|
+
displayProductSelect: this.displayProductSelect,
|
|
22021
|
+
displayRedeem: this.displayRedeem
|
|
22022
|
+
})
|
|
21121
22023
|
}), /*#__PURE__*/React__default['default'].createElement(Accordion.item, {
|
|
21122
22024
|
name: SUB_MENUS.GIFTS,
|
|
21123
22025
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgGift, null),
|
|
@@ -21154,7 +22056,7 @@ const DashboardOpenButton = () => {
|
|
|
21154
22056
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21155
22057
|
className: "plc-fixed plc-right-4 plc-bottom-4 pelcro-open-dashboard-btn"
|
|
21156
22058
|
}, /*#__PURE__*/React__default['default'].createElement("button", {
|
|
21157
|
-
className: "plc-bg-white plc-border-2 plc-rounded-full focus:plc-outline-none plc-border-primary-300",
|
|
22059
|
+
className: "plc-bg-white plc-border-2 plc-rounded-full focus:plc-outline-none plc-border-primary-300 hover:plc-bg-white",
|
|
21158
22060
|
name: "menu",
|
|
21159
22061
|
id: "pelcro-view-menu",
|
|
21160
22062
|
onClick: () => switchView("dashboard")
|
|
@@ -23019,6 +23921,7 @@ exports.AddressUpdateSubmit = AddressUpdateSubmit;
|
|
|
23019
23921
|
exports.AddressUpdateTextInput = AddressUpdateTextInput;
|
|
23020
23922
|
exports.AddressUpdateView = AddressUpdateView;
|
|
23021
23923
|
exports.Alert = AlertWithContext;
|
|
23924
|
+
exports.AlertElement = Alert;
|
|
23022
23925
|
exports.ApplyCouponButton = ApplyCouponButton;
|
|
23023
23926
|
exports.Badge = Badge;
|
|
23024
23927
|
exports.BankRedirection = BankRedirection;
|
|
@@ -23070,6 +23973,11 @@ exports.Modal = Modal;
|
|
|
23070
23973
|
exports.ModalBody = ModalBody;
|
|
23071
23974
|
exports.ModalFooter = ModalFooter;
|
|
23072
23975
|
exports.NewsLetter = NewsletterWithHook;
|
|
23976
|
+
exports.NewsletterUpdateButton = NewsletterUpdateButton;
|
|
23977
|
+
exports.NewsletterUpdateContainer = NewsletterUpdateContainer;
|
|
23978
|
+
exports.NewsletterUpdateList = NewsletterUpdateList;
|
|
23979
|
+
exports.NewsletterUpdateModal = NewsletterUpdateModal;
|
|
23980
|
+
exports.NewsletterUpdateView = NewsletterUpdateView;
|
|
23073
23981
|
exports.Notification = Notification;
|
|
23074
23982
|
exports.OrderConfirmModal = OrderConfirmModal;
|
|
23075
23983
|
exports.OrderCreateContainer = OrderCreateContainer;
|
|
@@ -23148,6 +24056,7 @@ exports.SubscriptionCreateView = SubscriptionCreateView;
|
|
|
23148
24056
|
exports.SubscriptionRenewContainer = SubscriptionRenewContainer;
|
|
23149
24057
|
exports.SubscriptionRenewModal = SubscriptionRenewModal;
|
|
23150
24058
|
exports.SubscriptionRenewView = SubscriptionRenewView;
|
|
24059
|
+
exports.TaxAmount = TaxAmount;
|
|
23151
24060
|
exports.TextArea = TextArea;
|
|
23152
24061
|
exports.Tooltip = Tooltip;
|
|
23153
24062
|
exports.UserUpdateButton = UserUpdateButton;
|