@pelcro/react-pelcro-js 2.7.0-beta.11 → 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 +56 -36
- package/dist/index.esm.js +56 -36
- package/dist/pelcro.css +4 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -4603,13 +4603,13 @@ var notification_fr = {
|
|
|
4603
4603
|
};
|
|
4604
4604
|
|
|
4605
4605
|
var labels$1 = {
|
|
4606
|
-
title: "Verify your
|
|
4607
|
-
instructions: "
|
|
4608
|
-
resend: "Resend
|
|
4606
|
+
title: "Verify your email",
|
|
4607
|
+
instructions: "You're on your way!\nLet's confirm your email address.\nClick on the verification link we've sent to your email:",
|
|
4608
|
+
resend: "Resend email"
|
|
4609
4609
|
};
|
|
4610
4610
|
var messages$1 = {
|
|
4611
4611
|
resent: "Resent successfully",
|
|
4612
|
-
success: "
|
|
4612
|
+
success: "Email verified successfully!"
|
|
4613
4613
|
};
|
|
4614
4614
|
var verifyEmail_en = {
|
|
4615
4615
|
labels: labels$1,
|
|
@@ -4617,13 +4617,13 @@ var verifyEmail_en = {
|
|
|
4617
4617
|
};
|
|
4618
4618
|
|
|
4619
4619
|
var labels = {
|
|
4620
|
-
title: "
|
|
4621
|
-
instructions: "
|
|
4622
|
-
resend: "
|
|
4620
|
+
title: "Vérifiez votre e-mail",
|
|
4621
|
+
instructions: "Vous êtes en route!\nConfirmons votre adresse e-mail.\nCliquez sur le lien de vérification que nous vous avons envoyé par e-mail:",
|
|
4622
|
+
resend: "Ré-envoyer l'email"
|
|
4623
4623
|
};
|
|
4624
4624
|
var messages = {
|
|
4625
|
-
resent: "
|
|
4626
|
-
success: "
|
|
4625
|
+
resent: "Renvoyé avec succès",
|
|
4626
|
+
success: "Email vérifié avec succès!"
|
|
4627
4627
|
};
|
|
4628
4628
|
var verifyEmail_fr = {
|
|
4629
4629
|
labels: labels,
|
|
@@ -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
|
|
|
@@ -8973,7 +8982,7 @@ const verifyEmailTokenFromUrl = () => {
|
|
|
8973
8982
|
var _window$Pelcro$site$r5, _window$Pelcro$site$r6;
|
|
8974
8983
|
|
|
8975
8984
|
const {
|
|
8976
|
-
|
|
8985
|
+
whenSiteReady
|
|
8977
8986
|
} = usePelcro.getStore();
|
|
8978
8987
|
const translations = i18next.t("verifyEmail:messages", {
|
|
8979
8988
|
returnObjects: true
|
|
@@ -8981,14 +8990,7 @@ const verifyEmailTokenFromUrl = () => {
|
|
|
8981
8990
|
const emailToken = window.Pelcro.helpers.getURLParameter("token");
|
|
8982
8991
|
const isEmailVerificationEnabled = (_window$Pelcro$site$r5 = (_window$Pelcro$site$r6 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r6 === void 0 ? void 0 : _window$Pelcro$site$r6.email_verify_enabled) !== null && _window$Pelcro$site$r5 !== void 0 ? _window$Pelcro$site$r5 : false;
|
|
8983
8992
|
if (!emailToken || !isEmailVerificationEnabled) return;
|
|
8984
|
-
|
|
8985
|
-
using whenUserReady means that the verification link needs to be
|
|
8986
|
-
opened on the same device that was used for registeration to guarantee
|
|
8987
|
-
that the user is authenticated. if that's not the case, nothing would show up,
|
|
8988
|
-
this is a limitation caused by the SDK and it's events
|
|
8989
|
-
*/
|
|
8990
|
-
|
|
8991
|
-
whenUserReady(() => {
|
|
8993
|
+
whenSiteReady(() => {
|
|
8992
8994
|
window.Pelcro.user.verifyEmailToken({
|
|
8993
8995
|
token: emailToken
|
|
8994
8996
|
}, (err, res) => {
|
|
@@ -10285,20 +10287,16 @@ const Auth0LoginButton = ({
|
|
|
10285
10287
|
labelClassName = "",
|
|
10286
10288
|
iconClassName = ""
|
|
10287
10289
|
}) => {
|
|
10288
|
-
|
|
10289
|
-
console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
|
|
10290
|
-
}
|
|
10291
|
-
|
|
10292
|
-
const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url && window.auth0);
|
|
10290
|
+
const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url);
|
|
10293
10291
|
const auth0InstanceRef = React__default['default'].useRef(null);
|
|
10294
10292
|
React__default['default'].useEffect(() => {
|
|
10295
|
-
if (auth0Enabled) {
|
|
10293
|
+
if (auth0Enabled && window.auth0 && auth0InstanceRef.current === null) {
|
|
10296
10294
|
auth0InstanceRef.current = new window.auth0.WebAuth({
|
|
10297
10295
|
domain: window.Pelcro.site.read().auth0_base_url,
|
|
10298
10296
|
clientID: window.Pelcro.site.read().auth0_client_id
|
|
10299
10297
|
});
|
|
10300
10298
|
}
|
|
10301
|
-
}, []);
|
|
10299
|
+
}, [auth0Enabled, window.auth0]);
|
|
10302
10300
|
const {
|
|
10303
10301
|
dispatch: loginDispatch
|
|
10304
10302
|
} = React.useContext(store$g);
|
|
@@ -10309,6 +10307,10 @@ const Auth0LoginButton = ({
|
|
|
10309
10307
|
function handleClick() {
|
|
10310
10308
|
var _auth0InstanceRef$cur, _auth0InstanceRef$cur2, _auth0InstanceRef$cur3;
|
|
10311
10309
|
|
|
10310
|
+
if (!window.auth0) {
|
|
10311
|
+
return console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
|
|
10312
|
+
}
|
|
10313
|
+
|
|
10312
10314
|
(_auth0InstanceRef$cur = auth0InstanceRef.current) === null || _auth0InstanceRef$cur === void 0 ? void 0 : (_auth0InstanceRef$cur2 = _auth0InstanceRef$cur.popup) === null || _auth0InstanceRef$cur2 === void 0 ? void 0 : (_auth0InstanceRef$cur3 = _auth0InstanceRef$cur2.authorize) === null || _auth0InstanceRef$cur3 === void 0 ? void 0 : _auth0InstanceRef$cur3.call(_auth0InstanceRef$cur2, {
|
|
10313
10315
|
responseType: "token id_token",
|
|
10314
10316
|
owp: true // close popup when finished
|
|
@@ -10948,15 +10950,21 @@ function RegisterModal(props) {
|
|
|
10948
10950
|
};
|
|
10949
10951
|
|
|
10950
10952
|
const handleAfterRegistrationLogic = () => {
|
|
10951
|
-
var _ReactGA$event;
|
|
10953
|
+
var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
10952
10954
|
|
|
10953
10955
|
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
10954
10956
|
category: "ACTIONS",
|
|
10955
10957
|
action: "Registered",
|
|
10956
10958
|
nonInteraction: true
|
|
10957
|
-
});
|
|
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
|
+
}
|
|
10958
10965
|
|
|
10959
10966
|
if (!product && !order && !giftCode) {
|
|
10967
|
+
// If product and plan are not selected
|
|
10960
10968
|
return resetView();
|
|
10961
10969
|
} // If this is a redeem gift
|
|
10962
10970
|
|
|
@@ -21457,12 +21465,20 @@ const SubscriptionsItems = ({
|
|
|
21457
21465
|
const {
|
|
21458
21466
|
t
|
|
21459
21467
|
} = useTranslation("dashboard");
|
|
21468
|
+
const {
|
|
21469
|
+
switchView,
|
|
21470
|
+
isAuthenticated
|
|
21471
|
+
} = usePelcro();
|
|
21460
21472
|
const subs = getNonDonationSubs();
|
|
21461
21473
|
if (subs.length === 0) return null;
|
|
21462
21474
|
return subs.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
|
|
21463
21475
|
const isActive = activeMenu === sub.id; // Cancel button click handlers
|
|
21464
21476
|
|
|
21465
21477
|
const onCancelClick = () => {
|
|
21478
|
+
if (userMustVerifyEmail()) {
|
|
21479
|
+
return switchView("email-verify");
|
|
21480
|
+
}
|
|
21481
|
+
|
|
21466
21482
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
21467
21483
|
notify.confirm((onSuccess, onFailure) => {
|
|
21468
21484
|
cancelSubscription(sub.id, onSuccess, onFailure);
|
|
@@ -21478,6 +21494,10 @@ const SubscriptionsItems = ({
|
|
|
21478
21494
|
|
|
21479
21495
|
|
|
21480
21496
|
const onReactivateClick = () => {
|
|
21497
|
+
if (userMustVerifyEmail()) {
|
|
21498
|
+
return switchView("email-verify");
|
|
21499
|
+
}
|
|
21500
|
+
|
|
21481
21501
|
reactivateSubscription(sub.id);
|
|
21482
21502
|
}; // Renew click
|
|
21483
21503
|
|
|
@@ -24348,7 +24368,7 @@ const EmailVerifyContainer = ({
|
|
|
24348
24368
|
} = useTranslation("verifyEmail");
|
|
24349
24369
|
|
|
24350
24370
|
const submit = () => {
|
|
24351
|
-
window.Pelcro.user.
|
|
24371
|
+
window.Pelcro.user.resendEmailVerification((err, res) => {
|
|
24352
24372
|
dispatch({
|
|
24353
24373
|
type: LOADING,
|
|
24354
24374
|
payload: false
|
|
@@ -24475,7 +24495,7 @@ const EmailVerifyView = props => {
|
|
|
24475
24495
|
}, /*#__PURE__*/React__default['default'].createElement(SvgEmailVerify, {
|
|
24476
24496
|
className: "plc-w-32 plc-h-32"
|
|
24477
24497
|
}), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
24478
|
-
className: "plc-mb-1 plc-text-gray-900"
|
|
24498
|
+
className: "plc-mb-1 plc-text-gray-900 plc-text-center plc-whitespace-pre-line"
|
|
24479
24499
|
}, t("labels.instructions"), " ", /*#__PURE__*/React__default['default'].createElement("span", {
|
|
24480
24500
|
className: "plc-font-bold"
|
|
24481
24501
|
}, (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email))), /*#__PURE__*/React__default['default'].createElement(EmailVerifyResendButton, {
|
package/dist/index.esm.js
CHANGED
|
@@ -4573,13 +4573,13 @@ var notification_fr = {
|
|
|
4573
4573
|
};
|
|
4574
4574
|
|
|
4575
4575
|
var labels$1 = {
|
|
4576
|
-
title: "Verify your
|
|
4577
|
-
instructions: "
|
|
4578
|
-
resend: "Resend
|
|
4576
|
+
title: "Verify your email",
|
|
4577
|
+
instructions: "You're on your way!\nLet's confirm your email address.\nClick on the verification link we've sent to your email:",
|
|
4578
|
+
resend: "Resend email"
|
|
4579
4579
|
};
|
|
4580
4580
|
var messages$1 = {
|
|
4581
4581
|
resent: "Resent successfully",
|
|
4582
|
-
success: "
|
|
4582
|
+
success: "Email verified successfully!"
|
|
4583
4583
|
};
|
|
4584
4584
|
var verifyEmail_en = {
|
|
4585
4585
|
labels: labels$1,
|
|
@@ -4587,13 +4587,13 @@ var verifyEmail_en = {
|
|
|
4587
4587
|
};
|
|
4588
4588
|
|
|
4589
4589
|
var labels = {
|
|
4590
|
-
title: "
|
|
4591
|
-
instructions: "
|
|
4592
|
-
resend: "
|
|
4590
|
+
title: "Vérifiez votre e-mail",
|
|
4591
|
+
instructions: "Vous êtes en route!\nConfirmons votre adresse e-mail.\nCliquez sur le lien de vérification que nous vous avons envoyé par e-mail:",
|
|
4592
|
+
resend: "Ré-envoyer l'email"
|
|
4593
4593
|
};
|
|
4594
4594
|
var messages = {
|
|
4595
|
-
resent: "
|
|
4596
|
-
success: "
|
|
4595
|
+
resent: "Renvoyé avec succès",
|
|
4596
|
+
success: "Email vérifié avec succès!"
|
|
4597
4597
|
};
|
|
4598
4598
|
var verifyEmail_fr = {
|
|
4599
4599
|
labels: labels,
|
|
@@ -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
|
|
|
@@ -8943,7 +8952,7 @@ const verifyEmailTokenFromUrl = () => {
|
|
|
8943
8952
|
var _window$Pelcro$site$r5, _window$Pelcro$site$r6;
|
|
8944
8953
|
|
|
8945
8954
|
const {
|
|
8946
|
-
|
|
8955
|
+
whenSiteReady
|
|
8947
8956
|
} = usePelcro.getStore();
|
|
8948
8957
|
const translations = i18next.t("verifyEmail:messages", {
|
|
8949
8958
|
returnObjects: true
|
|
@@ -8951,14 +8960,7 @@ const verifyEmailTokenFromUrl = () => {
|
|
|
8951
8960
|
const emailToken = window.Pelcro.helpers.getURLParameter("token");
|
|
8952
8961
|
const isEmailVerificationEnabled = (_window$Pelcro$site$r5 = (_window$Pelcro$site$r6 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r6 === void 0 ? void 0 : _window$Pelcro$site$r6.email_verify_enabled) !== null && _window$Pelcro$site$r5 !== void 0 ? _window$Pelcro$site$r5 : false;
|
|
8953
8962
|
if (!emailToken || !isEmailVerificationEnabled) return;
|
|
8954
|
-
|
|
8955
|
-
using whenUserReady means that the verification link needs to be
|
|
8956
|
-
opened on the same device that was used for registeration to guarantee
|
|
8957
|
-
that the user is authenticated. if that's not the case, nothing would show up,
|
|
8958
|
-
this is a limitation caused by the SDK and it's events
|
|
8959
|
-
*/
|
|
8960
|
-
|
|
8961
|
-
whenUserReady(() => {
|
|
8963
|
+
whenSiteReady(() => {
|
|
8962
8964
|
window.Pelcro.user.verifyEmailToken({
|
|
8963
8965
|
token: emailToken
|
|
8964
8966
|
}, (err, res) => {
|
|
@@ -10255,20 +10257,16 @@ const Auth0LoginButton = ({
|
|
|
10255
10257
|
labelClassName = "",
|
|
10256
10258
|
iconClassName = ""
|
|
10257
10259
|
}) => {
|
|
10258
|
-
|
|
10259
|
-
console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
|
|
10260
|
-
}
|
|
10261
|
-
|
|
10262
|
-
const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url && window.auth0);
|
|
10260
|
+
const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url);
|
|
10263
10261
|
const auth0InstanceRef = React__default.useRef(null);
|
|
10264
10262
|
React__default.useEffect(() => {
|
|
10265
|
-
if (auth0Enabled) {
|
|
10263
|
+
if (auth0Enabled && window.auth0 && auth0InstanceRef.current === null) {
|
|
10266
10264
|
auth0InstanceRef.current = new window.auth0.WebAuth({
|
|
10267
10265
|
domain: window.Pelcro.site.read().auth0_base_url,
|
|
10268
10266
|
clientID: window.Pelcro.site.read().auth0_client_id
|
|
10269
10267
|
});
|
|
10270
10268
|
}
|
|
10271
|
-
}, []);
|
|
10269
|
+
}, [auth0Enabled, window.auth0]);
|
|
10272
10270
|
const {
|
|
10273
10271
|
dispatch: loginDispatch
|
|
10274
10272
|
} = useContext(store$g);
|
|
@@ -10279,6 +10277,10 @@ const Auth0LoginButton = ({
|
|
|
10279
10277
|
function handleClick() {
|
|
10280
10278
|
var _auth0InstanceRef$cur, _auth0InstanceRef$cur2, _auth0InstanceRef$cur3;
|
|
10281
10279
|
|
|
10280
|
+
if (!window.auth0) {
|
|
10281
|
+
return console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
|
|
10282
|
+
}
|
|
10283
|
+
|
|
10282
10284
|
(_auth0InstanceRef$cur = auth0InstanceRef.current) === null || _auth0InstanceRef$cur === void 0 ? void 0 : (_auth0InstanceRef$cur2 = _auth0InstanceRef$cur.popup) === null || _auth0InstanceRef$cur2 === void 0 ? void 0 : (_auth0InstanceRef$cur3 = _auth0InstanceRef$cur2.authorize) === null || _auth0InstanceRef$cur3 === void 0 ? void 0 : _auth0InstanceRef$cur3.call(_auth0InstanceRef$cur2, {
|
|
10283
10285
|
responseType: "token id_token",
|
|
10284
10286
|
owp: true // close popup when finished
|
|
@@ -10918,15 +10920,21 @@ function RegisterModal(props) {
|
|
|
10918
10920
|
};
|
|
10919
10921
|
|
|
10920
10922
|
const handleAfterRegistrationLogic = () => {
|
|
10921
|
-
var _ReactGA$event;
|
|
10923
|
+
var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
10922
10924
|
|
|
10923
10925
|
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
10924
10926
|
category: "ACTIONS",
|
|
10925
10927
|
action: "Registered",
|
|
10926
10928
|
nonInteraction: true
|
|
10927
|
-
});
|
|
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
|
+
}
|
|
10928
10935
|
|
|
10929
10936
|
if (!product && !order && !giftCode) {
|
|
10937
|
+
// If product and plan are not selected
|
|
10930
10938
|
return resetView();
|
|
10931
10939
|
} // If this is a redeem gift
|
|
10932
10940
|
|
|
@@ -21427,12 +21435,20 @@ const SubscriptionsItems = ({
|
|
|
21427
21435
|
const {
|
|
21428
21436
|
t
|
|
21429
21437
|
} = useTranslation("dashboard");
|
|
21438
|
+
const {
|
|
21439
|
+
switchView,
|
|
21440
|
+
isAuthenticated
|
|
21441
|
+
} = usePelcro();
|
|
21430
21442
|
const subs = getNonDonationSubs();
|
|
21431
21443
|
if (subs.length === 0) return null;
|
|
21432
21444
|
return subs.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
|
|
21433
21445
|
const isActive = activeMenu === sub.id; // Cancel button click handlers
|
|
21434
21446
|
|
|
21435
21447
|
const onCancelClick = () => {
|
|
21448
|
+
if (userMustVerifyEmail()) {
|
|
21449
|
+
return switchView("email-verify");
|
|
21450
|
+
}
|
|
21451
|
+
|
|
21436
21452
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
21437
21453
|
notify.confirm((onSuccess, onFailure) => {
|
|
21438
21454
|
cancelSubscription(sub.id, onSuccess, onFailure);
|
|
@@ -21448,6 +21464,10 @@ const SubscriptionsItems = ({
|
|
|
21448
21464
|
|
|
21449
21465
|
|
|
21450
21466
|
const onReactivateClick = () => {
|
|
21467
|
+
if (userMustVerifyEmail()) {
|
|
21468
|
+
return switchView("email-verify");
|
|
21469
|
+
}
|
|
21470
|
+
|
|
21451
21471
|
reactivateSubscription(sub.id);
|
|
21452
21472
|
}; // Renew click
|
|
21453
21473
|
|
|
@@ -24318,7 +24338,7 @@ const EmailVerifyContainer = ({
|
|
|
24318
24338
|
} = useTranslation("verifyEmail");
|
|
24319
24339
|
|
|
24320
24340
|
const submit = () => {
|
|
24321
|
-
window.Pelcro.user.
|
|
24341
|
+
window.Pelcro.user.resendEmailVerification((err, res) => {
|
|
24322
24342
|
dispatch({
|
|
24323
24343
|
type: LOADING,
|
|
24324
24344
|
payload: false
|
|
@@ -24445,7 +24465,7 @@ const EmailVerifyView = props => {
|
|
|
24445
24465
|
}, /*#__PURE__*/React__default.createElement(SvgEmailVerify, {
|
|
24446
24466
|
className: "plc-w-32 plc-h-32"
|
|
24447
24467
|
}), /*#__PURE__*/React__default.createElement("p", {
|
|
24448
|
-
className: "plc-mb-1 plc-text-gray-900"
|
|
24468
|
+
className: "plc-mb-1 plc-text-gray-900 plc-text-center plc-whitespace-pre-line"
|
|
24449
24469
|
}, t("labels.instructions"), " ", /*#__PURE__*/React__default.createElement("span", {
|
|
24450
24470
|
className: "plc-font-bold"
|
|
24451
24471
|
}, (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email))), /*#__PURE__*/React__default.createElement(EmailVerifyResendButton, {
|
package/dist/pelcro.css
CHANGED
|
@@ -2759,6 +2759,10 @@ in order to scope selectors under pelcro-root
|
|
|
2759
2759
|
vertical-align: middle;
|
|
2760
2760
|
}
|
|
2761
2761
|
|
|
2762
|
+
.pelcro-root .plc-whitespace-pre-line {
|
|
2763
|
+
white-space: pre-line;
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2762
2766
|
.pelcro-root .plc-break-words {
|
|
2763
2767
|
overflow-wrap: break-word;
|
|
2764
2768
|
}
|