@pelcro/react-pelcro-js 3.13.0-beta.3 → 3.13.0-beta.5
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 +17 -6
- package/dist/index.esm.js +17 -6
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -11566,6 +11566,14 @@ const RegisterContainer = ({
|
|
|
11566
11566
|
});
|
|
11567
11567
|
|
|
11568
11568
|
if (err) {
|
|
11569
|
+
var _err$response, _err$response$data;
|
|
11570
|
+
|
|
11571
|
+
let {
|
|
11572
|
+
registered_on_other_sites,
|
|
11573
|
+
...errors
|
|
11574
|
+
} = err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.errors;
|
|
11575
|
+
err.response.data.errors = { ...errors
|
|
11576
|
+
};
|
|
11569
11577
|
dispatch({
|
|
11570
11578
|
type: SHOW_ALERT,
|
|
11571
11579
|
payload: {
|
|
@@ -16486,8 +16494,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16486
16494
|
} else {
|
|
16487
16495
|
if (isRenewingGift) {
|
|
16488
16496
|
window.Pelcro.subscription.renewGift({
|
|
16489
|
-
source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
|
|
16490
|
-
stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
|
|
16497
|
+
source_id: stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
|
|
16498
|
+
stripe_token: !(stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource) ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
|
|
16491
16499
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
16492
16500
|
plan_id: plan.id,
|
|
16493
16501
|
quantity: plan.quantity,
|
|
@@ -16519,8 +16527,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16519
16527
|
});
|
|
16520
16528
|
} else {
|
|
16521
16529
|
window.Pelcro.subscription.renew({
|
|
16522
|
-
source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
|
|
16523
|
-
stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
|
|
16530
|
+
source_id: stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
|
|
16531
|
+
stripe_token: !(stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource) ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
|
|
16524
16532
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
16525
16533
|
plan_id: plan.id,
|
|
16526
16534
|
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
@@ -18136,7 +18144,7 @@ const SubscriptionRenewView = ({
|
|
|
18136
18144
|
onGiftRenewalSuccess = () => {},
|
|
18137
18145
|
onFailure = () => {}
|
|
18138
18146
|
}) => {
|
|
18139
|
-
var _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
|
|
18147
|
+
var _window$Pelcro, _window$Pelcro$uiSett, _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
|
|
18140
18148
|
|
|
18141
18149
|
const {
|
|
18142
18150
|
t
|
|
@@ -18145,6 +18153,8 @@ const SubscriptionRenewView = ({
|
|
|
18145
18153
|
product,
|
|
18146
18154
|
plan
|
|
18147
18155
|
} = usePelcro();
|
|
18156
|
+
const skipPayment = (_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.skipPaymentForFreePlans;
|
|
18157
|
+
const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
|
|
18148
18158
|
|
|
18149
18159
|
const getPricingText = plan => {
|
|
18150
18160
|
const autoRenewed = plan.auto_renew;
|
|
@@ -18181,7 +18191,8 @@ const SubscriptionRenewView = ({
|
|
|
18181
18191
|
showExternalPaymentMethods: false,
|
|
18182
18192
|
onSuccess: onSuccess,
|
|
18183
18193
|
onGiftRenewalSuccess: onGiftRenewalSuccess,
|
|
18184
|
-
onFailure: onFailure
|
|
18194
|
+
onFailure: onFailure,
|
|
18195
|
+
showSubscriptionButton: showSubscriptionButton
|
|
18185
18196
|
}));
|
|
18186
18197
|
};
|
|
18187
18198
|
|
package/dist/index.esm.js
CHANGED
|
@@ -11536,6 +11536,14 @@ const RegisterContainer = ({
|
|
|
11536
11536
|
});
|
|
11537
11537
|
|
|
11538
11538
|
if (err) {
|
|
11539
|
+
var _err$response, _err$response$data;
|
|
11540
|
+
|
|
11541
|
+
let {
|
|
11542
|
+
registered_on_other_sites,
|
|
11543
|
+
...errors
|
|
11544
|
+
} = err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.errors;
|
|
11545
|
+
err.response.data.errors = { ...errors
|
|
11546
|
+
};
|
|
11539
11547
|
dispatch({
|
|
11540
11548
|
type: SHOW_ALERT,
|
|
11541
11549
|
payload: {
|
|
@@ -16456,8 +16464,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16456
16464
|
} else {
|
|
16457
16465
|
if (isRenewingGift) {
|
|
16458
16466
|
window.Pelcro.subscription.renewGift({
|
|
16459
|
-
source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
|
|
16460
|
-
stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
|
|
16467
|
+
source_id: stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
|
|
16468
|
+
stripe_token: !(stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource) ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
|
|
16461
16469
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
16462
16470
|
plan_id: plan.id,
|
|
16463
16471
|
quantity: plan.quantity,
|
|
@@ -16489,8 +16497,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16489
16497
|
});
|
|
16490
16498
|
} else {
|
|
16491
16499
|
window.Pelcro.subscription.renew({
|
|
16492
|
-
source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
|
|
16493
|
-
stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
|
|
16500
|
+
source_id: stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
|
|
16501
|
+
stripe_token: !(stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource) ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
|
|
16494
16502
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
16495
16503
|
plan_id: plan.id,
|
|
16496
16504
|
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
@@ -18106,7 +18114,7 @@ const SubscriptionRenewView = ({
|
|
|
18106
18114
|
onGiftRenewalSuccess = () => {},
|
|
18107
18115
|
onFailure = () => {}
|
|
18108
18116
|
}) => {
|
|
18109
|
-
var _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
|
|
18117
|
+
var _window$Pelcro, _window$Pelcro$uiSett, _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
|
|
18110
18118
|
|
|
18111
18119
|
const {
|
|
18112
18120
|
t
|
|
@@ -18115,6 +18123,8 @@ const SubscriptionRenewView = ({
|
|
|
18115
18123
|
product,
|
|
18116
18124
|
plan
|
|
18117
18125
|
} = usePelcro();
|
|
18126
|
+
const skipPayment = (_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.skipPaymentForFreePlans;
|
|
18127
|
+
const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
|
|
18118
18128
|
|
|
18119
18129
|
const getPricingText = plan => {
|
|
18120
18130
|
const autoRenewed = plan.auto_renew;
|
|
@@ -18151,7 +18161,8 @@ const SubscriptionRenewView = ({
|
|
|
18151
18161
|
showExternalPaymentMethods: false,
|
|
18152
18162
|
onSuccess: onSuccess,
|
|
18153
18163
|
onGiftRenewalSuccess: onGiftRenewalSuccess,
|
|
18154
|
-
onFailure: onFailure
|
|
18164
|
+
onFailure: onFailure,
|
|
18165
|
+
showSubscriptionButton: showSubscriptionButton
|
|
18155
18166
|
}));
|
|
18156
18167
|
};
|
|
18157
18168
|
|