@abpjs/account 2.4.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AuthWrapper/AuthWrapper.d.ts +4 -0
- package/dist/components/LoginForm/LoginForm.d.ts +4 -0
- package/dist/components/ManageProfile/ManageProfile.d.ts +5 -0
- package/dist/components/RegisterForm/RegisterForm.d.ts +4 -0
- package/dist/components/TenantBox/TenantBox.d.ts +5 -0
- package/dist/enums/components.d.ts +52 -0
- package/dist/enums/index.d.ts +7 -0
- package/dist/enums/route-names.d.ts +40 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +93 -23
- package/dist/index.mjs +91 -23
- package/dist/models/index.d.ts +7 -0
- package/package.json +4 -4
|
@@ -50,6 +50,7 @@ export interface AuthWrapperProps {
|
|
|
50
50
|
* @since 1.1.0
|
|
51
51
|
* @since 2.0.0 - Added enableLocalLogin prop to control local login visibility
|
|
52
52
|
* @since 2.4.0 - Added isMultiTenancyEnabled prop (equivalent to Angular's isMultiTenancyEnabled$)
|
|
53
|
+
* @since 2.7.0 - Added tenantBoxKey static property for component replacement system
|
|
53
54
|
*
|
|
54
55
|
* @example
|
|
55
56
|
* ```tsx
|
|
@@ -61,4 +62,7 @@ export interface AuthWrapperProps {
|
|
|
61
62
|
* ```
|
|
62
63
|
*/
|
|
63
64
|
export declare function AuthWrapper({ children, mainContent, cancelContent, enableLocalLogin, isMultiTenancyEnabled, }: AuthWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
export declare namespace AuthWrapper {
|
|
66
|
+
var tenantBoxKey: "Account.TenantBoxComponent";
|
|
67
|
+
}
|
|
64
68
|
export default AuthWrapper;
|
|
@@ -33,6 +33,7 @@ export interface LoginFormProps {
|
|
|
33
33
|
* It handles user authentication using OAuth password flow.
|
|
34
34
|
*
|
|
35
35
|
* @since 2.0.0 - Added isSelfRegistrationEnabled check from ABP settings
|
|
36
|
+
* @since 2.7.0 - Added authWrapperKey static property for component replacement system
|
|
36
37
|
*
|
|
37
38
|
* @example
|
|
38
39
|
* ```tsx
|
|
@@ -47,4 +48,7 @@ export interface LoginFormProps {
|
|
|
47
48
|
* ```
|
|
48
49
|
*/
|
|
49
50
|
export declare function LoginForm({ showTenantBox, showRegisterLink, registerUrl, onLoginSuccess, onLoginError, }: LoginFormProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export declare namespace LoginForm {
|
|
52
|
+
var authWrapperKey: "Account.AuthWrapperComponent";
|
|
53
|
+
}
|
|
50
54
|
export default LoginForm;
|
|
@@ -33,6 +33,7 @@ export interface ManageProfileProps {
|
|
|
33
33
|
* including personal information and password change.
|
|
34
34
|
*
|
|
35
35
|
* @since 1.1.0
|
|
36
|
+
* @since 2.7.0 - Added changePasswordKey and personalSettingsKey static properties for component replacement system
|
|
36
37
|
*
|
|
37
38
|
* @example
|
|
38
39
|
* ```tsx
|
|
@@ -43,4 +44,8 @@ export interface ManageProfileProps {
|
|
|
43
44
|
* ```
|
|
44
45
|
*/
|
|
45
46
|
export declare function ManageProfile({ defaultTabIndex, onTabChange, customTabs, }: ManageProfileProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare namespace ManageProfile {
|
|
48
|
+
var changePasswordKey: "Account.ChangePasswordComponent";
|
|
49
|
+
var personalSettingsKey: "Account.PersonalSettingsComponent";
|
|
50
|
+
}
|
|
46
51
|
export default ManageProfile;
|
|
@@ -36,6 +36,7 @@ export interface RegisterFormProps {
|
|
|
36
36
|
*
|
|
37
37
|
* @since 0.9.0 - Now uses AccountService for registration
|
|
38
38
|
* @since 2.0.0 - Added isSelfRegistrationEnabled check from ABP settings
|
|
39
|
+
* @since 2.7.0 - Added authWrapperKey static property for component replacement system
|
|
39
40
|
*
|
|
40
41
|
* @example
|
|
41
42
|
* ```tsx
|
|
@@ -50,4 +51,7 @@ export interface RegisterFormProps {
|
|
|
50
51
|
* ```
|
|
51
52
|
*/
|
|
52
53
|
export declare function RegisterForm({ showTenantBox, showLoginLink, loginUrl, onRegisterSuccess, onRegisterError, }: RegisterFormProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export declare namespace RegisterForm {
|
|
55
|
+
var authWrapperKey: "Account.AuthWrapperComponent";
|
|
56
|
+
}
|
|
53
57
|
export default RegisterForm;
|
|
@@ -18,6 +18,11 @@ export interface TenantBoxProps {
|
|
|
18
18
|
* and properly updates the session state.
|
|
19
19
|
*
|
|
20
20
|
* @since 0.9.0 - Now uses AccountService for tenant lookup
|
|
21
|
+
* @since 2.7.0 - Renamed internal properties (name, modalBusy) to match Angular v2.7.0
|
|
22
|
+
* Uses TenantIdResponse.name from API when available
|
|
21
23
|
*/
|
|
22
24
|
export declare function TenantBox({ containerStyle }: TenantBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare namespace TenantBox {
|
|
26
|
+
var componentKey: "Account.TenantBoxComponent";
|
|
27
|
+
}
|
|
23
28
|
export default TenantBox;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account component keys for component replacement system
|
|
3
|
+
*
|
|
4
|
+
* These keys are used by ABP's component replacement system to allow
|
|
5
|
+
* customization of account module components.
|
|
6
|
+
*
|
|
7
|
+
* Translated from @abp/ng.account v2.7.0 eAccountComponents enum.
|
|
8
|
+
*
|
|
9
|
+
* @since 2.7.0
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { eAccountComponents } from '@abpjs/account';
|
|
14
|
+
*
|
|
15
|
+
* // Use in component replacement
|
|
16
|
+
* const key = eAccountComponents.Login;
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const eAccountComponents: {
|
|
20
|
+
/**
|
|
21
|
+
* Key for the Login component
|
|
22
|
+
*/
|
|
23
|
+
readonly Login: "Account.LoginComponent";
|
|
24
|
+
/**
|
|
25
|
+
* Key for the Register component
|
|
26
|
+
*/
|
|
27
|
+
readonly Register: "Account.RegisterComponent";
|
|
28
|
+
/**
|
|
29
|
+
* Key for the ManageProfile component
|
|
30
|
+
*/
|
|
31
|
+
readonly ManageProfile: "Account.ManageProfileComponent";
|
|
32
|
+
/**
|
|
33
|
+
* Key for the TenantBox component
|
|
34
|
+
*/
|
|
35
|
+
readonly TenantBox: "Account.TenantBoxComponent";
|
|
36
|
+
/**
|
|
37
|
+
* Key for the AuthWrapper component
|
|
38
|
+
*/
|
|
39
|
+
readonly AuthWrapper: "Account.AuthWrapperComponent";
|
|
40
|
+
/**
|
|
41
|
+
* Key for the ChangePassword component
|
|
42
|
+
*/
|
|
43
|
+
readonly ChangePassword: "Account.ChangePasswordComponent";
|
|
44
|
+
/**
|
|
45
|
+
* Key for the PersonalSettings component
|
|
46
|
+
*/
|
|
47
|
+
readonly PersonalSettings: "Account.PersonalSettingsComponent";
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Type for eAccountComponents values
|
|
51
|
+
*/
|
|
52
|
+
export type eAccountComponents = (typeof eAccountComponents)[keyof typeof eAccountComponents];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account route names for navigation
|
|
3
|
+
*
|
|
4
|
+
* These constants represent localization keys for account route names
|
|
5
|
+
* in the ABP Framework navigation system.
|
|
6
|
+
*
|
|
7
|
+
* Translated from @abp/ng.account v2.7.0 eAccountRouteNames enum.
|
|
8
|
+
*
|
|
9
|
+
* @since 2.7.0
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { eAccountRouteNames } from '@abpjs/account';
|
|
14
|
+
*
|
|
15
|
+
* // Use in route configuration
|
|
16
|
+
* const routeName = eAccountRouteNames.Login;
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const eAccountRouteNames: {
|
|
20
|
+
/**
|
|
21
|
+
* Route name for Account menu
|
|
22
|
+
*/
|
|
23
|
+
readonly Account: "AbpAccount::Menu:Account";
|
|
24
|
+
/**
|
|
25
|
+
* Route name for Login page
|
|
26
|
+
*/
|
|
27
|
+
readonly Login: "AbpAccount::Login";
|
|
28
|
+
/**
|
|
29
|
+
* Route name for Register page
|
|
30
|
+
*/
|
|
31
|
+
readonly Register: "AbpAccount::Register";
|
|
32
|
+
/**
|
|
33
|
+
* Route name for Manage Profile page
|
|
34
|
+
*/
|
|
35
|
+
readonly ManageProfile: "AbpAccount::ManageYourProfile";
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Type for eAccountRouteNames values
|
|
39
|
+
*/
|
|
40
|
+
export type eAccountRouteNames = (typeof eAccountRouteNames)[keyof typeof eAccountRouteNames];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @abpjs/account
|
|
3
3
|
* ABP Framework Account module for React
|
|
4
|
-
* Translated from @abp/ng.account v2.
|
|
4
|
+
* Translated from @abp/ng.account v2.9.0
|
|
5
|
+
*
|
|
6
|
+
* Changes in v2.9.0:
|
|
7
|
+
* - Version bump only (dependency updates to @abp/ng.theme.shared v2.9.0)
|
|
8
|
+
* - No functional code changes
|
|
9
|
+
*
|
|
10
|
+
* Changes in v2.7.0:
|
|
11
|
+
* - Added eAccountComponents enum for component replacement system
|
|
12
|
+
* - Added eAccountRouteNames enum for route names
|
|
13
|
+
* - TenantIdResponse: Added name property
|
|
14
|
+
* - TenantBoxComponent: Refactored with new naming (name, modalBusy)
|
|
15
|
+
* - Components now have component keys for replacement system
|
|
5
16
|
*
|
|
6
17
|
* Changes in v2.4.0:
|
|
7
18
|
* - AuthWrapperComponent: Added isMultiTenancyEnabled prop (equivalent to Angular's isMultiTenancyEnabled$)
|
|
@@ -12,7 +23,7 @@
|
|
|
12
23
|
* - Dependency updates to @abp/ng.theme.shared v2.2.0 and @abp/ng.account.config v2.2.0
|
|
13
24
|
* - No functional code changes
|
|
14
25
|
*
|
|
15
|
-
* @version 2.
|
|
26
|
+
* @version 2.9.0
|
|
16
27
|
* @since 2.0.0 - Added Account namespace with component interface types
|
|
17
28
|
* @since 2.0.0 - Added isSelfRegistrationEnabled support in Login/Register components
|
|
18
29
|
* @since 2.0.0 - Added enableLocalLogin support in AuthWrapper component
|
|
@@ -20,7 +31,11 @@
|
|
|
20
31
|
* @since 2.0.0 - TenantBoxComponent and AccountService now publicly exported
|
|
21
32
|
* @since 2.1.0 - Version bump only (dependency updates to @abp/ng.theme.shared v2.1.0)
|
|
22
33
|
* @since 2.4.0 - AuthWrapper: isMultiTenancyEnabled prop; AccountService: apiName property
|
|
34
|
+
* @since 2.7.0 - Added eAccountComponents and eAccountRouteNames enums
|
|
35
|
+
* @since 2.7.0 - Components have static keys for component replacement system
|
|
36
|
+
* @since 2.9.0 - Version bump only (dependency updates)
|
|
23
37
|
*/
|
|
38
|
+
export * from './enums';
|
|
24
39
|
export * from './models';
|
|
25
40
|
export * from './services';
|
|
26
41
|
export * from './providers';
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,8 @@ __export(index_exports, {
|
|
|
33
33
|
RegisterForm: () => RegisterForm,
|
|
34
34
|
RegisterPage: () => RegisterPage,
|
|
35
35
|
TenantBox: () => TenantBox,
|
|
36
|
+
eAccountComponents: () => eAccountComponents,
|
|
37
|
+
eAccountRouteNames: () => eAccountRouteNames,
|
|
36
38
|
useAccountContext: () => useAccountContext,
|
|
37
39
|
useAccountOptions: () => useAccountOptions,
|
|
38
40
|
useAccountService: () => useAccountService,
|
|
@@ -41,6 +43,58 @@ __export(index_exports, {
|
|
|
41
43
|
});
|
|
42
44
|
module.exports = __toCommonJS(index_exports);
|
|
43
45
|
|
|
46
|
+
// src/enums/components.ts
|
|
47
|
+
var eAccountComponents = {
|
|
48
|
+
/**
|
|
49
|
+
* Key for the Login component
|
|
50
|
+
*/
|
|
51
|
+
Login: "Account.LoginComponent",
|
|
52
|
+
/**
|
|
53
|
+
* Key for the Register component
|
|
54
|
+
*/
|
|
55
|
+
Register: "Account.RegisterComponent",
|
|
56
|
+
/**
|
|
57
|
+
* Key for the ManageProfile component
|
|
58
|
+
*/
|
|
59
|
+
ManageProfile: "Account.ManageProfileComponent",
|
|
60
|
+
/**
|
|
61
|
+
* Key for the TenantBox component
|
|
62
|
+
*/
|
|
63
|
+
TenantBox: "Account.TenantBoxComponent",
|
|
64
|
+
/**
|
|
65
|
+
* Key for the AuthWrapper component
|
|
66
|
+
*/
|
|
67
|
+
AuthWrapper: "Account.AuthWrapperComponent",
|
|
68
|
+
/**
|
|
69
|
+
* Key for the ChangePassword component
|
|
70
|
+
*/
|
|
71
|
+
ChangePassword: "Account.ChangePasswordComponent",
|
|
72
|
+
/**
|
|
73
|
+
* Key for the PersonalSettings component
|
|
74
|
+
*/
|
|
75
|
+
PersonalSettings: "Account.PersonalSettingsComponent"
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/enums/route-names.ts
|
|
79
|
+
var eAccountRouteNames = {
|
|
80
|
+
/**
|
|
81
|
+
* Route name for Account menu
|
|
82
|
+
*/
|
|
83
|
+
Account: "AbpAccount::Menu:Account",
|
|
84
|
+
/**
|
|
85
|
+
* Route name for Login page
|
|
86
|
+
*/
|
|
87
|
+
Login: "AbpAccount::Login",
|
|
88
|
+
/**
|
|
89
|
+
* Route name for Register page
|
|
90
|
+
*/
|
|
91
|
+
Register: "AbpAccount::Register",
|
|
92
|
+
/**
|
|
93
|
+
* Route name for Manage Profile page
|
|
94
|
+
*/
|
|
95
|
+
ManageProfile: "AbpAccount::ManageYourProfile"
|
|
96
|
+
};
|
|
97
|
+
|
|
44
98
|
// src/services/account.service.ts
|
|
45
99
|
var AccountService = class {
|
|
46
100
|
constructor(rest) {
|
|
@@ -259,6 +313,7 @@ function AuthWrapper({
|
|
|
259
313
|
cancelContent && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react4.Box, { textAlign: "center", mt: 4, children: cancelContent })
|
|
260
314
|
] }) }) }) });
|
|
261
315
|
}
|
|
316
|
+
AuthWrapper.tenantBoxKey = eAccountComponents.TenantBox;
|
|
262
317
|
|
|
263
318
|
// src/components/ChangePasswordForm/ChangePasswordForm.tsx
|
|
264
319
|
var import_react5 = require("react");
|
|
@@ -416,47 +471,55 @@ function TenantBox({ containerStyle }) {
|
|
|
416
471
|
const accountService = useAccountService();
|
|
417
472
|
const toaster = (0, import_theme_shared2.useToaster)();
|
|
418
473
|
const currentTenant = (0, import_react_redux.useSelector)(import_core6.selectTenant);
|
|
419
|
-
const [
|
|
474
|
+
const [name, setName] = (0, import_react8.useState)("");
|
|
420
475
|
const [isModalVisible, setIsModalVisible] = (0, import_react8.useState)(false);
|
|
421
|
-
const [
|
|
476
|
+
const [modalBusy, setModalBusy] = (0, import_react8.useState)(false);
|
|
422
477
|
(0, import_react8.useEffect)(() => {
|
|
423
|
-
|
|
478
|
+
setName(currentTenant?.name || "");
|
|
424
479
|
}, [currentTenant]);
|
|
425
480
|
const onSwitch = (0, import_react8.useCallback)(() => {
|
|
426
481
|
setIsModalVisible(true);
|
|
427
482
|
}, []);
|
|
483
|
+
const setTenant = (0, import_react8.useCallback)(
|
|
484
|
+
(tenant) => {
|
|
485
|
+
dispatch(import_core6.sessionActions.setTenant(tenant));
|
|
486
|
+
},
|
|
487
|
+
[dispatch]
|
|
488
|
+
);
|
|
489
|
+
const showError = (0, import_react8.useCallback)(
|
|
490
|
+
(message) => {
|
|
491
|
+
toaster.error(message, t("AbpUi::Error") || "Error");
|
|
492
|
+
},
|
|
493
|
+
[toaster, t]
|
|
494
|
+
);
|
|
428
495
|
const save = (0, import_react8.useCallback)(async () => {
|
|
429
|
-
if (
|
|
430
|
-
|
|
496
|
+
if (name) {
|
|
497
|
+
setModalBusy(true);
|
|
431
498
|
try {
|
|
432
|
-
const { success, tenantId } = await accountService.findTenant(
|
|
499
|
+
const { success, tenantId, name: responseName } = await accountService.findTenant(name);
|
|
433
500
|
if (success) {
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
name: tenantName
|
|
437
|
-
};
|
|
438
|
-
dispatch(import_core6.sessionActions.setTenant(newTenant));
|
|
501
|
+
const tenantName = responseName || name;
|
|
502
|
+
setTenant({ id: tenantId, name: tenantName });
|
|
439
503
|
setIsModalVisible(false);
|
|
440
504
|
} else {
|
|
441
|
-
|
|
442
|
-
t("AbpUiMultiTenancy::GivenTenantIsNotAvailable",
|
|
443
|
-
t("AbpUi::Error") || "Error"
|
|
505
|
+
showError(
|
|
506
|
+
t("AbpUiMultiTenancy::GivenTenantIsNotAvailable", name) || `Tenant "${name}" is not available`
|
|
444
507
|
);
|
|
445
|
-
|
|
508
|
+
setName("");
|
|
446
509
|
}
|
|
447
510
|
} catch (err) {
|
|
448
511
|
const errorMessage = err?.error?.error_description || err?.error?.error?.message || t("AbpUi::DefaultErrorMessage") || "An error occurred";
|
|
449
|
-
|
|
512
|
+
showError(errorMessage);
|
|
450
513
|
} finally {
|
|
451
|
-
|
|
514
|
+
setModalBusy(false);
|
|
452
515
|
}
|
|
453
516
|
} else {
|
|
454
|
-
|
|
517
|
+
setTenant({ id: "", name: "" });
|
|
455
518
|
setIsModalVisible(false);
|
|
456
519
|
}
|
|
457
|
-
}, [
|
|
520
|
+
}, [name, accountService, setTenant, showError, t]);
|
|
458
521
|
const onClose = (0, import_react8.useCallback)(() => {
|
|
459
|
-
|
|
522
|
+
setName(currentTenant?.name || "");
|
|
460
523
|
setIsModalVisible(false);
|
|
461
524
|
}, [currentTenant]);
|
|
462
525
|
const handleSubmit = (0, import_react8.useCallback)(
|
|
@@ -515,7 +578,7 @@ function TenantBox({ containerStyle }) {
|
|
|
515
578
|
{
|
|
516
579
|
colorPalette: "blue",
|
|
517
580
|
onClick: save,
|
|
518
|
-
loading:
|
|
581
|
+
loading: modalBusy,
|
|
519
582
|
loadingText: t("AbpTenantManagement::Save"),
|
|
520
583
|
children: [
|
|
521
584
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CheckIcon, {}),
|
|
@@ -532,8 +595,8 @@ function TenantBox({ containerStyle }) {
|
|
|
532
595
|
{
|
|
533
596
|
id: "tenant-name",
|
|
534
597
|
type: "text",
|
|
535
|
-
value:
|
|
536
|
-
onChange: (e) =>
|
|
598
|
+
value: name,
|
|
599
|
+
onChange: (e) => setName(e.target.value),
|
|
537
600
|
autoFocus: true
|
|
538
601
|
}
|
|
539
602
|
)
|
|
@@ -544,6 +607,7 @@ function TenantBox({ containerStyle }) {
|
|
|
544
607
|
)
|
|
545
608
|
] });
|
|
546
609
|
}
|
|
610
|
+
TenantBox.componentKey = eAccountComponents.TenantBox;
|
|
547
611
|
function CheckIcon() {
|
|
548
612
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
549
613
|
"svg",
|
|
@@ -659,6 +723,7 @@ function LoginForm({
|
|
|
659
723
|
] }) })
|
|
660
724
|
] }) }) }) });
|
|
661
725
|
}
|
|
726
|
+
LoginForm.authWrapperKey = eAccountComponents.AuthWrapper;
|
|
662
727
|
|
|
663
728
|
// src/components/ManageProfile/ManageProfile.tsx
|
|
664
729
|
var import_react15 = require("react");
|
|
@@ -868,6 +933,8 @@ function ManageProfile({
|
|
|
868
933
|
)
|
|
869
934
|
] }) }) });
|
|
870
935
|
}
|
|
936
|
+
ManageProfile.changePasswordKey = eAccountComponents.ChangePassword;
|
|
937
|
+
ManageProfile.personalSettingsKey = eAccountComponents.PersonalSettings;
|
|
871
938
|
|
|
872
939
|
// src/components/RegisterForm/RegisterForm.tsx
|
|
873
940
|
var import_react17 = require("react");
|
|
@@ -1047,6 +1114,7 @@ function RegisterForm({
|
|
|
1047
1114
|
] }) })
|
|
1048
1115
|
] }) }) }) });
|
|
1049
1116
|
}
|
|
1117
|
+
RegisterForm.authWrapperKey = eAccountComponents.AuthWrapper;
|
|
1050
1118
|
|
|
1051
1119
|
// src/pages/LoginPage.tsx
|
|
1052
1120
|
var import_react20 = require("@chakra-ui/react");
|
|
@@ -1089,6 +1157,8 @@ var ACCOUNT_PATHS = {
|
|
|
1089
1157
|
RegisterForm,
|
|
1090
1158
|
RegisterPage,
|
|
1091
1159
|
TenantBox,
|
|
1160
|
+
eAccountComponents,
|
|
1161
|
+
eAccountRouteNames,
|
|
1092
1162
|
useAccountContext,
|
|
1093
1163
|
useAccountOptions,
|
|
1094
1164
|
useAccountService,
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
+
// src/enums/components.ts
|
|
2
|
+
var eAccountComponents = {
|
|
3
|
+
/**
|
|
4
|
+
* Key for the Login component
|
|
5
|
+
*/
|
|
6
|
+
Login: "Account.LoginComponent",
|
|
7
|
+
/**
|
|
8
|
+
* Key for the Register component
|
|
9
|
+
*/
|
|
10
|
+
Register: "Account.RegisterComponent",
|
|
11
|
+
/**
|
|
12
|
+
* Key for the ManageProfile component
|
|
13
|
+
*/
|
|
14
|
+
ManageProfile: "Account.ManageProfileComponent",
|
|
15
|
+
/**
|
|
16
|
+
* Key for the TenantBox component
|
|
17
|
+
*/
|
|
18
|
+
TenantBox: "Account.TenantBoxComponent",
|
|
19
|
+
/**
|
|
20
|
+
* Key for the AuthWrapper component
|
|
21
|
+
*/
|
|
22
|
+
AuthWrapper: "Account.AuthWrapperComponent",
|
|
23
|
+
/**
|
|
24
|
+
* Key for the ChangePassword component
|
|
25
|
+
*/
|
|
26
|
+
ChangePassword: "Account.ChangePasswordComponent",
|
|
27
|
+
/**
|
|
28
|
+
* Key for the PersonalSettings component
|
|
29
|
+
*/
|
|
30
|
+
PersonalSettings: "Account.PersonalSettingsComponent"
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/enums/route-names.ts
|
|
34
|
+
var eAccountRouteNames = {
|
|
35
|
+
/**
|
|
36
|
+
* Route name for Account menu
|
|
37
|
+
*/
|
|
38
|
+
Account: "AbpAccount::Menu:Account",
|
|
39
|
+
/**
|
|
40
|
+
* Route name for Login page
|
|
41
|
+
*/
|
|
42
|
+
Login: "AbpAccount::Login",
|
|
43
|
+
/**
|
|
44
|
+
* Route name for Register page
|
|
45
|
+
*/
|
|
46
|
+
Register: "AbpAccount::Register",
|
|
47
|
+
/**
|
|
48
|
+
* Route name for Manage Profile page
|
|
49
|
+
*/
|
|
50
|
+
ManageProfile: "AbpAccount::ManageYourProfile"
|
|
51
|
+
};
|
|
52
|
+
|
|
1
53
|
// src/services/account.service.ts
|
|
2
54
|
var AccountService = class {
|
|
3
55
|
constructor(rest) {
|
|
@@ -216,6 +268,7 @@ function AuthWrapper({
|
|
|
216
268
|
cancelContent && /* @__PURE__ */ jsx2(Box, { textAlign: "center", mt: 4, children: cancelContent })
|
|
217
269
|
] }) }) }) });
|
|
218
270
|
}
|
|
271
|
+
AuthWrapper.tenantBoxKey = eAccountComponents.TenantBox;
|
|
219
272
|
|
|
220
273
|
// src/components/ChangePasswordForm/ChangePasswordForm.tsx
|
|
221
274
|
import { useState as useState2, useEffect } from "react";
|
|
@@ -373,47 +426,55 @@ function TenantBox({ containerStyle }) {
|
|
|
373
426
|
const accountService = useAccountService();
|
|
374
427
|
const toaster = useToaster2();
|
|
375
428
|
const currentTenant = useSelector(selectTenant);
|
|
376
|
-
const [
|
|
429
|
+
const [name, setName] = useState3("");
|
|
377
430
|
const [isModalVisible, setIsModalVisible] = useState3(false);
|
|
378
|
-
const [
|
|
431
|
+
const [modalBusy, setModalBusy] = useState3(false);
|
|
379
432
|
useEffect2(() => {
|
|
380
|
-
|
|
433
|
+
setName(currentTenant?.name || "");
|
|
381
434
|
}, [currentTenant]);
|
|
382
435
|
const onSwitch = useCallback2(() => {
|
|
383
436
|
setIsModalVisible(true);
|
|
384
437
|
}, []);
|
|
438
|
+
const setTenant = useCallback2(
|
|
439
|
+
(tenant) => {
|
|
440
|
+
dispatch(sessionActions.setTenant(tenant));
|
|
441
|
+
},
|
|
442
|
+
[dispatch]
|
|
443
|
+
);
|
|
444
|
+
const showError = useCallback2(
|
|
445
|
+
(message) => {
|
|
446
|
+
toaster.error(message, t("AbpUi::Error") || "Error");
|
|
447
|
+
},
|
|
448
|
+
[toaster, t]
|
|
449
|
+
);
|
|
385
450
|
const save = useCallback2(async () => {
|
|
386
|
-
if (
|
|
387
|
-
|
|
451
|
+
if (name) {
|
|
452
|
+
setModalBusy(true);
|
|
388
453
|
try {
|
|
389
|
-
const { success, tenantId } = await accountService.findTenant(
|
|
454
|
+
const { success, tenantId, name: responseName } = await accountService.findTenant(name);
|
|
390
455
|
if (success) {
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
name: tenantName
|
|
394
|
-
};
|
|
395
|
-
dispatch(sessionActions.setTenant(newTenant));
|
|
456
|
+
const tenantName = responseName || name;
|
|
457
|
+
setTenant({ id: tenantId, name: tenantName });
|
|
396
458
|
setIsModalVisible(false);
|
|
397
459
|
} else {
|
|
398
|
-
|
|
399
|
-
t("AbpUiMultiTenancy::GivenTenantIsNotAvailable",
|
|
400
|
-
t("AbpUi::Error") || "Error"
|
|
460
|
+
showError(
|
|
461
|
+
t("AbpUiMultiTenancy::GivenTenantIsNotAvailable", name) || `Tenant "${name}" is not available`
|
|
401
462
|
);
|
|
402
|
-
|
|
463
|
+
setName("");
|
|
403
464
|
}
|
|
404
465
|
} catch (err) {
|
|
405
466
|
const errorMessage = err?.error?.error_description || err?.error?.error?.message || t("AbpUi::DefaultErrorMessage") || "An error occurred";
|
|
406
|
-
|
|
467
|
+
showError(errorMessage);
|
|
407
468
|
} finally {
|
|
408
|
-
|
|
469
|
+
setModalBusy(false);
|
|
409
470
|
}
|
|
410
471
|
} else {
|
|
411
|
-
|
|
472
|
+
setTenant({ id: "", name: "" });
|
|
412
473
|
setIsModalVisible(false);
|
|
413
474
|
}
|
|
414
|
-
}, [
|
|
475
|
+
}, [name, accountService, setTenant, showError, t]);
|
|
415
476
|
const onClose = useCallback2(() => {
|
|
416
|
-
|
|
477
|
+
setName(currentTenant?.name || "");
|
|
417
478
|
setIsModalVisible(false);
|
|
418
479
|
}, [currentTenant]);
|
|
419
480
|
const handleSubmit = useCallback2(
|
|
@@ -472,7 +533,7 @@ function TenantBox({ containerStyle }) {
|
|
|
472
533
|
{
|
|
473
534
|
colorPalette: "blue",
|
|
474
535
|
onClick: save,
|
|
475
|
-
loading:
|
|
536
|
+
loading: modalBusy,
|
|
476
537
|
loadingText: t("AbpTenantManagement::Save"),
|
|
477
538
|
children: [
|
|
478
539
|
/* @__PURE__ */ jsx4(CheckIcon, {}),
|
|
@@ -489,8 +550,8 @@ function TenantBox({ containerStyle }) {
|
|
|
489
550
|
{
|
|
490
551
|
id: "tenant-name",
|
|
491
552
|
type: "text",
|
|
492
|
-
value:
|
|
493
|
-
onChange: (e) =>
|
|
553
|
+
value: name,
|
|
554
|
+
onChange: (e) => setName(e.target.value),
|
|
494
555
|
autoFocus: true
|
|
495
556
|
}
|
|
496
557
|
)
|
|
@@ -501,6 +562,7 @@ function TenantBox({ containerStyle }) {
|
|
|
501
562
|
)
|
|
502
563
|
] });
|
|
503
564
|
}
|
|
565
|
+
TenantBox.componentKey = eAccountComponents.TenantBox;
|
|
504
566
|
function CheckIcon() {
|
|
505
567
|
return /* @__PURE__ */ jsx4(
|
|
506
568
|
"svg",
|
|
@@ -624,6 +686,7 @@ function LoginForm({
|
|
|
624
686
|
] }) })
|
|
625
687
|
] }) }) }) });
|
|
626
688
|
}
|
|
689
|
+
LoginForm.authWrapperKey = eAccountComponents.AuthWrapper;
|
|
627
690
|
|
|
628
691
|
// src/components/ManageProfile/ManageProfile.tsx
|
|
629
692
|
import { useState as useState5 } from "react";
|
|
@@ -833,6 +896,8 @@ function ManageProfile({
|
|
|
833
896
|
)
|
|
834
897
|
] }) }) });
|
|
835
898
|
}
|
|
899
|
+
ManageProfile.changePasswordKey = eAccountComponents.ChangePassword;
|
|
900
|
+
ManageProfile.personalSettingsKey = eAccountComponents.PersonalSettings;
|
|
836
901
|
|
|
837
902
|
// src/components/RegisterForm/RegisterForm.tsx
|
|
838
903
|
import { useState as useState6, useEffect as useEffect4 } from "react";
|
|
@@ -1020,6 +1085,7 @@ function RegisterForm({
|
|
|
1020
1085
|
] }) })
|
|
1021
1086
|
] }) }) }) });
|
|
1022
1087
|
}
|
|
1088
|
+
RegisterForm.authWrapperKey = eAccountComponents.AuthWrapper;
|
|
1023
1089
|
|
|
1024
1090
|
// src/pages/LoginPage.tsx
|
|
1025
1091
|
import { Container as Container5, Center } from "@chakra-ui/react";
|
|
@@ -1061,6 +1127,8 @@ export {
|
|
|
1061
1127
|
RegisterForm,
|
|
1062
1128
|
RegisterPage,
|
|
1063
1129
|
TenantBox,
|
|
1130
|
+
eAccountComponents,
|
|
1131
|
+
eAccountRouteNames,
|
|
1064
1132
|
useAccountContext,
|
|
1065
1133
|
useAccountOptions,
|
|
1066
1134
|
useAccountService,
|
package/dist/models/index.d.ts
CHANGED
|
@@ -132,8 +132,15 @@ export interface RegisterResponse {
|
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
134
|
* Response from tenant lookup API
|
|
135
|
+
*
|
|
136
|
+
* @since 2.7.0 - Added name property
|
|
135
137
|
*/
|
|
136
138
|
export interface TenantIdResponse {
|
|
137
139
|
success: boolean;
|
|
138
140
|
tenantId: string;
|
|
141
|
+
/**
|
|
142
|
+
* The name of the tenant
|
|
143
|
+
* @since 2.7.0
|
|
144
|
+
*/
|
|
145
|
+
name?: string;
|
|
139
146
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abpjs/account",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "ABP Framework Account module for React - Translation of @abp/ng.account",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"react-redux": "^9.0.0",
|
|
54
54
|
"zod": "^3.22.0",
|
|
55
55
|
"react-icons": "^5.0.0",
|
|
56
|
-
"@abpjs/core": "2.
|
|
57
|
-
"@abpjs/theme-shared": "2.
|
|
56
|
+
"@abpjs/core": "2.9.0",
|
|
57
|
+
"@abpjs/theme-shared": "2.9.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@abp/ng.account": "2.
|
|
60
|
+
"@abp/ng.account": "2.9.0",
|
|
61
61
|
"@reduxjs/toolkit": "^2.0.0",
|
|
62
62
|
"@testing-library/jest-dom": "^6.4.0",
|
|
63
63
|
"@testing-library/react": "^14.2.0",
|