@pelcro/react-pelcro-js 2.7.0-beta.12 → 2.7.0-beta.13
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 +7 -7
- package/dist/index.esm.js +7 -7
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -10278,20 +10278,16 @@ const Auth0LoginButton = ({
|
|
|
10278
10278
|
labelClassName = "",
|
|
10279
10279
|
iconClassName = ""
|
|
10280
10280
|
}) => {
|
|
10281
|
-
|
|
10282
|
-
console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
|
|
10283
|
-
}
|
|
10284
|
-
|
|
10285
|
-
const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url && window.auth0);
|
|
10281
|
+
const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url);
|
|
10286
10282
|
const auth0InstanceRef = React__default['default'].useRef(null);
|
|
10287
10283
|
React__default['default'].useEffect(() => {
|
|
10288
|
-
if (auth0Enabled) {
|
|
10284
|
+
if (auth0Enabled && window.auth0 && auth0InstanceRef.current === null) {
|
|
10289
10285
|
auth0InstanceRef.current = new window.auth0.WebAuth({
|
|
10290
10286
|
domain: window.Pelcro.site.read().auth0_base_url,
|
|
10291
10287
|
clientID: window.Pelcro.site.read().auth0_client_id
|
|
10292
10288
|
});
|
|
10293
10289
|
}
|
|
10294
|
-
}, []);
|
|
10290
|
+
}, [auth0Enabled, window.auth0]);
|
|
10295
10291
|
const {
|
|
10296
10292
|
dispatch: loginDispatch
|
|
10297
10293
|
} = React.useContext(store$g);
|
|
@@ -10302,6 +10298,10 @@ const Auth0LoginButton = ({
|
|
|
10302
10298
|
function handleClick() {
|
|
10303
10299
|
var _auth0InstanceRef$cur, _auth0InstanceRef$cur2, _auth0InstanceRef$cur3;
|
|
10304
10300
|
|
|
10301
|
+
if (!window.auth0) {
|
|
10302
|
+
return console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
|
|
10303
|
+
}
|
|
10304
|
+
|
|
10305
10305
|
(_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, {
|
|
10306
10306
|
responseType: "token id_token",
|
|
10307
10307
|
owp: true // close popup when finished
|
package/dist/index.esm.js
CHANGED
|
@@ -10248,20 +10248,16 @@ const Auth0LoginButton = ({
|
|
|
10248
10248
|
labelClassName = "",
|
|
10249
10249
|
iconClassName = ""
|
|
10250
10250
|
}) => {
|
|
10251
|
-
|
|
10252
|
-
console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
|
|
10253
|
-
}
|
|
10254
|
-
|
|
10255
|
-
const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url && window.auth0);
|
|
10251
|
+
const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url);
|
|
10256
10252
|
const auth0InstanceRef = React__default.useRef(null);
|
|
10257
10253
|
React__default.useEffect(() => {
|
|
10258
|
-
if (auth0Enabled) {
|
|
10254
|
+
if (auth0Enabled && window.auth0 && auth0InstanceRef.current === null) {
|
|
10259
10255
|
auth0InstanceRef.current = new window.auth0.WebAuth({
|
|
10260
10256
|
domain: window.Pelcro.site.read().auth0_base_url,
|
|
10261
10257
|
clientID: window.Pelcro.site.read().auth0_client_id
|
|
10262
10258
|
});
|
|
10263
10259
|
}
|
|
10264
|
-
}, []);
|
|
10260
|
+
}, [auth0Enabled, window.auth0]);
|
|
10265
10261
|
const {
|
|
10266
10262
|
dispatch: loginDispatch
|
|
10267
10263
|
} = useContext(store$g);
|
|
@@ -10272,6 +10268,10 @@ const Auth0LoginButton = ({
|
|
|
10272
10268
|
function handleClick() {
|
|
10273
10269
|
var _auth0InstanceRef$cur, _auth0InstanceRef$cur2, _auth0InstanceRef$cur3;
|
|
10274
10270
|
|
|
10271
|
+
if (!window.auth0) {
|
|
10272
|
+
return console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
|
|
10273
|
+
}
|
|
10274
|
+
|
|
10275
10275
|
(_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, {
|
|
10276
10276
|
responseType: "token id_token",
|
|
10277
10277
|
owp: true // close popup when finished
|