@abpjs/tenant-management 1.1.0 → 2.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -27,6 +27,11 @@ export interface TenantManagementModalProps {
27
27
  * Callback fired when tenant is saved successfully
28
28
  */
29
29
  onSave?: () => void;
30
+ /**
31
+ * Callback when features modal visibility changes
32
+ * @since 2.0.0
33
+ */
34
+ onVisibleFeaturesChange?: (visible: boolean) => void;
30
35
  }
31
36
  /**
32
37
  * TenantManagementModal - Modal for managing tenants
@@ -56,5 +61,5 @@ export interface TenantManagementModalProps {
56
61
  * }
57
62
  * ```
58
63
  */
59
- export declare function TenantManagementModal({ visible, onVisibleChange, tenantId, initialView, onSave, }: TenantManagementModalProps): React.ReactElement;
64
+ export declare function TenantManagementModal({ visible, onVisibleChange, tenantId, initialView, onSave, onVisibleFeaturesChange, }: TenantManagementModalProps): React.ReactElement;
60
65
  export default TenantManagementModal;
@@ -1 +1 @@
1
- export { TENANT_MANAGEMENT_ROUTES, TENANT_MANAGEMENT_ROUTE_PATHS, TENANT_MANAGEMENT_POLICIES, } from './routes';
1
+ export { TENANT_MANAGEMENT_ROUTE_PATHS, TENANT_MANAGEMENT_POLICIES, } from './routes';
@@ -1,16 +1,10 @@
1
- import { ABP } from '@abpjs/core';
2
1
  /**
3
- * Tenant Management module routes configuration (v0.9.0 format).
4
- * Translated from @abp/ng.tenant-management TENANT_MANAGEMENT_ROUTES.
2
+ * Tenant Management module route constants
3
+ * Translated from @abp/ng.tenant-management v2.0.0
5
4
  *
6
- * These routes define the navigation structure for the tenant management module
7
- * within the ABP Framework application.
8
- *
9
- * In v0.9.0, the format changed from `ABP.FullRoute[]` to `{ routes: ABP.FullRoute[] }`
5
+ * Note: TENANT_MANAGEMENT_ROUTES was deprecated in v0.9.0 and removed in v2.0.0.
6
+ * Use TENANT_MANAGEMENT_ROUTE_PATHS and TENANT_MANAGEMENT_POLICIES instead.
10
7
  */
11
- export declare const TENANT_MANAGEMENT_ROUTES: {
12
- routes: ABP.FullRoute[];
13
- };
14
8
  /**
15
9
  * Route paths for the tenant management module.
16
10
  * Use these constants for programmatic navigation.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,23 @@
1
1
  /**
2
2
  * @abpjs/tenant-management
3
3
  * ABP Framework Tenant Management module for React
4
- * Translated from @abp/ng.tenant-management v1.1.0
4
+ * Translated from @abp/ng.tenant-management v2.1.0
5
+ *
6
+ * Changes in v2.0.0:
7
+ * - Removed TENANT_MANAGEMENT_ROUTES constant (deprecated in v0.9.0)
8
+ * - Added dispatchGetTenants() to TenantManagementStateService
9
+ * - Added dispatchGetTenantById() to TenantManagementStateService
10
+ * - Added dispatchCreateTenant() to TenantManagementStateService
11
+ * - Added dispatchUpdateTenant() to TenantManagementStateService
12
+ * - Added dispatchDeleteTenant() to TenantManagementStateService
13
+ * - Added onVisibleFeaturesChange prop to TenantManagementModal
14
+ * - Added TenantsComponentInputs interface
15
+ * - Added TenantsComponentOutputs interface
16
+ * - Updated onSearch signature: (value: any) -> (value: string)
17
+ * - Updated onPageChange signature: (data: any) -> (page: number)
18
+ *
19
+ * Changes in v2.1.0:
20
+ * - Version bump only (dependency updates to @abp/ng.theme.shared v2.1.0, @abp/ng.feature-management v2.1.0)
5
21
  */
6
22
  export * from './models';
7
23
  export * from './services';
package/dist/index.js CHANGED
@@ -21,7 +21,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  TENANT_MANAGEMENT_POLICIES: () => TENANT_MANAGEMENT_POLICIES,
24
- TENANT_MANAGEMENT_ROUTES: () => TENANT_MANAGEMENT_ROUTES,
25
24
  TENANT_MANAGEMENT_ROUTE_PATHS: () => TENANT_MANAGEMENT_ROUTE_PATHS,
26
25
  TenantManagementModal: () => TenantManagementModal,
