@ieeesa-npm/tenants 0.1.4 → 0.1.6

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.
@@ -1,10 +1,11 @@
1
1
  import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
- import { AlignType, CheckboxOption, FormGrid, RadioOption, FormModel, AllowedFileTypes, FileUploadService, DynamicFormComponent } from '@ieeesa-npm/presentation';
2
+ import { AlignType, CheckboxOption, FormGrid, AllowedFileTypes, FileUploadService, RadioOption, DynamicFormComponent, FormModel } from '@ieeesa-npm/presentation';
3
3
  import { Subject } from 'rxjs';
4
4
  import { FormGroup } from '@angular/forms';
5
5
  import { TenantApplicationsService } from '../../services/tenant-applications.service';
6
- import { CreateTenantRequestPayload } from '../../models/tenant.model';
6
+ import { CreateTenantRequestPayload, NewTenantInfo, TenantBasicInfo } from '../../models/tenant.model';
7
7
  import { SharedService } from '@ieeesa-npm/shared';
8
+ import { TenantFunctionType } from '../../models/tenant-function-type.model';
8
9
  import * as i0 from "@angular/core";
9
10
  export declare class CreateTenantApplicationComponent implements OnInit, OnDestroy {
10
11
  fileUploadService: FileUploadService;
@@ -31,6 +32,10 @@ export declare class CreateTenantApplicationComponent implements OnInit, OnDestr
31
32
  allowedFileTypes: AllowedFileTypes[];
32
33
  selectedColor: string;
33
34
  selectedAppTypeOption: RadioOption;
35
+ tenantFunctionType: TenantFunctionType;
36
+ selectedTenantInfo: TenantBasicInfo | undefined;
37
+ isAppLogoModified: boolean;
38
+ updatedTenantBasicInfo: NewTenantInfo;
34
39
  constructor(fileUploadService: FileUploadService, tenantAppService: TenantApplicationsService, sharedService: SharedService);
35
40
  ngOnInit(): void;
36
41
  /**
@@ -49,11 +54,21 @@ export declare class CreateTenantApplicationComponent implements OnInit, OnDestr
49
54
  */
50
55
  initializeCreateTenantFormGroup(): void;
51
56
  /**
52
- * Creates tenant on form submission.
57
+ * Creates Payload and gets presigned url for file upload on form submission.
53
58
  * @param {FormGroup[]} form
54
59
  * @memberof CreateTenantApplicationComponent
55
60
  */
56
61
  onCreateTenantFormSubmit(form: FormGroup[]): void;
62
+ /**
63
+ * Creates a new tenant on form submission.
64
+ * @memberof CreateTenantApplicationComponent
65
+ */
66
+ createTenant(): void;
67
+ /**
68
+ * Updates the modified tenant information on form submission.
69
+ * @memberof CreateTenantApplicationComponent
70
+ */
71
+ editTenant(): void;
57
72
  /**
58
73
  * Constructs create tenant payload from the form data and returns.
59
74
  * @param {*} formData
@@ -68,7 +83,7 @@ export declare class CreateTenantApplicationComponent implements OnInit, OnDestr
68
83
  */
69
84
  getCreateTenantFormGroupRef(form: FormGroup[]): void;
70
85
  /**
71
- * Updates createTenantFormGroupRef on add tenant form change event.
86
+ * Updates createTenantFormGroupRef on add or edit tenant form change event.
72
87
  * @param {FormGroup[]} form
73
88
  * @memberof CreateTenantApplicationComponent
74
89
  */
@@ -2,14 +2,14 @@ import { OnDestroy, OnInit } from '@angular/core';
2
2
  import { BreakpointObserverService, GlobalErrorHandlerService } from '@ieeesa-npm/utility';
3
3
  import { AccordionInfo, Menu, PaginatorConfig, TableActions, AlignType, SlideToggleOption, TableColumnSchema } from '@ieeesa-npm/presentation';
4
4
  import { Subject } from 'rxjs';
5
- import { TenantInfo } from '../../models/tenants.model';
6
5
  import { TenantApplicationsService } from '../../services/tenant-applications.service';
7
6
  import { UserPermission } from '../../models/tenants-permission.model';
8
7
  import { SharedService } from '@ieeesa-npm/shared';
9
8
  import { TenantsRoutesConfig } from '../../models/route-config.model';
10
- import { GetRolesAndPermissionsPayload, RolesAndPermissions } from '../../models/roles-and-permissions.model';
9
+ import { TenantBasicInfo } from '../../models/tenant.model';
11
10
  import { PageEvent } from '@angular/material/paginator';
12
11
  import { MatDialog } from '@angular/material/dialog';
12
+ import { GetRolesAndPermissionsPayload, RolesAndPermissions } from '../../models/roles-and-permissions.model';
13
13
  import * as i0 from "@angular/core";
14
14
  export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
15
15
  dialog: MatDialog;
@@ -30,7 +30,7 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
30
30
  checked: boolean;
31
31
  disabled: boolean;
32
32
  };
