@abpjs/tenant-management 2.7.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -61,7 +61,7 @@ export interface TenantManagementModalProps {
61
61
  * }
62
62
  * ```
63
63
  */
64
- export declare function TenantManagementModal({ visible, onVisibleChange, tenantId, initialView, onSave, onVisibleFeaturesChange, }: TenantManagementModalProps): React.ReactElement;
64
+ export declare function TenantManagementModal({ visible, onVisibleChange, tenantId, initialView, onSave, onVisibleFeaturesChange: _onVisibleFeaturesChange, }: TenantManagementModalProps): React.ReactElement;
65
65
  export declare namespace TenantManagementModal {
66
66
  var componentKey: "TenantManagement.TenantsComponent";
67
67
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Tenant Management config enums
3
+ * @since 3.0.0
4
+ */
5
+ export * from './policy-names';
6
+ export * from './route-names';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Policy name keys for the Tenant Management module.
3
+ * These keys are used for permission/policy checks.
4
+ *
5
+ * @since 3.0.0
6
+ */
7
+ export declare const eTenantManagementPolicyNames: {
8
+ /**
9
+ * Tenant Management policy name key.
10
+ * Used for the main tenant management permission.
11
+ */
12
+ readonly TenantManagement: "AbpTenantManagement.Tenants";
13
+ /**
14
+ * Tenants policy name key.
15
+ * Used for tenant-specific permissions.
16
+ */
17
+ readonly Tenants: "AbpTenantManagement.Tenants";
18
+ };
19
+ /**
20
+ * Type for tenant management policy name key values
21
+ */
22
+ export type TenantManagementPolicyNameKey = (typeof eTenantManagementPolicyNames)[keyof typeof eTenantManagementPolicyNames];
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Route name keys for the Tenant Management module config.
3
+ * These keys are used for route localization and identification.
4
+ *
5
+ * Note: In v3.0.0, the Administration key was removed from this enum.
6
+ * It now only contains TenantManagement-specific route names.
7
+ *
8
+ * @since 3.0.0
9
+ */
10
+ export declare const eTenantManagementRouteNames: {
11
+ /**
12
+ * Tenant Management menu route name key.
13
+ */
14
+ readonly TenantManagement: "AbpTenantManagement::Menu:TenantManagement";
15
+ /**
16
+ * Tenants route name key.
17
+ */
18
+ readonly Tenants: "AbpTenantManagement::Tenants";
19
+ };
20
+ /**
21
+ * Type for tenant management route name key values
22
+ */
23
+ export type TenantManagementRouteNameKey = (typeof eTenantManagementRouteNames)[keyof typeof eTenantManagementRouteNames];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Tenant Management config subpackage
3
+ * Provides route configuration and related enums for the tenant management module.
4
+ *
5
+ * @since 3.0.0
6
+ */
7
+ export * from './enums';
8
+ export * from './providers';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Tenant Management config providers
3
+ * @since 3.0.0
4
+ */
5
+ export * from './route.provider';
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Route provider for Tenant Management module.
3
+ * Provides route configuration for the tenant management routes.
4
+ *
5
+ * @since 3.0.0
6
+ */
7
+ import { RoutesService } from '@abpjs/core';
8
+ /**
9
+ * Configures the tenant management module routes.
10
+ * Returns a function that adds the routes to the RoutesService.
11
+ *
12
+ * @param routes - The RoutesService instance to add routes to
13
+ * @returns A function that adds the tenant management routes when called
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const routes = getRoutesService();
18
+ * const addRoutes = configureRoutes(routes);
19
+ * addRoutes();
20
+ * ```
21
+ */
22
+ export declare function configureRoutes(routes: RoutesService): () => void;
23
+ /**
24
+ * Tenant Management route providers configuration object.
25
+ * Use this to configure tenant management routes in your application.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * // In your app initialization:
30
+ * const routes = getRoutesService();
31
+ * const addRoutes = TENANT_MANAGEMENT_ROUTE_PROVIDERS.configureRoutes(routes);
32
+ * addRoutes();
33
+ * ```
34
+ */
35
+ export declare const TENANT_MANAGEMENT_ROUTE_PROVIDERS: {
36
+ configureRoutes: typeof configureRoutes;
37
+ };
38
+ /**
39
+ * Initializes the tenant management module routes using the global services.
40
+ * Call this function during application startup to register tenant management routes.
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * // In your app initialization:
45
+ * initializeTenantManagementRoutes();
46
+ * ```
47
+ */
48
+ export declare function initializeTenantManagementRoutes(): void;
@@ -4,3 +4,4 @@
4
4
  */
