authscape 1.0.268 → 1.0.269

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/index.js CHANGED
@@ -29,6 +29,8 @@ function AuthScapeApp(_ref) {
29
29
  muiTheme = _ref$muiTheme === void 0 ? {} : _ref$muiTheme,
30
30
  _ref$enforceLoggedIn = _ref.enforceLoggedIn,
31
31
  enforceLoggedIn = _ref$enforceLoggedIn === void 0 ? false : _ref$enforceLoggedIn,
32
+ _ref$enableAuth = _ref.enableAuth,
33
+ enableAuth = _ref$enableAuth === void 0 ? true : _ref$enableAuth,
32
34
  _ref$onAuthentication = _ref.onAuthenticationLoaded,
33
35
  onAuthenticationLoaded = _ref$onAuthentication === void 0 ? null : _ref$onAuthentication,
34
36
  _ref$children = _ref.children,
@@ -58,11 +60,13 @@ function AuthScapeApp(_ref) {
58
60
  if (router.query.r != null) {
59
61
  localStorage.setItem("ref", router.query.r);
60
62
  }
61
- if (enforceLoggedIn) {
62
- if (currentUser == null) {
63
- window.location.href = "/login";
64
- }
65
- }
63
+
64
+ // if (enforceLoggedIn)
65
+ // {
66
+ // if (currentUser == null ) {
67
+ // window.location.href = "/login";
68
+ // }
69
+ // }
66
70
  }
67
71
  }, [loadedUser]);
68
72
  (0, _react.useEffect)(function () {
@@ -79,7 +83,7 @@ function AuthScapeApp(_ref) {
79
83
  theme: muiTheme
80
84
  }, loadingLogin && /*#__PURE__*/_react["default"].createElement(_material.Box, null, "Please wait. Loading..."), !loadingLogin && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(AuthorizationComponent, {
81
85
  setCurrentUser: setCurrentUser,
82
- isEnabled: process.env.enableAuth,
86
+ isEnabled: enableAuth,
83
87
  userLoaded: function userLoaded(signedInUser) {
84
88
  setLoadedUser(true);
85
89
  if (enforceLoggedIn && signedInUser == null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.268",
3
+ "version": "1.0.269",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -6,7 +6,7 @@ import { useRouter } from 'next/router';
6
6
  import { ThemeProvider } from '@mui/material/styles';
7
7
  import { Box } from '@mui/material';
8
8
 
9
- export function AuthScapeApp({Component, pageProps, muiTheme = {}, enforceLoggedIn = false, onAuthenticationLoaded = null, children = null}) {
9
+ export function AuthScapeApp({Component, pageProps, muiTheme = {}, enforceLoggedIn = false, enableAuth = true, onAuthenticationLoaded = null, children = null}) {
10
10
 
11
11
  const [isLoading, setIsLoading] = useState(process.env.enableOEMClient ? true : false);
12
12
  const [loadedUser, setLoadedUser] = useState(false);
@@ -27,12 +27,12 @@ export function AuthScapeApp({Component, pageProps, muiTheme = {}, enforceLogged
27
27
  localStorage.setItem("ref", router.query.r);
28
28
  }
29
29
 
30
- if (enforceLoggedIn)
31
- {
32
- if (currentUser == null ) {
33
- window.location.href = "/login";
34
- }
35
- }
30
+ // if (enforceLoggedIn)
31
+ // {
32
+ // if (currentUser == null ) {
33
+ // window.location.href = "/login";
34
+ // }
35
+ // }
36
36
 
37
37
  }
38
38
  }, [loadedUser]);
@@ -65,7 +65,7 @@ export function AuthScapeApp({Component, pageProps, muiTheme = {}, enforceLogged
65
65
 
66
66
  {!loadingLogin &&
67
67
  <>
68
- <AuthorizationComponent setCurrentUser={setCurrentUser} isEnabled={process.env.enableAuth} userLoaded={(signedInUser) => {
68
+ <AuthorizationComponent setCurrentUser={setCurrentUser} isEnabled={enableAuth} userLoaded={(signedInUser) => {
69
69
  setLoadedUser(true);
70
70
 
71
71
  if (enforceLoggedIn && signedInUser == null)