@pelcro/react-pelcro-js 3.10.1-beta.2 → 3.10.1-beta.4
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 +40 -32
- package/dist/index.esm.js +40 -32
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -10531,35 +10531,38 @@ const showInvoiceDetailsFromUrl = () => {
|
|
|
10531
10531
|
isAuthenticated,
|
|
10532
10532
|
setInvoice,
|
|
10533
10533
|
whenUserReady,
|
|
10534
|
+
whenSiteReady,
|
|
10534
10535
|
switchView
|
|
10535
10536
|
} = usePelcro.getStore();
|
|
10536
|
-
|
|
10537
|
-
const invoiceId = window.Pelcro.helpers.getURLParameter("id");
|
|
10538
|
-
const wasSetSuccessfully = setInvoice(invoiceId);
|
|
10539
|
-
|
|
10540
|
-
if (!wasSetSuccessfully) {
|
|
10541
|
-
const errorMessage = i18next.t("messages:invalidInvoice", {
|
|
10542
|
-
returnObjects: true
|
|
10543
|
-
});
|
|
10544
|
-
return notify.error(errorMessage);
|
|
10545
|
-
}
|
|
10546
|
-
|
|
10537
|
+
whenSiteReady(() => {
|
|
10547
10538
|
if (!isAuthenticated()) {
|
|
10548
10539
|
return switchView("login");
|
|
10549
10540
|
}
|
|
10550
10541
|
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10542
|
+
whenUserReady(() => {
|
|
10543
|
+
const invoiceId = window.Pelcro.helpers.getURLParameter("id");
|
|
10544
|
+
const wasSetSuccessfully = setInvoice(invoiceId);
|
|
10554
10545
|
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10546
|
+
if (!wasSetSuccessfully) {
|
|
10547
|
+
const errorMessage = i18next.t("messages:invalidInvoice", {
|
|
10548
|
+
returnObjects: true
|
|
10549
|
+
});
|
|
10550
|
+
return notify.error(errorMessage);
|
|
10551
|
+
}
|
|
10561
10552
|
|
|
10562
|
-
|
|
10553
|
+
const {
|
|
10554
|
+
invoice
|
|
10555
|
+
} = usePelcro.getStore();
|
|
10556
|
+
|
|
10557
|
+
if (invoice.total === 0) {
|
|
10558
|
+
const errorMessage = i18next.t("messages:zeroTotalInvoice", {
|
|
10559
|
+
returnObjects: true
|
|
10560
|
+
});
|
|
10561
|
+
return notify.error(errorMessage);
|
|
10562
|
+
}
|
|
10563
|
+
|
|
10564
|
+
return switchView("invoice-details");
|
|
10565
|
+
});
|
|
10563
10566
|
});
|
|
10564
10567
|
};
|
|
10565
10568
|
|
|
@@ -12239,17 +12242,18 @@ function LoginModal({
|
|
|
12239
12242
|
const onSuccess = res => {
|
|
12240
12243
|
var _props$onSuccess;
|
|
12241
12244
|
|
|
12242
|
-
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
12243
|
-
|
|
12244
|
-
if (invoice) {
|
|
12245
|
-
switchView("invoice-details");
|
|
12246
|
-
}
|
|
12245
|
+
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
12247
12246
|
|
|
12248
12247
|
if (window.Pelcro.paywall.isArticleRestricted()) {
|
|
12249
12248
|
initPaywalls();
|
|
12250
12249
|
}
|
|
12251
12250
|
|
|
12252
12251
|
resetView();
|
|
12252
|
+
const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
|
|
12253
|
+
|
|
12254
|
+
if (viewFromURL === "invoice-details") {
|
|
12255
|
+
initViewFromURL();
|
|
12256
|
+
}
|
|
12253
12257
|
};
|
|
12254
12258
|
|
|
12255
12259
|
const onCreateAccountClick = () => {
|
|
@@ -16079,7 +16083,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16079
16083
|
|
|
16080
16084
|
if (err) {
|
|
16081
16085
|
onFailure(err);
|
|
16082
|
-
console.error(err);
|
|
16083
16086
|
dispatch({
|
|
16084
16087
|
type: SET_COUPON_ERROR,
|
|
16085
16088
|
payload: getErrorMessages(err)
|
|
@@ -17081,12 +17084,17 @@ const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
|
|
|
17081
17084
|
|
|
17082
17085
|
const PaymentMethodContainer = props => {
|
|
17083
17086
|
const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
|
|
17087
|
+
const {
|
|
17088
|
+
whenUserReady
|
|
17089
|
+
} = usePelcro.getStore();
|
|
17084
17090
|
React.useEffect(() => {
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
|
|
17088
|
-
|
|
17089
|
-
|
|
17091
|
+
whenUserReady(() => {
|
|
17092
|
+
if (!window.Stripe) {
|
|
17093
|
+
document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
|
|
17094
|
+
setIsStripeLoaded(true);
|
|
17095
|
+
});
|
|
17096
|
+
}
|
|
17097
|
+
});
|
|
17090
17098
|
}, []);
|
|
17091
17099
|
|
|
17092
17100
|
if (isStripeLoaded) {
|
package/dist/index.esm.js
CHANGED
|
@@ -10501,35 +10501,38 @@ const showInvoiceDetailsFromUrl = () => {
|
|
|
10501
10501
|
isAuthenticated,
|
|
10502
10502
|
setInvoice,
|
|
10503
10503
|
whenUserReady,
|
|
10504
|
+
whenSiteReady,
|
|
10504
10505
|
switchView
|
|
10505
10506
|
} = usePelcro.getStore();
|
|
10506
|
-
|
|
10507
|
-
const invoiceId = window.Pelcro.helpers.getURLParameter("id");
|
|
10508
|
-
const wasSetSuccessfully = setInvoice(invoiceId);
|
|
10509
|
-
|
|
10510
|
-
if (!wasSetSuccessfully) {
|
|
10511
|
-
const errorMessage = i18next.t("messages:invalidInvoice", {
|
|
10512
|
-
returnObjects: true
|
|
10513
|
-
});
|
|
10514
|
-
return notify.error(errorMessage);
|
|
10515
|
-
}
|
|
10516
|
-
|
|
10507
|
+
whenSiteReady(() => {
|
|
10517
10508
|
if (!isAuthenticated()) {
|
|
10518
10509
|
return switchView("login");
|
|
10519
10510
|
}
|
|
10520
10511
|
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10512
|
+
whenUserReady(() => {
|
|
10513
|
+
const invoiceId = window.Pelcro.helpers.getURLParameter("id");
|
|
10514
|
+
const wasSetSuccessfully = setInvoice(invoiceId);
|
|
10524
10515
|
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10516
|
+
if (!wasSetSuccessfully) {
|
|
10517
|
+
const errorMessage = i18next.t("messages:invalidInvoice", {
|
|
10518
|
+
returnObjects: true
|
|
10519
|
+
});
|
|
10520
|
+
return notify.error(errorMessage);
|
|
10521
|
+
}
|
|
10531
10522
|
|
|
10532
|
-
|
|
10523
|
+
const {
|
|
10524
|
+
invoice
|
|
10525
|
+
} = usePelcro.getStore();
|
|
10526
|
+
|
|
10527
|
+
if (invoice.total === 0) {
|
|
10528
|
+
const errorMessage = i18next.t("messages:zeroTotalInvoice", {
|
|
10529
|
+
returnObjects: true
|
|
10530
|
+
});
|
|
10531
|
+
return notify.error(errorMessage);
|
|
10532
|
+
}
|
|
10533
|
+
|
|
10534
|
+
return switchView("invoice-details");
|
|
10535
|
+
});
|
|
10533
10536
|
});
|
|
10534
10537
|
};
|
|
10535
10538
|
|
|
@@ -12209,17 +12212,18 @@ function LoginModal({
|
|
|
12209
12212
|
const onSuccess = res => {
|
|
12210
12213
|
var _props$onSuccess;
|
|
12211
12214
|
|
|
12212
|
-
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
12213
|
-
|
|
12214
|
-
if (invoice) {
|
|
12215
|
-
switchView("invoice-details");
|
|
12216
|
-
}
|
|
12215
|
+
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
12217
12216
|
|
|
12218
12217
|
if (window.Pelcro.paywall.isArticleRestricted()) {
|
|
12219
12218
|
initPaywalls();
|
|
12220
12219
|
}
|
|
12221
12220
|
|
|
12222
12221
|
resetView();
|
|
12222
|
+
const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
|
|
12223
|
+
|
|
12224
|
+
if (viewFromURL === "invoice-details") {
|
|
12225
|
+
initViewFromURL();
|
|
12226
|
+
}
|
|
12223
12227
|
};
|
|
12224
12228
|
|
|
12225
12229
|
const onCreateAccountClick = () => {
|
|
@@ -16049,7 +16053,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16049
16053
|
|
|
16050
16054
|
if (err) {
|
|
16051
16055
|
onFailure(err);
|
|
16052
|
-
console.error(err);
|
|
16053
16056
|
dispatch({
|
|
16054
16057
|
type: SET_COUPON_ERROR,
|
|
16055
16058
|
payload: getErrorMessages(err)
|
|
@@ -17051,12 +17054,17 @@ const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
|
|
|
17051
17054
|
|
|
17052
17055
|
const PaymentMethodContainer = props => {
|
|
17053
17056
|
const [isStripeLoaded, setIsStripeLoaded] = useState(Boolean(window.Stripe));
|
|
17057
|
+
const {
|
|
17058
|
+
whenUserReady
|
|
17059
|
+
} = usePelcro.getStore();
|
|
17054
17060
|
useEffect(() => {
|
|
17055
|
-
|
|
17056
|
-
|
|
17057
|
-
|
|
17058
|
-
|
|
17059
|
-
|
|
17061
|
+
whenUserReady(() => {
|
|
17062
|
+
if (!window.Stripe) {
|
|
17063
|
+
document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
|
|
17064
|
+
setIsStripeLoaded(true);
|
|
17065
|
+
});
|
|
17066
|
+
}
|
|
17067
|
+
});
|
|
17060
17068
|
}, []);
|
|
17061
17069
|
|
|
17062
17070
|
if (isStripeLoaded) {
|