33
- tenantDetails: TenantInfo;
33
+ tenantDetails: TenantBasicInfo;
34
34
  accordionInfoList: AccordionInfo[];
35
35
  appId: string;
36
36
  iconSize: any;
@@ -45,8 +45,9 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
45
45
  paginatorConfig: PaginatorConfig;
46
46
  tableActions: TableActions;
47
47
  viewTenantsRouteUrl: string;
48
- alignmentType: typeof AlignType;
49
48
  dialogRef: any;
49
+ editTenantScreenTexts: any;
50
+ alignmentType: typeof AlignType;
50
51
  constructor(dialog: MatDialog, breakpointObserverService: BreakpointObserverService, tenantAppService: TenantApplicationsService, globalErrorHandlerService: GlobalErrorHandlerService, sharedService: SharedService);
51
52
  /**
52
53
  * Initializes view tenant details component.
@@ -88,6 +89,20 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
88
89
  * @memberof ViewTenantDetailsComponent
89
90
  */
90
91
  trackByAccordionFn(index: number, item: AccordionInfo): number;
92
+ /**
93
+ * Sets the dialog options for edit tenant modal and calls openModal method.
94
+ * @return -returns nothing
95
+ * @memberof ViewTenantDetailsComponent
96
+ */
97
+ openEditTenantForm(): void;
98
+ /**
99
+ * Opens modal component with received params and handles form submission success and errors.
100
+ * @param {*} dialogOptions
101
+ * @param {string} [className]
102
+ * @return -returns nothing
103
+ * @memberof ViewTenantsDetailsComponent
104
+ */
105
+ openModal(dialogOptions: any, className?: string): void;
91
106
  /**
92
107
  * Calls openTenantStatusConfirmationModal to change the status of tenant on slide toggle change.
93
108
  * @param {SlideToggleOption} slideToggleOption
@@ -1,6 +1,5 @@
1
1
  import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
2
  import { PaginatorConfig, TableActions, TableColumnSchema } from '@ieeesa-npm/presentation';
3
- import { FeatureInfo, TenantInfo } from '../../models/tenants.model';
4
3
  import { Subject } from 'rxjs';
5
4
  import { AlertsService, BreakpointObserverService } from '@ieeesa-npm/utility';
6
5
  import { TenantsRoutesConfig } from '../../models/route-config.model';
@@ -13,6 +12,8 @@ import { PermissionType } from '../../models/permission-type.model';
13
12
  import { TenantsPermissions, UserPermission } from '../../models/tenants-permission.model';
14
13
  import { GetTenantsPayload } from '../../models/table-column-schema-view-tenant-list.model';
15
14
  import { MatDialog } from '@angular/material/dialog';
15
+ import { TenantBasicInfo } from '../../models/tenant.model';
16
+ import { Features } from '../../models/features.model';
16
17
  import * as i0 from "@angular/core";
17
18
  export declare class ViewTenantsListComponent implements OnInit, OnDestroy {
18
19
  dialog: MatDialog;
@@ -33,8 +34,8 @@ export declare class ViewTenantsListComponent implements OnInit, OnDestroy {
33
34
  userPermissions: UserPermission[];
34
35
  defaultSortedColumn: string;
35
36
  createTenant: EventEmitter<any>;
36
- viewTenantsDetails: EventEmitter<TenantInfo>;
37
- tableData: TenantInfo[];
37
+ viewTenantsDetails: EventEmitter<TenantBasicInfo>;
38
+ tableData: TenantBasicInfo[];
38
39
  columnSchema: TableColumnSchema[];
39
40
  tableActions: TableActions;
40
41
  tableColumns: any;
@@ -67,7 +68,7 @@ export declare class ViewTenantsListComponent implements OnInit, OnDestroy {
67
68
  * Format the features name in to single sentence with comma separated.
68
69
  * @memberof ViewTenantsListComponent
69
70
  */
