authscape 1.0.358 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.358",
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';
@@ -1,23 +0,0 @@
1
- import React, {forwardRef, CSSProperties} from 'react';
2
- import classNames from 'classnames';
3
-
4
- export const Action = forwardRef(
5
- ({active, className, cursor, style, ...props}, ref) => {
6
- return (
7
- <button
8
- ref={ref}
9
- {...props}
10
- className={"Action"}
11
- tabIndex={0}
12
- style={
13
- {
14
- ...style,
15
- cursor,
16
- '--fill': active?.fill,
17
- '--background': active?.background,
18
- }
19
- }
20
- />
21
- );
22
- }
23
- );
@@ -1,66 +0,0 @@
1
- import React, {forwardRef} from 'react';
2
- import classNames from 'classnames';
3
-
4
- // import { Handle } from './Handle';
5
- // import { Remove } from './Remove';
6
-
7
- import styles from './Container.module.css';
8
-
9
- export const Container = forwardRef(
10
- (
11
- {
12
- children,
13
- columns = 1,
14
- handleProps,
15
- horizontal,
16
- hover,
17
- onClick,
18
- onRemove,
19
- label,
20
- placeholder,
21
- style,
22
- scrollable,
23
- shadow,
24
- unstyled,
25
- ...props
26
- },
27
- ref
28
- ) => {
29
- const Component = onClick ? 'button' : 'div';
30
-
31
- return (
32
- <Component
33
- {...props}
34
- ref={ref}
35
- style={
36
- {
37
- ...style,
38
- '--columns': columns,
39
- }
40
- }
41
- className={classNames(
42
- styles.Container,
43
- unstyled && styles.unstyled,
44
- horizontal && styles.horizontal,
45
- hover && styles.hover,
46
- placeholder && styles.placeholder,
47
- scrollable && styles.scrollable,
48
- shadow && styles.shadow
49
- )}
50
- onClick={onClick}
51
- tabIndex={onClick ? 0 : undefined}
52
- >
53
- {label ? (
54
- <div className={"Header"}>
55
- {label}
56
- <div className={"Actions"}>
57
- {onRemove ? <Remove onClick={onRemove} /> : undefined}
58
- <Handle {...handleProps} />
59
- </div>
60
- </div>
61
- ) : null}
62
- {placeholder ? children : <ul style={{paddingLeft:"10px", paddingRight:"10px", marginTop:"5px"}}>{children}</ul>}
63
- </Component>
64
- );
65
- }
66
- );
@@ -1,103 +0,0 @@
1
- .Container {
2
- display: flex;
3
- flex-direction: column;
4
- grid-auto-rows: max-content;
5
- overflow: hidden;
6
- box-sizing: border-box;
7
- appearance: none;
8
- outline: none;
9
- min-width: 350px;
10
- margin: 10px;
11
- border-radius: 5px;
12
- min-height: 200px;
13
- transition: background-color 350ms ease;
14
- background-color: rgba(246, 246, 246, 1);
15
- border: 1px solid rgba(0, 0, 0, 0.05);
16
- font-size: 1em;
17
-
18
- .ul {
19
- display: grid;
20
- grid-gap: 10px;
21
- grid-template-columns: repeat(var(--columns, 1), 1fr);
22
- list-style: none;
23
- padding: 20px;
24
- margin: 0;
25
- }
26
-
27
- &.scrollable {
28
- .ul {
29
- overflow-y: auto;
30
- }
31
- }
32
-
33
- &.placeholder {
34
- justify-content: center;
35
- align-items: center;
36
- cursor: pointer;
37
- color: rgba(0, 0, 0, 0.5);
38
- background-color: transparent;
39
- border-style: dashed;
40
- border-color: rgba(0, 0, 0, 0.08);
41
-
42
- /* &:hover {
43
- border-color: rgba(0, 0, 0, 0.15);
44
- } */
45
- }
46
-
47
- &.hover {
48
- background-color: rgb(235, 235, 235, 1);
49
- }
50
-
51
- &.unstyled {
52
- overflow: visible;
53
- background-color: transparent !important;
54
- border: none !important;
55
- }
56
-
57
- &.horizontal {
58
- width: 100%;
59
-
60
- .ul {
61
- grid-auto-flow: column;
62
- }
63
- }
64
-
65
- &.shadow {
66
- box-shadow: 0 1px 10px 0 rgba(34, 33, 81, 0.1);
67
- }
68
-
69
- /* &:focus-visible {
70
- border-color: transparent;
71
- box-shadow: 0 0 0 2px rgba(255, 255, 255, 0), 0 0px 0px 2px #4c9ffe;
72
- } */
73
- }
74
-
75
- .Header {
76
- display: flex;
77
- padding: 5px 20px;
78
- padding-right: 8px;
79
- align-items: center;
80
- justify-content: space-between;
81
- background-color: #fff;
82
- border-top-left-radius: 5px;
83
- border-top-right-radius: 5px;
84
- border-bottom: 1px solid rgba(0, 0, 0, 0.08);
85
-
86
- /* &:hover {
87
- .Actions > * {
88
- opacity: 1 !important;
89
- }
90
- } */
91
- }
92
-
93
- /* .Actions {
94
- display: flex;
95
-
96
- > *:first-child:not(:last-child) {
97
- opacity: 0;
98
-
99
- &:focus-visible {
100
- opacity: 1;
101
- }
102
- }
103
- } */
@@ -1,20 +0,0 @@
1
- import React, {forwardRef} from 'react';
2
-
3
- // import {Action} from './Action';
4
-
5
- export const Handle = forwardRef(
6
- (props, ref) => {
7
- return (
8
- <Action
9
- ref={ref}
10
- cursor="grab"
11
- data-cypress="draggable-handle"
12
- {...props}
13
- >
14
- <svg viewBox="0 0 20 20" width="12">
15
- <path d="M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z"></path>
16
- </svg>
17
- </Action>
18
- );
19
- }
20
- );
@@ -1,139 +0,0 @@
1
- import React, {useEffect} from 'react';
2
- import classNames from 'classnames';
3
-
4
- // import { Handle } from './Handle';
5
- // import { Remove } from './Remove';
6
-
7
- import styles from './Item.module.css';
8
- import { Box } from '@mui/material';
9
-
10
- export const Item = React.memo(
11
- React.forwardRef(
12
- (
13
- {
14
- color,
15
- dragOverlay,
16
- dragging,
17
- disabled,
18
- fadeIn,
19
- name,
20
- handle,
21
- handleProps,
22
- height,
23
- cardDetail,
24
- CardTemplate,
25
- index,
26
- listeners,
27
- onRemove,
28
- renderItem,
29
- sorting,
30
- style,
31
- transition,
32
- transform,
33
- value,
34
- handleMoreClick,
35
- handleMoreClose,
36
- wrapperStyle,
37
- ...props
38
- },
39
- ref
40
- ) => {
41
- useEffect(() => {
42
- if (!dragOverlay) {
43
- return;
44
- }
45
-
46
- document.body.style.cursor = 'grabbing';
47
-
48
- return () => {
49
- document.body.style.cursor = '';
50
- };
51
- }, [dragOverlay]);
52
-
53
- cardDetail.moreClicked = handleMoreClick;
54
-
55
- return renderItem ? (
56
- renderItem({
57
- dragOverlay: Boolean(dragOverlay),
58
- dragging: Boolean(dragging),
59
- sorting: Boolean(sorting),
60
- index,
61
- fadeIn: Boolean(fadeIn),
62
- listeners,
63
- ref,
64
- style,
65
- transform,
66
- transition,
67
- value,
68
- })
69
- ) : (
70
- <li
71
- className={classNames(
72
- styles.Wrapper,
73
- fadeIn && styles.fadeIn,
74
- sorting && styles.sorting,
75
- dragOverlay && styles.dragOverlay
76
- )}
77
- style={
78
- {
79
- ...wrapperStyle,
80
- transition: [transition, wrapperStyle?.transition]
81
- .filter(Boolean)
82
- .join(', '),
83
- '--translate-x': transform
84
- ? `${Math.round(transform.x)}px`
85
- : undefined,
86
- '--translate-y': transform
87
- ? `${Math.round(transform.y)}px`
88
- : undefined,
89
- '--scale-x': transform?.scaleX
90
- ? `${transform.scaleX}`
91
- : undefined,
92
- '--scale-y': transform?.scaleY
93
- ? `${transform.scaleY}`
94
- : undefined,
95
- '--index': index,
96
- '--color': color,
97
- paddingTop:"10px"
98
- }
99
- }
100
- ref={ref}
101
- >
102
- <Box
103
- className={classNames(
104
- styles.Item,
105
- dragging && styles.dragging,
106
- handle && styles.withHandle,
107
- dragOverlay && styles.dragOverlay,
108
- disabled && styles.disabled,
109
- color && styles.color
110
- )}
111
- style={style}
112
- data-cypress="draggable-item"
113
- {...(!handle ? listeners : undefined)}
114
- {...props}
115
- tabIndex={!handle ? 0 : undefined}>
116
-
117
-
118
- {CardTemplate != null &&
119
- <CardTemplate props={cardDetail} />
120
- }
121
-
122
- {CardTemplate == null &&
123
- <Box>
124
- {name}
125
- </Box>
126
- }
127
-
128
- <span className={"Actions"}>
129
- {onRemove ? (
130
- <Remove className={"Remove"} onClick={onRemove} />
131
- ) : null}
132
- {handle ? <Handle {...handleProps} {...listeners} /> : null}
133
- </span>
134
- </Box>
135
- </li>
136
- );
137
- }
138
- )
139
- );
@@ -1,135 +0,0 @@
1
- @keyframes pop {
2
- 0% {
3
- transform: scale(1);
4
- box-shadow: var(--box-shadow);
5
- }
6
- 100% {
7
- transform: scale(var(--scale));
8
- box-shadow: var(--box-shadow-picked-up);
9
- }
10
- }
11
-
12
- @keyframes fadeIn {
13
- 0% {
14
- opacity: 0;
15
- }
16
- 100% {
17
- opacity: 1;
18
- }
19
- }
20
-
21
- .Wrapper {
22
- display: flex;
23
- box-sizing: border-box;
24
- transform: translate3d(var(--translate-x, 0), var(--translate-y, 0), 0)
25
- scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1));
26
- transform-origin: 0 0;
27
- touch-action: manipulation;
28
-
29
- &.fadeIn {
30
- animation: fadeIn 500ms ease;
31
- }
32
-
33
- &.dragOverlay {
34
- --scale: 1.05;
35
- --box-shadow: $box-shadow;
36
- --box-shadow-picked-up: $box-shadow-border,
37
- -1px 0 15px 0 rgba(34, 33, 81, 0.01),
38
- 0px 15px 15px 0 rgba(34, 33, 81, 0.25);
39
- z-index: 999;
40
- }
41
- }
42
-
43
- .Item {
44
- position: relative;
45
- display: flex;
46
- flex-grow: 1;
47
- align-items: center;
48
- padding: 18px 20px;
49
- background-color: #fff;
50
- box-shadow: 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05), 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
51
- outline: none;
52
- border-radius: calc(4px / var(--scale-x, 1));
53
- box-sizing: border-box;
54
- list-style: none;
55
- transform-origin: 50% 50%;
56
-
57
- -webkit-tap-highlight-color: transparent;
58
-
59
- color: #333;
60
- font-weight: 400;
61
- font-size: 1rem;
62
- white-space: nowrap;
63
-
64
- transform: scale(var(--scale, 1));
65
- transition: box-shadow 200ms cubic-bezier(0.18, 0.67, 0.6, 1.22);
66
-
67
- /* &:focus-visible {
68
- box-shadow: 0 0px 4px 1px #4c9ffe, 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05), 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
69
- } */
70
-
71
- &:not(.withHandle) {
72
- touch-action: manipulation;
73
- cursor: grab;
74
- }
75
-
76
- &.dragging:not(.dragOverlay) {
77
- opacity: var(--dragging-opacity, 0.5);
78
- z-index: 0;
79
-
80
- /* &:focus {
81
- box-shadow: 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05), 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
82
- } */
83
- }
84
-
85
- &.disabled {
86
- color: #999;
87
- background-color: #f1f1f1;
88
- /* &:focus {
89
- box-shadow: 0 0px 4px 1px rgba(0, 0, 0, 0.1), 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05), 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
90
- } */
91
- cursor: not-allowed;
92
- }
93
-
94
- &.dragOverlay {
95
- cursor: inherit;
96
- /* box-shadow: 0 0px 6px 2px $focused-outline-color; */
97
- animation: pop 200ms cubic-bezier(0.18, 0.67, 0.6, 1.22);
98
- transform: scale(var(--scale));
99
- box-shadow: var(--box-shadow-picked-up);
100
- opacity: 1;
101
- }
102
-
103
- &.color:before {
104
- content: '';
105
- position: absolute;
106
- top: 50%;
107
- transform: translateY(-50%);
108
- left: 0;
109
- height: 100%;
110
- width: 3px;
111
- display: block;
112
- border-top-left-radius: 3px;
113
- border-bottom-left-radius: 3px;
114
- background-color: var(--color);
115
- }
116
-
117
- /* &:hover {
118
- .Remove {
119
- visibility: visible;
120
- }
121
- } */
122
- }
123
-
124
- .Remove {
125
- visibility: hidden;
126
- }
127
-
128
- .Actions {
129
- display: flex;
130
- align-self: flex-start;
131
- margin-top: -12px;
132
- margin-left: auto;
133
- margin-bottom: -15px;
134
- margin-right: -10px;
135
- }