authscape 1.0.359 → 1.0.370

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
@@ -9,10 +9,10 @@ var _react = _interopRequireWildcard(require("react"));
9
9
  var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
10
10
  var _Backdrop = _interopRequireDefault(require("@mui/material/Backdrop"));
11
11
  var _reactToastify = require("react-toastify");
12
- var _router = require("next/router");
13
12
  var _styles = require("@mui/material/styles");
14
13
  var _material = require("@mui/material");
15
14
  var _head = _interopRequireDefault(require("next/head"));
15
+ var _navigation = require("next/navigation");
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -52,30 +52,59 @@ function AuthScapeApp(_ref) {
52
52
  _useState8 = _slicedToArray(_useState7, 2),
53
53
  loadingLogin = _useState8[0],
54
54
  setLoadingLogin = _useState8[1];
55
- var router = (0, _router.useRouter)();
56
- (0, _react.useEffect)(function () {}, [loadedUser]);
57
- (0, _react.useEffect)(function () {
58
- if (loadedUser && router.isReady) {
59
- if (process.env.googleAnalytics4 != null) {
60
- init(process.env.googleAnalytics4);
61
- }
62
- if (router.query.r != null) {
63
- localStorage.setItem("ref", router.query.r);
64
- }
65
-
66
- // sign in validation
67
- if (router.query.code != null) {
68
- setLoadingLogin(true);
69
- signInValidator(router.query.code);
70
- } else {
71
- if (enforceLoggedIn) {
72
- if (currentUser == null) {
73
- authService().login();
74
- }
55
+ var validateCode = function validateCode() {
56
+ if (queryCode != null) {
57
+ setLoadingLogin(true);
58
+ signInValidator(queryCode);
59
+ } else {
60
+ if (enforceLoggedIn) {
61
+ if (currentUser == null) {
62
+ authService().login();
75
63
  }
76
64
  }
77
65
  }
78
- }, [loadedUser, router.isReady]);
66
+ };
67
+ var searchParams = (0, _navigation.useSearchParams)();
68
+ var queryRef = searchParams.get('ref');
69
+ var queryCode = searchParams.get('code');
70
+ validateCode(queryCode);
71
+
72
+ // const router = useRouter();
73
+
74
+ // useEffect(() => {
75
+
76
+ // if (loadedUser && router.isReady)
77
+ // {
78
+ // if (process.env.googleAnalytics4 != null)
79
+ // {
80
+ // init(process.env.googleAnalytics4);
81
+ // }
82
+
83
+ // if (queryRef != null)
84
+ // {
85
+ // localStorage.setItem("ref", queryRef);
86
+ // }
87
+
88
+ // // sign in validation
89
+ // if (queryCode != null)
90
+ // {
91
+ // setLoadingLogin(true);
92
+ // signInValidator(queryCode);
93
+ // }
94
+ // else
95
+ // {
96
+ // if (enforceLoggedIn)
97
+ // {
98
+ // if (currentUser == null)
99
+ // {
100
+ // authService().login();
101
+ // }
102
+ // }
103
+ // }
104
+ // }
105
+
106
+ // }, [loadedUser, router.isReady])
107
+
79
108
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_head["default"], null, /*#__PURE__*/_react["default"].createElement("meta", {
80
109
  name: "viewport",
81
110
  content: "width=device-width, initial-scale=1"
@@ -2976,6 +3005,7 @@ exports.SpreadsheetViewer = SpreadsheetViewer;
2976
3005
  var _material = require("@mui/material");
2977
3006
  var _react = _interopRequireWildcard(require("react"));
2978
3007
  var _reactgrid = require("@silevis/reactgrid");
3008
+ var _authscape = require("authscape");
2979
3009
  var _reactDeviceDetect = require("react-device-detect");
2980
3010
  var signalR = _interopRequireWildcard(require("@microsoft/signalr"));
2981
3011
  var _Avatar = _interopRequireDefault(require("@mui/material/Avatar"));
@@ -3151,7 +3181,7 @@ function SpreadsheetViewer(_ref) {
3151
3181
  while (1) switch (_context.prev = _context.next) {
3152
3182
  case 0:
3153
3183
  _context.next = 2;
3154
- return apiService().get(url);
3184
+ return (0, _authscape.apiService)().get(url);
3155
3185
  case 2:
3156
3186
  response = _context.sent;
3157
3187
  if (response != null && response.status == 200) {
@@ -3179,7 +3209,7 @@ function SpreadsheetViewer(_ref) {
3179
3209
  while (1) switch (_context2.prev = _context2.next) {
3180
3210
  case 0:
3181
3211
  _context2.next = 2;
3182
- return apiService().get("/AuthScapeSpreadSheet/GetActiveSessions?documentId=" + documentId);
3212
+ return (0, _authscape.apiService)().get("/AuthScapeSpreadSheet/GetActiveSessions?documentId=" + documentId);
3183
3213
  case 2:
3184
3214
  response = _context2.sent;
3185
3215
  sessionData = response.data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.359",
3
+ "version": "1.0.370",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,9 +27,6 @@
27
27
  "react-dom": "^18.2.0"
28
28
  },
29
29
  "dependencies": {
30
- "@dnd-kit/core": "^6.1.0",
31
- "@dnd-kit/sortable": "^8.0.0",
32
- "@dnd-kit/utilities": "^3.2.2",
33
30
  "@microsoft/signalr": "^8.0.0",
34
31
  "@monaco-editor/react": "^4.5.1",
35
32
  "@silevis/reactgrid": "^4.1.3",
@@ -38,12 +35,12 @@
38
35
  "axios": "^1.6.1",
39
36
  "draft-js": "^0.11.7",
40
37
  "draftjs-to-html": "^0.9.1",
41
- "eslint-config-next": "^13.3.2",
38
+ "eslint-config-next": "^14.1.0",
42
39
  "ga-4-react": "^0.1.281",
43
40
  "html2canvas": "^1.4.1",
44
41
  "js-file-download": "^0.4.12",
45
42
  "jspdf": "^2.5.1",
46
- "next": "^13.3.2",
43
+ "next": "^14.1.0",
47
44
  "nookies": "^2.5.2",
48
45
  "query-string": "^7.1.1",
49
46
  "react-color": "^2.19.3",
@@ -2,10 +2,10 @@ import React, { useEffect, useState, useRef } from 'react';
2
2
  import CircularProgress from '@mui/material/CircularProgress';
3
3
  import Backdrop from '@mui/material/Backdrop';
4
4
  import { ToastContainer, toast } from 'react-toastify';
5
- import { useRouter } from 'next/router';
6
5
  import { ThemeProvider } from '@mui/material/styles';
7
6
  import { Box } from '@mui/material';
8
7
  import Head from "next/head";
8
+ import { useSearchParams } from 'next/navigation';
9
9
 
10
10
  export function AuthScapeApp({Component, pageProps, muiTheme = {}, enforceLoggedIn = false, enableAuth = true, onAuthenticationLoaded = null, children = null}) {
11
11
 
@@ -13,46 +13,68 @@ export function AuthScapeApp({Component, pageProps, muiTheme = {}, enforceLogged
13
13
  const [loadedUser, setLoadedUser] = useState(false);
14
14
  const [currentUser, setCurrentUser] = useState(null);
15
15
  const [loadingLogin, setLoadingLogin] = useState(false);
16
- const router = useRouter();
17
-
18
- useEffect(() => {
19
-
20
- }, [loadedUser]);
21
16
 
22
17
 
23
- useEffect(() => {
24
18
 
25
- if (loadedUser && router.isReady)
19
+ const validateCode = () => {
20
+ if (queryCode != null)
26
21
  {
27
- if (process.env.googleAnalytics4 != null)
28
- {
29
- init(process.env.googleAnalytics4);
30
- }
31
-
32
- if (router.query.r != null)
33
- {
34
- localStorage.setItem("ref", router.query.r);
35
- }
36
-
37
- // sign in validation
38
- if (router.query.code != null)
39
- {
40
- setLoadingLogin(true);
41
- signInValidator(router.query.code);
42
- }
43
- else
22
+ setLoadingLogin(true);
23
+ signInValidator(queryCode);
24
+ }
25
+ else
26
+ {
27
+ if (enforceLoggedIn)
44
28
  {
45
- if (enforceLoggedIn)
29
+ if (currentUser == null)
46
30
  {
47
- if (currentUser == null)
48
- {
49
- authService().login();
50
- }
31
+ authService().login();
51
32
  }
52
33
  }
53
34
  }
35
+ }
36
+
37
+ const searchParams = useSearchParams();
38
+ const queryRef = searchParams.get('ref');
39
+ const queryCode = searchParams.get('code');
40
+ validateCode(queryCode);
41
+
42
+ // const router = useRouter();
43
+
44
+
45
+ // useEffect(() => {
46
+
47
+ // if (loadedUser && router.isReady)
48
+ // {
49
+ // if (process.env.googleAnalytics4 != null)
50
+ // {
51
+ // init(process.env.googleAnalytics4);
52
+ // }
53
+
54
+ // if (queryRef != null)
55
+ // {
56
+ // localStorage.setItem("ref", queryRef);
57
+ // }
58
+
59
+ // // sign in validation
60
+ // if (queryCode != null)
61
+ // {
62
+ // setLoadingLogin(true);
63
+ // signInValidator(queryCode);
64
+ // }
65
+ // else
66
+ // {
67
+ // if (enforceLoggedIn)
68
+ // {
69
+ // if (currentUser == null)
70
+ // {
71
+ // authService().login();
72
+ // }
73
+ // }
74
+ // }
75
+ // }
54
76
 
55
- }, [loadedUser, router.isReady])
77
+ // }, [loadedUser, router.isReady])
56
78
 
57
79
 
58
80
  return (
@@ -1,6 +1,7 @@
1
1
  import { Box, Button } from '@mui/material';
2
2
  import React, { useEffect, useState, useRef } from 'react';
3
3
  import { ReactGrid, Column, Row } from "@silevis/reactgrid";
4
+ import { apiService } from 'authscape';
4
5
  import {isMacOs} from 'react-device-detect';
5
6
  import * as signalR from '@microsoft/signalr';
6
7
  import Avatar from '@mui/material/Avatar';