@pelcro/react-pelcro-js 3.26.0-beta.40 → 3.26.0-beta.41
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 +26 -6
- package/dist/index.esm.js +26 -6
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -14459,14 +14459,37 @@ function LoginModal(_ref) {
|
|
|
14459
14459
|
plan,
|
|
14460
14460
|
order,
|
|
14461
14461
|
switchToAddressView,
|
|
14462
|
-
switchToPaymentView
|
|
14462
|
+
switchToPaymentView,
|
|
14463
|
+
giftCode,
|
|
14464
|
+
isGift
|
|
14463
14465
|
} = usePelcro();
|
|
14464
14466
|
const onSuccess = res => {
|
|
14465
14467
|
var _props$onSuccess;
|
|
14466
14468
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
14469
|
+
handleAfterLoginLogic();
|
|
14470
|
+
};
|
|
14471
|
+
const handleAfterLoginLogic = () => {
|
|
14467
14472
|
if (window.Pelcro.paywall.isArticleRestricted()) {
|
|
14468
14473
|
initPaywalls();
|
|
14469
14474
|
}
|
|
14475
|
+
if (!product && !order && !giftCode) {
|
|
14476
|
+
// If product and plan are not selected
|
|
14477
|
+
return resetView();
|
|
14478
|
+
}
|
|
14479
|
+
|
|
14480
|
+
// If this is a redeem gift
|
|
14481
|
+
if (giftCode) {
|
|
14482
|
+
return switchView("gift-redeem");
|
|
14483
|
+
// return switchToAddressView();
|
|
14484
|
+
}
|
|
14485
|
+
|
|
14486
|
+
// Check if the subscription is meant as a gift (if so, gather recipients info)
|
|
14487
|
+
if (isGift) {
|
|
14488
|
+
return switchView("gift-create");
|
|
14489
|
+
}
|
|
14490
|
+
if (order) {
|
|
14491
|
+
return switchToAddressView();
|
|
14492
|
+
}
|
|
14470
14493
|
if (product && plan) {
|
|
14471
14494
|
if (product.address_required) {
|
|
14472
14495
|
return switchToAddressView();
|
|
@@ -14477,15 +14500,12 @@ function LoginModal(_ref) {
|
|
|
14477
14500
|
if (product && !plan) {
|
|
14478
14501
|
return switchView("plan-select");
|
|
14479
14502
|
}
|
|
14480
|
-
if (order) {
|
|
14481
|
-
return switchToAddressView();
|
|
14482
|
-
}
|
|
14483
|
-
resetView();
|
|
14484
14503
|
const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
|
|
14485
14504
|
const viewsURLs = ["invoice-details", "gift-redeem", "plan-select", "payment-method-update"];
|
|
14486
14505
|
if (viewsURLs.includes(viewFromURL)) {
|
|
14487
|
-
initViewFromURL();
|
|
14506
|
+
return initViewFromURL();
|
|
14488
14507
|
}
|
|
14508
|
+
return resetView();
|
|
14489
14509
|
};
|
|
14490
14510
|
const onCreateAccountClick = () => {
|
|
14491
14511
|
switchView("plan-select");
|
package/dist/index.esm.js
CHANGED
|
@@ -14429,14 +14429,37 @@ function LoginModal(_ref) {
|
|
|
14429
14429
|
plan,
|
|
14430
14430
|
order,
|
|
14431
14431
|
switchToAddressView,
|
|
14432
|
-
switchToPaymentView
|
|
14432
|
+
switchToPaymentView,
|
|
14433
|
+
giftCode,
|
|
14434
|
+
isGift
|
|
14433
14435
|
} = usePelcro();
|
|
14434
14436
|
const onSuccess = res => {
|
|
14435
14437
|
var _props$onSuccess;
|
|
14436
14438
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
14439
|
+
handleAfterLoginLogic();
|
|
14440
|
+
};
|
|
14441
|
+
const handleAfterLoginLogic = () => {
|
|
14437
14442
|
if (window.Pelcro.paywall.isArticleRestricted()) {
|
|
14438
14443
|
initPaywalls();
|
|
14439
14444
|
}
|
|
14445
|
+
if (!product && !order && !giftCode) {
|
|
14446
|
+
// If product and plan are not selected
|
|
14447
|
+
return resetView();
|
|
14448
|
+
}
|
|
14449
|
+
|
|
14450
|
+
// If this is a redeem gift
|
|
14451
|
+
if (giftCode) {
|
|
14452
|
+
return switchView("gift-redeem");
|
|
14453
|
+
// return switchToAddressView();
|
|
14454
|
+
}
|
|
14455
|
+
|
|
14456
|
+
// Check if the subscription is meant as a gift (if so, gather recipients info)
|
|
14457
|
+
if (isGift) {
|
|
14458
|
+
return switchView("gift-create");
|
|
14459
|
+
}
|
|
14460
|
+
if (order) {
|
|
14461
|
+
return switchToAddressView();
|
|
14462
|
+
}
|
|
14440
14463
|
if (product && plan) {
|
|
14441
14464
|
if (product.address_required) {
|
|
14442
14465
|
return switchToAddressView();
|
|
@@ -14447,15 +14470,12 @@ function LoginModal(_ref) {
|
|
|
14447
14470
|
if (product && !plan) {
|
|
14448
14471
|
return switchView("plan-select");
|
|
14449
14472
|
}
|
|
14450
|
-
if (order) {
|
|
14451
|
-
return switchToAddressView();
|
|
14452
|
-
}
|
|
14453
|
-
resetView();
|
|
14454
14473
|
const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
|
|
14455
14474
|
const viewsURLs = ["invoice-details", "gift-redeem", "plan-select", "payment-method-update"];
|
|
14456
14475
|
if (viewsURLs.includes(viewFromURL)) {
|
|
14457
|
-
initViewFromURL();
|
|
14476
|
+
return initViewFromURL();
|
|
14458
14477
|
}
|
|
14478
|
+
return resetView();
|
|
14459
14479
|
};
|
|
14460
14480
|
const onCreateAccountClick = () => {
|
|
14461
14481
|
switchView("plan-select");
|