@pelcro/react-pelcro-js 3.15.0 → 3.15.1-beta.1
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 +18 -0
- package/dist/index.esm.js +18 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -10707,6 +10707,8 @@ const init = () => {
|
|
|
10707
10707
|
disableKeyboardInteractions(elemDeepClone);
|
|
10708
10708
|
elemDeepClone.setAttribute("style", "filter:blur(3px) !important; pointer-events:none !important; user-select:none !important");
|
|
10709
10709
|
unblurElemWhenUserSubscribes(elemDeepClone, entitlements);
|
|
10710
|
+
unblurElemWhenUserLogsIn(elemDeepClone, entitlements);
|
|
10711
|
+
unblurElemWhenUserLogsOut(elemDeepClone, entitlements);
|
|
10710
10712
|
const NOTIFICATION_ID = "entitlement";
|
|
10711
10713
|
notify$1( /*#__PURE__*/React__default['default'].createElement("p", null, /*#__PURE__*/React__default['default'].createElement(Trans, {
|
|
10712
10714
|
i18nKey: "messages:entitlement"
|
|
@@ -10780,6 +10782,22 @@ function unblurElemWhenUserSubscribes(elem, entitlements) {
|
|
|
10780
10782
|
});
|
|
10781
10783
|
}
|
|
10782
10784
|
|
|
10785
|
+
function unblurElemWhenUserLogsIn(elem, entitlements) {
|
|
10786
|
+
document.addEventListener("PelcroUserLoggedIn", () => {
|
|
10787
|
+
if (!shouldBlurContent(entitlements)) {
|
|
10788
|
+
elem.setAttribute("style", "filter:inherit !important; pointer-events:inherit !important; user-select:inherit !important");
|
|
10789
|
+
}
|
|
10790
|
+
});
|
|
10791
|
+
}
|
|
10792
|
+
|
|
10793
|
+
function unblurElemWhenUserLogsOut(elem, entitlements) {
|
|
10794
|
+
document.addEventListener("PelcroUserLogout", () => {
|
|
10795
|
+
if (shouldBlurContent(entitlements)) {
|
|
10796
|
+
elem.setAttribute("style", "filter:blur(3px) !important; pointer-events:none !important; user-select:none !important");
|
|
10797
|
+
}
|
|
10798
|
+
});
|
|
10799
|
+
}
|
|
10800
|
+
|
|
10783
10801
|
function shouldBlurContent(entitlements) {
|
|
10784
10802
|
return entitlements.every(entitlement => !window.Pelcro.user.isEntitledTo(entitlement));
|
|
10785
10803
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -10677,6 +10677,8 @@ const init = () => {
|
|
|
10677
10677
|
disableKeyboardInteractions(elemDeepClone);
|
|
10678
10678
|
elemDeepClone.setAttribute("style", "filter:blur(3px) !important; pointer-events:none !important; user-select:none !important");
|
|
10679
10679
|
unblurElemWhenUserSubscribes(elemDeepClone, entitlements);
|
|
10680
|
+
unblurElemWhenUserLogsIn(elemDeepClone, entitlements);
|
|
10681
|
+
unblurElemWhenUserLogsOut(elemDeepClone, entitlements);
|
|
10680
10682
|
const NOTIFICATION_ID = "entitlement";
|
|
10681
10683
|
notify$1( /*#__PURE__*/React__default.createElement("p", null, /*#__PURE__*/React__default.createElement(Trans, {
|
|
10682
10684
|
i18nKey: "messages:entitlement"
|
|
@@ -10750,6 +10752,22 @@ function unblurElemWhenUserSubscribes(elem, entitlements) {
|
|
|
10750
10752
|
});
|
|
10751
10753
|
}
|
|
10752
10754
|
|
|
10755
|
+
function unblurElemWhenUserLogsIn(elem, entitlements) {
|
|
10756
|
+
document.addEventListener("PelcroUserLoggedIn", () => {
|
|
10757
|
+
if (!shouldBlurContent(entitlements)) {
|
|
10758
|
+
elem.setAttribute("style", "filter:inherit !important; pointer-events:inherit !important; user-select:inherit !important");
|
|
10759
|
+
}
|
|
10760
|
+
});
|
|
10761
|
+
}
|
|
10762
|
+
|
|
10763
|
+
function unblurElemWhenUserLogsOut(elem, entitlements) {
|
|
10764
|
+
document.addEventListener("PelcroUserLogout", () => {
|
|
10765
|
+
if (shouldBlurContent(entitlements)) {
|
|
10766
|
+
elem.setAttribute("style", "filter:blur(3px) !important; pointer-events:none !important; user-select:none !important");
|
|
10767
|
+
}
|
|
10768
|
+
});
|
|
10769
|
+
}
|
|
10770
|
+
|
|
10753
10771
|
function shouldBlurContent(entitlements) {
|
|
10754
10772
|
return entitlements.every(entitlement => !window.Pelcro.user.isEntitledTo(entitlement));
|
|
10755
10773
|
}
|