5
5
  export * from './components';
6
6
  export * from './route-names';
7
+ export { eTenantManagementPolicyNames, type TenantManagementPolicyNameKey } from '../config/enums/policy-names';
@@ -1,23 +1,11 @@
1
1
  /**
2
2
  * Route name keys for the Tenant Management module.
3
3
  * These keys are used for route localization and identification.
4
+ *
5
+ * Note: In v3.0.0, this is re-exported from the config subpackage.
6
+ * The Administration key was removed - use 'AbpUiNavigation::Menu:Administration' directly.
7
+ *
4
8
  * @since 2.7.0
9
+ * @deprecated Import from config subpackage instead: `import { eTenantManagementRouteNames } from '@abpjs/tenant-management/config'`
5
10
  */
6
- export declare const eTenantManagementRouteNames: {
7
- /**
8
- * Administration menu route name key.
9
- */
10
- readonly Administration: "AbpUiNavigation::Menu:Administration";
11
- /**
12
- * Tenant Management menu route name key.
13
- */
14
- readonly TenantManagement: "AbpTenantManagement::Menu:TenantManagement";
15
- /**
16
- * Tenants route name key.
17
- */
18
- readonly Tenants: "AbpTenantManagement::Tenants";
19
- };
20
- /**
21
- * Type for tenant management route name key values
22
- */
23
- export type TenantManagementRouteNameKey = (typeof eTenantManagementRouteNames)[keyof typeof eTenantManagementRouteNames];
11
+ export { eTenantManagementRouteNames, type TenantManagementRouteNameKey, } from '../config/enums/route-names';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,19 @@
1
1
  /**
2
2
  * @abpjs/tenant-management
3
3
  * ABP Framework Tenant Management module for React
4
- * Translated from @abp/ng.tenant-management v2.7.0
4
+ * Translated from @abp/ng.tenant-management v3.0.0
5
+ *
6
+ * Changes in v3.0.0:
7
+ * - Added config subpackage with route providers and policy names
8
+ * - Added eTenantManagementPolicyNames enum for permission checks
9
+ * - Added TENANT_MANAGEMENT_ROUTE_PROVIDERS for route configuration
10
+ * - Added configureRoutes function for route setup
11
+ * - Added initializeTenantManagementRoutes helper function
12
+ * - Moved eTenantManagementRouteNames to config subpackage (re-exported for backward compatibility)
13
+ * - Removed Administration from eTenantManagementRouteNames (use 'AbpUiNavigation::Menu:Administration' directly)
14
+ *
15
+ * Changes in v2.9.0:
16
+ * - Version bump only (dependency updates to @abp/ng.theme.shared v2.9.0, @abp/ng.feature-management v2.9.0)
5
17
  *
6
18
  * Changes in v2.7.0:
7
19
  * - Added eTenantManagementComponents enum for component replacement keys
@@ -36,6 +48,7 @@
36
48
  * - Updated onSearch signature: (value: any) -> (value: string)
37
49
  * - Updated onPageChange signature: (data: any) -> (page: number)
38
50
  */
51
+ export * from './config';
39
52
  export * from './enums';
40
53
  export * from './models';
41
54
  export * from './services';
