@digitaldefiance/express-suite-react-components 2.9.11 → 2.9.12
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 +3 -3
- package/src/components/ApiAccess.d.ts.map +1 -1
- package/src/components/ApiAccess.js +16 -9
- package/src/components/BackupCodeLoginForm.d.ts +2 -2
- package/src/components/BackupCodeLoginForm.d.ts.map +1 -1
- package/src/components/BackupCodeLoginForm.js +62 -29
- package/src/components/BackupCodesForm.d.ts.map +1 -1
- package/src/components/BackupCodesForm.js +29 -17
- package/src/components/ChangePasswordForm.d.ts.map +1 -1
- package/src/components/ChangePasswordForm.js +29 -17
- package/src/components/ExpirationSecondsSelector.d.ts +3 -3
- package/src/components/ExpirationSecondsSelector.d.ts.map +1 -1
- package/src/components/ExpirationSecondsSelector.js +1 -1
- package/src/components/Flag.d.ts.map +1 -1
- package/src/components/ForgotPasswordForm.d.ts.map +1 -1
- package/src/components/ForgotPasswordForm.js +16 -9
- package/src/components/LoginForm.d.ts +2 -2
- package/src/components/LoginForm.d.ts.map +1 -1
- package/src/components/LoginForm.js +52 -29
- package/src/components/RegisterForm.d.ts +5 -3
- package/src/components/RegisterForm.d.ts.map +1 -1
- package/src/components/RegisterForm.js +62 -27
- package/src/components/ResetPasswordForm.d.ts.map +1 -1
- package/src/components/ResetPasswordForm.js +25 -15
- package/src/components/TopMenu.d.ts.map +1 -1
- package/src/components/TopMenu.js +2 -3
- package/src/components/TranslatedTitle.d.ts +1 -1
- package/src/components/TranslatedTitle.d.ts.map +1 -1
- package/src/components/TranslatedTitle.js +1 -1
- package/src/components/UserSettingsForm.d.ts +4 -3
- package/src/components/UserSettingsForm.d.ts.map +1 -1
- package/src/components/UserSettingsForm.js +58 -25
- package/src/components/VerifyEmailPage.d.ts.map +1 -1
- package/src/components/VerifyEmailPage.js +20 -11
- package/src/contexts/AuthProvider.d.ts +4 -4
- package/src/contexts/AuthProvider.d.ts.map +1 -1
- package/src/contexts/AuthProvider.js +82 -27
- package/src/contexts/I18nProvider.d.ts.map +1 -1
- package/src/contexts/MenuContext.d.ts +2 -2
- package/src/contexts/MenuContext.d.ts.map +1 -1
- package/src/contexts/MenuContext.js +72 -43
- package/src/hooks/useBackupCodes.d.ts.map +1 -1
- package/src/hooks/useBackupCodes.js +8 -4
- package/src/hooks/useEmailVerification.d.ts.map +1 -1
- package/src/hooks/useEmailVerification.js +8 -4
- package/src/hooks/useUserSettings.d.ts +4 -2
- package/src/hooks/useUserSettings.d.ts.map +1 -1
- package/src/hooks/useUserSettings.js +30 -13
- package/src/services/authService.d.ts.map +1 -1
- package/src/services/authService.js +45 -63
- package/src/wrappers/BackupCodeLoginWrapper.d.ts.map +1 -1
- package/src/wrappers/BackupCodeLoginWrapper.js +0 -1
- package/src/wrappers/ChangePasswordFormWrapper.d.ts.map +1 -1
- package/src/wrappers/RegisterFormWrapper.d.ts.map +1 -1
- package/src/wrappers/RegisterFormWrapper.js +7 -2
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LoginForm = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
6
7
|
const icons_material_1 = require("@mui/icons-material");
|
|
7
8
|
const material_1 = require("@mui/material");
|
|
8
9
|
const formik_1 = require("formik");
|
|
9
10
|
const react_1 = require("react");
|
|
10
11
|
const Yup = tslib_1.__importStar(require("yup"));
|
|
11
|
-
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
12
12
|
const contexts_1 = require("../contexts");
|
|
13
13
|
const LoginForm = ({ onSubmit, loginType: initialLoginType = 'email', authType: initialAuthType = 'password', allowLoginTypeToggle = true, allowAuthTypeToggle = true, showForgotPassword = true, showSignUp = true, forgotPasswordLink = '/forgot-password', signUpLink = '/register', emailLabel, usernameLabel, passwordLabel, mnemonicLabel, signInButtonText, forgotPasswordText, signUpText, useUsernameText, useEmailText, useMnemonicText, usePasswordText, toggleVisibilityLabel, titleText, emailValidation, usernameValidation, passwordValidation, mnemonicValidation, additionalFields, additionalInitialValues = {}, additionalValidation = {}, }) => {
|
|
14
14
|
const { tComponent } = (0, contexts_1.useI18n)();
|
|
@@ -17,33 +17,50 @@ const LoginForm = ({ onSubmit, loginType: initialLoginType = 'email', authType:
|
|
|
17
17
|
const [showSecret, setShowSecret] = (0, react_1.useState)(false);
|
|
18
18
|
// Use translations with fallbacks
|
|
19
19
|
const labels = {
|
|
20
|
-
title: titleText ||
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
title: titleText ||
|
|
21
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Login_Title),
|
|
22
|
+
email: emailLabel ||
|
|
23
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Email),
|
|
24
|
+
username: usernameLabel ||
|
|
25
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Username),
|
|
26
|
+
password: passwordLabel ||
|
|
27
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Password),
|
|
28
|
+
mnemonic: mnemonicLabel ||
|
|
29
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Mnemonic),
|
|
30
|
+
signIn: signInButtonText ||
|
|
31
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.SignInButton),
|
|
32
|
+
forgotPassword: forgotPasswordText ||
|
|
33
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Login_ForgotPassword),
|
|
34
|
+
signUp: signUpText ||
|
|
35
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Login_SignUp),
|
|
36
|
+
useUsername: useUsernameText ||
|
|
37
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Login_UseUsername),
|
|
38
|
+
useEmail: useEmailText ||
|
|
39
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Login_UseEmailAddress),
|
|
40
|
+
useMnemonic: useMnemonicText ||
|
|
41
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_UseMnemonic),
|
|
42
|
+
usePassword: usePasswordText ||
|
|
43
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_UsePassword),
|
|
44
|
+
toggleVisibility: toggleVisibilityLabel ||
|
|
45
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.TogglePasswordVisibility),
|
|
33
46
|
};
|
|
34
47
|
const validation = {
|
|
35
|
-
email: emailValidation ||
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
email: emailValidation ||
|
|
49
|
+
Yup.string()
|
|
50
|
+
.email(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_InvalidEmail))
|
|
51
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
52
|
+
username: usernameValidation ||
|
|
53
|
+
Yup.string()
|
|
54
|
+
.matches(suite_core_lib_1.Constants.UsernameRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_UsernameRegexErrorTemplate))
|
|
55
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
56
|
+
password: passwordValidation ||
|
|
57
|
+
Yup.string()
|
|
58
|
+
.min(1, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required))
|
|
59
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
60
|
+
mnemonic: mnemonicValidation ||
|
|
61
|
+
Yup.string()
|
|
62
|
+
.matches(suite_core_lib_1.Constants.MnemonicRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_InvalidMnemonic))
|
|
63
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
47
64
|
};
|
|
48
65
|
const formik = (0, formik_1.useFormik)({
|
|
49
66
|
initialValues: {
|
|
@@ -67,7 +84,9 @@ const LoginForm = ({ onSubmit, loginType: initialLoginType = 'email', authType:
|
|
|
67
84
|
await onSubmit(values);
|
|
68
85
|
}
|
|
69
86
|
catch (error) {
|
|
70
|
-
|
|
87
|
+
const err = error;
|
|
88
|
+
setStatus(err.message ||
|
|
89
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_UnexpectedError));
|
|
71
90
|
throw error;
|
|
72
91
|
}
|
|
73
92
|
},
|
|
@@ -77,7 +96,9 @@ const LoginForm = ({ onSubmit, loginType: initialLoginType = 'email', authType:
|
|
|
77
96
|
display: 'flex',
|
|
78
97
|
flexDirection: 'column',
|
|
79
98
|
alignItems: 'center',
|
|
80
|
-
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h1", variant: "h5", children: labels.title }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "form", onSubmit: formik.handleSubmit, sx: { mt: 1, width: '100%' }, children: [formik.status && ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", sx: { mb: 2 }, children: formik.status })), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, id: loginType, label: loginType === 'email' ? labels.email : labels.username, name: loginType, autoComplete: loginType === 'email' ? 'email' : 'username', autoFocus: true, value: loginType === 'email'
|
|
99
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h1", variant: "h5", children: labels.title }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "form", onSubmit: formik.handleSubmit, sx: { mt: 1, width: '100%' }, children: [formik.status && ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", sx: { mb: 2 }, children: formik.status })), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, id: loginType, label: loginType === 'email' ? labels.email : labels.username, name: loginType, autoComplete: loginType === 'email' ? 'email' : 'username', autoFocus: true, value: loginType === 'email'
|
|
100
|
+
? formik.values.email
|
|
101
|
+
: formik.values.username, onChange: formik.handleChange, error: formik.touched[loginType] && Boolean(formik.errors[loginType]), helperText: formik.touched[loginType] && formik.errors[loginType] }), authType === 'password' ? ((0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, name: "password", label: labels.password, id: "password", type: showSecret ? 'text' : 'password', value: formik.values.password, onChange: formik.handleChange, error: formik.touched.password && Boolean(formik.errors.password), helperText: formik.touched.password && formik.errors.password, slotProps: {
|
|
81
102
|
input: {
|
|
82
103
|
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-label": labels.toggleVisibility, onClick: () => setShowSecret(!showSecret), edge: "end", children: showSecret ? (0, jsx_runtime_1.jsx)(icons_material_1.VisibilityOff, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.Visibility, {}) }) })),
|
|
83
104
|
},
|
|
@@ -93,7 +114,9 @@ const LoginForm = ({ onSubmit, loginType: initialLoginType = 'email', authType:
|
|
|
93
114
|
const newType = authType === 'password' ? 'mnemonic' : 'password';
|
|
94
115
|
formik.setFieldValue(authType, '');
|
|
95
116
|
setAuthType(newType);
|
|
96
|
-
}, children: authType === 'password'
|
|
117
|
+
}, children: authType === 'password'
|
|
118
|
+
? labels.useMnemonic
|
|
119
|
+
: labels.usePassword }))] }))] })] }) }));
|
|
97
120
|
};
|
|
98
121
|
exports.LoginForm = LoginForm;
|
|
99
122
|
exports.default = exports.LoginForm;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useFormik } from 'formik';
|
|
1
2
|
import { FC } from 'react';
|
|
2
3
|
import * as Yup from 'yup';
|
|
3
4
|
export interface RegisterFormValues {
|
|
@@ -6,7 +7,8 @@ export interface RegisterFormValues {
|
|
|
6
7
|
timezone: string;
|
|
7
8
|
password?: string;
|
|
8
9
|
confirmPassword?: string;
|
|
9
|
-
|
|
10
|
+
directChallenge?: boolean;
|
|
11
|
+
[key: string]: string | boolean | undefined;
|
|
10
12
|
}
|
|
11
13
|
export interface RegisterFormProps {
|
|
12
14
|
onSubmit: (values: RegisterFormValues, usePassword: boolean) => Promise<{
|
|
@@ -29,8 +31,8 @@ export interface RegisterFormProps {
|
|
|
29
31
|
timezoneValidation?: Yup.StringSchema;
|
|
30
32
|
passwordValidation?: Yup.StringSchema;
|
|
31
33
|
confirmPasswordValidation?: Yup.StringSchema;
|
|
32
|
-
additionalFields?: (formik:
|
|
33
|
-
additionalInitialValues?: Record<string,
|
|
34
|
+
additionalFields?: (formik: ReturnType<typeof useFormik<RegisterFormValues>>, usePassword: boolean) => React.ReactNode;
|
|
35
|
+
additionalInitialValues?: Record<string, string | boolean>;
|
|
34
36
|
additionalValidation?: Record<string, Yup.Schema>;
|
|
35
37
|
labels?: {
|
|
36
38
|
title?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegisterForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/RegisterForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RegisterForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/RegisterForm.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAC7C;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,CACR,MAAM,EAAE,kBAAkB,EAC1B,WAAW,EAAE,OAAO,KACjB,OAAO,CACR;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GACxD;QACE,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC/C,CACJ,CAAC;IACF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,kBAAkB,EAAE,MAAM,MAAM,CAAC;IACjC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,eAAe,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACnC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,yBAAyB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IAC7C,gBAAgB,CAAC,EAAE,CACjB,MAAM,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,kBAAkB,CAAC,CAAC,EACxD,WAAW,EAAE,OAAO,KACjB,KAAK,CAAC,SAAS,CAAC;IACrB,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;IAC3D,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAsgB9C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -3,38 +3,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RegisterForm = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
6
7
|
const material_1 = require("@mui/material");
|
|
7
8
|
const formik_1 = require("formik");
|
|
8
9
|
const react_1 = require("react");
|
|
9
10
|
const Yup = tslib_1.__importStar(require("yup"));
|
|
10
|
-
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
11
11
|
const contexts_1 = require("../contexts");
|
|
12
12
|
const RegisterForm = ({ onSubmit, timezones, getInitialTimezone, usernameValidation, emailValidation, timezoneValidation, passwordValidation, confirmPasswordValidation, additionalFields, additionalInitialValues = {}, additionalValidation = {}, labels = {}, }) => {
|
|
13
|
-
const {
|
|
13
|
+
const { tComponent } = (0, contexts_1.useI18n)();
|
|
14
14
|
const [apiErrors, setApiErrors] = (0, react_1.useState)({});
|
|
15
15
|
const [mnemonic, setMnemonic] = (0, react_1.useState)(null);
|
|
16
16
|
const [usePassword, setUsePassword] = (0, react_1.useState)(true);
|
|
17
17
|
const [registrationSuccess, setRegistrationSuccess] = (0, react_1.useState)(false);
|
|
18
18
|
const [registering, setRegistering] = (0, react_1.useState)(false);
|
|
19
19
|
const validation = {
|
|
20
|
-
username: usernameValidation ||
|
|
21
|
-
.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
20
|
+
username: usernameValidation ||
|
|
21
|
+
Yup.string()
|
|
22
|
+
.min(suite_core_lib_1.Constants.UsernameMinLength, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_UsernameMinLengthTemplate))
|
|
23
|
+
.max(suite_core_lib_1.Constants.UsernameMaxLength, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_UsernameMaxLengthTemplate))
|
|
24
|
+
.matches(suite_core_lib_1.Constants.UsernameRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_UsernameRegexErrorTemplate))
|
|
25
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
26
|
+
email: emailValidation ||
|
|
27
|
+
Yup.string()
|
|
28
|
+
.email(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_InvalidEmail))
|
|
29
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
30
|
+
timezone: timezoneValidation ||
|
|
31
|
+
Yup.string()
|
|
32
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_TimezoneRequired))
|
|
33
|
+
.oneOf(timezones, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_TimezoneInvalid)),
|
|
34
|
+
password: passwordValidation ||
|
|
35
|
+
Yup.string()
|
|
36
|
+
.matches(suite_core_lib_1.Constants.PasswordRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordRegexErrorTemplate))
|
|
37
|
+
.min(8, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordMinLengthTemplate))
|
|
38
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
39
|
+
confirmPassword: confirmPasswordValidation ||
|
|
40
|
+
Yup.string()
|
|
41
|
+
.oneOf([Yup.ref('password')], tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordMatch))
|
|
42
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
38
43
|
};
|
|
39
44
|
const formik = (0, formik_1.useFormik)({
|
|
40
45
|
initialValues: {
|
|
@@ -64,7 +69,7 @@ const RegisterForm = ({ onSubmit, timezones, getInitialTimezone, usernameValidat
|
|
|
64
69
|
const registerResult = await onSubmit(values, usePassword);
|
|
65
70
|
if ('success' in registerResult && registerResult.success) {
|
|
66
71
|
setRegistrationSuccess(true);
|
|
67
|
-
if (!usePassword && registerResult
|
|
72
|
+
if (!usePassword && registerResult.mnemonic) {
|
|
68
73
|
setMnemonic(registerResult.mnemonic);
|
|
69
74
|
}
|
|
70
75
|
}
|
|
@@ -84,7 +89,9 @@ const RegisterForm = ({ onSubmit, timezones, getInitialTimezone, usernameValidat
|
|
|
84
89
|
}
|
|
85
90
|
});
|
|
86
91
|
}
|
|
87
|
-
if ('error' in registerResult &&
|
|
92
|
+
if ('error' in registerResult &&
|
|
93
|
+
registerResult.error &&
|
|
94
|
+
!Object.keys(newApiErrors).length) {
|
|
88
95
|
newApiErrors.general = registerResult.error;
|
|
89
96
|
}
|
|
90
97
|
setApiErrors(newApiErrors);
|
|
@@ -95,11 +102,39 @@ const RegisterForm = ({ onSubmit, timezones, getInitialTimezone, usernameValidat
|
|
|
95
102
|
setApiErrors({});
|
|
96
103
|
},
|
|
97
104
|
});
|
|
98
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Container, { maxWidth: "sm", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Container, { maxWidth: "sm", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
106
|
+
mt: 8,
|
|
107
|
+
display: 'flex',
|
|
108
|
+
flexDirection: 'column',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h4", component: "h1", gutterBottom: true, children: labels.title ||
|
|
111
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Registration) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "form", onSubmit: formik.handleSubmit, sx: { mt: 1, width: '100%' }, children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { fullWidth: true, id: "username", name: "username", label: labels.username ||
|
|
112
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Username), value: formik.values.username, onChange: formik.handleChange, onBlur: formik.handleBlur, error: Boolean(formik.touched.username &&
|
|
113
|
+
(formik.errors.username || apiErrors.username)), helperText: formik.touched.username &&
|
|
114
|
+
(formik.errors.username || apiErrors.username), margin: "normal" }), (0, jsx_runtime_1.jsx)(material_1.TextField, { fullWidth: true, id: "email", name: "email", label: labels.email ||
|
|
115
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Email), value: formik.values.email, onChange: formik.handleChange, onBlur: formik.handleBlur, error: Boolean(formik.touched.email && (formik.errors.email || apiErrors.email)), helperText: formik.touched.email && (formik.errors.email || apiErrors.email), margin: "normal" }), (0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, margin: "normal", children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { id: "timezone-label", children: labels.timezone ||
|
|
116
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Timezone) }), (0, jsx_runtime_1.jsx)(material_1.Select, { labelId: "timezone-label", id: "timezone", name: "timezone", value: formik.values.timezone, onChange: formik.handleChange, onBlur: formik.handleBlur, error: formik.touched.timezone && Boolean(formik.errors.timezone), label: labels.timezone ||
|
|
117
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Timezone), children: timezones.map((tz) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: tz, children: tz }, tz))) }), formik.touched.timezone &&
|
|
118
|
+
(formik.errors.timezone || apiErrors.timezone) && ((0, jsx_runtime_1.jsx)(material_1.Typography, { color: "error", variant: "caption", children: formik.errors.timezone || apiErrors.timezone }))] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: 'flex', alignItems: 'center', mt: 2 }, children: (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "text", onClick: () => setUsePassword(!usePassword), children: usePassword
|
|
119
|
+
? labels.useMnemonic ||
|
|
120
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_UseMnemonic)
|
|
121
|
+
: labels.usePassword ||
|
|
122
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_UsePassword) }) }), usePassword && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { fullWidth: true, id: "password", name: "password", label: labels.password ||
|
|
123
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Password), type: "password", value: formik.values.password, onChange: formik.handleChange, onBlur: formik.handleBlur, error: Boolean(formik.touched.password && formik.errors.password), helperText: formik.touched.password && formik.errors.password, margin: "normal" }), (0, jsx_runtime_1.jsx)(material_1.TextField, { fullWidth: true, id: "confirmPassword", name: "confirmPassword", label: labels.confirmPassword ||
|
|
124
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_ConfirmNewPassword), type: "password", value: formik.values.confirmPassword, onChange: formik.handleChange, onBlur: formik.handleBlur, error: Boolean(formik.touched.confirmPassword &&
|
|
125
|
+
formik.errors.confirmPassword), helperText: formik.touched.confirmPassword &&
|
|
126
|
+
formik.errors.confirmPassword, margin: "normal" })] })), (0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, margin: "normal", children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { id: "directChallenge", name: "directChallenge", checked: formik.values.directChallenge || false, onChange: formik.handleChange }), label: tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Registration_DirectChallengeLabel) }), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Registration_DirectChallengeHelper) })] }), additionalFields && additionalFields(formik, usePassword), apiErrors.general && ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", sx: { mt: 2, mb: 2 }, children: apiErrors.general })), (0, jsx_runtime_1.jsx)(material_1.Button, { type: "submit", fullWidth: true, variant: "contained", color: "primary", sx: { mt: 3, mb: 2 }, disabled: formik.isSubmitting, children: registering
|
|
127
|
+
? labels.registering ||
|
|
128
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Registration_Registering)
|
|
129
|
+
: labels.register ||
|
|
130
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Registration_RegisterButton) }), registering && ((0, jsx_runtime_1.jsxs)(material_1.Alert, { severity: "success", sx: { mt: 2, mb: 2, whiteSpace: 'pre-wrap' }, children: [(0, jsx_runtime_1.jsx)(material_1.AlertTitle, { children: labels.registering ||
|
|
131
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Registration_Registering) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", component: "div", children: tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Registration_RegisteringMessage) })] })), mnemonic && ((0, jsx_runtime_1.jsxs)(material_1.Alert, { severity: "success", sx: { mt: 2, mb: 2, whiteSpace: 'pre-wrap' }, children: [(0, jsx_runtime_1.jsx)(material_1.AlertTitle, { children: labels.successTitle ||
|
|
132
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Registration_SuccessTitle) }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "body2", component: "div", children: [labels.mnemonicSuccess ||
|
|
133
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Registration_MnemonicSuccess), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", component: "div", sx: { mt: 1, fontFamily: 'monospace' }, children: mnemonic }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { textAlign: 'center' }, children: (0, jsx_runtime_1.jsx)(material_1.Link, { href: "/login", children: labels.proceedToLogin ||
|
|
134
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ProceedToLogin) }) })] })] })), registrationSuccess && ((0, jsx_runtime_1.jsxs)(material_1.Alert, { severity: "success", sx: { mt: 2, mb: 2 }, children: [(0, jsx_runtime_1.jsx)(material_1.AlertTitle, { children: labels.successTitle ||
|
|
135
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Registration_SuccessTitle) }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "body2", component: "div", children: [tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Registration_Success), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { textAlign: 'center' }, children: (0, jsx_runtime_1.jsx)(material_1.Link, { href: "/login", children: labels.proceedToLogin ||
|
|
136
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ProceedToLogin) }) })] })] })), !mnemonic && !registrationSuccess && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { textAlign: 'center' }, children: (0, jsx_runtime_1.jsx)(material_1.Link, { href: "/login", variant: "body2", children: labels.loginLink ||
|
|
137
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Registration_LoginLink) }) }))] })] }) }));
|
|
103
138
|
};
|
|
104
139
|
exports.RegisterForm = RegisterForm;
|
|
105
140
|
exports.default = exports.RegisterForm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPasswordForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ResetPasswordForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResetPasswordForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ResetPasswordForm.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,yBAAyB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IAC7C,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CA6MxD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -3,31 +3,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ResetPasswordForm = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
6
7
|
const material_1 = require("@mui/material");
|
|
7
8
|
const formik_1 = require("formik");
|
|
8
9
|
const react_1 = require("react");
|
|
9
10
|
const Yup = tslib_1.__importStar(require("yup"));
|
|
10
|
-
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
11
11
|
const contexts_1 = require("../contexts");
|
|
12
12
|
const ResetPasswordForm = ({ token, onSubmit, passwordValidation, confirmPasswordValidation, labels = {}, }) => {
|
|
13
|
-
const {
|
|
13
|
+
const { tComponent } = (0, contexts_1.useI18n)();
|
|
14
14
|
const [success, setSuccess] = (0, react_1.useState)(false);
|
|
15
15
|
const [apiError, setApiError] = (0, react_1.useState)('');
|
|
16
16
|
const validation = {
|
|
17
|
-
password: passwordValidation ||
|
|
18
|
-
.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
.
|
|
17
|
+
password: passwordValidation ||
|
|
18
|
+
Yup.string()
|
|
19
|
+
.min(suite_core_lib_1.Constants.PasswordMinLength, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordMinLengthTemplate))
|
|
20
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
21
|
+
confirmPassword: confirmPasswordValidation ||
|
|
22
|
+
Yup.string()
|
|
23
|
+
.oneOf([Yup.ref('password')], tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordMatch))
|
|
24
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
23
25
|
};
|
|
24
26
|
const translatedLabels = {
|
|
25
|
-
title: labels.title ||
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
title: labels.title ||
|
|
28
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.PasswordReset_Title),
|
|
29
|
+
password: labels.password ||
|
|
30
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_NewPassword),
|
|
31
|
+
confirmPassword: labels.confirmPassword ||
|
|
32
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_ConfirmNewPassword),
|
|
33
|
+
resetButton: labels.resetButton ||
|
|
34
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.PasswordReset_Button),
|
|
35
|
+
successMessage: labels.successMessage ||
|
|
36
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.PasswordReset_Success),
|
|
37
|
+
invalidToken: labels.invalidToken ||
|
|
38
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ForgotPassword_InvalidToken),
|
|
31
39
|
};
|
|
32
40
|
const formik = (0, formik_1.useFormik)({
|
|
33
41
|
initialValues: {
|
|
@@ -49,7 +57,9 @@ const ResetPasswordForm = ({ token, onSubmit, passwordValidation, confirmPasswor
|
|
|
49
57
|
setApiError('');
|
|
50
58
|
}
|
|
51
59
|
catch (error) {
|
|
52
|
-
|
|
60
|
+
const err = error;
|
|
61
|
+
setApiError(err.response?.data?.message ||
|
|
62
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Error_PasswordChange));
|
|
53
63
|
setSuccess(false);
|
|
54
64
|
}
|
|
55
65
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopMenu.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/TopMenu.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAE,EAAE,EAAE,YAAY,EAAwB,MAAM,OAAO,CAAC;AAKtE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAO7C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,CAAC,EAAE;YACX,QAAQ,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAC;YAClB,MAAM,EAAE,MAAM,CAAC;YACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;SACxB,CAAC;KACH;CACF;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,eAAe,CAAC,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAC;CACjD;AAED,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"TopMenu.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/TopMenu.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAE,EAAE,EAAE,YAAY,EAAwB,MAAM,OAAO,CAAC;AAKtE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAO7C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,CAAC,EAAE;YACX,QAAQ,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAC;YAClB,MAAM,EAAE,MAAM,CAAC;YACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;SACxB,CAAC;KACH;CACF;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,eAAe,CAAC,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAC;CACjD;AAED,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAkGpC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -15,14 +15,13 @@ const DropdownMenu_1 = require("./DropdownMenu");
|
|
|
15
15
|
const SideMenu_1 = require("./SideMenu");
|
|
16
16
|
const UserLanguageSelector_1 = require("./UserLanguageSelector");
|
|
17
17
|
const UserMenu_1 = require("./UserMenu");
|
|
18
|
-
const TopMenu = ({ Logo
|
|
18
|
+
const TopMenu = ({ Logo }) => {
|
|
19
19
|
const { isAuthenticated } = (0, react_1.useContext)(AuthProvider_1.AuthContext);
|
|
20
20
|
const { getTopMenus } = (0, MenuContext_1.useMenu)();
|
|
21
21
|
const [isSideMenuOpen, setIsSideMenuOpen] = (0, react_1.useState)(false);
|
|
22
22
|
const handleOpenSideMenu = () => setIsSideMenuOpen(true);
|
|
23
23
|
const handleCloseSideMenu = () => setIsSideMenuOpen(false);
|
|
24
|
-
const {
|
|
25
|
-
const appConfig = window.APP_CONFIG;
|
|
24
|
+
const { tComponent } = (0, I18nProvider_1.useI18n)();
|
|
26
25
|
const siteTitle = tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_SiteTemplate);
|
|
27
26
|
return ((0, jsx_runtime_1.jsxs)(material_1.AppBar, { position: "fixed", sx: { top: 10 }, children: [(0, jsx_runtime_1.jsxs)(material_1.Toolbar, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "large", edge: "start", color: "inherit", "aria-label": "menu", sx: { mr: 2 }, onClick: handleOpenSideMenu, children: (0, jsx_runtime_1.jsx)(Menu_1.default, {}) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
28
27
|
height: 40,
|
|
@@ -2,6 +2,6 @@ interface FCParams<TEnum extends string> {
|
|
|
2
2
|
componentId: string;
|
|
3
3
|
stringKey: TEnum;
|
|
4
4
|
}
|
|
5
|
-
export declare const TranslatedTitle: <TEnum extends string>({ componentId, stringKey }: FCParams<TEnum>) => null;
|
|
5
|
+
export declare const TranslatedTitle: <TEnum extends string>({ componentId, stringKey, }: FCParams<TEnum>) => null;
|
|
6
6
|
export default TranslatedTitle;
|
|
7
7
|
//# sourceMappingURL=TranslatedTitle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslatedTitle.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/TranslatedTitle.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TranslatedTitle.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/TranslatedTitle.tsx"],"names":[],"mappings":"AAKA,UAAU,QAAQ,CAAC,KAAK,SAAS,MAAM;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,KAAK,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,GAAI,KAAK,SAAS,MAAM,EAAE,6BAGnD,QAAQ,CAAC,KAAK,CAAC,KAAG,IAapB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.TranslatedTitle = void 0;
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const contexts_1 = require("../contexts");
|
|
7
|
-
const TranslatedTitle = ({ componentId, stringKey }) => {
|
|
7
|
+
const TranslatedTitle = ({ componentId, stringKey, }) => {
|
|
8
8
|
const { tComponent, currentLanguage } = (0, contexts_1.useI18n)();
|
|
9
9
|
(0, react_1.useEffect)(() => {
|
|
10
10
|
document.title = tComponent(componentId, stringKey, undefined, currentLanguage);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useFormik } from 'formik';
|
|
1
2
|
import { FC } from 'react';
|
|
2
3
|
import * as Yup from 'yup';
|
|
3
4
|
export interface UserSettingsFormValues {
|
|
@@ -7,7 +8,7 @@ export interface UserSettingsFormValues {
|
|
|
7
8
|
currency: string;
|
|
8
9
|
darkMode: boolean;
|
|
9
10
|
directChallenge: boolean;
|
|
10
|
-
[key: string]:
|
|
11
|
+
[key: string]: string | boolean;
|
|
11
12
|
}
|
|
12
13
|
export interface UserSettingsFormProps {
|
|
13
14
|
initialValues: UserSettingsFormValues;
|
|
@@ -33,8 +34,8 @@ export interface UserSettingsFormProps {
|
|
|
33
34
|
currencyValidation?: Yup.StringSchema;
|
|
34
35
|
darkModeValidation?: Yup.BooleanSchema;
|
|
35
36
|
directChallengeValidation?: Yup.BooleanSchema;
|
|
36
|
-
additionalFields?: (formik:
|
|
37
|
-
additionalInitialValues?: Record<string,
|
|
37
|
+
additionalFields?: (formik: ReturnType<typeof useFormik<UserSettingsFormValues>>) => React.ReactNode;
|
|
38
|
+
additionalInitialValues?: Record<string, string | boolean>;
|
|
38
39
|
additionalValidation?: Record<string, Yup.Schema>;
|
|
39
40
|
labels?: {
|
|
40
41
|
title?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserSettingsForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/UserSettingsForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UserSettingsForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/UserSettingsForm.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,EAAE,EAAE,EAAqB,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,sBAAsB,CAAC;IACtC,QAAQ,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,OAAO,CACjD;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GACrC;QACE,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC/C,CACJ,CAAC;IACF,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,eAAe,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACnC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,sBAAsB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IAC1C,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,kBAAkB,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC;IACvC,yBAAyB,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC;IAC9C,gBAAgB,CAAC,EAAE,CACjB,MAAM,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,sBAAsB,CAAC,CAAC,KACzD,KAAK,CAAC,SAAS,CAAC;IACrB,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;IAC3D,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA4atD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|