70
- formatFeaturesName(features: FeatureInfo[]): string;
71
+ formatFeaturesName(features: Features[]): string;
71
72
  /**
72
73
  * Fetching details of tenants and initialize table view
73
74
  * @param {GetTenantsPayload} payload
@@ -113,7 +114,7 @@ export declare class ViewTenantsListComponent implements OnInit, OnDestroy {
113
114
  * Navigates to view tenants detail component
114
115
  * @memberof ViewTenantsListComponent
115
116
  */
116
- navigateToViewTenantDetails(tenantInfo: TenantInfo): void;
117
+ navigateToViewTenantDetails(tenantInfo: TenantBasicInfo): void;
117
118
  /**
118
119
  * NgOnDestroy performs necessary cleanup tasks, such as unsubscribing from subscription when the component is being destroyed.
119
120
  * @memberof ViewTenantsListComponent
@@ -0,0 +1,4 @@
1
+ export declare enum TenantFunctionType {
2
+ CREATE = "CREATE",
3
+ EDIT = "EDIT"
4
+ }
@@ -1,18 +1,24 @@
1
- import { FeatureId } from './features.model';
2
- export interface TenantBasicInfo {
1
+ import { FeatureId, Features } from './features.model';
2
+ export interface TenantInfo {
3
3
  appId: string;
4
4
  appTitle: string;
5
- appLogo: string;
5
+ appLogo?: string;
6
6
  appHeading: string;
7
7
  appDescription: string;
8
- backgroundColor: string;
9
- appHelpLink: string;
10
- appType: string;
11
- appDomainUrl: string;
12
- features: FeatureId[];
8
+ backgroundColor?: string;
9
+ appHelpLink?: string;
10
+ appType?: string;
11
+ appDomainUrl?: string;
12
+ }
13
+ export interface NewTenantInfo extends TenantInfo {
14
+ features: FeatureId[] | Features[];
15
+ }
16
+ export interface TenantBasicInfo extends TenantInfo {
17
+ status?: boolean;
18
+ features: Features[];
13
19
  }
14
20
  export interface CreateTenantRequestPayload {
15
- payload: TenantBasicInfo;
21
+ payload: NewTenantInfo;
16
22
  }
17
23
  export interface CreateTenantResponse {
18
24
  status: boolean;
@@ -21,3 +27,20 @@ export interface CreateTenantResponse {
21
27
  errorCodes: string[];
22
28
  };
23
29
  }
30
+ export interface GetTenantsResponse {
31
+ status: boolean;
32
+ message: string;
33
+ body?: {
34
+ totalRecords: number;
35
+ appDetails: TenantBasicInfo[] | null | {
36
+ errorCodes: string[];
37
+ };
38
+ };
39
+ }
40
+ export interface TenantDetailsResponse {
41
+ status: boolean;
42
+ message: string;
43
+ body?: TenantBasicInfo | {
44
+ errorCodes: string[];
45
+ };
46
+ }
@@ -1,15 +1,15 @@
1
1
  import { HttpService } from '@ieeesa-npm/utility';
2
2
  import { Observable } from 'rxjs';
3
- import { GetTenantsResponse, TenantInfo, TenantDetailsResponse } from '../models/tenants.model';
4
3
  import { GetTenantsPayload } from '../models/table-column-schema-view-tenant-list.model';
5
4
  import { TenantsPermissions, UserPermission } from '../models/tenants-permission.model';
6
5
  import { PermissionType } from '../models/permission-type.model';
7
6
  import { TenantPermissionsMapService } from './tenant-permissions-map.service';
8
- import { CreateTenantRequestPayload, CreateTenantResponse, TenantBasicInfo } from '../models/tenant.model';
7
+ import { CreateTenantRequestPayload, CreateTenantResponse, GetTenantsResponse, NewTenantInfo, TenantBasicInfo, TenantDetailsResponse } from '../models/tenant.model';
9
8
  import { CheckboxOption, RadioOption } from '@ieeesa-npm/presentation';
10
9
  import { FeatureId, Features, GetFeaturesResponse } from '../models/features.model';
11
10
  import { AppTypeConfig, GetAppTypesResponse } from '../models/app-type-config.model';
12
11
  import { TenantPermissionsService } from './tenant-permissions.service';
12
+ import { TenantFunctionType } from '../models/tenant-function-type.model';
13
13
  import { GetRolesAndPermissionsPayload, GetRolesAndPermissionsResponse, GetRolesResponse } from '../models/roles-and-permissions.model';
14
14
  import { UpdateTenantStatusRequestPayload, UpdateTenantStatusResponse } from '../models/update-tenant-status.model';
15
15
  import * as i0 from "@angular/core";
@@ -24,9 +24,8 @@ export declare class TenantApplicationsService {
24
24
  };
25
25
  apiBaseUrl: string;
26
26
  userPermission: UserPermission[];
27
- selectedTenantInfo: TenantInfo | undefined;
27
+ selectedTenantInfo: TenantBasicInfo | undefined;
28
28
  userTenantsPermissions: TenantsPermissions[];
29
- tenantsInfo: TenantInfo;
30
29
  createTenantsText: {
31
30
  "2003": string;
32
31
  "2026": string;
@@ -52,10 +51,15 @@ export declare class TenantApplicationsService {
52
51
  "2047": string;
53
52
  "2048": string;
54
53
  "2049": string;
54
+ "2050": string;
55
+ "2052": string;
56
+ "2053": string;
55
57
  };
56
- tenantBasicInfo: TenantBasicInfo;
58
+ newTenantInfo: NewTenantInfo;
59
+ tenantFunctionType: TenantFunctionType;
57
60
  radioOptions: RadioOption[];
58
61
  checkBoxOptions: CheckboxOption[];
62
+ featureList: Features[];
59
63
  constructor(httpService: HttpService, tenantPermissionsService: TenantPermissionsService, tenantPermissionsMapService: TenantPermissionsMapService);
60
64
  setAppConfig(apiBaseUrl: string, userPermission: UserPermission[]): void;
61
65
  /**
@@ -79,16 +83,16 @@ export declare class TenantApplicationsService {
79
83
  getUserTenantsPermissions(): TenantsPermissions[];
80
84
  /**
81
85
  * Sets the user tenants information
82
- * @param {TenantInfo} tenantInfo
86
+ * @param {TenantBasicInfo} tenantInfo
83
87
  * @memberof TenantApplicationsService
84
88
  */
