@pelcro/react-pelcro-js 2.4.0-beta.9 → 2.6.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1430 -566
- package/dist/index.esm.js +1424 -567
- package/dist/pelcro.css +129 -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,
|
|
@@ -4359,7 +4359,8 @@ var labels$3 = {
|
|
|
4359
4359
|
title: "Status",
|
|
4360
4360
|
active: "Active",
|
|
4361
4361
|
inTrial: "In trial",
|
|
4362
|
-
endingSoon: "Ending soon"
|
|
4362
|
+
endingSoon: "Ending soon",
|
|
4363
|
+
scheduled: "Scheduled"
|
|
4363
4364
|
},
|
|
4364
4365
|
shipments: "Shipments remaining",
|
|
4365
4366
|
logout: "Logout",
|
|
@@ -4375,6 +4376,7 @@ var labels$3 = {
|
|
|
4375
4376
|
profile: "Profile",
|
|
4376
4377
|
updateProfile: "Edit profile",
|
|
4377
4378
|
changePassword: "Change password",
|
|
4379
|
+
editNewsletters: "Edit newsletters",
|
|
4378
4380
|
edit: "Edit",
|
|
4379
4381
|
gifts: "Gifts",
|
|
4380
4382
|
redeemGift: "Redeem gift",
|
|
@@ -4384,6 +4386,7 @@ var labels$3 = {
|
|
|
4384
4386
|
paymentSource: "Payment cards",
|
|
4385
4387
|
actions: "Actions",
|
|
4386
4388
|
expiresOn: "Ends",
|
|
4389
|
+
startsOn: "Starts",
|
|
4387
4390
|
renewsOn: "Renews",
|
|
4388
4391
|
canceledOn: "Canceled on",
|
|
4389
4392
|
recipient: "Recipient",
|
|
@@ -4435,7 +4438,8 @@ var labels$2 = {
|
|
|
4435
4438
|
title: "Statut",
|
|
4436
4439
|
active: "Active",
|
|
4437
4440
|
inTrial: "Dans l'essai",
|
|
4438
|
-
endingSoon: "Fin bientôt"
|
|
4441
|
+
endingSoon: "Fin bientôt",
|
|
4442
|
+
scheduled: "Programmé"
|
|
4439
4443
|
},
|
|
4440
4444
|
shipments: "Expéditions restantes",
|
|
4441
4445
|
logout: "Déconnexion",
|
|
@@ -4451,6 +4455,7 @@ var labels$2 = {
|
|
|
4451
4455
|
profile: "Profil",
|
|
4452
4456
|
updateProfile: "Mettre à jour le profil",
|
|
4453
4457
|
changePassword: "Changer le mot de passe",
|
|
4458
|
+
editNewsletters: "Modifier les newsletters",
|
|
4454
4459
|
edit: "Modifier",
|
|
4455
4460
|
gifts: "Cadeaux",
|
|
4456
4461
|
redeemGift: "Échanger un cadeau",
|
|
@@ -4460,6 +4465,7 @@ var labels$2 = {
|
|
|
4460
4465
|
paymentSource: "Sources de paiement",
|
|
4461
4466
|
actions: "Actes",
|
|
4462
4467
|
expiresOn: "Expire le",
|
|
4468
|
+
startsOn: "Débute le",
|
|
4463
4469
|
renewsOn: "Renouvelle le",
|
|
4464
4470
|
canceledOn: "Annulé le",
|
|
4465
4471
|
recipient: "Destinataire",
|
|
@@ -4492,7 +4498,7 @@ var messages$2 = {
|
|
|
4492
4498
|
isSureToCancel: "Êtes-vous certain de vouloir annuler votre abonnement?",
|
|
4493
4499
|
loading: "Annulation de l'abonnement",
|
|
4494
4500
|
success: "L'abonnement a été annulé avec succès",
|
|
4495
|
-
error: "Une
|
|
4501
|
+
error: "Une erreur s'est produite lors de l'annulation de l'abonnement"
|
|
4496
4502
|
}
|
|
4497
4503
|
};
|
|
4498
4504
|
var dashboard_fr = {
|
|
@@ -5927,7 +5933,7 @@ class PelcroActions {
|
|
|
5927
5933
|
view,
|
|
5928
5934
|
cartItems,
|
|
5929
5935
|
...otherStateFields
|
|
5930
|
-
} = initialState$
|
|
5936
|
+
} = initialState$g;
|
|
5931
5937
|
this.set(otherStateFields);
|
|
5932
5938
|
});
|
|
5933
5939
|
|
|
@@ -6217,7 +6223,7 @@ class PelcroCallbacks {
|
|
|
6217
6223
|
|
|
6218
6224
|
}
|
|
6219
6225
|
|
|
6220
|
-
const initialState$
|
|
6226
|
+
const initialState$g = {
|
|
6221
6227
|
// View
|
|
6222
6228
|
view: null,
|
|
6223
6229
|
// Plans
|
|
@@ -6245,7 +6251,7 @@ const createPelcroStore = () => createStore(middleware_3((set, get) => {
|
|
|
6245
6251
|
return {
|
|
6246
6252
|
// Store setter
|
|
6247
6253
|
set,
|
|
6248
|
-
...initialState$
|
|
6254
|
+
...initialState$g,
|
|
6249
6255
|
// State actions
|
|
6250
6256
|
...actions,
|
|
6251
6257
|
// Callbacks
|
|
@@ -6325,13 +6331,34 @@ const getAddressById = id => {
|
|
|
6325
6331
|
};
|
|
6326
6332
|
/**
|
|
6327
6333
|
* Transforms locale names stored in our backend like
|
|
6328
|
-
* "en_US" into the
|
|
6334
|
+
* "en_US" into the standard accepted in core i18n methods: "en-US"
|
|
6329
6335
|
* @param {string} localeName
|
|
6330
6336
|
* @return {string | undefined}
|
|
6331
6337
|
* @example getCanonicalLocaleFormat("en_US") => "en-US"
|
|
6332
6338
|
*/
|
|
6333
6339
|
|
|
6334
6340
|
const getCanonicalLocaleFormat = localeName => localeName === null || localeName === void 0 ? void 0 : localeName.replace("_", "-");
|
|
6341
|
+
/**
|
|
6342
|
+
* @param {string} localeName
|
|
6343
|
+
* @return {string | undefined}
|
|
6344
|
+
* @example getLanguageWithoutRegion("en-US") => "en"
|
|
6345
|
+
*/
|
|
6346
|
+
|
|
6347
|
+
const getLanguageWithoutRegion = localeName => {
|
|
6348
|
+
var _getCanonicalLocaleFo;
|
|
6349
|
+
|
|
6350
|
+
return (_getCanonicalLocaleFo = getCanonicalLocaleFormat(localeName)) === null || _getCanonicalLocaleFo === void 0 ? void 0 : _getCanonicalLocaleFo.split("-")[0];
|
|
6351
|
+
};
|
|
6352
|
+
/**
|
|
6353
|
+
* Gets the current page language or fallbacks to site default
|
|
6354
|
+
* @return {string | undefined}
|
|
6355
|
+
*/
|
|
6356
|
+
|
|
6357
|
+
const getPageOrDefaultLanguage = () => {
|
|
6358
|
+
var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
6359
|
+
|
|
6360
|
+
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);
|
|
6361
|
+
};
|
|
6335
6362
|
/**
|
|
6336
6363
|
* Returns a formatted price string depending on locale
|
|
6337
6364
|
* @param {number} amount
|
|
@@ -6341,7 +6368,7 @@ const getCanonicalLocaleFormat = localeName => localeName === null || localeName
|
|
|
6341
6368
|
* @example getFormattedPriceByLocal(10, 'USD', 'en-US') => "$10.00"
|
|
6342
6369
|
*/
|
|
6343
6370
|
|
|
6344
|
-
const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en
|
|
6371
|
+
const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en") => {
|
|
6345
6372
|
const formatter = new Intl.NumberFormat(getCanonicalLocaleFormat(locale), {
|
|
6346
6373
|
style: "currency",
|
|
6347
6374
|
currency
|
|
@@ -6366,8 +6393,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
6366
6393
|
totalWithoutDividingBy100 += parseFloat(item.price ? (item.price * item.quantity).toFixed(2) : item.amount.toFixed(2));
|
|
6367
6394
|
}
|
|
6368
6395
|
|
|
6369
|
-
|
|
6370
|
-
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, locale);
|
|
6396
|
+
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
6371
6397
|
};
|
|
6372
6398
|
/**
|
|
6373
6399
|
* returns true if the URL contains a supported view trigger URL
|
|
@@ -6376,11 +6402,43 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
6376
6402
|
*/
|
|
6377
6403
|
|
|
6378
6404
|
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)) {
|
|
6405
|
+
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
6406
|
return true;
|
|
6381
6407
|
}
|
|
6382
6408
|
|
|
6383
6409
|
return false;
|
|
6410
|
+
/**
|
|
6411
|
+
*
|
|
6412
|
+
*/
|
|
6413
|
+
|
|
6414
|
+
function hasValidNewsletterUpdateUrl() {
|
|
6415
|
+
var _window$Pelcro2, _window$Pelcro2$uiSet;
|
|
6416
|
+
|
|
6417
|
+
if (viewID !== "newsletter-update") return false;
|
|
6418
|
+
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;
|
|
6419
|
+
const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
|
|
6420
|
+
|
|
6421
|
+
if (!siteHasNewslettersDefined) {
|
|
6422
|
+
return false;
|
|
6423
|
+
}
|
|
6424
|
+
|
|
6425
|
+
const queryParamEmail = window.Pelcro.helpers.getURLParameter("email");
|
|
6426
|
+
|
|
6427
|
+
if (queryParamEmail && window.Pelcro.user.isAuthenticated()) {
|
|
6428
|
+
var _window$Pelcro$user$r4;
|
|
6429
|
+
|
|
6430
|
+
if (queryParamEmail !== ((_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.email)) {
|
|
6431
|
+
console.error("email query parameter and user account email are different, url email query parameter must match user email if user is logged in");
|
|
6432
|
+
return false;
|
|
6433
|
+
}
|
|
6434
|
+
}
|
|
6435
|
+
|
|
6436
|
+
if (!queryParamEmail && !window.Pelcro.user.isAuthenticated()) {
|
|
6437
|
+
return false;
|
|
6438
|
+
}
|
|
6439
|
+
|
|
6440
|
+
return true;
|
|
6441
|
+
}
|
|
6384
6442
|
};
|
|
6385
6443
|
/**
|
|
6386
6444
|
* Returns the current stable viewID from all old variations
|
|
@@ -6412,7 +6470,7 @@ const disableScroll = () => {
|
|
|
6412
6470
|
}
|
|
6413
6471
|
};
|
|
6414
6472
|
const trackSubscriptionOnGA = () => {
|
|
6415
|
-
var _ReactGA$set, _window$Pelcro$user$
|
|
6473
|
+
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
6474
|
|
|
6417
6475
|
const {
|
|
6418
6476
|
product,
|
|
@@ -6434,7 +6492,7 @@ const trackSubscriptionOnGA = () => {
|
|
|
6434
6492
|
}
|
|
6435
6493
|
|
|
6436
6494
|
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$
|
|
6495
|
+
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
6496
|
});
|
|
6439
6497
|
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
6498
|
id: lastSubscriptionId,
|
|
@@ -6462,9 +6520,9 @@ const trackSubscriptionOnGA = () => {
|
|
|
6462
6520
|
*/
|
|
6463
6521
|
|
|
6464
6522
|
const userHasPaymentMethod = () => {
|
|
6465
|
-
var _window$Pelcro$user$
|
|
6523
|
+
var _window$Pelcro$user$r7, _window$Pelcro$user$r8;
|
|
6466
6524
|
|
|
6467
|
-
const sources = (_window$Pelcro$user$
|
|
6525
|
+
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
6526
|
return sources.length > 0;
|
|
6469
6527
|
};
|
|
6470
6528
|
/**
|
|
@@ -6530,10 +6588,20 @@ const getPaymentCardIcon$1 = name => {
|
|
|
6530
6588
|
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
6589
|
}));
|
|
6532
6590
|
};
|
|
6591
|
+
/**
|
|
6592
|
+
* Gets the current date with time set to 0
|
|
6593
|
+
* @param {Date} dateObject
|
|
6594
|
+
* @return {Date}
|
|
6595
|
+
*/
|
|
6596
|
+
|
|
6597
|
+
function getDateWithoutTime(dateObject) {
|
|
6598
|
+
const date = new Date(dateObject.getTime());
|
|
6599
|
+
date.setHours(0, 0, 0, 0);
|
|
6600
|
+
return date;
|
|
6601
|
+
}
|
|
6533
6602
|
|
|
6534
|
-
var _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
6535
6603
|
const resources = {
|
|
6536
|
-
|
|
6604
|
+
en: {
|
|
6537
6605
|
common: common_en,
|
|
6538
6606
|
paymentMethod: paymentMethod_en,
|
|
6539
6607
|
newsletter: newsletter_en,
|
|
@@ -6555,7 +6623,7 @@ const resources = {
|
|
|
6555
6623
|
select: select_en,
|
|
6556
6624
|
notification: notification_en
|
|
6557
6625
|
},
|
|
6558
|
-
|
|
6626
|
+
fr: {
|
|
6559
6627
|
common: common_fr,
|
|
6560
6628
|
paymentMethod: paymentMethod_fr,
|
|
6561
6629
|
newsletter: newsletter_fr,
|
|
@@ -6577,13 +6645,14 @@ const resources = {
|
|
|
6577
6645
|
select: select_fr,
|
|
6578
6646
|
notification: notification_fr
|
|
6579
6647
|
}
|
|
6580
|
-
};
|
|
6581
|
-
|
|
6582
|
-
|
|
6648
|
+
}; // set UI language to the page language or default to the language in site settings
|
|
6649
|
+
|
|
6650
|
+
const locale = getPageOrDefaultLanguage();
|
|
6583
6651
|
i18next.use(initReactI18next) // passes i18n down to react-i18next,
|
|
6584
6652
|
.init({
|
|
6585
6653
|
resources,
|
|
6586
|
-
lng:
|
|
6654
|
+
lng: locale,
|
|
6655
|
+
fallbackLng: "en",
|
|
6587
6656
|
// debug: true,
|
|
6588
6657
|
interpolation: {
|
|
6589
6658
|
escapeValue: false // react already safes from xss
|
|
@@ -6594,6 +6663,16 @@ i18next.use(initReactI18next) // passes i18n down to react-i18next,
|
|
|
6594
6663
|
|
|
6595
6664
|
}
|
|
6596
6665
|
});
|
|
6666
|
+
const pageLanguageObserver = new MutationObserver(mutationsList => {
|
|
6667
|
+
mutationsList.forEach(mutationRecord => {
|
|
6668
|
+
if (mutationRecord.attributeName === "lang") {
|
|
6669
|
+
i18next.changeLanguage(window.Pelcro.helpers.getHtmlLanguageAttribute());
|
|
6670
|
+
}
|
|
6671
|
+
});
|
|
6672
|
+
});
|
|
6673
|
+
pageLanguageObserver.observe(document.documentElement, {
|
|
6674
|
+
attributes: true
|
|
6675
|
+
});
|
|
6597
6676
|
|
|
6598
6677
|
function _classPrivateFieldGet(receiver, privateMap) {
|
|
6599
6678
|
var descriptor = privateMap.get(receiver);
|
|
@@ -6846,8 +6925,8 @@ const saveToMetadataButton = new SaveToMetadataButtonClass();
|
|
|
6846
6925
|
|
|
6847
6926
|
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
6927
|
|
|
6849
|
-
function _extends$
|
|
6850
|
-
_extends$
|
|
6928
|
+
function _extends$v() {
|
|
6929
|
+
_extends$v = Object.assign || function (target) {
|
|
6851
6930
|
for (var i = 1; i < arguments.length; i++) {
|
|
6852
6931
|
var source = arguments[i];
|
|
6853
6932
|
|
|
@@ -6861,7 +6940,7 @@ function _extends$t() {
|
|
|
6861
6940
|
return target;
|
|
6862
6941
|
};
|
|
6863
6942
|
|
|
6864
|
-
return _extends$
|
|
6943
|
+
return _extends$v.apply(this, arguments);
|
|
6865
6944
|
}
|
|
6866
6945
|
|
|
6867
6946
|
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
@@ -6951,7 +7030,7 @@ var clearFromRemoveQueue = function clearFromRemoveQueue(toastId) {
|
|
|
6951
7030
|
var reducer = function reducer(state, action) {
|
|
6952
7031
|
switch (action.type) {
|
|
6953
7032
|
case ActionType.ADD_TOAST:
|
|
6954
|
-
return _extends$
|
|
7033
|
+
return _extends$v({}, state, {
|
|
6955
7034
|
toasts: [action.toast].concat(state.toasts).slice(0, TOAST_LIMIT)
|
|
6956
7035
|
});
|
|
6957
7036
|
|
|
@@ -6961,9 +7040,9 @@ var reducer = function reducer(state, action) {
|
|
|
6961
7040
|
clearFromRemoveQueue(action.toast.id);
|
|
6962
7041
|
}
|
|
6963
7042
|
|
|
6964
|
-
return _extends$
|
|
7043
|
+
return _extends$v({}, state, {
|
|
6965
7044
|
toasts: state.toasts.map(function (t) {
|
|
6966
|
-
return t.id === action.toast.id ? _extends$
|
|
7045
|
+
return t.id === action.toast.id ? _extends$v({}, t, action.toast) : t;
|
|
6967
7046
|
})
|
|
6968
7047
|
});
|
|
6969
7048
|
|
|
@@ -6990,9 +7069,9 @@ var reducer = function reducer(state, action) {
|
|
|
6990
7069
|
});
|
|
6991
7070
|
}
|
|
6992
7071
|
|
|
6993
|
-
return _extends$
|
|
7072
|
+
return _extends$v({}, state, {
|
|
6994
7073
|
toasts: state.toasts.map(function (t) {
|
|
6995
|
-
return t.id === toastId || toastId === undefined ? _extends$
|
|
7074
|
+
return t.id === toastId || toastId === undefined ? _extends$v({}, t, {
|
|
6996
7075
|
visible: false
|
|
6997
7076
|
}) : t;
|
|
6998
7077
|
})
|
|
@@ -7000,28 +7079,28 @@ var reducer = function reducer(state, action) {
|
|
|
7000
7079
|
|
|
7001
7080
|
case ActionType.REMOVE_TOAST:
|
|
7002
7081
|
if (action.toastId === undefined) {
|
|
7003
|
-
return _extends$
|
|
7082
|
+
return _extends$v({}, state, {
|
|
7004
7083
|
toasts: []
|
|
7005
7084
|
});
|
|
7006
7085
|
}
|
|
7007
7086
|
|
|
7008
|
-
return _extends$
|
|
7087
|
+
return _extends$v({}, state, {
|
|
7009
7088
|
toasts: state.toasts.filter(function (t) {
|
|
7010
7089
|
return t.id !== action.toastId;
|
|
7011
7090
|
})
|
|
7012
7091
|
});
|
|
7013
7092
|
|
|
7014
7093
|
case ActionType.START_PAUSE:
|
|
7015
|
-
return _extends$
|
|
7094
|
+
return _extends$v({}, state, {
|
|
7016
7095
|
pausedAt: action.time
|
|
7017
7096
|
});
|
|
7018
7097
|
|
|
7019
7098
|
case ActionType.END_PAUSE:
|
|
7020
7099
|
var diff = action.time - (state.pausedAt || 0);
|
|
7021
|
-
return _extends$
|
|
7100
|
+
return _extends$v({}, state, {
|
|
7022
7101
|
pausedAt: undefined,
|
|
7023
7102
|
toasts: state.toasts.map(function (t) {
|
|
7024
|
-
return _extends$
|
|
7103
|
+
return _extends$v({}, t, {
|
|
7025
7104
|
pauseDuration: t.pauseDuration + diff
|
|
7026
7105
|
});
|
|
7027
7106
|
})
|
|
@@ -7068,12 +7147,12 @@ var useStore = function useStore(toastOptions) {
|
|
|
7068
7147
|
var mergedToasts = state.toasts.map(function (t) {
|
|
7069
7148
|
var _toastOptions$t$type, _toastOptions, _toastOptions$t$type2;
|
|
7070
7149
|
|
|
7071
|
-
return _extends$
|
|
7150
|
+
return _extends$v({}, toastOptions, toastOptions[t.type], t, {
|
|
7072
7151
|
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$
|
|
7152
|
+
style: _extends$v({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
|
|
7074
7153
|
});
|
|
7075
7154
|
});
|
|
7076
|
-
return _extends$
|
|
7155
|
+
return _extends$v({}, state, {
|
|
7077
7156
|
toasts: mergedToasts
|
|
7078
7157
|
});
|
|
7079
7158
|
};
|
|
@@ -7083,7 +7162,7 @@ var createToast = function createToast(message, type, opts) {
|
|
|
7083
7162
|
type = 'blank';
|
|
7084
7163
|
}
|
|
7085
7164
|
|
|
7086
|
-
return _extends$
|
|
7165
|
+
return _extends$v({
|
|
7087
7166
|
createdAt: Date.now(),
|
|
7088
7167
|
visible: true,
|
|
7089
7168
|
type: type,
|
|
@@ -7133,14 +7212,14 @@ toast.remove = function (toastId) {
|
|
|
7133
7212
|
};
|
|
7134
7213
|
|
|
7135
7214
|
toast.promise = function (promise, msgs, opts) {
|
|
7136
|
-
var id = toast.loading(msgs.loading, _extends$
|
|
7215
|
+
var id = toast.loading(msgs.loading, _extends$v({}, opts, opts == null ? void 0 : opts.loading));
|
|
7137
7216
|
promise.then(function (p) {
|
|
7138
|
-
toast.success(resolveValue(msgs.success, p), _extends$
|
|
7217
|
+
toast.success(resolveValue(msgs.success, p), _extends$v({
|
|
7139
7218
|
id: id
|
|
7140
7219
|
}, opts, opts == null ? void 0 : opts.success));
|
|
7141
7220
|
return p;
|
|
7142
7221
|
})["catch"](function (e) {
|
|
7143
|
-
toast.error(resolveValue(msgs.error, e), _extends$
|
|
7222
|
+
toast.error(resolveValue(msgs.error, e), _extends$v({
|
|
7144
7223
|
id: id
|
|
7145
7224
|
}, opts, opts == null ? void 0 : opts.error));
|
|
7146
7225
|
});
|
|
@@ -7479,7 +7558,7 @@ var ToastBar = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
7479
7558
|
var message = React.createElement(Message, Object.assign({}, toast.ariaProps), resolveValue(toast.message, toast));
|
|
7480
7559
|
return React.createElement(ToastBarBase, {
|
|
7481
7560
|
className: toast.className,
|
|
7482
|
-
style: _extends$
|
|
7561
|
+
style: _extends$v({}, animationStyle, style, toast.style)
|
|
7483
7562
|
}, typeof children === 'function' ? children({
|
|
7484
7563
|
icon: icon,
|
|
7485
7564
|
message: message
|
|
@@ -7509,7 +7588,7 @@ var getPositionStyle = function getPositionStyle(position, offset) {
|
|
|
7509
7588
|
} : position.includes('right') ? {
|
|
7510
7589
|
justifyContent: 'flex-end'
|
|
7511
7590
|
} : {};
|
|
7512
|
-
return _extends$
|
|
7591
|
+
return _extends$v({
|
|
7513
7592
|
left: 0,
|
|
7514
7593
|
right: 0,
|
|
7515
7594
|
display: 'flex',
|
|
@@ -7536,7 +7615,7 @@ var Toaster = function Toaster(_ref) {
|
|
|
7536
7615
|
handlers = _useToaster.handlers;
|
|
7537
7616
|
|
|
7538
7617
|
return React.createElement("div", {
|
|
7539
|
-
style: _extends$
|
|
7618
|
+
style: _extends$v({
|
|
7540
7619
|
position: 'fixed',
|
|
7541
7620
|
zIndex: 9999,
|
|
7542
7621
|
top: DEFAULT_OFFSET,
|
|
@@ -7571,82 +7650,82 @@ var Toaster = function Toaster(_ref) {
|
|
|
7571
7650
|
}));
|
|
7572
7651
|
};
|
|
7573
7652
|
|
|
7574
|
-
var _path$
|
|
7653
|
+
var _path$s;
|
|
7575
7654
|
|
|
7576
|
-
function _extends$
|
|
7655
|
+
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
7656
|
|
|
7578
7657
|
function SvgCheckSolid(props) {
|
|
7579
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
7658
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$u({
|
|
7580
7659
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7581
7660
|
className: "h-5 w-5",
|
|
7582
7661
|
viewBox: "0 0 20 20",
|
|
7583
7662
|
fill: "currentColor"
|
|
7584
|
-
}, props), _path$
|
|
7663
|
+
}, props), _path$s || (_path$s = /*#__PURE__*/React__namespace.createElement("path", {
|
|
7585
7664
|
fillRule: "evenodd",
|
|
7586
7665
|
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
7666
|
clipRule: "evenodd"
|
|
7588
7667
|
})));
|
|
7589
7668
|
}
|
|
7590
7669
|
|
|
7591
|
-
var _path$
|
|
7670
|
+
var _path$r;
|
|
7592
7671
|
|
|
7593
|
-
function _extends$
|
|
7672
|
+
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
7673
|
|
|
7595
7674
|
function SvgXIcon(props) {
|
|
7596
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
7675
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
|
|
7597
7676
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7598
7677
|
viewBox: "0 0 20 20",
|
|
7599
7678
|
fill: "currentColor"
|
|
7600
|
-
}, props), _path$
|
|
7679
|
+
}, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
|
|
7601
7680
|
fill: "evenodd",
|
|
7602
7681
|
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
7682
|
clipRule: "evenodd"
|
|
7604
7683
|
})));
|
|
7605
7684
|
}
|
|
7606
7685
|
|
|
7607
|
-
var _path$
|
|
7686
|
+
var _path$q;
|
|
7608
7687
|
|
|
7609
|
-
function _extends$
|
|
7688
|
+
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
7689
|
|
|
7611
7690
|
function SvgXIconSolid(props) {
|
|
7612
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
7691
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
|
|
7613
7692
|
className: "plc-w-4 plc-h-4",
|
|
7614
7693
|
fill: "currentColor",
|
|
7615
7694
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7616
7695
|
viewBox: "0 0 100 100"
|
|
7617
|
-
}, props), _path$
|
|
7696
|
+
}, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
|
|
7618
7697
|
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
7698
|
})));
|
|
7620
7699
|
}
|
|
7621
7700
|
|
|
7622
|
-
var _path$
|
|
7701
|
+
var _path$p;
|
|
7623
7702
|
|
|
7624
|
-
function _extends$
|
|
7703
|
+
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
7704
|
|
|
7626
7705
|
function SvgExclamation(props) {
|
|
7627
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
7706
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
|
|
7628
7707
|
className: "plc-w-4 plc-h-4 plc-mr-1",
|
|
7629
7708
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7630
7709
|
viewBox: "0 0 20 20",
|
|
7631
7710
|
fill: "currentColor"
|
|
7632
|
-
}, props), _path$
|
|
7711
|
+
}, props), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
|
|
7633
7712
|
fillRule: "evenodd",
|
|
7634
7713
|
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
7714
|
clipRule: "evenodd"
|
|
7636
7715
|
})));
|
|
7637
7716
|
}
|
|
7638
7717
|
|
|
7639
|
-
var _path$
|
|
7718
|
+
var _path$o, _path2$3;
|
|
7640
7719
|
|
|
7641
|
-
function _extends$
|
|
7720
|
+
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
7721
|
|
|
7643
7722
|
function SvgSpinner(props) {
|
|
7644
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
7723
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
|
|
7645
7724
|
className: "plc-animate-spin",
|
|
7646
7725
|
viewBox: "0 0 24 24",
|
|
7647
7726
|
fill: "currentColor",
|
|
7648
7727
|
xmlns: "http://www.w3.org/2000/svg"
|
|
7649
|
-
}, props), _path$
|
|
7728
|
+
}, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
|
|
7650
7729
|
opacity: 0.2,
|
|
7651
7730
|
fill: "evenodd",
|
|
7652
7731
|
clipRule: "evenodd",
|
|
@@ -7872,6 +7951,16 @@ const init$1 = () => {
|
|
|
7872
7951
|
}
|
|
7873
7952
|
}
|
|
7874
7953
|
|
|
7954
|
+
const pelcroUpdateNewslettersButtons = document.getElementsByClassName("pelcro-update-newsletters-button");
|
|
7955
|
+
|
|
7956
|
+
if (pelcroUpdateNewslettersButtons.length !== 0) {
|
|
7957
|
+
for (let i = 0; i < pelcroUpdateNewslettersButtons.length; i++) {
|
|
7958
|
+
pelcroUpdateNewslettersButtons[i].addEventListener("click", () => {
|
|
7959
|
+
switchView("newsletter-update");
|
|
7960
|
+
});
|
|
7961
|
+
}
|
|
7962
|
+
}
|
|
7963
|
+
|
|
7875
7964
|
const pelcroCartButtonsByClass = document.getElementsByClassName("pelcro-cart-button");
|
|
7876
7965
|
|
|
7877
7966
|
if (pelcroCartButtonsByClass.length !== 0) {
|
|
@@ -8087,87 +8176,71 @@ function Link({
|
|
|
8087
8176
|
|
|
8088
8177
|
const init = () => {
|
|
8089
8178
|
const {
|
|
8090
|
-
whenSiteReady,
|
|
8091
|
-
view,
|
|
8092
|
-
resetView,
|
|
8093
8179
|
switchView,
|
|
8094
8180
|
set
|
|
8095
8181
|
} = usePelcro.getStore();
|
|
8096
|
-
|
|
8097
|
-
const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
|
|
8182
|
+
const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
|
|
8098
8183
|
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8184
|
+
if (entitlementsProtectedElements.length === 0) {
|
|
8185
|
+
return false;
|
|
8186
|
+
}
|
|
8102
8187
|
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8188
|
+
if (!allElemsHaveSameEntitlements(entitlementsProtectedElements)) {
|
|
8189
|
+
console.error("not all elements protected by entitlements have the same entitlements, all elements protected by entitlements must have the exact same data-pelcro-entitlements attribute value");
|
|
8190
|
+
return false;
|
|
8191
|
+
}
|
|
8107
8192
|
|
|
8108
|
-
|
|
8109
|
-
|
|
8193
|
+
for (const elem of entitlementsProtectedElements) {
|
|
8194
|
+
const entitlements = getEntitlementsFromElem(elem);
|
|
8110
8195
|
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8196
|
+
if (entitlements.length === 0) {
|
|
8197
|
+
console.error("invalid data-pelcro-entitlements attribute value", elem);
|
|
8198
|
+
return false;
|
|
8199
|
+
}
|
|
8115
8200
|
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8201
|
+
if (window.Pelcro.product.getByEntitlements(entitlements).length === 0) {
|
|
8202
|
+
console.warn("user can't subscribe to any plan that has any of the entitlement(s) needed, this is usually unintentional, make sure that the entitlements are spelled correctly, entitlements are case sensitive. make sure that your plans are configured in a way that allows users from all supported countries, using all supported currencies, to have access to your content by subscribing to certain plans that provide the needed entitlement(s)");
|
|
8203
|
+
}
|
|
8119
8204
|
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8205
|
+
if (shouldBlurContent(entitlements)) {
|
|
8206
|
+
// remove all event listeners from the elem by replacing it with a deep clone of itself
|
|
8207
|
+
const elemDeepClone = elem.cloneNode(true);
|
|
8208
|
+
elem.replaceWith(elemDeepClone);
|
|
8209
|
+
disableKeyboardInteractions(elemDeepClone);
|
|
8210
|
+
elemDeepClone.setAttribute("style", "filter:blur(3px) !important; pointer-events:none !important; user-select:none !important");
|
|
8211
|
+
unblurElemWhenUserSubscribes(elemDeepClone, entitlements);
|
|
8212
|
+
const NOTIFICATION_ID = "entitlement";
|
|
8213
|
+
notify( /*#__PURE__*/React__default['default'].createElement("p", null, /*#__PURE__*/React__default['default'].createElement(Trans, {
|
|
8214
|
+
i18nKey: "messages:entitlement"
|
|
8215
|
+
}, "Some of the content on this page is available with one or more of our plans.", /*#__PURE__*/React__default['default'].createElement(Link, {
|
|
8216
|
+
onClick: () => {
|
|
8217
|
+
const productId = Number(elem.dataset.productId);
|
|
8218
|
+
const planId = Number(elem.dataset.planId);
|
|
8219
|
+
const selectedProduct = window.Pelcro.product.getById(productId);
|
|
8220
|
+
const selectedPlan = window.Pelcro.plan.getById(planId);
|
|
8221
|
+
const hasValidProductAndPlan = Boolean(selectedProduct && selectedPlan);
|
|
8132
8222
|
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8223
|
+
if (hasValidProductAndPlan) {
|
|
8224
|
+
set({
|
|
8225
|
+
product: selectedProduct,
|
|
8226
|
+
plan: selectedPlan
|
|
8227
|
+
});
|
|
8228
|
+
}
|
|
8136
8229
|
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
if (hasValidProductAndPlan) {
|
|
8149
|
-
set({
|
|
8150
|
-
product: selectedProduct,
|
|
8151
|
-
plan: selectedPlan
|
|
8152
|
-
});
|
|
8153
|
-
}
|
|
8230
|
+
notify.dismiss(NOTIFICATION_ID);
|
|
8231
|
+
switchView("_plan-select-entitlements");
|
|
8232
|
+
}
|
|
8233
|
+
}, "Subscribe"), "now to get full page access.")), {
|
|
8234
|
+
className: "pelcro-notification-entitlement",
|
|
8235
|
+
position: "bottom-right",
|
|
8236
|
+
duration: Infinity,
|
|
8237
|
+
id: NOTIFICATION_ID
|
|
8238
|
+
});
|
|
8239
|
+
}
|
|
8240
|
+
}
|
|
8154
8241
|
|
|
8155
|
-
|
|
8156
|
-
switchView("_plan-select-entitlements");
|
|
8157
|
-
}
|
|
8158
|
-
}, "Subscribe"), "now to get full page access.")), {
|
|
8159
|
-
className: "pelcro-notification-entitlement",
|
|
8160
|
-
position: "bottom-right",
|
|
8161
|
-
duration: Infinity,
|
|
8162
|
-
id: NOTIFICATION_ID
|
|
8163
|
-
});
|
|
8164
|
-
}
|
|
8165
|
-
});
|
|
8166
|
-
});
|
|
8242
|
+
return true;
|
|
8167
8243
|
};
|
|
8168
|
-
/**
|
|
8169
|
-
*
|
|
8170
|
-
*/
|
|
8171
8244
|
|
|
8172
8245
|
function allElemsHaveSameEntitlements(elems) {
|
|
8173
8246
|
const entitlements = getEntitlementsFromElem(elems[0]);
|
|
@@ -8177,10 +8250,6 @@ function allElemsHaveSameEntitlements(elems) {
|
|
|
8177
8250
|
return entitlements.every(ent => elemEntitlements.includes(ent));
|
|
8178
8251
|
});
|
|
8179
8252
|
}
|
|
8180
|
-
/**
|
|
8181
|
-
*
|
|
8182
|
-
*/
|
|
8183
|
-
|
|
8184
8253
|
|
|
8185
8254
|
function disableKeyboardInteractions(elem) {
|
|
8186
8255
|
elem.addEventListener("keydown", event => {
|
|
@@ -8193,10 +8262,6 @@ function disableKeyboardInteractions(elem) {
|
|
|
8193
8262
|
}
|
|
8194
8263
|
}, true);
|
|
8195
8264
|
}
|
|
8196
|
-
/**
|
|
8197
|
-
*
|
|
8198
|
-
*/
|
|
8199
|
-
|
|
8200
8265
|
|
|
8201
8266
|
function unblurElemWhenUserSubscribes(elem, entitlements) {
|
|
8202
8267
|
document.addEventListener("PelcroSubscriptionCreate", event => {
|
|
@@ -8204,11 +8269,11 @@ function unblurElemWhenUserSubscribes(elem, entitlements) {
|
|
|
8204
8269
|
isGift
|
|
8205
8270
|
} = usePelcro.getStore();
|
|
8206
8271
|
if (isGift) return;
|
|
8207
|
-
const latestSub = event.detail.data.subscriptions[
|
|
8272
|
+
const latestSub = event.detail.data.subscriptions[event.detail.data.subscriptions.length - 1];
|
|
8208
8273
|
const shouldUnblurContent = entitlements.some(ent => {
|
|
8209
|
-
var _latestSub$plan$entit, _latestSub$plan$entit2;
|
|
8274
|
+
var _latestSub$plan$entit, _latestSub$plan, _latestSub$plan$entit2;
|
|
8210
8275
|
|
|
8211
|
-
return (_latestSub$plan$entit = (_latestSub$plan
|
|
8276
|
+
return (_latestSub$plan$entit = latestSub === null || latestSub === void 0 ? void 0 : (_latestSub$plan = latestSub.plan) === null || _latestSub$plan === void 0 ? void 0 : (_latestSub$plan$entit2 = _latestSub$plan.entitlements) === null || _latestSub$plan$entit2 === void 0 ? void 0 : _latestSub$plan$entit2.includes(ent)) !== null && _latestSub$plan$entit !== void 0 ? _latestSub$plan$entit : false;
|
|
8212
8277
|
});
|
|
8213
8278
|
|
|
8214
8279
|
if (shouldUnblurContent) {
|
|
@@ -8216,15 +8281,180 @@ function unblurElemWhenUserSubscribes(elem, entitlements) {
|
|
|
8216
8281
|
}
|
|
8217
8282
|
});
|
|
8218
8283
|
}
|
|
8219
|
-
/**
|
|
8220
|
-
*
|
|
8221
|
-
*/
|
|
8222
|
-
|
|
8223
8284
|
|
|
8224
8285
|
function shouldBlurContent(entitlements) {
|
|
8225
8286
|
return entitlements.every(entitlement => !window.Pelcro.user.isEntitledTo(entitlement));
|
|
8226
8287
|
}
|
|
8227
8288
|
|
|
8289
|
+
var pure$1 = createCommonjsModule(function (module, exports) {
|
|
8290
|
+
|
|
8291
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8292
|
+
|
|
8293
|
+
function _typeof(obj) {
|
|
8294
|
+
"@babel/helpers - typeof";
|
|
8295
|
+
|
|
8296
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
8297
|
+
_typeof = function (obj) {
|
|
8298
|
+
return typeof obj;
|
|
8299
|
+
};
|
|
8300
|
+
} else {
|
|
8301
|
+
_typeof = function (obj) {
|
|
8302
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
8303
|
+
};
|
|
8304
|
+
}
|
|
8305
|
+
|
|
8306
|
+
return _typeof(obj);
|
|
8307
|
+
}
|
|
8308
|
+
|
|
8309
|
+
var V3_URL = 'https://js.stripe.com/v3';
|
|
8310
|
+
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
8311
|
+
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';
|
|
8312
|
+
var findScript = function findScript() {
|
|
8313
|
+
var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
|
|
8314
|
+
|
|
8315
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
8316
|
+
var script = scripts[i];
|
|
8317
|
+
|
|
8318
|
+
if (!V3_URL_REGEX.test(script.src)) {
|
|
8319
|
+
continue;
|
|
8320
|
+
}
|
|
8321
|
+
|
|
8322
|
+
return script;
|
|
8323
|
+
}
|
|
8324
|
+
|
|
8325
|
+
return null;
|
|
8326
|
+
};
|
|
8327
|
+
|
|
8328
|
+
var injectScript = function injectScript(params) {
|
|
8329
|
+
var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
|
|
8330
|
+
var script = document.createElement('script');
|
|
8331
|
+
script.src = "".concat(V3_URL).concat(queryString);
|
|
8332
|
+
var headOrBody = document.head || document.body;
|
|
8333
|
+
|
|
8334
|
+
if (!headOrBody) {
|
|
8335
|
+
throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
|
|
8336
|
+
}
|
|
8337
|
+
|
|
8338
|
+
headOrBody.appendChild(script);
|
|
8339
|
+
return script;
|
|
8340
|
+
};
|
|
8341
|
+
|
|
8342
|
+
var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
8343
|
+
if (!stripe || !stripe._registerWrapper) {
|
|
8344
|
+
return;
|
|
8345
|
+
}
|
|
8346
|
+
|
|
8347
|
+
stripe._registerWrapper({
|
|
8348
|
+
name: 'stripe-js',
|
|
8349
|
+
version: "1.21.1",
|
|
8350
|
+
startTime: startTime
|
|
8351
|
+
});
|
|
8352
|
+
};
|
|
8353
|
+
|
|
8354
|
+
var stripePromise = null;
|
|
8355
|
+
var loadScript = function loadScript(params) {
|
|
8356
|
+
// Ensure that we only attempt to load Stripe.js at most once
|
|
8357
|
+
if (stripePromise !== null) {
|
|
8358
|
+
return stripePromise;
|
|
8359
|
+
}
|
|
8360
|
+
|
|
8361
|
+
stripePromise = new Promise(function (resolve, reject) {
|
|
8362
|
+
if (typeof window === 'undefined') {
|
|
8363
|
+
// Resolve to null when imported server side. This makes the module
|
|
8364
|
+
// safe to import in an isomorphic code base.
|
|
8365
|
+
resolve(null);
|
|
8366
|
+
return;
|
|
8367
|
+
}
|
|
8368
|
+
|
|
8369
|
+
if (window.Stripe && params) {
|
|
8370
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
8371
|
+
}
|
|
8372
|
+
|
|
8373
|
+
if (window.Stripe) {
|
|
8374
|
+
resolve(window.Stripe);
|
|
8375
|
+
return;
|
|
8376
|
+
}
|
|
8377
|
+
|
|
8378
|
+
try {
|
|
8379
|
+
var script = findScript();
|
|
8380
|
+
|
|
8381
|
+
if (script && params) {
|
|
8382
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
8383
|
+
} else if (!script) {
|
|
8384
|
+
script = injectScript(params);
|
|
8385
|
+
}
|
|
8386
|
+
|
|
8387
|
+
script.addEventListener('load', function () {
|
|
8388
|
+
if (window.Stripe) {
|
|
8389
|
+
resolve(window.Stripe);
|
|
8390
|
+
} else {
|
|
8391
|
+
reject(new Error('Stripe.js not available'));
|
|
8392
|
+
}
|
|
8393
|
+
});
|
|
8394
|
+
script.addEventListener('error', function () {
|
|
8395
|
+
reject(new Error('Failed to load Stripe.js'));
|
|
8396
|
+
});
|
|
8397
|
+
} catch (error) {
|
|
8398
|
+
reject(error);
|
|
8399
|
+
return;
|
|
8400
|
+
}
|
|
8401
|
+
});
|
|
8402
|
+
return stripePromise;
|
|
8403
|
+
};
|
|
8404
|
+
var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
8405
|
+
if (maybeStripe === null) {
|
|
8406
|
+
return null;
|
|
8407
|
+
}
|
|
8408
|
+
|
|
8409
|
+
var stripe = maybeStripe.apply(undefined, args);
|
|
8410
|
+
registerWrapper(stripe, startTime);
|
|
8411
|
+
return stripe;
|
|
8412
|
+
};
|
|
8413
|
+
var validateLoadParams = function validateLoadParams(params) {
|
|
8414
|
+
var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
|
|
8415
|
+
|
|
8416
|
+
if (params === null || _typeof(params) !== 'object') {
|
|
8417
|
+
throw new Error(errorMessage);
|
|
8418
|
+
}
|
|
8419
|
+
|
|
8420
|
+
if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === 'boolean') {
|
|
8421
|
+
return params;
|
|
8422
|
+
}
|
|
8423
|
+
|
|
8424
|
+
throw new Error(errorMessage);
|
|
8425
|
+
};
|
|
8426
|
+
|
|
8427
|
+
var loadParams;
|
|
8428
|
+
var loadStripeCalled = false;
|
|
8429
|
+
var loadStripe = function loadStripe() {
|
|
8430
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8431
|
+
args[_key] = arguments[_key];
|
|
8432
|
+
}
|
|
8433
|
+
|
|
8434
|
+
loadStripeCalled = true;
|
|
8435
|
+
var startTime = Date.now();
|
|
8436
|
+
return loadScript(loadParams).then(function (maybeStripe) {
|
|
8437
|
+
return initStripe(maybeStripe, args, startTime);
|
|
8438
|
+
});
|
|
8439
|
+
};
|
|
8440
|
+
|
|
8441
|
+
loadStripe.setLoadParameters = function (params) {
|
|
8442
|
+
if (loadStripeCalled) {
|
|
8443
|
+
throw new Error('You cannot change load parameters after calling loadStripe');
|
|
8444
|
+
}
|
|
8445
|
+
|
|
8446
|
+
loadParams = validateLoadParams(params);
|
|
8447
|
+
};
|
|
8448
|
+
|
|
8449
|
+
exports.loadStripe = loadStripe;
|
|
8450
|
+
});
|
|
8451
|
+
|
|
8452
|
+
unwrapExports(pure$1);
|
|
8453
|
+
pure$1.loadStripe;
|
|
8454
|
+
|
|
8455
|
+
var pure = pure$1;
|
|
8456
|
+
var pure_1 = pure.loadStripe;
|
|
8457
|
+
|
|
8228
8458
|
/**
|
|
8229
8459
|
* @typedef {Object} OptionsType
|
|
8230
8460
|
* @property {boolean} loadPaymentSDKs
|
|
@@ -8250,6 +8480,7 @@ const optionsController = options => {
|
|
|
8250
8480
|
enableURLTriggers: initViewFromURL,
|
|
8251
8481
|
enableTheme: applyPelcroTheme,
|
|
8252
8482
|
enablePaywalls: initPaywalls,
|
|
8483
|
+
loadSecuritySDK: initSecuritySdk,
|
|
8253
8484
|
enableGoogleAnalytics: initGATracking
|
|
8254
8485
|
}; // Only execute enabled options
|
|
8255
8486
|
|
|
@@ -8266,7 +8497,9 @@ const initPaywalls = () => {
|
|
|
8266
8497
|
const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
|
|
8267
8498
|
|
|
8268
8499
|
if (((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.settings) === "subscription") {
|
|
8269
|
-
//
|
|
8500
|
+
// blur entitlements based content
|
|
8501
|
+
const didBlurContent = init(); // Skip paywall if article is not restricted
|
|
8502
|
+
|
|
8270
8503
|
if (isValidViewFromURL(viewFromURL) || !paywallMethods.isArticleRestricted()) {
|
|
8271
8504
|
return;
|
|
8272
8505
|
}
|
|
@@ -8276,9 +8509,14 @@ const initPaywalls = () => {
|
|
|
8276
8509
|
} = usePelcro.getStore();
|
|
8277
8510
|
|
|
8278
8511
|
if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8512
|
+
/*
|
|
8513
|
+
showing both the meter and the entitlements notification doesn't make sense from
|
|
8514
|
+
a product prespective + they would take half the screen on mobile devies, so we're
|
|
8515
|
+
not showing the meter, and only showing the entitlements notification.
|
|
8516
|
+
*/
|
|
8517
|
+
if (!didBlurContent) {
|
|
8518
|
+
switchView("meter");
|
|
8519
|
+
}
|
|
8282
8520
|
} else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
|
|
8283
8521
|
switchView("newsletter");
|
|
8284
8522
|
} else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
|
|
@@ -8287,8 +8525,15 @@ const initPaywalls = () => {
|
|
|
8287
8525
|
}
|
|
8288
8526
|
};
|
|
8289
8527
|
const loadPaymentSDKs = () => {
|
|
8290
|
-
//
|
|
8291
|
-
|
|
8528
|
+
// Lazy load stripe's SDK
|
|
8529
|
+
const {
|
|
8530
|
+
whenUserReady
|
|
8531
|
+
} = usePelcro.getStore();
|
|
8532
|
+
whenUserReady(() => {
|
|
8533
|
+
if (!window.Stripe) {
|
|
8534
|
+
pure_1(window.Pelcro.environment.stripe);
|
|
8535
|
+
}
|
|
8536
|
+
}); // Load PayPal SDK's
|
|
8292
8537
|
|
|
8293
8538
|
const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
|
|
8294
8539
|
|
|
@@ -8297,6 +8542,18 @@ const loadPaymentSDKs = () => {
|
|
|
8297
8542
|
window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.69.0/js/paypal-checkout.min.js", "braintree-paypal-sdk");
|
|
8298
8543
|
}
|
|
8299
8544
|
};
|
|
8545
|
+
const initSecuritySdk = () => {
|
|
8546
|
+
const {
|
|
8547
|
+
whenSiteReady
|
|
8548
|
+
} = usePelcro.getStore();
|
|
8549
|
+
whenSiteReady(() => {
|
|
8550
|
+
var _window$Pelcro$site$r2;
|
|
8551
|
+
|
|
8552
|
+
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;
|
|
8553
|
+
if (!securityKey) return;
|
|
8554
|
+
window.Pelcro.helpers.loadSDK(`https://www.google.com/recaptcha/enterprise.js?render=${securityKey}`, "pelcro-security-enteprise");
|
|
8555
|
+
});
|
|
8556
|
+
};
|
|
8300
8557
|
const initGATracking = () => {
|
|
8301
8558
|
var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
|
|
8302
8559
|
|
|
@@ -8383,9 +8640,9 @@ const applyPelcroTheme = () => {
|
|
|
8383
8640
|
};
|
|
8384
8641
|
|
|
8385
8642
|
whenSiteReady(() => {
|
|
8386
|
-
var _window$Pelcro$site$
|
|
8643
|
+
var _window$Pelcro$site$r3, _window$Pelcro$site$r4;
|
|
8387
8644
|
|
|
8388
|
-
const primaryColorHex = (_window$Pelcro$site$
|
|
8645
|
+
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;
|
|
8389
8646
|
|
|
8390
8647
|
if (!primaryColorHex) {
|
|
8391
8648
|
return;
|
|
@@ -8584,6 +8841,7 @@ const defaultOptions = {
|
|
|
8584
8841
|
enableURLTriggers: true,
|
|
8585
8842
|
enableTheme: true,
|
|
8586
8843
|
enablePaywalls: true,
|
|
8844
|
+
loadSecuritySDK: true,
|
|
8587
8845
|
enableGoogleAnalytics: false
|
|
8588
8846
|
};
|
|
8589
8847
|
const PelcroModalController = ({
|
|
@@ -8882,6 +9140,7 @@ const GET_STATES_SUCCESS = "GET_STATES_SUCCESS";
|
|
|
8882
9140
|
const GET_STATES_FETCH = "GET_STATES_FETCH";
|
|
8883
9141
|
const HANDLE_SUBMIT = "HANDLE_SUBMIT";
|
|
8884
9142
|
const SET_UPDATED_PRICE = "SET_UPDATED_PRICE";
|
|
9143
|
+
const SET_TAX_AMOUNT = "SET_TAX_AMOUNT";
|
|
8885
9144
|
const SET_CAN_MAKE_PAYMENT = "SET_CAN_MAKE_PAYMENT";
|
|
8886
9145
|
const SET_PAYMENT_REQUEST = "SET_PAYMENT_REQUEST";
|
|
8887
9146
|
const INIT_CONTAINER = "INIT_CONTAINER";
|
|
@@ -8910,6 +9169,9 @@ const SET_IMAGE_SRC = "SET_IMAGE_SRC";
|
|
|
8910
9169
|
const PASSWORD_CHANGE_SUCCESS = "PASSWORD_CHANGE_SUCCESS";
|
|
8911
9170
|
const SELECT_PAYMENT_METHOD = "SELECT_PAYMENT_METHOD";
|
|
8912
9171
|
const LOAD_PAYMENT_METHODS = "LOAD_PAYMENT_METHODS";
|
|
9172
|
+
const GET_NEWSLETTERS_FETCH = "GET_NEWSLETTERS_FETCH";
|
|
9173
|
+
const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
|
|
9174
|
+
const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
|
|
8913
9175
|
|
|
8914
9176
|
/**
|
|
8915
9177
|
* Extracts error message from the response error object
|
|
@@ -8971,7 +9233,7 @@ const debounce = (func, waitTime) => {
|
|
|
8971
9233
|
};
|
|
8972
9234
|
};
|
|
8973
9235
|
|
|
8974
|
-
const initialState$
|
|
9236
|
+
const initialState$f = {
|
|
8975
9237
|
email: "",
|
|
8976
9238
|
password: "",
|
|
8977
9239
|
emailError: null,
|
|
@@ -8982,10 +9244,10 @@ const initialState$e = {
|
|
|
8982
9244
|
content: ""
|
|
8983
9245
|
}
|
|
8984
9246
|
};
|
|
8985
|
-
const store$
|
|
9247
|
+
const store$f = /*#__PURE__*/React.createContext(initialState$f);
|
|
8986
9248
|
const {
|
|
8987
|
-
Provider: Provider$
|
|
8988
|
-
} = store$
|
|
9249
|
+
Provider: Provider$f
|
|
9250
|
+
} = store$f;
|
|
8989
9251
|
|
|
8990
9252
|
const LoginContainer = ({
|
|
8991
9253
|
style,
|
|
@@ -9092,7 +9354,7 @@ const LoginContainer = ({
|
|
|
9092
9354
|
});
|
|
9093
9355
|
|
|
9094
9356
|
case RESET_LOGIN_FORM:
|
|
9095
|
-
return initialState$
|
|
9357
|
+
return initialState$f;
|
|
9096
9358
|
|
|
9097
9359
|
case DISABLE_LOGIN_BUTTON:
|
|
9098
9360
|
return lib_7({ ...state,
|
|
@@ -9110,12 +9372,12 @@ const LoginContainer = ({
|
|
|
9110
9372
|
default:
|
|
9111
9373
|
return state;
|
|
9112
9374
|
}
|
|
9113
|
-
}, initialState$
|
|
9375
|
+
}, initialState$f);
|
|
9114
9376
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
9115
9377
|
style: { ...style
|
|
9116
9378
|
},
|
|
9117
9379
|
className: `pelcro-container pelcro-login-container ${className}`
|
|
9118
|
-
}, /*#__PURE__*/React__default['default'].createElement(Provider$
|
|
9380
|
+
}, /*#__PURE__*/React__default['default'].createElement(Provider$f, {
|
|
9119
9381
|
value: {
|
|
9120
9382
|
state,
|
|
9121
9383
|
dispatch
|
|
@@ -9123,12 +9385,12 @@ const LoginContainer = ({
|
|
|
9123
9385
|
}, children.length ? children.map((child, i) => {
|
|
9124
9386
|
if (child) {
|
|
9125
9387
|
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
9126
|
-
store: store$
|
|
9388
|
+
store: store$f,
|
|
9127
9389
|
key: i
|
|
9128
9390
|
});
|
|
9129
9391
|
}
|
|
9130
9392
|
}) : /*#__PURE__*/React__default['default'].cloneElement(children, {
|
|
9131
|
-
store: store$
|
|
9393
|
+
store: store$f
|
|
9132
9394
|
})));
|
|
9133
9395
|
};
|
|
9134
9396
|
|
|
@@ -9373,7 +9635,7 @@ const LoginButton = ({
|
|
|
9373
9635
|
buttonDisabled
|
|
9374
9636
|
},
|
|
9375
9637
|
dispatch
|
|
9376
|
-
} = React.useContext(store$
|
|
9638
|
+
} = React.useContext(store$f);
|
|
9377
9639
|
const {
|
|
9378
9640
|
t
|
|
9379
9641
|
} = useTranslation("login");
|
|
@@ -9394,23 +9656,23 @@ const LoginButton = ({
|
|
|
9394
9656
|
};
|
|
9395
9657
|
|
|
9396
9658
|
const LoginEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
|
|
9397
|
-
store: store$
|
|
9659
|
+
store: store$f
|
|
9398
9660
|
}, props));
|
|
9399
9661
|
|
|
9400
9662
|
const LoginPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
|
|
9401
|
-
store: store$
|
|
9663
|
+
store: store$f
|
|
9402
9664
|
}, props));
|
|
9403
9665
|
|
|
9404
|
-
var _path$
|
|
9666
|
+
var _path$n;
|
|
9405
9667
|
|
|
9406
|
-
function _extends$
|
|
9668
|
+
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); }
|
|
9407
9669
|
|
|
9408
9670
|
function SvgCheck(props) {
|
|
9409
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
9671
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
|
|
9410
9672
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9411
9673
|
fill: "currentColor",
|
|
9412
9674
|
viewBox: "0 0 20 20"
|
|
9413
|
-
}, props), _path$
|
|
9675
|
+
}, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
|
|
9414
9676
|
fillRule: "evenodd",
|
|
9415
9677
|
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",
|
|
9416
9678
|
clipRule: "evenodd"
|
|
@@ -9475,7 +9737,7 @@ var facebookLoginRenderProps = createCommonjsModule(function (module, exports) {
|
|
|
9475
9737
|
var FacebookLogin = unwrapExports(facebookLoginRenderProps);
|
|
9476
9738
|
facebookLoginRenderProps.FacebookLogin;
|
|
9477
9739
|
|
|
9478
|
-
const initialState$
|
|
9740
|
+
const initialState$e = {
|
|
9479
9741
|
email: "",
|
|
9480
9742
|
password: "",
|
|
9481
9743
|
emailError: null,
|
|
@@ -9492,10 +9754,10 @@ const initialState$d = {
|
|
|
9492
9754
|
content: ""
|
|
9493
9755
|
}
|
|
9494
9756
|
};
|
|
9495
|
-
const store$
|
|
9757
|
+
const store$e = /*#__PURE__*/React.createContext(initialState$e);
|
|
9496
9758
|
const {
|
|
9497
|
-
Provider: Provider$
|
|
9498
|
-
} = store$
|
|
9759
|
+
Provider: Provider$e
|
|
9760
|
+
} = store$e;
|
|
9499
9761
|
|
|
9500
9762
|
const RegisterContainer = ({
|
|
9501
9763
|
style,
|
|
@@ -9520,35 +9782,53 @@ const RegisterContainer = ({
|
|
|
9520
9782
|
jobTitle,
|
|
9521
9783
|
selectFields
|
|
9522
9784
|
} = filteredData;
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
dispatch({
|
|
9535
|
-
type: DISABLE_REGISTRATION_BUTTON,
|
|
9536
|
-
payload: false
|
|
9785
|
+
|
|
9786
|
+
if (!hasSecurityTokenEnabled()) {
|
|
9787
|
+
sendRegisterRequest();
|
|
9788
|
+
return;
|
|
9789
|
+
}
|
|
9790
|
+
|
|
9791
|
+
window.grecaptcha.enterprise.ready(async () => {
|
|
9792
|
+
var _window$Pelcro$site$r;
|
|
9793
|
+
|
|
9794
|
+
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, {
|
|
9795
|
+
action: "register"
|
|
9537
9796
|
});
|
|
9797
|
+
sendRegisterRequest(token);
|
|
9798
|
+
});
|
|
9538
9799
|
|
|
9539
|
-
|
|
9800
|
+
function sendRegisterRequest(securityToken) {
|
|
9801
|
+
window.Pelcro.user.register({
|
|
9802
|
+
email,
|
|
9803
|
+
password,
|
|
9804
|
+
first_name: firstName,
|
|
9805
|
+
last_name: lastName,
|
|
9806
|
+
security_token: securityToken,
|
|
9807
|
+
metadata: {
|
|
9808
|
+
organization,
|
|
9809
|
+
jobTitle,
|
|
9810
|
+
...selectFields
|
|
9811
|
+
}
|
|
9812
|
+
}, (err, res) => {
|
|
9540
9813
|
dispatch({
|
|
9541
|
-
type:
|
|
9542
|
-
payload:
|
|
9543
|
-
type: "error",
|
|
9544
|
-
content: getErrorMessages(err)
|
|
9545
|
-
}
|
|
9814
|
+
type: DISABLE_REGISTRATION_BUTTON,
|
|
9815
|
+
payload: false
|
|
9546
9816
|
});
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9817
|
+
|
|
9818
|
+
if (err) {
|
|
9819
|
+
dispatch({
|
|
9820
|
+
type: SHOW_ALERT,
|
|
9821
|
+
payload: {
|
|
9822
|
+
type: "error",
|
|
9823
|
+
content: getErrorMessages(err)
|
|
9824
|
+
}
|
|
9825
|
+
});
|
|
9826
|
+
onFailure(err);
|
|
9827
|
+
} else {
|
|
9828
|
+
onSuccess(res);
|
|
9829
|
+
}
|
|
9830
|
+
});
|
|
9831
|
+
}
|
|
9552
9832
|
};
|
|
9553
9833
|
|
|
9554
9834
|
const handleSocialLogin = ({
|
|
@@ -9660,7 +9940,7 @@ const RegisterContainer = ({
|
|
|
9660
9940
|
});
|
|
9661
9941
|
|
|
9662
9942
|
case RESET_LOGIN_FORM:
|
|
9663
|
-
return initialState$
|
|
9943
|
+
return initialState$e;
|
|
9664
9944
|
|
|
9665
9945
|
case DISABLE_REGISTRATION_BUTTON:
|
|
9666
9946
|
return lib_7({ ...state,
|
|
@@ -9678,12 +9958,12 @@ const RegisterContainer = ({
|
|
|
9678
9958
|
default:
|
|
9679
9959
|
return state;
|
|
9680
9960
|
}
|
|
9681
|
-
}, initialState$
|
|
9961
|
+
}, initialState$e);
|
|
9682
9962
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
9683
9963
|
style: { ...style
|
|
9684
9964
|
},
|
|
9685
9965
|
className: `pelcro-container pelcro-register-container ${className}`
|
|
9686
|
-
}, /*#__PURE__*/React__default['default'].createElement(Provider$
|
|
9966
|
+
}, /*#__PURE__*/React__default['default'].createElement(Provider$e, {
|
|
9687
9967
|
value: {
|
|
9688
9968
|
state,
|
|
9689
9969
|
dispatch
|
|
@@ -9691,24 +9971,33 @@ const RegisterContainer = ({
|
|
|
9691
9971
|
}, children.length ? children.map((child, i) => {
|
|
9692
9972
|
if (child) {
|
|
9693
9973
|
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
9694
|
-
store: store$
|
|
9974
|
+
store: store$e,
|
|
9695
9975
|
key: i
|
|
9696
9976
|
});
|
|
9697
9977
|
}
|
|
9698
9978
|
}) : /*#__PURE__*/React__default['default'].cloneElement(children, {
|
|
9699
|
-
store: store$
|
|
9979
|
+
store: store$e
|
|
9700
9980
|
})));
|
|
9701
9981
|
};
|
|
9982
|
+
/**
|
|
9983
|
+
* Checks if the current site has security token enabled
|
|
9984
|
+
* @return {boolean}
|
|
9985
|
+
*/
|
|
9986
|
+
|
|
9987
|
+
function hasSecurityTokenEnabled() {
|
|
9988
|
+
const hasSecuritySdkLoaded = Boolean(window.grecaptcha);
|
|
9989
|
+
return hasSecuritySdkLoaded;
|
|
9990
|
+
}
|
|
9702
9991
|
|
|
9703
|
-
var _path$
|
|
9992
|
+
var _path$m;
|
|
9704
9993
|
|
|
9705
|
-
function _extends$
|
|
9994
|
+
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); }
|
|
9706
9995
|
|
|
9707
9996
|
function SvgFacebookLogo(props) {
|
|
9708
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
9997
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
|
|
9709
9998
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9710
9999
|
viewBox: "88.428 12.828 107.543 207.085"
|
|
9711
|
-
}, props), _path$
|
|
10000
|
+
}, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
|
|
9712
10001
|
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",
|
|
9713
10002
|
fill: "#3c5a9a"
|
|
9714
10003
|
})));
|
|
@@ -9720,15 +10009,15 @@ const FacebookLoginButton = ({
|
|
|
9720
10009
|
labelClassName = "",
|
|
9721
10010
|
iconClassName = ""
|
|
9722
10011
|
}) => {
|
|
9723
|
-
var _window$Pelcro$site$r
|
|
10012
|
+
var _window$Pelcro$site$r;
|
|
9724
10013
|
|
|
9725
10014
|
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;
|
|
9726
10015
|
const {
|
|
9727
10016
|
dispatch: loginDispatch
|
|
9728
|
-
} = React.useContext(store$
|
|
10017
|
+
} = React.useContext(store$f);
|
|
9729
10018
|
const {
|
|
9730
10019
|
dispatch: registerDispatch
|
|
9731
|
-
} = React.useContext(store$
|
|
10020
|
+
} = React.useContext(store$e);
|
|
9732
10021
|
|
|
9733
10022
|
const onSuccess = facebookUser => {
|
|
9734
10023
|
loginDispatch === null || loginDispatch === void 0 ? void 0 : loginDispatch({
|
|
@@ -9759,7 +10048,7 @@ const FacebookLoginButton = ({
|
|
|
9759
10048
|
|
|
9760
10049
|
return facebookLoginEnabled ? /*#__PURE__*/React__default['default'].createElement(FacebookLogin, {
|
|
9761
10050
|
appId: window.Pelcro.site.read().facebook_app_id,
|
|
9762
|
-
language: (
|
|
10051
|
+
language: getPageOrDefaultLanguage(),
|
|
9763
10052
|
fields: "first_name,last_name,email,picture",
|
|
9764
10053
|
callback: onSuccess,
|
|
9765
10054
|
onFailure: onFailure,
|
|
@@ -9781,15 +10070,15 @@ var googleLogin = createCommonjsModule(function (module, exports) {
|
|
|
9781
10070
|
unwrapExports(googleLogin);
|
|
9782
10071
|
var googleLogin_1 = googleLogin.GoogleLogin;
|
|
9783
10072
|
|
|
9784
|
-
var _path$
|
|
10073
|
+
var _path$l, _path2$2, _path3$1, _path4;
|
|
9785
10074
|
|
|
9786
|
-
function _extends$
|
|
10075
|
+
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); }
|
|
9787
10076
|
|
|
9788
10077
|
function SvgGoogleLogo(props) {
|
|
9789
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
10078
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
|
|
9790
10079
|
viewBox: "0 0 24 24",
|
|
9791
10080
|
xmlns: "http://www.w3.org/2000/svg"
|
|
9792
|
-
}, props), _path$
|
|
10081
|
+
}, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
|
|
9793
10082
|
fill: "#4285F4",
|
|
9794
10083
|
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"
|
|
9795
10084
|
})), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
@@ -9815,10 +10104,10 @@ const GoogleLoginButton = ({
|
|
|
9815
10104
|
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;
|
|
9816
10105
|
const {
|
|
9817
10106
|
dispatch: loginDispatch
|
|
9818
|
-
} = React.useContext(store$
|
|
10107
|
+
} = React.useContext(store$f);
|
|
9819
10108
|
const {
|
|
9820
10109
|
dispatch: registerDispatch
|
|
9821
|
-
} = React.useContext(store$
|
|
10110
|
+
} = React.useContext(store$e);
|
|
9822
10111
|
|
|
9823
10112
|
const onSuccess = response => {
|
|
9824
10113
|
var _response$getAuthResp, _profile$getEmail, _profile$getGivenName, _profile$getFamilyNam, _profile$getEmail2, _profile$getGivenName2, _profile$getFamilyNam2;
|
|
@@ -9923,15 +10212,15 @@ function LoginView(props) {
|
|
|
9923
10212
|
}, /*#__PURE__*/React__default['default'].createElement(GoogleLoginButton, null), /*#__PURE__*/React__default['default'].createElement(FacebookLoginButton, null))))));
|
|
9924
10213
|
}
|
|
9925
10214
|
|
|
9926
|
-
var _path$
|
|
10215
|
+
var _path$k, _path2$1, _path3;
|
|
9927
10216
|
|
|
9928
|
-
function _extends$
|
|
10217
|
+
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); }
|
|
9929
10218
|
|
|
9930
10219
|
function SvgPelcroAuthorship(props) {
|
|
9931
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
10220
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
|
|
9932
10221
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9933
10222
|
viewBox: "0 -80.652 497.072 179.991"
|
|
9934
|
-
}, props), _path$
|
|
10223
|
+
}, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
|
|
9935
10224
|
fill: "none",
|
|
9936
10225
|
stroke: "#4a4a4a",
|
|
9937
10226
|
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"
|
|
@@ -10078,18 +10367,21 @@ function LoginModal({
|
|
|
10078
10367
|
LoginModal.viewId = "login";
|
|
10079
10368
|
|
|
10080
10369
|
const RegisterEmail = props => /*#__PURE__*/React__default['default'].createElement(Email, Object.assign({
|
|
10081
|
-
store: store$
|
|
10370
|
+
store: store$e
|
|
10082
10371
|
}, props));
|
|
10083
10372
|
|
|
10084
10373
|
const RegisterPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
|
|
10085
|
-
store: store$
|
|
10374
|
+
store: store$e
|
|
10086
10375
|
}, props));
|
|
10087
10376
|
|
|
10088
10377
|
const RegisterButton = ({
|
|
10089
10378
|
name,
|
|
10090
10379
|
onClick,
|
|
10380
|
+
className,
|
|
10091
10381
|
...otherProps
|
|
10092
10382
|
}) => {
|
|
10383
|
+
var _window$Pelcro$site$r;
|
|
10384
|
+
|
|
10093
10385
|
const {
|
|
10094
10386
|
state: {
|
|
10095
10387
|
emailError,
|
|
@@ -10099,7 +10391,7 @@ const RegisterButton = ({
|
|
|
10099
10391
|
buttonDisabled
|
|
10100
10392
|
},
|
|
10101
10393
|
dispatch
|
|
10102
|
-
} = React.useContext(store$
|
|
10394
|
+
} = React.useContext(store$e);
|
|
10103
10395
|
const {
|
|
10104
10396
|
t
|
|
10105
10397
|
} = useTranslation("register");
|
|
@@ -10115,7 +10407,10 @@ const RegisterButton = ({
|
|
|
10115
10407
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
10116
10408
|
},
|
|
10117
10409
|
disabled: isDisabled,
|
|
10118
|
-
isLoading: buttonDisabled
|
|
10410
|
+
isLoading: buttonDisabled,
|
|
10411
|
+
className: `${className} g-recaptcha`,
|
|
10412
|
+
"data-action": "register",
|
|
10413
|
+
"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
|
|
10119
10414
|
}, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
|
|
10120
10415
|
};
|
|
10121
10416
|
|
|
@@ -10234,7 +10529,7 @@ function FirstName({
|
|
|
10234
10529
|
}
|
|
10235
10530
|
|
|
10236
10531
|
const RegisterFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
|
|
10237
|
-
store: store$
|
|
10532
|
+
store: store$e
|
|
10238
10533
|
}, props));
|
|
10239
10534
|
|
|
10240
10535
|
function LastName({
|
|
@@ -10265,7 +10560,7 @@ function LastName({
|
|
|
10265
10560
|
}
|
|
10266
10561
|
|
|
10267
10562
|
const RegisterLastName = props => /*#__PURE__*/React__default['default'].createElement(LastName, Object.assign({
|
|
10268
|
-
store: store$
|
|
10563
|
+
store: store$e
|
|
10269
10564
|
}, props));
|
|
10270
10565
|
|
|
10271
10566
|
/**
|
|
@@ -10369,7 +10664,7 @@ function TextInput({
|
|
|
10369
10664
|
|
|
10370
10665
|
const RegisterTextInput = props => {
|
|
10371
10666
|
return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
|
|
10372
|
-
store: store$
|
|
10667
|
+
store: store$e
|
|
10373
10668
|
}));
|
|
10374
10669
|
};
|
|
10375
10670
|
|
|
@@ -12334,13 +12629,14 @@ class PaypalGateWay {
|
|
|
12334
12629
|
* @property {unknown} canMakePayment
|
|
12335
12630
|
* @property {unknown} paymentRequest
|
|
12336
12631
|
* @property {number} updatedPrice
|
|
12632
|
+
* @property {number} taxAmount
|
|
12337
12633
|
* @property {object} currentPlan
|
|
12338
12634
|
* @property {object} alert
|
|
12339
12635
|
*/
|
|
12340
12636
|
|
|
12341
12637
|
/** @type {PaymentStateType} */
|
|
12342
12638
|
|
|
12343
|
-
const initialState$
|
|
12639
|
+
const initialState$d = {
|
|
12344
12640
|
disableSubmit: false,
|
|
12345
12641
|
isLoading: false,
|
|
12346
12642
|
disableCouponButton: false,
|
|
@@ -12352,16 +12648,17 @@ const initialState$c = {
|
|
|
12352
12648
|
canMakePayment: false,
|
|
12353
12649
|
paymentRequest: null,
|
|
12354
12650
|
updatedPrice: null,
|
|
12651
|
+
taxAmount: null,
|
|
12355
12652
|
currentPlan: null,
|
|
12356
12653
|
alert: {
|
|
12357
12654
|
type: "error",
|
|
12358
12655
|
content: ""
|
|
12359
12656
|
}
|
|
12360
12657
|
};
|
|
12361
|
-
const store$
|
|
12658
|
+
const store$d = /*#__PURE__*/React.createContext(initialState$d);
|
|
12362
12659
|
const {
|
|
12363
|
-
Provider: Provider$
|
|
12364
|
-
} = store$
|
|
12660
|
+
Provider: Provider$d
|
|
12661
|
+
} = store$d;
|
|
12365
12662
|
|
|
12366
12663
|
const PaymentMethodContainerWithoutStripe = ({
|
|
12367
12664
|
style,
|
|
@@ -12402,6 +12699,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12402
12699
|
dispatch({
|
|
12403
12700
|
type: INIT_CONTAINER
|
|
12404
12701
|
});
|
|
12702
|
+
updateTotalAmountWithTax();
|
|
12405
12703
|
}, []);
|
|
12406
12704
|
|
|
12407
12705
|
const initPaymentRequest = (state, dispatch) => {
|
|
@@ -12468,6 +12766,45 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12468
12766
|
console.log("Google Pay/Apple pay isn't available in this country");
|
|
12469
12767
|
}
|
|
12470
12768
|
};
|
|
12769
|
+
/**
|
|
12770
|
+
* Updates the total amount after adding taxes only if site taxes are enabled
|
|
12771
|
+
*/
|
|
12772
|
+
|
|
12773
|
+
|
|
12774
|
+
const updateTotalAmountWithTax = () => {
|
|
12775
|
+
var _window$Pelcro$site$r;
|
|
12776
|
+
|
|
12777
|
+
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;
|
|
12778
|
+
|
|
12779
|
+
if (taxesEnabled && type === "createPayment") {
|
|
12780
|
+
dispatch({
|
|
12781
|
+
type: DISABLE_SUBMIT,
|
|
12782
|
+
payload: true
|
|
12783
|
+
});
|
|
12784
|
+
resolveTaxCalculation().then(res => {
|
|
12785
|
+
if (res) {
|
|
12786
|
+
dispatch({
|
|
12787
|
+
type: SET_TAX_AMOUNT,
|
|
12788
|
+
payload: res.taxAmount
|
|
12789
|
+
});
|
|
12790
|
+
dispatch({
|
|
12791
|
+
type: SET_UPDATED_PRICE,
|
|
12792
|
+
payload: res.totalAmountWithTax
|
|
12793
|
+
});
|
|
12794
|
+
dispatch({
|
|
12795
|
+
type: UPDATE_PAYMENT_REQUEST
|
|
12796
|
+
});
|
|
12797
|
+
}
|
|
12798
|
+
}).catch(error => {
|
|
12799
|
+
handlePaymentError(error);
|
|
12800
|
+
}).finally(() => {
|
|
12801
|
+
dispatch({
|
|
12802
|
+
type: DISABLE_SUBMIT,
|
|
12803
|
+
payload: false
|
|
12804
|
+
});
|
|
12805
|
+
});
|
|
12806
|
+
}
|
|
12807
|
+
};
|
|
12471
12808
|
|
|
12472
12809
|
const onApplyCouponCode = (state, dispatch) => {
|
|
12473
12810
|
const {
|
|
@@ -12494,6 +12831,10 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12494
12831
|
});
|
|
12495
12832
|
}
|
|
12496
12833
|
|
|
12834
|
+
dispatch({
|
|
12835
|
+
type: SET_COUPON_ERROR,
|
|
12836
|
+
payload: ""
|
|
12837
|
+
});
|
|
12497
12838
|
dispatch({
|
|
12498
12839
|
type: SHOW_ALERT,
|
|
12499
12840
|
payload: {
|
|
@@ -12509,6 +12850,10 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12509
12850
|
type: SET_PERCENT_OFF,
|
|
12510
12851
|
payload: `${(_res$data$coupon = res.data.coupon) === null || _res$data$coupon === void 0 ? void 0 : _res$data$coupon.percent_off}%`
|
|
12511
12852
|
});
|
|
12853
|
+
dispatch({
|
|
12854
|
+
type: SET_TAX_AMOUNT,
|
|
12855
|
+
payload: res.data.taxes
|
|
12856
|
+
});
|
|
12512
12857
|
dispatch({
|
|
12513
12858
|
type: SET_UPDATED_PRICE,
|
|
12514
12859
|
payload: res.data.total
|
|
@@ -12518,6 +12863,29 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12518
12863
|
});
|
|
12519
12864
|
};
|
|
12520
12865
|
|
|
12866
|
+
if ((couponCode === null || couponCode === void 0 ? void 0 : couponCode.trim()) === "") {
|
|
12867
|
+
dispatch({
|
|
12868
|
+
type: SET_COUPON,
|
|
12869
|
+
payload: null
|
|
12870
|
+
});
|
|
12871
|
+
dispatch({
|
|
12872
|
+
type: SET_PERCENT_OFF,
|
|
12873
|
+
payload: ""
|
|
12874
|
+
});
|
|
12875
|
+
dispatch({
|
|
12876
|
+
type: SET_UPDATED_PRICE,
|
|
12877
|
+
payload: null
|
|
12878
|
+
});
|
|
12879
|
+
dispatch({
|
|
12880
|
+
type: SET_TAX_AMOUNT,
|
|
12881
|
+
payload: null
|
|
12882
|
+
});
|
|
12883
|
+
dispatch({
|
|
12884
|
+
type: UPDATE_PAYMENT_REQUEST
|
|
12885
|
+
});
|
|
12886
|
+
updateTotalAmountWithTax();
|
|
12887
|
+
}
|
|
12888
|
+
|
|
12521
12889
|
if (couponCode !== null && couponCode !== void 0 && couponCode.trim()) {
|
|
12522
12890
|
dispatch({
|
|
12523
12891
|
type: DISABLE_COUPON_BUTTON,
|
|
@@ -12904,16 +13272,20 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12904
13272
|
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();
|
|
12905
13273
|
|
|
12906
13274
|
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) {
|
|
12907
|
-
return resolveTaxCalculation().then(
|
|
12908
|
-
|
|
12909
|
-
error
|
|
12910
|
-
}) => {
|
|
12911
|
-
if (error) {
|
|
12912
|
-
return handlePaymentError(error);
|
|
12913
|
-
}
|
|
13275
|
+
return resolveTaxCalculation().then(res => {
|
|
13276
|
+
var _res$totalAmountWithT;
|
|
12914
13277
|
|
|
12915
|
-
|
|
12916
|
-
|
|
13278
|
+
return generate3DSecureSource(source, (_res$totalAmountWithT = res === null || res === void 0 ? void 0 : res.totalAmountWithTax) !== null && _res$totalAmountWithT !== void 0 ? _res$totalAmountWithT : totalAmount).then(({
|
|
13279
|
+
source,
|
|
13280
|
+
error
|
|
13281
|
+
}) => {
|
|
13282
|
+
if (error) {
|
|
13283
|
+
return handlePaymentError(error);
|
|
13284
|
+
}
|
|
13285
|
+
|
|
13286
|
+
toggleAuthenticationPendingView(true, source);
|
|
13287
|
+
});
|
|
13288
|
+
});
|
|
12917
13289
|
}
|
|
12918
13290
|
|
|
12919
13291
|
return handlePayment(source);
|
|
@@ -12922,15 +13294,15 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12922
13294
|
});
|
|
12923
13295
|
};
|
|
12924
13296
|
/**
|
|
12925
|
-
* Resolves with the total
|
|
13297
|
+
* Resolves with the total & tax amount incase taxes enabled by site
|
|
12926
13298
|
* @return {Promise}
|
|
12927
13299
|
*/
|
|
12928
13300
|
|
|
12929
13301
|
|
|
12930
13302
|
const resolveTaxCalculation = () => {
|
|
12931
|
-
var _window$Pelcro$site$
|
|
13303
|
+
var _window$Pelcro$site$r2;
|
|
12932
13304
|
|
|
12933
|
-
const taxesEnabled = (_window$Pelcro$site$
|
|
13305
|
+
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;
|
|
12934
13306
|
return new Promise((resolve, reject) => {
|
|
12935
13307
|
// resolve early if taxes isn't enabled
|
|
12936
13308
|
if (!taxesEnabled) {
|
|
@@ -12943,14 +13315,18 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
12943
13315
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
12944
13316
|
address_id: selectedAddressId
|
|
12945
13317
|
}, (error, res) => {
|
|
12946
|
-
var _res$data;
|
|
13318
|
+
var _res$data, _res$data2;
|
|
12947
13319
|
|
|
12948
13320
|
if (error) {
|
|
12949
13321
|
return reject(error);
|
|
12950
13322
|
}
|
|
12951
13323
|
|
|
12952
|
-
const
|
|
12953
|
-
|
|
13324
|
+
const taxAmount = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.taxes;
|
|
13325
|
+
const totalAmountWithTax = (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.total;
|
|
13326
|
+
resolve({
|
|
13327
|
+
totalAmountWithTax,
|
|
13328
|
+
taxAmount
|
|
13329
|
+
});
|
|
12954
13330
|
});
|
|
12955
13331
|
});
|
|
12956
13332
|
};
|
|
@@ -13005,13 +13381,13 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13005
13381
|
const handlePaymentError = error => {
|
|
13006
13382
|
if (error.type === "validation_error" && // Subscription creation & renewal
|
|
13007
13383
|
type === "createPayment") {
|
|
13008
|
-
var _state$
|
|
13384
|
+
var _state$couponObject;
|
|
13009
13385
|
|
|
13010
13386
|
const {
|
|
13011
13387
|
updatedPrice
|
|
13012
13388
|
} = state; // When price is 0, we allow submitting without card info
|
|
13013
13389
|
|
|
13014
|
-
if (updatedPrice === 0 && ((_state$
|
|
13390
|
+
if (updatedPrice === 0 && ((_state$couponObject = state.couponObject) === null || _state$couponObject === void 0 ? void 0 : _state$couponObject.duration) === "forever") {
|
|
13015
13391
|
return subscribe({}, state, dispatch);
|
|
13016
13392
|
}
|
|
13017
13393
|
}
|
|
@@ -13139,6 +13515,11 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13139
13515
|
updatedPrice: action.payload
|
|
13140
13516
|
});
|
|
13141
13517
|
|
|
13518
|
+
case SET_TAX_AMOUNT:
|
|
13519
|
+
return lib_7({ ...state,
|
|
13520
|
+
taxAmount: action.payload
|
|
13521
|
+
});
|
|
13522
|
+
|
|
13142
13523
|
case SET_CAN_MAKE_PAYMENT:
|
|
13143
13524
|
return lib_7({ ...state,
|
|
13144
13525
|
canMakePayment: action.payload
|
|
@@ -13156,7 +13537,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13156
13537
|
|
|
13157
13538
|
case SET_COUPON:
|
|
13158
13539
|
return lib_7({ ...state,
|
|
13159
|
-
|
|
13540
|
+
couponObject: action.payload
|
|
13160
13541
|
});
|
|
13161
13542
|
|
|
13162
13543
|
case SET_COUPON_ERROR:
|
|
@@ -13182,34 +13563,43 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13182
13563
|
default:
|
|
13183
13564
|
return state;
|
|
13184
13565
|
}
|
|
13185
|
-
}, initialState$
|
|
13566
|
+
}, initialState$d);
|
|
13186
13567
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
13187
13568
|
style: { ...style
|
|
13188
13569
|
},
|
|
13189
13570
|
className: `pelcro-container pelcro-payment-container ${className}`
|
|
13190
|
-
}, /*#__PURE__*/React__default['default'].createElement(Provider$
|
|
13571
|
+
}, /*#__PURE__*/React__default['default'].createElement(Provider$d, {
|
|
13191
13572
|
value: {
|
|
13192
13573
|
state,
|
|
13193
13574
|
dispatch
|
|
13194
13575
|
}
|
|
13195
13576
|
}, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
13196
|
-
store: store$
|
|
13577
|
+
store: store$d,
|
|
13197
13578
|
key: i
|
|
13198
13579
|
})) : /*#__PURE__*/React__default['default'].cloneElement(children, {
|
|
13199
|
-
store: store$
|
|
13580
|
+
store: store$d
|
|
13200
13581
|
})));
|
|
13201
13582
|
};
|
|
13202
13583
|
|
|
13203
13584
|
const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
|
|
13204
13585
|
|
|
13205
13586
|
const PaymentMethodContainer = props => {
|
|
13206
|
-
|
|
13587
|
+
const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
|
|
13588
|
+
React.useEffect(() => {
|
|
13589
|
+
if (!window.Stripe) {
|
|
13590
|
+
document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
|
|
13591
|
+
setIsStripeLoaded(true);
|
|
13592
|
+
});
|
|
13593
|
+
}
|
|
13594
|
+
}, []);
|
|
13595
|
+
|
|
13596
|
+
if (isStripeLoaded) {
|
|
13207
13597
|
return /*#__PURE__*/React__default['default'].createElement(es_13, {
|
|
13208
13598
|
apiKey: window.Pelcro.environment.stripe,
|
|
13209
13599
|
stripeAccount: window.Pelcro.site.read().account_id,
|
|
13210
|
-
locale:
|
|
13600
|
+
locale: getPageOrDefaultLanguage()
|
|
13211
13601
|
}, /*#__PURE__*/React__default['default'].createElement(es_11, null, /*#__PURE__*/React__default['default'].createElement(UnwrappedForm, Object.assign({
|
|
13212
|
-
store: store$
|
|
13602
|
+
store: store$d
|
|
13213
13603
|
}, props))));
|
|
13214
13604
|
}
|
|
13215
13605
|
|
|
@@ -13262,7 +13652,7 @@ const PelcroPaymentRequestButton = props => {
|
|
|
13262
13652
|
currentPlan,
|
|
13263
13653
|
updatedPrice
|
|
13264
13654
|
}
|
|
13265
|
-
} = React.useContext(store$
|
|
13655
|
+
} = React.useContext(store$d);
|
|
13266
13656
|
|
|
13267
13657
|
const updatePaymentRequest = () => {
|
|
13268
13658
|
// Make sure payment request is up to date, eg. user added a coupon code.
|
|
@@ -13315,24 +13705,25 @@ const DiscountedPrice = props => {
|
|
|
13315
13705
|
const {
|
|
13316
13706
|
state: {
|
|
13317
13707
|
updatedPrice,
|
|
13708
|
+
taxAmount,
|
|
13318
13709
|
percentOff
|
|
13319
13710
|
}
|
|
13320
|
-
} = React.useContext(store$
|
|
13321
|
-
const {
|
|
13322
|
-
default_locale
|
|
13323
|
-
} = Pelcro.site.read();
|
|
13711
|
+
} = React.useContext(store$d);
|
|
13324
13712
|
const {
|
|
13325
13713
|
order,
|
|
13326
13714
|
plan
|
|
13327
13715
|
} = usePelcro();
|
|
13328
13716
|
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;
|
|
13329
13717
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
13330
|
-
const
|
|
13718
|
+
const discountedPriceWithoutTax = updatedPrice - taxAmount;
|
|
13719
|
+
const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
13331
13720
|
|
|
13332
13721
|
if (percentOff) {
|
|
13333
13722
|
return /*#__PURE__*/React__default['default'].createElement("div", Object.assign({
|
|
13334
|
-
className: "plc-
|
|
13335
|
-
}, props), "(-", percentOff, ") ",
|
|
13723
|
+
className: "plc-flex plc-justify-center plc-mt-2 pelcro-discount"
|
|
13724
|
+
}, props), "(-", percentOff, ")", " ", /*#__PURE__*/React__default['default'].createElement("span", {
|
|
13725
|
+
className: "plc-font-bold pelcro-discounted-price"
|
|
13726
|
+
}, priceFormatted));
|
|
13336
13727
|
}
|
|
13337
13728
|
|
|
13338
13729
|
return "";
|
|
@@ -13357,13 +13748,10 @@ const SubmitPaymentMethod = ({
|
|
|
13357
13748
|
isLoading,
|
|
13358
13749
|
updatedPrice
|
|
13359
13750
|
}
|
|
13360
|
-
} = React.useContext(store$
|
|
13361
|
-
const {
|
|
13362
|
-
default_locale
|
|
13363
|
-
} = Pelcro.site.read();
|
|
13751
|
+
} = React.useContext(store$d);
|
|
13364
13752
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
13365
13753
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
13366
|
-
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency,
|
|
13754
|
+
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
13367
13755
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
13368
13756
|
role: "submit",
|
|
13369
13757
|
className: "plc-w-full plc-py-3",
|
|
@@ -13381,17 +13769,17 @@ const SubmitPaymentMethod = ({
|
|
|
13381
13769
|
}, t("labels.pay"), " ", priceFormatted && priceFormatted) : t("labels.submit"));
|
|
13382
13770
|
};
|
|
13383
13771
|
|
|
13384
|
-
var _path$
|
|
13772
|
+
var _path$j;
|
|
13385
13773
|
|
|
13386
|
-
function _extends$
|
|
13774
|
+
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); }
|
|
13387
13775
|
|
|
13388
13776
|
function SvgArrowLeft(props) {
|
|
13389
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
13777
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
|
|
13390
13778
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13391
13779
|
fill: "none",
|
|
13392
13780
|
viewBox: "0 0 24 24",
|
|
13393
13781
|
stroke: "currentColor"
|
|
13394
|
-
}, props), _path$
|
|
13782
|
+
}, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
|
|
13395
13783
|
strokeLinecap: "round",
|
|
13396
13784
|
strokeLinejoin: "round",
|
|
13397
13785
|
strokeWidth: 2,
|
|
@@ -13410,7 +13798,7 @@ const ApplyCouponButton = ({
|
|
|
13410
13798
|
disableCouponButton
|
|
13411
13799
|
},
|
|
13412
13800
|
dispatch
|
|
13413
|
-
} = React.useContext(store$
|
|
13801
|
+
} = React.useContext(store$d);
|
|
13414
13802
|
const {
|
|
13415
13803
|
t
|
|
13416
13804
|
} = useTranslation("checkoutForm");
|
|
@@ -13444,7 +13832,7 @@ const CouponCodeField = props => {
|
|
|
13444
13832
|
couponCode,
|
|
13445
13833
|
couponError
|
|
13446
13834
|
}
|
|
13447
|
-
} = React.useContext(store$
|
|
13835
|
+
} = React.useContext(store$d);
|
|
13448
13836
|
|
|
13449
13837
|
const onCouponCodeChange = e => {
|
|
13450
13838
|
dispatch({
|
|
@@ -13462,6 +13850,7 @@ const CouponCodeField = props => {
|
|
|
13462
13850
|
|
|
13463
13851
|
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
13464
13852
|
className: "plc-h-12",
|
|
13853
|
+
wrapperClassName: "plc-mb-1",
|
|
13465
13854
|
errorClassName: "plc-h-12 sm:plc-h-8",
|
|
13466
13855
|
error: couponError,
|
|
13467
13856
|
"aria-label": t("labels.code"),
|
|
@@ -13472,17 +13861,17 @@ const CouponCodeField = props => {
|
|
|
13472
13861
|
}, props));
|
|
13473
13862
|
};
|
|
13474
13863
|
|
|
13475
|
-
var _path$
|
|
13864
|
+
var _path$i;
|
|
13476
13865
|
|
|
13477
|
-
function _extends$
|
|
13866
|
+
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); }
|
|
13478
13867
|
|
|
13479
13868
|
function SvgTicket(props) {
|
|
13480
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
13869
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
|
|
13481
13870
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13482
13871
|
fill: "none",
|
|
13483
13872
|
viewBox: "0 0 24 24",
|
|
13484
13873
|
stroke: "currentColor"
|
|
13485
|
-
}, props), _path$
|
|
13874
|
+
}, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
|
|
13486
13875
|
strokeLinecap: "round",
|
|
13487
13876
|
strokeLinejoin: "round",
|
|
13488
13877
|
strokeWidth: 2,
|
|
@@ -13499,7 +13888,7 @@ const CouponCode = ({
|
|
|
13499
13888
|
state: {
|
|
13500
13889
|
enableCouponField
|
|
13501
13890
|
}
|
|
13502
|
-
} = React.useContext(store$
|
|
13891
|
+
} = React.useContext(store$d);
|
|
13503
13892
|
const {
|
|
13504
13893
|
t
|
|
13505
13894
|
} = useTranslation("checkoutForm");
|
|
@@ -13513,16 +13902,16 @@ const CouponCode = ({
|
|
|
13513
13902
|
};
|
|
13514
13903
|
|
|
13515
13904
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
13516
|
-
className: "plc-
|
|
13905
|
+
className: "plc-mt-4"
|
|
13517
13906
|
}, /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
13518
|
-
className: "plc-text-base plc-text-gray-500",
|
|
13907
|
+
className: "plc-mb-2 plc-text-base plc-text-gray-500",
|
|
13519
13908
|
variant: "ghost",
|
|
13520
13909
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgTicket, {
|
|
13521
13910
|
className: "plc-w-5 plc-h-5 plc-mr-2"
|
|
13522
13911
|
}),
|
|
13523
13912
|
onClick: showCouponField
|
|
13524
13913
|
}, otherProps), !enableCouponField ? t("labels.addCode") : t("labels.hideCode")), enableCouponField && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
13525
|
-
className: "plc-flex plc-w-full plc-
|
|
13914
|
+
className: "plc-flex plc-w-full plc-mt-2 pelcro-apply-coupon-wrapper"
|
|
13526
13915
|
}, /*#__PURE__*/React__default['default'].createElement(CouponCodeField, null), /*#__PURE__*/React__default['default'].createElement(ApplyCouponButton, null)));
|
|
13527
13916
|
};
|
|
13528
13917
|
|
|
@@ -13607,7 +13996,7 @@ class PaypalClient {
|
|
|
13607
13996
|
this.paypalButton = window.paypal.Buttons({
|
|
13608
13997
|
fundingSource: window.paypal.FUNDING.PAYPAL,
|
|
13609
13998
|
// button locale
|
|
13610
|
-
locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale :
|
|
13999
|
+
locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale : getPageOrDefaultLanguage(),
|
|
13611
14000
|
// button style
|
|
13612
14001
|
style: (_this$config$style = this.config.style) !== null && _this$config$style !== void 0 ? _this$config$style : defaultButtonStyle,
|
|
13613
14002
|
// create payment handler
|
|
@@ -13704,7 +14093,7 @@ class PaypalClient {
|
|
|
13704
14093
|
} : undefined,
|
|
13705
14094
|
shippingAddressEditable: this.config.shippingAddressEditable,
|
|
13706
14095
|
displayName: (_this$config$displayN = this.config.displayName) !== null && _this$config$displayN !== void 0 ? _this$config$displayN : this.siteInfo.name,
|
|
13707
|
-
locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 :
|
|
14096
|
+
locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 : getPageOrDefaultLanguage()
|
|
13708
14097
|
};
|
|
13709
14098
|
}
|
|
13710
14099
|
});
|
|
@@ -13713,7 +14102,7 @@ class PaypalClient {
|
|
|
13713
14102
|
writable: true,
|
|
13714
14103
|
value: () => {
|
|
13715
14104
|
const totalAmount = (this.product.quantity || 1) * this.amount;
|
|
13716
|
-
const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency,
|
|
14105
|
+
const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency, getPageOrDefaultLanguage());
|
|
13717
14106
|
const autoRenewed = this.product.auto_renew;
|
|
13718
14107
|
const {
|
|
13719
14108
|
interval,
|
|
@@ -13756,7 +14145,7 @@ const PaypalSubscribeButton = props => {
|
|
|
13756
14145
|
const {
|
|
13757
14146
|
dispatch,
|
|
13758
14147
|
state
|
|
13759
|
-
} = React.useContext(store$
|
|
14148
|
+
} = React.useContext(store$d);
|
|
13760
14149
|
const {
|
|
13761
14150
|
product,
|
|
13762
14151
|
plan,
|
|
@@ -13841,16 +14230,16 @@ const BankRedirection = () => {
|
|
|
13841
14230
|
}));
|
|
13842
14231
|
};
|
|
13843
14232
|
|
|
13844
|
-
var _path$
|
|
14233
|
+
var _path$h;
|
|
13845
14234
|
|
|
13846
|
-
function _extends$
|
|
14235
|
+
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); }
|
|
13847
14236
|
|
|
13848
14237
|
function SvgLock(props) {
|
|
13849
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
14238
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
|
|
13850
14239
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13851
14240
|
viewBox: "0 0 20 20",
|
|
13852
14241
|
fill: "currentColor"
|
|
13853
|
-
}, props), _path$
|
|
14242
|
+
}, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
|
|
13854
14243
|
fillRule: "evenodd",
|
|
13855
14244
|
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",
|
|
13856
14245
|
clipRule: "evenodd"
|
|
@@ -13867,7 +14256,7 @@ const SelectedPaymentMethod = () => {
|
|
|
13867
14256
|
state: {
|
|
13868
14257
|
isLoading
|
|
13869
14258
|
}
|
|
13870
|
-
} = React.useContext(store$
|
|
14259
|
+
} = React.useContext(store$d);
|
|
13871
14260
|
const {
|
|
13872
14261
|
switchView,
|
|
13873
14262
|
selectedPaymentMethodId
|
|
@@ -13899,6 +14288,34 @@ const SelectedPaymentMethod = () => {
|
|
|
13899
14288
|
}, t("select.buttons.changePaymentMethod")))));
|
|
13900
14289
|
};
|
|
13901
14290
|
|
|
14291
|
+
const TaxAmount = () => {
|
|
14292
|
+
var _plan$quantity;
|
|
14293
|
+
|
|
14294
|
+
const {
|
|
14295
|
+
t
|
|
14296
|
+
} = useTranslation("checkoutForm");
|
|
14297
|
+
const {
|
|
14298
|
+
state: {
|
|
14299
|
+
taxAmount
|
|
14300
|
+
}
|
|
14301
|
+
} = React.useContext(store$d);
|
|
14302
|
+
const {
|
|
14303
|
+
plan
|
|
14304
|
+
} = usePelcro();
|
|
14305
|
+
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
14306
|
+
const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
14307
|
+
|
|
14308
|
+
if (taxAmount) {
|
|
14309
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
14310
|
+
className: "plc-text-center pelcro-tax-amount"
|
|
14311
|
+
}, t("labels.tax"), " ", /*#__PURE__*/React__default['default'].createElement("span", {
|
|
14312
|
+
className: "plc-font-bold"
|
|
14313
|
+
}, priceFormatted));
|
|
14314
|
+
}
|
|
14315
|
+
|
|
14316
|
+
return null;
|
|
14317
|
+
};
|
|
14318
|
+
|
|
13902
14319
|
/**
|
|
13903
14320
|
*
|
|
13904
14321
|
*/
|
|
@@ -13935,7 +14352,9 @@ function PaymentMethodView({
|
|
|
13935
14352
|
onFailure: onFailure
|
|
13936
14353
|
}, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
|
|
13937
14354
|
className: "plc-mb-2"
|
|
13938
|
-
}), /*#__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(
|
|
14355
|
+
}), /*#__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", {
|
|
14356
|
+
className: "plc-mb-2"
|
|
14357
|
+
}, /*#__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", {
|
|
13939
14358
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
13940
14359
|
}, /*#__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)))))));
|
|
13941
14360
|
}
|
|
@@ -14042,12 +14461,12 @@ function SubscriptionRenewModal({
|
|
|
14042
14461
|
}
|
|
14043
14462
|
SubscriptionRenewModal.viewId = "subscription-renew";
|
|
14044
14463
|
|
|
14045
|
-
var _path$
|
|
14464
|
+
var _path$g;
|
|
14046
14465
|
|
|
14047
|
-
function _extends$
|
|
14466
|
+
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); }
|
|
14048
14467
|
|
|
14049
14468
|
function SvgGift(props) {
|
|
14050
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
14469
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
|
|
14051
14470
|
className: "plc-w-6 plc-h-6 plc-mr-2",
|
|
14052
14471
|
fill: "none",
|
|
14053
14472
|
stroke: "currentColor",
|
|
@@ -14056,7 +14475,7 @@ function SvgGift(props) {
|
|
|
14056
14475
|
strokeWidth: 2,
|
|
14057
14476
|
viewBox: "0 0 24 24",
|
|
14058
14477
|
xmlns: "http://www.w3.org/2000/svg"
|
|
14059
|
-
}, props), _path$
|
|
14478
|
+
}, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
|
|
14060
14479
|
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"
|
|
14061
14480
|
})));
|
|
14062
14481
|
}
|
|
@@ -14387,6 +14806,292 @@ class DefaultNewsLetter extends React.Component {
|
|
|
14387
14806
|
|
|
14388
14807
|
const NewsLetter = withTranslation("newsletter")(DefaultNewsLetter);
|
|
14389
14808
|
|
|
14809
|
+
const initialState$c = {
|
|
14810
|
+
didSubToNewslettersBefore: false,
|
|
14811
|
+
newsletters: [],
|
|
14812
|
+
isListLoading: true,
|
|
14813
|
+
isSubmitting: false,
|
|
14814
|
+
alert: {
|
|
14815
|
+
type: "error",
|
|
14816
|
+
content: ""
|
|
14817
|
+
}
|
|
14818
|
+
};
|
|
14819
|
+
const store$c = /*#__PURE__*/React.createContext(initialState$c);
|
|
14820
|
+
const {
|
|
14821
|
+
Provider: Provider$c
|
|
14822
|
+
} = store$c;
|
|
14823
|
+
|
|
14824
|
+
const NewsletterUpdateContainer = ({
|
|
14825
|
+
style,
|
|
14826
|
+
className = "",
|
|
14827
|
+
onSuccess = () => {},
|
|
14828
|
+
onFailure = () => {},
|
|
14829
|
+
children
|
|
14830
|
+
}) => {
|
|
14831
|
+
const [t] = useTranslation("newsletter");
|
|
14832
|
+
|
|
14833
|
+
const handleSubmit = ({
|
|
14834
|
+
newsletters,
|
|
14835
|
+
didSubToNewslettersBefore
|
|
14836
|
+
}, dispatch) => {
|
|
14837
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
14838
|
+
|
|
14839
|
+
const callback = (err, res) => {
|
|
14840
|
+
dispatch({
|
|
14841
|
+
type: LOADING,
|
|
14842
|
+
payload: false
|
|
14843
|
+
});
|
|
14844
|
+
|
|
14845
|
+
if (err) {
|
|
14846
|
+
dispatch({
|
|
14847
|
+
type: SHOW_ALERT,
|
|
14848
|
+
payload: {
|
|
14849
|
+
type: "error",
|
|
14850
|
+
content: getErrorMessages(err)
|
|
14851
|
+
}
|
|
14852
|
+
});
|
|
14853
|
+
onFailure(err);
|
|
14854
|
+
} else {
|
|
14855
|
+
if (!didSubToNewslettersBefore) {
|
|
14856
|
+
dispatch({
|
|
14857
|
+
type: SWITCH_TO_UPDATE
|
|
14858
|
+
});
|
|
14859
|
+
}
|
|
14860
|
+
|
|
14861
|
+
dispatch({
|
|
14862
|
+
type: SHOW_ALERT,
|
|
14863
|
+
payload: {
|
|
14864
|
+
type: "success",
|
|
14865
|
+
content: t("messages.success")
|
|
14866
|
+
}
|
|
14867
|
+
});
|
|
14868
|
+
onSuccess(res);
|
|
14869
|
+
}
|
|
14870
|
+
};
|
|
14871
|
+
|
|
14872
|
+
const requestData = {
|
|
14873
|
+
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"),
|
|
14874
|
+
source: "web",
|
|
14875
|
+
lists: newsletters.filter(newsletter => newsletter.selected).map(newsletter => newsletter.id).join(",")
|
|
14876
|
+
};
|
|
14877
|
+
|
|
14878
|
+
if (didSubToNewslettersBefore) {
|
|
14879
|
+
window.Pelcro.newsletter.update(requestData, callback);
|
|
14880
|
+
} else {
|
|
14881
|
+
window.Pelcro.newsletter.create(requestData, callback);
|
|
14882
|
+
}
|
|
14883
|
+
};
|
|
14884
|
+
|
|
14885
|
+
const [state, dispatch] = useReducerWithSideEffects((state, action) => {
|
|
14886
|
+
switch (action.type) {
|
|
14887
|
+
case GET_NEWSLETTERS_FETCH:
|
|
14888
|
+
return lib_7({ ...state,
|
|
14889
|
+
isListLoading: true
|
|
14890
|
+
});
|
|
14891
|
+
|
|
14892
|
+
case GET_NEWSLETTERS_SUCCESS:
|
|
14893
|
+
return lib_7({ ...state,
|
|
14894
|
+
newsletters: action.payload.newsletters,
|
|
14895
|
+
didSubToNewslettersBefore: action.payload.didSubToNewslettersBefore,
|
|
14896
|
+
isListLoading: false
|
|
14897
|
+
});
|
|
14898
|
+
|
|
14899
|
+
case SET_SELECT:
|
|
14900
|
+
return lib_7({ ...state,
|
|
14901
|
+
newsletters: state.newsletters.map(newsletter => {
|
|
14902
|
+
if (newsletter.id === action.payload) {
|
|
14903
|
+
return { ...newsletter,
|
|
14904
|
+
selected: !newsletter.selected
|
|
14905
|
+
};
|
|
14906
|
+
}
|
|
14907
|
+
|
|
14908
|
+
return newsletter;
|
|
14909
|
+
})
|
|
14910
|
+
});
|
|
14911
|
+
|
|
14912
|
+
case SWITCH_TO_UPDATE:
|
|
14913
|
+
return lib_7({ ...state,
|
|
14914
|
+
didSubToNewslettersBefore: true
|
|
14915
|
+
});
|
|
14916
|
+
|
|
14917
|
+
case SHOW_ALERT:
|
|
14918
|
+
return lib_7({ ...state,
|
|
14919
|
+
alert: action.payload
|
|
14920
|
+
});
|
|
14921
|
+
|
|
14922
|
+
case LOADING:
|
|
14923
|
+
return lib_7({ ...state,
|
|
14924
|
+
isSubmitting: action.payload
|
|
14925
|
+
});
|
|
14926
|
+
|
|
14927
|
+
case HANDLE_SUBMIT:
|
|
14928
|
+
return lib_5({ ...state,
|
|
14929
|
+
isSubmitting: true
|
|
14930
|
+
}, (state, dispatch) => handleSubmit(state, dispatch));
|
|
14931
|
+
|
|
14932
|
+
default:
|
|
14933
|
+
return state;
|
|
14934
|
+
}
|
|
14935
|
+
}, initialState$c);
|
|
14936
|
+
React.useEffect(() => {
|
|
14937
|
+
const getUserNewsletters = () => {
|
|
14938
|
+
var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
|
|
14939
|
+
|
|
14940
|
+
dispatch({
|
|
14941
|
+
type: GET_NEWSLETTERS_FETCH
|
|
14942
|
+
});
|
|
14943
|
+
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");
|
|
14944
|
+
window.Pelcro.newsletter.getByEmail(email, (err, res) => {
|
|
14945
|
+
var _window$Pelcro$uiSett, _window$Pelcro, _window$Pelcro$uiSett2, _res$data$lists$split, _res$data$lists;
|
|
14946
|
+
|
|
14947
|
+
if (err) {
|
|
14948
|
+
return dispatch({
|
|
14949
|
+
type: SHOW_ALERT,
|
|
14950
|
+
payload: {
|
|
14951
|
+
type: "error",
|
|
14952
|
+
content: getErrorMessages(err)
|
|
14953
|
+
}
|
|
14954
|
+
});
|
|
14955
|
+
}
|
|
14956
|
+
|
|
14957
|
+
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 : [];
|
|
14958
|
+
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 : [];
|
|
14959
|
+
const allNewslettersWithSelectedField = newsletters.map(newsletter => ({ ...newsletter,
|
|
14960
|
+
id: String(newsletter.id),
|
|
14961
|
+
selected: selectedNewsletters.includes(String(newsletter.id))
|
|
14962
|
+
}));
|
|
14963
|
+
dispatch({
|
|
14964
|
+
type: GET_NEWSLETTERS_SUCCESS,
|
|
14965
|
+
payload: {
|
|
14966
|
+
newsletters: allNewslettersWithSelectedField,
|
|
14967
|
+
didSubToNewslettersBefore: Boolean(res.data.email)
|
|
14968
|
+
}
|
|
14969
|
+
});
|
|
14970
|
+
});
|
|
14971
|
+
};
|
|
14972
|
+
|
|
14973
|
+
getUserNewsletters();
|
|
14974
|
+
}, []);
|
|
14975
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
14976
|
+
style: { ...style
|
|
14977
|
+
},
|
|
14978
|
+
className: `pelcro-container pelcro-newsletter-update-container ${className}`
|
|
14979
|
+
}, /*#__PURE__*/React__default['default'].createElement(Provider$c, {
|
|
14980
|
+
value: {
|
|
14981
|
+
state,
|
|
14982
|
+
dispatch
|
|
14983
|
+
}
|
|
14984
|
+
}, children.length ? children.map((child, i) => {
|
|
14985
|
+
if (child) {
|
|
14986
|
+
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
14987
|
+
store: store$c,
|
|
14988
|
+
key: i
|
|
14989
|
+
});
|
|
14990
|
+
}
|
|
14991
|
+
}) : /*#__PURE__*/React__default['default'].cloneElement(children, {
|
|
14992
|
+
store: store$c
|
|
14993
|
+
})));
|
|
14994
|
+
};
|
|
14995
|
+
|
|
14996
|
+
const NewsletterUpdateButton = ({
|
|
14997
|
+
name,
|
|
14998
|
+
onClick,
|
|
14999
|
+
...otherProps
|
|
15000
|
+
}) => {
|
|
15001
|
+
const {
|
|
15002
|
+
dispatch,
|
|
15003
|
+
state: {
|
|
15004
|
+
isSubmitting,
|
|
15005
|
+
isListLoading
|
|
15006
|
+
}
|
|
15007
|
+
} = React.useContext(store$c);
|
|
15008
|
+
const {
|
|
15009
|
+
t
|
|
15010
|
+
} = useTranslation("newsletter");
|
|
15011
|
+
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
15012
|
+
onClick: () => {
|
|
15013
|
+
dispatch({
|
|
15014
|
+
type: HANDLE_SUBMIT
|
|
15015
|
+
});
|
|
15016
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
15017
|
+
},
|
|
15018
|
+
disabled: isListLoading,
|
|
15019
|
+
isLoading: isSubmitting
|
|
15020
|
+
}, otherProps), name !== null && name !== void 0 ? name : t("labels.submit"));
|
|
15021
|
+
};
|
|
15022
|
+
|
|
15023
|
+
const NewsletterUpdateList = () => {
|
|
15024
|
+
const handleSelectNewsletter = event => {
|
|
15025
|
+
dispatch({
|
|
15026
|
+
type: SET_SELECT,
|
|
15027
|
+
payload: event.target.value
|
|
15028
|
+
});
|
|
15029
|
+
};
|
|
15030
|
+
|
|
15031
|
+
const {
|
|
15032
|
+
dispatch,
|
|
15033
|
+
state: {
|
|
15034
|
+
newsletters,
|
|
15035
|
+
isListLoading
|
|
15036
|
+
}
|
|
15037
|
+
} = React.useContext(store$c);
|
|
15038
|
+
|
|
15039
|
+
if (isListLoading) {
|
|
15040
|
+
return /*#__PURE__*/React__default['default'].createElement(Loader, {
|
|
15041
|
+
width: 60,
|
|
15042
|
+
height: 100
|
|
15043
|
+
});
|
|
15044
|
+
}
|
|
15045
|
+
|
|
15046
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
15047
|
+
className: "plc-max-h-80 plc-overflow-y-auto pelcro-newsletters-wrapper"
|
|
15048
|
+
}, newsletters.map(newsletter => /*#__PURE__*/React__default['default'].createElement("div", {
|
|
15049
|
+
key: newsletter.id,
|
|
15050
|
+
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"
|
|
15051
|
+
}, /*#__PURE__*/React__default['default'].createElement(Checkbox, {
|
|
15052
|
+
className: "pelcro-select-newsletter-checkbox",
|
|
15053
|
+
labelClassName: "plc-cursor-pointer plc-w-full",
|
|
15054
|
+
id: `pelcro-newsletter-update-${newsletter.id}`,
|
|
15055
|
+
checked: newsletter.selected,
|
|
15056
|
+
value: newsletter.id,
|
|
15057
|
+
onChange: handleSelectNewsletter
|
|
15058
|
+
}, newsletter.label))));
|
|
15059
|
+
};
|
|
15060
|
+
|
|
15061
|
+
const NewsletterUpdateView = props => {
|
|
15062
|
+
const {
|
|
15063
|
+
t
|
|
15064
|
+
} = useTranslation("newsletter");
|
|
15065
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
15066
|
+
id: "pelcro-newsletter-update-view"
|
|
15067
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
15068
|
+
className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
15069
|
+
}, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
15070
|
+
className: "plc-text-2xl plc-font-semibold"
|
|
15071
|
+
}, t("updateTitle"))), /*#__PURE__*/React__default['default'].createElement("form", {
|
|
15072
|
+
action: "javascript:void(0);",
|
|
15073
|
+
className: "plc-mt-2 pelcro-form"
|
|
15074
|
+
}, /*#__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, {
|
|
15075
|
+
role: "submit",
|
|
15076
|
+
className: "plc-mt-4 plc-w-full",
|
|
15077
|
+
name: t("labels.submit"),
|
|
15078
|
+
id: "pelcro-submit"
|
|
15079
|
+
}))));
|
|
15080
|
+
};
|
|
15081
|
+
|
|
15082
|
+
const NewsletterUpdateModal = ({
|
|
15083
|
+
onDisplay,
|
|
15084
|
+
onClose,
|
|
15085
|
+
...otherProps
|
|
15086
|
+
}) => {
|
|
15087
|
+
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
15088
|
+
id: "pelcro-newsletter-update-modal",
|
|
15089
|
+
onDisplay: onDisplay,
|
|
15090
|
+
onClose: onClose
|
|
15091
|
+
}, /*#__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)));
|
|
15092
|
+
};
|
|
15093
|
+
NewsletterUpdateModal.viewId = "newsletter-update";
|
|
15094
|
+
|
|
14390
15095
|
const MeterView = () => {
|
|
14391
15096
|
var _paywallProduct$paywa, _paywallProduct$paywa2;
|
|
14392
15097
|
|
|
@@ -14438,7 +15143,7 @@ const MeterModal = props => {
|
|
|
14438
15143
|
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"
|
|
14439
15144
|
}, /*#__PURE__*/React__default['default'].createElement("button", {
|
|
14440
15145
|
type: "button",
|
|
14441
|
-
className: "plc-absolute plc-top-0 plc-text-2xl plc-text-gray-500 plc-right-1 pelcro-close-btn",
|
|
15146
|
+
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",
|
|
14442
15147
|
"aria-label": "Close",
|
|
14443
15148
|
onClick: onClose
|
|
14444
15149
|
}, /*#__PURE__*/React__default['default'].createElement("span", null, "\xD7")), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(MeterView, props)));
|
|
@@ -14471,10 +15176,7 @@ const SubscriptionCreateView = ({
|
|
|
14471
15176
|
interval,
|
|
14472
15177
|
count: interval_count
|
|
14473
15178
|
});
|
|
14474
|
-
const
|
|
14475
|
-
default_locale
|
|
14476
|
-
} = Pelcro.site.read();
|
|
14477
|
-
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);
|
|
15179
|
+
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());
|
|
14478
15180
|
return /*#__PURE__*/React__default['default'].createElement("p", {
|
|
14479
15181
|
className: "plc-text-gray-600"
|
|
14480
15182
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
@@ -14774,17 +15476,17 @@ const UserUpdatePhone = props => /*#__PURE__*/React__default['default'].createEl
|
|
|
14774
15476
|
|
|
14775
15477
|
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";
|
|
14776
15478
|
|
|
14777
|
-
var _path$
|
|
15479
|
+
var _path$f;
|
|
14778
15480
|
|
|
14779
|
-
function _extends$
|
|
15481
|
+
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); }
|
|
14780
15482
|
|
|
14781
15483
|
function SvgEdit(props) {
|
|
14782
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
15484
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
|
|
14783
15485
|
className: "plc-w-6 plc-h-6",
|
|
14784
15486
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14785
15487
|
viewBox: "0 0 20 20",
|
|
14786
15488
|
fill: "currentColor"
|
|
14787
|
-
}, props), _path$
|
|
15489
|
+
}, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
|
|
14788
15490
|
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"
|
|
14789
15491
|
})));
|
|
14790
15492
|
}
|
|
@@ -17651,7 +18353,6 @@ const OrderConfirmModal = props => {
|
|
|
17651
18353
|
const userOrders = window.Pelcro.user.read().orders;
|
|
17652
18354
|
const latestOrder = userOrders === null || userOrders === void 0 ? void 0 : userOrders[userOrders.length - 1];
|
|
17653
18355
|
const latestOrderDiscount = latestOrder === null || latestOrder === void 0 ? void 0 : (_latestOrder$coupon = latestOrder.coupon) === null || _latestOrder$coupon === void 0 ? void 0 : _latestOrder$coupon.percent_off;
|
|
17654
|
-
const locale = window.Pelcro.site.read().default_locale;
|
|
17655
18356
|
const {
|
|
17656
18357
|
t
|
|
17657
18358
|
} = useTranslation("shop");
|
|
@@ -17710,7 +18411,7 @@ const OrderConfirmModal = props => {
|
|
|
17710
18411
|
className: "plc-mr-1 pelcro-summary-total-text"
|
|
17711
18412
|
}, t("labels.total")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
17712
18413
|
className: "pelcro-summary-total"
|
|
17713
|
-
}, latestOrderDiscount && `(-${latestOrderDiscount}%) `, getFormattedPriceByLocal(latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.amount, latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.currency,
|
|
18414
|
+
}, 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", {
|
|
17714
18415
|
className: "plc-flex plc-justify-center plc-mt-6"
|
|
17715
18416
|
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
17716
18417
|
id: "pelcro-submit",
|
|
@@ -17772,9 +18473,9 @@ const GiftCreateContainer = ({
|
|
|
17772
18473
|
}
|
|
17773
18474
|
|
|
17774
18475
|
if (giftRecipient.startDate) {
|
|
17775
|
-
const nowDate = new Date();
|
|
17776
|
-
const yearFromNowDate = new Date(new Date().setFullYear(nowDate.getFullYear() + 1));
|
|
17777
|
-
const submittedDate = new Date(giftRecipient.startDate);
|
|
18476
|
+
const nowDate = getDateWithoutTime(new Date());
|
|
18477
|
+
const yearFromNowDate = getDateWithoutTime(new Date(new Date().setFullYear(nowDate.getFullYear() + 1)));
|
|
18478
|
+
const submittedDate = getDateWithoutTime(new Date(giftRecipient.startDate));
|
|
17778
18479
|
|
|
17779
18480
|
if (submittedDate < nowDate || submittedDate > yearFromNowDate) {
|
|
17780
18481
|
dispatch({
|
|
@@ -17895,18 +18596,18 @@ const GiftCreateLastName = props => /*#__PURE__*/React__default['default'].creat
|
|
|
17895
18596
|
store: store$4
|
|
17896
18597
|
}, props));
|
|
17897
18598
|
|
|
17898
|
-
var _path$
|
|
18599
|
+
var _path$e;
|
|
17899
18600
|
|
|
17900
|
-
function _extends$
|
|
18601
|
+
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); }
|
|
17901
18602
|
|
|
17902
18603
|
function SvgInfoCircle(props) {
|
|
17903
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
18604
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
|
|
17904
18605
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17905
18606
|
className: "plc-w-5 plc-h-5",
|
|
17906
18607
|
fill: "none",
|
|
17907
18608
|
viewBox: "0 0 24 24",
|
|
17908
18609
|
stroke: "currentColor"
|
|
17909
|
-
}, props), _path$
|
|
18610
|
+
}, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
|
|
17910
18611
|
strokeLinecap: "round",
|
|
17911
18612
|
strokeLinejoin: "round",
|
|
17912
18613
|
strokeWidth: 2,
|
|
@@ -18893,8 +19594,8 @@ const PaymentMethodSelectModal = ({
|
|
|
18893
19594
|
};
|
|
18894
19595
|
PaymentMethodSelectModal.viewId = "payment-method-select";
|
|
18895
19596
|
|
|
18896
|
-
function _extends$
|
|
18897
|
-
_extends$
|
|
19597
|
+
function _extends$f() {
|
|
19598
|
+
_extends$f = Object.assign || function (target) {
|
|
18898
19599
|
for (var i = 1; i < arguments.length; i++) {
|
|
18899
19600
|
var source = arguments[i];
|
|
18900
19601
|
|
|
@@ -18908,7 +19609,7 @@ function _extends$d() {
|
|
|
18908
19609
|
return target;
|
|
18909
19610
|
};
|
|
18910
19611
|
|
|
18911
|
-
return _extends$
|
|
19612
|
+
return _extends$f.apply(this, arguments);
|
|
18912
19613
|
}
|
|
18913
19614
|
|
|
18914
19615
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
@@ -19092,7 +19793,7 @@ function render(props, propsBag, defaultTag, features, visible) {
|
|
|
19092
19793
|
return match(strategy, (_match = {}, _match[RenderStrategy.Unmount] = function () {
|
|
19093
19794
|
return null;
|
|
19094
19795
|
}, _match[RenderStrategy.Hidden] = function () {
|
|
19095
|
-
return _render(_extends$
|
|
19796
|
+
return _render(_extends$f({}, _rest, {
|
|
19096
19797
|
hidden: true,
|
|
19097
19798
|
style: {
|
|
19098
19799
|
display: 'none'
|
|
@@ -19620,7 +20321,7 @@ function TransitionChild(props) {
|
|
|
19620
20321
|
var passthroughProps = rest;
|
|
19621
20322
|
return React__default['default'].createElement(NestingContext.Provider, {
|
|
19622
20323
|
value: nesting
|
|
19623
|
-
}, render(_extends$
|
|
20324
|
+
}, render(_extends$f({}, passthroughProps, propsWeControl), propsBag, DEFAULT_TRANSITION_CHILD_TAG, TransitionChildRenderFeatures, state === TreeStates.Visible));
|
|
19624
20325
|
}
|
|
19625
20326
|
|
|
19626
20327
|
function Transition(props) {
|
|
@@ -19664,7 +20365,7 @@ function Transition(props) {
|
|
|
19664
20365
|
value: nestingBag
|
|
19665
20366
|
}, React__default['default'].createElement(TransitionContext.Provider, {
|
|
19666
20367
|
value: transitionBag
|
|
19667
|
-
}, render(_extends$
|
|
20368
|
+
}, render(_extends$f({}, sharedProps, {
|
|
19668
20369
|
as: React.Fragment,
|
|
19669
20370
|
children: React__default['default'].createElement(TransitionChild, Object.assign({}, sharedProps, passthroughProps))
|
|
19670
20371
|
}), propsBag, React.Fragment, TransitionChildRenderFeatures, state === TreeStates.Visible)));
|
|
@@ -19791,12 +20492,12 @@ var ActionTypes;
|
|
|
19791
20492
|
})(ActionTypes || (ActionTypes = {}));
|
|
19792
20493
|
|
|
19793
20494
|
(_reducers = {}, _reducers[ActionTypes.CloseMenu] = function (state) {
|
|
19794
|
-
return _extends$
|
|
20495
|
+
return _extends$f({}, state, {
|
|
19795
20496
|
activeItemIndex: null,
|
|
19796
20497
|
menuState: MenuStates.Closed
|
|
19797
20498
|
});
|
|
19798
20499
|
}, _reducers[ActionTypes.OpenMenu] = function (state) {
|
|
19799
|
-
return _extends$
|
|
20500
|
+
return _extends$f({}, state, {
|
|
19800
20501
|
menuState: MenuStates.Open
|
|
19801
20502
|
});
|
|
19802
20503
|
}, _reducers[ActionTypes.GoToItem] = function (state, action) {
|
|
@@ -19815,7 +20516,7 @@ var ActionTypes;
|
|
|
19815
20516
|
}
|
|
19816
20517
|
});
|
|
19817
20518
|
if (state.searchQuery === '' && state.activeItemIndex === activeItemIndex) return state;
|
|
19818
|
-
return _extends$
|
|
20519
|
+
return _extends$f({}, state, {
|
|
19819
20520
|
searchQuery: '',
|
|
19820
20521
|
activeItemIndex: activeItemIndex
|
|
19821
20522
|
});
|
|
@@ -19826,19 +20527,19 @@ var ActionTypes;
|
|
|
19826
20527
|
|
|
19827
20528
|
return ((_item$dataRef$current = item.dataRef.current.textValue) == null ? void 0 : _item$dataRef$current.startsWith(searchQuery)) && !item.dataRef.current.disabled;
|
|
19828
20529
|
});
|
|
19829
|
-
if (match === -1 || match === state.activeItemIndex) return _extends$
|
|
20530
|
+
if (match === -1 || match === state.activeItemIndex) return _extends$f({}, state, {
|
|
19830
20531
|
searchQuery: searchQuery
|
|
19831
20532
|
});
|
|
19832
|
-
return _extends$
|
|
20533
|
+
return _extends$f({}, state, {
|
|
19833
20534
|
searchQuery: searchQuery,
|
|
19834
20535
|
activeItemIndex: match
|
|
19835
20536
|
});
|
|
19836
20537
|
}, _reducers[ActionTypes.ClearSearch] = function (state) {
|
|
19837
|
-
return _extends$
|
|
20538
|
+
return _extends$f({}, state, {
|
|
19838
20539
|
searchQuery: ''
|
|
19839
20540
|
});
|
|
19840
20541
|
}, _reducers[ActionTypes.RegisterItem] = function (state, action) {
|
|
19841
|
-
return _extends$
|
|
20542
|
+
return _extends$f({}, state, {
|
|
19842
20543
|
items: [].concat(state.items, [{
|
|
19843
20544
|
id: action.id,
|
|
19844
20545
|
dataRef: action.dataRef
|
|
@@ -19851,7 +20552,7 @@ var ActionTypes;
|
|
|
19851
20552
|
return a.id === action.id;
|
|
19852
20553
|
});
|
|
19853
20554
|
if (idx !== -1) nextItems.splice(idx, 1);
|
|
19854
|
-
return _extends$
|
|
20555
|
+
return _extends$f({}, state, {
|
|
19855
20556
|
items: nextItems,
|
|
19856
20557
|
activeItemIndex: function () {
|
|
19857
20558
|
if (idx === state.activeItemIndex) return null;
|
|
@@ -19890,19 +20591,19 @@ var ActionTypes$1;
|
|
|
19890
20591
|
(_reducers$1 = {}, _reducers$1[ActionTypes$1.CloseListbox] = function (state) {
|
|
19891
20592
|
if (state.disabled) return state;
|
|
19892
20593
|
if (state.listboxState === ListboxStates.Closed) return state;
|
|
19893
|
-
return _extends$
|
|
20594
|
+
return _extends$f({}, state, {
|
|
19894
20595
|
activeOptionIndex: null,
|
|
19895
20596
|
listboxState: ListboxStates.Closed
|
|
19896
20597
|
});
|
|
19897
20598
|
}, _reducers$1[ActionTypes$1.OpenListbox] = function (state) {
|
|
19898
20599
|
if (state.disabled) return state;
|
|
19899
20600
|
if (state.listboxState === ListboxStates.Open) return state;
|
|
19900
|
-
return _extends$
|
|
20601
|
+
return _extends$f({}, state, {
|
|
19901
20602
|
listboxState: ListboxStates.Open
|
|
19902
20603
|
});
|
|
19903
20604
|
}, _reducers$1[ActionTypes$1.SetDisabled] = function (state, action) {
|
|
19904
20605
|
if (state.disabled === action.disabled) return state;
|
|
19905
|
-
return _extends$
|
|
20606
|
+
return _extends$f({}, state, {
|
|
19906
20607
|
disabled: action.disabled
|
|
19907
20608
|
});
|
|
19908
20609
|
}, _reducers$1[ActionTypes$1.GoToOption] = function (state, action) {
|
|
@@ -19923,7 +20624,7 @@ var ActionTypes$1;
|
|
|
19923
20624
|
}
|
|
19924
20625
|
});
|
|
19925
20626
|
if (state.searchQuery === '' && state.activeOptionIndex === activeOptionIndex) return state;
|
|
19926
|
-
return _extends$
|
|
20627
|
+
return _extends$f({}, state, {
|
|
19927
20628
|
searchQuery: '',
|
|
19928
20629
|
activeOptionIndex: activeOptionIndex
|
|
19929
20630
|
});
|
|
@@ -19936,10 +20637,10 @@ var ActionTypes$1;
|
|
|
19936
20637
|
|
|
19937
20638
|
return !option.dataRef.current.disabled && ((_option$dataRef$curre = option.dataRef.current.textValue) == null ? void 0 : _option$dataRef$curre.startsWith(searchQuery));
|
|
19938
20639
|
});
|
|
19939
|
-
if (match === -1 || match === state.activeOptionIndex) return _extends$
|
|
20640
|
+
if (match === -1 || match === state.activeOptionIndex) return _extends$f({}, state, {
|
|
19940
20641
|
searchQuery: searchQuery
|
|
19941
20642
|
});
|
|
19942
|
-
return _extends$
|
|
20643
|
+
return _extends$f({}, state, {
|
|
19943
20644
|
searchQuery: searchQuery,
|
|
19944
20645
|
activeOptionIndex: match
|
|
19945
20646
|
});
|
|
@@ -19947,11 +20648,11 @@ var ActionTypes$1;
|
|
|
19947
20648
|
if (state.disabled) return state;
|
|
19948
20649
|
if (state.listboxState === ListboxStates.Closed) return state;
|
|
19949
20650
|
if (state.searchQuery === '') return state;
|
|
19950
|
-
return _extends$
|
|
20651
|
+
return _extends$f({}, state, {
|
|
19951
20652
|
searchQuery: ''
|
|
19952
20653
|
});
|
|
19953
20654
|
}, _reducers$1[ActionTypes$1.RegisterOption] = function (state, action) {
|
|
19954
|
-
return _extends$
|
|
20655
|
+
return _extends$f({}, state, {
|
|
19955
20656
|
options: [].concat(state.options, [{
|
|
19956
20657
|
id: action.id,
|
|
19957
20658
|
dataRef: action.dataRef
|
|
@@ -19964,7 +20665,7 @@ var ActionTypes$1;
|
|
|
19964
20665
|
return a.id === action.id;
|
|
19965
20666
|
});
|
|
19966
20667
|
if (idx !== -1) nextOptions.splice(idx, 1);
|
|
19967
|
-
return _extends$
|
|
20668
|
+
return _extends$f({}, state, {
|
|
19968
20669
|
options: nextOptions,
|
|
19969
20670
|
activeOptionIndex: function () {
|
|
19970
20671
|
if (idx === state.activeOptionIndex) return null;
|
|
@@ -20025,18 +20726,18 @@ const getPaymentCardIcon = name => {
|
|
|
20025
20726
|
}));
|
|
20026
20727
|
};
|
|
20027
20728
|
|
|
20028
|
-
var _path$
|
|
20729
|
+
var _path$d;
|
|
20029
20730
|
|
|
20030
|
-
function _extends$
|
|
20731
|
+
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); }
|
|
20031
20732
|
|
|
20032
20733
|
function SvgChevronRight(props) {
|
|
20033
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
20734
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
|
|
20034
20735
|
className: "plc-w-6 plc-h-6",
|
|
20035
20736
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20036
20737
|
fill: "none",
|
|
20037
20738
|
viewBox: "0 0 24 24",
|
|
20038
20739
|
stroke: "currentColor"
|
|
20039
|
-
}, props), _path$
|
|
20740
|
+
}, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20040
20741
|
strokeLinecap: "round",
|
|
20041
20742
|
strokeLinejoin: "round",
|
|
20042
20743
|
strokeWidth: 2,
|
|
@@ -20079,7 +20780,6 @@ const OrderItems = ({
|
|
|
20079
20780
|
const {
|
|
20080
20781
|
t
|
|
20081
20782
|
} = useTranslation("dashboard");
|
|
20082
|
-
const site = window.Pelcro.site.read();
|
|
20083
20783
|
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", {
|
|
20084
20784
|
colSpan: "3",
|
|
20085
20785
|
className: "plc-text-center plc-text-gray-500"
|
|
@@ -20095,7 +20795,7 @@ const OrderItems = ({
|
|
|
20095
20795
|
className: "plc-py-4 plc-pl-2"
|
|
20096
20796
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20097
20797
|
className: "plc-text-xl plc-font-semibold "
|
|
20098
|
-
}, getFormattedPriceByLocal(order.amount, order.currency,
|
|
20798
|
+
}, getFormattedPriceByLocal(order.amount, order.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20099
20799
|
className: "plc-text-xs plc-text-gray-400 plc-uppercase"
|
|
20100
20800
|
}, t("labels.orders.itemsAmount", {
|
|
20101
20801
|
count: getItemsAmount(order.id)
|
|
@@ -20124,7 +20824,7 @@ const OrderItems = ({
|
|
|
20124
20824
|
className: ""
|
|
20125
20825
|
}, item.product_sku_name))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20126
20826
|
className: "plc-font-semibold"
|
|
20127
|
-
}, getFormattedPriceByLocal(item.amount, order.currency,
|
|
20827
|
+
}, getFormattedPriceByLocal(item.amount, order.currency, getPageOrDefaultLanguage()))));
|
|
20128
20828
|
}), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20129
20829
|
colSpan: "3"
|
|
20130
20830
|
}, /*#__PURE__*/React__default['default'].createElement("hr", {
|
|
@@ -20253,33 +20953,291 @@ const SavedItems = ({
|
|
|
20253
20953
|
});
|
|
20254
20954
|
};
|
|
20255
20955
|
|
|
20256
|
-
|
|
20257
|
-
* @typedef {Object} AccordionPropsType
|
|
20258
|
-
* @property {string} initialActiveMenu the initial active menu
|
|
20259
|
-
*/
|
|
20260
|
-
|
|
20261
|
-
/**
|
|
20262
|
-
* Accordion component
|
|
20263
|
-
* @param {AccordionPropsType} AccordionProps
|
|
20264
|
-
* @return {JSX}
|
|
20265
|
-
*/
|
|
20956
|
+
var _path$c;
|
|
20266
20957
|
|
|
20267
|
-
|
|
20268
|
-
children,
|
|
20269
|
-
initialActiveMenu = ""
|
|
20270
|
-
}) => {
|
|
20271
|
-
const [activeMenu, setActiveMenu] = React.useState(initialActiveMenu);
|
|
20958
|
+
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); }
|
|
20272
20959
|
|
|
20273
|
-
|
|
20274
|
-
|
|
20275
|
-
|
|
20276
|
-
|
|
20277
|
-
|
|
20278
|
-
|
|
20279
|
-
|
|
20960
|
+
function SvgRefresh(props) {
|
|
20961
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
|
|
20962
|
+
className: "plc-w-4 plc-h-4 plc-mr-1",
|
|
20963
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20964
|
+
fill: "none",
|
|
20965
|
+
viewBox: "0 0 24 24",
|
|
20966
|
+
stroke: "currentColor"
|
|
20967
|
+
}, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20968
|
+
strokeLinecap: "round",
|
|
20969
|
+
strokeLinejoin: "round",
|
|
20970
|
+
strokeWidth: 2,
|
|
20971
|
+
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"
|
|
20972
|
+
})));
|
|
20973
|
+
}
|
|
20974
|
+
|
|
20975
|
+
var _path$b;
|
|
20976
|
+
|
|
20977
|
+
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); }
|
|
20978
|
+
|
|
20979
|
+
function SvgCalendar(props) {
|
|
20980
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
|
|
20981
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20982
|
+
className: "plc-h-4 plc-w-4 plc-mr-1",
|
|
20983
|
+
viewBox: "0 0 20 20",
|
|
20984
|
+
fill: "currentColor"
|
|
20985
|
+
}, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20986
|
+
fillRule: "evenodd",
|
|
20987
|
+
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",
|
|
20988
|
+
clipRule: "evenodd"
|
|
20989
|
+
})));
|
|
20990
|
+
}
|
|
20991
|
+
|
|
20992
|
+
var _path$a;
|
|
20993
|
+
|
|
20994
|
+
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); }
|
|
20995
|
+
|
|
20996
|
+
function SvgPlus(props) {
|
|
20997
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
|
|
20998
|
+
className: "plc-w-5 plc-h-5",
|
|
20999
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21000
|
+
fill: "none",
|
|
21001
|
+
viewBox: "0 0 24 24",
|
|
21002
|
+
stroke: "currentColor"
|
|
21003
|
+
}, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
|
|
21004
|
+
strokeLinecap: "round",
|
|
21005
|
+
strokeLinejoin: "round",
|
|
21006
|
+
strokeWidth: 2,
|
|
21007
|
+
d: "M12 6v6m0 0v6m0-6h6m-6 0H6"
|
|
21008
|
+
})));
|
|
21009
|
+
}
|
|
21010
|
+
|
|
21011
|
+
var _path$9;
|
|
21012
|
+
|
|
21013
|
+
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); }
|
|
21014
|
+
|
|
21015
|
+
function SvgCheckMark(props) {
|
|
21016
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
|
|
21017
|
+
className: "plc-w-4 plc-h-4 plc-mr-1",
|
|
21018
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21019
|
+
viewBox: "0 0 20 20",
|
|
21020
|
+
fill: "currentColor"
|
|
21021
|
+
}, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
21022
|
+
fillRule: "evenodd",
|
|
21023
|
+
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",
|
|
21024
|
+
clipRule: "evenodd"
|
|
21025
|
+
})));
|
|
21026
|
+
}
|
|
21027
|
+
|
|
21028
|
+
const SubscriptionsMenu = props => {
|
|
21029
|
+
const {
|
|
21030
|
+
t
|
|
21031
|
+
} = useTranslation("dashboard");
|
|
21032
|
+
return /*#__PURE__*/React__default['default'].createElement("table", {
|
|
21033
|
+
className: "plc-w-full plc-table-fixed"
|
|
21034
|
+
}, /*#__PURE__*/React__default['default'].createElement("thead", {
|
|
21035
|
+
className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
|
|
21036
|
+
}, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
|
|
21037
|
+
className: "plc-w-3/12 "
|
|
21038
|
+
}, t("labels.plan")), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
21039
|
+
className: "plc-w-4/12 "
|
|
21040
|
+
}, t("labels.status.title")), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
21041
|
+
className: "plc-w-3/12 "
|
|
21042
|
+
}, t("labels.actions")), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
21043
|
+
className: "plc-w-2/12 "
|
|
21044
|
+
}))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
21045
|
+
className: "plc-h-4"
|
|
21046
|
+
})), /*#__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", {
|
|
21047
|
+
colSpan: "4",
|
|
21048
|
+
className: "plc-p-1"
|
|
21049
|
+
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21050
|
+
variant: "ghost",
|
|
21051
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgPlus, {
|
|
21052
|
+
className: "plc-w-4 plc-h-4 plc-mr-1"
|
|
21053
|
+
}),
|
|
21054
|
+
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",
|
|
21055
|
+
onClick: props.displayProductSelect
|
|
21056
|
+
}, t("labels.addSubscription")))), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21057
|
+
colSpan: "4",
|
|
21058
|
+
className: "plc-p-1"
|
|
21059
|
+
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21060
|
+
variant: "ghost",
|
|
21061
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgGift, {
|
|
21062
|
+
className: "plc-w-4 plc-h-4 plc-mr-1"
|
|
21063
|
+
}),
|
|
21064
|
+
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",
|
|
21065
|
+
onClick: props.displayRedeem
|
|
21066
|
+
}, t("labels.redeemGift"))))));
|
|
21067
|
+
};
|
|
21068
|
+
const SubscriptionsItems = ({
|
|
21069
|
+
onClose,
|
|
21070
|
+
cancelSubscription,
|
|
21071
|
+
reactivateSubscription,
|
|
21072
|
+
setProductAndPlan,
|
|
21073
|
+
setSubscriptionIdToRenew,
|
|
21074
|
+
setView,
|
|
21075
|
+
getSubscriptionStatus,
|
|
21076
|
+
disableSubmit,
|
|
21077
|
+
activeMenu,
|
|
21078
|
+
toggleActiveMenu
|
|
21079
|
+
}) => {
|
|
21080
|
+
const {
|
|
21081
|
+
t
|
|
21082
|
+
} = useTranslation("dashboard");
|
|
21083
|
+
const subs = window.Pelcro.subscription.list();
|
|
21084
|
+
if (!subs || subs.length === 0) return null;
|
|
21085
|
+
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 => {
|
|
21086
|
+
const isActive = activeMenu === sub.id; // Cancel button click handlers
|
|
21087
|
+
|
|
21088
|
+
const onCancelClick = () => {
|
|
21089
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
21090
|
+
notify.confirm((onSuccess, onFailure) => {
|
|
21091
|
+
cancelSubscription(sub.id, onSuccess, onFailure);
|
|
21092
|
+
}, {
|
|
21093
|
+
confirmMessage: t("messages.subCancellation.isSureToCancel"),
|
|
21094
|
+
loadingMessage: t("messages.subCancellation.loading"),
|
|
21095
|
+
successMessage: t("messages.subCancellation.success"),
|
|
21096
|
+
errorMessage: t("messages.subCancellation.error")
|
|
21097
|
+
}, {
|
|
21098
|
+
closeButtonLabel: t("labels.subCancellation.goBack")
|
|
21099
|
+
});
|
|
21100
|
+
}; // Reactivate button click handlers
|
|
21101
|
+
|
|
21102
|
+
|
|
21103
|
+
const onReactivateClick = () => {
|
|
21104
|
+
reactivateSubscription(sub.id);
|
|
21105
|
+
}; // Renew click
|
|
21106
|
+
|
|
21107
|
+
|
|
21108
|
+
const onRenewClick = () => {
|
|
21109
|
+
const product_id = sub.plan.product.id;
|
|
21110
|
+
const plan_id = sub.plan.id;
|
|
21111
|
+
const product = window.Pelcro.product.getById(product_id);
|
|
21112
|
+
const plan = window.Pelcro.plan.getById(plan_id);
|
|
21113
|
+
setProductAndPlan(product, plan);
|
|
21114
|
+
setSubscriptionIdToRenew(sub.id);
|
|
21115
|
+
setView("plan-select");
|
|
21116
|
+
};
|
|
21117
|
+
|
|
21118
|
+
const getPhases = () => {
|
|
21119
|
+
if (!sub.schedule) return [];
|
|
21120
|
+
const currentPhaseStartDate = sub.schedule.current_phase.start_date;
|
|
21121
|
+
const currentPhase = sub.schedule.phases.find(phase => {
|
|
21122
|
+
return phase.start_date === currentPhaseStartDate;
|
|
21123
|
+
});
|
|
21124
|
+
const futurePhases = sub.schedule.phases.filter(phase => {
|
|
21125
|
+
return phase.start_date > currentPhaseStartDate;
|
|
21126
|
+
});
|
|
21127
|
+
return [currentPhase, ...futurePhases];
|
|
21128
|
+
};
|
|
21129
|
+
|
|
21130
|
+
const hasPhases = getPhases().length > 0;
|
|
21131
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, {
|
|
21132
|
+
key: sub.id
|
|
21133
|
+
}, /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
21134
|
+
onClick: () => toggleActiveMenu(sub.id),
|
|
21135
|
+
key: sub.id,
|
|
21136
|
+
className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header ${isActive ? "plc-bg-gray-100" : "hover:plc-bg-gray-50"}`
|
|
21137
|
+
}, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21138
|
+
className: "plc-truncate"
|
|
21139
|
+
}, sub.plan.nickname && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21140
|
+
className: "plc-font-semibold plc-text-gray-500"
|
|
21141
|
+
}, sub.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21142
|
+
className: "plc-text-xs plc-text-gray-400"
|
|
21143
|
+
}, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21144
|
+
className: "plc-py-2"
|
|
21145
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21146
|
+
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getSubscriptionStatus(sub).bgColor} plc-uppercase ${getSubscriptionStatus(sub).textColor} plc-rounded-lg`
|
|
21147
|
+
}, getSubscriptionStatus(sub).icon, getSubscriptionStatus(sub).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21148
|
+
className: "plc-text-xs plc-text-gray-500"
|
|
21149
|
+
}, sub.status && /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21150
|
+
className: "plc-inline-block plc-mt-1 plc-underline"
|
|
21151
|
+
}, getSubscriptionStatus(sub).content), /*#__PURE__*/React__default['default'].createElement("br", null), sub.shipments_remaining ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21152
|
+
className: "plc-inline-block plc-mt-1"
|
|
21153
|
+
}, 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, {
|
|
21154
|
+
variant: "ghost",
|
|
21155
|
+
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
|
|
21156
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
|
|
21157
|
+
onClick: onCancelClick,
|
|
21158
|
+
disabled: disableSubmit,
|
|
21159
|
+
"data-key": sub.id
|
|
21160
|
+
}, t("labels.unsubscribe")), sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21161
|
+
variant: "ghost",
|
|
21162
|
+
className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
|
|
21163
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
21164
|
+
onClick: onReactivateClick,
|
|
21165
|
+
disabled: disableSubmit,
|
|
21166
|
+
"data-key": sub.id
|
|
21167
|
+
}, t("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21168
|
+
variant: "ghost",
|
|
21169
|
+
className: "plc-text-blue-400 pelcro-dashboard-sub-renew-button",
|
|
21170
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
21171
|
+
onClick: onRenewClick,
|
|
21172
|
+
disabled: disableSubmit,
|
|
21173
|
+
"data-key": sub.id
|
|
21174
|
+
}, t("labels.renew"))), /*#__PURE__*/React__default['default'].createElement("td", null, hasPhases && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21175
|
+
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"}`
|
|
21176
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21177
|
+
className: `plc-transition plc-ease-out ${isActive && "plc-text-white plc-transform plc-rotate-90"}`
|
|
21178
|
+
}, /*#__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) => {
|
|
21179
|
+
var _phase$plans;
|
|
21180
|
+
|
|
21181
|
+
const plan = (_phase$plans = phase.plans) === null || _phase$plans === void 0 ? void 0 : _phase$plans[0].plan;
|
|
21182
|
+
const isCurrentPhase = i === 0;
|
|
21183
|
+
const startDate = new Date(Number(`${phase.start_date}000`));
|
|
21184
|
+
const endDate = new Date(Number(`${phase.end_date}000`));
|
|
21185
|
+
const formattedStartDate = new Intl.DateTimeFormat("en-CA").format(startDate);
|
|
21186
|
+
const formattedEndDate = new Intl.DateTimeFormat("en-CA").format(endDate);
|
|
21187
|
+
const startDateString = `${t("labels.startsOn")} ${formattedStartDate}`;
|
|
21188
|
+
const endDateString = `${t("labels.expiresOn")} ${formattedEndDate}`;
|
|
21189
|
+
return /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
21190
|
+
key: `${phase.start_date}-${phase.end_date}`,
|
|
21191
|
+
className: "pelcro-sub-phase-row plc-w-full plc-align-middle"
|
|
21192
|
+
}, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21193
|
+
className: "plc-truncate"
|
|
21194
|
+
}, plan.nickname && /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21195
|
+
className: "plc-font-semibold plc-text-gray-500"
|
|
21196
|
+
}, plan.nickname)), /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21197
|
+
className: "plc-py-2"
|
|
21198
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21199
|
+
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"}
|
|
21200
|
+
`
|
|
21201
|
+
}, 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", {
|
|
21202
|
+
className: "plc-text-xs plc-text-gray-500"
|
|
21203
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21204
|
+
className: "plc-inline-block plc-mt-1 plc-underline"
|
|
21205
|
+
}, isCurrentPhase ? endDateString : startDateString))));
|
|
21206
|
+
}), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
21207
|
+
colSpan: "4"
|
|
21208
|
+
}, /*#__PURE__*/React__default['default'].createElement("hr", {
|
|
21209
|
+
className: "plc-mt-4"
|
|
21210
|
+
}))))));
|
|
21211
|
+
});
|
|
21212
|
+
};
|
|
21213
|
+
|
|
21214
|
+
/**
|
|
21215
|
+
* @typedef {Object} AccordionPropsType
|
|
21216
|
+
* @property {string} initialActiveMenu the initial active menu
|
|
21217
|
+
*/
|
|
21218
|
+
|
|
21219
|
+
/**
|
|
21220
|
+
* Accordion component
|
|
21221
|
+
* @param {AccordionPropsType} AccordionProps
|
|
21222
|
+
* @return {JSX}
|
|
21223
|
+
*/
|
|
21224
|
+
|
|
21225
|
+
const Accordion = ({
|
|
21226
|
+
children,
|
|
21227
|
+
initialActiveMenu = ""
|
|
21228
|
+
}) => {
|
|
21229
|
+
const [activeMenu, setActiveMenu] = React.useState(initialActiveMenu);
|
|
21230
|
+
|
|
21231
|
+
const toggleActiveMenu = menuToToggle => {
|
|
21232
|
+
if (activeMenu === menuToToggle) {
|
|
21233
|
+
setActiveMenu("");
|
|
21234
|
+
} else {
|
|
21235
|
+
setActiveMenu(menuToToggle);
|
|
21236
|
+
}
|
|
21237
|
+
};
|
|
20280
21238
|
|
|
20281
21239
|
return React__default['default'].Children.map(children, (child, i) => {
|
|
20282
|
-
if (child.type === Accordion.item || child.type === OrderItems || child.type === SavedItems) {
|
|
21240
|
+
if (child.type === Accordion.item || child.type === OrderItems || child.type === SavedItems || child.type === SubscriptionsItems) {
|
|
20283
21241
|
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
20284
21242
|
activeMenu,
|
|
20285
21243
|
toggleActiveMenu,
|
|
@@ -20335,18 +21293,18 @@ Accordion.item = function AccordionItem({
|
|
|
20335
21293
|
}, content)) : null;
|
|
20336
21294
|
};
|
|
20337
21295
|
|
|
20338
|
-
var _path$
|
|
21296
|
+
var _path$8;
|
|
20339
21297
|
|
|
20340
|
-
function _extends$
|
|
21298
|
+
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); }
|
|
20341
21299
|
|
|
20342
21300
|
function SvgExit(props) {
|
|
20343
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
21301
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
|
|
20344
21302
|
className: "plc-w-6 plc-h-6",
|
|
20345
21303
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20346
21304
|
fill: "none",
|
|
20347
21305
|
viewBox: "0 0 24 24",
|
|
20348
21306
|
stroke: "currentColor"
|
|
20349
|
-
}, props), _path$
|
|
21307
|
+
}, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20350
21308
|
strokeLinecap: "round",
|
|
20351
21309
|
strokeLinejoin: "round",
|
|
20352
21310
|
strokeWidth: 2,
|
|
@@ -20354,34 +21312,17 @@ function SvgExit(props) {
|
|
|
20354
21312
|
})));
|
|
20355
21313
|
}
|
|
20356
21314
|
|
|
20357
|
-
var _path$
|
|
20358
|
-
|
|
20359
|
-
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); }
|
|
20360
|
-
|
|
20361
|
-
function SvgCheckMark(props) {
|
|
20362
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
|
|
20363
|
-
className: "plc-w-4 plc-h-4 plc-mr-1",
|
|
20364
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20365
|
-
viewBox: "0 0 20 20",
|
|
20366
|
-
fill: "currentColor"
|
|
20367
|
-
}, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20368
|
-
fillRule: "evenodd",
|
|
20369
|
-
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",
|
|
20370
|
-
clipRule: "evenodd"
|
|
20371
|
-
})));
|
|
20372
|
-
}
|
|
20373
|
-
|
|
20374
|
-
var _path$8;
|
|
21315
|
+
var _path$7;
|
|
20375
21316
|
|
|
20376
|
-
function _extends$
|
|
21317
|
+
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); }
|
|
20377
21318
|
|
|
20378
21319
|
function SvgUser(props) {
|
|
20379
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
21320
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
|
|
20380
21321
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20381
21322
|
fill: "none",
|
|
20382
21323
|
viewBox: "0 0 24 24",
|
|
20383
21324
|
stroke: "currentColor"
|
|
20384
|
-
}, props), _path$
|
|
21325
|
+
}, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20385
21326
|
strokeLinecap: "round",
|
|
20386
21327
|
strokeLinejoin: "round",
|
|
20387
21328
|
strokeWidth: 2,
|
|
@@ -20389,37 +21330,37 @@ function SvgUser(props) {
|
|
|
20389
21330
|
})));
|
|
20390
21331
|
}
|
|
20391
21332
|
|
|
20392
|
-
var _path$
|
|
21333
|
+
var _path$6;
|
|
20393
21334
|
|
|
20394
|
-
function _extends$
|
|
21335
|
+
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); }
|
|
20395
21336
|
|
|
20396
|
-
function
|
|
20397
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
20398
|
-
className: "plc-w-4 plc-h-4 plc-mr-1",
|
|
21337
|
+
function SvgNewsletter(props) {
|
|
21338
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
|
|
20399
21339
|
xmlns: "http://www.w3.org/2000/svg",
|
|
21340
|
+
className: "plc-h-5 plc-w-5",
|
|
20400
21341
|
fill: "none",
|
|
20401
21342
|
viewBox: "0 0 24 24",
|
|
20402
21343
|
stroke: "currentColor"
|
|
20403
|
-
}, props), _path$
|
|
21344
|
+
}, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20404
21345
|
strokeLinecap: "round",
|
|
20405
21346
|
strokeLinejoin: "round",
|
|
20406
21347
|
strokeWidth: 2,
|
|
20407
|
-
d: "
|
|
21348
|
+
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"
|
|
20408
21349
|
})));
|
|
20409
21350
|
}
|
|
20410
21351
|
|
|
20411
|
-
var _path$
|
|
21352
|
+
var _path$5;
|
|
20412
21353
|
|
|
20413
|
-
function _extends$
|
|
21354
|
+
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); }
|
|
20414
21355
|
|
|
20415
21356
|
function SvgPaymentCard(props) {
|
|
20416
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
21357
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
|
|
20417
21358
|
className: "plc-w-6 plc-h-6 plc-mr-2",
|
|
20418
21359
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20419
21360
|
fill: "none",
|
|
20420
21361
|
viewBox: "0 0 24 24",
|
|
20421
21362
|
stroke: "currentColor"
|
|
20422
|
-
}, props), _path$
|
|
21363
|
+
}, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20423
21364
|
strokeLinecap: "round",
|
|
20424
21365
|
strokeLinejoin: "round",
|
|
20425
21366
|
strokeWidth: 2,
|
|
@@ -20427,18 +21368,18 @@ function SvgPaymentCard(props) {
|
|
|
20427
21368
|
})));
|
|
20428
21369
|
}
|
|
20429
21370
|
|
|
20430
|
-
var _path$
|
|
21371
|
+
var _path$4, _path2;
|
|
20431
21372
|
|
|
20432
|
-
function _extends$
|
|
21373
|
+
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); }
|
|
20433
21374
|
|
|
20434
21375
|
function SvgLocationPin(props) {
|
|
20435
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
21376
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
|
|
20436
21377
|
className: "plc-w-6 plc-h-6 plc-mr-2",
|
|
20437
21378
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20438
21379
|
fill: "none",
|
|
20439
21380
|
viewBox: "0 0 24 24",
|
|
20440
21381
|
stroke: "currentColor"
|
|
20441
|
-
}, props), _path$
|
|
21382
|
+
}, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20442
21383
|
strokeLinecap: "round",
|
|
20443
21384
|
strokeLinejoin: "round",
|
|
20444
21385
|
strokeWidth: 2,
|
|
@@ -20453,10 +21394,10 @@ function SvgLocationPin(props) {
|
|
|
20453
21394
|
|
|
20454
21395
|
var _switch;
|
|
20455
21396
|
|
|
20456
|
-
function _extends$
|
|
21397
|
+
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); }
|
|
20457
21398
|
|
|
20458
21399
|
function SvgSubscription(props) {
|
|
20459
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
21400
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
|
|
20460
21401
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20461
21402
|
viewBox: "0 0 100 125",
|
|
20462
21403
|
fill: "currentColor"
|
|
@@ -20471,30 +21412,11 @@ function SvgSubscription(props) {
|
|
|
20471
21412
|
}))))));
|
|
20472
21413
|
}
|
|
20473
21414
|
|
|
20474
|
-
var _path$4;
|
|
20475
|
-
|
|
20476
|
-
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); }
|
|
20477
|
-
|
|
20478
|
-
function SvgShopping(props) {
|
|
20479
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
|
|
20480
|
-
className: "plc-w-6 plc-h-6 plc-mr-2",
|
|
20481
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20482
|
-
fill: "none",
|
|
20483
|
-
viewBox: "0 0 24 24",
|
|
20484
|
-
stroke: "currentColor"
|
|
20485
|
-
}, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
20486
|
-
strokeLinecap: "round",
|
|
20487
|
-
strokeLinejoin: "round",
|
|
20488
|
-
strokeWidth: 2,
|
|
20489
|
-
d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"
|
|
20490
|
-
})));
|
|
20491
|
-
}
|
|
20492
|
-
|
|
20493
21415
|
var _path$3;
|
|
20494
21416
|
|
|
20495
21417
|
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); }
|
|
20496
21418
|
|
|
20497
|
-
function
|
|
21419
|
+
function SvgShopping(props) {
|
|
20498
21420
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
|
|
20499
21421
|
className: "plc-w-6 plc-h-6 plc-mr-2",
|
|
20500
21422
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -20505,7 +21427,7 @@ function SvgBookmark(props) {
|
|
|
20505
21427
|
strokeLinecap: "round",
|
|
20506
21428
|
strokeLinejoin: "round",
|
|
20507
21429
|
strokeWidth: 2,
|
|
20508
|
-
d: "
|
|
21430
|
+
d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"
|
|
20509
21431
|
})));
|
|
20510
21432
|
}
|
|
20511
21433
|
|
|
@@ -20513,9 +21435,9 @@ var _path$2;
|
|
|
20513
21435
|
|
|
20514
21436
|
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); }
|
|
20515
21437
|
|
|
20516
|
-
function
|
|
21438
|
+
function SvgBookmark(props) {
|
|
20517
21439
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
|
|
20518
|
-
className: "plc-w-
|
|
21440
|
+
className: "plc-w-6 plc-h-6 plc-mr-2",
|
|
20519
21441
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20520
21442
|
fill: "none",
|
|
20521
21443
|
viewBox: "0 0 24 24",
|
|
@@ -20524,7 +21446,7 @@ function SvgPlus(props) {
|
|
|
20524
21446
|
strokeLinecap: "round",
|
|
20525
21447
|
strokeLinejoin: "round",
|
|
20526
21448
|
strokeWidth: 2,
|
|
20527
|
-
d: "
|
|
21449
|
+
d: "M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"
|
|
20528
21450
|
})));
|
|
20529
21451
|
}
|
|
20530
21452
|
|
|
@@ -20624,6 +21546,24 @@ class Dashboard extends React.Component {
|
|
|
20624
21546
|
});
|
|
20625
21547
|
});
|
|
20626
21548
|
|
|
21549
|
+
_defineProperty$3(this, "componentWillUnmount", () => {
|
|
21550
|
+
document.removeEventListener("click", this.hideMenuIfClickedOutside);
|
|
21551
|
+
});
|
|
21552
|
+
|
|
21553
|
+
_defineProperty$3(this, "initializeHideMenuHandler", () => {
|
|
21554
|
+
document.addEventListener("click", this.hideMenuIfClickedOutside);
|
|
21555
|
+
});
|
|
21556
|
+
|
|
21557
|
+
_defineProperty$3(this, "hideMenuIfClickedOutside", event => {
|
|
21558
|
+
const didClickOutsideMenu = this.state.isOpen && this.menuRef.current && !this.menuRef.current.contains(event.target);
|
|
21559
|
+
|
|
21560
|
+
if (didClickOutsideMenu) {
|
|
21561
|
+
this.setState({
|
|
21562
|
+
isOpen: false
|
|
21563
|
+
});
|
|
21564
|
+
}
|
|
21565
|
+
});
|
|
21566
|
+
|
|
20627
21567
|
_defineProperty$3(this, "cancelSubscription", (subscription_id, onSuccess, onFailure) => {
|
|
20628
21568
|
// disable the Login button to prevent repeated clicks
|
|
20629
21569
|
window.Pelcro.subscription.cancel({
|
|
@@ -20661,6 +21601,10 @@ class Dashboard extends React.Component {
|
|
|
20661
21601
|
return this.props.setView("password-change");
|
|
20662
21602
|
});
|
|
20663
21603
|
|
|
21604
|
+
_defineProperty$3(this, "displayNewsletterUpdate", () => {
|
|
21605
|
+
return this.props.setView("newsletter-update");
|
|
21606
|
+
});
|
|
21607
|
+
|
|
20664
21608
|
_defineProperty$3(this, "displayProductSelect", ({
|
|
20665
21609
|
isGift
|
|
20666
21610
|
}) => {
|
|
@@ -20766,116 +21710,6 @@ class Dashboard extends React.Component {
|
|
|
20766
21710
|
};
|
|
20767
21711
|
});
|
|
20768
21712
|
|
|
20769
|
-
_defineProperty$3(this, "renderSubscriptions", () => {
|
|
20770
|
-
var _this$state$subscript;
|
|
20771
|
-
|
|
20772
|
-
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 => {
|
|
20773
|
-
// Cancel button click handlers
|
|
20774
|
-
const onCancelClick = () => {
|
|
20775
|
-
this.props.onClose();
|
|
20776
|
-
notify.confirm((onSuccess, onFailure) => {
|
|
20777
|
-
this.cancelSubscription(sub.id, onSuccess, onFailure);
|
|
20778
|
-
}, {
|
|
20779
|
-
confirmMessage: this.locale("messages.subCancellation.isSureToCancel"),
|
|
20780
|
-
loadingMessage: this.locale("messages.subCancellation.loading"),
|
|
20781
|
-
successMessage: this.locale("messages.subCancellation.success"),
|
|
20782
|
-
errorMessage: this.locale("messages.subCancellation.error")
|
|
20783
|
-
}, {
|
|
20784
|
-
closeButtonLabel: this.locale("labels.subCancellation.goBack")
|
|
20785
|
-
});
|
|
20786
|
-
}; // Reactivate button click handlers
|
|
20787
|
-
|
|
20788
|
-
|
|
20789
|
-
const onReactivateClick = () => {
|
|
20790
|
-
this.reactivateSubscription(sub.id);
|
|
20791
|
-
}; // Renew click
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
const onRenewClick = () => {
|
|
20795
|
-
const product_id = sub.plan.product.id;
|
|
20796
|
-
const plan_id = sub.plan.id;
|
|
20797
|
-
const product = window.Pelcro.product.getById(product_id);
|
|
20798
|
-
const plan = window.Pelcro.plan.getById(plan_id);
|
|
20799
|
-
this.props.setProductAndPlan(product, plan);
|
|
20800
|
-
this.props.setSubscriptionIdToRenew(sub.id);
|
|
20801
|
-
this.props.setView("plan-select");
|
|
20802
|
-
};
|
|
20803
|
-
|
|
20804
|
-
return /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
20805
|
-
key: "dashboard-subscription-" + sub.id,
|
|
20806
|
-
className: "plc-w-full plc-align-top"
|
|
20807
|
-
}, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20808
|
-
className: "plc-truncate"
|
|
20809
|
-
}, sub.plan.nickname && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20810
|
-
className: "plc-font-semibold plc-text-gray-500"
|
|
20811
|
-
}, sub.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20812
|
-
className: "plc-text-xs plc-text-gray-400"
|
|
20813
|
-
}, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency, this.site.default_locale)))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20814
|
-
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`
|
|
20815
|
-
}, this.getSubscriptionStatus(sub).icon, this.getSubscriptionStatus(sub).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20816
|
-
className: "plc-mb-4 plc-text-xs plc-text-gray-500"
|
|
20817
|
-
}, sub.status && /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20818
|
-
className: "plc-inline-block plc-mt-1 plc-underline"
|
|
20819
|
-
}, this.getSubscriptionStatus(sub).content), /*#__PURE__*/React__default['default'].createElement("br", null), sub.shipments_remaining ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20820
|
-
className: "plc-inline-block plc-mt-1"
|
|
20821
|
-
}, 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, {
|
|
20822
|
-
variant: "ghost",
|
|
20823
|
-
className: "plc-text-red-500 focus:plc-ring-red-500",
|
|
20824
|
-
icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
|
|
20825
|
-
onClick: onCancelClick,
|
|
20826
|
-
disabled: this.state.disableSubmit,
|
|
20827
|
-
"data-key": sub.id
|
|
20828
|
-
}, this.locale("labels.unsubscribe")), sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
20829
|
-
variant: "ghost",
|
|
20830
|
-
className: "plc-text-green-400 focus:plc-ring-green-300",
|
|
20831
|
-
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
20832
|
-
onClick: onReactivateClick,
|
|
20833
|
-
disabled: this.state.disableSubmit,
|
|
20834
|
-
"data-key": sub.id
|
|
20835
|
-
}, this.locale("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
20836
|
-
variant: "ghost",
|
|
20837
|
-
className: "plc-text-blue-400",
|
|
20838
|
-
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
20839
|
-
onClick: onRenewClick,
|
|
20840
|
-
disabled: this.state.disableSubmit,
|
|
20841
|
-
"data-key": sub.id
|
|
20842
|
-
}, this.locale("labels.renew"))));
|
|
20843
|
-
});
|
|
20844
|
-
return /*#__PURE__*/React__default['default'].createElement("table", {
|
|
20845
|
-
className: "plc-w-full plc-table-fixed"
|
|
20846
|
-
}, /*#__PURE__*/React__default['default'].createElement("thead", {
|
|
20847
|
-
className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
|
|
20848
|
-
}, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
|
|
20849
|
-
className: "plc-w-5/12 "
|
|
20850
|
-
}, this.locale("labels.plan")), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
20851
|
-
className: "plc-w-4/12 "
|
|
20852
|
-
}, this.locale("labels.status.title")), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
20853
|
-
className: "plc-w-3/12 "
|
|
20854
|
-
}, this.locale("labels.actions")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
20855
|
-
className: "plc-h-4"
|
|
20856
|
-
}), subscriptions, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20857
|
-
colSpan: "4",
|
|
20858
|
-
className: "plc-p-1"
|
|
20859
|
-
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
20860
|
-
variant: "ghost",
|
|
20861
|
-
icon: /*#__PURE__*/React__default['default'].createElement(SvgPlus, {
|
|
20862
|
-
className: "plc-w-4 plc-h-4 plc-mr-1"
|
|
20863
|
-
}),
|
|
20864
|
-
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",
|
|
20865
|
-
onClick: this.displayProductSelect
|
|
20866
|
-
}, this.locale("labels.addSubscription")))), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20867
|
-
colSpan: "4",
|
|
20868
|
-
className: "plc-p-1"
|
|
20869
|
-
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
20870
|
-
variant: "ghost",
|
|
20871
|
-
icon: /*#__PURE__*/React__default['default'].createElement(SvgGift, {
|
|
20872
|
-
className: "plc-w-4 plc-h-4 plc-mr-1"
|
|
20873
|
-
}),
|
|
20874
|
-
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",
|
|
20875
|
-
onClick: this.displayRedeem
|
|
20876
|
-
}, this.locale("labels.redeemGift"))))));
|
|
20877
|
-
});
|
|
20878
|
-
|
|
20879
21713
|
_defineProperty$3(this, "renderGiftRecipients", () => {
|
|
20880
21714
|
var _giftRecipients$sort, _giftRecipients$sort$;
|
|
20881
21715
|
|
|
@@ -20913,7 +21747,7 @@ class Dashboard extends React.Component {
|
|
|
20913
21747
|
className: "plc-font-semibold plc-text-gray-500"
|
|
20914
21748
|
}, recipient.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20915
21749
|
className: "plc-text-xs plc-text-gray-400"
|
|
20916
|
-
}, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency,
|
|
21750
|
+
}, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency, getPageOrDefaultLanguage())))), recipient.status && /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20917
21751
|
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`
|
|
20918
21752
|
}, this.getSubscriptionStatus(recipient).icon, this.getSubscriptionStatus(recipient).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20919
21753
|
className: "plc-mb-4 plc-text-xs plc-text-gray-500"
|
|
@@ -21015,28 +21849,33 @@ class Dashboard extends React.Component {
|
|
|
21015
21849
|
this.site = window.Pelcro.site.read();
|
|
21016
21850
|
this.locale = this.props.t;
|
|
21017
21851
|
this.user = window.Pelcro.user.read();
|
|
21852
|
+
this.menuRef = /*#__PURE__*/React__default['default'].createRef();
|
|
21018
21853
|
}
|
|
21019
21854
|
|
|
21020
21855
|
render() {
|
|
21021
|
-
var _window$Pelcro$user$r3, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
|
|
21856
|
+
var _window$Pelcro$user$r3, _window$Pelcro, _window$Pelcro$uiSett, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
|
|
21022
21857
|
|
|
21023
21858
|
const {
|
|
21024
21859
|
isOpen
|
|
21025
21860
|
} = this.state;
|
|
21026
21861
|
const userHasName = this.user.first_name || this.user.last_name;
|
|
21027
21862
|
const profilePicture = (_window$Pelcro$user$r3 = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : userSolidIcon;
|
|
21863
|
+
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;
|
|
21864
|
+
const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
|
|
21028
21865
|
return /*#__PURE__*/React__default['default'].createElement(Transition, {
|
|
21029
21866
|
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",
|
|
21030
21867
|
show: isOpen,
|
|
21031
21868
|
enter: "plc-transform plc-transition plc-duration-500",
|
|
21032
21869
|
enterFrom: "plc-translate-x-full",
|
|
21033
21870
|
enterTo: "plc-translate-x-0",
|
|
21871
|
+
afterEnter: this.initializeHideMenuHandler,
|
|
21034
21872
|
leave: "plc-transform plc-transition plc-duration-500",
|
|
21035
21873
|
leaveFrom: "plc-translate-x-0",
|
|
21036
21874
|
leaveTo: "plc-translate-x-full",
|
|
21037
21875
|
afterLeave: this.props.onClose
|
|
21038
21876
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21039
|
-
id: "pelcro-view-dashboard"
|
|
21877
|
+
id: "pelcro-view-dashboard",
|
|
21878
|
+
ref: this.menuRef
|
|
21040
21879
|
}, /*#__PURE__*/React__default['default'].createElement("header", {
|
|
21041
21880
|
className: "plc-flex plc-flex-col plc-p-4 plc-pl-2 plc-min-h-40 sm:plc-pr-8 plc-bg-primary-500"
|
|
21042
21881
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -21099,7 +21938,14 @@ class Dashboard extends React.Component {
|
|
|
21099
21938
|
}),
|
|
21100
21939
|
className: "plc-text-sm plc-text-gray-500 hover:plc-text-primary-700",
|
|
21101
21940
|
onClick: this.displayChangePassword
|
|
21102
|
-
}, this.locale("labels.changePassword"))
|
|
21941
|
+
}, this.locale("labels.changePassword")), siteHasNewslettersDefined && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21942
|
+
variant: "ghost",
|
|
21943
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgNewsletter, {
|
|
21944
|
+
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
21945
|
+
}),
|
|
21946
|
+
className: "plc-text-sm plc-text-gray-500 hover:plc-text-primary-700",
|
|
21947
|
+
onClick: this.displayNewsletterUpdate
|
|
21948
|
+
}, this.locale("labels.editNewsletters")))
|
|
21103
21949
|
}), /*#__PURE__*/React__default['default'].createElement(Accordion.item, {
|
|
21104
21950
|
name: SUB_MENUS.PAYMENT_CARDS,
|
|
21105
21951
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgPaymentCard, null),
|
|
@@ -21138,7 +21984,18 @@ class Dashboard extends React.Component {
|
|
|
21138
21984
|
className: "plc-w-10 plc-h-10 plc-pt-2 plc-pr-1 plc--ml-2"
|
|
21139
21985
|
}),
|
|
21140
21986
|
title: this.locale("labels.subscriptions"),
|
|
21141
|
-
content:
|
|
21987
|
+
content: /*#__PURE__*/React__default['default'].createElement(SubscriptionsMenu, {
|
|
21988
|
+
onClose: this.props.onClose,
|
|
21989
|
+
cancelSubscription: this.cancelSubscription,
|
|
21990
|
+
reactivateSubscription: this.reactivateSubscription,
|
|
21991
|
+
setProductAndPlan: this.props.setProductAndPlan,
|
|
21992
|
+
setSubscriptionIdToRenew: this.props.setSubscriptionIdToRenew,
|
|
21993
|
+
setView: this.props.setView,
|
|
21994
|
+
getSubscriptionStatus: this.getSubscriptionStatus,
|
|
21995
|
+
disableSubmit: this.state.disableSubmit,
|
|
21996
|
+
displayProductSelect: this.displayProductSelect,
|
|
21997
|
+
displayRedeem: this.displayRedeem
|
|
21998
|
+
})
|
|
21142
21999
|
}), /*#__PURE__*/React__default['default'].createElement(Accordion.item, {
|
|
21143
22000
|
name: SUB_MENUS.GIFTS,
|
|
21144
22001
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgGift, null),
|
|
@@ -21175,7 +22032,7 @@ const DashboardOpenButton = () => {
|
|
|
21175
22032
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21176
22033
|
className: "plc-fixed plc-right-4 plc-bottom-4 pelcro-open-dashboard-btn"
|
|
21177
22034
|
}, /*#__PURE__*/React__default['default'].createElement("button", {
|
|
21178
|
-
className: "plc-bg-white plc-border-2 plc-rounded-full focus:plc-outline-none plc-border-primary-300",
|
|
22035
|
+
className: "plc-bg-white plc-border-2 plc-rounded-full focus:plc-outline-none plc-border-primary-300 hover:plc-bg-white",
|
|
21179
22036
|
name: "menu",
|
|
21180
22037
|
id: "pelcro-view-menu",
|
|
21181
22038
|
onClick: () => switchView("dashboard")
|
|
@@ -23040,6 +23897,7 @@ exports.AddressUpdateSubmit = AddressUpdateSubmit;
|
|
|
23040
23897
|
exports.AddressUpdateTextInput = AddressUpdateTextInput;
|
|
23041
23898
|
exports.AddressUpdateView = AddressUpdateView;
|
|
23042
23899
|
exports.Alert = AlertWithContext;
|
|
23900
|
+
exports.AlertElement = Alert;
|
|
23043
23901
|
exports.ApplyCouponButton = ApplyCouponButton;
|
|
23044
23902
|
exports.Badge = Badge;
|
|
23045
23903
|
exports.BankRedirection = BankRedirection;
|
|
@@ -23091,6 +23949,11 @@ exports.Modal = Modal;
|
|
|
23091
23949
|
exports.ModalBody = ModalBody;
|
|
23092
23950
|
exports.ModalFooter = ModalFooter;
|
|
23093
23951
|
exports.NewsLetter = NewsletterWithHook;
|
|
23952
|
+
exports.NewsletterUpdateButton = NewsletterUpdateButton;
|
|
23953
|
+
exports.NewsletterUpdateContainer = NewsletterUpdateContainer;
|
|
23954
|
+
exports.NewsletterUpdateList = NewsletterUpdateList;
|
|
23955
|
+
exports.NewsletterUpdateModal = NewsletterUpdateModal;
|
|
23956
|
+
exports.NewsletterUpdateView = NewsletterUpdateView;
|
|
23094
23957
|
exports.Notification = Notification;
|
|
23095
23958
|
exports.OrderConfirmModal = OrderConfirmModal;
|
|
23096
23959
|
exports.OrderCreateContainer = OrderCreateContainer;
|
|
@@ -23169,6 +24032,7 @@ exports.SubscriptionCreateView = SubscriptionCreateView;
|
|
|
23169
24032
|
exports.SubscriptionRenewContainer = SubscriptionRenewContainer;
|
|
23170
24033
|
exports.SubscriptionRenewModal = SubscriptionRenewModal;
|
|
23171
24034
|
exports.SubscriptionRenewView = SubscriptionRenewView;
|
|
24035
|
+
exports.TaxAmount = TaxAmount;
|
|
23172
24036
|
exports.TextArea = TextArea;
|
|
23173
24037
|
exports.Tooltip = Tooltip;
|
|
23174
24038
|
exports.UserUpdateButton = UserUpdateButton;
|