@abpjs/account 2.9.0 → 3.1.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 +1 -1
- package/dist/components/ChangePasswordForm/ChangePasswordForm.d.ts +13 -1
- package/dist/components/ManageProfile/ManageProfile.d.ts +13 -1
- package/dist/config/enums/index.d.ts +6 -0
- package/dist/{enums → config/enums}/route-names.d.ts +5 -1
- package/dist/config/index.d.ts +23 -0
- package/dist/config/providers/index.d.ts +6 -0
- package/dist/config/providers/route.provider.d.ts +55 -0
- package/dist/enums/index.d.ts +2 -1
- package/dist/guards/authentication-flow.guard.d.ts +121 -0
- package/dist/guards/index.d.ts +7 -0
- package/dist/index.d.ts +22 -2
- package/dist/index.js +226 -75
- package/dist/index.mjs +203 -59
- package/dist/models/index.d.ts +7 -14
- package/dist/utils/factory-utils.d.ts +29 -0
- package/dist/utils/index.d.ts +6 -0
- package/package.json +4 -4
|
@@ -61,7 +61,7 @@ export interface AuthWrapperProps {
|
|
|
61
61
|
* />
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
64
|
-
export declare function AuthWrapper({ children, mainContent, cancelContent, enableLocalLogin, isMultiTenancyEnabled, }: AuthWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
export declare function AuthWrapper({ children, mainContent, cancelContent, enableLocalLogin, isMultiTenancyEnabled: _isMultiTenancyEnabled, }: AuthWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
65
65
|
export declare namespace AuthWrapper {
|
|
66
66
|
var tenantBoxKey: "Account.TenantBoxComponent";
|
|
67
67
|
}
|
|
@@ -10,6 +10,14 @@ export interface ChangePasswordFormProps {
|
|
|
10
10
|
* Callback fired on password change error
|
|
11
11
|
*/
|
|
12
12
|
onError?: (error: string) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to hide the current password field.
|
|
15
|
+
* When undefined, this is automatically determined based on the user's profile.
|
|
16
|
+
* Users without a password (e.g., social login users) don't need to enter current password.
|
|
17
|
+
*
|
|
18
|
+
* @since 3.1.0
|
|
19
|
+
*/
|
|
20
|
+
hideCurrentPassword?: boolean;
|
|
13
21
|
}
|
|
14
22
|
/**
|
|
15
23
|
* ChangePasswordForm - Password change form component
|
|
@@ -18,6 +26,7 @@ export interface ChangePasswordFormProps {
|
|
|
18
26
|
* It provides a form for authenticated users to change their password.
|
|
19
27
|
*
|
|
20
28
|
* @since 1.1.0
|
|
29
|
+
* @since 3.1.0 - Added hideCurrentPassword prop for users without password (social login)
|
|
21
30
|
*
|
|
22
31
|
* @example
|
|
23
32
|
* ```tsx
|
|
@@ -25,7 +34,10 @@ export interface ChangePasswordFormProps {
|
|
|
25
34
|
* onSuccess={() => console.log('Password changed!')}
|
|
26
35
|
* onError={(err) => console.error(err)}
|
|
27
36
|
* />
|
|
37
|
+
*
|
|
38
|
+
* // For social login users (no current password needed)
|
|
39
|
+
* <ChangePasswordForm hideCurrentPassword={true} />
|
|
28
40
|
* ```
|
|
29
41
|
*/
|
|
30
|
-
export declare function ChangePasswordForm({ onSuccess, onError }: ChangePasswordFormProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function ChangePasswordForm({ onSuccess, onError, hideCurrentPassword: hideCurrentPasswordProp, }: ChangePasswordFormProps): import("react/jsx-runtime").JSX.Element;
|
|
31
43
|
export default ChangePasswordForm;
|
|
@@ -24,6 +24,14 @@ export interface ManageProfileProps {
|
|
|
24
24
|
* Custom tabs to add/replace default tabs
|
|
25
25
|
*/
|
|
26
26
|
customTabs?: ProfileTab[];
|
|
27
|
+
/**
|
|
28
|
+
* Whether to hide the change password tab.
|
|
29
|
+
* When undefined, this is automatically determined based on the user's profile.
|
|
30
|
+
* External users (social login) don't see the change password tab by default.
|
|
31
|
+
*
|
|
32
|
+
* @since 3.1.0
|
|
33
|
+
*/
|
|
34
|
+
hideChangePasswordTab?: boolean;
|
|
27
35
|
}
|
|
28
36
|
/**
|
|
29
37
|
* ManageProfile - User profile management component
|
|
@@ -34,6 +42,7 @@ export interface ManageProfileProps {
|
|
|
34
42
|
*
|
|
35
43
|
* @since 1.1.0
|
|
36
44
|
* @since 2.7.0 - Added changePasswordKey and personalSettingsKey static properties for component replacement system
|
|
45
|
+
* @since 3.1.0 - Added hideChangePasswordTab prop and loading state; external users don't see change password tab
|
|
37
46
|
*
|
|
38
47
|
* @example
|
|
39
48
|
* ```tsx
|
|
@@ -41,9 +50,12 @@ export interface ManageProfileProps {
|
|
|
41
50
|
* defaultTabIndex={0}
|
|
42
51
|
* onTabChange={(index) => console.log('Tab changed to', index)}
|
|
43
52
|
* />
|
|
53
|
+
*
|
|
54
|
+
* // Force hide change password tab
|
|
55
|
+
* <ManageProfile hideChangePasswordTab={true} />
|
|
44
56
|
* ```
|
|
45
57
|
*/
|
|
46
|
-
export declare function ManageProfile({ defaultTabIndex, onTabChange, customTabs, }: ManageProfileProps): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
export declare function ManageProfile({ defaultTabIndex, onTabChange, customTabs, hideChangePasswordTab: hideChangePasswordTabProp, }: ManageProfileProps): import("react/jsx-runtime").JSX.Element;
|
|
47
59
|
export declare namespace ManageProfile {
|
|
48
60
|
var changePasswordKey: "Account.ChangePasswordComponent";
|
|
49
61
|
var personalSettingsKey: "Account.PersonalSettingsComponent";
|
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
* These constants represent localization keys for account route names
|
|
5
5
|
* in the ABP Framework navigation system.
|
|
6
6
|
*
|
|
7
|
-
* Translated from @abp/ng.account
|
|
7
|
+
* Translated from @abp/ng.account/config v3.0.0 eAccountRouteNames enum.
|
|
8
|
+
*
|
|
9
|
+
* In v3.0.0, this enum was moved from lib/enums to config/enums
|
|
10
|
+
* to be part of the config subpackage.
|
|
8
11
|
*
|
|
9
12
|
* @since 2.7.0
|
|
13
|
+
* @moved 3.0.0 - Moved to config/enums
|
|
10
14
|
*
|
|
11
15
|
* @example
|
|
12
16
|
* ```tsx
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @abpjs/account config subpackage
|
|
3
|
+
*
|
|
4
|
+
* This subpackage contains configuration providers and enums for the account module.
|
|
5
|
+
* Translated from @abp/ng.account/config v3.0.0.
|
|
6
|
+
*
|
|
7
|
+
* @since 3.0.0
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import {
|
|
12
|
+
* configureRoutes,
|
|
13
|
+
* ACCOUNT_ROUTE_PROVIDERS,
|
|
14
|
+
* initializeAccountRoutes,
|
|
15
|
+
* eAccountRouteNames,
|
|
16
|
+
* } from '@abpjs/account';
|
|
17
|
+
*
|
|
18
|
+
* // Initialize account routes
|
|
19
|
+
* initializeAccountRoutes();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export * from './enums';
|
|
23
|
+
export * from './providers';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account route provider for ABP Framework route configuration
|
|
3
|
+
*
|
|
4
|
+
* This provider registers account-related routes with the ABP routing system.
|
|
5
|
+
* Translated from @abp/ng.account/config v3.0.0 ACCOUNT_ROUTE_PROVIDERS.
|
|
6
|
+
*
|
|
7
|
+
* @since 3.0.0
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { configureRoutes, ACCOUNT_ROUTE_PROVIDERS } from '@abpjs/account/config';
|
|
12
|
+
* import { getRoutesService } from '@abpjs/core';
|
|
13
|
+
*
|
|
14
|
+
* // Using the configureRoutes function directly
|
|
15
|
+
* const addRoutes = configureRoutes(getRoutesService());
|
|
16
|
+
* addRoutes();
|
|
17
|
+
*
|
|
18
|
+
* // Or use the initialization helper
|
|
19
|
+
* initializeAccountRoutes();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
import { RoutesService } from '@abpjs/core';
|
|
23
|
+
/**
|
|
24
|
+
* Configure account routes using the provided RoutesService
|
|
25
|
+
*
|
|
26
|
+
* @param routes - The RoutesService instance to add routes to
|
|
27
|
+
* @returns A function that adds the account routes when called
|
|
28
|
+
*/
|
|
29
|
+
export declare function configureRoutes(routes: RoutesService): () => void;
|
|
30
|
+
/**
|
|
31
|
+
* Account route providers configuration
|
|
32
|
+
*
|
|
33
|
+
* This is the React equivalent of Angular's ACCOUNT_ROUTE_PROVIDERS.
|
|
34
|
+
* It provides a configureRoutes function that can be used to set up routes.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ACCOUNT_ROUTE_PROVIDERS: {
|
|
37
|
+
/**
|
|
38
|
+
* Factory function to configure routes
|
|
39
|
+
*/
|
|
40
|
+
configureRoutes: typeof configureRoutes;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Initialize account routes using the default RoutesService
|
|
44
|
+
*
|
|
45
|
+
* Call this function during app initialization to register account routes.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* // In your app initialization
|
|
50
|
+
* import { initializeAccountRoutes } from '@abpjs/account/config';
|
|
51
|
+
*
|
|
52
|
+
* initializeAccountRoutes();
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function initializeAccountRoutes(): void;
|
package/dist/enums/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Account module enums
|
|
3
3
|
*
|
|
4
4
|
* @since 2.7.0
|
|
5
|
+
* @updated 3.0.0 - eAccountRouteNames moved to config/enums, re-exported here for compatibility
|
|
5
6
|
*/
|
|
6
7
|
export * from './components';
|
|
7
|
-
export
|
|
8
|
+
export { eAccountRouteNames } from '../config/enums/route-names';
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication Flow Guard
|
|
3
|
+
* Translated from @abp/ng.account v3.1.0
|
|
4
|
+
*
|
|
5
|
+
* A route guard that checks if the authentication flow is internal (password-based).
|
|
6
|
+
* If using external auth (SSO/OAuth), it initiates the login flow and blocks navigation.
|
|
7
|
+
*
|
|
8
|
+
* In Angular, this implements CanActivate interface.
|
|
9
|
+
* In React, this is a function that can be used with react-router loaders/guards.
|
|
10
|
+
*
|
|
11
|
+
* @since 3.1.0
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Authentication flow guard result
|
|
15
|
+
*/
|
|
16
|
+
export interface AuthenticationFlowGuardResult {
|
|
17
|
+
/**
|
|
18
|
+
* Whether navigation is allowed
|
|
19
|
+
*/
|
|
20
|
+
canActivate: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* If navigation is blocked, the reason why
|
|
23
|
+
*/
|
|
24
|
+
reason?: 'external_auth' | 'not_configured';
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Options for the authentication flow guard
|
|
28
|
+
*/
|
|
29
|
+
export interface AuthenticationFlowGuardOptions {
|
|
30
|
+
/**
|
|
31
|
+
* Whether internal authentication is being used.
|
|
32
|
+
* When true, the guard allows navigation.
|
|
33
|
+
* When false, the guard blocks navigation and initiates login.
|
|
34
|
+
*/
|
|
35
|
+
isInternalAuth: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Function to initiate the login flow for external auth
|
|
38
|
+
*/
|
|
39
|
+
initLogin: () => void | Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check if navigation should be allowed based on auth flow type
|
|
43
|
+
*
|
|
44
|
+
* @param options - The guard options
|
|
45
|
+
* @returns Whether navigation is allowed
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* // In a route loader
|
|
50
|
+
* export const loader = async () => {
|
|
51
|
+
* const result = authenticationFlowGuard({
|
|
52
|
+
* isInternalAuth: true, // or false for SSO
|
|
53
|
+
* initLogin: () => auth.login(),
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* if (!result.canActivate) {
|
|
57
|
+
* return redirect('/');
|
|
58
|
+
* }
|
|
59
|
+
*
|
|
60
|
+
* return null;
|
|
61
|
+
* };
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function authenticationFlowGuard(options: AuthenticationFlowGuardOptions): AuthenticationFlowGuardResult;
|
|
65
|
+
/**
|
|
66
|
+
* React hook version of AuthenticationFlowGuard
|
|
67
|
+
*
|
|
68
|
+
* This hook can be used in a route component to check auth flow
|
|
69
|
+
* and redirect if needed.
|
|
70
|
+
*
|
|
71
|
+
* @param options - The guard options
|
|
72
|
+
* @returns Whether navigation is allowed
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* function ProtectedRoute({ children }) {
|
|
77
|
+
* const auth = useAuth();
|
|
78
|
+
* const canActivate = useAuthenticationFlowGuard({
|
|
79
|
+
* isInternalAuth: true,
|
|
80
|
+
* initLogin: auth.login,
|
|
81
|
+
* });
|
|
82
|
+
*
|
|
83
|
+
* if (!canActivate) {
|
|
84
|
+
* return null; // Login redirect in progress
|
|
85
|
+
* }
|
|
86
|
+
*
|
|
87
|
+
* return children;
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare function useAuthenticationFlowGuard(options: AuthenticationFlowGuardOptions): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Class-based AuthenticationFlowGuard for Angular-like usage patterns
|
|
94
|
+
*
|
|
95
|
+
* This class provides a similar API to Angular's CanActivate guard.
|
|
96
|
+
*
|
|
97
|
+
* @since 3.1.0
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```tsx
|
|
101
|
+
* const guard = new AuthenticationFlowGuard(
|
|
102
|
+
* isInternalAuth,
|
|
103
|
+
* () => auth.login()
|
|
104
|
+
* );
|
|
105
|
+
*
|
|
106
|
+
* if (!guard.canActivate()) {
|
|
107
|
+
* // Navigation blocked, login initiated
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare class AuthenticationFlowGuard {
|
|
112
|
+
private isInternalAuth;
|
|
113
|
+
private initLogin;
|
|
114
|
+
constructor(isInternalAuth: boolean, initLogin: () => void | Promise<void>);
|
|
115
|
+
/**
|
|
116
|
+
* Check if navigation should be allowed
|
|
117
|
+
* @returns Whether navigation is allowed
|
|
118
|
+
*/
|
|
119
|
+
canActivate(): boolean;
|
|
120
|
+
}
|
|
121
|
+
export default AuthenticationFlowGuard;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @abpjs/account
|
|
3
3
|
* ABP Framework Account module for React
|
|
4
|
-
* Translated from @abp/ng.account
|
|
4
|
+
* Translated from @abp/ng.account v3.1.0
|
|
5
|
+
*
|
|
6
|
+
* Changes in v3.1.0:
|
|
7
|
+
* - New: AuthenticationFlowGuard - Route guard for checking auth flow type
|
|
8
|
+
* - ChangePasswordForm: Added hideCurrentPassword prop for users without password (social login)
|
|
9
|
+
* - ManageProfile: Added hideChangePasswordTab prop and loading state for external users
|
|
10
|
+
* - AuthWrapper: Internal refactoring (uses SubscriptionService in Angular, no React impact)
|
|
11
|
+
* - PersonalSettingsForm: Simplified internal implementation
|
|
12
|
+
*
|
|
13
|
+
* Changes in v3.0.0:
|
|
14
|
+
* - New config subpackage: config/providers with ACCOUNT_ROUTE_PROVIDERS, configureRoutes
|
|
15
|
+
* - New config/enums: eAccountRouteNames moved from lib/enums to config/enums
|
|
16
|
+
* - New utils: accountOptionsFactory for creating account options with defaults
|
|
17
|
+
* - New helper: initializeAccountRoutes() for easy route initialization
|
|
18
|
+
* - Merged @abp/ng.account.config into main package (no longer a separate dependency)
|
|
19
|
+
* - Dependency updates to @abp/ng.theme.shared v3.0.0
|
|
5
20
|
*
|
|
6
21
|
* Changes in v2.9.0:
|
|
7
22
|
* - Version bump only (dependency updates to @abp/ng.theme.shared v2.9.0)
|
|
@@ -23,7 +38,7 @@
|
|
|
23
38
|
* - Dependency updates to @abp/ng.theme.shared v2.2.0 and @abp/ng.account.config v2.2.0
|
|
24
39
|
* - No functional code changes
|
|
25
40
|
*
|
|
26
|
-
* @version
|
|
41
|
+
* @version 3.1.0
|
|
27
42
|
* @since 2.0.0 - Added Account namespace with component interface types
|
|
28
43
|
* @since 2.0.0 - Added isSelfRegistrationEnabled support in Login/Register components
|
|
29
44
|
* @since 2.0.0 - Added enableLocalLogin support in AuthWrapper component
|
|
@@ -34,10 +49,15 @@
|
|
|
34
49
|
* @since 2.7.0 - Added eAccountComponents and eAccountRouteNames enums
|
|
35
50
|
* @since 2.7.0 - Components have static keys for component replacement system
|
|
36
51
|
* @since 2.9.0 - Version bump only (dependency updates)
|
|
52
|
+
* @since 3.0.0 - Config subpackage, accountOptionsFactory, initializeAccountRoutes
|
|
53
|
+
* @since 3.1.0 - AuthenticationFlowGuard, hideCurrentPassword, hideChangePasswordTab
|
|
37
54
|
*/
|
|
55
|
+
export * from './config';
|
|
38
56
|
export * from './enums';
|
|
57
|
+
export * from './guards';
|
|
39
58
|
export * from './models';
|
|
40
59
|
export * from './services';
|
|
60
|
+
export * from './utils';
|
|
41
61
|
export * from './providers';
|
|
42
62
|
export * from './hooks';
|
|
43
63
|
export * from './components';
|