@abpjs/account 1.0.0 → 2.0.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 +50 -0
- package/dist/components/AuthWrapper/index.d.ts +1 -0
- package/dist/components/ChangePasswordForm/ChangePasswordForm.d.ts +31 -0
- package/dist/components/ChangePasswordForm/index.d.ts +1 -0
- package/dist/components/LoginForm/LoginForm.d.ts +2 -0
- package/dist/components/ManageProfile/ManageProfile.d.ts +46 -0
- package/dist/components/ManageProfile/index.d.ts +1 -0
- package/dist/components/PersonalSettingsForm/PersonalSettingsForm.d.ts +31 -0
- package/dist/components/PersonalSettingsForm/index.d.ts +1 -0
- package/dist/components/RegisterForm/RegisterForm.d.ts +1 -0
- package/dist/components/index.d.ts +5 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useSelfRegistration.d.ts +24 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +539 -168
- package/dist/index.mjs +531 -164
- package/dist/models/index.d.ts +56 -0
- package/dist/routes/index.d.ts +2 -15
- package/package.json +6 -5
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for AuthWrapper component
|
|
4
|
+
*/
|
|
5
|
+
export interface AuthWrapperProps {
|
|
6
|
+
/**
|
|
7
|
+
* Main content to be rendered in the wrapper
|
|
8
|
+
*/
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Main content template reference (for consistency with Angular API)
|
|
12
|
+
*/
|
|
13
|
+
mainContent?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Cancel/footer content template reference
|
|
16
|
+
*/
|
|
17
|
+
cancelContent?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Whether local login (username/password) is enabled.
|
|
20
|
+
* When false, the wrapper will show a message that local login is disabled.
|
|
21
|
+
* This is read from ABP settings by default.
|
|
22
|
+
*
|
|
23
|
+
* @since 2.0.0
|
|
24
|
+
* @default true (from ABP settings or if not configured)
|
|
25
|
+
*/
|
|
26
|
+
enableLocalLogin?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* AuthWrapper - Authentication wrapper component
|
|
30
|
+
*
|
|
31
|
+
* This is the React equivalent of Angular's AuthWrapperComponent.
|
|
32
|
+
* It provides a consistent wrapper layout for authentication-related forms
|
|
33
|
+
* like login, register, and password reset.
|
|
34
|
+
*
|
|
35
|
+
* In Angular, this used TemplateRef for content projection.
|
|
36
|
+
* In React, we use children and render props pattern.
|
|
37
|
+
*
|
|
38
|
+
* @since 1.1.0
|
|
39
|
+
* @since 2.0.0 - Added enableLocalLogin prop to control local login visibility
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <AuthWrapper
|
|
44
|
+
* mainContent={<LoginForm />}
|
|
45
|
+
* cancelContent={<Link to="/register">Create account</Link>}
|
|
46
|
+
* />
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function AuthWrapper({ children, mainContent, cancelContent, enableLocalLogin, }: AuthWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
export default AuthWrapper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AuthWrapper, type AuthWrapperProps } from './AuthWrapper';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for ChangePasswordForm component
|
|
3
|
+
*/
|
|
4
|
+
export interface ChangePasswordFormProps {
|
|
5
|
+
/**
|
|
6
|
+
* Callback fired on successful password change
|
|
7
|
+
*/
|
|
8
|
+
onSuccess?: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Callback fired on password change error
|
|
11
|
+
*/
|
|
12
|
+
onError?: (error: string) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* ChangePasswordForm - Password change form component
|
|
16
|
+
*
|
|
17
|
+
* This is the React equivalent of Angular's ChangePasswordComponent.
|
|
18
|
+
* It provides a form for authenticated users to change their password.
|
|
19
|
+
*
|
|
20
|
+
* @since 1.1.0
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <ChangePasswordForm
|
|
25
|
+
* onSuccess={() => console.log('Password changed!')}
|
|
26
|
+
* onError={(err) => console.error(err)}
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function ChangePasswordForm({ onSuccess, onError }: ChangePasswordFormProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export default ChangePasswordForm;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChangePasswordForm, type ChangePasswordFormProps } from './ChangePasswordForm';
|
|
@@ -32,6 +32,8 @@ export interface LoginFormProps {
|
|
|
32
32
|
* This is the React equivalent of Angular's LoginComponent.
|
|
33
33
|
* It handles user authentication using OAuth password flow.
|
|
34
34
|
*
|
|
35
|
+
* @since 2.0.0 - Added isSelfRegistrationEnabled check from ABP settings
|
|
36
|
+
*
|
|
35
37
|
* @example
|
|
36
38
|
* ```tsx
|
|
37
39
|
* function LoginPage() {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Tab configuration for manage profile
|
|
4
|
+
*/
|
|
5
|
+
interface ProfileTab {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
content: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Props for ManageProfile component
|
|
12
|
+
*/
|
|
13
|
+
export interface ManageProfileProps {
|
|
14
|
+
/**
|
|
15
|
+
* Initial tab index to display
|
|
16
|
+
* @default 0
|
|
17
|
+
*/
|
|
18
|
+
defaultTabIndex?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Callback fired when tab changes
|
|
21
|
+
*/
|
|
22
|
+
onTabChange?: (index: number) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Custom tabs to add/replace default tabs
|
|
25
|
+
*/
|
|
26
|
+
customTabs?: ProfileTab[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* ManageProfile - User profile management component
|
|
30
|
+
*
|
|
31
|
+
* This is the React equivalent of Angular's ManageProfileComponent.
|
|
32
|
+
* It provides a tabbed interface for managing user profile settings,
|
|
33
|
+
* including personal information and password change.
|
|
34
|
+
*
|
|
35
|
+
* @since 1.1.0
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <ManageProfile
|
|
40
|
+
* defaultTabIndex={0}
|
|
41
|
+
* onTabChange={(index) => console.log('Tab changed to', index)}
|
|
42
|
+
* />
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function ManageProfile({ defaultTabIndex, onTabChange, customTabs, }: ManageProfileProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export default ManageProfile;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ManageProfile, type ManageProfileProps } from './ManageProfile';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for PersonalSettingsForm component
|
|
3
|
+
*/
|
|
4
|
+
export interface PersonalSettingsFormProps {
|
|
5
|
+
/**
|
|
6
|
+
* Callback fired on successful profile update
|
|
7
|
+
*/
|
|
8
|
+
onSuccess?: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Callback fired on profile update error
|
|
11
|
+
*/
|
|
12
|
+
onError?: (error: string) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* PersonalSettingsForm - User personal settings form component
|
|
16
|
+
*
|
|
17
|
+
* This is the React equivalent of Angular's PersonalSettingsComponent.
|
|
18
|
+
* It provides a form for authenticated users to update their personal information.
|
|
19
|
+
*
|
|
20
|
+
* @since 1.1.0
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <PersonalSettingsForm
|
|
25
|
+
* onSuccess={() => console.log('Profile updated!')}
|
|
26
|
+
* onError={(err) => console.error(err)}
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function PersonalSettingsForm({ onSuccess, onError }: PersonalSettingsFormProps): import("react/jsx-runtime").JSX.Element | null;
|
|
31
|
+
export default PersonalSettingsForm;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PersonalSettingsForm, type PersonalSettingsFormProps } from './PersonalSettingsForm';
|
|
@@ -35,6 +35,7 @@ export interface RegisterFormProps {
|
|
|
35
35
|
* AccountService and automatically logs in the user after successful registration.
|
|
36
36
|
*
|
|
37
37
|
* @since 0.9.0 - Now uses AccountService for registration
|
|
38
|
+
* @since 2.0.0 - Added isSelfRegistrationEnabled check from ABP settings
|
|
38
39
|
*
|
|
39
40
|
* @example
|
|
40
41
|
* ```tsx
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { AuthWrapper, type AuthWrapperProps } from './AuthWrapper';
|
|
2
|
+
export { ChangePasswordForm, type ChangePasswordFormProps } from './ChangePasswordForm';
|
|
2
3
|
export { LoginForm, type LoginFormProps } from './LoginForm';
|
|
4
|
+
export { ManageProfile, type ManageProfileProps } from './ManageProfile';
|
|
5
|
+
export { PersonalSettingsForm, type PersonalSettingsFormProps } from './PersonalSettingsForm';
|
|
3
6
|
export { RegisterForm, type RegisterFormProps } from './RegisterForm';
|
|
7
|
+
export { TenantBox, type TenantBoxProps } from './TenantBox';
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to check if self-registration is enabled.
|
|
3
|
+
*
|
|
4
|
+
* This reads the `Abp.Account.IsSelfRegistrationEnabled` setting from the
|
|
5
|
+
* ABP application configuration.
|
|
6
|
+
*
|
|
7
|
+
* @since 2.0.0
|
|
8
|
+
*
|
|
9
|
+
* @returns true if self-registration is enabled, false otherwise
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* function RegisterLink() {
|
|
14
|
+
* const isSelfRegistrationEnabled = useSelfRegistrationEnabled();
|
|
15
|
+
*
|
|
16
|
+
* if (!isSelfRegistrationEnabled) {
|
|
17
|
+
* return null;
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* return <Link to="/account/register">Register</Link>;
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function useSelfRegistrationEnabled(): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
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 v2.0.0
|
|
5
|
+
*
|
|
6
|
+
* @version 2.0.0
|
|
7
|
+
* @since 2.0.0 - Added Account namespace with component interface types
|
|
8
|
+
* @since 2.0.0 - Added isSelfRegistrationEnabled support in Login/Register components
|
|
9
|
+
* @since 2.0.0 - Added enableLocalLogin support in AuthWrapper component
|
|
10
|
+
* @since 2.0.0 - Removed deprecated ACCOUNT_ROUTES (use AccountProvider instead)
|
|
11
|
+
* @since 2.0.0 - TenantBoxComponent and AccountService now publicly exported
|
|
5
12
|
*/
|
|
6
13
|
export * from './models';
|
|
7
14
|
export * from './services';
|