package/dist/index.js CHANGED
@@ -22,31 +22,36 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  TENANT_MANAGEMENT_POLICIES: () => TENANT_MANAGEMENT_POLICIES,
24
24
  TENANT_MANAGEMENT_ROUTE_PATHS: () => TENANT_MANAGEMENT_ROUTE_PATHS,
25
+ TENANT_MANAGEMENT_ROUTE_PROVIDERS: () => TENANT_MANAGEMENT_ROUTE_PROVIDERS,
25
26
  TenantManagementModal: () => TenantManagementModal,
26
27
  TenantManagementService: () => TenantManagementService,
27
28
  TenantManagementStateService: () => TenantManagementStateService,
29
+ configureRoutes: () => configureRoutes,
28
30
  eTenantManagementComponents: () => eTenantManagementComponents,
31
+ eTenantManagementPolicyNames: () => eTenantManagementPolicyNames,
29
32
  eTenantManagementRouteNames: () => eTenantManagementRouteNames,
30
33
  getTenantManagementStateService: () => getTenantManagementStateService,
34
+ initializeTenantManagementRoutes: () => initializeTenantManagementRoutes,
31
35
  useTenantManagement: () => useTenantManagement
32
36
  });
33
37
  module.exports = __toCommonJS(index_exports);
34
38
 
