@techextensor/tab-sdk 0.0.4 → 0.0.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.
Files changed (43) hide show
  1. package/esm2022/lib/app/analytics.service.mjs +51 -0
  2. package/esm2022/lib/app/app.service.mjs +145 -0
  3. package/esm2022/lib/app/file.service.mjs +41 -0
  4. package/esm2022/lib/app/release.service.mjs +38 -0
  5. package/esm2022/lib/app/report.service.mjs +48 -0
  6. package/esm2022/lib/app/translator.service.mjs +77 -0
  7. package/esm2022/lib/crud/crud.service.mjs +161 -0
  8. package/esm2022/lib/enum/store.enum.mjs +6 -0
  9. package/esm2022/lib/enum/ui.enum.mjs +13 -0
  10. package/esm2022/lib/http/http.service.mjs +58 -0
  11. package/esm2022/lib/interface/http.interface.mjs +2 -0
  12. package/esm2022/lib/interface/ui.interface.mjs +2 -0
  13. package/esm2022/lib/store/store.service.mjs +719 -0
  14. package/esm2022/lib/tab-sdk.service.mjs +53 -5
  15. package/esm2022/lib/ui/form.service.mjs +79 -0
  16. package/esm2022/lib/ui/ui.service.mjs +176 -19
  17. package/esm2022/lib/util/util.service.mjs +53 -0
  18. package/esm2022/lib/workflow/transition.service.mjs +40 -0
  19. package/fesm2022/techextensor-tab-sdk.mjs +1687 -30
  20. package/fesm2022/techextensor-tab-sdk.mjs.map +1 -1
  21. package/lib/app/analytics.service.d.ts +28 -0
  22. package/lib/app/app.service.d.ts +81 -0
  23. package/lib/app/file.service.d.ts +22 -0
  24. package/lib/app/release.service.d.ts +23 -0
  25. package/lib/app/report.service.d.ts +28 -0
  26. package/lib/app/translator.service.d.ts +49 -0
  27. package/lib/crud/crud.service.d.ts +88 -0
  28. package/lib/enum/store.enum.d.ts +4 -0
  29. package/lib/enum/ui.enum.d.ts +10 -0
  30. package/lib/http/http.service.d.ts +35 -0
  31. package/lib/interface/http.interface.d.ts +8 -0
  32. package/lib/interface/ui.interface.d.ts +24 -0
  33. package/lib/store/store.service.d.ts +406 -0
  34. package/lib/tab-sdk.service.d.ts +23 -1
  35. package/lib/ui/form.service.d.ts +47 -0
  36. package/lib/ui/ui.service.d.ts +79 -5
  37. package/lib/util/util.service.d.ts +14 -0
  38. package/lib/workflow/transition.service.d.ts +21 -0
  39. package/package.json +2 -2
  40. package/esm2022/lib/enums/ui.enum.mjs +0 -16
  41. package/esm2022/lib/interfaces/ui.interface.mjs +0 -2
  42. package/lib/enums/ui.enum.d.ts +0 -13
  43. package/lib/interfaces/ui.interface.d.ts +0 -56
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, inject } from '@angular/core';
3
- import { AuthService, MetadataHelper } from '@techextensor/tab-core-utility';
2
+ import { inject, Injectable } from '@angular/core';
3
+ import { NotificationService, ConfirmationService, NotificationType, AuthService, TabFormioService, TemplateHelper, TabBlueprintService, AppHelper, MediaUploadHelper, TabReleaseService, TranslationService, TabCrudService, TabGetService, LocalStorageService, SessionStorageService, StorageConstants, MetadataHelper } from '@techextensor/tab-core-utility';
4
4
  import { firstValueFrom } from 'rxjs';
5
5
 
6
6
  var ScreenDisplayMode;
@@ -9,20 +9,16 @@ var ScreenDisplayMode;
9
9
  ScreenDisplayMode["Popup"] = "popup";
10
10
  ScreenDisplayMode["SameTab"] = "sameTab";
11
11
  ScreenDisplayMode["NewTab"] = "newTab";
12
- ScreenDisplayMode["NavigationInSameTab"] = "navigationInSameTab";
13
- ScreenDisplayMode["NavigationInNewTab"] = "navigationInNewTab";
14
12
  })(ScreenDisplayMode || (ScreenDisplayMode = {}));
15
- var NotificationType;
16
- (function (NotificationType) {
17
- NotificationType["Success"] = "success";
18
- NotificationType["Warning"] = "warning";
19
- NotificationType["Error"] = "error";
20
- })(NotificationType || (NotificationType = {}));
13
+ var NavigationType;
14
+ (function (NavigationType) {
15
+ NavigationType["NavigateToUrl"] = "navigateToUrl";
16
+ NavigationType["NavigateToSubdomain"] = "navigateToSubdomain";
17
+ })(NavigationType || (NavigationType = {}));
21
18
 
