@digitaldefiance/express-suite-react-components 5.0.2 → 5.0.3
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 +186 -0
- package/src/contexts/AuthProvider.d.ts.map +1 -0
- package/src/contexts/AuthProvider.js +515 -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 +292 -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/{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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./api"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./authenticatedApi"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./authService"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type MenuType = string & {
|
|
2
|
+
readonly __brand: 'MenuType';
|
|
3
|
+
};
|
|
4
|
+
export declare const createMenuType: (id: string) => MenuType;
|
|
5
|
+
export declare const MenuTypes: {
|
|
6
|
+
readonly SideMenu: MenuType;
|
|
7
|
+
readonly TopMenu: MenuType;
|
|
8
|
+
readonly UserMenu: MenuType;
|
|
9
|
+
};
|
|
10
|
+
export type BuiltInMenuType = typeof MenuTypes[keyof typeof MenuTypes];
|
|
11
|
+
//# sourceMappingURL=MenuType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuType.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/types/MenuType.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;CAAE,CAAC;AAGjE,eAAO,MAAM,cAAc,GAAI,IAAI,MAAM,KAAG,QAA0B,CAAC;AAGvE,eAAO,MAAM,SAAS;;;;CAIZ,CAAC;AAGX,MAAM,MAAM,eAAe,GAAG,OAAO,SAAS,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MenuTypes = exports.createMenuType = void 0;
|
|
4
|
+
// Factory function to create menu types
|
|
5
|
+
const createMenuType = (id) => id;
|
|
6
|
+
exports.createMenuType = createMenuType;
|
|
7
|
+
// Built-in menu types
|
|
8
|
+
exports.MenuTypes = {
|
|
9
|
+
SideMenu: (0, exports.createMenuType)('SideMenu'),
|
|
10
|
+
TopMenu: (0, exports.createMenuType)('TopMenu'),
|
|
11
|
+
UserMenu: (0, exports.createMenuType)('UserMenu'),
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expirationSeconds.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/types/expirationSeconds.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,UAAqC,CAAC;AAEhF,wBAAgB,kCAAkC,CAChD,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,MAAM,EAAE,CAWV"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExpirationSecondsOptionValues = void 0;
|
|
4
|
+
exports.createExpirationSecondsOptionNames = createExpirationSecondsOptionNames;
|
|
5
|
+
exports.ExpirationSecondsOptionValues = [0, 10, 30, 45, 60, 120, 300, 600];
|
|
6
|
+
function createExpirationSecondsOptionNames(secondsLabel, minuteLabel, minutesLabel) {
|
|
7
|
+
return [
|
|
8
|
+
`0 ${secondsLabel}`,
|
|
9
|
+
`10 ${secondsLabel}`,
|
|
10
|
+
`30 ${secondsLabel}`,
|
|
11
|
+
`45 ${secondsLabel}`,
|
|
12
|
+
`1 ${minuteLabel}`,
|
|
13
|
+
`2 ${minutesLabel}`,
|
|
14
|
+
`5 ${minutesLabel}`,
|
|
15
|
+
`10 ${minutesLabel}`,
|
|
16
|
+
];
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translation function type for components
|
|
3
|
+
* Accepts a key and optional variables, returns translated string
|
|
4
|
+
*/
|
|
5
|
+
export type TranslationFunction = (key: string, variables?: Record<string, string | number>) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Helper to get translated text or fallback to provided string
|
|
8
|
+
*/
|
|
9
|
+
export declare function getTranslatedText(t: TranslationFunction | undefined, key: string, fallback: string, variables?: Record<string, string | number>): string;
|
|
10
|
+
//# sourceMappingURL=translation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/types/translation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACxC,MAAM,CAAC;AAEZ;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,CAAC,EAAE,mBAAmB,GAAG,SAAS,EAClC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAC1C,MAAM,CAER"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTranslatedText = getTranslatedText;
|
|
4
|
+
/**
|
|
5
|
+
* Helper to get translated text or fallback to provided string
|
|
6
|
+
*/
|
|
7
|
+
function getTranslatedText(t, key, fallback, variables) {
|
|
8
|
+
return t ? t(key, variables) : fallback;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { BackupCodeLoginForm } from '../components/BackupCodeLoginForm';
|
|
3
|
+
export interface BackupCodeLoginWrapperProps {
|
|
4
|
+
onSuccess?: () => void;
|
|
5
|
+
componentProps?: Partial<React.ComponentProps<typeof BackupCodeLoginForm>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const BackupCodeLoginWrapper: FC<BackupCodeLoginWrapperProps>;
|
|
8
|
+
//# sourceMappingURL=BackupCodeLoginWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackupCodeLoginWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/BackupCodeLoginWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC;CAC5E;AAED,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAuBlE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BackupCodeLoginWrapper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_router_1 = require("react-router");
|
|
6
|
+
const BackupCodeLoginForm_1 = require("../components/BackupCodeLoginForm");
|
|
7
|
+
const contexts_1 = require("../contexts");
|
|
8
|
+
const BackupCodeLoginWrapper = ({ onSuccess, componentProps = {}, }) => {
|
|
9
|
+
const { backupCodeLogin, isAuthenticated } = (0, contexts_1.useAuth)();
|
|
10
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
11
|
+
const handleSubmit = async (...args) => {
|
|
12
|
+
const result = await backupCodeLogin(...args);
|
|
13
|
+
if ('token' in result && onSuccess) {
|
|
14
|
+
onSuccess();
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(BackupCodeLoginForm_1.BackupCodeLoginForm, { onSubmit: handleSubmit, onNavigate: navigate, isAuthenticated: isAuthenticated, ...componentProps }));
|
|
19
|
+
};
|
|
20
|
+
exports.BackupCodeLoginWrapper = BackupCodeLoginWrapper;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { BackupCodesForm } from '../components/BackupCodesForm';
|
|
3
|
+
export interface BackupCodesWrapperProps {
|
|
4
|
+
componentProps?: Partial<React.ComponentProps<typeof BackupCodesForm>>;
|
|
5
|
+
}
|
|
6
|
+
export declare const BackupCodesWrapper: FC<BackupCodesWrapperProps>;
|
|
7
|
+
//# sourceMappingURL=BackupCodesWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackupCodesWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/BackupCodesWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,MAAM,WAAW,uBAAuB;IACtC,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC;CACxE;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAkB1D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BackupCodesWrapper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_router_1 = require("react-router");
|
|
6
|
+
const BackupCodesForm_1 = require("../components/BackupCodesForm");
|
|
7
|
+
const hooks_1 = require("../hooks");
|
|
8
|
+
const BackupCodesWrapper = ({ componentProps = {}, }) => {
|
|
9
|
+
const location = (0, react_router_1.useLocation)();
|
|
10
|
+
const initialCodeCount = location.state?.codeCount ?? null;
|
|
11
|
+
const { backupCodesRemaining, generateBackupCodes } = (0, hooks_1.useBackupCodes)({ initialCodeCount });
|
|
12
|
+
const handleSubmit = async (values) => {
|
|
13
|
+
return await generateBackupCodes(values.password, values.mnemonic);
|
|
14
|
+
};
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(BackupCodesForm_1.BackupCodesForm, { onSubmit: handleSubmit, backupCodesRemaining: backupCodesRemaining, ...componentProps }));
|
|
16
|
+
};
|
|
17
|
+
exports.BackupCodesWrapper = BackupCodesWrapper;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ChangePasswordForm } from '../components/ChangePasswordForm';
|
|
3
|
+
export interface ChangePasswordFormWrapperProps {
|
|
4
|
+
onSuccess?: () => void;
|
|
5
|
+
componentProps?: Partial<React.ComponentProps<typeof ChangePasswordForm>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const ChangePasswordFormWrapper: FC<ChangePasswordFormWrapperProps>;
|
|
8
|
+
//# sourceMappingURL=ChangePasswordFormWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChangePasswordFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/ChangePasswordFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGtE,MAAM,WAAW,8BAA8B;IAC7C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;CAC3E;AAED,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,CAwBxE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChangePasswordFormWrapper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ChangePasswordForm_1 = require("../components/ChangePasswordForm");
|
|
6
|
+
const contexts_1 = require("../contexts");
|
|
7
|
+
const ChangePasswordFormWrapper = ({ onSuccess, componentProps = {}, }) => {
|
|
8
|
+
const { changePassword } = (0, contexts_1.useAuth)();
|
|
9
|
+
const handleSubmit = async (values) => {
|
|
10
|
+
const result = await changePassword(values.currentPassword, values.newPassword);
|
|
11
|
+
if ('error' in result) {
|
|
12
|
+
return { error: result.error };
|
|
13
|
+
}
|
|
14
|
+
if (onSuccess) {
|
|
15
|
+
onSuccess();
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
return (0, jsx_runtime_1.jsx)(ChangePasswordForm_1.ChangePasswordForm, { onSubmit: handleSubmit, ...componentProps });
|
|
20
|
+
};
|
|
21
|
+
exports.ChangePasswordFormWrapper = ChangePasswordFormWrapper;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ForgotPasswordFormProps } from '../components/ForgotPasswordForm';
|
|
3
|
+
export interface ForgotPasswordFormWrapperProps {
|
|
4
|
+
onSuccess?: () => void;
|
|
5
|
+
componentProps?: Partial<Omit<ForgotPasswordFormProps, 'onSubmit'>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const ForgotPasswordFormWrapper: FC<ForgotPasswordFormWrapperProps>;
|
|
8
|
+
//# sourceMappingURL=ForgotPasswordFormWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForgotPasswordFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/ForgotPasswordFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,OAAO,EAEL,uBAAuB,EAExB,MAAM,kCAAkC,CAAC;AAG1C,MAAM,WAAW,8BAA8B;IAC7C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAC,CAAC;CACrE;AAED,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,CA2BxE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ForgotPasswordFormWrapper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
6
|
+
const ForgotPasswordForm_1 = require("../components/ForgotPasswordForm");
|
|
7
|
+
const contexts_1 = require("../contexts");
|
|
8
|
+
const ForgotPasswordFormWrapper = ({ onSuccess, componentProps = {}, }) => {
|
|
9
|
+
const { baseUrl } = (0, contexts_1.useSuiteConfig)();
|
|
10
|
+
const handleSubmit = async (values) => {
|
|
11
|
+
const res = await fetch(`${baseUrl}/user/forgot-password`, {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
headers: { 'Content-Type': 'application/json' },
|
|
14
|
+
body: JSON.stringify({ email: values.email }),
|
|
15
|
+
});
|
|
16
|
+
if (!res.ok) {
|
|
17
|
+
const body = await res.json().catch(() => ({}));
|
|
18
|
+
if (body.message) {
|
|
19
|
+
throw new Error(body.message);
|
|
20
|
+
}
|
|
21
|
+
throw new suite_core_lib_1.TranslatableSuiteError(suite_core_lib_1.SuiteCoreStringKey.ForgotPassword_Error);
|
|
22
|
+
}
|
|
23
|
+
if (onSuccess) {
|
|
24
|
+
onSuccess();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return (0, jsx_runtime_1.jsx)(ForgotPasswordForm_1.ForgotPasswordForm, { onSubmit: handleSubmit, ...componentProps });
|
|
28
|
+
};
|
|
29
|
+
exports.ForgotPasswordFormWrapper = ForgotPasswordFormWrapper;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { IRequestUserDTO } from '@digitaldefiance/suite-core-lib';
|
|
3
|
+
import { LoginFormProps } from '../components/LoginForm';
|
|
4
|
+
export interface LoginFormWrapperProps {
|
|
5
|
+
onSuccess?: () => void;
|
|
6
|
+
redirectTo?: string;
|
|
7
|
+
componentProps?: Partial<Omit<LoginFormProps, 'onSubmit'>>;
|
|
8
|
+
/**
|
|
9
|
+
* Called when the user submits a TOTP verification code during login.
|
|
10
|
+
* Typically wired to `AuthService.verifyTotpLogin(pendingTotpToken, code)`.
|
|
11
|
+
* When not provided, the wrapper cannot complete TOTP-protected logins.
|
|
12
|
+
*/
|
|
13
|
+
onVerifyTotp?: (code: string, pendingTotpToken: string) => Promise<{
|
|
14
|
+
token: string;
|
|
15
|
+
user: IRequestUserDTO;
|
|
16
|
+
} | {
|
|
17
|
+
error: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export declare const LoginFormWrapper: FC<LoginFormWrapperProps>;
|
|
21
|
+
//# sourceMappingURL=LoginFormWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoginFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/LoginFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAGrC,OAAO,EAAE,eAAe,EAA8C,MAAM,iCAAiC,CAAC;AAC9G,OAAO,EAA8B,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAIrF,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;IAC3D;;;;OAIG;IACH,YAAY,CAAC,EAAE,CACb,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,MAAM,KACrB,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5E;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAoFtD,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoginFormWrapper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_router_1 = require("react-router");
|
|
7
|
+
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
8
|
+
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
9
|
+
const LoginForm_1 = require("../components/LoginForm");
|
|
10
|
+
const TotpVerificationForm_1 = require("../components/TotpVerificationForm");
|
|
11
|
+
const contexts_1 = require("../contexts");
|
|
12
|
+
const LoginFormWrapper = ({ onSuccess, redirectTo, componentProps = {}, onVerifyTotp, }) => {
|
|
13
|
+
const { directLogin, passwordLogin, verifyTotpLogin, setUser } = (0, contexts_1.useAuth)();
|
|
14
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
15
|
+
const { routes } = (0, contexts_1.useSuiteConfig)();
|
|
16
|
+
const [pendingTotpToken, setPendingTotpToken] = (0, react_1.useState)(null);
|
|
17
|
+
const handleLoginSuccess = () => {
|
|
18
|
+
if (onSuccess) {
|
|
19
|
+
onSuccess();
|
|
20
|
+
}
|
|
21
|
+
navigate(redirectTo || routes.dashboard || '/dashboard');
|
|
22
|
+
};
|
|
23
|
+
const handleSubmit = async (values) => {
|
|
24
|
+
const email = values.email && values.email.trim().length > 0 ? new ecies_lib_1.EmailString(values.email) : undefined;
|
|
25
|
+
const username = values.username && values.username.trim() ? values.username : undefined;
|
|
26
|
+
if (values.password) {
|
|
27
|
+
const result = await passwordLogin(new ecies_lib_1.SecureString(values.password), username, email);
|
|
28
|
+
if ('error' in result) {
|
|
29
|
+
throw new Error(result.error);
|
|
30
|
+
}
|
|
31
|
+
if ('pendingTotpToken' in result) {
|
|
32
|
+
setPendingTotpToken(result.pendingTotpToken);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
handleLoginSuccess();
|
|
36
|
+
}
|
|
37
|
+
else if (values.mnemonic) {
|
|
38
|
+
const result = await directLogin(new ecies_lib_1.SecureString(values.mnemonic), username, email);
|
|
39
|
+
if ('error' in result) {
|
|
40
|
+
throw new Error(result.error);
|
|
41
|
+
}
|
|
42
|
+
if ('pendingTotpToken' in result) {
|
|
43
|
+
setPendingTotpToken(result.pendingTotpToken);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
handleLoginSuccess();
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
throw new suite_core_lib_1.TranslatableSuiteError(suite_core_lib_1.SuiteCoreStringKey.Error_NoPasswordOrMnemonicProvided);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const handleTotpSubmit = async (code, token) => {
|
|
53
|
+
// Use the explicitly provided callback, or fall back to verifyTotpLogin from AuthContext
|
|
54
|
+
const verifyFn = onVerifyTotp ?? ((c, t) => verifyTotpLogin(t, c));
|
|
55
|
+
const result = await verifyFn(code, token);
|
|
56
|
+
if ('error' in result) {
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
// Store the full JWT and complete the login flow
|
|
60
|
+
localStorage.setItem('authToken', result.token);
|
|
61
|
+
localStorage.setItem('user', JSON.stringify(result.user));
|
|
62
|
+
// Update auth context so PrivateRoute guards see the user as authenticated
|
|
63
|
+
await setUser(result.user);
|
|
64
|
+
handleLoginSuccess();
|
|
65
|
+
return result;
|
|
66
|
+
};
|
|
67
|
+
if (pendingTotpToken) {
|
|
68
|
+
return ((0, jsx_runtime_1.jsx)(TotpVerificationForm_1.TotpVerificationForm, { pendingTotpToken: pendingTotpToken, onSubmit: handleTotpSubmit }));
|
|
69
|
+
}
|
|
70
|
+
return (0, jsx_runtime_1.jsx)(LoginForm_1.LoginForm, { onSubmit: handleSubmit, ...componentProps });
|
|
71
|
+
};
|
|
72
|
+
exports.LoginFormWrapper = LoginFormWrapper;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { LogoutPage } from '../components/LogoutPage';
|
|
3
|
+
export interface LogoutPageWrapperProps {
|
|
4
|
+
onSuccess?: () => void;
|
|
5
|
+
redirectTo?: string;
|
|
6
|
+
componentProps?: Partial<React.ComponentProps<typeof LogoutPage>>;
|
|
7
|
+
}
|
|
8
|
+
export declare const LogoutPageWrapper: FC<LogoutPageWrapperProps>;
|
|
9
|
+
//# sourceMappingURL=LogoutPageWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogoutPageWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/LogoutPageWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAkBxD,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogoutPageWrapper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_router_1 = require("react-router");
|
|
6
|
+
const LogoutPage_1 = require("../components/LogoutPage");
|
|
7
|
+
const contexts_1 = require("../contexts");
|
|
8
|
+
const LogoutPageWrapper = ({ onSuccess, redirectTo, componentProps = {}, }) => {
|
|
9
|
+
const { logout } = (0, contexts_1.useAuth)();
|
|
10
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
11
|
+
const { routes } = (0, contexts_1.useSuiteConfig)();
|
|
12
|
+
const handleLogout = async () => {
|
|
13
|
+
await logout();
|
|
14
|
+
if (onSuccess) {
|
|
15
|
+
onSuccess();
|
|
16
|
+
}
|
|
17
|
+
navigate(redirectTo || routes.login || '/login');
|
|
18
|
+
};
|
|
19
|
+
return (0, jsx_runtime_1.jsx)(LogoutPage_1.LogoutPage, { onLogout: handleLogout, onNavigate: navigate, ...componentProps });
|
|
20
|
+
};
|
|
21
|
+
exports.LogoutPageWrapper = LogoutPageWrapper;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { RegisterFormProps } from '../components/RegisterForm';
|
|
3
|
+
export interface RegisterFormWrapperProps {
|
|
4
|
+
onSuccess?: () => void;
|
|
5
|
+
/**
|
|
6
|
+
* When true, offer the TOTP setup step after successful registration.
|
|
7
|
+
* Typically sourced from window.APP_CONFIG.totpAvailable.
|
|
8
|
+
* Defaults to false.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This requires the registration endpoint to return a session token
|
|
11
|
+
* so the user is authenticated when the TOTP setup call is made. If
|
|
12
|
+
* registration does not issue a token (the default in this suite), leave
|
|
13
|
+
* this false and direct users to enable TOTP from their settings page
|
|
14
|
+
* after logging in.
|
|
15
|
+
*/
|
|
16
|
+
enableTotpSetup?: boolean;
|
|
17
|
+
componentProps?: Partial<Omit<RegisterFormProps, 'onSubmit' | 'timezones' | 'getInitialTimezone'>>;
|
|
18
|
+
}
|
|
19
|
+
export declare const RegisterFormWrapper: FC<RegisterFormWrapperProps>;
|
|
20
|
+
//# sourceMappingURL=RegisterFormWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegisterFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/RegisterFormWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAEL,iBAAiB,EAElB,MAAM,4BAA4B,CAAC;AAGpC,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CACtB,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,WAAW,GAAG,oBAAoB,CAAC,CACzE,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAgF5D,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegisterFormWrapper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
6
|
+
const RegisterForm_1 = require("../components/RegisterForm");
|
|
7
|
+
const contexts_1 = require("../contexts");
|
|
8
|
+
const RegisterFormWrapper = ({ onSuccess, enableTotpSetup = false, componentProps = {}, }) => {
|
|
9
|
+
const { register, setUpBrowserPasswordLogin, setupTotp, confirmTotp } = (0, contexts_1.useAuth)();
|
|
10
|
+
const { timezones } = (0, contexts_1.useSuiteConfig)();
|
|
11
|
+
const handleSubmit = async (values, usePassword) => {
|
|
12
|
+
const result = await register(values.username, values.email, values.timezone || 'UTC', values.password, values.mnemonic, values.displayName, values.directChallenge);
|
|
13
|
+
if ('error' in result) {
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
// After successful registration with a password, set up the browser-side
|
|
17
|
+
// password login bundle (encrypts mnemonic with password and stores in localStorage).
|
|
18
|
+
// This is required for subsequent password-based logins to work.
|
|
19
|
+
if (usePassword && values.password && result.mnemonic) {
|
|
20
|
+
const setupResult = await setUpBrowserPasswordLogin(new ecies_lib_1.SecureString(result.mnemonic), new ecies_lib_1.SecureString(values.password));
|
|
21
|
+
if ('error' in setupResult) {
|
|
22
|
+
// Password login setup failed — still return success for registration
|
|
23
|
+
// but log the issue. The user can set up password login later.
|
|
24
|
+
console.warn('Registration succeeded but browser password login setup failed:', setupResult.error);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (onSuccess) {
|
|
28
|
+
onSuccess();
|
|
29
|
+
}
|
|
30
|
+
// Don't navigate away — let RegisterForm show the success message
|
|
31
|
+
// (mnemonic grid or email verification notice). The user navigates
|
|
32
|
+
// manually via the "Proceed to login" / "I Have Saved My Recovery
|
|
33
|
+
// Phrase" button.
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
const defaultTimezones = timezones || [
|
|
37
|
+
'UTC',
|
|
38
|
+
'America/New_York',
|
|
39
|
+
'America/Los_Angeles',
|
|
40
|
+
'Europe/London',
|
|
41
|
+
];
|
|
42
|
+
const totpProps = enableTotpSetup
|
|
43
|
+
? {
|
|
44
|
+
enableTotpSetup: true,
|
|
45
|
+
onTotpSetup: setupTotp,
|
|
46
|
+
onTotpConfirm: confirmTotp,
|
|
47
|
+
}
|
|
48
|
+
: {};
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(RegisterForm_1.RegisterForm, { onSubmit: handleSubmit, timezones: defaultTimezones, getInitialTimezone: () => Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC', ...totpProps, ...componentProps }));
|
|
50
|
+
};
|
|
51
|
+
exports.RegisterFormWrapper = RegisterFormWrapper;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ResetPasswordFormProps } from '../components/ResetPasswordForm';
|
|
3
|
+
export interface ResetPasswordFormWrapperProps {
|
|
4
|
+
onSuccess?: () => void;
|
|
5
|
+
redirectTo?: string;
|
|
6
|
+
componentProps?: Partial<Omit<ResetPasswordFormProps, 'onSubmit' | 'token'>>;
|
|
7
|
+
}
|
|
8
|
+
export declare const ResetPasswordFormWrapper: FC<ResetPasswordFormWrapperProps>;
|
|
9
|
+
//# sourceMappingURL=ResetPasswordFormWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResetPasswordFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/ResetPasswordFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAM3B,OAAO,EAEL,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AAGzC,MAAM,WAAW,6BAA6B;IAC5C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC;CAC9E;AAED,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC,6BAA6B,CAsCtE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResetPasswordFormWrapper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_router_1 = require("react-router");
|
|
6
|
+
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
7
|
+
const ResetPasswordForm_1 = require("../components/ResetPasswordForm");
|
|
8
|
+
const contexts_1 = require("../contexts");
|
|
9
|
+
const ResetPasswordFormWrapper = ({ onSuccess, redirectTo, componentProps = {}, }) => {
|
|
10
|
+
const { baseUrl, routes } = (0, contexts_1.useSuiteConfig)();
|
|
11
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
12
|
+
const [searchParams] = (0, react_router_1.useSearchParams)();
|
|
13
|
+
const token = searchParams.get('token');
|
|
14
|
+
const handleSubmit = async (resetToken, password) => {
|
|
15
|
+
const res = await fetch(`${baseUrl}/user/reset-password`, {
|
|
16
|
+
method: 'POST',
|
|
17
|
+
headers: { 'Content-Type': 'application/json' },
|
|
18
|
+
body: JSON.stringify({ token: resetToken, password }),
|
|
19
|
+
});
|
|
20
|
+
if (!res.ok) {
|
|
21
|
+
const body = await res.json().catch(() => ({}));
|
|
22
|
+
if (body.message) {
|
|
23
|
+
throw new Error(body.message);
|
|
24
|
+
}
|
|
25
|
+
throw new suite_core_lib_1.TranslatableSuiteError(suite_core_lib_1.SuiteCoreStringKey.Error_PasswordChange);
|
|
26
|
+
}
|
|
27
|
+
if (onSuccess) {
|
|
28
|
+
onSuccess();
|
|
29
|
+
}
|
|
30
|
+
navigate(redirectTo || routes.login || '/login');
|
|
31
|
+
};
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(ResetPasswordForm_1.ResetPasswordForm, { token: token, onSubmit: handleSubmit, ...componentProps }));
|
|
33
|
+
};
|
|
34
|
+
exports.ResetPasswordFormWrapper = ResetPasswordFormWrapper;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { UserSettingsFormProps } from '../components/UserSettingsForm';
|
|
3
|
+
import { IConstants } from '@digitaldefiance/suite-core-lib';
|
|
4
|
+
import { IECIESConfig } from '@digitaldefiance/ecies-lib';
|
|
5
|
+
export interface UserSettingsFormWrapperProps {
|
|
6
|
+
onSuccess?: () => void;
|
|
7
|
+
/**
|
|
8
|
+
* Constants for AuthService (required for TOTP methods).
|
|
9
|
+
* If not provided, TOTP callbacks will not be wired up.
|
|
10
|
+
*/
|
|
11
|
+
constants?: IConstants;
|
|
12
|
+
/**
|
|
13
|
+
* ECIES config for AuthService (required for TOTP methods).
|
|
14
|
+
* If not provided, TOTP callbacks will not be wired up.
|
|
15
|
+
*/
|
|
16
|
+
eciesConfig?: IECIESConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Email domain for AuthService (required for TOTP methods).
|
|
19
|
+
*/
|
|
20
|
+
emailDomain?: string;
|
|
21
|
+
/**
|
|
22
|
+
* When false (default), TOTP management controls are not shown.
|
|
23
|
+
* Set to true when TOTP_AVAILABLE is enabled in the server environment.
|
|
24
|
+
*/
|
|
25
|
+
totpAvailable?: boolean;
|
|
26
|
+
componentProps?: Partial<Omit<UserSettingsFormProps, 'initialValues' | 'onSubmit' | 'languages'>>;
|
|
27
|
+
}
|
|
28
|
+
export declare const UserSettingsFormWrapper: FC<UserSettingsFormWrapperProps>;
|
|
29
|
+
//# sourceMappingURL=UserSettingsFormWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserSettingsFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/UserSettingsFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA6C,MAAM,OAAO,CAAC;AACtE,OAAO,EAA4C,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAGjH,OAAO,EAA2B,UAAU,EAAsB,MAAM,iCAAiC,CAAC;AAG1G,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,WAAW,4BAA4B;IAC3C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,eAAe,GAAG,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC;CACnG;AAED,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CA0GpE,CAAC"}
|