authscape 1.0.266 → 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,6 +60,13 @@ function AuthScapeApp(_ref) {
58
60
  if (router.query.r != null) {
59
61
  localStorage.setItem("ref", router.query.r);
60
62
  }
63
+
64
+ // if (enforceLoggedIn)
65
+ // {
66
+ // if (currentUser == null ) {
67
+ // window.location.href = "/login";
68
+ // }
69
+ // }
61
70
  }
62
71
  }, [loadedUser]);
63
72
  (0, _react.useEffect)(function () {
@@ -74,11 +83,11 @@ function AuthScapeApp(_ref) {
74
83
  theme: muiTheme
75
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, {
76
85
  setCurrentUser: setCurrentUser,
77
- isEnabled: process.env.enableAuth,
86
+ isEnabled: enableAuth,
78
87
  userLoaded: function userLoaded(signedInUser) {
79
88
  setLoadedUser(true);
80
89
  if (enforceLoggedIn && signedInUser == null) {
81
- authService().login();
90
+ // authService().login();
82
91
  } else {
83
92
  if (onAuthenticationLoaded != null) {
84
93
  onAuthenticationLoaded(signedInUser);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.266",
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);
@@ -26,6 +26,14 @@ export function AuthScapeApp({Component, pageProps, muiTheme = {}, enforceLogged
26
26
  {
27
27
  localStorage.setItem("ref", router.query.r);
28
28
  }
29
+
30
+ // if (enforceLoggedIn)
31
+ // {
32
+ // if (currentUser == null ) {
33
+ // window.location.href = "/login";
34
+ // }
35
+ // }
36
+
29
37
  }
30
38
  }, [loadedUser]);
31
39
 
@@ -57,12 +65,12 @@ export function AuthScapeApp({Component, pageProps, muiTheme = {}, enforceLogged
57
65
 
58
66
  {!loadingLogin &&
59
67
  <>
60
- <AuthorizationComponent setCurrentUser={setCurrentUser} isEnabled={process.env.enableAuth} userLoaded={(signedInUser) => {
68
+ <AuthorizationComponent setCurrentUser={setCurrentUser} isEnabled={enableAuth} userLoaded={(signedInUser) => {
61
69
  setLoadedUser(true);
62
70
 
63
71
  if (enforceLoggedIn && signedInUser == null)
64
72
  {
65
- authService().login();
73
+ // authService().login();
66
74
  }
67
75
  else
68
76
  {