22
19
  class UiService {
23
- _eventActionService = TabSdk.context?.EventActionService;
24
- _tabUtilsService = TabSdk.context?.TabUtilsService;
25
- _confirmationDialogService = TabSdk.context?.ConfirmationDialogService;
20
+ _notificationService = inject(NotificationService);
21
+ _confirmationService = inject(ConfirmationService);
26
22
  /**
27
23
  * Open a screen with the given options. The mode determines how the screen is
28
24
  * displayed.
@@ -39,11 +35,9 @@ class UiService {
39
35
  this.showDialog({ screenId, reqtokens, submission, title, width, height, customClass });
40
36
  break;
41
37
  case ScreenDisplayMode.SameTab:
42
- case ScreenDisplayMode.NavigationInSameTab:
43
38
  this.navigateTo({ screenId, reqtokens });
44
39
  break;
45
40
  case ScreenDisplayMode.NewTab:
46
- case ScreenDisplayMode.NavigationInNewTab:
47
41
  this.openInNewTab({ screenId, reqtokens });
48
42
  break;
49
43
  }
@@ -60,7 +54,7 @@ class UiService {
60
54
  ...(options.height && { height: options.height }),
61
55
  ...(options.customClass && { customClass: options.customClass })
62
56
  };
63
- this._eventActionService.openScreen(ScreenDisplayMode.Sidebar, options.screenId, options.reqtokens || undefined, options.submission || undefined, Object.keys(otherConfiguration).length > 0 ? otherConfiguration : undefined);
57
+ TabSdk.util?.openScreen(ScreenDisplayMode.Sidebar, options.screenId, options.reqtokens || undefined, options.submission || undefined, Object.keys(otherConfiguration).length > 0 ? otherConfiguration : undefined);
64
58
  }
65
59
  /**
66
60
  * Opens a screen in a popup dialog.
@@ -74,7 +68,7 @@ class UiService {
74
68
  ...(options.height && { height: options.height }),
75
69
  ...(options.customClass && { customClass: options.customClass })
76
70
  };
77
- this._eventActionService.openScreen(ScreenDisplayMode.Popup, options.screenId, options.reqtokens || undefined, options.submission || undefined, Object.keys(otherConfiguration).length > 0 ? otherConfiguration : undefined);
71
+ TabSdk.util?.openScreen(ScreenDisplayMode.Popup, options.screenId, options.reqtokens || undefined, options.submission || undefined, Object.keys(otherConfiguration).length > 0 ? otherConfiguration : undefined);
78
72
  }
79
73
  /**
80
74
  * Navigates to a screen within the same tab.
@@ -82,7 +76,7 @@ class UiService {
82
76
  * @param options - The options for navigation, including screenId and optional reqtokens.
83
77
  */
84
78
  navigateTo(options) {
85
- this._eventActionService.openScreen(ScreenDisplayMode.NavigationInSameTab, options.screenId, options.reqtokens || undefined);
79
+ TabSdk.util?.openScreen(ScreenDisplayMode.SameTab, options.screenId, options.reqtokens || undefined);
86
80
  }
87
81
  /**
88
82
  * Navigates to a screen in a new tab.
@@ -90,7 +84,7 @@ class UiService {
90
84
  * @param options The options for navigation, including screenId and optional reqtokens.
91
85
  */
92
86
  openInNewTab(options) {
93
- this._eventActionService.openScreen(ScreenDisplayMode.NavigationInNewTab, options.screenId, options.reqtokens || undefined);
87
+ TabSdk.util?.openScreen(ScreenDisplayMode.NewTab, options.screenId, options.reqtokens || undefined);
94
88
  }
95
89
  /**
96
90
  * Navigates to the specified URL.
@@ -98,7 +92,10 @@ class UiService {
98
92
  * @param url - The URL to navigate to.
99
93
  */
100
94
  navigateToUrl(url) {
101
- this._tabUtilsService.navigateToUrl({ Url: url });
95
+ TabSdk.util?.navigateToUrl({
96
+ url,
97
+ type: NavigationType.NavigateToUrl
98
+ });
102
99
  }
103
100
  /**
104
101
  * Navigates to a specified subdomain using the provided options.
@@ -106,7 +103,23 @@ class UiService {
106
103
  * @param options - The options for navigation, including subDomain, appCode, and url.
107
104
  */
108
105
  navigateToSubdomain(options) {
109
- this._tabUtilsService.navigateToUrlWithSubdomain(options);
106
+ TabSdk.util?.navigateToUrl({
107
+ ...options,
108
+ type: NavigationType.NavigateToUrl
109
+ });
110
+ }
111
+ /**
112
+ * Retrieves the active screen ID from the current URL.
113
+ *
114
+ * @returns The screen ID if present in the URL, otherwise undefined.
115
+ */
116
+ getActiveUrlScreenId() {
117
+ // Split the URL pathname using the app name and '/screen/' as delimiters
118
+ const urlParts = window?.location?.pathname?.split(TabSdk.store.appName + '/screen/');
119
+ // Extract the screen ID part and remove any query parameters
120
+ const screenId = urlParts?.[1]?.split('?')[0];
121
+ // Return the screen ID or undefined if not found
122
+ return screenId;
110
123
  }
111
124
  /**
112
125
  * Show a notification to the user.
@@ -114,7 +127,12 @@ class UiService {
114
127
  * @param options The options for the notification.
115
128
  */
116
129
  notify(options) {
117
- this._tabUtilsService.notify(options);
130
+ this._notificationService.notify({
131
+ type: options.type,
132
+ message: TabSdk.translator.translate(options.message),
133
+ ...(options?.title ? { title: TabSdk.translator.translate(options.title) } : {}),
134
+ ...(options?.configuration ? { configuration: options.configuration } : {}),
135
+ });
118
136
  }
119
137
  /**
120
138
  * Displays a success notification to the user.
@@ -122,7 +140,11 @@ class UiService {
122
140
  * @param options - The options for the notification, including message, title, and configuration.
123
141
  */
124
142
  showSuccess(options) {
125
- this.notify({ ...options, type: NotificationType.Success });
143
+ this.notify({
144
+ ...options,
145
+ type: NotificationType.Success,
146
+ title: options?.title ?? 'Success'
147
+ });
126
148
  }
127
149
  /**
128
150
  * Displays a warning notification to the user.
@@ -130,7 +152,23 @@ class UiService {
130
152
  * @param options - The options for the notification, including message, title, and configuration.
131
153
  */
132
154
  showWarning(options) {
133
- this.notify({ ...options, type: NotificationType.Warning });
155
+ this.notify({
156
+ ...options,
157
+ type: NotificationType.Warning,
158
+ title: options?.title ?? 'Warning'
159
+ });
160
+ }
161
+ /**
162
+ * Displays an info notification to the user.
163
+ *
164
+ * @param options - The options for the notification, including message, title, and configuration.
165
+ */
166
+ showInfo(options) {
167
+ this.notify({
168
+ ...options,
169
+ type: NotificationType.Info,
170
+ title: options?.title ?? 'Info'
171
+ });
134
172
  }
135
173
  /**
136
174
  * Displays an error notification to the user.
@@ -138,7 +176,11 @@ class UiService {
138
176
  * @param options - The options for the notification, including message, title, and configuration.
139
177
  */
140
178
  showError(options) {
141
- this.notify({ ...options, type: NotificationType.Error });
179
+ this.notify({
180
+ ...options,
181
+ type: NotificationType.Error,
182
+ title: options?.title ?? 'Error'
183
+ });
142
184
  }
143
185
  /**
144
186
  * Displays a confirmation dialog to the user and returns a promise that resolves
@@ -150,12 +192,123 @@ class UiService {
150
192
  */
151
193
  confirm(options) {
152
194
  return new Promise((resolve) => {
153
- this._confirmationDialogService.confirm(options)
195
+ this._confirmationService.confirm(options)
154
196
  ?.subscribe((isConfirmed) => {
155
197
  resolve(isConfirmed);
156
198
  });
157
199
  });
158
200
  }
201
+ /**
202
+ * Displays a confirmation dialog to the user with a title and message that indicates
203
+ * the user is about to delete an item. The confirmation dialog has a "Delete" and "Cancel"
204
+ * button.
205
+ *
206
+ * @param options - The options for the confirmation dialog, including the item name and
207
+ * optional message.
208
+ * @returns A promise that resolves to true if the user confirms, false otherwise.
209
+ */
210
+ confirmDelete(options) {
211
+ return this.confirm({
212
+ title: options?.title ?? `Are you sure you want to delete this record`,
213
+ message: options?.message ?? `You are about to delete the selected record. Are you sure you want to proceed?`,
214
+ primaryOption: 'Delete',
215
+ });
216
+ }
217
+ /**
218
+ * Displays a confirmation dialog to the user with a title and message that indicates
219
+ * the user is about to discard changes to an item. The confirmation dialog has a "Discard"
220
+ * and "Cancel" button.
221
+ *
222
+ * @param options - The options for the confirmation dialog, including the item name and
223
+ * optional message.
224
+ * @returns A promise that resolves to true if the user confirms, false otherwise.
225
+ */
226
+ confirmDiscard(options) {
227
+ return this.confirm({
228
+ title: `Are you sure you want to discard your changes`,
229
+ message: options?.message ?? `You are about to discard your changes. Are you sure you want to proceed?`,
230
+ primaryOption: 'Discard',
231
+ });
232
+ }
233
+ /**
234
+ * Closes the confirmation dialog.
235
+ *
236
+ * This method can be used to manually close the confirmation dialog.
237
+ */
238
+ closeConfirmationDialog() {
239
+ // Close the confirmation dialog
240
+ this._confirmationService.closeDialog();
241
+ }
242
+ /**
243
+ * Retrieves the confirmation emitter from the confirmation service.
244
+ *
245
+ * @returns The confirmation emitter used for emitting confirmation events.
246
+ */
247
+ getConformationEmitter() {
248
+ return this._confirmationService.getConformationEmitter();
249
+ }
250
+ /**
251
+ * Retrieves the dialog emitter from the confirmation service.
252
+ *
253
+ * The dialog emitter is an RxJS Subject that emits whenever a confirmation dialog is
254
+ * opened or closed. The value emitted is a boolean indicating whether a dialog is
255
+ * currently open.
256
+ *
257
+ * @returns The dialog emitter used for emitting confirmation dialog events.
258
+ */
259
+ getDialogEmitter() {
260
+ return this._confirmationService.getDialogEmitter();
261
+ }
262
+ /**
263
+ * Retrieves the remove emitter from the confirmation service.
264
+ *
265
+ * The remove emitter is an RxJS Subject that emits whenever a removal confirmation
266
+ * dialog is opened or closed. The value emitted is a boolean indicating whether a
267
+ * removal dialog is currently open.
268
+ *
269
+ * @returns The remove emitter used for emitting removal confirmation dialog events.
270
+ */
271
+ getRemoveEmitter() {
272
+ return this._confirmationService.getRemoveEmitter();
273
+ }
274
+ /**
275
+ * Copies the provided text to the clipboard and displays a success notification.
276
+ *
277
+ * @param text - The text to be copied to the clipboard.
278
+ */
279
+ copyToClipboard(text) {
280
+ // Create a temporary input element to hold the text
281
+ const tempInput = document.createElement("input");
282
+ // Set the input's value to the text to be copied
283
+ tempInput.value = text;
284
+ // Append the temporary input to the document body
285
+ document.body.appendChild(tempInput);
286
+ // Select the text in the input element
287
+ tempInput.select();
288
+ // Execute the copy command
289
+ document.execCommand("copy");
290
+ // Remove the temporary input from the document body
291
+ document.body.removeChild(tempInput);
292
+ // Show a success notification
293
+ this.showSuccess({
294
+ message: "",
295
+ title: "Copied to clipboard!",
296
+ configuration: {
297
+ timeOut: 1000,
298
+ positionClass: 'toast-top-center',
299
+ easing: 'ease-in',
300
+ easeTime: 300,
301
+ extendedTimeOut: 2000,
302
+ }
303
+ });
304
+ }
305
+ /**
306
+ * Copies the current URL to the clipboard and displays a success notification.
307
+ */
308
+ copyCurrentUrlToClipboard() {
309
+ // Use the copyToClipboard method to copy the current window URL
310
+ this.copyToClipboard(window.location.href);
311
+ }
159
312
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
160
313
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UiService, providedIn: 'root' });
161
314
  }
@@ -257,26 +410,1530 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
257
410
  }]
258
411
  }] });
259
412
 