85
- setSelectedTenantInformation(tenantInfo: TenantInfo): void;
89
+ setSelectedTenantInformation(tenantInfo: TenantBasicInfo): void;
86
90
  /**
87
91
  * Returns the tenants information
88
- * @return {TenantInfo}
92
+ * @return {TenantBasicInfo}
89
93
  * @memberof TenantApplicationsService
90
94
  */
91
- getSelectedTenantInformation(): TenantInfo | undefined;
95
+ getSelectedTenantInformation(): TenantBasicInfo | undefined;
92
96
  /**
93
97
  * Filter permissions
94
98
  * @param usersPermissions
@@ -162,14 +166,31 @@ export declare class TenantApplicationsService {
162
166
  */
163
167
  getFeatureIds(featureOptions: CheckboxOption[]): FeatureId[];
164
168
  /**
165
- * Sets the tenant basic information.
166
- * @param {CreateTenantRequestPayload} createTenantPayload
169
+ * Sets the newly created tenant information.
170
+ * @param {NewTenantInfo} newTenantInfo
171
+ */
172
+ setNewTenantInfo(newTenantInfo: NewTenantInfo): void;
173
+ /**
174
+ * Returns the newly created tenant information.
175
+ */
176
+ get getNewTenantInfo(): NewTenantInfo;
177
+ /**
178
+ * Sets tenant function type.
179
+ * @param {TenantFunctionType} tenantFunctionType -tenant function type.
180
+ */
181
+ setTenantFunctionType(tenantFunctionType: TenantFunctionType): void;
182
+ /**
183
+ * Returns tenant function type.
184
+ * @return {TenantFunctionType} -tenant function type.
167
185
  */
