@digitaldefiance/express-suite-react-components 5.0.2 → 5.0.4
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 +5 -4
- package/src/auth/AdminRoute.d.ts +8 -0
- package/src/auth/AdminRoute.d.ts.map +1 -0
- package/src/auth/AdminRoute.js +28 -0
- package/src/auth/Private.d.ts +6 -0
- package/src/auth/Private.d.ts.map +1 -0
- package/src/auth/Private.js +14 -0
- package/src/auth/PrivateRoute.d.ts +8 -0
- package/src/auth/PrivateRoute.d.ts.map +1 -0
- package/src/auth/PrivateRoute.js +23 -0
- package/src/auth/UnAuth.d.ts +6 -0
- package/src/auth/UnAuth.d.ts.map +1 -0
- package/src/auth/UnAuth.js +14 -0
- package/src/auth/UnAuthRoute.d.ts +8 -0
- package/src/auth/UnAuthRoute.d.ts.map +1 -0
- package/src/auth/UnAuthRoute.js +22 -0
- package/src/auth/{index.ts → index.d.ts} +3 -2
- package/src/auth/index.d.ts.map +1 -0
- package/src/auth/index.js +12 -0
- package/src/components/ApiAccess.d.ts +16 -0
- package/src/components/ApiAccess.d.ts.map +1 -0
- package/src/components/ApiAccess.js +77 -0
- package/src/components/BackupCodeLoginForm.d.ts +43 -0
- package/src/components/BackupCodeLoginForm.d.ts.map +1 -0
- package/src/components/BackupCodeLoginForm.js +139 -0
- package/src/components/BackupCodesForm.d.ts +26 -0
- package/src/components/BackupCodesForm.d.ts.map +1 -0
- package/src/components/BackupCodesForm.js +120 -0
- package/src/components/CategoryMenu.d.ts +17 -0
- package/src/components/CategoryMenu.d.ts.map +1 -0
- package/src/components/CategoryMenu.js +65 -0
- package/src/components/ChangePasswordForm.d.ts +26 -0
- package/src/components/ChangePasswordForm.d.ts.map +1 -0
- package/src/components/ChangePasswordForm.js +78 -0
- package/src/components/ConfirmationDialog.d.ts +13 -0
- package/src/components/ConfirmationDialog.d.ts.map +1 -0
- package/src/components/ConfirmationDialog.js +10 -0
- package/src/components/CurrencyCodeSelector.d.ts +9 -0
- package/src/components/CurrencyCodeSelector.d.ts.map +1 -0
- package/src/components/CurrencyCodeSelector.js +31 -0
- package/src/components/CurrencyInput.d.ts +13 -0
- package/src/components/CurrencyInput.d.ts.map +1 -0
- package/src/components/CurrencyInput.js +22 -0
- package/src/components/DashboardPage.d.ts +8 -0
- package/src/components/DashboardPage.d.ts.map +1 -0
- package/src/components/DashboardPage.js +10 -0
- package/src/components/DropdownMenu.d.ts +13 -0
- package/src/components/DropdownMenu.d.ts.map +1 -0
- package/src/components/DropdownMenu.js +63 -0
- package/src/components/ExpirationSecondsSelector.d.ts +13 -0
- package/src/components/ExpirationSecondsSelector.d.ts.map +1 -0
- package/src/components/ExpirationSecondsSelector.js +32 -0
- package/src/components/FakeEmailAdminPanel.d.ts +23 -0
- package/src/components/FakeEmailAdminPanel.d.ts.map +1 -0
- package/src/components/FakeEmailAdminPanel.js +147 -0
- package/src/components/Flag.d.ts +20 -0
- package/src/components/Flag.d.ts.map +1 -0
- package/src/components/Flag.js +43 -0
- package/src/components/ForgotPasswordForm.d.ts +18 -0
- package/src/components/ForgotPasswordForm.d.ts.map +1 -0
- package/src/components/ForgotPasswordForm.js +61 -0
- package/src/components/LoginForm.d.ts +44 -0
- package/src/components/LoginForm.d.ts.map +1 -0
- package/src/components/LoginForm.js +123 -0
- package/src/components/LogoutPage.d.ts +8 -0
- package/src/components/LogoutPage.d.ts.map +1 -0
- package/src/components/LogoutPage.js +16 -0
- package/src/components/RegisterForm.d.ts +100 -0
- package/src/components/RegisterForm.d.ts.map +1 -0
- package/src/components/RegisterForm.js +306 -0
- package/src/components/ResetPasswordForm.d.ts +23 -0
- package/src/components/ResetPasswordForm.d.ts.map +1 -0
- package/src/components/ResetPasswordForm.js +78 -0
- package/src/components/SideMenu.d.ts +8 -0
- package/src/components/SideMenu.d.ts.map +1 -0
- package/src/components/SideMenu.js +25 -0
- package/src/components/SideMenuListItem.d.ts +13 -0
- package/src/components/SideMenuListItem.d.ts.map +1 -0
- package/src/components/SideMenuListItem.js +44 -0
- package/src/components/T.d.ts +7 -0
- package/src/components/T.d.ts.map +1 -0
- package/src/components/T.js +13 -0
- package/src/components/TDiv.d.ts +9 -0
- package/src/components/TDiv.d.ts.map +1 -0
- package/src/components/TDiv.js +14 -0
- package/src/components/TImgAlt.d.ts +10 -0
- package/src/components/TImgAlt.d.ts.map +1 -0
- package/src/components/TImgAlt.js +14 -0
- package/src/components/TopMenu.d.ts +50 -0
- package/src/components/TopMenu.d.ts.map +1 -0
- package/src/components/TopMenu.js +79 -0
- package/src/components/TotpSetupForm.d.ts +24 -0
- package/src/components/TotpSetupForm.d.ts.map +1 -0
- package/src/components/TotpSetupForm.js +82 -0
- package/src/components/TotpVerificationForm.d.ts +23 -0
- package/src/components/TotpVerificationForm.d.ts.map +1 -0
- package/src/components/TotpVerificationForm.js +66 -0
- package/src/components/TranslatedTitle.d.ts +8 -0
- package/src/components/TranslatedTitle.d.ts.map +1 -0
- package/src/components/TranslatedTitle.js +15 -0
- package/src/components/UserLanguageSelector.d.ts +4 -0
- package/src/components/UserLanguageSelector.d.ts.map +1 -0
- package/src/components/UserLanguageSelector.js +31 -0
- package/src/components/UserMenu.d.ts +4 -0
- package/src/components/UserMenu.d.ts.map +1 -0
- package/src/components/UserMenu.js +12 -0
- package/src/components/UserSettingsForm.d.ts +113 -0
- package/src/components/UserSettingsForm.d.ts.map +1 -0
- package/src/components/UserSettingsForm.js +269 -0
- package/src/components/VerifyEmailPage.d.ts +24 -0
- package/src/components/VerifyEmailPage.d.ts.map +1 -0
- package/src/components/VerifyEmailPage.js +81 -0
- package/src/components/{index.ts → index.d.ts} +1 -1
- package/src/components/index.d.ts.map +1 -0
- package/src/components/index.js +35 -0
- package/src/contexts/AuthProvider.d.ts +19 -0
- package/src/contexts/AuthProvider.d.ts.map +1 -0
- package/src/contexts/AuthProvider.js +514 -0
- package/src/contexts/I18nProvider.d.ts +27 -0
- package/src/contexts/I18nProvider.d.ts.map +1 -0
- package/src/contexts/I18nProvider.js +60 -0
- package/src/contexts/MenuContext.d.ts +28 -0
- package/src/contexts/MenuContext.d.ts.map +1 -0
- package/src/contexts/MenuContext.js +307 -0
- package/src/contexts/SuiteConfigProvider.d.ts +44 -0
- package/src/contexts/SuiteConfigProvider.d.ts.map +1 -0
- package/src/contexts/SuiteConfigProvider.js +43 -0
- package/src/contexts/ThemeProvider.d.ts +15 -0
- package/src/contexts/ThemeProvider.d.ts.map +1 -0
- package/src/contexts/ThemeProvider.js +36 -0
- package/src/contexts/auth-context.d.ts +172 -0
- package/src/contexts/auth-context.d.ts.map +1 -0
- package/src/contexts/auth-context.js +13 -0
- package/src/contexts/{index.ts → index.d.ts} +1 -0
- package/src/contexts/index.d.ts.map +1 -0
- package/src/contexts/index.js +8 -0
- package/src/hooks/{index.ts → index.d.ts} +1 -0
- package/src/hooks/index.d.ts.map +1 -0
- package/src/hooks/index.js +9 -0
- package/src/hooks/useAuthenticatedApi.d.ts +34 -0
- package/src/hooks/useAuthenticatedApi.d.ts.map +1 -0
- package/src/hooks/useAuthenticatedApi.js +46 -0
- package/src/hooks/useBackupCodes.d.ts +15 -0
- package/src/hooks/useBackupCodes.d.ts.map +1 -0
- package/src/hooks/useBackupCodes.js +74 -0
- package/src/hooks/useEmailVerification.d.ts +10 -0
- package/src/hooks/useEmailVerification.d.ts.map +1 -0
- package/src/hooks/useEmailVerification.js +40 -0
- package/src/hooks/useExpiringValue.d.ts +14 -0
- package/src/hooks/useExpiringValue.d.ts.map +1 -0
- package/src/hooks/useExpiringValue.js +53 -0
- package/src/hooks/useLocalStorage.d.ts +2 -0
- package/src/hooks/useLocalStorage.d.ts.map +1 -0
- package/src/hooks/useLocalStorage.js +15 -0
- package/src/hooks/useUserSettings.d.ts +48 -0
- package/src/hooks/useUserSettings.d.ts.map +1 -0
- package/src/hooks/useUserSettings.js +171 -0
- package/src/{index.ts → index.d.ts} +1 -1
- package/src/index.d.ts.map +1 -0
- package/src/index.js +12 -0
- package/src/interfaces/IAppConfig.d.ts +8 -0
- package/src/interfaces/IAppConfig.d.ts.map +1 -0
- package/src/interfaces/IAppConfig.js +2 -0
- package/src/interfaces/ICategoryConfig.d.ts +41 -0
- package/src/interfaces/ICategoryConfig.d.ts.map +1 -0
- package/src/interfaces/ICategoryConfig.js +2 -0
- package/src/interfaces/IMenuConfig.d.ts +28 -0
- package/src/interfaces/IMenuConfig.d.ts.map +1 -0
- package/src/interfaces/IMenuConfig.js +2 -0
- package/src/interfaces/IMenuOption.d.ts +82 -0
- package/src/interfaces/IMenuOption.d.ts.map +1 -0
- package/src/interfaces/IMenuOption.js +2 -0
- package/src/interfaces/{index.ts → index.d.ts} +1 -0
- package/src/interfaces/index.d.ts.map +1 -0
- package/src/interfaces/index.js +7 -0
- package/src/services/__mocks__/authService.d.ts +21 -0
- package/src/services/__mocks__/authService.d.ts.map +1 -0
- package/src/services/__mocks__/authService.js +15 -0
- package/src/services/api.d.ts +3 -0
- package/src/services/api.d.ts.map +1 -0
- package/src/services/api.js +14 -0
- package/src/services/authService.d.ts +126 -0
- package/src/services/authService.d.ts.map +1 -0
- package/src/services/authService.js +471 -0
- package/src/services/authenticatedApi.d.ts +3 -0
- package/src/services/authenticatedApi.d.ts.map +1 -0
- package/src/services/authenticatedApi.js +18 -0
- package/src/services/index.d.ts +4 -0
- package/src/services/index.d.ts.map +1 -0
- package/src/services/index.js +6 -0
- package/src/types/MenuType.d.ts +11 -0
- package/src/types/MenuType.d.ts.map +1 -0
- package/src/types/MenuType.js +12 -0
- package/src/types/expirationSeconds.d.ts +3 -0
- package/src/types/expirationSeconds.d.ts.map +1 -0
- package/src/types/expirationSeconds.js +17 -0
- package/src/types/index.d.ts +2 -0
- package/src/types/index.d.ts.map +1 -0
- package/src/types/index.js +4 -0
- package/src/types/translation.d.ts +10 -0
- package/src/types/translation.d.ts.map +1 -0
- package/src/types/translation.js +9 -0
- package/src/wrappers/BackupCodeLoginWrapper.d.ts +8 -0
- package/src/wrappers/BackupCodeLoginWrapper.d.ts.map +1 -0
- package/src/wrappers/BackupCodeLoginWrapper.js +20 -0
- package/src/wrappers/BackupCodesWrapper.d.ts +7 -0
- package/src/wrappers/BackupCodesWrapper.d.ts.map +1 -0
- package/src/wrappers/BackupCodesWrapper.js +17 -0
- package/src/wrappers/ChangePasswordFormWrapper.d.ts +8 -0
- package/src/wrappers/ChangePasswordFormWrapper.d.ts.map +1 -0
- package/src/wrappers/ChangePasswordFormWrapper.js +21 -0
- package/src/wrappers/ForgotPasswordFormWrapper.d.ts +8 -0
- package/src/wrappers/ForgotPasswordFormWrapper.d.ts.map +1 -0
- package/src/wrappers/ForgotPasswordFormWrapper.js +29 -0
- package/src/wrappers/LoginFormWrapper.d.ts +21 -0
- package/src/wrappers/LoginFormWrapper.d.ts.map +1 -0
- package/src/wrappers/LoginFormWrapper.js +72 -0
- package/src/wrappers/LogoutPageWrapper.d.ts +9 -0
- package/src/wrappers/LogoutPageWrapper.d.ts.map +1 -0
- package/src/wrappers/LogoutPageWrapper.js +21 -0
- package/src/wrappers/RegisterFormWrapper.d.ts +20 -0
- package/src/wrappers/RegisterFormWrapper.d.ts.map +1 -0
- package/src/wrappers/RegisterFormWrapper.js +51 -0
- package/src/wrappers/ResetPasswordFormWrapper.d.ts +9 -0
- package/src/wrappers/ResetPasswordFormWrapper.d.ts.map +1 -0
- package/src/wrappers/ResetPasswordFormWrapper.js +34 -0
- package/src/wrappers/UserSettingsFormWrapper.d.ts +29 -0
- package/src/wrappers/UserSettingsFormWrapper.d.ts.map +1 -0
- package/src/wrappers/UserSettingsFormWrapper.js +95 -0
- package/src/wrappers/VerifyEmailPageWrapper.d.ts +8 -0
- package/src/wrappers/VerifyEmailPageWrapper.d.ts.map +1 -0
- package/src/wrappers/VerifyEmailPageWrapper.js +21 -0
- package/src/wrappers/{index.tsx → index.d.ts} +1 -10
- package/src/wrappers/index.d.ts.map +1 -0
- package/src/wrappers/index.js +24 -0
- package/LICENSE +0 -21
- package/src/auth/AdminRoute.tsx +0 -54
- package/src/auth/Private.tsx +0 -17
- package/src/auth/PrivateRoute.tsx +0 -28
- package/src/auth/UnAuth.tsx +0 -16
- package/src/auth/UnAuthRoute.tsx +0 -30
- package/src/components/ApiAccess.tsx +0 -175
- package/src/components/BackupCodeLoginForm.tsx +0 -489
- package/src/components/BackupCodesForm.tsx +0 -287
- package/src/components/CategoryMenu.tsx +0 -155
- package/src/components/ChangePasswordForm.tsx +0 -273
- package/src/components/ConfirmationDialog.tsx +0 -48
- package/src/components/CurrencyCodeSelector.tsx +0 -60
- package/src/components/CurrencyInput.tsx +0 -80
- package/src/components/DashboardPage.tsx +0 -24
- package/src/components/DropdownMenu.tsx +0 -105
- package/src/components/ExpirationSecondsSelector.tsx +0 -60
- package/src/components/FakeEmailAdminPanel.tsx +0 -374
- package/src/components/Flag.tsx +0 -52
- package/src/components/ForgotPasswordForm.tsx +0 -174
- package/src/components/LoginForm.tsx +0 -468
- package/src/components/LogoutPage.tsx +0 -21
- package/src/components/RegisterForm.tsx +0 -1169
- package/src/components/ResetPasswordForm.tsx +0 -247
- package/src/components/SideMenu.tsx +0 -46
- package/src/components/SideMenuListItem.tsx +0 -75
- package/src/components/T.tsx +0 -24
- package/src/components/TDiv.tsx +0 -26
- package/src/components/TImgAlt.tsx +0 -28
- package/src/components/TopMenu.tsx +0 -252
- package/src/components/TotpSetupForm.tsx +0 -188
- package/src/components/TotpVerificationForm.tsx +0 -148
- package/src/components/TranslatedTitle.tsx +0 -31
- package/src/components/UserLanguageSelector.tsx +0 -45
- package/src/components/UserMenu.tsx +0 -15
- package/src/components/UserSettingsForm.tsx +0 -904
- package/src/components/VerifyEmailPage.tsx +0 -222
- package/src/components/__tests__/RegisterForm.totp.spec.tsx +0 -377
- package/src/components/__tests__/TotpSetupForm.spec.tsx +0 -258
- package/src/components/__tests__/TotpVerificationForm.spec.tsx +0 -259
- package/src/components/__tests__/UserSettingsForm.totp.spec.tsx +0 -396
- package/src/contexts/AuthProvider.spec.tsx +0 -1284
- package/src/contexts/AuthProvider.tsx +0 -977
- package/src/contexts/I18nProvider.tsx +0 -164
- package/src/contexts/MenuContext.tsx +0 -426
- package/src/contexts/SuiteConfigProvider.tsx +0 -93
- package/src/contexts/ThemeProvider.tsx +0 -67
- package/src/hooks/useAuthenticatedApi.tsx +0 -67
- package/src/hooks/useBackupCodes.ts +0 -105
- package/src/hooks/useEmailVerification.ts +0 -54
- package/src/hooks/useExpiringValue.ts +0 -78
- package/src/hooks/useLocalStorage.ts +0 -18
- package/src/hooks/useUserSettings.ts +0 -271
- package/src/interfaces/IAppConfig.ts +0 -7
- package/src/interfaces/ICategoryConfig.ts +0 -41
- package/src/interfaces/IMenuConfig.ts +0 -28
- package/src/interfaces/IMenuOption.ts +0 -79
- package/src/services/__mocks__/authService.ts +0 -14
- package/src/services/__tests__/authService.totp.property.spec.ts +0 -360
- package/src/services/__tests__/authService.totp.spec.ts +0 -439
- package/src/services/api.ts +0 -13
- package/src/services/authService.ts +0 -692
- package/src/services/authenticatedApi.ts +0 -17
- package/src/services/index.ts +0 -3
- package/src/types/MenuType.ts +0 -15
- package/src/types/expirationSeconds.ts +0 -18
- package/src/types/index.ts +0 -1
- package/src/types/translation.ts +0 -20
- package/src/wrappers/BackupCodeLoginWrapper.tsx +0 -34
- package/src/wrappers/BackupCodesWrapper.tsx +0 -28
- package/src/wrappers/ChangePasswordFormWrapper.tsx +0 -34
- package/src/wrappers/ForgotPasswordFormWrapper.tsx +0 -45
- package/src/wrappers/LoginFormWrapper.tsx +0 -108
- package/src/wrappers/LogoutPageWrapper.tsx +0 -30
- package/src/wrappers/RegisterFormWrapper.tsx +0 -109
- package/src/wrappers/ResetPasswordFormWrapper.tsx +0 -57
- package/src/wrappers/UserSettingsFormWrapper.tsx +0 -140
- package/src/wrappers/VerifyEmailPageWrapper.tsx +0 -27
- package/src/wrappers/__tests__/LoginFormWrapper.totp.spec.tsx +0 -339
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FakeEmailAdminButtons = exports.FakeEmailAdminPanel = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* FakeEmailAdminPanel — dev-only panel for inspecting captured emails.
|
|
8
|
+
*
|
|
9
|
+
* Renders only in development/test environments where FakeEmailService is
|
|
10
|
+
* active. Calls the AdminEmailRouter endpoints mounted at `baseUrl/api/admin/emails`.
|
|
11
|
+
*
|
|
12
|
+
* Self-contained: wraps itself with AuthenticatedApiProvider internally.
|
|
13
|
+
* Usage (inside SuiteConfigProvider):
|
|
14
|
+
* <FakeEmailAdminPanel />
|
|
15
|
+
*/
|
|
16
|
+
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
17
|
+
const Delete_1 = tslib_1.__importDefault(require("@mui/icons-material/Delete"));
|
|
18
|
+
const ExpandLess_1 = tslib_1.__importDefault(require("@mui/icons-material/ExpandLess"));
|
|
19
|
+
const ExpandMore_1 = tslib_1.__importDefault(require("@mui/icons-material/ExpandMore"));
|
|
20
|
+
const Refresh_1 = tslib_1.__importDefault(require("@mui/icons-material/Refresh"));
|
|
21
|
+
const material_1 = require("@mui/material");
|
|
22
|
+
const react_1 = require("react");
|
|
23
|
+
const contexts_1 = require("../contexts");
|
|
24
|
+
const ConfirmationDialog_1 = require("./ConfirmationDialog");
|
|
25
|
+
const useAuthenticatedApi_1 = require("../hooks/useAuthenticatedApi");
|
|
26
|
+
/**
|
|
27
|
+
* Renders email HTML content in a sandboxed iframe so that links are
|
|
28
|
+
* clickable and open in a new tab. Falls back to plain text when no
|
|
29
|
+
* HTML body is available.
|
|
30
|
+
*/
|
|
31
|
+
const EmailBodyIframe = ({ html, text, }) => {
|
|
32
|
+
const iframeRef = (0, react_1.useRef)(null);
|
|
33
|
+
(0, react_1.useEffect)(() => {
|
|
34
|
+
const iframe = iframeRef.current;
|
|
35
|
+
if (!iframe)
|
|
36
|
+
return;
|
|
37
|
+
const doc = iframe.contentDocument ?? iframe.contentWindow?.document;
|
|
38
|
+
if (!doc)
|
|
39
|
+
return;
|
|
40
|
+
if (html) {
|
|
41
|
+
// Inject a <base target="_blank"> so every link opens in a new tab,
|
|
42
|
+
// then write the original HTML body.
|
|
43
|
+
doc.open();
|
|
44
|
+
doc.write(`<!DOCTYPE html><html><head><base target="_blank"><style>body{font-family:sans-serif;font-size:14px;margin:8px;}</style></head><body>${html}</body></html>`);
|
|
45
|
+
doc.close();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
doc.open();
|
|
49
|
+
doc.write(`<!DOCTYPE html><html><head><style>body{font-family:sans-serif;font-size:14px;margin:8px;white-space:pre-wrap;}</style></head><body>${text.replace(/</g, '<').replace(/>/g, '>')}</body></html>`);
|
|
50
|
+
doc.close();
|
|
51
|
+
}
|
|
52
|
+
// Auto-resize iframe height to fit content
|
|
53
|
+
const resize = () => {
|
|
54
|
+
if (doc.body) {
|
|
55
|
+
iframe.style.height = `${doc.body.scrollHeight + 16}px`;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
// Resize after content loads (images, etc.)
|
|
59
|
+
iframe.addEventListener('load', resize);
|
|
60
|
+
resize();
|
|
61
|
+
// Small delay to catch late-rendering content
|
|
62
|
+
const timer = setTimeout(resize, 200);
|
|
63
|
+
return () => {
|
|
64
|
+
iframe.removeEventListener('load', resize);
|
|
65
|
+
clearTimeout(timer);
|
|
66
|
+
};
|
|
67
|
+
}, [html, text]);
|
|
68
|
+
return ((0, jsx_runtime_1.jsx)("iframe", { ref: iframeRef, sandbox: "allow-popups allow-popups-to-escape-sandbox allow-same-origin", style: {
|
|
69
|
+
width: '100%',
|
|
70
|
+
minHeight: 80,
|
|
71
|
+
border: '1px solid #e0e0e0',
|
|
72
|
+
borderRadius: 4,
|
|
73
|
+
background: '#fff',
|
|
74
|
+
}, title: "Email body" }));
|
|
75
|
+
};
|
|
76
|
+
const FakeEmailAdminPanelContent = () => {
|
|
77
|
+
const api = (0, useAuthenticatedApi_1.useAuthenticatedApi)();
|
|
78
|
+
const { tComponent } = (0, contexts_1.useI18n)();
|
|
79
|
+
const t = (key) => tComponent(suite_core_lib_1.SuiteCoreComponentId, key);
|
|
80
|
+
const [recipients, setRecipients] = (0, react_1.useState)([]);
|
|
81
|
+
const [expanded, setExpanded] = (0, react_1.useState)(null);
|
|
82
|
+
/** Tracks which individual email is expanded to show its body (address:idx) */
|
|
83
|
+
const [expandedEmail, setExpandedEmail] = (0, react_1.useState)(null);
|
|
84
|
+
const [emailsByAddress, setEmailsByAddress] = (0, react_1.useState)({});
|
|
85
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
86
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
87
|
+
const [clearDialogOpen, setClearDialogOpen] = (0, react_1.useState)(false);
|
|
88
|
+
const loadRecipients = (0, react_1.useCallback)(async () => {
|
|
89
|
+
setLoading(true);
|
|
90
|
+
setError(null);
|
|
91
|
+
try {
|
|
92
|
+
const res = await api.get('/admin/emails');
|
|
93
|
+
setRecipients(res.data.recipients);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
setLoading(false);
|
|
100
|
+
}
|
|
101
|
+
}, [api]);
|
|
102
|
+
(0, react_1.useEffect)(() => {
|
|
103
|
+
void loadRecipients();
|
|
104
|
+
}, [loadRecipients]);
|
|
105
|
+
const toggleExpand = (0, react_1.useCallback)(async (address) => {
|
|
106
|
+
if (expanded === address) {
|
|
107
|
+
setExpanded(null);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
setExpanded(address);
|
|
111
|
+
if (!emailsByAddress[address]) {
|
|
112
|
+
try {
|
|
113
|
+
const res = await api.get(`/admin/emails/${encodeURIComponent(address)}`);
|
|
114
|
+
setEmailsByAddress((prev) => ({ ...prev, [address]: res.data }));
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, [api, expanded, emailsByAddress]);
|
|
121
|
+
const handleClearAll = (0, react_1.useCallback)(async () => {
|
|
122
|
+
setClearDialogOpen(false);
|
|
123
|
+
try {
|
|
124
|
+
await api.delete('/admin/emails');
|
|
125
|
+
setRecipients([]);
|
|
126
|
+
setEmailsByAddress({});
|
|
127
|
+
setExpanded(null);
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
131
|
+
}
|
|
132
|
+
}, [api]);
|
|
133
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Paper, { variant: "outlined", sx: { p: 2 }, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: 'flex', alignItems: 'center', gap: 1, mb: 1 }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "subtitle1", fontWeight: "bold", sx: { flexGrow: 1 }, children: t(suite_core_lib_1.SuiteCoreStringKey.FakeEmail_Admin_Title) }), (0, jsx_runtime_1.jsx)(material_1.Chip, { label: "DEV", size: "small", color: "warning" }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: () => void loadRecipients(), title: t(suite_core_lib_1.SuiteCoreStringKey.FakeEmail_Admin_Refresh), children: (0, jsx_runtime_1.jsx)(Refresh_1.default, { fontSize: "small" }) }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", color: "error", onClick: () => setClearDialogOpen(true), title: t(suite_core_lib_1.SuiteCoreStringKey.FakeEmail_Admin_ClearAll), disabled: recipients.length === 0, children: (0, jsx_runtime_1.jsx)(Delete_1.default, { fontSize: "small" }) })] }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { mb: 1 } }), error && ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", sx: { mb: 1 }, onClose: () => setError(null), children: error })), loading && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: 'flex', justifyContent: 'center', py: 2 }, children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 24 }) })), !loading && recipients.length === 0 && ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: "text.secondary", children: t(suite_core_lib_1.SuiteCoreStringKey.FakeEmail_Admin_NoRecipients) })), !loading && recipients.length > 0 && ((0, jsx_runtime_1.jsx)(material_1.List, { dense: true, disablePadding: true, children: recipients.map((r) => ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.ListItemButton, { onClick: () => void toggleExpand(r.address), sx: { px: 0, py: 0.5 }, children: [(0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: r.address, secondary: `${r.count} ${t(suite_core_lib_1.SuiteCoreStringKey.FakeEmail_Admin_Recipients)}` }), expanded === r.address ? ((0, jsx_runtime_1.jsx)(ExpandLess_1.default, { fontSize: "small" })) : ((0, jsx_runtime_1.jsx)(ExpandMore_1.default, { fontSize: "small" }))] }), (0, jsx_runtime_1.jsx)(material_1.Collapse, { in: expanded === r.address, unmountOnExit: true, children: emailsByAddress[r.address]?.length === 0 ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: "text.secondary", sx: { pl: 2, py: 0.5 }, children: t(suite_core_lib_1.SuiteCoreStringKey.FakeEmail_Admin_NoEmails) })) : ((0, jsx_runtime_1.jsx)(material_1.List, { dense: true, disablePadding: true, sx: { pl: 2 }, children: (emailsByAddress[r.address] ?? []).map((email, idx) => {
|
|
134
|
+
const emailKey = `${r.address}:${idx}`;
|
|
135
|
+
const isEmailExpanded = expandedEmail === emailKey;
|
|
136
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { py: 0.25 }, children: [(0, jsx_runtime_1.jsxs)(material_1.ListItemButton, { disableGutters: true, onClick: () => setExpandedEmail(isEmailExpanded ? null : emailKey), sx: { py: 0.25, px: 0.5, borderRadius: 1 }, children: [(0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: email.subject || '(no subject)', secondary: `${t(suite_core_lib_1.SuiteCoreStringKey.FakeEmail_Admin_Timestamp)}: ${new Date(email.timestamp).toLocaleString()}`, primaryTypographyProps: { variant: 'body2' }, secondaryTypographyProps: { variant: 'caption' } }), isEmailExpanded ? ((0, jsx_runtime_1.jsx)(ExpandLess_1.default, { fontSize: "small" })) : ((0, jsx_runtime_1.jsx)(ExpandMore_1.default, { fontSize: "small" }))] }), (0, jsx_runtime_1.jsx)(material_1.Collapse, { in: isEmailExpanded, unmountOnExit: true, children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { pl: 1, pr: 1, pb: 1 }, children: (0, jsx_runtime_1.jsx)(EmailBodyIframe, { html: email.html, text: email.text }) }) })] }, idx));
|
|
137
|
+
}) })) }), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] }, r.address))) })), (0, jsx_runtime_1.jsx)(ConfirmationDialog_1.ConfirmationDialog, { open: clearDialogOpen, title: t(suite_core_lib_1.SuiteCoreStringKey.FakeEmail_Admin_ClearAll), message: t(suite_core_lib_1.SuiteCoreStringKey.FakeEmail_Admin_ClearConfirm), onConfirm: () => void handleClearAll(), onCancel: () => setClearDialogOpen(false) })] }));
|
|
138
|
+
};
|
|
139
|
+
const FakeEmailAdminPanel = () => ((0, jsx_runtime_1.jsx)(useAuthenticatedApi_1.AuthenticatedApiProvider, { children: (0, jsx_runtime_1.jsx)(FakeEmailAdminPanelContent, {}) }));
|
|
140
|
+
exports.FakeEmailAdminPanel = FakeEmailAdminPanel;
|
|
141
|
+
exports.default = exports.FakeEmailAdminPanel;
|
|
142
|
+
const FakeEmailAdminButtons = ({ onRefresh, onClear, disabled = false, }) => {
|
|
143
|
+
const { tComponent } = (0, contexts_1.useI18n)();
|
|
144
|
+
const t = (key) => tComponent(suite_core_lib_1.SuiteCoreComponentId, key);
|
|
145
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: 'flex', gap: 1 }, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", startIcon: (0, jsx_runtime_1.jsx)(Refresh_1.default, {}), onClick: onRefresh, disabled: disabled, children: t(suite_core_lib_1.SuiteCoreStringKey.FakeEmail_Admin_Refresh) }), (0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", color: "error", startIcon: (0, jsx_runtime_1.jsx)(Delete_1.default, {}), onClick: onClear, disabled: disabled, children: t(suite_core_lib_1.SuiteCoreStringKey.FakeEmail_Admin_ClearAll) })] }));
|
|
146
|
+
};
|
|
147
|
+
exports.FakeEmailAdminButtons = FakeEmailAdminButtons;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForgotPasswordForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ForgotPasswordForm.tsx"],"names":[],"mappings":"AAcA,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"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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;
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoginForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/LoginForm.tsx"],"names":[],"mappings":"AAkBA,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,CAgZxC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
passwordAuthInfo: tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Login_PasswordAuthInfo),
|
|
47
|
+
};
|
|
48
|
+
const validation = {
|
|
49
|
+
email: emailValidation ||
|
|
50
|
+
Yup.string()
|
|
51
|
+
.email(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_InvalidEmail))
|
|
52
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
53
|
+
username: usernameValidation ||
|
|
54
|
+
Yup.string()
|
|
55
|
+
.matches(suite_core_lib_1.Constants.UsernameRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_UsernameRegexErrorTemplate))
|
|
56
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
57
|
+
password: passwordValidation ||
|
|
58
|
+
Yup.string()
|
|
59
|
+
.min(1, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required))
|
|
60
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
61
|
+
mnemonic: mnemonicValidation ||
|
|
62
|
+
Yup.string()
|
|
63
|
+
.matches(suite_core_lib_1.Constants.MnemonicRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_InvalidMnemonic))
|
|
64
|
+
.required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
|
|
65
|
+
};
|
|
66
|
+
const formik = (0, formik_1.useFormik)({
|
|
67
|
+
initialValues: {
|
|
68
|
+
email: '',
|
|
69
|
+
username: '',
|
|
70
|
+
mnemonic: '',
|
|
71
|
+
password: '',
|
|
72
|
+
...additionalInitialValues,
|
|
73
|
+
},
|
|
74
|
+
validationSchema: Yup.object({
|
|
75
|
+
[loginType]: loginType === 'email' ? validation.email : validation.username,
|
|
76
|
+
...(authType === 'mnemonic'
|
|
77
|
+
? { mnemonic: validation.mnemonic }
|
|
78
|
+
: { password: validation.password }),
|
|
79
|
+
...additionalValidation,
|
|
80
|
+
}),
|
|
81
|
+
enableReinitialize: true,
|
|
82
|
+
onSubmit: async (values, { setStatus }) => {
|
|
83
|
+
try {
|
|
84
|
+
setStatus(null);
|
|
85
|
+
await onSubmit(values);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
const err = error;
|
|
89
|
+
setStatus(err.message ||
|
|
90
|
+
tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_UnexpectedError));
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Container, { component: "main", maxWidth: "xs", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
96
|
+
marginTop: 8,
|
|
97
|
+
display: 'flex',
|
|
98
|
+
flexDirection: 'column',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
}, 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'
|
|
101
|
+
? formik.values.email
|
|
102
|
+
: 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.jsxs)(jsx_runtime_1.Fragment, { children: [(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: {
|
|
103
|
+
input: {
|
|
104
|
+
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, {}) }) })),
|
|
105
|
+
},
|
|
106
|
+
} }), (0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "info", sx: { mt: 1 }, children: labels.passwordAuthInfo })] })) : ((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, autoComplete: "section-mnemonic current-password", 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: {
|
|
107
|
+
input: {
|
|
108
|
+
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, {}) }) })),
|
|
109
|
+
},
|
|
110
|
+
} })), 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: () => {
|
|
111
|
+
const newType = loginType === 'email' ? 'username' : 'email';
|
|
112
|
+
formik.setFieldValue(loginType, '');
|
|
113
|
+
setLoginType(newType);
|
|
114
|
+
}, children: loginType === 'email' ? labels.useUsername : labels.useEmail })), allowAuthTypeToggle && ((0, jsx_runtime_1.jsx)(material_1.Button, { fullWidth: true, variant: "text", onClick: () => {
|
|
115
|
+
const newType = authType === 'password' ? 'mnemonic' : 'password';
|
|
116
|
+
formik.setFieldValue(authType, '');
|
|
117
|
+
setAuthType(newType);
|
|
118
|
+
}, children: authType === 'password'
|
|
119
|
+
? labels.useMnemonic
|
|
120
|
+
: labels.usePassword }))] }))] })] }) }));
|
|
121
|
+
};
|
|
122
|
+
exports.LoginForm = LoginForm;
|
|
123
|
+
exports.default = exports.LoginForm;
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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;
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
displayName?: string;
|
|
8
|
+
timezone: string;
|
|
9
|
+
password?: string;
|
|
10
|
+
confirmPassword?: string;
|
|
11
|
+
directChallenge?: boolean;
|
|
12
|
+
mnemonic?: string;
|
|
13
|
+
[key: string]: string | boolean | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface RegisterFormProps {
|
|
16
|
+
onSubmit: (values: RegisterFormValues, usePassword: boolean) => Promise<{
|
|
17
|
+
success: boolean;
|
|
18
|
+
message: string;
|
|
19
|
+
mnemonic?: string;
|
|
20
|
+
} | {
|
|
21
|
+
error: string;
|
|
22
|
+
errorType?: string;
|
|
23
|
+
field?: string;
|
|
24
|
+
errors?: Array<{
|
|
25
|
+
path: string;
|
|
26
|
+
msg: string;
|
|
27
|
+
}>;
|
|
28
|
+
}>;
|
|
29
|
+
timezones: string[];
|
|
30
|
+
getInitialTimezone: () => string;
|
|
31
|
+
usernameValidation?: Yup.StringSchema;
|
|
32
|
+
emailValidation?: Yup.StringSchema;
|
|
33
|
+
displayNameValidation?: Yup.StringSchema;
|
|
34
|
+
timezoneValidation?: Yup.StringSchema;
|
|
35
|
+
passwordValidation?: Yup.StringSchema;
|
|
36
|
+
confirmPasswordValidation?: Yup.StringSchema;
|
|
37
|
+
/**
|
|
38
|
+
* When true, display a TOTP setup step after successful registration.
|
|
39
|
+
* Defaults to false. When false or not provided, existing flow is unchanged.
|
|
40
|
+
*/
|
|
41
|
+
enableTotpSetup?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Called to initiate TOTP setup (e.g. AuthService.setupTotp()).
|
|
44
|
+
* Must return provisioning URI and secret on success, or an error.
|
|
45
|
+
*/
|
|
46
|
+
onTotpSetup?: () => Promise<{
|
|
47
|
+
provisioningUri: string;
|
|
48
|
+
secret: string;
|
|
49
|
+
} | {
|
|
50
|
+
error: string;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Called to confirm TOTP setup with a 6-digit code (e.g. AuthService.confirmTotp()).
|
|
54
|
+
*/
|
|
55
|
+
onTotpConfirm?: (code: string) => Promise<{
|
|
56
|
+
success: boolean;
|
|
57
|
+
} | {
|
|
58
|
+
error: string;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Called after the user successfully confirms TOTP during the registration flow.
|
|
62
|
+
*/
|
|
63
|
+
onTotpSetupComplete?: () => void;
|
|
64
|
+
/**
|
|
65
|
+
* List of email domains that are not allowed during registration.
|
|
66
|
+
* For example, the home system's email domain should be disallowed
|
|
67
|
+
* so users cannot register with addresses managed by the platform.
|
|
68
|
+
*/
|
|
69
|
+
disallowedEmailDomains?: string[];
|
|
70
|
+
additionalFields?: (formik: ReturnType<typeof useFormik<RegisterFormValues>>, usePassword: boolean) => React.ReactNode;
|
|
71
|
+
additionalInitialValues?: Record<string, string | boolean>;
|
|
72
|
+
additionalValidation?: Record<string, Yup.Schema>;
|
|
73
|
+
labels?: {
|
|
74
|
+
title?: string;
|
|
75
|
+
username?: string;
|
|
76
|
+
email?: string;
|
|
77
|
+
displayName?: string;
|
|
78
|
+
timezone?: string;
|
|
79
|
+
password?: string;
|
|
80
|
+
confirmPassword?: string;
|
|
81
|
+
useMnemonic?: string;
|
|
82
|
+
usePassword?: string;
|
|
83
|
+
registering?: string;
|
|
84
|
+
register?: string;
|
|
85
|
+
successTitle?: string;
|
|
86
|
+
mnemonicSuccess?: string;
|
|
87
|
+
proceedToLogin?: string;
|
|
88
|
+
savedRecoveryPhrase?: string;
|
|
89
|
+
loginLink?: string;
|
|
90
|
+
mnemonic?: string;
|
|
91
|
+
totpSetupTitle?: string;
|
|
92
|
+
totpSkipButton?: string;
|
|
93
|
+
totpSetupError?: string;
|
|
94
|
+
totpSetupSuccess?: string;
|
|
95
|
+
passwordAuthInfo?: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export declare const RegisterForm: FC<RegisterFormProps>;
|
|
99
|
+
export default RegisterForm;
|
|
100
|
+
//# sourceMappingURL=RegisterForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegisterForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/RegisterForm.tsx"],"names":[],"mappings":"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"}
|