35
- // src/enums/components.ts
36
- var eTenantManagementComponents = {
39
+ // src/config/enums/policy-names.ts
40
+ var eTenantManagementPolicyNames = {
37
41
  /**
38
- * Key for the Tenants component.
39
- * Use this to replace the default TenantsComponent with a custom implementation.
42
+ * Tenant Management policy name key.
43
+ * Used for the main tenant management permission.
40
44
  */
41
- Tenants: "TenantManagement.TenantsComponent"
45
+ TenantManagement: "AbpTenantManagement.Tenants",
46
+ /**
47
+ * Tenants policy name key.
48
+ * Used for tenant-specific permissions.
49
+ */
50
+ Tenants: "AbpTenantManagement.Tenants"
42
51
  };
43
52
 
44
- // src/enums/route-names.ts
53
+ // src/config/enums/route-names.ts
45
54
  var eTenantManagementRouteNames = {
46
- /**
47
- * Administration menu route name key.
48
- */
49
- Administration: "AbpUiNavigation::Menu:Administration",
50
55
  /**
51
56
  * Tenant Management menu route name key.
52
57
  */
@@ -57,6 +62,48 @@ var eTenantManagementRouteNames = {
57
62
  Tenants: "AbpTenantManagement::Tenants"
58
63
  };
59
64
 
65
+ // src/config/providers/route.provider.ts
66
+ var import_core = require("@abpjs/core");
67
+ function configureRoutes(routes) {
68
+ return () => {
69
+ routes.add([
70
+ {
71
+ path: "/tenant-management",
72
+ name: eTenantManagementRouteNames.TenantManagement,
73
+ parentName: "AbpUiNavigation::Menu:Administration",
74
+ layout: import_core.eLayoutType.application,
75
+ iconClass: "bi bi-people",
76
+ order: 2,
77
+ requiredPolicy: eTenantManagementPolicyNames.TenantManagement
78
+ },
79
+ {
80
+ path: "/tenant-management/tenants",
81
+ name: eTenantManagementRouteNames.Tenants,
82
+ parentName: eTenantManagementRouteNames.TenantManagement,
83
+ layout: import_core.eLayoutType.application,
84
+ requiredPolicy: eTenantManagementPolicyNames.Tenants
85
+ }
86
+ ]);
87
+ };
88
+ }
89
+ var TENANT_MANAGEMENT_ROUTE_PROVIDERS = {
90
+ configureRoutes
91
+ };
92
+ function initializeTenantManagementRoutes() {
93
+ const routes = (0, import_core.getRoutesService)();
94
+ const addRoutes = configureRoutes(routes);
95
+ addRoutes();
96
+ }
97
+
98
+ // src/enums/components.ts
99
+ var eTenantManagementComponents = {
100
+ /**
101
+ * Key for the Tenants component.
102
+ * Use this to replace the default TenantsComponent with a custom implementation.
103
+ */
104
+ Tenants: "TenantManagement.TenantsComponent"
105
+ };
106
+
60
107
  // src/services/tenant-management.service.ts
61
108
  var TenantManagementService = class {
62
109
  constructor(rest) {
@@ -327,9 +374,9 @@ function getTenantManagementStateService() {
327
374
 
328
375
  // src/hooks/useTenantManagement.ts
329
376
  var import_react = require("react");
330
- var import_core = require("@abpjs/core");
377
+ var import_core2 = require("@abpjs/core");
331
378
  function useTenantManagement() {
332
- const restService = (0, import_core.useRestService)();
379
+ const restService = (0, import_core2.useRestService)();
333
380
  const service = (0, import_react.useMemo)(() => new TenantManagementService(restService), [restService]);
334
381
  const [tenants, setTenants] = (0, import_react.useState)([]);
335
382
  const [totalCount, setTotalCount] = (0, import_react.useState)(0);
@@ -577,7 +624,7 @@ var TENANT_MANAGEMENT_POLICIES = {
577
624
 
578
625
  // src/components/TenantManagementModal/TenantManagementModal.tsx
579
626
  var import_react2 = require("react");
580
- var import_core2 = require("@abpjs/core");
627
+ var import_core3 = require("@abpjs/core");
581
628
  var import_theme_shared = require("@abpjs/theme-shared");
582
629
  var import_react3 = require("@chakra-ui/react");
583
630
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -587,9 +634,9 @@ function TenantManagementModal({
587
634
  tenantId,
588
635
  initialView = "tenant",
589
636
  onSave,
590
- onVisibleFeaturesChange
637
+ onVisibleFeaturesChange: _onVisibleFeaturesChange
591
638
  }) {
592
- const { t } = (0, import_core2.useLocalization)();
639
+ const { t } = (0, import_core3.useLocalization)();
593
640
  const {
594
641
  selectedTenant,
595
642
  isLoading,
@@ -628,28 +675,32 @@ function TenantManagementModal({
628
675
  }
629
676
  }
630
677
  if (visible) {
631
- setCurrentView(initialView);
678
+ queueMicrotask(() => setCurrentView(initialView));
632
679
  }
633
680
  if (!visible) {
634
- reset();
635
- setTenantName("");
636
- setTenantNameError(null);
637
- setAdminEmail("");
638
- setAdminEmailError(null);
639
- setAdminPassword("");
640
- setAdminPasswordError(null);
641
- setLocalConnectionString("");
642
- setLocalUseSharedDatabase(true);
681
+ queueMicrotask(() => {
682
+ reset();
683
+ setTenantName("");
684
+ setTenantNameError(null);
685
+ setAdminEmail("");
686
+ setAdminEmailError(null);
687
+ setAdminPassword("");
688
+ setAdminPasswordError(null);
689
+ setLocalConnectionString("");
690
+ setLocalUseSharedDatabase(true);
691
+ });
643
692
  }
644
693
  }, [visible, tenantId, initialView, fetchTenantById, fetchConnectionString, reset]);
645
694
  (0, import_react2.useEffect)(() => {
646
695
  if (selectedTenant) {
647
- setTenantName(selectedTenant.name);
696
+ queueMicrotask(() => setTenantName(selectedTenant.name));
648
697
  }
649
698
  }, [selectedTenant]);
650
699
  (0, import_react2.useEffect)(() => {
651
- setLocalConnectionString(defaultConnectionString);
652
- setLocalUseSharedDatabase(useSharedDatabase);
700
+ queueMicrotask(() => {
701
+ setLocalConnectionString(defaultConnectionString);
702
+ setLocalUseSharedDatabase(useSharedDatabase);
703
+ });
653
704
  }, [defaultConnectionString, useSharedDatabase]);
654
705
  const validateTenantName = (0, import_react2.useCallback)(
655
706
  (name) => {
@@ -930,11 +981,15 @@ TenantManagementModal.componentKey = eTenantManagementComponents.Tenants;
930
981
  0 && (module.exports = {
931
982
  TENANT_MANAGEMENT_POLICIES,
932
983
  TENANT_MANAGEMENT_ROUTE_PATHS,
984
+ TENANT_MANAGEMENT_ROUTE_PROVIDERS,
933
985
  TenantManagementModal,
934
986
  TenantManagementService,
935
987
  TenantManagementStateService,
988
+ configureRoutes,
936
989
  eTenantManagementComponents,
990
+ eTenantManagementPolicyNames,
937
991
  eTenantManagementRouteNames,
938
992
  getTenantManagementStateService,
993
+ initializeTenantManagementRoutes,
939
994
  useTenantManagement
940
995
  });
package/dist/index.mjs CHANGED
@@ -1,18 +1,19 @@
1
- // src/enums/components.ts
2
- var eTenantManagementComponents = {
1
+ // src/config/enums/policy-names.ts
2
+ var eTenantManagementPolicyNames = {
3
3
  /**
4
- * Key for the Tenants component.
5
- * Use this to replace the default TenantsComponent with a custom implementation.
4
+ * Tenant Management policy name key.
5
+ * Used for the main tenant management permission.
6
6
  */
7
- Tenants: "TenantManagement.TenantsComponent"
7
+ TenantManagement: "AbpTenantManagement.Tenants",
8
+ /**
9
+ * Tenants policy name key.
10
+ * Used for tenant-specific permissions.
11
+ */
12
+ Tenants: "AbpTenantManagement.Tenants"
8
13
  };
9
14
 
10
- // src/enums/route-names.ts
15
+ // src/config/enums/route-names.ts
11
16
  var eTenantManagementRouteNames = {
12
- /**
13
- * Administration menu route name key.
14
- */
15
- Administration: "AbpUiNavigation::Menu:Administration",
16
17
  /**
17
18
  * Tenant Management menu route name key.
18
19
  */
@@ -23,6 +24,48 @@ var eTenantManagementRouteNames = {
23
24
  Tenants: "AbpTenantManagement::Tenants"
24
25
  };
25
26
 
27
+ // src/config/providers/route.provider.ts
28
+ import { getRoutesService, eLayoutType } from "@abpjs/core";
29
+ function configureRoutes(routes) {
30
+ return () => {
31
+ routes.add([
32
+ {
33
+ path: "/tenant-management",
34
+ name: eTenantManagementRouteNames.TenantManagement,
35
+ parentName: "AbpUiNavigation::Menu:Administration",
36
+ layout: eLayoutType.application,
37
+ iconClass: "bi bi-people",
38
+ order: 2,
39
+ requiredPolicy: eTenantManagementPolicyNames.TenantManagement
40
+ },
41
+ {
42
+ path: "/tenant-management/tenants",
43
+ name: eTenantManagementRouteNames.Tenants,
44
+ parentName: eTenantManagementRouteNames.TenantManagement,
45
+ layout: eLayoutType.application,
46
+ requiredPolicy: eTenantManagementPolicyNames.Tenants
47
+ }
48
+ ]);
49
+ };
50
+ }
51
+ var TENANT_MANAGEMENT_ROUTE_PROVIDERS = {
52
+ configureRoutes
53
+ };
54
+ function initializeTenantManagementRoutes() {
55
+ const routes = getRoutesService();
56
+ const addRoutes = configureRoutes(routes);
57
+ addRoutes();
58
+ }
59
+
60
+ // src/enums/components.ts
61
+ var eTenantManagementComponents = {
62
+ /**
63
+ * Key for the Tenants component.
64
+ * Use this to replace the default TenantsComponent with a custom implementation.
65
+ */
66
+ Tenants: "TenantManagement.TenantsComponent"
67
+ };
68
+
26
69
  // src/services/tenant-management.service.ts
27
70
  var TenantManagementService = class {
28
71
  constructor(rest) {
@@ -559,7 +602,7 @@ function TenantManagementModal({
559
602
  tenantId,
560
603
  initialView = "tenant",
561
604
  onSave,
562
- onVisibleFeaturesChange
605
+ onVisibleFeaturesChange: _onVisibleFeaturesChange
563
606
  }) {
564
607
  const { t } = useLocalization();
565
608
  const {
@@ -600,28 +643,32 @@ function TenantManagementModal({
600
643
  }
601
644
  }
602
645
  if (visible) {
603
- setCurrentView(initialView);
646
+ queueMicrotask(() => setCurrentView(initialView));
604
647
  }
605
648
  if (!visible) {
606
- reset();
607
- setTenantName("");
608
- setTenantNameError(null);
609
- setAdminEmail("");
610
- setAdminEmailError(null);
611
- setAdminPassword("");
612
- setAdminPasswordError(null);
613
- setLocalConnectionString("");
614
- setLocalUseSharedDatabase(true);
649
+ queueMicrotask(() => {
650
+ reset();
651
+ setTenantName("");
652
+ setTenantNameError(null);
653
+ setAdminEmail("");
654
+ setAdminEmailError(null);
655
+ setAdminPassword("");
656
+ setAdminPasswordError(null);
657
+ setLocalConnectionString("");
658
+ setLocalUseSharedDatabase(true);
659
+ });
615
660
  }
616
661
  }, [visible, tenantId, initialView, fetchTenantById, fetchConnectionString, reset]);
617
662
  useEffect(() => {
618
663
  if (selectedTenant) {
619
- setTenantName(selectedTenant.name);
664
+ queueMicrotask(() => setTenantName(selectedTenant.name));
620
665
  }
621
666
  }, [selectedTenant]);
622
667
  useEffect(() => {
623
- setLocalConnectionString(defaultConnectionString);
624
- setLocalUseSharedDatabase(useSharedDatabase);
668
+ queueMicrotask(() => {
669
+ setLocalConnectionString(defaultConnectionString);
670
+ setLocalUseSharedDatabase(useSharedDatabase);
671
+ });
625
672
  }, [defaultConnectionString, useSharedDatabase]);
626
673
  const validateTenantName = useCallback2(
627
674
  (name) => {
@@ -901,11 +948,15 @@ TenantManagementModal.componentKey = eTenantManagementComponents.Tenants;
901
948
  export {
902
949
  TENANT_MANAGEMENT_POLICIES,
903
950
  TENANT_MANAGEMENT_ROUTE_PATHS,
951
+ TENANT_MANAGEMENT_ROUTE_PROVIDERS,
904
952
  TenantManagementModal,
905
953
  TenantManagementService,
906
954
  TenantManagementStateService,
955
+ configureRoutes,
907
956
  eTenantManagementComponents,
957
+ eTenantManagementPolicyNames,
908
958
  eTenantManagementRouteNames,
909
959
  getTenantManagementStateService,
960
+ initializeTenantManagementRoutes,
910
961
  useTenantManagement
911
962
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abpjs/tenant-management",
3
- "version": "2.7.0",
3
+ "version": "3.0.0",
4
4
  "description": "ABP Framework tenant-management components for React - translated from @abp/ng.tenant-management",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -23,11 +23,11 @@
23
23
  "dependencies": {
24
24
  "@chakra-ui/react": "^3.2.0",
25
25
  "@emotion/react": "^11.11.0",
26
- "@abpjs/core": "2.7.0",
27
- "@abpjs/theme-shared": "2.7.0"
26
+ "@abpjs/core": "3.0.0",
27
+ "@abpjs/theme-shared": "3.0.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@abp/ng.tenant-management": "2.7.0",
30
+ "@abp/ng.tenant-management": "3.0.0",
31
31
  "@testing-library/jest-dom": "^6.4.0",
32
32
  "@testing-library/react": "^14.2.0",
33
33
  "@types/react": "^18.2.0",