@visns-studio/visns-components 6.6.4 → 6.15.1
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/README.md +1623 -18
- package/package.json +10 -4
- package/src/components/DataGrid.jsx +181 -38
- package/src/components/Fetch.jsx +80 -3
- package/src/components/Form.jsx +9 -0
- package/src/components/Navigation.jsx +109 -50
- package/src/components/Notification.jsx +279 -9
- package/src/components/TableFilter.jsx +14 -1
- package/src/components/auth/AuthBrandPanel.jsx +43 -0
- package/src/components/auth/AuthLoading.jsx +78 -0
- package/src/components/auth/AuthShell.jsx +59 -0
- package/src/components/auth/ClientAuth.jsx +161 -0
- package/src/components/auth/ClientAuthFrame.jsx +59 -0
- package/src/components/auth/ClientLogin.jsx +266 -55
- package/src/components/auth/ClientOTPVerify.jsx +587 -115
- package/src/components/auth/ImpersonateGate.jsx +254 -0
- package/src/components/auth/Login.jsx +134 -41
- package/src/components/auth/LogoutScreen.jsx +112 -0
- package/src/components/auth/Reset.jsx +134 -77
- package/src/components/auth/TwoFactorAuth.jsx +475 -297
- package/src/components/auth/Verify.jsx +237 -126
- package/src/components/auth/authEndpoints.js +105 -0
- package/src/components/auth/authFont.js +23 -0
- package/src/components/auth/authHelpers.js +465 -0
- package/src/components/auth/clientAuthProtocols.js +240 -0
- package/src/components/auth/useOptionalRouter.js +49 -0
- package/src/components/callQueue/CallQueuePop.jsx +1502 -0
- package/src/components/callQueue/CallQueueSettings.jsx +508 -0
- package/src/components/callQueue/callQueueHelpers.js +280 -0
- package/src/components/callQueue/callQueueSettingsHelpers.js +75 -0
- package/src/components/columns/ColumnRenderers.jsx +53 -7
- package/src/components/generic/GenericAuth.jsx +163 -96
- package/src/components/generic/GenericDetail.jsx +215 -90
- package/src/components/generic/GenericIndex.jsx +20 -47
- package/src/components/generic/GenericMain.jsx +5 -0
- package/src/components/generic/GroupedReportRenderer.jsx +1 -5
- package/src/components/generic/StandardModal.jsx +17 -5
- package/src/components/generic/reportSemanticSteps/SemanticEntityStep.jsx +1 -6
- package/src/components/generic/reportSemanticSteps/SemanticFieldsStep.jsx +4 -11
- package/src/components/generic/reportSemanticSteps/SemanticFiltersStep.jsx +9 -27
- package/src/components/generic/reportSemanticSteps/SemanticGroupingStep.jsx +5 -13
- package/src/components/generic/reportSemanticSteps/SemanticParameterPrompt.jsx +5 -13
- package/src/components/generic/reportSemanticSteps/SemanticPreviewStep.jsx +14 -31
- package/src/components/generic/reportSemanticSteps/SemanticRelationsStep.jsx +3 -9
- package/src/components/generic/reportSemanticSteps/SemanticValueInput.jsx +2 -15
- package/src/components/navActive.js +60 -0
- package/src/components/notify/desktopNotifications.js +256 -0
- package/src/components/sketch/SketchField.jsx +12 -2
- package/src/components/sms/SmsComposeModal.jsx +495 -0
- package/src/components/sms/SmsInbox.jsx +596 -0
- package/src/components/sms/SmsInboxBadge.jsx +468 -0
- package/src/components/sms/SmsLineSettings.jsx +854 -0
- package/src/components/sms/SmsThreadPanel.jsx +1184 -0
- package/src/components/sms/smsEndpoints.js +56 -0
- package/src/components/sms/smsHelpers.js +1075 -0
- package/src/components/sms/smsLiveState.js +132 -0
- package/src/components/sms/useSmsLive.js +307 -0
- package/src/components/styles/CallQueuePop.module.scss +646 -0
- package/src/components/styles/CallQueueSettings.module.scss +460 -0
- package/src/components/styles/ClientAuth.module.scss +229 -0
- package/src/components/styles/GenericDetail.module.scss +153 -26
- package/src/components/styles/GenericIndex.module.scss +13 -0
- package/src/components/styles/GenericMain.module.scss +19 -2
- package/src/components/styles/ImpersonateGate.module.scss +85 -0
- package/src/components/styles/Login.module.scss +13 -122
- package/src/components/styles/LogoutScreen.module.scss +89 -0
- package/src/components/styles/Navigation.module.scss +509 -223
- package/src/components/styles/Notification.module.scss +103 -0
- package/src/components/styles/Reset.module.scss +52 -186
- package/src/components/styles/Sms.module.scss +2382 -0
- package/src/components/styles/TableFilter.module.scss +118 -98
- package/src/components/styles/TwoFactorAuth.module.scss +115 -176
- package/src/components/styles/Vault.module.scss +1983 -0
- package/src/components/styles/Verify.module.scss +57 -180
- package/src/components/styles/_authBrandPanel.scss +163 -0
- package/src/components/styles/_authShell.scss +369 -0
- package/src/components/styles/global-datagrid.css +27 -2
- package/src/components/utils/buildEnv.js +67 -0
- package/src/components/utils/displayValue.js +94 -0
- package/src/components/utils/useDensity.js +345 -9
- package/src/components/vault/OtpChip.jsx +208 -0
- package/src/components/vault/PasswordGenerator.jsx +145 -0
- package/src/components/vault/QrScanner.jsx +326 -0
- package/src/components/vault/VaultAccessLog.jsx +225 -0
- package/src/components/vault/VaultConfirmPanel.jsx +113 -0
- package/src/components/vault/VaultEntryForm.jsx +740 -0
- package/src/components/vault/VaultManager.jsx +1000 -0
- package/src/components/vault/VaultQuickSearch.jsx +681 -0
- package/src/components/vault/qrDecode.js +257 -0
- package/src/components/vault/useDebouncedValue.js +22 -0
- package/src/components/vault/useVaultReveal.js +160 -0
- package/src/components/vault/vaultClipboard.js +33 -0
- package/src/components/vault/vaultEndpoints.js +40 -0
- package/src/components/vault/vaultFit.js +116 -0
- package/src/components/vault/vaultHelpers.js +547 -0
- package/src/components/vault/vaultNavigation.jsx +58 -0
- package/src/components/vault/vaultOtp.js +105 -0
- package/src/index.js +233 -1
|
@@ -1,109 +1,166 @@
|
|
|
1
1
|
import '../styles/global.css';
|
|
2
|
+
import './authFont';
|
|
2
3
|
|
|
3
4
|
import React, { useState } from 'react';
|
|
4
|
-
import
|
|
5
|
+
import { Link } from 'react-router-dom';
|
|
5
6
|
import { toast } from 'react-toastify';
|
|
6
|
-
import
|
|
7
|
-
import { User } from 'lucide-react';
|
|
7
|
+
import { ArrowLeft, MailCheck } from 'lucide-react';
|
|
8
8
|
|
|
9
9
|
import CustomFetch from '../Fetch';
|
|
10
|
+
import AuthShell from './AuthShell';
|
|
11
|
+
import { resolveAuthEndpoints } from './authEndpoints';
|
|
12
|
+
import { normaliseAuthError } from './authHelpers';
|
|
10
13
|
|
|
11
14
|
import styles from '../styles/Reset.module.scss';
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Forgot password — the first half of the reset journey.
|
|
18
|
+
*
|
|
19
|
+
* Redesigned in 6.7.0 onto the same two-pane frame as the login screen it is
|
|
20
|
+
* reached from; the pre-6.1 centred card it used to render had its own greys,
|
|
21
|
+
* its own button and its own idea of what a form field looks like.
|
|
22
|
+
*
|
|
23
|
+
* The request itself is unchanged: POST {passwordForgot} with `{email}`, and a
|
|
24
|
+
* `{error: ''}` body means the mail is on its way.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const DEFAULT_COPY = {
|
|
28
|
+
title: 'Forgot your password?',
|
|
29
|
+
subtitle:
|
|
30
|
+
'Enter the email address on your account and we will send you a link to set a new password.',
|
|
31
|
+
fieldLabel: 'Email',
|
|
32
|
+
submit: 'Send Reset Link',
|
|
33
|
+
submitting: 'Sending…',
|
|
34
|
+
/** Replaces the form once the request is in. */
|
|
35
|
+
sent: 'If that address is on an account, a reset link is on its way. Follow the instructions in the email to set a new password.',
|
|
36
|
+
back: 'Back to Login',
|
|
37
|
+
/** Client-side validation. */
|
|
38
|
+
required: 'Please type in your email address.',
|
|
39
|
+
failed: 'Could not request a password reset, please try again.',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const Reset = ({
|
|
43
|
+
logo,
|
|
44
|
+
loginBg,
|
|
45
|
+
config = {},
|
|
46
|
+
/** Merged over the 6.6.3 literals — see authEndpoints.js. */
|
|
47
|
+
endpoints,
|
|
48
|
+
/** Merged over DEFAULT_COPY above. */
|
|
49
|
+
copy: copyOverrides,
|
|
50
|
+
loginPath = '/login',
|
|
51
|
+
}) => {
|
|
52
|
+
const urls = resolveAuthEndpoints(endpoints);
|
|
53
|
+
const copy = { ...DEFAULT_COPY, ...(copyOverrides || {}) };
|
|
54
|
+
const branding = config.branding || {};
|
|
55
|
+
|
|
14
56
|
const [email, setEmail] = useState('');
|
|
15
57
|
const [emailClass, setEmailClass] = useState('');
|
|
58
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
59
|
+
const [isSent, setIsSent] = useState(false);
|
|
16
60
|
|
|
17
61
|
const handleSubmit = (e) => {
|
|
18
62
|
e.preventDefault();
|
|
19
63
|
|
|
20
|
-
|
|
21
|
-
|
|
64
|
+
// The button is disabled too; this also covers Enter in the field.
|
|
65
|
+
if (isLoading) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (email.trim() === '') {
|
|
22
70
|
setEmailClass('inputError');
|
|
23
|
-
toast.error(
|
|
71
|
+
toast.error(copy.required);
|
|
72
|
+
|
|
24
73
|
return;
|
|
25
74
|
}
|
|
26
75
|
|
|
76
|
+
setIsLoading(true);
|
|
77
|
+
|
|
27
78
|
CustomFetch(
|
|
28
|
-
|
|
79
|
+
urls.passwordForgot,
|
|
29
80
|
'POST',
|
|
30
81
|
{ email: email },
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
82
|
+
(result) => {
|
|
83
|
+
setIsLoading(false);
|
|
84
|
+
|
|
85
|
+
const failure =
|
|
86
|
+
(result && typeof result === 'object' && result.error) ||
|
|
87
|
+
'';
|
|
88
|
+
|
|
89
|
+
if (failure) {
|
|
90
|
+
setEmailClass('inputError');
|
|
91
|
+
toast.error(normaliseAuthError(failure, copy.failed));
|
|
92
|
+
|
|
93
|
+
return;
|
|
39
94
|
}
|
|
95
|
+
|
|
96
|
+
setEmail('');
|
|
97
|
+
// The form is replaced rather than re-offered: a second submit
|
|
98
|
+
// while the first mail is still in flight only produces a
|
|
99
|
+
// second link, and invalidates the first.
|
|
100
|
+
setIsSent(true);
|
|
101
|
+
toast.success(copy.sent);
|
|
102
|
+
},
|
|
103
|
+
(error) => {
|
|
104
|
+
setIsLoading(false);
|
|
105
|
+
setEmailClass('inputError');
|
|
106
|
+
toast.error(normaliseAuthError(error, copy.failed));
|
|
40
107
|
}
|
|
41
108
|
);
|
|
42
109
|
};
|
|
43
110
|
|
|
44
111
|
return (
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
textAlign: 'center',
|
|
59
|
-
marginBottom: '1.5rem',
|
|
60
|
-
color: '#111827',
|
|
61
|
-
fontWeight: '600',
|
|
62
|
-
fontSize: '1.5rem',
|
|
63
|
-
}}
|
|
64
|
-
>
|
|
65
|
-
Forgot your password?
|
|
66
|
-
</h2>
|
|
67
|
-
<div
|
|
68
|
-
className={`${styles.formItem} ${styles.fwItem}`}
|
|
69
|
-
>
|
|
70
|
-
<label className={styles.fi__label}>
|
|
71
|
-
<input
|
|
72
|
-
type="email"
|
|
73
|
-
name="email"
|
|
74
|
-
value={email}
|
|
75
|
-
onChange={(e) => {
|
|
76
|
-
setEmail(e.target.value);
|
|
77
|
-
setEmailClass('');
|
|
78
|
-
}}
|
|
79
|
-
tabIndex="1"
|
|
80
|
-
className={emailClass}
|
|
81
|
-
/>
|
|
82
|
-
<span className={styles.fi__span}>
|
|
83
|
-
Email
|
|
84
|
-
</span>
|
|
85
|
-
<small>
|
|
86
|
-
<User strokeWidth={2} size={18} />
|
|
87
|
-
</small>
|
|
88
|
-
</label>
|
|
89
|
-
</div>
|
|
90
|
-
<div
|
|
91
|
-
className={`${styles.formItem} ${styles.fwItem} ${styles.lastItem}`}
|
|
92
|
-
>
|
|
93
|
-
<button
|
|
94
|
-
className={styles.btn}
|
|
95
|
-
type="submit"
|
|
96
|
-
tabIndex="2"
|
|
97
|
-
>
|
|
98
|
-
Send Reset Link
|
|
99
|
-
</button>
|
|
100
|
-
</div>
|
|
101
|
-
</div>
|
|
102
|
-
</Reveal>
|
|
103
|
-
</form>
|
|
112
|
+
<AuthShell
|
|
113
|
+
styles={styles}
|
|
114
|
+
logo={logo}
|
|
115
|
+
loginBg={loginBg}
|
|
116
|
+
branding={branding}
|
|
117
|
+
title={copy.title}
|
|
118
|
+
subtitle={isSent ? null : copy.subtitle}
|
|
119
|
+
footer={branding.footer}
|
|
120
|
+
>
|
|
121
|
+
{isSent ? (
|
|
122
|
+
<div className={styles.sent}>
|
|
123
|
+
<MailCheck size={18} strokeWidth={2} />
|
|
124
|
+
<p>{copy.sent}</p>
|
|
104
125
|
</div>
|
|
105
|
-
|
|
106
|
-
|
|
126
|
+
) : (
|
|
127
|
+
<form onSubmit={handleSubmit} className={styles.form}>
|
|
128
|
+
<div className={styles.field}>
|
|
129
|
+
<input
|
|
130
|
+
id="reset-email"
|
|
131
|
+
type="email"
|
|
132
|
+
name="email"
|
|
133
|
+
value={email}
|
|
134
|
+
onChange={(e) => {
|
|
135
|
+
setEmail(e.target.value);
|
|
136
|
+
setEmailClass('');
|
|
137
|
+
}}
|
|
138
|
+
tabIndex="1"
|
|
139
|
+
className={emailClass}
|
|
140
|
+
autoComplete="username"
|
|
141
|
+
placeholder=" "
|
|
142
|
+
autoFocus
|
|
143
|
+
disabled={isLoading}
|
|
144
|
+
/>
|
|
145
|
+
<label htmlFor="reset-email">{copy.fieldLabel}</label>
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
<button
|
|
149
|
+
className={styles.submit}
|
|
150
|
+
type="submit"
|
|
151
|
+
disabled={isLoading}
|
|
152
|
+
tabIndex="2"
|
|
153
|
+
>
|
|
154
|
+
{isLoading ? copy.submitting : copy.submit}
|
|
155
|
+
</button>
|
|
156
|
+
</form>
|
|
157
|
+
)}
|
|
158
|
+
|
|
159
|
+
<Link to={loginPath} className={styles.back}>
|
|
160
|
+
<ArrowLeft size={15} strokeWidth={2} />
|
|
161
|
+
{copy.back}
|
|
162
|
+
</Link>
|
|
163
|
+
</AuthShell>
|
|
107
164
|
);
|
|
108
165
|
};
|
|
109
166
|
|