@digitaldefiance/express-suite-react-components 2.9.37 → 2.9.38
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/LICENSE +21 -0
- package/package.json +4 -5
- package/src/auth/Private.tsx +17 -0
- package/src/auth/PrivateRoute.tsx +28 -0
- package/src/auth/UnAuth.tsx +16 -0
- package/src/auth/UnAuthRoute.tsx +30 -0
- package/src/auth/{index.d.ts → index.ts} +1 -2
- package/src/components/ApiAccess.tsx +174 -0
- package/src/components/BackupCodeLoginForm.tsx +488 -0
- package/src/components/BackupCodesForm.tsx +286 -0
- package/src/components/ChangePasswordForm.tsx +272 -0
- package/src/components/ConfirmationDialog.tsx +48 -0
- package/src/components/CurrencyCodeSelector.tsx +60 -0
- package/src/components/CurrencyInput.tsx +80 -0
- package/src/components/DashboardPage.tsx +24 -0
- package/src/components/DropdownMenu.tsx +92 -0
- package/src/components/ExpirationSecondsSelector.tsx +60 -0
- package/src/components/Flag.tsx +52 -0
- package/src/components/ForgotPasswordForm.tsx +173 -0
- package/src/components/LoginForm.tsx +455 -0
- package/src/components/LogoutPage.tsx +21 -0
- package/src/components/RegisterForm.tsx +602 -0
- package/src/components/ResetPasswordForm.tsx +246 -0
- package/src/components/SideMenu.tsx +46 -0
- package/src/components/SideMenuListItem.tsx +74 -0
- package/src/components/TopMenu.tsx +145 -0
- package/src/components/TranslatedTitle.tsx +29 -0
- package/src/components/UserLanguageSelector.tsx +45 -0
- package/src/components/UserMenu.tsx +15 -0
- package/src/components/UserSettingsForm.tsx +505 -0
- package/src/components/VerifyEmailPage.tsx +184 -0
- package/src/components/{index.d.ts → index.ts} +1 -1
- package/src/contexts/AuthProvider.spec.tsx +1195 -0
- package/src/contexts/AuthProvider.tsx +924 -0
- package/src/contexts/I18nProvider.tsx +114 -0
- package/src/contexts/MenuContext.tsx +398 -0
- package/src/contexts/SuiteConfigProvider.tsx +93 -0
- package/src/contexts/ThemeProvider.tsx +67 -0
- package/src/contexts/{index.d.ts → index.ts} +0 -1
- package/src/hooks/{index.d.ts → index.ts} +0 -1
- package/src/hooks/useBackupCodes.ts +105 -0
- package/src/hooks/useEmailVerification.ts +49 -0
- package/src/hooks/useExpiringValue.ts +78 -0
- package/src/hooks/useLocalStorage.ts +18 -0
- package/src/hooks/useUserSettings.ts +269 -0
- package/src/{index.d.ts → index.ts} +1 -1
- package/src/interfaces/IAppConfig.ts +5 -0
- package/src/interfaces/IMenuConfig.ts +11 -0
- package/src/interfaces/IMenuOption.ts +55 -0
- package/src/interfaces/index.ts +3 -0
- package/src/services/__mocks__/authService.ts +14 -0
- package/src/services/api.ts +13 -0
- package/src/services/authService.ts +500 -0
- package/src/services/authenticatedApi.ts +17 -0
- package/src/services/index.ts +3 -0
- package/src/types/MenuType.ts +15 -0
- package/src/types/expirationSeconds.ts +18 -0
- package/src/types/index.ts +1 -0
- package/src/types/translation.ts +20 -0
- package/src/wrappers/BackupCodeLoginWrapper.tsx +34 -0
- package/src/wrappers/BackupCodesWrapper.tsx +28 -0
- package/src/wrappers/ChangePasswordFormWrapper.tsx +34 -0
- package/src/wrappers/LoginFormWrapper.tsx +59 -0
- package/src/wrappers/LogoutPageWrapper.tsx +30 -0
- package/src/wrappers/RegisterFormWrapper.tsx +61 -0
- package/src/wrappers/UserSettingsFormWrapper.tsx +39 -0
- package/src/wrappers/VerifyEmailPageWrapper.tsx +27 -0
- package/src/wrappers/{index.d.ts → index.tsx} +8 -1
- package/src/auth/Private.d.ts +0 -6
- package/src/auth/Private.d.ts.map +0 -1
- package/src/auth/Private.js +0 -14
- package/src/auth/PrivateRoute.d.ts +0 -8
- package/src/auth/PrivateRoute.d.ts.map +0 -1
- package/src/auth/PrivateRoute.js +0 -23
- package/src/auth/UnAuth.d.ts +0 -6
- package/src/auth/UnAuth.d.ts.map +0 -1
- package/src/auth/UnAuth.js +0 -14
- package/src/auth/UnAuthRoute.d.ts +0 -8
- package/src/auth/UnAuthRoute.d.ts.map +0 -1
- package/src/auth/UnAuthRoute.js +0 -22
- package/src/auth/index.d.ts.map +0 -1
- package/src/auth/index.js +0 -10
- package/src/components/ApiAccess.d.ts +0 -16
- package/src/components/ApiAccess.d.ts.map +0 -1
- package/src/components/ApiAccess.js +0 -77
- package/src/components/BackupCodeLoginForm.d.ts +0 -43
- package/src/components/BackupCodeLoginForm.d.ts.map +0 -1
- package/src/components/BackupCodeLoginForm.js +0 -139
- package/src/components/BackupCodesForm.d.ts +0 -26
- package/src/components/BackupCodesForm.d.ts.map +0 -1
- package/src/components/BackupCodesForm.js +0 -120
- package/src/components/ChangePasswordForm.d.ts +0 -26
- package/src/components/ChangePasswordForm.d.ts.map +0 -1
- package/src/components/ChangePasswordForm.js +0 -78
- package/src/components/ConfirmationDialog.d.ts +0 -13
- package/src/components/ConfirmationDialog.d.ts.map +0 -1
- package/src/components/ConfirmationDialog.js +0 -10
- package/src/components/CurrencyCodeSelector.d.ts +0 -9
- package/src/components/CurrencyCodeSelector.d.ts.map +0 -1
- package/src/components/CurrencyCodeSelector.js +0 -31
- package/src/components/CurrencyInput.d.ts +0 -13
- package/src/components/CurrencyInput.d.ts.map +0 -1
- package/src/components/CurrencyInput.js +0 -22
- package/src/components/DashboardPage.d.ts +0 -8
- package/src/components/DashboardPage.d.ts.map +0 -1
- package/src/components/DashboardPage.js +0 -10
- package/src/components/DropdownMenu.d.ts +0 -9
- package/src/components/DropdownMenu.d.ts.map +0 -1
- package/src/components/DropdownMenu.js +0 -56
- package/src/components/ExpirationSecondsSelector.d.ts +0 -13
- package/src/components/ExpirationSecondsSelector.d.ts.map +0 -1
- package/src/components/ExpirationSecondsSelector.js +0 -32
- package/src/components/Flag.d.ts +0 -20
- package/src/components/Flag.d.ts.map +0 -1
- package/src/components/Flag.js +0 -43
- package/src/components/ForgotPasswordForm.d.ts +0 -18
- package/src/components/ForgotPasswordForm.d.ts.map +0 -1
- package/src/components/ForgotPasswordForm.js +0 -61
- package/src/components/LoginForm.d.ts +0 -44
- package/src/components/LoginForm.d.ts.map +0 -1
- package/src/components/LoginForm.js +0 -122
- package/src/components/LogoutPage.d.ts +0 -8
- package/src/components/LogoutPage.d.ts.map +0 -1
- package/src/components/LogoutPage.js +0 -16
- package/src/components/RegisterForm.d.ts +0 -56
- package/src/components/RegisterForm.d.ts.map +0 -1
- package/src/components/RegisterForm.js +0 -140
- package/src/components/ResetPasswordForm.d.ts +0 -23
- package/src/components/ResetPasswordForm.d.ts.map +0 -1
- package/src/components/ResetPasswordForm.js +0 -78
- package/src/components/SideMenu.d.ts +0 -8
- package/src/components/SideMenu.d.ts.map +0 -1
- package/src/components/SideMenu.js +0 -25
- package/src/components/SideMenuListItem.d.ts +0 -13
- package/src/components/SideMenuListItem.d.ts.map +0 -1
- package/src/components/SideMenuListItem.js +0 -44
- package/src/components/TopMenu.d.ts +0 -24
- package/src/components/TopMenu.d.ts.map +0 -1
- package/src/components/TopMenu.js +0 -35
- package/src/components/TranslatedTitle.d.ts +0 -7
- package/src/components/TranslatedTitle.d.ts.map +0 -1
- package/src/components/TranslatedTitle.js +0 -15
- package/src/components/UserLanguageSelector.d.ts +0 -4
- package/src/components/UserLanguageSelector.d.ts.map +0 -1
- package/src/components/UserLanguageSelector.js +0 -31
- package/src/components/UserMenu.d.ts +0 -4
- package/src/components/UserMenu.d.ts.map +0 -1
- package/src/components/UserMenu.js +0 -12
- package/src/components/UserSettingsForm.d.ts +0 -57
- package/src/components/UserSettingsForm.d.ts.map +0 -1
- package/src/components/UserSettingsForm.js +0 -126
- package/src/components/VerifyEmailPage.d.ts +0 -23
- package/src/components/VerifyEmailPage.d.ts.map +0 -1
- package/src/components/VerifyEmailPage.js +0 -70
- package/src/components/index.d.ts.map +0 -1
- package/src/components/index.js +0 -28
- package/src/contexts/AuthProvider.d.ts +0 -152
- package/src/contexts/AuthProvider.d.ts.map +0 -1
- package/src/contexts/AuthProvider.js +0 -502
- package/src/contexts/I18nProvider.d.ts +0 -16
- package/src/contexts/I18nProvider.d.ts.map +0 -1
- package/src/contexts/I18nProvider.js +0 -46
- package/src/contexts/MenuContext.d.ts +0 -20
- package/src/contexts/MenuContext.d.ts.map +0 -1
- package/src/contexts/MenuContext.js +0 -273
- package/src/contexts/SuiteConfigProvider.d.ts +0 -44
- package/src/contexts/SuiteConfigProvider.d.ts.map +0 -1
- package/src/contexts/SuiteConfigProvider.js +0 -43
- package/src/contexts/ThemeProvider.d.ts +0 -15
- package/src/contexts/ThemeProvider.d.ts.map +0 -1
- package/src/contexts/ThemeProvider.js +0 -36
- package/src/contexts/index.d.ts.map +0 -1
- package/src/contexts/index.js +0 -8
- package/src/hooks/index.d.ts.map +0 -1
- package/src/hooks/index.js +0 -8
- package/src/hooks/useBackupCodes.d.ts +0 -15
- package/src/hooks/useBackupCodes.d.ts.map +0 -1
- package/src/hooks/useBackupCodes.js +0 -74
- package/src/hooks/useEmailVerification.d.ts +0 -10
- package/src/hooks/useEmailVerification.d.ts.map +0 -1
- package/src/hooks/useEmailVerification.js +0 -40
- package/src/hooks/useExpiringValue.d.ts +0 -14
- package/src/hooks/useExpiringValue.d.ts.map +0 -1
- package/src/hooks/useExpiringValue.js +0 -53
- package/src/hooks/useLocalStorage.d.ts +0 -2
- package/src/hooks/useLocalStorage.d.ts.map +0 -1
- package/src/hooks/useLocalStorage.js +0 -15
- package/src/hooks/useUserSettings.d.ts +0 -48
- package/src/hooks/useUserSettings.d.ts.map +0 -1
- package/src/hooks/useUserSettings.js +0 -169
- package/src/index.d.ts.map +0 -1
- package/src/index.js +0 -12
- package/src/interfaces/IAppConfig.d.ts +0 -6
- package/src/interfaces/IAppConfig.d.ts.map +0 -1
- package/src/interfaces/IAppConfig.js +0 -2
- package/src/interfaces/IMenuConfig.d.ts +0 -11
- package/src/interfaces/IMenuConfig.d.ts.map +0 -1
- package/src/interfaces/IMenuConfig.js +0 -2
- package/src/interfaces/IMenuOption.d.ts +0 -58
- package/src/interfaces/IMenuOption.d.ts.map +0 -1
- package/src/interfaces/IMenuOption.js +0 -2
- package/src/interfaces/index.d.ts +0 -4
- package/src/interfaces/index.d.ts.map +0 -1
- package/src/interfaces/index.js +0 -6
- package/src/services/__mocks__/authService.d.ts +0 -21
- package/src/services/__mocks__/authService.d.ts.map +0 -1
- package/src/services/__mocks__/authService.js +0 -15
- package/src/services/api.d.ts +0 -3
- package/src/services/api.d.ts.map +0 -1
- package/src/services/api.js +0 -14
- package/src/services/authService.d.ts +0 -72
- package/src/services/authService.d.ts.map +0 -1
- package/src/services/authService.js +0 -335
- package/src/services/authenticatedApi.d.ts +0 -3
- package/src/services/authenticatedApi.d.ts.map +0 -1
- package/src/services/authenticatedApi.js +0 -18
- package/src/services/index.d.ts +0 -4
- package/src/services/index.d.ts.map +0 -1
- package/src/services/index.js +0 -6
- package/src/types/MenuType.d.ts +0 -11
- package/src/types/MenuType.d.ts.map +0 -1
- package/src/types/MenuType.js +0 -12
- package/src/types/expirationSeconds.d.ts +0 -3
- package/src/types/expirationSeconds.d.ts.map +0 -1
- package/src/types/expirationSeconds.js +0 -17
- package/src/types/index.d.ts +0 -2
- package/src/types/index.d.ts.map +0 -1
- package/src/types/index.js +0 -4
- package/src/types/translation.d.ts +0 -10
- package/src/types/translation.d.ts.map +0 -1
- package/src/types/translation.js +0 -9
- package/src/wrappers/BackupCodeLoginWrapper.d.ts +0 -8
- package/src/wrappers/BackupCodeLoginWrapper.d.ts.map +0 -1
- package/src/wrappers/BackupCodeLoginWrapper.js +0 -20
- package/src/wrappers/BackupCodesWrapper.d.ts +0 -7
- package/src/wrappers/BackupCodesWrapper.d.ts.map +0 -1
- package/src/wrappers/BackupCodesWrapper.js +0 -17
- package/src/wrappers/ChangePasswordFormWrapper.d.ts +0 -8
- package/src/wrappers/ChangePasswordFormWrapper.d.ts.map +0 -1
- package/src/wrappers/ChangePasswordFormWrapper.js +0 -21
- package/src/wrappers/LoginFormWrapper.d.ts +0 -9
- package/src/wrappers/LoginFormWrapper.d.ts.map +0 -1
- package/src/wrappers/LoginFormWrapper.js +0 -43
- package/src/wrappers/LogoutPageWrapper.d.ts +0 -9
- package/src/wrappers/LogoutPageWrapper.d.ts.map +0 -1
- package/src/wrappers/LogoutPageWrapper.js +0 -21
- package/src/wrappers/RegisterFormWrapper.d.ts +0 -9
- package/src/wrappers/RegisterFormWrapper.d.ts.map +0 -1
- package/src/wrappers/RegisterFormWrapper.js +0 -31
- package/src/wrappers/UserSettingsFormWrapper.d.ts +0 -8
- package/src/wrappers/UserSettingsFormWrapper.d.ts.map +0 -1
- package/src/wrappers/UserSettingsFormWrapper.js +0 -24
- package/src/wrappers/VerifyEmailPageWrapper.d.ts +0 -8
- package/src/wrappers/VerifyEmailPageWrapper.d.ts.map +0 -1
- package/src/wrappers/VerifyEmailPageWrapper.js +0 -20
- package/src/wrappers/index.d.ts.map +0 -1
- package/src/wrappers/index.js +0 -20
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FormikProps } from 'formik';
|
|
2
|
-
import { FC } from 'react';
|
|
3
|
-
export interface ExpirationSecondsSelectorProps<T = Record<string, unknown>> {
|
|
4
|
-
name: string;
|
|
5
|
-
label: string;
|
|
6
|
-
formik: FormikProps<T>;
|
|
7
|
-
optionValues: number[];
|
|
8
|
-
optionNames: string[];
|
|
9
|
-
onChange?: (value: number) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare const ExpirationSecondsSelector: FC<ExpirationSecondsSelectorProps<Record<string, unknown>>>;
|
|
12
|
-
export default ExpirationSecondsSelector;
|
|
13
|
-
//# sourceMappingURL=ExpirationSecondsSelector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpirationSecondsSelector.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ExpirationSecondsSelector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAe,EAAE,EAAE,MAAM,OAAO,CAAC;AAExC,MAAM,WAAW,8BAA8B,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,eAAO,MAAM,yBAAyB,EAAE,EAAE,CACxC,8BAA8B,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA2CxD,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExpirationSecondsSelector = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const material_1 = require("@mui/material");
|
|
6
|
-
const ExpirationSecondsSelector = ({ name, label, formik, optionValues, optionNames, onChange }) => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)(material_1.TextField, { select: true, fullWidth: true, label: label, name: name, value: formik.values[name] ?? '', onChange: (event) => {
|
|
8
|
-
const selectedValue = event.target.value;
|
|
9
|
-
formik.setFieldValue(name, selectedValue);
|
|
10
|
-
if (onChange) {
|
|
11
|
-
onChange(parseInt(selectedValue));
|
|
12
|
-
}
|
|
13
|
-
}, error: formik.touched[name] && Boolean(formik.errors[name]), helperText: formik.touched[name] && formik.errors[name], sx: {
|
|
14
|
-
mt: 1,
|
|
15
|
-
'& .MuiSelect-select': {
|
|
16
|
-
paddingRight: '32px',
|
|
17
|
-
},
|
|
18
|
-
'& .MuiOutlinedInput-root': {
|
|
19
|
-
'& fieldset': {
|
|
20
|
-
borderColor: 'rgba(0, 0, 0, 0.23)',
|
|
21
|
-
},
|
|
22
|
-
'&:hover fieldset': {
|
|
23
|
-
borderColor: 'rgba(0, 0, 0, 0.87)',
|
|
24
|
-
},
|
|
25
|
-
'&.Mui-focused fieldset': {
|
|
26
|
-
borderColor: 'primary.main',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
}, children: optionNames.map((name, index) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: optionValues[index], children: name }, name))) }));
|
|
30
|
-
};
|
|
31
|
-
exports.ExpirationSecondsSelector = ExpirationSecondsSelector;
|
|
32
|
-
exports.default = exports.ExpirationSecondsSelector;
|
package/src/components/Flag.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { SxProps, Theme } from '@mui/material';
|
|
2
|
-
import { FC } from 'react';
|
|
3
|
-
export interface FlagProps {
|
|
4
|
-
language: string;
|
|
5
|
-
sx?: SxProps<Theme>;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* A simple component to display a flag icon for a given language.
|
|
9
|
-
*
|
|
10
|
-
* Props:
|
|
11
|
-
* language: The language to display a flag for, as a StringLanguages enum value.
|
|
12
|
-
* sx: Optional styles to apply to the component.
|
|
13
|
-
*
|
|
14
|
-
* Returns a Box component with an SVG flag icon from flagcdn.com as a ::before pseudo-element.
|
|
15
|
-
* The flag is sized to 1.5rem by default, but can be overridden by passing a custom sx prop.
|
|
16
|
-
* The component also includes an aria-label for accessibility, set to `Flag for <language>`.
|
|
17
|
-
*/
|
|
18
|
-
export declare const Flag: FC<FlagProps>;
|
|
19
|
-
export default Flag;
|
|
20
|
-
//# sourceMappingURL=Flag.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Flag.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/Flag.tsx"],"names":[],"mappings":"AACA,OAAO,EAAO,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CA6B9B,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/src/components/Flag.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Flag = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
6
|
-
const material_1 = require("@mui/material");
|
|
7
|
-
/**
|
|
8
|
-
* A simple component to display a flag icon for a given language.
|
|
9
|
-
*
|
|
10
|
-
* Props:
|
|
11
|
-
* language: The language to display a flag for, as a StringLanguages enum value.
|
|
12
|
-
* sx: Optional styles to apply to the component.
|
|
13
|
-
*
|
|
14
|
-
* Returns a Box component with an SVG flag icon from flagcdn.com as a ::before pseudo-element.
|
|
15
|
-
* The flag is sized to 1.5rem by default, but can be overridden by passing a custom sx prop.
|
|
16
|
-
* The component also includes an aria-label for accessibility, set to `Flag for <language>`.
|
|
17
|
-
*/
|
|
18
|
-
const Flag = ({ language, sx }) => {
|
|
19
|
-
const flagContent = (0, suite_core_lib_1.getFlagCode)(language);
|
|
20
|
-
if (!flagContent) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Box, { component: "span", "aria-label": `Flag for ${language}`, sx: {
|
|
24
|
-
fontSize: '1.5rem',
|
|
25
|
-
lineHeight: 1,
|
|
26
|
-
verticalAlign: 'middle',
|
|
27
|
-
'&::before': {
|
|
28
|
-
content: `" "`,
|
|
29
|
-
display: 'inline-block',
|
|
30
|
-
width: '1em',
|
|
31
|
-
height: '1em',
|
|
32
|
-
backgroundImage: `url(https://flagcdn.com/${flagContent.toLowerCase()}.svg)`,
|
|
33
|
-
backgroundSize: 'contain',
|
|
34
|
-
backgroundRepeat: 'no-repeat',
|
|
35
|
-
backgroundPosition: 'center',
|
|
36
|
-
border: '1px solid rgba(0, 0, 0, 0.1)',
|
|
37
|
-
borderRadius: '2px',
|
|
38
|
-
},
|
|
39
|
-
...sx,
|
|
40
|
-
} }));
|
|
41
|
-
};
|
|
42
|
-
exports.Flag = Flag;
|
|
43
|
-
exports.default = exports.Flag;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import * as Yup from 'yup';
|
|
3
|
-
export interface ForgotPasswordFormValues {
|
|
4
|
-
email: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ForgotPasswordFormProps {
|
|
7
|
-
onSubmit: (values: ForgotPasswordFormValues) => Promise<void>;
|
|
8
|
-
emailValidation?: Yup.StringSchema;
|
|
9
|
-
labels?: {
|
|
10
|
-
title?: string;
|
|
11
|
-
email?: string;
|
|
12
|
-
sendResetLink?: string;
|
|
13
|
-
successMessage?: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export declare const ForgotPasswordForm: FC<ForgotPasswordFormProps>;
|
|
17
|
-
export default ForgotPasswordForm;
|
|
18
|
-
//# sourceMappingURL=ForgotPasswordForm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ForgotPasswordForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ForgotPasswordForm.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,eAAe,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACnC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CA0I1D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ForgotPasswordForm = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
7
|
-
const material_1 = require("@mui/material");
|
|
8
|
-
const formik_1 = require("formik");
|
|
9
|
-
const react_1 = require("react");
|
|
10
|
-
const Yup = tslib_1.__importStar(require("yup"));
|
|
11
|
-
const contexts_1 = require("../contexts");
|
|
12
|
-
const ForgotPasswordForm = ({ onSubmit, emailValidation, labels = {}, }) => {
|
|
13
|
-
const { tComponent } = (0, contexts_1.useI18n)();
|
|
14
|
-
const [success, setSuccess] = (0, react_1.useState)(false);
|
|
15
|
-
const [apiError, setApiError] = (0, react_1.useState)('');
|
|
16
|
-
const validation = {
|
|
17
|
-
email: emailValidation ||
|
|
18
|
-
Yup.string()
|
|
19
|
-
.email(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_InvalidEmail))
|
|
20
|
-
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
21
|
-
};
|
|
22
|
-
const translatedLabels = {
|
|
23
|
-
title: labels.title ||
|
|
24
|
-
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ForgotPassword_Title),
|
|
25
|
-
email: labels.email ||
|
|
26
|
-
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Email),
|
|
27
|
-
sendResetLink: labels.sendResetLink ||
|
|
28
|
-
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ForgotPassword_SendResetLink),
|
|
29
|
-
successMessage: labels.successMessage ||
|
|
30
|
-
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.PasswordReset_Success),
|
|
31
|
-
};
|
|
32
|
-
const formik = (0, formik_1.useFormik)({
|
|
33
|
-
initialValues: {
|
|
34
|
-
email: '',
|
|
35
|
-
},
|
|
36
|
-
validationSchema: Yup.object({
|
|
37
|
-
email: validation.email,
|
|
38
|
-
}),
|
|
39
|
-
onSubmit: async (values) => {
|
|
40
|
-
try {
|
|
41
|
-
await onSubmit(values);
|
|
42
|
-
setSuccess(true);
|
|
43
|
-
setApiError('');
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
const err = error;
|
|
47
|
-
setApiError(err.response?.data?.message ||
|
|
48
|
-
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ForgotPassword_Error));
|
|
49
|
-
setSuccess(false);
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Container, { maxWidth: "sm", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
54
|
-
mt: 8,
|
|
55
|
-
display: 'flex',
|
|
56
|
-
flexDirection: 'column',
|
|
57
|
-
alignItems: 'center',
|
|
58
|
-
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h4", component: "h1", gutterBottom: true, children: translatedLabels.title }), (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: "email", name: "email", label: translatedLabels.email, value: formik.values.email, onChange: formik.handleChange, onBlur: formik.handleBlur, error: Boolean(formik.touched.email && formik.errors.email), helperText: formik.touched.email && formik.errors.email, margin: "normal" }), apiError && ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", sx: { mt: 2, mb: 2 }, children: apiError })), success && ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "success", sx: { mt: 2, mb: 2 }, children: translatedLabels.successMessage })), (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: translatedLabels.sendResetLink })] })] }) }));
|
|
59
|
-
};
|
|
60
|
-
exports.ForgotPasswordForm = ForgotPasswordForm;
|
|
61
|
-
exports.default = exports.ForgotPasswordForm;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useFormik } from 'formik';
|
|
2
|
-
import { FC } from 'react';
|
|
3
|
-
import * as Yup from 'yup';
|
|
4
|
-
export interface LoginFormValues {
|
|
5
|
-
email?: string;
|
|
6
|
-
username?: string;
|
|
7
|
-
password?: string;
|
|
8
|
-
mnemonic?: string;
|
|
9
|
-
[key: string]: string | boolean | undefined;
|
|
10
|
-
}
|
|
11
|
-
export interface LoginFormProps {
|
|
12
|
-
onSubmit: (values: LoginFormValues) => Promise<void>;
|
|
13
|
-
loginType?: 'email' | 'username';
|
|
14
|
-
authType?: 'password' | 'mnemonic';
|
|
15
|
-
allowLoginTypeToggle?: boolean;
|
|
16
|
-
allowAuthTypeToggle?: boolean;
|
|
17
|
-
showForgotPassword?: boolean;
|
|
18
|
-
showSignUp?: boolean;
|
|
19
|
-
forgotPasswordLink?: string;
|
|
20
|
-
signUpLink?: string;
|
|
21
|
-
emailLabel?: string;
|
|
22
|
-
usernameLabel?: string;
|
|
23
|
-
passwordLabel?: string;
|
|
24
|
-
mnemonicLabel?: string;
|
|
25
|
-
signInButtonText?: string;
|
|
26
|
-
forgotPasswordText?: string;
|
|
27
|
-
signUpText?: string;
|
|
28
|
-
useUsernameText?: string;
|
|
29
|
-
useEmailText?: string;
|
|
30
|
-
useMnemonicText?: string;
|
|
31
|
-
usePasswordText?: string;
|
|
32
|
-
toggleVisibilityLabel?: string;
|
|
33
|
-
titleText?: string;
|
|
34
|
-
emailValidation?: Yup.StringSchema;
|
|
35
|
-
usernameValidation?: Yup.StringSchema;
|
|
36
|
-
passwordValidation?: Yup.StringSchema;
|
|
37
|
-
mnemonicValidation?: Yup.StringSchema;
|
|
38
|
-
additionalFields?: (formik: ReturnType<typeof useFormik<LoginFormValues>>) => React.ReactNode;
|
|
39
|
-
additionalInitialValues?: Record<string, string | boolean>;
|
|
40
|
-
additionalValidation?: Record<string, Yup.Schema>;
|
|
41
|
-
}
|
|
42
|
-
export declare const LoginForm: FC<LoginFormProps>;
|
|
43
|
-
export default LoginForm;
|
|
44
|
-
//# sourceMappingURL=LoginForm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoginForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/LoginForm.tsx"],"names":[],"mappings":"AAiBA,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,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAC7C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,SAAS,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IACjC,QAAQ,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACnC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACnC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,gBAAgB,CAAC,EAAE,CACjB,MAAM,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,eAAe,CAAC,CAAC,KAClD,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;CACnD;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAoYxC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LoginForm = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
7
|
-
const icons_material_1 = require("@mui/icons-material");
|
|
8
|
-
const material_1 = require("@mui/material");
|
|
9
|
-
const formik_1 = require("formik");
|
|
10
|
-
const react_1 = require("react");
|
|
11
|
-
const Yup = tslib_1.__importStar(require("yup"));
|
|
12
|
-
const contexts_1 = require("../contexts");
|
|
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
|
-
const { tComponent } = (0, contexts_1.useI18n)();
|
|
15
|
-
const [loginType, setLoginType] = (0, react_1.useState)(initialLoginType);
|
|
16
|
-
const [authType, setAuthType] = (0, react_1.useState)(initialAuthType);
|
|
17
|
-
const [showSecret, setShowSecret] = (0, react_1.useState)(false);
|
|
18
|
-
// Use translations with fallbacks
|
|
19
|
-
const labels = {
|
|
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),
|
|
46
|
-
};
|
|
47
|
-
const validation = {
|
|
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)),
|
|
64
|
-
};
|
|
65
|
-
const formik = (0, formik_1.useFormik)({
|
|
66
|
-
initialValues: {
|
|
67
|
-
email: '',
|
|
68
|
-
username: '',
|
|
69
|
-
mnemonic: '',
|
|
70
|
-
password: '',
|
|
71
|
-
...additionalInitialValues,
|
|
72
|
-
},
|
|
73
|
-
validationSchema: Yup.object({
|
|
74
|
-
[loginType]: loginType === 'email' ? validation.email : validation.username,
|
|
75
|
-
...(authType === 'mnemonic'
|
|
76
|
-
? { mnemonic: validation.mnemonic }
|
|
77
|
-
: { password: validation.password }),
|
|
78
|
-
...additionalValidation,
|
|
79
|
-
}),
|
|
80
|
-
enableReinitialize: true,
|
|
81
|
-
onSubmit: async (values, { setStatus }) => {
|
|
82
|
-
try {
|
|
83
|
-
setStatus(null);
|
|
84
|
-
await onSubmit(values);
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
const err = error;
|
|
88
|
-
setStatus(err.message ||
|
|
89
|
-
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_UnexpectedError));
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Container, { component: "main", maxWidth: "xs", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
95
|
-
marginTop: 8,
|
|
96
|
-
display: 'flex',
|
|
97
|
-
flexDirection: 'column',
|
|
98
|
-
alignItems: 'center',
|
|
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: {
|
|
102
|
-
input: {
|
|
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, {}) }) })),
|
|
104
|
-
},
|
|
105
|
-
} })) : ((0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, name: "mnemonic", label: labels.mnemonic, id: "mnemonic", multiline: true, rows: 3, value: formik.values.mnemonic, onChange: formik.handleChange, error: formik.touched.mnemonic && Boolean(formik.errors.mnemonic), helperText: formik.touched.mnemonic && formik.errors.mnemonic, type: showSecret ? 'text' : 'password', slotProps: {
|
|
106
|
-
input: {
|
|
107
|
-
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, {}) }) })),
|
|
108
|
-
},
|
|
109
|
-
} })), additionalFields && additionalFields(formik), (0, jsx_runtime_1.jsx)(material_1.Button, { type: "submit", fullWidth: true, variant: "contained", sx: { mt: 3, mb: 2 }, disabled: formik.isSubmitting, children: labels.signIn }), (showForgotPassword || showSignUp) && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: 'flex', justifyContent: 'space-between' }, children: [showForgotPassword && ((0, jsx_runtime_1.jsx)(material_1.Link, { href: forgotPasswordLink, variant: "body2", children: labels.forgotPassword })), showSignUp && ((0, jsx_runtime_1.jsx)(material_1.Link, { href: signUpLink, variant: "body2", children: labels.signUp }))] })), (allowLoginTypeToggle || allowAuthTypeToggle) && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: 'flex', gap: 1, mt: 2 }, children: [allowLoginTypeToggle && ((0, jsx_runtime_1.jsx)(material_1.Button, { fullWidth: true, variant: "text", onClick: () => {
|
|
110
|
-
const newType = loginType === 'email' ? 'username' : 'email';
|
|
111
|
-
formik.setFieldValue(loginType, '');
|
|
112
|
-
setLoginType(newType);
|
|
113
|
-
}, children: loginType === 'email' ? labels.useUsername : labels.useEmail })), allowAuthTypeToggle && ((0, jsx_runtime_1.jsx)(material_1.Button, { fullWidth: true, variant: "text", onClick: () => {
|
|
114
|
-
const newType = authType === 'password' ? 'mnemonic' : 'password';
|
|
115
|
-
formik.setFieldValue(authType, '');
|
|
116
|
-
setAuthType(newType);
|
|
117
|
-
}, children: authType === 'password'
|
|
118
|
-
? labels.useMnemonic
|
|
119
|
-
: labels.usePassword }))] }))] })] }) }));
|
|
120
|
-
};
|
|
121
|
-
exports.LoginForm = LoginForm;
|
|
122
|
-
exports.default = exports.LoginForm;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export interface LogoutPageProps {
|
|
2
|
-
onLogout: () => Promise<void> | void;
|
|
3
|
-
onNavigate?: (path: string) => void;
|
|
4
|
-
redirectTo?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const LogoutPage: ({ onLogout, onNavigate, redirectTo }: LogoutPageProps) => null;
|
|
7
|
-
export default LogoutPage;
|
|
8
|
-
//# sourceMappingURL=LogoutPage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LogoutPage.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/LogoutPage.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,UAAU,GAAI,sCAAiD,eAAe,SAU1F,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LogoutPage = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const LogoutPage = ({ onLogout, onNavigate, redirectTo = '/login' }) => {
|
|
6
|
-
(0, react_1.useEffect)(() => {
|
|
7
|
-
const performLogout = async () => {
|
|
8
|
-
await onLogout();
|
|
9
|
-
onNavigate?.(redirectTo);
|
|
10
|
-
};
|
|
11
|
-
performLogout();
|
|
12
|
-
}, [onLogout, onNavigate, redirectTo]);
|
|
13
|
-
return null;
|
|
14
|
-
};
|
|
15
|
-
exports.LogoutPage = LogoutPage;
|
|
16
|
-
exports.default = exports.LogoutPage;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { useFormik } from 'formik';
|
|
2
|
-
import { FC } from 'react';
|
|
3
|
-
import * as Yup from 'yup';
|
|
4
|
-
export interface RegisterFormValues {
|
|
5
|
-
username: string;
|
|
6
|
-
email: string;
|
|
7
|
-
timezone: string;
|
|
8
|
-
password?: string;
|
|
9
|
-
confirmPassword?: string;
|
|
10
|
-
directChallenge?: boolean;
|
|
11
|
-
[key: string]: string | boolean | undefined;
|
|
12
|
-
}
|
|
13
|
-
export interface RegisterFormProps {
|
|
14
|
-
onSubmit: (values: RegisterFormValues, usePassword: boolean) => Promise<{
|
|
15
|
-
success: boolean;
|
|
16
|
-
message: string;
|
|
17
|
-
mnemonic?: string;
|
|
18
|
-
} | {
|
|
19
|
-
error: string;
|
|
20
|
-
errorType?: string;
|
|
21
|
-
field?: string;
|
|
22
|
-
errors?: Array<{
|
|
23
|
-
path: string;
|
|
24
|
-
msg: string;
|
|
25
|
-
}>;
|
|
26
|
-
}>;
|
|
27
|
-
timezones: string[];
|
|
28
|
-
getInitialTimezone: () => string;
|
|
29
|
-
usernameValidation?: Yup.StringSchema;
|
|
30
|
-
emailValidation?: Yup.StringSchema;
|
|
31
|
-
timezoneValidation?: Yup.StringSchema;
|
|
32
|
-
passwordValidation?: Yup.StringSchema;
|
|
33
|
-
confirmPasswordValidation?: Yup.StringSchema;
|
|
34
|
-
additionalFields?: (formik: ReturnType<typeof useFormik<RegisterFormValues>>, usePassword: boolean) => React.ReactNode;
|
|
35
|
-
additionalInitialValues?: Record<string, string | boolean>;
|
|
36
|
-
additionalValidation?: Record<string, Yup.Schema>;
|
|
37
|
-
labels?: {
|
|
38
|
-
title?: string;
|
|
39
|
-
username?: string;
|
|
40
|
-
email?: string;
|
|
41
|
-
timezone?: string;
|
|
42
|
-
password?: string;
|
|
43
|
-
confirmPassword?: string;
|
|
44
|
-
useMnemonic?: string;
|
|
45
|
-
usePassword?: string;
|
|
46
|
-
registering?: string;
|
|
47
|
-
register?: string;
|
|
48
|
-
successTitle?: string;
|
|
49
|
-
mnemonicSuccess?: string;
|
|
50
|
-
proceedToLogin?: string;
|
|
51
|
-
loginLink?: string;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export declare const RegisterForm: FC<RegisterFormProps>;
|
|
55
|
-
export default RegisterForm;
|
|
56
|
-
//# sourceMappingURL=RegisterForm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RegisterForm = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
7
|
-
const material_1 = require("@mui/material");
|
|
8
|
-
const formik_1 = require("formik");
|
|
9
|
-
const react_1 = require("react");
|
|
10
|
-
const Yup = tslib_1.__importStar(require("yup"));
|
|
11
|
-
const contexts_1 = require("../contexts");
|
|
12
|
-
const RegisterForm = ({ onSubmit, timezones, getInitialTimezone, usernameValidation, emailValidation, timezoneValidation, passwordValidation, confirmPasswordValidation, additionalFields, additionalInitialValues = {}, additionalValidation = {}, labels = {}, }) => {
|
|
13
|
-
const { tComponent } = (0, contexts_1.useI18n)();
|
|
14
|
-
const [apiErrors, setApiErrors] = (0, react_1.useState)({});
|
|
15
|
-
const [mnemonic, setMnemonic] = (0, react_1.useState)(null);
|
|
16
|
-
const [usePassword, setUsePassword] = (0, react_1.useState)(true);
|
|
17
|
-
const [registrationSuccess, setRegistrationSuccess] = (0, react_1.useState)(false);
|
|
18
|
-
const [registering, setRegistering] = (0, react_1.useState)(false);
|
|
19
|
-
const validation = {
|
|
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)),
|
|
43
|
-
};
|
|
44
|
-
const formik = (0, formik_1.useFormik)({
|
|
45
|
-
initialValues: {
|
|
46
|
-
username: '',
|
|
47
|
-
email: '',
|
|
48
|
-
timezone: getInitialTimezone(),
|
|
49
|
-
password: '',
|
|
50
|
-
confirmPassword: '',
|
|
51
|
-
directChallenge: false,
|
|
52
|
-
...additionalInitialValues,
|
|
53
|
-
},
|
|
54
|
-
enableReinitialize: true,
|
|
55
|
-
validationSchema: Yup.object({
|
|
56
|
-
username: validation.username,
|
|
57
|
-
email: validation.email,
|
|
58
|
-
timezone: validation.timezone,
|
|
59
|
-
...(usePassword
|
|
60
|
-
? {
|
|
61
|
-
password: validation.password,
|
|
62
|
-
confirmPassword: validation.confirmPassword,
|
|
63
|
-
}
|
|
64
|
-
: {}),
|
|
65
|
-
...additionalValidation,
|
|
66
|
-
}),
|
|
67
|
-
onSubmit: async (values, { setSubmitting, setFieldError, setTouched }) => {
|
|
68
|
-
setRegistering(true);
|
|
69
|
-
const registerResult = await onSubmit(values, usePassword);
|
|
70
|
-
if ('success' in registerResult && registerResult.success) {
|
|
71
|
-
setRegistrationSuccess(true);
|
|
72
|
-
if (!usePassword && registerResult.mnemonic) {
|
|
73
|
-
setMnemonic(registerResult.mnemonic);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
setRegistrationSuccess(false);
|
|
78
|
-
const newApiErrors = {};
|
|
79
|
-
const fieldsToTouch = {};
|
|
80
|
-
if ('field' in registerResult && registerResult.field) {
|
|
81
|
-
setFieldError(registerResult.field, registerResult.error);
|
|
82
|
-
fieldsToTouch[registerResult.field] = true;
|
|
83
|
-
}
|
|
84
|
-
if ('errors' in registerResult && registerResult.errors) {
|
|
85
|
-
registerResult.errors.forEach((err) => {
|
|
86
|
-
if (err.path && err.msg) {
|
|
87
|
-
setFieldError(err.path, err.msg);
|
|
88
|
-
fieldsToTouch[err.path] = true;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
if ('error' in registerResult &&
|
|
93
|
-
registerResult.error &&
|
|
94
|
-
!Object.keys(newApiErrors).length) {
|
|
95
|
-
newApiErrors.general = registerResult.error;
|
|
96
|
-
}
|
|
97
|
-
setApiErrors(newApiErrors);
|
|
98
|
-
setTouched(fieldsToTouch, false);
|
|
99
|
-
}
|
|
100
|
-
setSubmitting(false);
|
|
101
|
-
setRegistering(false);
|
|
102
|
-
setApiErrors({});
|
|
103
|
-
},
|
|
104
|
-
});
|
|
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) }) }))] })] }) }));
|
|
138
|
-
};
|
|
139
|
-
exports.RegisterForm = RegisterForm;
|
|
140
|
-
exports.default = exports.RegisterForm;
|