@peassoft/mnr-web-topline 4.0.1 → 4.2.0
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/dist/en/modules/env/index.d.ts +8 -0
- package/dist/en/modules/env/index.js +15 -0
- package/dist/en/modules/local-db/create-request-error.d.ts +2 -2
- package/dist/en/modules/local-db/create-request-error.js +2 -2
- package/dist/en/modules/local-db/init-db.js +3 -3
- package/dist/en/modules/logger/index.d.ts +1 -1
- package/dist/en/modules/logger/index.js +19 -2
- package/dist/en/modules/request/index.js +5 -5
- package/dist/en/modules/topline-service/inner-service.js +3 -3
- package/dist/en/modules/ui-lang/index.d.ts +4 -8
- package/dist/en/modules/ui-lang/index.js +6 -18
- package/dist/en/modules/websocket/index.js +2 -2
- package/dist/en/parts/logout/actions/perform-logout/index.d.ts +1 -20
- package/dist/en/parts/logout/actions/perform-logout/index.js +9 -22
- package/dist/en/parts/password-recovery/actions/create-claim/index.d.ts +1 -13
- package/dist/en/parts/password-recovery/actions/create-claim/index.js +5 -14
- package/dist/en/parts/profile/actions/change-password/index.js +2 -2
- package/dist/en/parts/profile/ui/root/has-changes.js +1 -1
- package/dist/en/parts/profile/ui/root/index.js +3 -3
- package/dist/en/parts/shell/actions/refresh-user/index.d.ts +1 -22
- package/dist/en/parts/shell/actions/refresh-user/index.js +13 -27
- package/dist/en/parts/signup/actions/perform-signup/index.d.ts +2 -1
- package/dist/en/parts/signup/ui/signup/index.js +17 -3
- package/dist/en/shared/procedures/process-response.js +3 -3
- package/dist/ru/modules/env/index.d.ts +8 -0
- package/dist/ru/modules/env/index.js +15 -0
- package/dist/ru/modules/local-db/create-request-error.d.ts +2 -2
- package/dist/ru/modules/local-db/create-request-error.js +2 -2
- package/dist/ru/modules/local-db/init-db.js +3 -3
- package/dist/ru/modules/logger/index.d.ts +1 -1
- package/dist/ru/modules/logger/index.js +19 -2
- package/dist/ru/modules/request/index.js +5 -5
- package/dist/ru/modules/topline-service/inner-service.js +3 -3
- package/dist/ru/modules/ui-lang/index.d.ts +4 -8
- package/dist/ru/modules/ui-lang/index.js +6 -18
- package/dist/ru/modules/websocket/index.js +2 -2
- package/dist/ru/parts/logout/actions/perform-logout/index.d.ts +1 -20
- package/dist/ru/parts/logout/actions/perform-logout/index.js +9 -22
- package/dist/ru/parts/password-recovery/actions/create-claim/index.d.ts +1 -13
- package/dist/ru/parts/password-recovery/actions/create-claim/index.js +5 -14
- package/dist/ru/parts/profile/actions/change-password/index.js +2 -2
- package/dist/ru/parts/profile/ui/root/has-changes.js +1 -1
- package/dist/ru/parts/profile/ui/root/index.js +3 -3
- package/dist/ru/parts/shell/actions/refresh-user/index.d.ts +1 -22
- package/dist/ru/parts/shell/actions/refresh-user/index.js +13 -27
- package/dist/ru/parts/signup/actions/perform-signup/index.d.ts +2 -1
- package/dist/ru/parts/signup/ui/signup/index.js +17 -3
- package/dist/ru/shared/procedures/process-response.js +3 -3
- package/package.json +9 -9
- package/dist/en/parts/profile/ui/root/get-initial-ui-lang.d.ts +0 -2
- package/dist/en/parts/profile/ui/root/get-initial-ui-lang.js +0 -4
- package/dist/ru/parts/profile/ui/root/get-initial-ui-lang.d.ts +0 -2
- package/dist/ru/parts/profile/ui/root/get-initial-ui-lang.js +0 -4
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useContext, useState, useCallback, useEffect, createRef } from 'react';
|
|
2
|
+
import { useContext, useState, useCallback, useMemo, useEffect, createRef } from 'react';
|
|
3
|
+
import { supportedLanguagesDescriptors } from '@peassoft/mnr-langs';
|
|
3
4
|
import Modal from '../../../../shared/components/modal/index.js';
|
|
4
5
|
import Alternative from '../../../../shared/components/alternative/index.js';
|
|
5
6
|
import { InputField } from '@peassoft/mnr-web-ui-kit/input-field/index.js';
|
|
6
7
|
import { Button } from '@peassoft/mnr-web-ui-kit/button/index.js';
|
|
7
8
|
import { ErrorMessage } from '@peassoft/mnr-web-ui-kit/error-message/index.js';
|
|
9
|
+
import { Select } from '@peassoft/mnr-web-ui-kit/select/index.js';
|
|
8
10
|
import { ToplineContext } from '../../../shell/index.js';
|
|
9
11
|
import { globalRefs } from '../../../../modules/focus-marshal/index.js';
|
|
10
12
|
import validateEmail from '../../../../modules/validators/email.js';
|
|
11
13
|
import validatePassword from '../../../../modules/validators/password.js';
|
|
14
|
+
import { getPageLang } from '../../../../modules/ui-lang/index.js';
|
|
12
15
|
import performSignup from '../../actions/perform-signup/index.js';
|
|
13
16
|
export default function Signup(props) {
|
|
14
17
|
const {
|
|
@@ -20,6 +23,7 @@ export default function Signup(props) {
|
|
|
20
23
|
const [email, setEmail] = useState('');
|
|
21
24
|
const [isEmailValid, setIsEmailValid] = useState(true);
|
|
22
25
|
const [userName, setUserName] = useState('');
|
|
26
|
+
const [uiLang, setUiLang] = useState(getPageLang());
|
|
23
27
|
const [password, setPassword] = useState('');
|
|
24
28
|
const [isPasswordValid, setIsPasswordValid] = useState(true);
|
|
25
29
|
const [passwordConfirmation, setPasswordConfirmation] = useState('');
|
|
@@ -29,8 +33,13 @@ export default function Signup(props) {
|
|
|
29
33
|
const {
|
|
30
34
|
handleUserChange
|
|
31
35
|
} = useContext(ToplineContext);
|
|
36
|
+
const uiLangOptions = useMemo(() => supportedLanguagesDescriptors().map(langDescriptor => ({
|
|
37
|
+
id: langDescriptor.code,
|
|
38
|
+
value: langDescriptor.name
|
|
39
|
+
})), []);
|
|
32
40
|
const handleEmailChange = useCallback(newValue => setEmail(newValue.trim()), []);
|
|
33
41
|
const handleUserNameChange = useCallback(newValue => setUserName(newValue), []);
|
|
42
|
+
const handleUiLangChange = useCallback(val => setUiLang(val), []);
|
|
34
43
|
const handlePasswordChange = useCallback(newValue => setPassword(newValue.trim()), []);
|
|
35
44
|
const handlePasswordConfirmationChange = useCallback(newValue => setPasswordConfirmation(newValue.trim()), []);
|
|
36
45
|
const handleEmailBlur = useCallback(() => setIsEmailValid(validateEmail(email)), [email]);
|
|
@@ -58,7 +67,7 @@ export default function Signup(props) {
|
|
|
58
67
|
...(userName ? {
|
|
59
68
|
userName: userName.trim()
|
|
60
69
|
} : {}),
|
|
61
|
-
uiLang
|
|
70
|
+
uiLang
|
|
62
71
|
};
|
|
63
72
|
const {
|
|
64
73
|
user,
|
|
@@ -80,7 +89,7 @@ export default function Signup(props) {
|
|
|
80
89
|
default:
|
|
81
90
|
throw new Error('Unknown error of a login request');
|
|
82
91
|
}
|
|
83
|
-
}, [email, password, passwordConfirmation, userName, onClose, handleUserChange]);
|
|
92
|
+
}, [email, uiLang, password, passwordConfirmation, userName, onClose, handleUserChange]);
|
|
84
93
|
const handleTabOnLastElement = useCallback(() => globalRefs.modalFirstItem.current?.focus(), []);
|
|
85
94
|
const handleShiftTabOnFirstElement = useCallback(() => lastElementRef.current?.focus(), [lastElementRef]);
|
|
86
95
|
useEffect(() => globalRefs.modalFirstItem.current?.focus(), []);
|
|
@@ -107,6 +116,11 @@ export default function Signup(props) {
|
|
|
107
116
|
label: "Ваше имя",
|
|
108
117
|
value: userName,
|
|
109
118
|
onChange: handleUserNameChange
|
|
119
|
+
}), _jsx(Select, {
|
|
120
|
+
label: "Предпочитаемый язык для пользовательского интерфейса",
|
|
121
|
+
items: uiLangOptions,
|
|
122
|
+
selectedItemId: uiLang,
|
|
123
|
+
onChange: handleUiLangChange
|
|
110
124
|
}), _jsx(InputField, {
|
|
111
125
|
type: 'password',
|
|
112
126
|
autocompleteAttribute: 'new-password',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import VError from '@peassoft/verror';
|
|
2
2
|
import { updateUser, updateGrantToken, updateRefreshToken, updateIsUserKnown } from '../../modules/local-db/index.js';
|
|
3
3
|
import { setGrantToken, setRefreshToken } from '../../modules/tokens/index.js';
|
|
4
4
|
import { openWebsocket } from '../../modules/websocket/index.js';
|
|
@@ -28,7 +28,7 @@ export default async function processResponse(response, url, eventName) {
|
|
|
28
28
|
error: null
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
logError(new
|
|
31
|
+
logError(new VError({
|
|
32
32
|
name: 'UnexpectedError'
|
|
33
33
|
}, `unexpected payload of response to request to ${url}`));
|
|
34
34
|
return {
|
|
@@ -36,7 +36,7 @@ export default async function processResponse(response, url, eventName) {
|
|
|
36
36
|
error: 'network'
|
|
37
37
|
};
|
|
38
38
|
} catch (e) {
|
|
39
|
-
logError(new
|
|
39
|
+
logError(new VError({
|
|
40
40
|
name: 'UnexpectedError',
|
|
41
41
|
...(e instanceof Error ? {
|
|
42
42
|
cause: e
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peassoft/mnr-web-topline",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Peassoft Topline widget for mem'n'rev web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -38,16 +38,15 @@
|
|
|
38
38
|
"@types/md5": "^2.3.3",
|
|
39
39
|
"@types/react": "^19.0.2",
|
|
40
40
|
"@types/react-dom": "^19.0.2",
|
|
41
|
-
"@
|
|
42
|
-
"@vitejs/plugin-react": "^5.1.4",
|
|
41
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
43
42
|
"autoprefixer": "^10.3.4",
|
|
44
43
|
"clean-webpack-plugin": "^4.0.0",
|
|
45
|
-
"copy-webpack-plugin": "^
|
|
44
|
+
"copy-webpack-plugin": "^14.0.0",
|
|
46
45
|
"cpy-cli": "^7.0.0",
|
|
47
46
|
"css-loader": "^7.1.2",
|
|
48
47
|
"eslint": "^9.8.0",
|
|
49
48
|
"html-webpack-plugin": "^5.3.2",
|
|
50
|
-
"jsdom": "^
|
|
49
|
+
"jsdom": "^29.0.1",
|
|
51
50
|
"postcss": "^8.3.6",
|
|
52
51
|
"postcss-loader": "^8.0.0",
|
|
53
52
|
"postcss-normalize": "^13.0.1",
|
|
@@ -59,18 +58,19 @@
|
|
|
59
58
|
"stylelint": "^17.0.0",
|
|
60
59
|
"stylelint-config-sass-guidelines": "^13.0.0",
|
|
61
60
|
"ts-loader": "^9.4.4",
|
|
62
|
-
"typescript": "^
|
|
61
|
+
"typescript": "^6.0.2",
|
|
63
62
|
"vitest": "^4.0.7",
|
|
64
63
|
"webpack": "^5.52.0",
|
|
65
|
-
"webpack-cli": "^
|
|
64
|
+
"webpack-cli": "^7.0.2",
|
|
66
65
|
"webpack-dev-server": "^5.2.0"
|
|
67
66
|
},
|
|
68
67
|
"dependencies": {
|
|
69
|
-
"@
|
|
68
|
+
"@peassoft/mnr-langs": "^1.2.0",
|
|
69
|
+
"@peassoft/verror": "^1.0.0",
|
|
70
|
+
"@peassoft/web-logger": "^1.0.0",
|
|
70
71
|
"email-validator": "^2.0.4",
|
|
71
72
|
"md5": "^2.3.0",
|
|
72
73
|
"react-error-boundary": "^6.0.0",
|
|
73
|
-
"stampit": "^4.3.2",
|
|
74
74
|
"uuid": "^13.0.0"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|