168
- setTenantBasicInfo(createTenantPayload: CreateTenantRequestPayload): void;
186
+ getTenantFunctionType(): TenantFunctionType;
169
187
  /**
170
- * Returns the tenant basic information.
188
+ * Posts the edited tenant application form data to server using HttpService for updating the tenant information.
189
+ * @param {CreateTenantPayload} editTenantPayload
190
+ * @return {Observable<CreateTenantResponse>}
191
+ * @memberof TenantApplicationsService
171
192
  */
172
- get getTenantBasicInfo(): TenantBasicInfo;
193
+ editTenant(editTenantPayload: CreateTenantRequestPayload): Observable<CreateTenantResponse>;
173
194
  /**
174
195
  * Sends update request to the server to update the tenant application status to active/inactive using HttpService and returns the success or failure response.
175
196
  * @param {UpdateTenantStatusRequestPayload} updateTenantStatusPayload
@@ -177,6 +198,13 @@ export declare class TenantApplicationsService {
177
198
  * @memberof TenantApplicationsService
178
199
  */
179
200
  updateTenantStatus(updateTenantStatusPayload: UpdateTenantStatusRequestPayload): Observable<UpdateTenantStatusResponse>;
201
+ /**
202
+ * It generates Feature list from checkbox options generated in form array.
203
+ * @param {CheckboxOption[]} features
204
+ * @return {Features[]}
205
+ * @memberof TenantApplicationsService
206
+ */
207
+ getFeaturesList(features: CheckboxOption[]): Features[];
180
208
  static ɵfac: i0.ɵɵFactoryDeclaration<TenantApplicationsService, never>;
181
209
  static ɵprov: i0.ɵɵInjectableDeclaration<TenantApplicationsService>;
182
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ieeesa-npm/tenants",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^16.1.0",
6
6
  "@angular/core": "^16.1.0"
package/public-api.d.ts CHANGED
@@ -5,7 +5,6 @@ export * from './lib/tenant-applications.component';
5
5
  export * from './lib/models/app-type-config.model';
6
6
  export * from './lib/models/app-type.model';
7
7
  export * from './lib/models/tenant.model';
8
- export * from './lib/models/tenants.model';
9
8
  export * from './lib/models/features.model';
10
9
  export * from './lib/models/form-status.model';
11
10
  export * from './lib/models/permission-type.model';
@@ -14,6 +13,7 @@ export * from './lib/models/route-config.model';
14
13
  export * from './lib/models/table-column-schema-view-tenant-list.model';
15
14
  export * from './lib/models/roles-and-permissions.model';
16
15
  export * from './lib/models/update-tenant-status.model';