413
+ class FormService {
414
+ _tabFormioService = inject(TabFormioService);
415
+ _templateHelper = inject(TemplateHelper);
416
+ /**
417
+ * Retrieves a screen by its ID.
418
+ *
419
+ * @param screenId The ID of the screen to retrieve.
420
+ * @param config Optional configuration object for the request.
421
+ * @returns A promise of the response from the server.
422
+ */
423
+ async getScreen(screenId, config) {
424
+ const response = await firstValueFrom(this._tabFormioService.getScreen(screenId, config));
425
+ return response;
426
+ }
427
+ /**
428
+ * Retrieves the data for a screen by its ID.
429
+ *
430
+ * @param screenId The ID of the screen to retrieve the data for.
431
+ * @param requestPayload The request payload to send to the server.
432
+ * @returns A promise of the response from the server.
433
+ */
434
+ async getScreenData(screenId, requestPayload) {
435
+ // Send the request to the server and get the response.
436
+ const response = await firstValueFrom(this._tabFormioService.getScreenData(screenId, requestPayload));
437
+ // Return the response from the server.
438
+ return response;
439
+ }
440
+ /**
441
+ * Processes a request using the provided request payload.
442
+ *
443
+ * @param requestPayload The payload to be processed.
444
+ * @returns A promise of the response from the server.
445
+ */
446
+ async processRequest(requestPayload) {
447
+ // Send the request payload to the server and await the response.
448
+ const response = await firstValueFrom(this._tabFormioService.processRequest(requestPayload));
449
+ // Return the server's response.
450
+ return response;
451
+ }
452
+ /**
453
+ * Builds Form.io components for the specified app object ID and type.
454
+ *
455
+ * @param appObjectId The ID of the app object to build the components for.
456
+ * @param type The type of components to build.
457
+ * @returns A promise of the response from the server.
458
+ */
459
+ async buildFormIOComponents(appObjectId, type) {
460
+ // Send the request to the server to build the components.
461
+ const response = await firstValueFrom(this._tabFormioService.buildFormIOComponents(appObjectId, type));
462
+ // Return the response from the server.
463
+ return response;
464
+ }
465
+ /**
466
+ * Parses a template using the provided request payload.
467
+ *
468
+ * @param requestPayload The payload containing the template to be parsed.
469
+ * @param onFailedParseOnServer If the parsing should be done on the server.
470
+ * @returns A promise of the response from the server.
471
+ */
472
+ async parseTemplate(requestPayload, onFailedParseOnServer = false) {
473
+ // Send the request to the server to parse the template.
474
+ const response = await firstValueFrom(this._templateHelper.templateParseUniversal(requestPayload, onFailedParseOnServer));
475
+ // Return the response from the server.
476
+ return response;
477
+ }
478
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
479
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FormService, providedIn: 'root' });
480
+ }
481
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FormService, decorators: [{
482
+ type: Injectable,
483
+ args: [{
484
+ providedIn: 'root'
485
+ }]
486
+ }] });
487
+
488
+ class TransitionService {
489
+ _tabBlueprintService = inject(TabBlueprintService);
490
+ /**
491
+ * Retrieves the next status based on the provided payload.
492
+ *
493
+ * @param payload - The payload containing information to determine the next status.
494
+ * @returns A promise that resolves to the common API response.
495
+ */
496
+ async getNextStatus(payload) {
497
+ // Await the response from the getNextStatus method of the tabBlueprintService
498
+ const response = await firstValueFrom(this._tabBlueprintService.getNextStatus(payload));
499
+ // Return the obtained response
500
+ return response;
501
+ }
502
+ /**
503
+ * Updates the status of an entity based on the provided payload.
504
+ *
505
+ * @param payload - The payload containing information to update the status.
506
+ * @returns A promise that resolves to the common API response.
507
+ */
508
+ async updateStatus(payload) {
509
+ const response = await firstValueFrom(TabSdk.util?.updateStatus(payload));
510
+ // Return the obtained response
511
+ return response;
512
+ }
513
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TransitionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
514
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TransitionService, providedIn: 'root' });
515
+ }
516
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TransitionService, decorators: [{
517
+ type: Injectable,
518
+ args: [{
519
+ providedIn: 'root'
520
+ }]
521
+ }] });
522
+
523
+ class AppService {
524
+ _appHelper = inject(AppHelper);
525
+ /**
526
+ * Rebuilds the current app.
527
+ *
528
+ * @returns A promise that resolves to a common API response.
529
+ */
530
+ async rebuild() {
531
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
532
+ const response = await firstValueFrom(this._appHelper.rebuildApp());
533
+ // Return the response from the server.
534
+ return response;
535
+ }
536
+ /**
537
+ * Retrieves the schema for the current app.
538
+ *
539
+ * @returns A promise that resolves to a common API response containing the schema.
540
+ */
541
+ async getSchema() {
542
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
543
+ const response = await firstValueFrom(this._appHelper.getSchema());
544
+ // Return the response from the server
545
+ return response;
546
+ }
547
+ /**
548
+ * Retrieves the current app's permission.
549
+ *
550
+ * @returns A promise that resolves to a common API response containing the permission information.
551
+ */
552
+ async getPermission() {
553
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
554
+ const response = await firstValueFrom(this._appHelper.getPermission());
555
+ // Return the response from the server
556
+ return response;
557
+ }
558
+ /**
559
+ * Registers app objects based on the provided payload.
560
+ *
561
+ * @param payload The register app objects payload.
562
+ * @returns A promise that resolves to a common API response.
563
+ */
564
+ async registerAppObject(payload) {
565
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
566
+ const response = await firstValueFrom(this._appHelper.registerAppObjects(payload));
567
+ // Return the response from the server
568
+ return response;
569
+ }
570
+ /**
571
+ * Clones a data source query (DSQ) based on the provided payload.
572
+ *
573
+ * @param payload The clone DSQ payload.
574
+ * @returns A promise that resolves to a common API response.
575
+ */
576
+ async cloneDsq(payload) {
577
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
578
+ const response = await firstValueFrom(this._appHelper.cloneDsq(payload));
579
+ // Return the response from the server
580
+ return response;
581
+ }
582
+ /**
583
+ * Retrieves data in JSON format based on the provided payload.
584
+ *
585
+ * @param payload The get data JSON by type payload.
586
+ * @returns A promise that resolves to a common API response containing the data in JSON format.
587
+ */
588
+ async getDataJsonByType(payload) {
589
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
590
+ const response = await firstValueFrom(this._appHelper.getDataJsonByType(payload));
591
+ // Return the response from the server
592
+ return response;
593
+ }
594
+ /**
595
+ * Synchronizes the current app's fields based on the provided payload.
596
+ *
597
+ * @param payload The sync app fields payload.
598
+ * @returns A promise that resolves to a common API response.
599
+ */
600
+ async syncAppFields(payload) {
601
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
602
+ const response = await firstValueFrom(this._appHelper.syncAppFields(payload));
603
+ // Return the response from the server
604
+ return response;
605
+ }
606
+ /**
607
+ * Sets the tab components based on the provided connection ID.
608
+ *
609
+ * @param connectionId The ID of the connection to set the components for.
610
+ * @returns A promise that resolves to a common API response.
611
+ */
612
+ async setTabComponents(connectionId) {
613
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
614
+ const response = await firstValueFrom(this._appHelper.setTabComponents(connectionId));
615
+ // Return the response from the server
616
+ return response;
617
+ }
618
+ /**
619
+ * Performs validation for the connection with the provided ID.
620
+ *
621
+ * @param connectionId The ID of the connection to validate.
622
+ * @returns A promise that resolves to a common API response containing the validation result.
623
+ */
624
+ async performValidation(connectionId) {
625
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
626
+ const response = await firstValueFrom(this._appHelper.performValidation(connectionId));
627
+ // Return the response from the server
628
+ return response;
629
+ }
630
+ /**
631
+ * Tests the connection with the provided connection ID.
632
+ *
633
+ * @param connectionId The ID of the connection to test.
634
+ * @returns A promise that resolves to a common API response containing the test result.
635
+ */
636
+ async testConnection(connectionId) {
637
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
638
+ const response = await firstValueFrom(this._appHelper.testConnection(connectionId));
639
+ // Return the response from the server
640
+ return response;
641
+ }
642
+ /**
643
+ * Refreshes the global search data based on the provided payload.
644
+ *
645
+ * @param payload The refresh global search data payload.
646
+ * @returns A promise that resolves to a common API response containing the refreshed global search data.
647
+ */
648
+ async refreshGlobalSearchData(payload) {
649
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
650
+ const response = await firstValueFrom(this._appHelper.refreshGlobalSearchData(payload));
651
+ // Return the response from the server
652
+ return response;
653
+ }
654
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AppService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
655
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AppService, providedIn: 'root' });
656
+ }
657
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AppService, decorators: [{
658
+ type: Injectable,
659
+ args: [{
660
+ providedIn: 'root'
661
+ }]
662
+ }] });
663
+
664
+ class FileService {
665
+ _mediaUploadHelper = inject(MediaUploadHelper);
666
+ /**
667
+ * Uploads media files using the provided payload and optional headers.
668
+ *
669
+ * @param payload The payload containing the media files to upload.
670
+ * @param headers Optional headers to pass to the server.
671
+ * @returns A promise that resolves to a common API response.
672
+ */
673
+ async uploadMediaFiles(payload, headers) {
674
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
675
+ const response = await firstValueFrom(this._mediaUploadHelper.uploadMediaFiles(payload, headers));
676
+ // Return the response from the server
677
+ return response;
678
+ }
679
+ /**
680
+ * Removes a media file from the server using the provided media ID.
681
+ *
682
+ * @param mediaId The ID of the media file to remove.
683
+ * @returns A promise that resolves to a common API response.
684
+ */
685
+ async removeMediaFile(mediaId) {
686
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
687
+ const response = await firstValueFrom(this._mediaUploadHelper.removeMediaFile(mediaId));
688
+ // Return the response from the server
689
+ return response;
690
+ }
691
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FileService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
692
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FileService, providedIn: 'root' });
693
+ }
694
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FileService, decorators: [{
695
+ type: Injectable,
696
+ args: [{
697
+ providedIn: 'root'
698
+ }]
699
+ }] });
700
+
701
+ class ReportService {
702
+ _appHelper = inject(AppHelper);
703
+ /**
704
+ * Exports a report based on the provided payload.
705
+ *
706
+ * @param payload The payload containing the parameters for the report.
707
+ * @returns A promise that resolves to a common API response containing the report.
708
+ */
709
+ async export(payload) {
710
+ const response = await firstValueFrom(this._appHelper.exportReport(payload));
711
+ return response;
712
+ }
713
+ /**
714
+ * Downloads a report based on the provided payload.
715
+ *
716
+ * @param payload The payload containing the parameters for the report.
717
+ * @returns A promise that resolves to a common API response containing the report.
718
+ */
719
+ async download(payload) {
720
+ const response = await firstValueFrom(this._appHelper.downloadReport(payload));
721
+ return response;
722
+ }
723
+ /**
724
+ * Sends a report based on the provided payload.
725
+ *
726
+ * @param payload The payload containing the parameters for the report.
727
+ * @returns A promise that resolves to a common API response containing the report.
728
+ */
729
+ async send(payload) {
730
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
731
+ const response = await firstValueFrom(this._appHelper.sendReport(payload));
732
+ // Return the response from the server
733
+ return response;
734
+ }
735
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ReportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
736
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ReportService, providedIn: 'root' });
737
+ }
738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ReportService, decorators: [{
739
+ type: Injectable,
740
+ args: [{
741
+ providedIn: 'root'
742
+ }]
743
+ }] });
744
+
745
+ class ReleaseService {
746
+ _tabReleaseService = inject(TabReleaseService);
747
+ /**
748
+ * Retrieves the data differences between the current app version and the latest
749
+ * released version of the app.
750
+ *
751
+ * @returns A promise that resolves to a common API response containing the data
752
+ * differences in JSON format.
753
+ */
754
+ async getTabDataDiff() {
755
+ const response = await firstValueFrom(this._tabReleaseService.getDataJsonDiff());
756
+ return response;
757
+ }
758
+ /**
759
+ * Retrieves the metadata differences between the current app version and the latest
760
+ * released version of the app.
761
+ *
762
+ * @returns A promise that resolves to a common API response containing the metadata
763
+ * differences in JSON format.
764
+ */
765
+ async getMetaDataDiff() {
766
+ const response = await firstValueFrom(this._tabReleaseService.getMetaDataJsonDiff());
767
+ return response;
768
+ }
769
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ReleaseService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
770
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ReleaseService, providedIn: 'root' });
771
+ }
772
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ReleaseService, decorators: [{
773
+ type: Injectable,
774
+ args: [{
775
+ providedIn: 'root'
776
+ }]
777
+ }] });
778
+
779
+ class AnalyticsService {
780
+ _appHelper = inject(AppHelper);
781
+ /**
782
+ * Retrieves the summary of performance analytics based on the provided payload.
783
+ *
784
+ * @param payload The performance analytics payload.
785
+ * @returns A promise that resolves to a common API response containing the performance analytics summary.
786
+ */
787
+ async getSummaryOfPerformance(payload) {
788
+ const response = await firstValueFrom(this._appHelper.getSummaryOfPerformanceAnalytics(payload));
789
+ // Return the response from the server
790
+ return response;
791
+ }
792
+ /**
793
+ * Retrieves the detail of performance analytics based on the provided payload.
794
+ *
795
+ * @param payload The performance analytics payload.
796
+ * @returns A promise that resolves to a common API response containing the performance analytics detail.
797
+ */
798
+ async getDetailOfPerformance(payload) {
799
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
800
+ const response = await firstValueFrom(this._appHelper.getDetailOfPerformanceAnalytics(payload));
801
+ // Return the response from the server
802
+ return response;
803
+ }
804
+ /**
805
+ * Inserts the screen performance statistics based on the provided payload.
806
+ *
807
+ * @param payload The screen performance payload containing the statistics to be inserted.
808
+ * @returns A promise that resolves to a common API response containing the result of the insertion.
809
+ */
810
+ async insertScreenPerformance(payload) {
811
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
812
+ const response = await firstValueFrom(this._appHelper.insertScreenPerformanceStatistics(payload));
813
+ // Return the response from the server
814
+ return response;
815
+ }
816
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AnalyticsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
817
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AnalyticsService, providedIn: 'root' });
818
+ }
819
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AnalyticsService, decorators: [{
820
+ type: Injectable,
821
+ args: [{
822
+ providedIn: 'root'
823
+ }]
824
+ }] });
825
+
826
+ class TranslatorService {
827
+ _translationService = inject(TranslationService);
828
+ /**
829
+ * Gets the current active language
830
+ *
831
+ * @returns The current language code
832
+ */
833
+ getCurrentLanguage() {
834
+ return this._translationService.getCurrentLanguage();
835
+ }
836
+ /**
837
+ * Gets an observable of the current language changes
838
+ *
839
+ * @returns An observable of the current language code
840
+ */
841
+ getLanguageChanges() {
842
+ return this._translationService.currentLanguage$;
843
+ }
844
+ /**
845
+ * Changes the application language
846
+ *
847
+ * @param payload The translate payload containing language and languageCode
848
+ * @returns A promise that resolves when the language has been changed
849
+ */
850
+ async changeLanguage(payload) {
851
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
852
+ const response = await firstValueFrom(this._translationService.changeLanguage(payload));
853
+ // Return the response
854
+ return response;
855
+ }
856
+ /**
857
+ * Translates a key to the current language
858
+ *
859
+ * @param key The translation key
860
+ * @param params Optional parameters for interpolation
861
+ * @returns The translated string
862
+ */
863
+ translate(key, params) {
864
+ if (!key?.length)
865
+ return key;
866
+ return this._translationService.translate(key, params);
867
+ }
868
+ /**
869
+ * Gets a translation as an observable for async operations
870
+ *
871
+ * @param key The translation key
872
+ * @param params Optional parameters for interpolation
873
+ * @returns An observable of the translated string
874
+ */
875
+ async getTranslation(key, params) {
876
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
877
+ const translation = await firstValueFrom(this._translationService.getTranslation(key, params));
878
+ // Return the translated string
879
+ return translation;
880
+ }
881
+ /**
882
+ * Registers an external library integration for translations
883
+ *
884
+ * @param handler Function to handle the integration with language and translations
885
+ */
886
+ registerIntegration(handler) {
887
+ this._translationService.registerIntegration(handler);
888
+ }
889
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TranslatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
890
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TranslatorService, providedIn: 'root' });
891
+ }
892
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TranslatorService, decorators: [{
893
+ type: Injectable,
894
+ args: [{
895
+ providedIn: 'root'
896
+ }]
897
+ }] });
898
+
899
+ class CrudService {
900
+ _tabCrudService = inject(TabCrudService);
901
+ _tabGetService = inject(TabGetService);
902
+ /**
903
+ * Retrieves a record from the database using the provided payload.
904
+ *
905
+ * @param payload - The payload containing information to retrieve the record.
906
+ * @param headers - Optional headers to pass to the server.
907
+ * @returns A promise that resolves to a common API response containing the retrieved record.
908
+ */
909
+ async get(payload, headers) {
910
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
911
+ const response = await firstValueFrom(this._tabCrudService.get(payload, headers));
912
+ // Return the response from the server
913
+ return response;
914
+ }
915
+ /**
916
+ * Inserts a record into the database using the provided payload.
917
+ *
918
+ * @param payload - The payload containing information to insert the record.
919
+ * @param headers - Optional headers to pass to the server.
920
+ * @returns A promise that resolves to a common API response containing the inserted record.
921
+ */
922
+ async insert(payload, headers) {
923
+ const response = await firstValueFrom(
924
+ // Call the insert method of the TabCrudService and pass the payload and headers
925
+ this._tabCrudService.insert(payload, headers));
926
+ // Return the response from the server
927
+ return response;
928
+ }
929
+ /**
930
+ * Updates a record in the database using the provided payload.
931
+ *
932
+ * @param payload - The payload containing information to update the record.
933
+ * @param headers - Optional headers to pass to the server.
934
+ * @returns A promise that resolves to a common API response containing the updated record.
935
+ */
936
+ async update(payload, headers) {
937
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
938
+ const response = await firstValueFrom(this._tabCrudService.update(payload, headers));
939
+ // Return the response from the server
940
+ return response;
941
+ }
942
+ /**
943
+ * Deletes a record from the database using the provided payload.
944
+ *
945
+ * @param payload - The payload containing information to delete the record.
946
+ * @param headers - Optional headers to pass to the server.
947
+ * @returns A promise that resolves to a common API response containing the deleted record.
948
+ */
949
+ async delete(payload, headers) {
950
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
951
+ const response = await firstValueFrom(
952
+ // Call the delete method of the TabCrudService and pass the payload and headers
953
+ this._tabCrudService.delete(payload, headers));
954
+ // Return the response from the server
955
+ return response;
956
+ }
957
+ /**
958
+ * Executes a stored procedure using the provided payload.
959
+ *
960
+ * @param sp - The name of the stored procedure to execute.
961
+ * @param headers - Optional headers to pass to the server.
962
+ * @returns A promise that resolves to a common API response containing the result of executing the stored procedure.
963
+ */
964
+ async executeSp(sp, headers) {
965
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
966
+ const response = await firstValueFrom(
967
+ // Call the executeSp method of the TabCrudService and pass the name of the stored procedure and headers
968
+ this._tabCrudService.executeSp(sp, headers));
969
+ // Return the response from the server
970
+ return response;
971
+ }
972
+ /**
973
+ * Executes a select query using the provided select query ID.
974
+ *
975
+ * @param selectQueryId - The ID of the select query to execute.
976
+ * @param parameters - Optional parameters to pass to the select query.
977
+ * @returns A promise that resolves to a common API response containing the result of executing the select query.
978
+ */
979
+ async executeSelectQuery(selectQueryId, parameters) {
980
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
981
+ const response = await firstValueFrom(
982
+ // Call the executeSelectQueryById method of the TabGetService and pass the ID of the select query and parameters
983
+ this._tabGetService.executeSelectQueryById(selectQueryId, parameters));
984
+ // Return the response from the server
985
+ return response;
986
+ }
987
+ /**
988
+ * Executes a select query using the provided select query data.
989
+ *
990
+ * @param data - The select query data.
991
+ * @param parameters - Optional parameters to pass to the select query.
992
+ * @returns A promise that resolves to a common API response containing the result of executing the select query.
993
+ */
994
+ async executeSelectExecutor(data, parameters) {
995
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
996
+ const response = await firstValueFrom(
997
+ // Call the selectExecutor method of the TabGetService and pass the select query data and parameters
998
+ this._tabGetService.selectExecutor(data, parameters));
999
+ // Return the response from the server
1000
+ return response;
1001
+ }
1002
+ /**
1003
+ * Gets the search data using the provided search query and limit.
1004
+ *
1005
+ * @param searchQuery - The search query to search for.
1006
+ * @param limit - The number of records to limit the results to.
1007
+ * @param parameters - Optional parameters to pass to the search query.
1008
+ * @returns A promise that resolves to a common API response containing the search data.
1009
+ */
1010
+ async getSearchData(payload, parameters) {
1011
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
1012
+ const response = await firstValueFrom(
1013
+ // Call the getSearchData method of the TabGetService and pass the search query and limit
1014
+ this._tabGetService.getSearchData(payload, parameters));
1015
+ // Return the response from the server
1016
+ return response;
1017
+ }
1018
+ /**
1019
+ * Retrieves the history of records for a specified app object.
1020
+ *
1021
+ * @param appObjectId - The ID of the app object to retrieve the record history for.
1022
+ * @param recordIds - An array of record IDs to retrieve the history for.
1023
+ * @returns A promise that resolves to a common API response containing the record history.
1024
+ */
1025
+ async getRecordHistory(payload) {
1026
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
1027
+ const response = await firstValueFrom(
1028
+ // Call the getHistory method of the TabGetService and pass the app object ID and record IDs
1029
+ this._tabGetService.getHistory(payload));
1030
+ // Return the response from the server
1031
+ return response;
1032
+ }
1033
+ /**
1034
+ * Imports data into the database.
1035
+ *
1036
+ * @param data - The data to import.
1037
+ * @returns A promise that resolves to a common API response containing the result of importing the data.
1038
+ */
1039
+ async import(payload) {
1040
+ const response = await firstValueFrom(
1041
+ // Call the pmjayImport method of the TabGetService and pass the data to import
1042
+ this._tabGetService.pmjayImport(payload));
1043
+ // Return the response from the server
1044
+ return response;
1045
+ }
1046
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CrudService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1047
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CrudService, providedIn: 'root' });
1048
+ }
1049
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CrudService, decorators: [{
1050
+ type: Injectable,
1051
+ args: [{
1052
+ providedIn: 'root'
1053
+ }]
1054
+ }] });
1055
+
1056
+ class HttpService {
1057
+ _tabGetService = inject(TabGetService);
1058
+ /**
1059
+ * Executes an HTTP request using the provided payload.
1060
+ *
1061
+ * @param payload - The payload containing information to execute the HTTP request.
1062
+ * @returns A promise that resolves to the response from the server.
1063
+ */
1064
+ async executeRequest(payload) {
1065
+ // Await the response from the executeHttpRequest method of the TabGetService
1066
+ const response = await firstValueFrom(this._tabGetService.executeHttpRequest(payload));
1067
+ // Return the response from the server
1068
+ return response;
1069
+ }
1070
+ /**
1071
+ * Generates an HTTP request for the given data source query name.
1072
+ *
1073
+ * @param dataSourceQueryName - The name of the data source query for which to generate the HTTP request.
1074
+ * @returns A promise that resolves to the generated HTTP request.
1075
+ */
1076
+ async generateRequest(dataSourceQueryName) {
1077
+ // Await the response from the generateHttpRequest method of the TabGetService
1078
+ const response = await firstValueFrom(this._tabGetService.generateHttpRequest(dataSourceQueryName));
1079
+ // Return the generated HTTP request
1080
+ return response;
1081
+ }
1082
+ /**
1083
+ * Sets the request status for the given URL.
1084
+ *
1085
+ * @param status - The request status to set.
1086
+ */
1087
+ setRequestStatus(status) {
1088
+ TabSdk.util?.setLatestStatus(status);
1089
+ }
1090
+ /**
1091
+ * Gets the request status for the given URL.
1092
+ *
1093
+ * @param url - The URL for which to get the request status.
1094
+ * @returns The request status for the given URL.
1095
+ */
1096
+ getRequestStatus(url) {
1097
+ return TabSdk.util?.getLatestStatus(url);
1098
+ }
1099
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HttpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1100
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HttpService, providedIn: 'root' });
1101
+ }
1102
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HttpService, decorators: [{
1103
+ type: Injectable,
1104
+ args: [{
1105
+ providedIn: 'root'
1106
+ }]
1107
+ }] });
1108
+
1109
+ var StorageType;
1110
+ (function (StorageType) {
1111
+ StorageType["Local"] = "local";
1112
+ StorageType["Session"] = "session";
1113
+ })(StorageType || (StorageType = {}));
1114
+
1115
+ class StoreService {
1116
+ _localStorageService = inject(LocalStorageService);
1117
+ _sessionStorageService = inject(SessionStorageService);
1118
+ /**
1119
+ * Retrieves the tenant ID from the local storage.
1120
+ */
1121
+ get tenantId() {
1122
+ return this.getOrgInfo()?.Id || null;
1123
+ }
1124
+ /**
1125
+ * Sets the tenant ID in the organization info.
1126
+ *
1127
+ * @param value - The tenant ID to set.
1128
+ */
1129
+ set tenantId(value) {
1130
+ // Retrieve the existing organization info or initialize a new object
1131
+ const orgInfo = this.getOrgInfo() || {};
1132
+ // Update the tenant ID value
1133
+ orgInfo.Id = value;
1134
+ // Save the updated organization info back to storage
1135
+ this.setOrgInfo(orgInfo);
1136
+ }
1137
+ /**
1138
+ * Retrieves the tenant name from the organization info.
1139
+ */
1140
+ get tenantName() {
1141
+ // Retrieve the organization info from storage
1142
+ const orgInfo = this.getOrgInfo();
1143
+ // Return the tenant name if it exists, otherwise return null
1144
+ return orgInfo?.OrganizationName || null;
1145
+ }
1146
+ /**
1147
+ * Sets the tenant name in the organization info.
1148
+ *
1149
+ * @param value - The tenant name to set.
1150
+ */
1151
+ set tenantName(value) {
1152
+ // Retrieve the existing organization info or initialize a new object
1153
+ const orgInfo = this.getOrgInfo() || {};
1154
+ // Update the organization name value
1155
+ orgInfo.OrganizationName = value;
1156
+ // Save the updated organization info back to storage
1157
+ this.setOrgInfo(orgInfo);
1158
+ }
1159
+ /**
1160
+ * Retrieves the subdomain from the organization info.
1161
+ *
1162
+ * @returns The subdomain if it exists, otherwise `null`.
1163
+ */
1164
+ get subdomain() {
1165
+ // Retrieve the organization info from storage
1166
+ const orgInfo = this.getOrgInfo();
1167
+ // Return the subdomain if it exists, otherwise return null
1168
+ return orgInfo?.Subdomain || null;
1169
+ }
1170
+ /**
1171
+ * Sets the subdomain in the organization info.
1172
+ *
1173
+ * @param value - The subdomain to set.
1174
+ */
1175
+ set subdomain(value) {
1176
+ // Retrieve the existing organization info or initialize a new object
1177
+ const orgInfo = this.getOrgInfo() || {};
1178
+ // Update the subdomain value
1179
+ orgInfo.Subdomain = value;
1180
+ // Save the updated organization info back to storage
1181
+ this.setOrgInfo(orgInfo);
1182
+ }
1183
+ /**
1184
+ * Retrieves the app ID from the app info.
1185
+ *
1186
+ * @returns The app ID if it exists, otherwise `null`.
1187
+ */
1188
+ get appId() {
1189
+ return this.getAppInfo()?.Id || null;
1190
+ }
1191
+ /**
1192
+ * Sets the app ID in the app info.
1193
+ *
1194
+ * @param value - The app ID to set.
1195
+ */
1196
+ set appId(value) {
1197
+ // Retrieve the existing app info or initialize a new object
1198
+ const appInfo = this.getAppInfo() || {};
1199
+ // Update the app ID value
1200
+ appInfo.Id = value;
1201
+ // Save the updated app info back to storage
1202
+ this.setAppInfo(appInfo);
1203
+ }
1204
+ /**
1205
+ * Retrieves the app name from the app info.
1206
+ *
1207
+ * @returns The app name if it exists, otherwise `null`.
1208
+ */
1209
+ get appName() {
1210
+ // Retrieve and return the app name from the app info, or return null if it doesn't exist
1211
+ return this.getAppInfo()?.AppName || null;
1212
+ }
1213
+ /**
1214
+ * Sets the app name in the app info.
1215
+ *
1216
+ * @param value - The app name to set.
1217
+ */
1218
+ set appName(value) {
1219
+ // Retrieve the existing app info or initialize a new object
1220
+ const appInfo = this.getAppInfo() || {};
1221
+ // Update the app name value
1222
+ appInfo.AppName = value;
1223
+ // Save the updated app info back to storage
1224
+ this.setAppInfo(appInfo);
1225
+ }
1226
+ /**
1227
+ * Retrieves the environment ID from the environment info.
1228
+ *
1229
+ * @returns The environment ID if it exists, otherwise `null`.
1230
+ */
1231
+ get environmentId() {
1232
+ // Retrieve and return the environment ID from the environment info, or return null if it doesn't exist
1233
+ return this.getEnvironmentInfo()?.Id || null;
1234
+ }
1235
+ /**
1236
+ * Sets the environment ID in the environment info.
1237
+ *
1238
+ * @param value - The environment ID to set.
1239
+ */
1240
+ set environmentId(value) {
1241
+ // Retrieve the existing environment info or initialize a new object
1242
+ const environmentInfo = this.getEnvironmentInfo() || {};
1243
+ // Update the environment ID value
1244
+ environmentInfo.Id = value;
1245
+ // Save the updated environment info back to storage
1246
+ this.setEnvironmentInfo(environmentInfo);
1247
+ }
1248
+ /**
1249
+ * Retrieves the environment name from the environment info.
1250
+ *
1251
+ * @returns The environment name if it exists, otherwise `null`.
1252
+ */
1253
+ get environmentName() {
1254
+ // Retrieve and return the environment name from the environment info, or return null if it doesn't exist
1255
+ return this.getEnvironmentInfo()?.Name || null;
1256
+ }
1257
+ /**
1258
+ * Sets the environment name in the environment info.
1259
+ *
1260
+ * @param value - The environment name to set.
1261
+ */
1262
+ set environmentName(value) {
1263
+ // Retrieve the existing environment info or initialize a new object
1264
+ const environmentInfo = this.getEnvironmentInfo() || {};
1265
+ // Update the environment name value
1266
+ environmentInfo.Name = value;
1267
+ // Save the updated environment info back to storage
1268
+ this.setEnvironmentInfo(environmentInfo);
1269
+ }
1270
+ /**
1271
+ * Retrieves the token from the token info.
1272
+ *
1273
+ * @returns The token if it exists, otherwise `null`.
1274
+ */
1275
+ get token() {
1276
+ // Retrieve and return the token from the token info, or return null if it doesn't exist
1277
+ return this.getTokenInfo()?.token || null;
1278
+ }
1279
+ /**
1280
+ * Sets the token in the token info.
1281
+ *
1282
+ * @param value - The token to set.
1283
+ */
1284
+ set token(value) {
1285
+ // Retrieve the existing token info or initialize a new object
1286
+ const tokenInfo = this.getTokenInfo() || {};
1287
+ // Update the token value
1288
+ tokenInfo.token = value;
1289
+ // Save the updated token info back to storage
1290
+ this.setTokenInfo(tokenInfo);
1291
+ }
1292
+ /**
1293
+ * Retrieves the refresh token from the token info.
1294
+ *
1295
+ * @returns The refresh token if it exists, otherwise `null`.
1296
+ */
1297
+ get refreshToken() {
1298
+ // Retrieve and return the refresh token from the token info, or return null if it doesn't exist
1299
+ return this.getTokenInfo()?.refreshToken || null;
1300
+ }
1301
+ /**
1302
+ * Sets the refresh token in the token info.
1303
+ *
1304
+ * @param value - The refresh token to set.
1305
+ */
1306
+ set refreshToken(value) {
1307
+ // Retrieve the existing token info or initialize a new object
1308
+ const tokenInfo = this.getTokenInfo() || {};
1309
+ // Update the refresh token value
1310
+ tokenInfo.refreshToken = value;
1311
+ // Save the updated token info back to storage
1312
+ this.setTokenInfo(tokenInfo);
1313
+ }
1314
+ /**
1315
+ * Retrieves the refresh token expiry time from the token info.
1316
+ *
1317
+ * @returns The refresh token expiry time if it exists, otherwise `null`.
1318
+ */
1319
+ get refreshTokenExpiry() {
1320
+ // Retrieve and return the refresh token expiry time from the token info,
1321
+ // or return null if it doesn't exist
1322
+ return this.getTokenInfo()?.refreshTokenExpiry || null;
1323
+ }
1324
+ /**
1325
+ * Sets the refresh token expiry time in the token info.
1326
+ *
1327
+ * @param value - The refresh token expiry time to set.
1328
+ */
1329
+ set refreshTokenExpiry(value) {
1330
+ // Retrieve the existing token info or initialize a new object
1331
+ const tokenInfo = this.getTokenInfo() || {};
1332
+ // Update the refresh token expiry time
1333
+ tokenInfo.refreshTokenExpiry = value;
1334
+ // Save the updated token info back to storage
1335
+ this.setTokenInfo(tokenInfo);
1336
+ }
1337
+ /**
1338
+ * Retrieves the static token from the token info.
1339
+ *
1340
+ * @returns The static token if it exists, otherwise `null`.
1341
+ */
1342
+ get staticToken() {
1343
+ // Retrieve and return the static token from the token info,
1344
+ // or return null if it doesn't exist
1345
+ return this.getTokenInfo()?.staticToken || null;
1346
+ }
1347
+ /**
1348
+ * Sets the static token in the token info.
1349
+ *
1350
+ * @param value - The static token to set.
1351
+ */
1352
+ set staticToken(value) {
1353
+ // Retrieve the existing token info or initialize a new object
1354
+ const tokenInfo = this.getTokenInfo() || {};
1355
+ // Update the static token value
1356
+ tokenInfo.staticToken = value;
1357
+ // Save the updated token info back to storage
1358
+ this.setTokenInfo(tokenInfo);
1359
+ }
1360
+ /**
1361
+ * Retrieves the user ID from the user info.
1362
+ *
1363
+ * @returns The user ID if it exists, otherwise `null`.
1364
+ */
1365
+ get userId() {
1366
+ // Retrieve and return the user ID from the user info, or return null if it doesn't exist
1367
+ return this.getUserInfo()?.user?.Id || null;
1368
+ }
1369
+ /**
1370
+ * Retrieves the user's roles from the user information.
1371
+ *
1372
+ * @returns An array of user roles if they exist, otherwise `null`.
1373
+ */
1374
+ get userRoles() {
1375
+ // Retrieve and return the user roles from the user info, or return null if they don't exist
1376
+ return this.getUserInfo()?.user?.Roles || null;
1377
+ }
1378
+ /**
1379
+ * Retrieves the user's teams from the user information.
1380
+ *
1381
+ * @returns An array of user teams if they exist, otherwise `null`.
1382
+ */
1383
+ get userTeams() {
1384
+ // Retrieve and return the user teams from the user info, or return null if they don't exist
1385
+ return this.getUserInfo()?.user?.Teams || null;
1386
+ }
1387
+ /**
1388
+ * Removes the tenant ID from the organization information.
1389
+ */
1390
+ removeTenantId() {
1391
+ this.removeFromOrgInfo('Id');
1392
+ }
1393
+ /**
1394
+ * Removes the tenant name from the organization information.
1395
+ */
1396
+ removeTenantName() {
1397
+ // Remove the tenant name from the organization information
1398
+ this.removeFromOrgInfo('OrganizationName');
1399
+ }
1400
+ /**
1401
+ * Removes the subdomain from the organization information.
1402
+ *
1403
+ * This removes the subdomain property from the organization information
1404
+ * stored in local storage.
1405
+ */
1406
+ removeSubdomain() {
1407
+ // Remove the subdomain from the organization information
1408
+ this.removeFromOrgInfo('Subdomain');
1409
+ }
1410
+ /**
1411
+ * Removes the app ID from the app information.
1412
+ *
1413
+ * This removes the app ID property from the app information stored in local storage.
1414
+ */
1415
+ removeAppId() {
1416
+ this.removeFromAppInfo('Id');
1417
+ }
1418
+ /**
1419
+ * Removes the app name from the app information.
1420
+ *
1421
+ * This removes the app name property from the app information stored in local storage.
1422
+ */
1423
+ removeAppName() {
1424
+ this.removeFromAppInfo('AppName');
1425
+ }
1426
+ /**
1427
+ * Removes the environment ID from the environment information.
1428
+ *
1429
+ * This removes the ID property from the environment information
1430
+ * stored in local storage.
1431
+ */
1432
+ removeEnvironmentId() {
1433
+ // Remove the environment ID from the environment information
1434
+ this.removeFromEnvironmentInfo('Id');
1435
+ }
1436
+ /**
1437
+ * Removes the environment name from the environment information.
1438
+ *
1439
+ * This removes the Name property from the environment information
1440
+ * stored in local storage.
1441
+ */
1442
+ removeEnvironmentName() {
1443
+ // Remove the environment name from the environment information
1444
+ this.removeFromEnvironmentInfo('Name');
1445
+ }
1446
+ /**
1447
+ * Removes the token from the token info.
1448
+ *
1449
+ * This removes the token property from the token information stored in session
1450
+ * storage.
1451
+ */
1452
+ removeToken() {
1453
+ // Remove the token from the token info
1454
+ this.removeFromTokenInfo('token');
1455
+ }
1456
+ /**
1457
+ * Removes the refresh token from the token information.
1458
+ *
1459
+ * This removes the refresh token property from the token information stored in session
1460
+ * storage.
1461
+ */
1462
+ removeRefreshToken() {
1463
+ this.removeFromTokenInfo('refreshToken');
1464
+ }
1465
+ /**
1466
+ * Removes the refresh token expiry time from the token information.
1467
+ *
1468
+ * This removes the refresh token expiry time property from the token information stored in session
1469
+ * storage.
1470
+ */
1471
+ removeRefreshTokenExpiry() {
1472
+ // Remove the refresh token expiry from the token info
1473
+ this.removeFromTokenInfo('refreshTokenExpiry');
1474
+ }
1475
+ /**
1476
+ * Removes the static token from the token information.
1477
+ *
1478
+ * This removes the static token property from the token information stored in session
1479
+ * storage.
1480
+ */
1481
+ removeStaticToken() {
1482
+ // Remove the static token from the token info
1483
+ this.removeFromTokenInfo('staticToken');
1484
+ }
1485
+ /**
1486
+ * Removes the specified key from the organization information.
1487
+ *
1488
+ * This removes the specified key from the organization information stored in local storage.
1489
+ *
1490
+ * @param key The key to remove from the organization information.
1491
+ */
1492
+ removeFromOrgInfo(key) {
1493
+ const orgInfo = this.getOrgInfo();
1494
+ if (orgInfo) {
1495
+ // Remove the key from the organization information
1496
+ delete orgInfo[key];
1497
+ // Save the updated organization information back to local storage
1498
+ this.setOrgInfo(orgInfo);
1499
+ }
1500
+ }
1501
+ /**
1502
+ * Removes the specified key from the app information.
1503
+ *
1504
+ * This removes the specified key from the app information stored in session
1505
+ * storage.
1506
+ *
1507
+ * @param key The key to remove from the app information.
1508
+ */
1509
+ removeFromAppInfo(key) {
1510
+ const appInfo = this.getAppInfo();
1511
+ if (appInfo) {
1512
+ // Remove the key from the app information
1513
+ delete appInfo[key];
1514
+ // Save the updated app information back to session storage
1515
+ this.setAppInfo(appInfo);
1516
+ }
1517
+ }
1518
+ /**
1519
+ * Removes the specified key from the environment information.
1520
+ *
1521
+ * This removes the specified key from the environment information stored in session
1522
+ * storage.
1523
+ *
1524
+ * @param key The key to remove from the environment information.
1525
+ */
1526
+ removeFromEnvironmentInfo(key) {
1527
+ const environmentInfo = this.getEnvironmentInfo();
1528
+ if (environmentInfo) {
1529
+ // Remove the key from the environment information
1530
+ delete environmentInfo[key];
1531
+ // Save the updated environment information back to session storage
1532
+ this.setEnvironmentInfo(environmentInfo);
1533
+ }
1534
+ }
1535
+ /**
1536
+ * Removes the specified key from the token information.
1537
+ *
1538
+ * This removes the specified key from the token information stored in session
1539
+ * storage.
1540
+ *
1541
+ * @param key The key to remove from the token information.
1542
+ */
1543
+ removeFromTokenInfo(key) {
1544
+ const tokenInfo = this.getTokenInfo();
1545
+ if (tokenInfo) {
1546
+ // Remove the key from the token information
1547
+ delete tokenInfo[key];
1548
+ // Save the updated token information back to session storage
1549
+ this.setTokenInfo(tokenInfo);
1550
+ }
1551
+ }
1552
+ /**
1553
+ * Retrieves the organization information from local storage.
1554
+ *
1555
+ * @returns The organization information object or null if it doesn't exist.
1556
+ */
1557
+ getOrgInfo() {
1558
+ return this.getFromStorage(StorageType.Local, StorageConstants.orgInfo);
1559
+ }
1560
+ /**
1561
+ * Saves the organization information to local storage.
1562
+ *
1563
+ * @param orgInfo - The organization information to store.
1564
+ */
1565
+ setOrgInfo(orgInfo) {
1566
+ // temp once remove from dropdown, we can remove this
1567
+ if (orgInfo.Id) {
1568
+ this.setSession(StorageConstants.TenantId, orgInfo.Id);
1569
+ }
1570
+ else {
1571
+ this.removeSession(StorageConstants.TenantId);
1572
+ }
1573
+ // Save the organization info to local storage
1574
+ this.setToStorage(StorageType.Local, StorageConstants.orgInfo, orgInfo);
1575
+ }
1576
+ /**
1577
+ * Retrieves the app information from session storage.
1578
+ *
1579
+ * @returns The app information object or null if it doesn't exist.
1580
+ */
1581
+ getAppInfo() {
1582
+ return this.getFromStorage(StorageType.Session, StorageConstants.appInfo);
1583
+ }
1584
+ /**
1585
+ * Saves the app information to session storage.
1586
+ *
1587
+ * @param appInfo - The app information to store.
1588
+ */
1589
+ setAppInfo(appInfo) {
1590
+ // temp once remove from dropdown, we can remove this
1591
+ if (appInfo?.Id) {
1592
+ this.setSession(StorageConstants.AppId, appInfo.Id);
1593
+ }
1594
+ else {
1595
+ this.removeSession(StorageConstants.AppId);
1596
+ }
1597
+ if (appInfo?.AppName) {
1598
+ this.setSession(StorageConstants.applicationCode, appInfo.AppName);
1599
+ }
1600
+ else {
1601
+ this.removeSession(StorageConstants.applicationCode);
1602
+ }
1603
+ // Save the app info to session storage
1604
+ this.setToStorage(StorageType.Session, StorageConstants.appInfo, appInfo);
1605
+ }
1606
+ /**
1607
+ * Retrieves the environment information from session storage.
1608
+ *
1609
+ * @returns The environment information object or null if it doesn't exist.
1610
+ */
1611
+ getEnvironmentInfo() {
1612
+ return this.getFromStorage(StorageType.Session, StorageConstants.environmentInfo);
1613
+ }
1614
+ /**
1615
+ * Saves the environment information to session storage.
1616
+ *
1617
+ * @param envInfo - The environment information to store.
1618
+ */
1619
+ setEnvironmentInfo(envInfo) {
1620
+ // Save the environment info to session storage
1621
+ this.setToStorage(StorageType.Session, StorageConstants.environmentInfo, envInfo);
1622
+ }
1623
+ /**
1624
+ * Retrieves the token information from session storage.
1625
+ *
1626
+ * @returns The token information object or null if it doesn't exist.
1627
+ */
1628
+ getTokenInfo() {
1629
+ return this.getFromStorage(StorageType.Session, StorageConstants.tokenInfo);
1630
+ }
1631
+ /**
1632
+ * Saves the token information to session storage.
1633
+ *
1634
+ * @param tokenInfo - The token information to store.
1635
+ */
1636
+ setTokenInfo(tokenInfo) {
1637
+ // temp once remove from dropdown, we can remove this
1638
+ if (tokenInfo?.token) {
1639
+ this.setSession(StorageConstants.token, tokenInfo?.token);
1640
+ }
1641
+ else {
1642
+ this.removeSession(StorageConstants.token);
1643
+ }
1644
+ // Save the token info to session storage
1645
+ this.setToStorage(StorageType.Session, StorageConstants.tokenInfo, tokenInfo);
1646
+ }
1647
+ /**
1648
+ * Retrieves the user information from local storage.
1649
+ *
1650
+ * @returns The user information object or null if it doesn't exist.
1651
+ */
1652
+ getUserInfo() {
1653
+ return this.getFromStorage(StorageType.Local, StorageConstants.userInfo);
1654
+ }
1655
+ /**
1656
+ * Sets the user information in local storage.
1657
+ *
1658
+ * @param userInfo The user information to store.
1659
+ */
1660
+ setUserInfo(userInfo) {
1661
+ // Save the user info to local storage
1662
+ this.setToStorage(StorageType.Local, StorageConstants.userInfo, userInfo);
1663
+ }
1664
+ /**
1665
+ * Sets a key-value pair in local storage.
1666
+ *
1667
+ * @param key The key to store the value under.
1668
+ * @param data The value to store.
1669
+ */
1670
+ setLocal(key, data) {
1671
+ this.setToStorage(StorageType.Local, key, data);
1672
+ }
1673
+ /**
1674
+ * Retrieves a value from local storage by key.
1675
+ *
1676
+ * @param key The key associated with the value to retrieve.
1677
+ * @returns The value stored in local storage, or null if it doesn't exist.
1678
+ */
1679
+ getLocal(key) {
1680
+ return this.getFromStorage(StorageType.Local, key);
1681
+ }
1682
+ /**
1683
+ * Removes a key-value pair from local storage.
1684
+ *
1685
+ * @param key The key associated with the value to remove.
1686
+ */
1687
+ removeLocal(key) {
1688
+ // Remove the key from local storage
1689
+ this.removeFromStorage(StorageType.Local, key);
1690
+ }
1691
+ /**
1692
+ * Clears all local storage data.
1693
+ */
1694
+ clearLocal() {
1695
+ this.clearStorage(StorageType.Local);
1696
+ }
1697
+ /**
1698
+ * Sets a key-value pair in session storage.
1699
+ *
1700
+ * @param key The key to store the value under.
1701
+ * @param data The value to store.
1702
+ */
1703
+ setSession(key, data) {
1704
+ // Save data to session storage under the specified key
1705
+ this.setToStorage(StorageType.Session, key, data);
1706
+ }
1707
+ /**
1708
+ * Retrieves a value from session storage by key.
1709
+ *
1710
+ * @param key The key associated with the value to retrieve.
1711
+ * @returns The value stored in session storage, or null if it doesn't exist.
1712
+ */
1713
+ getSession(key) {
1714
+ // Retrieve the value from session storage
1715
+ return this.getFromStorage(StorageType.Session, key);
1716
+ }
1717
+ /**
1718
+ * Removes a key-value pair from session storage.
1719
+ *
1720
+ * @param key The key associated with the value to remove.
1721
+ */
1722
+ removeSession(key) {
1723
+ // Remove the key from session storage
1724
+ this.removeFromStorage(StorageType.Session, key);
1725
+ }
1726
+ /**
1727
+ * Clears all session storage data.
1728
+ */
1729
+ clearSession() {
1730
+ // Remove all key-value pairs from session storage
1731
+ this.clearStorage(StorageType.Session);
1732
+ }
1733
+ /**
1734
+ * Clears all authentication-related data from local and session storage.
1735
+ *
1736
+ * This method is typically used after a user logs out.
1737
+ */
1738
+ clearAuth() {
1739
+ // Remove user info from local storage
1740
+ this.removeFromStorage(StorageType.Local, StorageConstants.userInfo);
1741
+ // Remove token info from session storage
1742
+ this.removeFromStorage(StorageType.Session, StorageConstants.tokenInfo);
1743
+ }
1744
+ /**
1745
+ * Generic getter method for retrieving data from either local or session storage.
1746
+ *
1747
+ * @param storage The type of storage to retrieve from.
1748
+ * @param key The key associated with the data to retrieve.
1749
+ * @returns The retrieved data, deserialized from JSON if it was stored as a string.
1750
+ */
1751
+ getFromStorage(storage, key) {
1752
+ // Retrieve the data from the specified storage
1753
+ const data = storage === StorageType.Local
1754
+ ? this._localStorageService.getLocalStorage(key)
1755
+ : this._sessionStorageService.getSessionStorage(key);
1756
+ try {
1757
+ // Attempt to parse the data as JSON
1758
+ return typeof data === 'string' ? JSON.parse(data) : data;
1759
+ }
1760
+ catch (e) {
1761
+ // If the data cannot be parsed, return it as is
1762
+ return data;
1763
+ }
1764
+ }
1765
+ /**
1766
+ * Sets a key-value pair in the specified storage type.
1767
+ *
1768
+ * @param storage The type of storage to use (local or session).
1769
+ * @param key The key under which the data should be stored.
1770
+ * @param data The data to store.
1771
+ */
1772
+ setToStorage(storage, key, data) {
1773
+ // Check if the storage type is local
1774
+ if (storage === StorageType.Local) {
1775
+ // Set the data in local storage
1776
+ this._localStorageService.setLocalStorage(key, data);
1777
+ }
1778
+ else {
1779
+ // Otherwise, set the data in session storage
1780
+ this._sessionStorageService.setSessionStorage(key, data);
1781
+ }
1782
+ }
1783
+ /**
1784
+ * Removes a key-value pair from the specified storage type.
1785
+ *
1786
+ * This method removes the given key from either local or session storage
1787
+ * based on the specified storage type.
1788
+ *
1789
+ * @param storage The type of storage to remove from (local or session).
1790
+ * @param key The key associated with the value to remove.
1791
+ */
1792
+ removeFromStorage(storage, key) {
1793
+ if (storage === StorageType.Local) {
1794
+ // Remove the key from local storage
1795
+ this._localStorageService.removeLocalStorage(key);
1796
+ }
1797
+ else {
1798
+ // Remove the key from session storage
1799
+ this._sessionStorageService.removeSessionStorage(key);
1800
+ }
1801
+ }
1802
+ /**
1803
+ * Clears all key-value pairs from the specified storage type.
1804
+ *
1805
+ * This method clears all key-value pairs from either local or session storage
1806
+ * based on the specified storage type.
1807
+ *
1808
+ * @param storage The type of storage to clear (local or session).
1809
+ */
1810
+ clearStorage(storage) {
1811
+ if (storage === StorageType.Local) {
1812
+ // Clear local storage
1813
+ this._localStorageService.clearLocalStorage();
1814
+ }
1815
+ else {
1816
+ // Clear session storage
1817
+ this._sessionStorageService.clearSessionStorage();
1818
+ }
1819
+ }
1820
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: StoreService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1821
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: StoreService, providedIn: 'root' });
1822
+ }
1823
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: StoreService, decorators: [{
1824
+ type: Injectable,
1825
+ args: [{
1826
+ providedIn: 'root'
1827
+ }]
1828
+ }] });
1829
+
1830
+ class UtilService {
1831
+ // Will store the services from context
1832
+ _context = null;
1833
+ _initialized = false;
1834
+ /**
1835
+ * Initializes the UtilService with context that contains service references
1836
+ *
1837
+ * @param context The context object containing service references
1838
+ * @returns A proxy that intercepts and delegates method calls to the appropriate service
1839
+ */
1840
+ init(context) {
1841
+ if (this._initialized) {
1842
+ return this;
1843
+ }
1844
+ this._context = context;
1845
+ this._initialized = true;
1846
+ // Return a proxy that will intercept method calls
1847
+ return new Proxy(this, {
1848
+ get: (target, prop) => {
1849
+ // First check if the property exists directly on UtilService
1850
+ if (prop in target) {
1851
+ return target[prop];
1852
+ }
1853
+ // Convert symbol to string if needed
1854
+ const propName = prop.toString();
1855
+ // Check context services first
1856
+ if (this._context && Object.keys(this._context).length > 0) {
1857
+ // Loop through each service in the context
1858
+ for (const serviceName of Object.keys(this._context)) {
1859
+ const service = this._context[serviceName];
1860
+ if (service && typeof service === 'object' && propName in service && typeof service[propName] === 'function') {
1861
+ // Return the bound function from the service
1862
+ return service[propName].bind(service);
1863
+ }
1864
+ }
1865
+ }
1866
+ // If property not found anywhere, return undefined
1867
+ return undefined;
1868
+ }
1869
+ });
1870
+ }
1871
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UtilService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1872
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UtilService, providedIn: 'root' });
1873
+ }
1874
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UtilService, decorators: [{
1875
+ type: Injectable,
1876
+ args: [{
1877
+ providedIn: 'root'
1878
+ }]
1879
+ }] });
1880
+
260
1881
  class TabSdk {
1882
+ static app;
261
1883
  static auth;
262
1884
  static ui;
1885
+ static form;
1886
+ static transition;
263
1887
  static metadataUtils;
264
- static context;
1888
+ static file;
1889
+ static report;
1890
+ static release;
1891
+ static analytics;
1892
+ static translator;
1893
+ static crud;
1894
+ static http;
1895
+ static store;
1896
+ static util;
265
1897
  /**
266
1898
  * Initialize the SDK with necessary services
267
1899
  */
268
1900
  static init(injector, context) {
269
1901
  // Expose to window for global access if needed
270
1902
  window.TabSdk = TabSdk;
271
- // external services
272
- this.context = context;
273
1903
  // Initialize services
1904
+ this.app = injector.get(AppService);
274
1905
  this.auth = injector.get(AuthUtilService);
275
1906
  this.ui = injector.get(UiService);
1907
+ this.form = injector.get(FormService);
1908
+ this.transition = injector.get(TransitionService);
276
1909
  this.metadataUtils = injector.get(MetadataHelper);
1910
+ this.file = injector.get(FileService);
1911
+ this.report = injector.get(ReportService);
1912
+ this.release = injector.get(ReleaseService);
1913
+ this.analytics = injector.get(AnalyticsService);
1914
+ this.translator = injector.get(TranslatorService);
1915
+ this.crud = injector.get(CrudService);
1916
+ this.http = injector.get(HttpService);
1917
+ this.store = injector.get(StoreService);
1918
+ // Initialize util service with context
1919
+ const utilService = injector.get(UtilService);
1920
+ this.util = utilService.init(context);
277
1921
  // Freeze the global object to prevent modifications
278
1922
  Object.freeze(this);
279
- Object.freeze(this.context);
1923
+ Object.freeze(this.app);
1924
+ Object.freeze(this.auth);
1925
+ Object.freeze(this.ui);
1926
+ Object.freeze(this.form);
1927
+ Object.freeze(this.transition);
1928
+ Object.freeze(this.file);
1929
+ Object.freeze(this.report);
1930
+ Object.freeze(this.release);
1931
+ Object.freeze(this.analytics);
1932
+ Object.freeze(this.translator);
1933
+ Object.freeze(this.crud);
1934
+ Object.freeze(this.http);
1935
+ Object.freeze(this.store);
1936
+ Object.freeze(this.util);
280
1937
  }
281
1938
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabSdk, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
282
1939
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabSdk, providedIn: 'root' });