@abpjs/account 2.9.0 → 3.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 +1 -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/index.d.ts +13 -2
- package/dist/index.js +112 -51
- package/dist/index.mjs +78 -21
- 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
|
}
|
|
@@ -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';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
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.0.0
|
|
5
|
+
*
|
|
6
|
+
* Changes in v3.0.0:
|
|
7
|
+
* - New config subpackage: config/providers with ACCOUNT_ROUTE_PROVIDERS, configureRoutes
|
|
8
|
+
* - New config/enums: eAccountRouteNames moved from lib/enums to config/enums
|
|
9
|
+
* - New utils: accountOptionsFactory for creating account options with defaults
|
|
10
|
+
* - New helper: initializeAccountRoutes() for easy route initialization
|
|
11
|
+
* - Merged @abp/ng.account.config into main package (no longer a separate dependency)
|
|
12
|
+
* - Dependency updates to @abp/ng.theme.shared v3.0.0
|
|
5
13
|
*
|
|
6
14
|
* Changes in v2.9.0:
|
|
7
15
|
* - Version bump only (dependency updates to @abp/ng.theme.shared v2.9.0)
|
|
@@ -23,7 +31,7 @@
|
|
|
23
31
|
* - Dependency updates to @abp/ng.theme.shared v2.2.0 and @abp/ng.account.config v2.2.0
|
|
24
32
|
* - No functional code changes
|
|
25
33
|
*
|
|
26
|
-
* @version
|
|
34
|
+
* @version 3.0.0
|
|
27
35
|
* @since 2.0.0 - Added Account namespace with component interface types
|
|
28
36
|
* @since 2.0.0 - Added isSelfRegistrationEnabled support in Login/Register components
|
|
29
37
|
* @since 2.0.0 - Added enableLocalLogin support in AuthWrapper component
|
|
@@ -34,10 +42,13 @@
|
|
|
34
42
|
* @since 2.7.0 - Added eAccountComponents and eAccountRouteNames enums
|
|
35
43
|
* @since 2.7.0 - Components have static keys for component replacement system
|
|
36
44
|
* @since 2.9.0 - Version bump only (dependency updates)
|
|
45
|
+
* @since 3.0.0 - Config subpackage, accountOptionsFactory, initializeAccountRoutes
|
|
37
46
|
*/
|
|
47
|
+
export * from './config';
|
|
38
48
|
export * from './enums';
|
|
39
49
|
export * from './models';
|
|
40
50
|
export * from './services';
|
|
51
|
+
export * from './utils';
|
|
41
52
|
export * from './providers';
|
|
42
53
|
export * from './hooks';
|
|
43
54
|
export * from './components';
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ACCOUNT_PATHS: () => ACCOUNT_PATHS,
|
|
24
|
+
ACCOUNT_ROUTE_PROVIDERS: () => ACCOUNT_ROUTE_PROVIDERS,
|
|
24
25
|
AccountProvider: () => AccountProvider,
|
|
25
26
|
AccountService: () => AccountService,
|
|
26
27
|
AuthWrapper: () => AuthWrapper,
|
|
@@ -33,8 +34,11 @@ __export(index_exports, {
|
|
|
33
34
|
RegisterForm: () => RegisterForm,
|
|
34
35
|
RegisterPage: () => RegisterPage,
|
|
35
36
|
TenantBox: () => TenantBox,
|
|
37
|
+
accountOptionsFactory: () => accountOptionsFactory,
|
|
38
|
+
configureRoutes: () => configureRoutes,
|
|
36
39
|
eAccountComponents: () => eAccountComponents,
|
|
37
40
|
eAccountRouteNames: () => eAccountRouteNames,
|
|
41
|
+
initializeAccountRoutes: () => initializeAccountRoutes,
|
|
38
42
|
useAccountContext: () => useAccountContext,
|
|
39
43
|
useAccountOptions: () => useAccountOptions,
|
|
40
44
|
useAccountService: () => useAccountService,
|
|
@@ -43,6 +47,71 @@ __export(index_exports, {
|
|
|
43
47
|
});
|
|
44
48
|
module.exports = __toCommonJS(index_exports);
|
|
45
49
|
|
|
50
|
+
// src/config/enums/route-names.ts
|
|
51
|
+
var eAccountRouteNames = {
|
|
52
|
+
/**
|
|
53
|
+
* Route name for Account menu
|
|
54
|
+
*/
|
|
55
|
+
Account: "AbpAccount::Menu:Account",
|
|
56
|
+
/**
|
|
57
|
+
* Route name for Login page
|
|
58
|
+
*/
|
|
59
|
+
Login: "AbpAccount::Login",
|
|
60
|
+
/**
|
|
61
|
+
* Route name for Register page
|
|
62
|
+
*/
|
|
63
|
+
Register: "AbpAccount::Register",
|
|
64
|
+
/**
|
|
65
|
+
* Route name for Manage Profile page
|
|
66
|
+
*/
|
|
67
|
+
ManageProfile: "AbpAccount::ManageYourProfile"
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/config/providers/route.provider.ts
|
|
71
|
+
var import_core = require("@abpjs/core");
|
|
72
|
+
function configureRoutes(routes) {
|
|
73
|
+
return () => {
|
|
74
|
+
routes.add([
|
|
75
|
+
{
|
|
76
|
+
path: "/account",
|
|
77
|
+
name: eAccountRouteNames.Account,
|
|
78
|
+
invisible: true,
|
|
79
|
+
layout: import_core.eLayoutType.application,
|
|
80
|
+
order: 1
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
path: "/account/login",
|
|
84
|
+
name: eAccountRouteNames.Login,
|
|
85
|
+
parentName: eAccountRouteNames.Account,
|
|
86
|
+
order: 1
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
path: "/account/register",
|
|
90
|
+
name: eAccountRouteNames.Register,
|
|
91
|
+
parentName: eAccountRouteNames.Account,
|
|
92
|
+
order: 2
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
path: "/account/manage-profile",
|
|
96
|
+
name: eAccountRouteNames.ManageProfile,
|
|
97
|
+
parentName: eAccountRouteNames.Account,
|
|
98
|
+
order: 3
|
|
99
|
+
}
|
|
100
|
+
]);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
var ACCOUNT_ROUTE_PROVIDERS = {
|
|
104
|
+
/**
|
|
105
|
+
* Factory function to configure routes
|
|
106
|
+
*/
|
|
107
|
+
configureRoutes
|
|
108
|
+
};
|
|
109
|
+
function initializeAccountRoutes() {
|
|
110
|
+
const routes = (0, import_core.getRoutesService)();
|
|
111
|
+
const addRoutes = configureRoutes(routes);
|
|
112
|
+
addRoutes();
|
|
113
|
+
}
|
|
114
|
+
|
|
46
115
|
// src/enums/components.ts
|
|
47
116
|
var eAccountComponents = {
|
|
48
117
|
/**
|
|
@@ -75,26 +144,6 @@ var eAccountComponents = {
|
|
|
75
144
|
PersonalSettings: "Account.PersonalSettingsComponent"
|
|
76
145
|
};
|
|
77
146
|
|
|
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
|
-
|
|
98
147
|
// src/services/account.service.ts
|
|
99
148
|
var AccountService = class {
|
|
100
149
|
constructor(rest) {
|
|
@@ -133,6 +182,14 @@ var AccountService = class {
|
|
|
133
182
|
}
|
|
134
183
|
};
|
|
135
184
|
|
|
185
|
+
// src/utils/factory-utils.ts
|
|
186
|
+
function accountOptionsFactory(options) {
|
|
187
|
+
return {
|
|
188
|
+
redirectUrl: "/",
|
|
189
|
+
...options
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
136
193
|
// src/providers/AccountProvider.tsx
|
|
137
194
|
var import_react = require("react");
|
|
138
195
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -170,11 +227,11 @@ function useAccountOptions() {
|
|
|
170
227
|
|
|
171
228
|
// src/hooks/usePasswordFlow.ts
|
|
172
229
|
var import_react2 = require("react");
|
|
173
|
-
var
|
|
230
|
+
var import_core2 = require("@abpjs/core");
|
|
174
231
|
var import_react_router_dom = require("react-router-dom");
|
|
175
232
|
function usePasswordFlow() {
|
|
176
|
-
const { store, axiosInstance, applicationConfigurationService, userManager } = (0,
|
|
177
|
-
const config = (0,
|
|
233
|
+
const { store, axiosInstance, applicationConfigurationService, userManager } = (0, import_core2.useAbp)();
|
|
234
|
+
const config = (0, import_core2.useConfig)();
|
|
178
235
|
const options = useAccountOptions();
|
|
179
236
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
180
237
|
const [isLoading, setIsLoading] = (0, import_react2.useState)(false);
|
|
@@ -236,7 +293,7 @@ function usePasswordFlow() {
|
|
|
236
293
|
}
|
|
237
294
|
}
|
|
238
295
|
const appConfig = await applicationConfigurationService.getConfiguration();
|
|
239
|
-
store.dispatch(
|
|
296
|
+
store.dispatch(import_core2.configActions.setApplicationConfiguration(appConfig));
|
|
240
297
|
const redirectUrl = window.history.state?.redirectUrl || options.redirectUrl;
|
|
241
298
|
navigate(redirectUrl);
|
|
242
299
|
setIsLoading(false);
|
|
@@ -273,17 +330,17 @@ function usePasswordFlow() {
|
|
|
273
330
|
|
|
274
331
|
// src/hooks/useAccountService.ts
|
|
275
332
|
var import_react3 = require("react");
|
|
276
|
-
var
|
|
333
|
+
var import_core3 = require("@abpjs/core");
|
|
277
334
|
function useAccountService() {
|
|
278
|
-
const restService = (0,
|
|
335
|
+
const restService = (0, import_core3.useRestService)();
|
|
279
336
|
return (0, import_react3.useMemo)(() => new AccountService(restService), [restService]);
|
|
280
337
|
}
|
|
281
338
|
|
|
282
339
|
// src/hooks/useSelfRegistration.ts
|
|
283
|
-
var
|
|
340
|
+
var import_core4 = require("@abpjs/core");
|
|
284
341
|
var SELF_REGISTRATION_SETTING = "Abp.Account.IsSelfRegistrationEnabled";
|
|
285
342
|
function useSelfRegistrationEnabled() {
|
|
286
|
-
const setting = (0,
|
|
343
|
+
const setting = (0, import_core4.useSetting)(SELF_REGISTRATION_SETTING);
|
|
287
344
|
if (setting === void 0 || setting === null) {
|
|
288
345
|
return true;
|
|
289
346
|
}
|
|
@@ -292,7 +349,7 @@ function useSelfRegistrationEnabled() {
|
|
|
292
349
|
|
|
293
350
|
// src/components/AuthWrapper/AuthWrapper.tsx
|
|
294
351
|
var import_react4 = require("@chakra-ui/react");
|
|
295
|
-
var
|
|
352
|
+
var import_core5 = require("@abpjs/core");
|
|
296
353
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
297
354
|
var ENABLE_LOCAL_LOGIN_SETTING = "Abp.Account.EnableLocalLogin";
|
|
298
355
|
function AuthWrapper({
|
|
@@ -300,10 +357,10 @@ function AuthWrapper({
|
|
|
300
357
|
mainContent,
|
|
301
358
|
cancelContent,
|
|
302
359
|
enableLocalLogin,
|
|
303
|
-
isMultiTenancyEnabled = true
|
|
360
|
+
isMultiTenancyEnabled: _isMultiTenancyEnabled = true
|
|
304
361
|
}) {
|
|
305
|
-
const { t } = (0,
|
|
306
|
-
const localLoginSetting = (0,
|
|
362
|
+
const { t } = (0, import_core5.useLocalization)();
|
|
363
|
+
const localLoginSetting = (0, import_core5.useSetting)(ENABLE_LOCAL_LOGIN_SETTING);
|
|
307
364
|
const isLocalLoginEnabled = enableLocalLogin ?? (localLoginSetting === void 0 || localLoginSetting === null ? true : localLoginSetting.toLowerCase() === "true");
|
|
308
365
|
if (!isLocalLoginEnabled) {
|
|
309
366
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react4.Flex, { height: "full", flex: "1", className: "auth-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react4.Box, { flex: "1", py: { base: "24", md: "32" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react4.Container, { maxW: "md", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react4.Stack, { gap: "8", textAlign: "center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react4.Text, { fontSize: "lg", color: "fg.muted", children: t("AbpAccount::LocalLoginDisabledMessage") || "Local login is disabled. Please use an external login provider." }) }) }) }) });
|
|
@@ -320,7 +377,7 @@ var import_react5 = require("react");
|
|
|
320
377
|
var import_react_hook_form = require("react-hook-form");
|
|
321
378
|
var import_zod = require("@hookform/resolvers/zod");
|
|
322
379
|
var import_zod2 = require("zod");
|
|
323
|
-
var
|
|
380
|
+
var import_core6 = require("@abpjs/core");
|
|
324
381
|
var import_theme_shared = require("@abpjs/theme-shared");
|
|
325
382
|
var import_react6 = require("@chakra-ui/react");
|
|
326
383
|
var import_react7 = require("@chakra-ui/react");
|
|
@@ -353,8 +410,8 @@ var changePasswordSchema = import_zod2.z.object({
|
|
|
353
410
|
path: ["confirmNewPassword"]
|
|
354
411
|
});
|
|
355
412
|
function ChangePasswordForm({ onSuccess, onError }) {
|
|
356
|
-
const { t } = (0,
|
|
357
|
-
const { changePassword } = (0,
|
|
413
|
+
const { t } = (0, import_core6.useLocalization)();
|
|
414
|
+
const { changePassword } = (0, import_core6.useProfile)();
|
|
358
415
|
const toaster = (0, import_theme_shared.useToaster)();
|
|
359
416
|
const [inProgress, setInProgress] = (0, import_react5.useState)(false);
|
|
360
417
|
const {
|
|
@@ -454,23 +511,23 @@ var import_react_hook_form2 = require("react-hook-form");
|
|
|
454
511
|
var import_zod3 = require("@hookform/resolvers/zod");
|
|
455
512
|
var import_zod4 = require("zod");
|
|
456
513
|
var import_react_router_dom2 = require("react-router-dom");
|
|
457
|
-
var
|
|
514
|
+
var import_core8 = require("@abpjs/core");
|
|
458
515
|
var import_theme_shared3 = require("@abpjs/theme-shared");
|
|
459
516
|
var import_react10 = require("@chakra-ui/react");
|
|
460
517
|
|
|
461
518
|
// src/components/TenantBox/TenantBox.tsx
|
|
462
519
|
var import_react8 = require("react");
|
|
463
520
|
var import_react_redux = require("react-redux");
|
|
464
|
-
var
|
|
521
|
+
var import_core7 = require("@abpjs/core");
|
|
465
522
|
var import_theme_shared2 = require("@abpjs/theme-shared");
|
|
466
523
|
var import_react9 = require("@chakra-ui/react");
|
|
467
524
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
468
525
|
function TenantBox({ containerStyle }) {
|
|
469
|
-
const { t } = (0,
|
|
526
|
+
const { t } = (0, import_core7.useLocalization)();
|
|
470
527
|
const dispatch = (0, import_react_redux.useDispatch)();
|
|
471
528
|
const accountService = useAccountService();
|
|
472
529
|
const toaster = (0, import_theme_shared2.useToaster)();
|
|
473
|
-
const currentTenant = (0, import_react_redux.useSelector)(
|
|
530
|
+
const currentTenant = (0, import_react_redux.useSelector)(import_core7.selectTenant);
|
|
474
531
|
const [name, setName] = (0, import_react8.useState)("");
|
|
475
532
|
const [isModalVisible, setIsModalVisible] = (0, import_react8.useState)(false);
|
|
476
533
|
const [modalBusy, setModalBusy] = (0, import_react8.useState)(false);
|
|
@@ -482,7 +539,7 @@ function TenantBox({ containerStyle }) {
|
|
|
482
539
|
}, []);
|
|
483
540
|
const setTenant = (0, import_react8.useCallback)(
|
|
484
541
|
(tenant) => {
|
|
485
|
-
dispatch(
|
|
542
|
+
dispatch(import_core7.sessionActions.setTenant(tenant));
|
|
486
543
|
},
|
|
487
544
|
[dispatch]
|
|
488
545
|
);
|
|
@@ -642,7 +699,7 @@ function LoginForm({
|
|
|
642
699
|
onLoginSuccess,
|
|
643
700
|
onLoginError
|
|
644
701
|
}) {
|
|
645
|
-
const { t } = (0,
|
|
702
|
+
const { t } = (0, import_core8.useLocalization)();
|
|
646
703
|
const { login, isLoading, error, clearError } = usePasswordFlow();
|
|
647
704
|
const isSelfRegistrationEnabled = useSelfRegistrationEnabled();
|
|
648
705
|
const {
|
|
@@ -727,7 +784,7 @@ LoginForm.authWrapperKey = eAccountComponents.AuthWrapper;
|
|
|
727
784
|
|
|
728
785
|
// src/components/ManageProfile/ManageProfile.tsx
|
|
729
786
|
var import_react15 = require("react");
|
|
730
|
-
var
|
|
787
|
+
var import_core10 = require("@abpjs/core");
|
|
731
788
|
var import_react16 = require("@chakra-ui/react");
|
|
732
789
|
|
|
733
790
|
// src/components/PersonalSettingsForm/PersonalSettingsForm.tsx
|
|
@@ -735,7 +792,7 @@ var import_react12 = require("react");
|
|
|
735
792
|
var import_react_hook_form3 = require("react-hook-form");
|
|
736
793
|
var import_zod5 = require("@hookform/resolvers/zod");
|
|
737
794
|
var import_zod6 = require("zod");
|
|
738
|
-
var
|
|
795
|
+
var import_core9 = require("@abpjs/core");
|
|
739
796
|
var import_theme_shared4 = require("@abpjs/theme-shared");
|
|
740
797
|
var import_react13 = require("@chakra-ui/react");
|
|
741
798
|
var import_react14 = require("@chakra-ui/react");
|
|
@@ -749,8 +806,8 @@ var personalSettingsSchema = import_zod6.z.object({
|
|
|
749
806
|
phoneNumber: import_zod6.z.string().max(16, "Phone number must be at most 16 characters").optional()
|
|
750
807
|
});
|
|
751
808
|
function PersonalSettingsForm({ onSuccess, onError }) {
|
|
752
|
-
const { t } = (0,
|
|
753
|
-
const { profile, loading, fetchProfile, updateProfile } = (0,
|
|
809
|
+
const { t } = (0, import_core9.useLocalization)();
|
|
810
|
+
const { profile, loading, fetchProfile, updateProfile } = (0, import_core9.useProfile)();
|
|
754
811
|
const toaster = (0, import_theme_shared4.useToaster)();
|
|
755
812
|
const [inProgress, setInProgress] = (0, import_react12.useState)(false);
|
|
756
813
|
const {
|
|
@@ -895,7 +952,7 @@ function ManageProfile({
|
|
|
895
952
|
onTabChange,
|
|
896
953
|
customTabs
|
|
897
954
|
}) {
|
|
898
|
-
const { t } = (0,
|
|
955
|
+
const { t } = (0, import_core10.useLocalization)();
|
|
899
956
|
const [selectedTab, setSelectedTab] = (0, import_react15.useState)(defaultTabIndex);
|
|
900
957
|
const defaultTabs = [
|
|
901
958
|
{
|
|
@@ -942,7 +999,7 @@ var import_react_hook_form4 = require("react-hook-form");
|
|
|
942
999
|
var import_zod7 = require("@hookform/resolvers/zod");
|
|
943
1000
|
var import_zod8 = require("zod");
|
|
944
1001
|
var import_react_router_dom3 = require("react-router-dom");
|
|
945
|
-
var
|
|
1002
|
+
var import_core11 = require("@abpjs/core");
|
|
946
1003
|
var import_theme_shared5 = require("@abpjs/theme-shared");
|
|
947
1004
|
var import_react18 = require("@chakra-ui/react");
|
|
948
1005
|
var import_react19 = require("@chakra-ui/react");
|
|
@@ -978,12 +1035,12 @@ function RegisterForm({
|
|
|
978
1035
|
onRegisterSuccess,
|
|
979
1036
|
onRegisterError
|
|
980
1037
|
}) {
|
|
981
|
-
const { t } = (0,
|
|
1038
|
+
const { t } = (0, import_core11.useLocalization)();
|
|
982
1039
|
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
983
1040
|
const accountService = useAccountService();
|
|
984
1041
|
const toaster = (0, import_theme_shared5.useToaster)();
|
|
985
|
-
const userManager = (0,
|
|
986
|
-
const { store, applicationConfigurationService } = (0,
|
|
1042
|
+
const userManager = (0, import_core11.useUserManager)();
|
|
1043
|
+
const { store, applicationConfigurationService } = (0, import_core11.useAbp)();
|
|
987
1044
|
const [inProgress, setInProgress] = (0, import_react17.useState)(false);
|
|
988
1045
|
const isSelfRegistrationEnabled = useSelfRegistrationEnabled();
|
|
989
1046
|
(0, import_react17.useEffect)(() => {
|
|
@@ -1020,7 +1077,7 @@ function RegisterForm({
|
|
|
1020
1077
|
password: newUser.password
|
|
1021
1078
|
});
|
|
1022
1079
|
const config = await applicationConfigurationService.getConfiguration();
|
|
1023
|
-
store.dispatch(
|
|
1080
|
+
store.dispatch(import_core11.configActions.setApplicationConfiguration(config));
|
|
1024
1081
|
navigate("/");
|
|
1025
1082
|
onRegisterSuccess?.();
|
|
1026
1083
|
} catch (loginErr) {
|
|
@@ -1145,6 +1202,7 @@ var ACCOUNT_PATHS = {
|
|
|
1145
1202
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1146
1203
|
0 && (module.exports = {
|
|
1147
1204
|
ACCOUNT_PATHS,
|
|
1205
|
+
ACCOUNT_ROUTE_PROVIDERS,
|
|
1148
1206
|
AccountProvider,
|
|
1149
1207
|
AccountService,
|
|
1150
1208
|
AuthWrapper,
|
|
@@ -1157,8 +1215,11 @@ var ACCOUNT_PATHS = {
|
|
|
1157
1215
|
RegisterForm,
|
|
1158
1216
|
RegisterPage,
|
|
1159
1217
|
TenantBox,
|
|
1218
|
+
accountOptionsFactory,
|
|
1219
|
+
configureRoutes,
|
|
1160
1220
|
eAccountComponents,
|
|
1161
1221
|
eAccountRouteNames,
|
|
1222
|
+
initializeAccountRoutes,
|
|
1162
1223
|
useAccountContext,
|
|
1163
1224
|
useAccountOptions,
|
|
1164
1225
|
useAccountService,
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,68 @@
|
|
|
1
|
+
// src/config/enums/route-names.ts
|
|
2
|
+
var eAccountRouteNames = {
|
|
3
|
+
/**
|
|
4
|
+
* Route name for Account menu
|
|
5
|
+
*/
|
|
6
|
+
Account: "AbpAccount::Menu:Account",
|
|
7
|
+
/**
|
|
8
|
+
* Route name for Login page
|
|
9
|
+
*/
|
|
10
|
+
Login: "AbpAccount::Login",
|
|
11
|
+
/**
|
|
12
|
+
* Route name for Register page
|
|
13
|
+
*/
|
|
14
|
+
Register: "AbpAccount::Register",
|
|
15
|
+
/**
|
|
16
|
+
* Route name for Manage Profile page
|
|
17
|
+
*/
|
|
18
|
+
ManageProfile: "AbpAccount::ManageYourProfile"
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// src/config/providers/route.provider.ts
|
|
22
|
+
import { getRoutesService, eLayoutType } from "@abpjs/core";
|
|
23
|
+
function configureRoutes(routes) {
|
|
24
|
+
return () => {
|
|
25
|
+
routes.add([
|
|
26
|
+
{
|
|
27
|
+
path: "/account",
|
|
28
|
+
name: eAccountRouteNames.Account,
|
|
29
|
+
invisible: true,
|
|
30
|
+
layout: eLayoutType.application,
|
|
31
|
+
order: 1
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
path: "/account/login",
|
|
35
|
+
name: eAccountRouteNames.Login,
|
|
36
|
+
parentName: eAccountRouteNames.Account,
|
|
37
|
+
order: 1
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
path: "/account/register",
|
|
41
|
+
name: eAccountRouteNames.Register,
|
|
42
|
+
parentName: eAccountRouteNames.Account,
|
|
43
|
+
order: 2
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
path: "/account/manage-profile",
|
|
47
|
+
name: eAccountRouteNames.ManageProfile,
|
|
48
|
+
parentName: eAccountRouteNames.Account,
|
|
49
|
+
order: 3
|
|
50
|
+
}
|
|
51
|
+
]);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
var ACCOUNT_ROUTE_PROVIDERS = {
|
|
55
|
+
/**
|
|
56
|
+
* Factory function to configure routes
|
|
57
|
+
*/
|
|
58
|
+
configureRoutes
|
|
59
|
+
};
|
|
60
|
+
function initializeAccountRoutes() {
|
|
61
|
+
const routes = getRoutesService();
|
|
62
|
+
const addRoutes = configureRoutes(routes);
|
|
63
|
+
addRoutes();
|
|
64
|
+
}
|
|
65
|
+
|
|
1
66
|
// src/enums/components.ts
|
|
2
67
|
var eAccountComponents = {
|
|
3
68
|
/**
|
|
@@ -30,26 +95,6 @@ var eAccountComponents = {
|
|
|
30
95
|
PersonalSettings: "Account.PersonalSettingsComponent"
|
|
31
96
|
};
|
|
32
97
|
|
|
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
|
-
|
|
53
98
|
// src/services/account.service.ts
|
|
54
99
|
var AccountService = class {
|
|
55
100
|
constructor(rest) {
|
|
@@ -88,6 +133,14 @@ var AccountService = class {
|
|
|
88
133
|
}
|
|
89
134
|
};
|
|
90
135
|
|
|
136
|
+
// src/utils/factory-utils.ts
|
|
137
|
+
function accountOptionsFactory(options) {
|
|
138
|
+
return {
|
|
139
|
+
redirectUrl: "/",
|
|
140
|
+
...options
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
91
144
|
// src/providers/AccountProvider.tsx
|
|
92
145
|
import { createContext, useContext, useMemo } from "react";
|
|
93
146
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -255,7 +308,7 @@ function AuthWrapper({
|
|
|
255
308
|
mainContent,
|
|
256
309
|
cancelContent,
|
|
257
310
|
enableLocalLogin,
|
|
258
|
-
isMultiTenancyEnabled = true
|
|
311
|
+
isMultiTenancyEnabled: _isMultiTenancyEnabled = true
|
|
259
312
|
}) {
|
|
260
313
|
const { t } = useLocalization();
|
|
261
314
|
const localLoginSetting = useSetting2(ENABLE_LOCAL_LOGIN_SETTING);
|
|
@@ -1115,6 +1168,7 @@ var ACCOUNT_PATHS = {
|
|
|
1115
1168
|
};
|
|
1116
1169
|
export {
|
|
1117
1170
|
ACCOUNT_PATHS,
|
|
1171
|
+
ACCOUNT_ROUTE_PROVIDERS,
|
|
1118
1172
|
AccountProvider,
|
|
1119
1173
|
AccountService,
|
|
1120
1174
|
AuthWrapper,
|
|
@@ -1127,8 +1181,11 @@ export {
|
|
|
1127
1181
|
RegisterForm,
|
|
1128
1182
|
RegisterPage,
|
|
1129
1183
|
TenantBox,
|
|
1184
|
+
accountOptionsFactory,
|
|
1185
|
+
configureRoutes,
|
|
1130
1186
|
eAccountComponents,
|
|
1131
1187
|
eAccountRouteNames,
|
|
1188
|
+
initializeAccountRoutes,
|
|
1132
1189
|
useAccountContext,
|
|
1133
1190
|
useAccountOptions,
|
|
1134
1191
|
useAccountService,
|
package/dist/models/index.d.ts
CHANGED
|
@@ -24,38 +24,31 @@ export declare namespace Account {
|
|
|
24
24
|
/**
|
|
25
25
|
* Outputs for AuthWrapper component
|
|
26
26
|
*/
|
|
27
|
-
|
|
28
|
-
}
|
|
27
|
+
type AuthWrapperComponentOutputs = Record<string, never>;
|
|
29
28
|
/**
|
|
30
29
|
* Inputs for TenantBox component
|
|
31
30
|
*/
|
|
32
|
-
|
|
33
|
-
}
|
|
31
|
+
type TenantBoxComponentInputs = Record<string, never>;
|
|
34
32
|
/**
|
|
35
33
|
* Outputs for TenantBox component
|
|
36
34
|
*/
|
|
37
|
-
|
|
38
|
-
}
|
|
35
|
+
type TenantBoxComponentOutputs = Record<string, never>;
|
|
39
36
|
/**
|
|
40
37
|
* Inputs for PersonalSettings component
|
|
41
38
|
*/
|
|
42
|
-
|
|
43
|
-
}
|
|
39
|
+
type PersonalSettingsComponentInputs = Record<string, never>;
|
|
44
40
|
/**
|
|
45
41
|
* Outputs for PersonalSettings component
|
|
46
42
|
*/
|
|
47
|
-
|
|
48
|
-
}
|
|
43
|
+
type PersonalSettingsComponentOutputs = Record<string, never>;
|
|
49
44
|
/**
|
|
50
45
|
* Inputs for ChangePassword component
|
|
51
46
|
*/
|
|
52
|
-
|
|
53
|
-
}
|
|
47
|
+
type ChangePasswordComponentInputs = Record<string, never>;
|
|
54
48
|
/**
|
|
55
49
|
* Outputs for ChangePassword component
|
|
56
50
|
*/
|
|
57
|
-
|
|
58
|
-
}
|
|
51
|
+
type ChangePasswordComponentOutputs = Record<string, never>;
|
|
59
52
|
}
|
|
60
53
|
/**
|
|
61
54
|
* Account module configuration options
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account module factory utilities
|
|
3
|
+
*
|
|
4
|
+
* Translated from @abp/ng.account v3.0.0 lib/utils/factory-utils.
|
|
5
|
+
*
|
|
6
|
+
* @since 3.0.0
|
|
7
|
+
*/
|
|
8
|
+
import type { AccountOptions } from '../models';
|
|
9
|
+
/**
|
|
10
|
+
* Factory function to create account options with default values
|
|
11
|
+
*
|
|
12
|
+
* This function merges the provided options with default values.
|
|
13
|
+
* Translated from @abp/ng.account v3.0.0 accountOptionsFactory.
|
|
14
|
+
*
|
|
15
|
+
* @param options - Partial account options
|
|
16
|
+
* @returns Account options with defaults applied
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { accountOptionsFactory } from '@abpjs/account';
|
|
21
|
+
*
|
|
22
|
+
* const options = accountOptionsFactory({ redirectUrl: '/dashboard' });
|
|
23
|
+
* // options = { redirectUrl: '/dashboard' }
|
|
24
|
+
*
|
|
25
|
+
* const defaultOptions = accountOptionsFactory({});
|
|
26
|
+
* // defaultOptions = { redirectUrl: '/' }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function accountOptionsFactory(options: AccountOptions): Required<AccountOptions>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abpjs/account",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.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": "
|
|
57
|
-
"@abpjs/theme-shared": "
|
|
56
|
+
"@abpjs/core": "3.0.0",
|
|
57
|
+
"@abpjs/theme-shared": "3.0.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@abp/ng.account": "
|
|
60
|
+
"@abp/ng.account": "3.0.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",
|