@pelcro/react-pelcro-js 2.7.0-beta.13 → 2.7.0-beta.14
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 +36 -9
- package/dist/index.esm.js +36 -9
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -5984,13 +5984,8 @@ class PelcroActions {
|
|
|
5984
5984
|
});
|
|
5985
5985
|
|
|
5986
5986
|
_defineProperty$3(this, "switchView", view => {
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
const isEmailVerificationEnabled = (_window$Pelcro$site$r = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.email_verify_enabled) !== null && _window$Pelcro$site$r !== void 0 ? _window$Pelcro$site$r : false;
|
|
5990
|
-
const isUserEmailVerified = (_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_confirm) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : false;
|
|
5991
|
-
const userMustVerifyEmail = this.get().isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified; // view switching guards
|
|
5992
|
-
|
|
5993
|
-
if (userMustVerifyEmail && !["dashboard", "meter", "login", null].includes(view)) {
|
|
5987
|
+
// view switching guards
|
|
5988
|
+
if (userMustVerifyEmail() && !["dashboard", "meter", "login", null].includes(view)) {
|
|
5994
5989
|
return this.set({
|
|
5995
5990
|
view: "email-verify"
|
|
5996
5991
|
});
|
|
@@ -6656,6 +6651,13 @@ function getDateWithoutTime(dateObject) {
|
|
|
6656
6651
|
date.setHours(0, 0, 0, 0);
|
|
6657
6652
|
return date;
|
|
6658
6653
|
}
|
|
6654
|
+
function userMustVerifyEmail() {
|
|
6655
|
+
var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
|
|
6656
|
+
|
|
6657
|
+
const isEmailVerificationEnabled = (_window$Pelcro$site$r3 = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.email_verify_enabled) !== null && _window$Pelcro$site$r3 !== void 0 ? _window$Pelcro$site$r3 : false;
|
|
6658
|
+
const isUserEmailVerified = (_window$Pelcro$user$r9 = (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.email_confirm) !== null && _window$Pelcro$user$r9 !== void 0 ? _window$Pelcro$user$r9 : false;
|
|
6659
|
+
return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
|
|
6660
|
+
}
|
|
6659
6661
|
|
|
6660
6662
|
const resources = {
|
|
6661
6663
|
en: {
|
|
@@ -6859,11 +6861,18 @@ class SaveToMetadataButtonClass {
|
|
|
6859
6861
|
|
|
6860
6862
|
const button = event.currentTarget;
|
|
6861
6863
|
const user = window.Pelcro.user.read();
|
|
6864
|
+
const {
|
|
6865
|
+
switchView
|
|
6866
|
+
} = usePelcro.getStore();
|
|
6862
6867
|
const {
|
|
6863
6868
|
key,
|
|
6864
6869
|
...buttonMetadata
|
|
6865
6870
|
} = button.dataset;
|
|
6866
6871
|
|
|
6872
|
+
if (userMustVerifyEmail()) {
|
|
6873
|
+
return switchView("email-verify");
|
|
6874
|
+
}
|
|
6875
|
+
|
|
6867
6876
|
if (_classPrivateFieldGet(this, _isAlreadySaved).call(this, button)) {
|
|
6868
6877
|
_classPrivateFieldGet(this, _removeMetaData).call(this, event);
|
|
6869
6878
|
|
|
@@ -10941,15 +10950,21 @@ function RegisterModal(props) {
|
|
|
10941
10950
|
};
|
|
10942
10951
|
|
|
10943
10952
|
const handleAfterRegistrationLogic = () => {
|
|
10944
|
-
var _ReactGA$event;
|
|
10953
|
+
var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
10945
10954
|
|
|
10946
10955
|
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
10947
10956
|
category: "ACTIONS",
|
|
10948
10957
|
action: "Registered",
|
|
10949
10958
|
nonInteraction: true
|
|
10950
|
-
});
|
|
10959
|
+
});
|
|
10960
|
+
const isEmailVerificationEnabled = (_window$Pelcro$site$r = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.email_verify_enabled) !== null && _window$Pelcro$site$r !== void 0 ? _window$Pelcro$site$r : false;
|
|
10961
|
+
|
|
10962
|
+
if (isEmailVerificationEnabled) {
|
|
10963
|
+
return switchView("email-verify");
|
|
10964
|
+
}
|
|
10951
10965
|
|
|
10952
10966
|
if (!product && !order && !giftCode) {
|
|
10967
|
+
// If product and plan are not selected
|
|
10953
10968
|
return resetView();
|
|
10954
10969
|
} // If this is a redeem gift
|
|
10955
10970
|
|
|
@@ -21450,12 +21465,20 @@ const SubscriptionsItems = ({
|
|
|
21450
21465
|
const {
|
|
21451
21466
|
t
|
|
21452
21467
|
} = useTranslation("dashboard");
|
|
21468
|
+
const {
|
|
21469
|
+
switchView,
|
|
21470
|
+
isAuthenticated
|
|
21471
|
+
} = usePelcro();
|
|
21453
21472
|
const subs = getNonDonationSubs();
|
|
21454
21473
|
if (subs.length === 0) return null;
|
|
21455
21474
|
return subs.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
|
|
21456
21475
|
const isActive = activeMenu === sub.id; // Cancel button click handlers
|
|
21457
21476
|
|
|
21458
21477
|
const onCancelClick = () => {
|
|
21478
|
+
if (userMustVerifyEmail()) {
|
|
21479
|
+
return switchView("email-verify");
|
|
21480
|
+
}
|
|
21481
|
+
|
|
21459
21482
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
21460
21483
|
notify.confirm((onSuccess, onFailure) => {
|
|
21461
21484
|
cancelSubscription(sub.id, onSuccess, onFailure);
|
|
@@ -21471,6 +21494,10 @@ const SubscriptionsItems = ({
|
|
|
21471
21494
|
|
|
21472
21495
|
|
|
21473
21496
|
const onReactivateClick = () => {
|
|
21497
|
+
if (userMustVerifyEmail()) {
|
|
21498
|
+
return switchView("email-verify");
|
|
21499
|
+
}
|
|
21500
|
+
|
|
21474
21501
|
reactivateSubscription(sub.id);
|
|
21475
21502
|
}; // Renew click
|
|
21476
21503
|
|
package/dist/index.esm.js
CHANGED
|
@@ -5954,13 +5954,8 @@ class PelcroActions {
|
|
|
5954
5954
|
});
|
|
5955
5955
|
|
|
5956
5956
|
_defineProperty$3(this, "switchView", view => {
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
const isEmailVerificationEnabled = (_window$Pelcro$site$r = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.email_verify_enabled) !== null && _window$Pelcro$site$r !== void 0 ? _window$Pelcro$site$r : false;
|
|
5960
|
-
const isUserEmailVerified = (_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_confirm) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : false;
|
|
5961
|
-
const userMustVerifyEmail = this.get().isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified; // view switching guards
|
|
5962
|
-
|
|
5963
|
-
if (userMustVerifyEmail && !["dashboard", "meter", "login", null].includes(view)) {
|
|
5957
|
+
// view switching guards
|
|
5958
|
+
if (userMustVerifyEmail() && !["dashboard", "meter", "login", null].includes(view)) {
|
|
5964
5959
|
return this.set({
|
|
5965
5960
|
view: "email-verify"
|
|
5966
5961
|
});
|
|
@@ -6626,6 +6621,13 @@ function getDateWithoutTime(dateObject) {
|
|
|
6626
6621
|
date.setHours(0, 0, 0, 0);
|
|
6627
6622
|
return date;
|
|
6628
6623
|
}
|
|
6624
|
+
function userMustVerifyEmail() {
|
|
6625
|
+
var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
|
|
6626
|
+
|
|
6627
|
+
const isEmailVerificationEnabled = (_window$Pelcro$site$r3 = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.email_verify_enabled) !== null && _window$Pelcro$site$r3 !== void 0 ? _window$Pelcro$site$r3 : false;
|
|
6628
|
+
const isUserEmailVerified = (_window$Pelcro$user$r9 = (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.email_confirm) !== null && _window$Pelcro$user$r9 !== void 0 ? _window$Pelcro$user$r9 : false;
|
|
6629
|
+
return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
|
|
6630
|
+
}
|
|
6629
6631
|
|
|
6630
6632
|
const resources = {
|
|
6631
6633
|
en: {
|
|
@@ -6829,11 +6831,18 @@ class SaveToMetadataButtonClass {
|
|
|
6829
6831
|
|
|
6830
6832
|
const button = event.currentTarget;
|
|
6831
6833
|
const user = window.Pelcro.user.read();
|
|
6834
|
+
const {
|
|
6835
|
+
switchView
|
|
6836
|
+
} = usePelcro.getStore();
|
|
6832
6837
|
const {
|
|
6833
6838
|
key,
|
|
6834
6839
|
...buttonMetadata
|
|
6835
6840
|
} = button.dataset;
|
|
6836
6841
|
|
|
6842
|
+
if (userMustVerifyEmail()) {
|
|
6843
|
+
return switchView("email-verify");
|
|
6844
|
+
}
|
|
6845
|
+
|
|
6837
6846
|
if (_classPrivateFieldGet(this, _isAlreadySaved).call(this, button)) {
|
|
6838
6847
|
_classPrivateFieldGet(this, _removeMetaData).call(this, event);
|
|
6839
6848
|
|
|
@@ -10911,15 +10920,21 @@ function RegisterModal(props) {
|
|
|
10911
10920
|
};
|
|
10912
10921
|
|
|
10913
10922
|
const handleAfterRegistrationLogic = () => {
|
|
10914
|
-
var _ReactGA$event;
|
|
10923
|
+
var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
10915
10924
|
|
|
10916
10925
|
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
10917
10926
|
category: "ACTIONS",
|
|
10918
10927
|
action: "Registered",
|
|
10919
10928
|
nonInteraction: true
|
|
10920
|
-
});
|
|
10929
|
+
});
|
|
10930
|
+
const isEmailVerificationEnabled = (_window$Pelcro$site$r = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.email_verify_enabled) !== null && _window$Pelcro$site$r !== void 0 ? _window$Pelcro$site$r : false;
|
|
10931
|
+
|
|
10932
|
+
if (isEmailVerificationEnabled) {
|
|
10933
|
+
return switchView("email-verify");
|
|
10934
|
+
}
|
|
10921
10935
|
|
|
10922
10936
|
if (!product && !order && !giftCode) {
|
|
10937
|
+
// If product and plan are not selected
|
|
10923
10938
|
return resetView();
|
|
10924
10939
|
} // If this is a redeem gift
|
|
10925
10940
|
|
|
@@ -21420,12 +21435,20 @@ const SubscriptionsItems = ({
|
|
|
21420
21435
|
const {
|
|
21421
21436
|
t
|
|
21422
21437
|
} = useTranslation("dashboard");
|
|
21438
|
+
const {
|
|
21439
|
+
switchView,
|
|
21440
|
+
isAuthenticated
|
|
21441
|
+
} = usePelcro();
|
|
21423
21442
|
const subs = getNonDonationSubs();
|
|
21424
21443
|
if (subs.length === 0) return null;
|
|
21425
21444
|
return subs.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
|
|
21426
21445
|
const isActive = activeMenu === sub.id; // Cancel button click handlers
|
|
21427
21446
|
|
|
21428
21447
|
const onCancelClick = () => {
|
|
21448
|
+
if (userMustVerifyEmail()) {
|
|
21449
|
+
return switchView("email-verify");
|
|
21450
|
+
}
|
|
21451
|
+
|
|
21429
21452
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
21430
21453
|
notify.confirm((onSuccess, onFailure) => {
|
|
21431
21454
|
cancelSubscription(sub.id, onSuccess, onFailure);
|
|
@@ -21441,6 +21464,10 @@ const SubscriptionsItems = ({
|
|
|
21441
21464
|
|
|
21442
21465
|
|
|
21443
21466
|
const onReactivateClick = () => {
|
|
21467
|
+
if (userMustVerifyEmail()) {
|
|
21468
|
+
return switchView("email-verify");
|
|
21469
|
+
}
|
|
21470
|
+
|
|
21444
21471
|
reactivateSubscription(sub.id);
|
|
21445
21472
|
}; // Renew click
|
|
21446
21473
|
|