16
+ export * from './lib/models/tenant-function-type.model';
17
17
  export * from './lib/services/tenant-applications.service';
18
18
  export * from './lib/services/tenant-permissions-map.service';
19
19
  export * from './lib/services/tenant-permissions.service';
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVuYW50cy5tb2RlbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3RlbmFudHMvc3JjL2xpYi9tb2RlbHMvdGVuYW50cy5tb2RlbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGludGVyZmFjZSBGZWF0dXJlSW5mbyB7XHJcbiAgZmVhdHVyZUlkOiBzdHJpbmc7XHJcbiAgZmVhdHVyZU5hbWU6IHN0cmluZztcclxuICBpc0RlZmF1bHQ6IGJvb2xlYW47XHJcbn1cclxuZXhwb3J0IGludGVyZmFjZSBUZW5hbnRJbmZvIHtcclxuICBhcHBJZDogc3RyaW5nO1xyXG4gIGFwcFRpdGxlOiBzdHJpbmc7XHJcbiAgYXBwTG9nbz86IHN0cmluZztcclxuICBhcHBEZXNjcmlwdGlvbjogc3RyaW5nO1xyXG4gIGFwcEhlYWRpbmc6IHN0cmluZztcclxuICBmZWF0dXJlczogRmVhdHVyZUluZm9bXSB8IG51bGw7XHJcbiAgc3RhdHVzOiBib29sZWFuIHwgbnVsbDtcclxuICBhcHBUeXBlPzogc3RyaW5nO1xyXG4gIGJhY2tncm91bmRDb2xvcj86IHN0cmluZztcclxuICBhcHBIZWxwTGluaz86IHN0cmluZztcclxuICBhcHBEb21haW5Vcmw/OiBzdHJpbmc7XHJcbn1cclxuZXhwb3J0IGludGVyZmFjZSBHZXRUZW5hbnRzUmVzcG9uc2Uge1xyXG4gIHN0YXR1czogYm9vbGVhbjtcclxuICBtZXNzYWdlOiBzdHJpbmc7XHJcbiAgYm9keT86IHtcclxuICAgIHRvdGFsUmVjb3JkczogbnVtYmVyO1xyXG4gICAgYXBwRGV0YWlsczogVGVuYW50SW5mb1tdIHwgbnVsbCB8IHsgZXJyb3JDb2Rlczogc3RyaW5nW10gfTtcclxuICB9O1xyXG59XHJcbmV4cG9ydCBpbnRlcmZhY2UgVGVuYW50RGV0YWlsc1Jlc3BvbnNlIHtcclxuICBzdGF0dXM6IGJvb2xlYW47XHJcbiAgbWVzc2FnZTogc3RyaW5nO1xyXG4gIGJvZHk/OiBUZW5hbnRJbmZvIHwgeyBlcnJvckNvZGVzOiBzdHJpbmdbXSB9O1xyXG59XHJcbiJdfQ==
@@ -1,35 +0,0 @@
1
- export interface FeatureInfo {
2
- featureId: string;
3
- featureName: string;
4
- isDefault: boolean;
5
- }
6
- export interface TenantInfo {
7
- appId: string;
8
- appTitle: string;
9
- appLogo?: string;
10
- appDescription: string;
11
- appHeading: string;
12
- features: FeatureInfo[] | null;
13
- status: boolean | null;
14
- appType?: string;
15
- backgroundColor?: string;
16
- appHelpLink?: string;
17
- appDomainUrl?: string;
18
- }
19
- export interface GetTenantsResponse {
20
- status: boolean;
21
- message: string;
22
- body?: {
23
- totalRecords: number;
24
- appDetails: TenantInfo[] | null | {
25
- errorCodes: string[];
26
- };
27
- };
28
- }
29
- export interface TenantDetailsResponse {
30
- status: boolean;
31
- message: string;
32
- body?: TenantInfo | {
33
- errorCodes: string[];
34
- };
35
- }