@techextensor/tab-sdk 0.0.4 → 0.0.7

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