@pelcro/react-pelcro-js 3.10.1-beta.1 → 3.10.1-beta.3
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 +31 -21
- package/dist/index.esm.js +31 -21
- 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
|
+
whenSiteReady(() => {
|
|
10537
10538
|
if (!isAuthenticated()) {
|
|
10538
10539
|
return switchView("login");
|
|
10539
10540
|
}
|
|
10540
10541
|
|
|
10541
|
-
|
|
10542
|
-
|
|
10542
|
+
whenUserReady(() => {
|
|
10543
|
+
const invoiceId = window.Pelcro.helpers.getURLParameter("id");
|
|
10544
|
+
const wasSetSuccessfully = setInvoice(invoiceId);
|
|
10543
10545
|
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
|
|
10549
|
-
|
|
10546
|
+
if (!wasSetSuccessfully) {
|
|
10547
|
+
const errorMessage = i18next.t("messages:invalidInvoice", {
|
|
10548
|
+
returnObjects: true
|
|
10549
|
+
});
|
|
10550
|
+
return notify.error(errorMessage);
|
|
10551
|
+
}
|
|
10550
10552
|
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10553
|
+
const {
|
|
10554
|
+
invoice
|
|
10555
|
+
} = usePelcro.getStore();
|
|
10554
10556
|
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10557
|
+
if (invoice.total === 0) {
|
|
10558
|
+
const errorMessage = i18next.t("messages:zeroTotalInvoice", {
|
|
10559
|
+
returnObjects: true
|
|
10560
|
+
});
|
|
10561
|
+
return notify.error(errorMessage);
|
|
10562
|
+
}
|
|
10561
10563
|
|
|
10562
|
-
|
|
10564
|
+
return switchView("invoice-details");
|
|
10565
|
+
});
|
|
10563
10566
|
});
|
|
10564
10567
|
};
|
|
10565
10568
|
|
|
@@ -12232,18 +12235,25 @@ function LoginModal({
|
|
|
12232
12235
|
} = useTranslation("login");
|
|
12233
12236
|
const {
|
|
12234
12237
|
switchView,
|
|
12235
|
-
resetView
|
|
12238
|
+
resetView,
|
|
12239
|
+
invoice
|
|
12236
12240
|
} = usePelcro();
|
|
12237
12241
|
|
|
12238
12242
|
const onSuccess = res => {
|
|
12239
12243
|
var _props$onSuccess;
|
|
12240
12244
|
|
|
12241
12245
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
12242
|
-
resetView();
|
|
12243
12246
|
|
|
12244
12247
|
if (window.Pelcro.paywall.isArticleRestricted()) {
|
|
12245
12248
|
initPaywalls();
|
|
12246
12249
|
}
|
|
12250
|
+
|
|
12251
|
+
resetView();
|
|
12252
|
+
const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
|
|
12253
|
+
|
|
12254
|
+
if (viewFromURL === "invoice-details") {
|
|
12255
|
+
initViewFromURL();
|
|
12256
|
+
}
|
|
12247
12257
|
};
|
|
12248
12258
|
|
|
12249
12259
|
const onCreateAccountClick = () => {
|
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
|
+
whenSiteReady(() => {
|
|
10507
10508
|
if (!isAuthenticated()) {
|
|
10508
10509
|
return switchView("login");
|
|
10509
10510
|
}
|
|
10510
10511
|
|
|
10511
|
-
|
|
10512
|
-
|
|
10512
|
+
whenUserReady(() => {
|
|
10513
|
+
const invoiceId = window.Pelcro.helpers.getURLParameter("id");
|
|
10514
|
+
const wasSetSuccessfully = setInvoice(invoiceId);
|
|
10513
10515
|
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
|
|
10516
|
+
if (!wasSetSuccessfully) {
|
|
10517
|
+
const errorMessage = i18next.t("messages:invalidInvoice", {
|
|
10518
|
+
returnObjects: true
|
|
10519
|
+
});
|
|
10520
|
+
return notify.error(errorMessage);
|
|
10521
|
+
}
|
|
10520
10522
|
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10523
|
+
const {
|
|
10524
|
+
invoice
|
|
10525
|
+
} = usePelcro.getStore();
|
|
10524
10526
|
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10527
|
+
if (invoice.total === 0) {
|
|
10528
|
+
const errorMessage = i18next.t("messages:zeroTotalInvoice", {
|
|
10529
|
+
returnObjects: true
|
|
10530
|
+
});
|
|
10531
|
+
return notify.error(errorMessage);
|
|
10532
|
+
}
|
|
10531
10533
|
|
|
10532
|
-
|
|
10534
|
+
return switchView("invoice-details");
|
|
10535
|
+
});
|
|
10533
10536
|
});
|
|
10534
10537
|
};
|
|
10535
10538
|
|
|
@@ -12202,18 +12205,25 @@ function LoginModal({
|
|
|
12202
12205
|
} = useTranslation("login");
|
|
12203
12206
|
const {
|
|
12204
12207
|
switchView,
|
|
12205
|
-
resetView
|
|
12208
|
+
resetView,
|
|
12209
|
+
invoice
|
|
12206
12210
|
} = usePelcro();
|
|
12207
12211
|
|
|
12208
12212
|
const onSuccess = res => {
|
|
12209
12213
|
var _props$onSuccess;
|
|
12210
12214
|
|
|
12211
12215
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
12212
|
-
resetView();
|
|
12213
12216
|
|
|
12214
12217
|
if (window.Pelcro.paywall.isArticleRestricted()) {
|
|
12215
12218
|
initPaywalls();
|
|
12216
12219
|
}
|
|
12220
|
+
|
|
12221
|
+
resetView();
|
|
12222
|
+
const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
|
|
12223
|
+
|
|
12224
|
+
if (viewFromURL === "invoice-details") {
|
|
12225
|
+
initViewFromURL();
|
|
12226
|
+
}
|
|
12217
12227
|
};
|
|
12218
12228
|
|
|
12219
12229
|
const onCreateAccountClick = () => {
|