27
26
  TenantManagementService: () => TenantManagementService,
@@ -134,10 +133,15 @@ var TenantManagementService = class {
134
133
 
135
134
  // src/services/tenant-management-state.service.ts
136
135
  var TenantManagementStateService = class {
137
- constructor() {
136
+ /**
137
+ * Constructor
138
+ * @param tenantService Optional TenantManagementService for dispatch methods (v2.0.0)
139
+ */
140
+ constructor(tenantService) {
138
141
  this._tenants = [];
139
142
  this._totalCount = 0;
140
143
  this._subscribers = /* @__PURE__ */ new Set();
144
+ this._tenantService = tenantService;
141
145
  }
142
146
  /**
143
147
  * Get all tenants
@@ -200,6 +204,86 @@ var TenantManagementStateService = class {
200
204
  notifySubscribers() {
201
205
  this._subscribers.forEach((callback) => callback());
202
206
  }
207
+ // ========================
208
+ // Dispatch Methods (v2.0.0)
209
+ // ========================
210
+ /**
211
+ * Dispatch GetTenants action - fetches tenants from API and updates state
212
+ * @param params Optional pagination parameters
213
+ * @returns Promise with the tenant response
214
+ * @since 2.0.0
215
+ */
216
+ async dispatchGetTenants(params) {
217
+ if (!this._tenantService) {
218
+ throw new Error(
219
+ "TenantManagementService is required for dispatchGetTenants. Pass it to the constructor."
220
+ );
221
+ }
222
+ const response = await this._tenantService.getAll(params);
223
+ this.updateFromResponse(response);
224
+ return response;
225
+ }
226
+ /**
227
+ * Dispatch GetTenantById action - fetches a single tenant by ID
228
+ * @param id Tenant ID
229
+ * @returns Promise with the tenant item
230
+ * @since 2.0.0
231
+ */
232
+ async dispatchGetTenantById(id) {
233
+ if (!this._tenantService) {
234
+ throw new Error(
235
+ "TenantManagementService is required for dispatchGetTenantById. Pass it to the constructor."
236
+ );
237
+ }
238
+ return this._tenantService.getById(id);
239
+ }
240
+ /**
241
+ * Dispatch CreateTenant action - creates a new tenant and refreshes the list
242
+ * @param body Tenant creation request
243
+ * @returns Promise with the created tenant
244
+ * @since 2.0.0
245
+ */
246
+ async dispatchCreateTenant(body) {
247
+ if (!this._tenantService) {
248
+ throw new Error(
249
+ "TenantManagementService is required for dispatchCreateTenant. Pass it to the constructor."
250
+ );
251
+ }
252
+ const result = await this._tenantService.create(body);
253
+ await this.dispatchGetTenants();
254
+ return result;
255
+ }
256
+ /**
257
+ * Dispatch UpdateTenant action - updates an existing tenant and refreshes the list
258
+ * @param body Tenant update request
259
+ * @returns Promise with the updated tenant
260
+ * @since 2.0.0
261
+ */
262
+ async dispatchUpdateTenant(body) {
263
+ if (!this._tenantService) {
264
+ throw new Error(
265
+ "TenantManagementService is required for dispatchUpdateTenant. Pass it to the constructor."
266
+ );
267
+ }
268
+ const result = await this._tenantService.update(body);
269
+ await this.dispatchGetTenants();
270
+ return result;
271
+ }
272
+ /**
273
+ * Dispatch DeleteTenant action - deletes a tenant and refreshes the list
274
+ * @param id Tenant ID to delete
275
+ * @returns Promise that resolves when deletion completes
276
+ * @since 2.0.0
277
+ */
278
+ async dispatchDeleteTenant(id) {
279
+ if (!this._tenantService) {
280
+ throw new Error(
281
+ "TenantManagementService is required for dispatchDeleteTenant. Pass it to the constructor."
282
+ );
283
+ }
284
+ await this._tenantService.delete(id);
285
+ await this.dispatchGetTenants();
286
+ }
203
287
  };
204
288
  var _stateInstance = null;
205
289
  function getTenantManagementStateService() {
@@ -420,33 +504,6 @@ function useTenantManagement() {
420
504
  }
421
505
 
422
506
  // src/constants/routes.ts
423
- var import_core2 = require("@abpjs/core");
424
- var TENANT_MANAGEMENT_ROUTES = {
425
- routes: [
426
- {
427
- name: "AbpUiNavigation::Menu:Administration",
428
- path: "",
429
- order: 1,
430
- wrapper: true
431
- },
432
- {
433
- name: "AbpTenantManagement::Menu:TenantManagement",
434
- path: "tenant-management",
435
- order: 2,
436
- parentName: "AbpUiNavigation::Menu:Administration",
437
- layout: import_core2.eLayoutType.application,
438
- requiredPolicy: "AbpTenantManagement.Tenants",
439
- children: [
440
- {
441
- path: "tenants",
442
- name: "AbpTenantManagement::Tenants",
443
- order: 1,
444
- requiredPolicy: "AbpTenantManagement.Tenants"
445
- }
446
- ]
447
- }
448
- ]
449
- };
450
507
  var TENANT_MANAGEMENT_ROUTE_PATHS = {
451
508
  /** Base path for tenant management module */
452
509
  BASE: "/tenant-management",
@@ -470,7 +527,7 @@ var TENANT_MANAGEMENT_POLICIES = {
470
527
 
471
528
  // src/components/TenantManagementModal/TenantManagementModal.tsx
472
529
  var import_react2 = require("react");
473
- var import_core3 = require("@abpjs/core");
530
+ var import_core2 = require("@abpjs/core");
474
531
  var import_theme_shared = require("@abpjs/theme-shared");
475
532
  var import_react3 = require("@chakra-ui/react");
476
533
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -479,9 +536,10 @@ function TenantManagementModal({
479
536
  onVisibleChange,
480
537
  tenantId,
481
538
  initialView = "tenant",
482
- onSave
539
+ onSave,
540
+ onVisibleFeaturesChange
483
541
  }) {
484
- const { t } = (0, import_core3.useLocalization)();
542
+ const { t } = (0, import_core2.useLocalization)();
485
543
  const {
486
544
  selectedTenant,
487
545
  isLoading,
@@ -702,7 +760,6 @@ function TenantManagementModal({
702
760
  // Annotate the CommonJS export names for ESM import in node:
703
761
  0 && (module.exports = {
704
762
  TENANT_MANAGEMENT_POLICIES,
705
- TENANT_MANAGEMENT_ROUTES,
706
763
  TENANT_MANAGEMENT_ROUTE_PATHS,
707
764
  TenantManagementModal,
708
765
  TenantManagementService,
package/dist/index.mjs CHANGED
@@ -101,10 +101,15 @@ var TenantManagementService = class {
101
101
 
102
102
  // src/services/tenant-management-state.service.ts
103
103
  var TenantManagementStateService = class {
104
- constructor() {
104
+ /**
105
+ * Constructor
106
+ * @param tenantService Optional TenantManagementService for dispatch methods (v2.0.0)
107
+ */
108
+ constructor(tenantService) {
105
109
  this._tenants = [];
106
110
  this._totalCount = 0;
107
111
  this._subscribers = /* @__PURE__ */ new Set();
112
+ this._tenantService = tenantService;
108
113
  }
109
114
  /**
110
115
  * Get all tenants
@@ -167,6 +172,86 @@ var TenantManagementStateService = class {
167
172
  notifySubscribers() {
168
173
  this._subscribers.forEach((callback) => callback());
169
174
  }
175
+ // ========================
176
+ // Dispatch Methods (v2.0.0)
177
+ // ========================
178
+ /**
179
+ * Dispatch GetTenants action - fetches tenants from API and updates state
180
+ * @param params Optional pagination parameters
181
+ * @returns Promise with the tenant response
182
+ * @since 2.0.0
183
+ */
184
+ async dispatchGetTenants(params) {
185
+ if (!this._tenantService) {
186
+ throw new Error(
187
+ "TenantManagementService is required for dispatchGetTenants. Pass it to the constructor."
188
+ );
189
+ }
190
+ const response = await this._tenantService.getAll(params);
191
+ this.updateFromResponse(response);
192
+ return response;
193
+ }
194
+ /**
195
+ * Dispatch GetTenantById action - fetches a single tenant by ID
196
+ * @param id Tenant ID
197
+ * @returns Promise with the tenant item
198
+ * @since 2.0.0
199
+ */
200
+ async dispatchGetTenantById(id) {
201
+ if (!this._tenantService) {
202
+ throw new Error(
203
+ "TenantManagementService is required for dispatchGetTenantById. Pass it to the constructor."
204
+ );
205
+ }
206
+ return this._tenantService.getById(id);
207
+ }
208
+ /**
209
+ * Dispatch CreateTenant action - creates a new tenant and refreshes the list
210
+ * @param body Tenant creation request
211
+ * @returns Promise with the created tenant
212
+ * @since 2.0.0
213
+ */
214
+ async dispatchCreateTenant(body) {
215
+ if (!this._tenantService) {
216
+ throw new Error(
217
+ "TenantManagementService is required for dispatchCreateTenant. Pass it to the constructor."
218
+ );
219
+ }
220
+ const result = await this._tenantService.create(body);
221
+ await this.dispatchGetTenants();
222
+ return result;
223
+ }
224
+ /**
225
+ * Dispatch UpdateTenant action - updates an existing tenant and refreshes the list
226
+ * @param body Tenant update request
227
+ * @returns Promise with the updated tenant
228
+ * @since 2.0.0
229
+ */
230
+ async dispatchUpdateTenant(body) {
231
+ if (!this._tenantService) {
232
+ throw new Error(
233
+ "TenantManagementService is required for dispatchUpdateTenant. Pass it to the constructor."
234
+ );
235
+ }
236
+ const result = await this._tenantService.update(body);
237
+ await this.dispatchGetTenants();
238
+ return result;
239
+ }
240
+ /**
241
+ * Dispatch DeleteTenant action - deletes a tenant and refreshes the list
242
+ * @param id Tenant ID to delete
243
+ * @returns Promise that resolves when deletion completes
244
+ * @since 2.0.0
245
+ */
246
+ async dispatchDeleteTenant(id) {
247
+ if (!this._tenantService) {
248
+ throw new Error(
249
+ "TenantManagementService is required for dispatchDeleteTenant. Pass it to the constructor."
250
+ );
251
+ }
252
+ await this._tenantService.delete(id);
253
+ await this.dispatchGetTenants();
254
+ }
170
255
  };
171
256
  var _stateInstance = null;
172
257
  function getTenantManagementStateService() {
@@ -387,33 +472,6 @@ function useTenantManagement() {
387
472
  }
388
473
 
389
474
  // src/constants/routes.ts
390
- import { eLayoutType } from "@abpjs/core";
391
- var TENANT_MANAGEMENT_ROUTES = {
392
- routes: [
393
- {
394
- name: "AbpUiNavigation::Menu:Administration",
395
- path: "",
396
- order: 1,
397
- wrapper: true
398
- },
399
- {
400
- name: "AbpTenantManagement::Menu:TenantManagement",
401
- path: "tenant-management",
402
- order: 2,
403
- parentName: "AbpUiNavigation::Menu:Administration",
404
- layout: eLayoutType.application,
405
- requiredPolicy: "AbpTenantManagement.Tenants",
406
- children: [
407
- {
408
- path: "tenants",
409
- name: "AbpTenantManagement::Tenants",
410
- order: 1,
411
- requiredPolicy: "AbpTenantManagement.Tenants"
412
- }
413
- ]
414
- }
415
- ]
416
- };
417
475
  var TENANT_MANAGEMENT_ROUTE_PATHS = {
418
476
  /** Base path for tenant management module */
419
477
  BASE: "/tenant-management",
@@ -452,7 +510,8 @@ function TenantManagementModal({
452
510
  onVisibleChange,
453
511
  tenantId,
454
512
  initialView = "tenant",
455
- onSave
513
+ onSave,
514
+ onVisibleFeaturesChange
456
515
  }) {
457
516
  const { t } = useLocalization();
458
517
  const {
@@ -674,7 +733,6 @@ function TenantManagementModal({
674
733
  }
675
734
  export {
676
735
  TENANT_MANAGEMENT_POLICIES,
677
- TENANT_MANAGEMENT_ROUTES,
678
736
  TENANT_MANAGEMENT_ROUTE_PATHS,
679
737
  TenantManagementModal,
680
738
  TenantManagementService,
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Tenant Management module type definitions
3
- * Translated from @abp/ng.tenant-management v1.1.0
3
+ * Translated from @abp/ng.tenant-management v2.0.0
4
4
  */
5
5
  import type { ABP } from '@abpjs/core';
6
6
  /**
@@ -44,4 +44,28 @@ export declare namespace TenantManagement {
44
44
  id: string;
45
45
  defaultConnectionString: string;
46
46
  }
47
+ /**
48
+ * Input props for TenantsComponent
49
+ * @since 2.0.0
50
+ */
51
+ interface TenantsComponentInputs {
52
+ /** Callback when tenant is created */
53
+ readonly onTenantCreated?: (tenant: Item) => void;
54
+ /** Callback when tenant is updated */
55
+ readonly onTenantUpdated?: (tenant: Item) => void;
56
+ /** Callback when tenant is deleted */
57
+ readonly onTenantDeleted?: (id: string) => void;
58
+ }
59
+ /**
60
+ * Output callbacks for TenantsComponent
61
+ * @since 2.0.0
62
+ */
63
+ interface TenantsComponentOutputs {
64
+ /** Callback when features modal visibility changes */
65
+ readonly onVisibleFeaturesChange?: (visible: boolean) => void;
66
+ /** Callback when search is performed */
67
+ readonly onSearch?: (value: string) => void;
68
+ /** Callback when page changes */
69
+ readonly onPageChange?: (page: number) => void;
70
+ }
47
71
  }
@@ -1,15 +1,23 @@
1
1
  /**
2
2
  * Tenant Management State Service
3
- * Translated from @abp/ng.tenant-management v1.1.0
3
+ * Translated from @abp/ng.tenant-management v2.0.0
4
4
  *
5
5
  * This service provides state management for tenant management,
6
6
  * equivalent to the Angular NGXS TenantManagementState selectors.
7
+ *
8
+ * Changes in v2.0.0:
9
+ * - Added dispatchGetTenants() method
10
+ * - Added dispatchGetTenantById() method
11
+ * - Added dispatchCreateTenant() method
12
+ * - Added dispatchUpdateTenant() method
13
+ * - Added dispatchDeleteTenant() method
7
14
  */
8
15
  import type { ABP } from '@abpjs/core';
9
16
  import type { TenantManagement } from '../models';
17
+ import { TenantManagementService } from './tenant-management.service';
10
18
  /**
11
19
  * State service for managing tenant management state.
12
- * Provides methods equivalent to Angular's NGXS state selectors.
20
+ * Provides methods equivalent to Angular's NGXS state selectors and dispatch methods.
13
21
  *
14
22
  * @since 1.1.0
15
23
  */
@@ -17,6 +25,12 @@ export declare class TenantManagementStateService {
17
25
  private _tenants;
18
26
  private _totalCount;
19
27
  private _subscribers;
28
+ private _tenantService?;
29
+ /**
30
+ * Constructor
31
+ * @param tenantService Optional TenantManagementService for dispatch methods (v2.0.0)
32
+ */
33
+ constructor(tenantService?: TenantManagementService);
20
34
  /**
21
35
  * Get all tenants
22
36
  * Equivalent to Angular's TenantManagementState selector
@@ -53,6 +67,41 @@ export declare class TenantManagementStateService {
53
67
  */
54
68
  subscribe(callback: () => void): () => void;
55
69
  private notifySubscribers;
70
+ /**
71
+ * Dispatch GetTenants action - fetches tenants from API and updates state
72
+ * @param params Optional pagination parameters
73
+ * @returns Promise with the tenant response
74
+ * @since 2.0.0
75
+ */
76
+ dispatchGetTenants(params?: ABP.PageQueryParams): Promise<TenantManagement.Response>;
77
+ /**
78
+ * Dispatch GetTenantById action - fetches a single tenant by ID
79
+ * @param id Tenant ID
80
+ * @returns Promise with the tenant item
81
+ * @since 2.0.0
82
+ */
83
+ dispatchGetTenantById(id: string): Promise<TenantManagement.Item>;
84
+ /**
85
+ * Dispatch CreateTenant action - creates a new tenant and refreshes the list
86
+ * @param body Tenant creation request
87
+ * @returns Promise with the created tenant
88
+ * @since 2.0.0
89
+ */
90
+ dispatchCreateTenant(body: TenantManagement.AddRequest): Promise<TenantManagement.Item>;
91
+ /**
92
+ * Dispatch UpdateTenant action - updates an existing tenant and refreshes the list
93
+ * @param body Tenant update request
94
+ * @returns Promise with the updated tenant
95
+ * @since 2.0.0
96
+ */
97
+ dispatchUpdateTenant(body: TenantManagement.UpdateRequest): Promise<TenantManagement.Item>;
98
+ /**
99
+ * Dispatch DeleteTenant action - deletes a tenant and refreshes the list
100
+ * @param id Tenant ID to delete
101
+ * @returns Promise that resolves when deletion completes
102
+ * @since 2.0.0
103
+ */
104
+ dispatchDeleteTenant(id: string): Promise<void>;
56
105
  }
57
106
  /**
58
107
  * Get the singleton instance of TenantManagementStateService
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abpjs/tenant-management",
3
- "version": "1.1.0",
3
+ "version": "2.1.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": "1.1.0",
27
- "@abpjs/theme-shared": "1.1.0"
26
+ "@abpjs/core": "2.1.0",
27
+ "@abpjs/theme-shared": "2.1.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@abp/ng.tenant-management": "1.1.0",
30
+ "@abp/ng.tenant-management": "2.1.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",