@abpjs/saas 2.1.1 → 2.4.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/index.d.mts +42 -10
- package/dist/index.d.ts +42 -10
- package/dist/index.js +79 -1
- package/dist/index.mjs +79 -2
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,9 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* SaaS Models
|
|
6
|
-
* Translated from @volo/abp.ng.saas v2.
|
|
6
|
+
* Translated from @volo/abp.ng.saas v2.4.0
|
|
7
|
+
*
|
|
8
|
+
* @updated 2.4.0 - Updated CreateTenantRequest and UpdateTenantRequest types
|
|
7
9
|
*/
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -53,22 +55,19 @@ declare namespace Saas {
|
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* Create tenant request
|
|
58
|
+
* @updated 2.4.0 - adminEmailAddress and adminPassword are now required
|
|
56
59
|
*/
|
|
57
60
|
interface CreateTenantRequest {
|
|
61
|
+
adminEmailAddress: string;
|
|
62
|
+
adminPassword: string;
|
|
58
63
|
name: string;
|
|
59
64
|
editionId?: string;
|
|
60
|
-
adminEmailAddress?: string;
|
|
61
|
-
adminPassword?: string;
|
|
62
65
|
}
|
|
63
66
|
/**
|
|
64
67
|
* Update tenant request
|
|
68
|
+
* @updated 2.4.0 - Now uses Omit<Tenant, 'editionName'> pattern
|
|
65
69
|
*/
|
|
66
|
-
|
|
67
|
-
id?: string;
|
|
68
|
-
name: string;
|
|
69
|
-
editionId?: string;
|
|
70
|
-
concurrencyStamp?: string;
|
|
71
|
-
}
|
|
70
|
+
type UpdateTenantRequest = Omit<Tenant, 'editionName'>;
|
|
72
71
|
/**
|
|
73
72
|
* Create edition request
|
|
74
73
|
*/
|
|
@@ -118,6 +117,17 @@ declare const SAAS_ROUTES: {
|
|
|
118
117
|
routes: ABP.FullRoute[];
|
|
119
118
|
};
|
|
120
119
|
|
|
120
|
+
/**
|
|
121
|
+
* SaaS Component Identifiers
|
|
122
|
+
* Used for component registration and routing
|
|
123
|
+
*
|
|
124
|
+
* @since 2.4.0
|
|
125
|
+
*/
|
|
126
|
+
declare enum eSaasComponents {
|
|
127
|
+
Editions = "Saas.EditionsComponent",
|
|
128
|
+
Tenants = "Saas.TenantsComponent"
|
|
129
|
+
}
|
|
130
|
+
|
|
121
131
|
/**
|
|
122
132
|
* SaaS Service
|
|
123
133
|
* Translated from @volo/abp.ng.saas v2.0.0
|
|
@@ -131,9 +141,15 @@ declare const SAAS_ROUTES: {
|
|
|
131
141
|
* This service wraps all REST API calls for the SaaS module.
|
|
132
142
|
*
|
|
133
143
|
* @since 2.0.0
|
|
144
|
+
* @updated 2.4.0 - Added apiName property
|
|
134
145
|
*/
|
|
135
146
|
declare class SaasService {
|
|
136
147
|
private restService;
|
|
148
|
+
/**
|
|
149
|
+
* API name for multi-API configurations
|
|
150
|
+
* @since 2.4.0
|
|
151
|
+
*/
|
|
152
|
+
apiName: string;
|
|
137
153
|
constructor(restService: RestService);
|
|
138
154
|
/**
|
|
139
155
|
* Get paginated list of tenants
|
|
@@ -396,6 +412,10 @@ interface UseTenantsReturn {
|
|
|
396
412
|
defaultConnectionString: string;
|
|
397
413
|
/** Whether the tenant uses shared database */
|
|
398
414
|
useSharedDatabase: boolean;
|
|
415
|
+
/** Whether features modal is visible @since 2.2.0 */
|
|
416
|
+
visibleFeatures: boolean;
|
|
417
|
+
/** Provider key for features modal @since 2.2.0 */
|
|
418
|
+
featuresProviderKey: string;
|
|
399
419
|
/** Fetch all tenants with optional pagination/filtering */
|
|
400
420
|
fetchTenants: (params?: Saas.TenantsQueryParams) => Promise<TenantOperationResult<Saas.TenantsResponse>>;
|
|
401
421
|
/** Get a tenant by ID and set it as selected */
|
|
@@ -418,6 +438,10 @@ interface UseTenantsReturn {
|
|
|
418
438
|
setSortKey: (key: string) => void;
|
|
419
439
|
/** Set sort order */
|
|
420
440
|
setSortOrder: (order: SortOrder$1) => void;
|
|
441
|
+
/** Handle features modal visibility change @since 2.2.0 */
|
|
442
|
+
onVisibleFeaturesChange: (value: boolean) => void;
|
|
443
|
+
/** Open features modal for a tenant @since 2.2.0 */
|
|
444
|
+
openFeaturesModal: (providerKey: string) => void;
|
|
421
445
|
/** Reset state */
|
|
422
446
|
reset: () => void;
|
|
423
447
|
}
|
|
@@ -495,6 +519,10 @@ interface UseEditionsReturn {
|
|
|
495
519
|
sortOrder: SortOrder;
|
|
496
520
|
/** Usage statistics for editions */
|
|
497
521
|
usageStatistics: Record<string, number>;
|
|
522
|
+
/** Whether features modal is visible @since 2.2.0 */
|
|
523
|
+
visibleFeatures: boolean;
|
|
524
|
+
/** Provider key for features modal @since 2.2.0 */
|
|
525
|
+
featuresProviderKey: string;
|
|
498
526
|
/** Fetch all editions with optional pagination/filtering */
|
|
499
527
|
fetchEditions: (params?: Saas.EditionsQueryParams) => Promise<EditionOperationResult<Saas.EditionsResponse>>;
|
|
500
528
|
/** Get an edition by ID and set it as selected */
|
|
@@ -513,6 +541,10 @@ interface UseEditionsReturn {
|
|
|
513
541
|
setSortKey: (key: string) => void;
|
|
514
542
|
/** Set sort order */
|
|
515
543
|
setSortOrder: (order: SortOrder) => void;
|
|
544
|
+
/** Handle features modal visibility change @since 2.2.0 */
|
|
545
|
+
onVisibleFeaturesChange: (value: boolean) => void;
|
|
546
|
+
/** Open features modal for an edition @since 2.2.0 */
|
|
547
|
+
openFeaturesModal: (providerKey: string) => void;
|
|
516
548
|
/** Reset state */
|
|
517
549
|
reset: () => void;
|
|
518
550
|
}
|
|
@@ -602,4 +634,4 @@ interface EditionsComponentProps {
|
|
|
602
634
|
*/
|
|
603
635
|
declare function EditionsComponent({ onEditionCreated, onEditionUpdated, onEditionDeleted, onManageFeatures, }: EditionsComponentProps): react_jsx_runtime.JSX.Element;
|
|
604
636
|
|
|
605
|
-
export { type EditionOperationResult, EditionsComponent, type EditionsComponentProps, SAAS_ROUTES, Saas, SaasService, SaasStateService, type SortOrder$1 as SortOrder, type TenantOperationResult, TenantsComponent, type TenantsComponentProps, type UseEditionsReturn, type UseTenantsReturn, useEditions, useTenants };
|
|
637
|
+
export { type EditionOperationResult, EditionsComponent, type EditionsComponentProps, SAAS_ROUTES, Saas, SaasService, SaasStateService, type SortOrder$1 as SortOrder, type TenantOperationResult, TenantsComponent, type TenantsComponentProps, type UseEditionsReturn, type UseTenantsReturn, eSaasComponents, useEditions, useTenants };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* SaaS Models
|
|
6
|
-
* Translated from @volo/abp.ng.saas v2.
|
|
6
|
+
* Translated from @volo/abp.ng.saas v2.4.0
|
|
7
|
+
*
|
|
8
|
+
* @updated 2.4.0 - Updated CreateTenantRequest and UpdateTenantRequest types
|
|
7
9
|
*/
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -53,22 +55,19 @@ declare namespace Saas {
|
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* Create tenant request
|
|
58
|
+
* @updated 2.4.0 - adminEmailAddress and adminPassword are now required
|
|
56
59
|
*/
|
|
57
60
|
interface CreateTenantRequest {
|
|
61
|
+
adminEmailAddress: string;
|
|
62
|
+
adminPassword: string;
|
|
58
63
|
name: string;
|
|
59
64
|
editionId?: string;
|
|
60
|
-
adminEmailAddress?: string;
|
|
61
|
-
adminPassword?: string;
|
|
62
65
|
}
|
|
63
66
|
/**
|
|
64
67
|
* Update tenant request
|
|
68
|
+
* @updated 2.4.0 - Now uses Omit<Tenant, 'editionName'> pattern
|
|
65
69
|
*/
|
|
66
|
-
|
|
67
|
-
id?: string;
|
|
68
|
-
name: string;
|
|
69
|
-
editionId?: string;
|
|
70
|
-
concurrencyStamp?: string;
|
|
71
|
-
}
|
|
70
|
+
type UpdateTenantRequest = Omit<Tenant, 'editionName'>;
|
|
72
71
|
/**
|
|
73
72
|
* Create edition request
|
|
74
73
|
*/
|
|
@@ -118,6 +117,17 @@ declare const SAAS_ROUTES: {
|
|
|
118
117
|
routes: ABP.FullRoute[];
|
|
119
118
|
};
|
|
120
119
|
|
|
120
|
+
/**
|
|
121
|
+
* SaaS Component Identifiers
|
|
122
|
+
* Used for component registration and routing
|
|
123
|
+
*
|
|
124
|
+
* @since 2.4.0
|
|
125
|
+
*/
|
|
126
|
+
declare enum eSaasComponents {
|
|
127
|
+
Editions = "Saas.EditionsComponent",
|
|
128
|
+
Tenants = "Saas.TenantsComponent"
|
|
129
|
+
}
|
|
130
|
+
|
|
121
131
|
/**
|
|
122
132
|
* SaaS Service
|
|
123
133
|
* Translated from @volo/abp.ng.saas v2.0.0
|
|
@@ -131,9 +141,15 @@ declare const SAAS_ROUTES: {
|
|
|
131
141
|
* This service wraps all REST API calls for the SaaS module.
|
|
132
142
|
*
|
|
133
143
|
* @since 2.0.0
|
|
144
|
+
* @updated 2.4.0 - Added apiName property
|
|
134
145
|
*/
|
|
135
146
|
declare class SaasService {
|
|
136
147
|
private restService;
|
|
148
|
+
/**
|
|
149
|
+
* API name for multi-API configurations
|
|
150
|
+
* @since 2.4.0
|
|
151
|
+
*/
|
|
152
|
+
apiName: string;
|
|
137
153
|
constructor(restService: RestService);
|
|
138
154
|
/**
|
|
139
155
|
* Get paginated list of tenants
|
|
@@ -396,6 +412,10 @@ interface UseTenantsReturn {
|
|
|
396
412
|
defaultConnectionString: string;
|
|
397
413
|
/** Whether the tenant uses shared database */
|
|
398
414
|
useSharedDatabase: boolean;
|
|
415
|
+
/** Whether features modal is visible @since 2.2.0 */
|
|
416
|
+
visibleFeatures: boolean;
|
|
417
|
+
/** Provider key for features modal @since 2.2.0 */
|
|
418
|
+
featuresProviderKey: string;
|
|
399
419
|
/** Fetch all tenants with optional pagination/filtering */
|
|
400
420
|
fetchTenants: (params?: Saas.TenantsQueryParams) => Promise<TenantOperationResult<Saas.TenantsResponse>>;
|
|
401
421
|
/** Get a tenant by ID and set it as selected */
|
|
@@ -418,6 +438,10 @@ interface UseTenantsReturn {
|
|
|
418
438
|
setSortKey: (key: string) => void;
|
|
419
439
|
/** Set sort order */
|
|
420
440
|
setSortOrder: (order: SortOrder$1) => void;
|
|
441
|
+
/** Handle features modal visibility change @since 2.2.0 */
|
|
442
|
+
onVisibleFeaturesChange: (value: boolean) => void;
|
|
443
|
+
/** Open features modal for a tenant @since 2.2.0 */
|
|
444
|
+
openFeaturesModal: (providerKey: string) => void;
|
|
421
445
|
/** Reset state */
|
|
422
446
|
reset: () => void;
|
|
423
447
|
}
|
|
@@ -495,6 +519,10 @@ interface UseEditionsReturn {
|
|
|
495
519
|
sortOrder: SortOrder;
|
|
496
520
|
/** Usage statistics for editions */
|
|
497
521
|
usageStatistics: Record<string, number>;
|
|
522
|
+
/** Whether features modal is visible @since 2.2.0 */
|
|
523
|
+
visibleFeatures: boolean;
|
|
524
|
+
/** Provider key for features modal @since 2.2.0 */
|
|
525
|
+
featuresProviderKey: string;
|
|
498
526
|
/** Fetch all editions with optional pagination/filtering */
|
|
499
527
|
fetchEditions: (params?: Saas.EditionsQueryParams) => Promise<EditionOperationResult<Saas.EditionsResponse>>;
|
|
500
528
|
/** Get an edition by ID and set it as selected */
|
|
@@ -513,6 +541,10 @@ interface UseEditionsReturn {
|
|
|
513
541
|
setSortKey: (key: string) => void;
|
|
514
542
|
/** Set sort order */
|
|
515
543
|
setSortOrder: (order: SortOrder) => void;
|
|
544
|
+
/** Handle features modal visibility change @since 2.2.0 */
|
|
545
|
+
onVisibleFeaturesChange: (value: boolean) => void;
|
|
546
|
+
/** Open features modal for an edition @since 2.2.0 */
|
|
547
|
+
openFeaturesModal: (providerKey: string) => void;
|
|
516
548
|
/** Reset state */
|
|
517
549
|
reset: () => void;
|
|
518
550
|
}
|
|
@@ -602,4 +634,4 @@ interface EditionsComponentProps {
|
|
|
602
634
|
*/
|
|
603
635
|
declare function EditionsComponent({ onEditionCreated, onEditionUpdated, onEditionDeleted, onManageFeatures, }: EditionsComponentProps): react_jsx_runtime.JSX.Element;
|
|
604
636
|
|
|
605
|
-
export { type EditionOperationResult, EditionsComponent, type EditionsComponentProps, SAAS_ROUTES, Saas, SaasService, SaasStateService, type SortOrder$1 as SortOrder, type TenantOperationResult, TenantsComponent, type TenantsComponentProps, type UseEditionsReturn, type UseTenantsReturn, useEditions, useTenants };
|
|
637
|
+
export { type EditionOperationResult, EditionsComponent, type EditionsComponentProps, SAAS_ROUTES, Saas, SaasService, SaasStateService, type SortOrder$1 as SortOrder, type TenantOperationResult, TenantsComponent, type TenantsComponentProps, type UseEditionsReturn, type UseTenantsReturn, eSaasComponents, useEditions, useTenants };
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __export(index_exports, {
|
|
|
25
25
|
SaasService: () => SaasService,
|
|
26
26
|
SaasStateService: () => SaasStateService,
|
|
27
27
|
TenantsComponent: () => TenantsComponent,
|
|
28
|
+
eSaasComponents: () => eSaasComponents,
|
|
28
29
|
useEditions: () => useEditions,
|
|
29
30
|
useTenants: () => useTenants
|
|
30
31
|
});
|
|
@@ -56,10 +57,22 @@ var SAAS_ROUTES = {
|
|
|
56
57
|
]
|
|
57
58
|
};
|
|
58
59
|
|
|
60
|
+
// src/enums/components.ts
|
|
61
|
+
var eSaasComponents = /* @__PURE__ */ ((eSaasComponents2) => {
|
|
62
|
+
eSaasComponents2["Editions"] = "Saas.EditionsComponent";
|
|
63
|
+
eSaasComponents2["Tenants"] = "Saas.TenantsComponent";
|
|
64
|
+
return eSaasComponents2;
|
|
65
|
+
})(eSaasComponents || {});
|
|
66
|
+
|
|
59
67
|
// src/services/saas.service.ts
|
|
60
68
|
var SaasService = class {
|
|
61
69
|
constructor(restService) {
|
|
62
70
|
this.restService = restService;
|
|
71
|
+
/**
|
|
72
|
+
* API name for multi-API configurations
|
|
73
|
+
* @since 2.4.0
|
|
74
|
+
*/
|
|
75
|
+
this.apiName = "default";
|
|
63
76
|
}
|
|
64
77
|
// ==================== Tenant Operations ====================
|
|
65
78
|
/**
|
|
@@ -445,6 +458,8 @@ function useTenants() {
|
|
|
445
458
|
const [sortOrder, setSortOrder] = (0, import_react.useState)("");
|
|
446
459
|
const [defaultConnectionString, setDefaultConnectionString] = (0, import_react.useState)("");
|
|
447
460
|
const [useSharedDatabase, setUseSharedDatabase] = (0, import_react.useState)(true);
|
|
461
|
+
const [visibleFeatures, setVisibleFeatures] = (0, import_react.useState)(false);
|
|
462
|
+
const [featuresProviderKey, setFeaturesProviderKey] = (0, import_react.useState)("");
|
|
448
463
|
const fetchTenants = (0, import_react.useCallback)(
|
|
449
464
|
async (params) => {
|
|
450
465
|
setIsLoading(true);
|
|
@@ -587,6 +602,16 @@ function useTenants() {
|
|
|
587
602
|
},
|
|
588
603
|
[service]
|
|
589
604
|
);
|
|
605
|
+
const onVisibleFeaturesChange = (0, import_react.useCallback)((value) => {
|
|
606
|
+
setVisibleFeatures(value);
|
|
607
|
+
if (!value) {
|
|
608
|
+
setFeaturesProviderKey("");
|
|
609
|
+
}
|
|
610
|
+
}, []);
|
|
611
|
+
const openFeaturesModal = (0, import_react.useCallback)((providerKey) => {
|
|
612
|
+
setFeaturesProviderKey(providerKey);
|
|
613
|
+
setVisibleFeatures(true);
|
|
614
|
+
}, []);
|
|
590
615
|
const reset = (0, import_react.useCallback)(() => {
|
|
591
616
|
setTenants([]);
|
|
592
617
|
setTotalCount(0);
|
|
@@ -597,6 +622,8 @@ function useTenants() {
|
|
|
597
622
|
setSortOrder("");
|
|
598
623
|
setDefaultConnectionString("");
|
|
599
624
|
setUseSharedDatabase(true);
|
|
625
|
+
setVisibleFeatures(false);
|
|
626
|
+
setFeaturesProviderKey("");
|
|
600
627
|
}, []);
|
|
601
628
|
return {
|
|
602
629
|
tenants,
|
|
@@ -608,6 +635,8 @@ function useTenants() {
|
|
|
608
635
|
sortOrder,
|
|
609
636
|
defaultConnectionString,
|
|
610
637
|
useSharedDatabase,
|
|
638
|
+
visibleFeatures,
|
|
639
|
+
featuresProviderKey,
|
|
611
640
|
fetchTenants,
|
|
612
641
|
getTenantById,
|
|
613
642
|
createTenant,
|
|
@@ -619,6 +648,8 @@ function useTenants() {
|
|
|
619
648
|
setSelectedTenant,
|
|
620
649
|
setSortKey,
|
|
621
650
|
setSortOrder,
|
|
651
|
+
onVisibleFeaturesChange,
|
|
652
|
+
openFeaturesModal,
|
|
622
653
|
reset
|
|
623
654
|
};
|
|
624
655
|
}
|
|
@@ -637,6 +668,8 @@ function useEditions() {
|
|
|
637
668
|
const [sortKey, setSortKey] = (0, import_react2.useState)("displayName");
|
|
638
669
|
const [sortOrder, setSortOrder] = (0, import_react2.useState)("");
|
|
639
670
|
const [usageStatistics, setUsageStatistics] = (0, import_react2.useState)({});
|
|
671
|
+
const [visibleFeatures, setVisibleFeatures] = (0, import_react2.useState)(false);
|
|
672
|
+
const [featuresProviderKey, setFeaturesProviderKey] = (0, import_react2.useState)("");
|
|
640
673
|
const fetchEditions = (0, import_react2.useCallback)(
|
|
641
674
|
async (params) => {
|
|
642
675
|
setIsLoading(true);
|
|
@@ -740,6 +773,16 @@ function useEditions() {
|
|
|
740
773
|
},
|
|
741
774
|
[service]
|
|
742
775
|
);
|
|
776
|
+
const onVisibleFeaturesChange = (0, import_react2.useCallback)((value) => {
|
|
777
|
+
setVisibleFeatures(value);
|
|
778
|
+
if (!value) {
|
|
779
|
+
setFeaturesProviderKey("");
|
|
780
|
+
}
|
|
781
|
+
}, []);
|
|
782
|
+
const openFeaturesModal = (0, import_react2.useCallback)((providerKey) => {
|
|
783
|
+
setFeaturesProviderKey(providerKey);
|
|
784
|
+
setVisibleFeatures(true);
|
|
785
|
+
}, []);
|
|
743
786
|
const reset = (0, import_react2.useCallback)(() => {
|
|
744
787
|
setEditions([]);
|
|
745
788
|
setTotalCount(0);
|
|
@@ -749,6 +792,8 @@ function useEditions() {
|
|
|
749
792
|
setSortKey("displayName");
|
|
750
793
|
setSortOrder("");
|
|
751
794
|
setUsageStatistics({});
|
|
795
|
+
setVisibleFeatures(false);
|
|
796
|
+
setFeaturesProviderKey("");
|
|
752
797
|
}, []);
|
|
753
798
|
return {
|
|
754
799
|
editions,
|
|
@@ -759,6 +804,8 @@ function useEditions() {
|
|
|
759
804
|
sortKey,
|
|
760
805
|
sortOrder,
|
|
761
806
|
usageStatistics,
|
|
807
|
+
visibleFeatures,
|
|
808
|
+
featuresProviderKey,
|
|
762
809
|
fetchEditions,
|
|
763
810
|
getEditionById,
|
|
764
811
|
createEdition,
|
|
@@ -768,6 +815,8 @@ function useEditions() {
|
|
|
768
815
|
setSelectedEdition,
|
|
769
816
|
setSortKey,
|
|
770
817
|
setSortOrder,
|
|
818
|
+
onVisibleFeaturesChange,
|
|
819
|
+
openFeaturesModal,
|
|
771
820
|
reset
|
|
772
821
|
};
|
|
773
822
|
}
|
|
@@ -811,6 +860,8 @@ function TenantsComponent({
|
|
|
811
860
|
const [filter, setFilter] = (0, import_react3.useState)("");
|
|
812
861
|
const [tenantName, setTenantName] = (0, import_react3.useState)("");
|
|
813
862
|
const [tenantEditionId, setTenantEditionId] = (0, import_react3.useState)("");
|
|
863
|
+
const [adminEmailAddress, setAdminEmailAddress] = (0, import_react3.useState)("");
|
|
864
|
+
const [adminPassword, setAdminPassword] = (0, import_react3.useState)("");
|
|
814
865
|
const [connStringUseShared, setConnStringUseShared] = (0, import_react3.useState)(true);
|
|
815
866
|
const [connString, setConnString] = (0, import_react3.useState)("");
|
|
816
867
|
(0, import_react3.useEffect)(() => {
|
|
@@ -837,6 +888,8 @@ function TenantsComponent({
|
|
|
837
888
|
setSelectedTenant(null);
|
|
838
889
|
setTenantName("");
|
|
839
890
|
setTenantEditionId("");
|
|
891
|
+
setAdminEmailAddress("");
|
|
892
|
+
setAdminPassword("");
|
|
840
893
|
setModalType("tenant");
|
|
841
894
|
setModalVisible(true);
|
|
842
895
|
}, [setSelectedTenant]);
|
|
@@ -909,6 +962,8 @@ function TenantsComponent({
|
|
|
909
962
|
}
|
|
910
963
|
} else {
|
|
911
964
|
const result = await createTenant({
|
|
965
|
+
adminEmailAddress,
|
|
966
|
+
adminPassword,
|
|
912
967
|
name: tenantName,
|
|
913
968
|
editionId: tenantEditionId || void 0
|
|
914
969
|
});
|
|
@@ -929,6 +984,8 @@ function TenantsComponent({
|
|
|
929
984
|
}, [
|
|
930
985
|
tenantName,
|
|
931
986
|
tenantEditionId,
|
|
987
|
+
adminEmailAddress,
|
|
988
|
+
adminPassword,
|
|
932
989
|
selectedTenant,
|
|
933
990
|
updateTenant,
|
|
934
991
|
createTenant,
|
|
@@ -1098,7 +1155,27 @@ function TenantsComponent({
|
|
|
1098
1155
|
editions.map((edition) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: edition.id, children: edition.displayName }, edition.id))
|
|
1099
1156
|
]
|
|
1100
1157
|
}
|
|
1101
|
-
) }) })
|
|
1158
|
+
) }) }),
|
|
1159
|
+
!selectedTenant && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1160
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_theme_shared.FormField, { label: t("Saas::AdminEmailAddress"), required: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1161
|
+
import_react4.Input,
|
|
1162
|
+
{
|
|
1163
|
+
type: "email",
|
|
1164
|
+
value: adminEmailAddress,
|
|
1165
|
+
onChange: (e) => setAdminEmailAddress(e.target.value),
|
|
1166
|
+
placeholder: t("Saas::AdminEmailAddress")
|
|
1167
|
+
}
|
|
1168
|
+
) }),
|
|
1169
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_theme_shared.FormField, { label: t("Saas::AdminPassword"), required: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1170
|
+
import_react4.Input,
|
|
1171
|
+
{
|
|
1172
|
+
type: "password",
|
|
1173
|
+
value: adminPassword,
|
|
1174
|
+
onChange: (e) => setAdminPassword(e.target.value),
|
|
1175
|
+
placeholder: t("Saas::AdminPassword")
|
|
1176
|
+
}
|
|
1177
|
+
) })
|
|
1178
|
+
] })
|
|
1102
1179
|
] }),
|
|
1103
1180
|
modalType === "connectionString" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react4.VStack, { gap: 4, align: "stretch", children: [
|
|
1104
1181
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react4.Flex, { alignItems: "center", gap: 2, children: [
|
|
@@ -1384,6 +1461,7 @@ function EditionsComponent({
|
|
|
1384
1461
|
SaasService,
|
|
1385
1462
|
SaasStateService,
|
|
1386
1463
|
TenantsComponent,
|
|
1464
|
+
eSaasComponents,
|
|
1387
1465
|
useEditions,
|
|
1388
1466
|
useTenants
|
|
1389
1467
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -24,10 +24,22 @@ var SAAS_ROUTES = {
|
|
|
24
24
|
]
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
// src/enums/components.ts
|
|
28
|
+
var eSaasComponents = /* @__PURE__ */ ((eSaasComponents2) => {
|
|
29
|
+
eSaasComponents2["Editions"] = "Saas.EditionsComponent";
|
|
30
|
+
eSaasComponents2["Tenants"] = "Saas.TenantsComponent";
|
|
31
|
+
return eSaasComponents2;
|
|
32
|
+
})(eSaasComponents || {});
|
|
33
|
+
|
|
27
34
|
// src/services/saas.service.ts
|
|
28
35
|
var SaasService = class {
|
|
29
36
|
constructor(restService) {
|
|
30
37
|
this.restService = restService;
|
|
38
|
+
/**
|
|
39
|
+
* API name for multi-API configurations
|
|
40
|
+
* @since 2.4.0
|
|
41
|
+
*/
|
|
42
|
+
this.apiName = "default";
|
|
31
43
|
}
|
|
32
44
|
// ==================== Tenant Operations ====================
|
|
33
45
|
/**
|
|
@@ -413,6 +425,8 @@ function useTenants() {
|
|
|
413
425
|
const [sortOrder, setSortOrder] = useState("");
|
|
414
426
|
const [defaultConnectionString, setDefaultConnectionString] = useState("");
|
|
415
427
|
const [useSharedDatabase, setUseSharedDatabase] = useState(true);
|
|
428
|
+
const [visibleFeatures, setVisibleFeatures] = useState(false);
|
|
429
|
+
const [featuresProviderKey, setFeaturesProviderKey] = useState("");
|
|
416
430
|
const fetchTenants = useCallback(
|
|
417
431
|
async (params) => {
|
|
418
432
|
setIsLoading(true);
|
|
@@ -555,6 +569,16 @@ function useTenants() {
|
|
|
555
569
|
},
|
|
556
570
|
[service]
|
|
557
571
|
);
|
|
572
|
+
const onVisibleFeaturesChange = useCallback((value) => {
|
|
573
|
+
setVisibleFeatures(value);
|
|
574
|
+
if (!value) {
|
|
575
|
+
setFeaturesProviderKey("");
|
|
576
|
+
}
|
|
577
|
+
}, []);
|
|
578
|
+
const openFeaturesModal = useCallback((providerKey) => {
|
|
579
|
+
setFeaturesProviderKey(providerKey);
|
|
580
|
+
setVisibleFeatures(true);
|
|
581
|
+
}, []);
|
|
558
582
|
const reset = useCallback(() => {
|
|
559
583
|
setTenants([]);
|
|
560
584
|
setTotalCount(0);
|
|
@@ -565,6 +589,8 @@ function useTenants() {
|
|
|
565
589
|
setSortOrder("");
|
|
566
590
|
setDefaultConnectionString("");
|
|
567
591
|
setUseSharedDatabase(true);
|
|
592
|
+
setVisibleFeatures(false);
|
|
593
|
+
setFeaturesProviderKey("");
|
|
568
594
|
}, []);
|
|
569
595
|
return {
|
|
570
596
|
tenants,
|
|
@@ -576,6 +602,8 @@ function useTenants() {
|
|
|
576
602
|
sortOrder,
|
|
577
603
|
defaultConnectionString,
|
|
578
604
|
useSharedDatabase,
|
|
605
|
+
visibleFeatures,
|
|
606
|
+
featuresProviderKey,
|
|
579
607
|
fetchTenants,
|
|
580
608
|
getTenantById,
|
|
581
609
|
createTenant,
|
|
@@ -587,6 +615,8 @@ function useTenants() {
|
|
|
587
615
|
setSelectedTenant,
|
|
588
616
|
setSortKey,
|
|
589
617
|
setSortOrder,
|
|
618
|
+
onVisibleFeaturesChange,
|
|
619
|
+
openFeaturesModal,
|
|
590
620
|
reset
|
|
591
621
|
};
|
|
592
622
|
}
|
|
@@ -605,6 +635,8 @@ function useEditions() {
|
|
|
605
635
|
const [sortKey, setSortKey] = useState2("displayName");
|
|
606
636
|
const [sortOrder, setSortOrder] = useState2("");
|
|
607
637
|
const [usageStatistics, setUsageStatistics] = useState2({});
|
|
638
|
+
const [visibleFeatures, setVisibleFeatures] = useState2(false);
|
|
639
|
+
const [featuresProviderKey, setFeaturesProviderKey] = useState2("");
|
|
608
640
|
const fetchEditions = useCallback2(
|
|
609
641
|
async (params) => {
|
|
610
642
|
setIsLoading(true);
|
|
@@ -708,6 +740,16 @@ function useEditions() {
|
|
|
708
740
|
},
|
|
709
741
|
[service]
|
|
710
742
|
);
|
|
743
|
+
const onVisibleFeaturesChange = useCallback2((value) => {
|
|
744
|
+
setVisibleFeatures(value);
|
|
745
|
+
if (!value) {
|
|
746
|
+
setFeaturesProviderKey("");
|
|
747
|
+
}
|
|
748
|
+
}, []);
|
|
749
|
+
const openFeaturesModal = useCallback2((providerKey) => {
|
|
750
|
+
setFeaturesProviderKey(providerKey);
|
|
751
|
+
setVisibleFeatures(true);
|
|
752
|
+
}, []);
|
|
711
753
|
const reset = useCallback2(() => {
|
|
712
754
|
setEditions([]);
|
|
713
755
|
setTotalCount(0);
|
|
@@ -717,6 +759,8 @@ function useEditions() {
|
|
|
717
759
|
setSortKey("displayName");
|
|
718
760
|
setSortOrder("");
|
|
719
761
|
setUsageStatistics({});
|
|
762
|
+
setVisibleFeatures(false);
|
|
763
|
+
setFeaturesProviderKey("");
|
|
720
764
|
}, []);
|
|
721
765
|
return {
|
|
722
766
|
editions,
|
|
@@ -727,6 +771,8 @@ function useEditions() {
|
|
|
727
771
|
sortKey,
|
|
728
772
|
sortOrder,
|
|
729
773
|
usageStatistics,
|
|
774
|
+
visibleFeatures,
|
|
775
|
+
featuresProviderKey,
|
|
730
776
|
fetchEditions,
|
|
731
777
|
getEditionById,
|
|
732
778
|
createEdition,
|
|
@@ -736,6 +782,8 @@ function useEditions() {
|
|
|
736
782
|
setSelectedEdition,
|
|
737
783
|
setSortKey,
|
|
738
784
|
setSortOrder,
|
|
785
|
+
onVisibleFeaturesChange,
|
|
786
|
+
openFeaturesModal,
|
|
739
787
|
reset
|
|
740
788
|
};
|
|
741
789
|
}
|
|
@@ -755,7 +803,7 @@ import {
|
|
|
755
803
|
Badge
|
|
756
804
|
} from "@chakra-ui/react";
|
|
757
805
|
import { NativeSelectRoot, NativeSelectField } from "@chakra-ui/react";
|
|
758
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
806
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
759
807
|
function TenantsComponent({
|
|
760
808
|
onTenantCreated,
|
|
761
809
|
onTenantUpdated,
|
|
@@ -788,6 +836,8 @@ function TenantsComponent({
|
|
|
788
836
|
const [filter, setFilter] = useState3("");
|
|
789
837
|
const [tenantName, setTenantName] = useState3("");
|
|
790
838
|
const [tenantEditionId, setTenantEditionId] = useState3("");
|
|
839
|
+
const [adminEmailAddress, setAdminEmailAddress] = useState3("");
|
|
840
|
+
const [adminPassword, setAdminPassword] = useState3("");
|
|
791
841
|
const [connStringUseShared, setConnStringUseShared] = useState3(true);
|
|
792
842
|
const [connString, setConnString] = useState3("");
|
|
793
843
|
useEffect(() => {
|
|
@@ -814,6 +864,8 @@ function TenantsComponent({
|
|
|
814
864
|
setSelectedTenant(null);
|
|
815
865
|
setTenantName("");
|
|
816
866
|
setTenantEditionId("");
|
|
867
|
+
setAdminEmailAddress("");
|
|
868
|
+
setAdminPassword("");
|
|
817
869
|
setModalType("tenant");
|
|
818
870
|
setModalVisible(true);
|
|
819
871
|
}, [setSelectedTenant]);
|
|
@@ -886,6 +938,8 @@ function TenantsComponent({
|
|
|
886
938
|
}
|
|
887
939
|
} else {
|
|
888
940
|
const result = await createTenant({
|
|
941
|
+
adminEmailAddress,
|
|
942
|
+
adminPassword,
|
|
889
943
|
name: tenantName,
|
|
890
944
|
editionId: tenantEditionId || void 0
|
|
891
945
|
});
|
|
@@ -906,6 +960,8 @@ function TenantsComponent({
|
|
|
906
960
|
}, [
|
|
907
961
|
tenantName,
|
|
908
962
|
tenantEditionId,
|
|
963
|
+
adminEmailAddress,
|
|
964
|
+
adminPassword,
|
|
909
965
|
selectedTenant,
|
|
910
966
|
updateTenant,
|
|
911
967
|
createTenant,
|
|
@@ -1075,7 +1131,27 @@ function TenantsComponent({
|
|
|
1075
1131
|
editions.map((edition) => /* @__PURE__ */ jsx("option", { value: edition.id, children: edition.displayName }, edition.id))
|
|
1076
1132
|
]
|
|
1077
1133
|
}
|
|
1078
|
-
) }) })
|
|
1134
|
+
) }) }),
|
|
1135
|
+
!selectedTenant && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1136
|
+
/* @__PURE__ */ jsx(FormField, { label: t("Saas::AdminEmailAddress"), required: true, children: /* @__PURE__ */ jsx(
|
|
1137
|
+
Input,
|
|
1138
|
+
{
|
|
1139
|
+
type: "email",
|
|
1140
|
+
value: adminEmailAddress,
|
|
1141
|
+
onChange: (e) => setAdminEmailAddress(e.target.value),
|
|
1142
|
+
placeholder: t("Saas::AdminEmailAddress")
|
|
1143
|
+
}
|
|
1144
|
+
) }),
|
|
1145
|
+
/* @__PURE__ */ jsx(FormField, { label: t("Saas::AdminPassword"), required: true, children: /* @__PURE__ */ jsx(
|
|
1146
|
+
Input,
|
|
1147
|
+
{
|
|
1148
|
+
type: "password",
|
|
1149
|
+
value: adminPassword,
|
|
1150
|
+
onChange: (e) => setAdminPassword(e.target.value),
|
|
1151
|
+
placeholder: t("Saas::AdminPassword")
|
|
1152
|
+
}
|
|
1153
|
+
) })
|
|
1154
|
+
] })
|
|
1079
1155
|
] }),
|
|
1080
1156
|
modalType === "connectionString" && /* @__PURE__ */ jsxs(VStack, { gap: 4, align: "stretch", children: [
|
|
1081
1157
|
/* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, children: [
|
|
@@ -1368,6 +1444,7 @@ export {
|
|
|
1368
1444
|
SaasService,
|
|
1369
1445
|
SaasStateService,
|
|
1370
1446
|
TenantsComponent,
|
|
1447
|
+
eSaasComponents,
|
|
1371
1448
|
useEditions,
|
|
1372
1449
|
useTenants
|
|
1373
1450
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abpjs/saas",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "ABP Framework SaaS components for React - translated from @volo/abp.ng.saas",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@chakra-ui/react": "^3.2.0",
|
|
29
29
|
"@emotion/react": "^11.11.0",
|
|
30
|
-
"@abpjs/core": "2.
|
|
31
|
-
"@abpjs/theme-shared": "2.
|
|
32
|
-
"@abpjs/feature-management": "2.
|
|
30
|
+
"@abpjs/core": "2.4.0",
|
|
31
|
+
"@abpjs/theme-shared": "2.4.0",
|
|
32
|
+
"@abpjs/feature-management": "2.4.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@volo/abp.ng.saas": "2.
|
|
35
|
+
"@volo/abp.ng.saas": "2.4.0",
|
|
36
36
|
"@testing-library/jest-dom": "^6.9.1",
|
|
37
37
|
"@testing-library/react": "^14.0.0",
|
|
38
38
|
"@testing-library/user-event": "^14.6.1",
|