@techextensor/tab-sdk 0.0.3 → 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 (47) 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/auth/auth.service.mjs +95 -0
  8. package/esm2022/lib/crud/crud.service.mjs +161 -0
  9. package/esm2022/lib/enum/store.enum.mjs +6 -0
  10. package/esm2022/lib/enum/ui.enum.mjs +13 -0
  11. package/esm2022/lib/http/http.service.mjs +58 -0
  12. package/esm2022/lib/interface/http.interface.mjs +2 -0
  13. package/esm2022/lib/interface/ui.interface.mjs +2 -0
  14. package/esm2022/lib/store/store.service.mjs +719 -0
  15. package/esm2022/lib/tab-sdk.service.mjs +52 -18
  16. package/esm2022/lib/ui/form.service.mjs +58 -76
  17. package/esm2022/lib/ui/ui.service.mjs +297 -2
  18. package/esm2022/lib/util/util.service.mjs +53 -0
  19. package/esm2022/lib/workflow/transition.service.mjs +40 -0
  20. package/fesm2022/techextensor-tab-sdk.mjs +1855 -341
  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/auth/auth.service.d.ts +58 -0
  29. package/lib/crud/crud.service.d.ts +88 -0
  30. package/lib/enum/store.enum.d.ts +4 -0
  31. package/lib/enum/ui.enum.d.ts +10 -0
  32. package/lib/http/http.service.d.ts +35 -0
  33. package/lib/interface/http.interface.d.ts +8 -0
  34. package/lib/interface/ui.interface.d.ts +24 -0
  35. package/lib/store/store.service.d.ts +406 -0
  36. package/lib/tab-sdk.service.d.ts +24 -8
  37. package/lib/ui/form.service.d.ts +35 -44
  38. package/lib/ui/ui.service.d.ts +154 -0
  39. package/lib/util/util.service.d.ts +14 -0
  40. package/lib/workflow/transition.service.d.ts +21 -0
  41. package/package.json +2 -2
  42. package/esm2022/lib/common/utils.service.mjs +0 -163
  43. package/esm2022/lib/core/auth.service.mjs +0 -48
  44. package/esm2022/lib/data/data.service.mjs +0 -81
  45. package/lib/common/utils.service.d.ts +0 -58
  46. package/lib/core/auth.service.d.ts +0 -28
  47. package/lib/data/data.service.d.ts +0 -36
@@ -1,90 +1,409 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Injectable } from '@angular/core';
3
- import { TabInsertService, TabUpdateService, TabDeleteService, SessionStorageService, LocalStorageService, StorageConstants, MetadataHelper } from '@techextensor/tab-core-utility';
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
+ import { firstValueFrom } from 'rxjs';
4
5
 
5
- class DataService {
6
- _tabInsertService = inject(TabInsertService);
7
- _tabUpdateService = inject(TabUpdateService);
8
- _tabDeleteService = inject(TabDeleteService);
9
- /**
10
- * Insert a new record
11
- *
12
- * @example
13
- * const newRecord = await sdk.data.insert('123456', {
14
- * name: 'ACME Corp',
15
- * email: 'contact@acme.com'
16
- * });
17
- */
18
- insert(objectId, data) {
19
- return new Promise((resolve, reject) => {
20
- this._tabInsertService.insertByObjectId(objectId, { data })
21
- ?.subscribe((response) => {
22
- if (response?.StatusCode == 200 && response?.Result) {
23
- resolve(response.Result);
24
- }
25
- else {
26
- reject(new Error('Failed to insert record'));
27
- }
28
- });
6
+ var ScreenDisplayMode;
7
+ (function (ScreenDisplayMode) {
8
+ ScreenDisplayMode["Sidebar"] = "sidebar";
9
+ ScreenDisplayMode["Popup"] = "popup";
10
+ ScreenDisplayMode["SameTab"] = "sameTab";
11
+ ScreenDisplayMode["NewTab"] = "newTab";
12
+ })(ScreenDisplayMode || (ScreenDisplayMode = {}));
13
+ var NavigationType;
14
+ (function (NavigationType) {
15
+ NavigationType["NavigateToUrl"] = "navigateToUrl";
16
+ NavigationType["NavigateToSubdomain"] = "navigateToSubdomain";
17
+ })(NavigationType || (NavigationType = {}));
18
+
19
+ class UiService {
20
+ _notificationService = inject(NotificationService);
21
+ _confirmationService = inject(ConfirmationService);
22
+ /**
23
+ * Open a screen with the given options. The mode determines how the screen is
24
+ * displayed.
25
+ *
26
+ * @param options The options for opening the screen.
27
+ */
28
+ openScreen(options) {
29
+ const { mode, screenId, reqtokens, submission, title, width, height, customClass } = options;
30
+ switch (mode) {
31
+ case ScreenDisplayMode.Sidebar:
32
+ this.showSidebar({ screenId, reqtokens, submission, title, width, height, customClass });
33
+ break;
34
+ case ScreenDisplayMode.Popup:
35
+ this.showDialog({ screenId, reqtokens, submission, title, width, height, customClass });
36
+ break;
37
+ case ScreenDisplayMode.SameTab:
38
+ this.navigateTo({ screenId, reqtokens });
39
+ break;
40
+ case ScreenDisplayMode.NewTab:
41
+ this.openInNewTab({ screenId, reqtokens });
42
+ break;
43
+ }
44
+ }
45
+ /**
46
+ * Opens a screen in a sidebar.
47
+ *
48
+ * @param options The options for opening the sidebar.
49
+ */
50
+ showSidebar(options) {
51
+ const otherConfiguration = {
52
+ ...(options.title && { title: options.title }),
53
+ ...(options.width && { width: options.width }),
54
+ ...(options.height && { height: options.height }),
55
+ ...(options.customClass && { customClass: options.customClass })
56
+ };
57
+ TabSdk.util?.openScreen(ScreenDisplayMode.Sidebar, options.screenId, options.reqtokens || undefined, options.submission || undefined, Object.keys(otherConfiguration).length > 0 ? otherConfiguration : undefined);
58
+ }
59
+ /**
60
+ * Opens a screen in a popup dialog.
61
+ *
62
+ * @param options The options for opening the dialog.
63
+ */
64
+ showDialog(options) {
65
+ const otherConfiguration = {
66
+ ...(options.title && { title: options.title }),
67
+ ...(options.width && { width: options.width }),
68
+ ...(options.height && { height: options.height }),
69
+ ...(options.customClass && { customClass: options.customClass })
70
+ };
71
+ TabSdk.util?.openScreen(ScreenDisplayMode.Popup, options.screenId, options.reqtokens || undefined, options.submission || undefined, Object.keys(otherConfiguration).length > 0 ? otherConfiguration : undefined);
72
+ }
73
+ /**
74
+ * Navigates to a screen within the same tab.
75
+ *
76
+ * @param options - The options for navigation, including screenId and optional reqtokens.
77
+ */
78
+ navigateTo(options) {
79
+ TabSdk.util?.openScreen(ScreenDisplayMode.SameTab, options.screenId, options.reqtokens || undefined);
80
+ }
81
+ /**
82
+ * Navigates to a screen in a new tab.
83
+ *
84
+ * @param options The options for navigation, including screenId and optional reqtokens.
85
+ */
86
+ openInNewTab(options) {
87
+ TabSdk.util?.openScreen(ScreenDisplayMode.NewTab, options.screenId, options.reqtokens || undefined);
88
+ }
89
+ /**
90
+ * Navigates to the specified URL.
91
+ *
92
+ * @param url - The URL to navigate to.
93
+ */
94
+ navigateToUrl(url) {
95
+ TabSdk.util?.navigateToUrl({
96
+ url,
97
+ type: NavigationType.NavigateToUrl
29
98
  });
30
99
  }
31
100
  /**
32
- * Update an existing record
101
+ * Navigates to a specified subdomain using the provided options.
33
102
  *
34
- * @example
35
- * await sdk.data.update('12345', {
36
- * Id: '12345',
37
- * name: 'ACME Corporation',
38
- * status: 'active'
39
- * });
103
+ * @param options - The options for navigation, including subDomain, appCode, and url.
40
104
  */
41
- update(objectId, data) {
42
- return new Promise((resolve, reject) => {
43
- this._tabUpdateService.updateByObjectId(objectId, { data })
44
- ?.subscribe((response) => {
45
- if (response?.StatusCode == 200 && response?.Result) {
46
- resolve(response.Result);
47
- }
48
- else {
49
- reject(new Error('Failed to update record'));
50
- }
51
- });
105
+ navigateToSubdomain(options) {
106
+ TabSdk.util?.navigateToUrl({
107
+ ...options,
108
+ type: NavigationType.NavigateToUrl
52
109
  });
53
110
  }
54
111
  /**
55
- * Delete a record
112
+ * Retrieves the active screen ID from the current URL.
56
113
  *
57
- * @example
58
- * await sdk.data.delete('12345', {Id: '12345'});
114
+ * @returns The screen ID if present in the URL, otherwise undefined.
59
115
  */
60
- delete(objectId, data) {
61
- return new Promise((resolve, reject) => {
62
- this._tabDeleteService.deleteRecord('', { data }, objectId)
63
- ?.subscribe((response) => {
64
- if (response?.StatusCode == 200) {
65
- resolve();
66
- }
67
- else {
68
- reject(new Error('Failed to delete record'));
69
- }
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;
123
+ }
124
+ /**
125
+ * Show a notification to the user.
126
+ *
127
+ * @param options The options for the notification.
128
+ */
129
+ 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
+ });
136
+ }
137
+ /**
138
+ * Displays a success notification to the user.
139
+ *
140
+ * @param options - The options for the notification, including message, title, and configuration.
141
+ */
142
+ showSuccess(options) {
143
+ this.notify({
144
+ ...options,
145
+ type: NotificationType.Success,
146
+ title: options?.title ?? 'Success'
147
+ });
148
+ }
149
+ /**
150
+ * Displays a warning notification to the user.
151
+ *
152
+ * @param options - The options for the notification, including message, title, and configuration.
153
+ */
154
+ showWarning(options) {
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
+ });
172
+ }
173
+ /**
174
+ * Displays an error notification to the user.
175
+ *
176
+ * @param options - The options for the notification, including message, title, and configuration.
177
+ */
178
+ showError(options) {
179
+ this.notify({
180
+ ...options,
181
+ type: NotificationType.Error,
182
+ title: options?.title ?? 'Error'
183
+ });
184
+ }
185
+ /**
186
+ * Displays a confirmation dialog to the user and returns a promise that resolves
187
+ * to a boolean indicating whether the user confirmed the action.
188
+ *
189
+ * @param options - The options for the confirmation dialog, including title, message,
190
+ * confirmText, cancelText, and visibility of buttons.
191
+ * @returns A promise that resolves to true if the user confirms, false otherwise.
192
+ */
193
+ confirm(options) {
194
+ return new Promise((resolve) => {
195
+ this._confirmationService.confirm(options)
196
+ ?.subscribe((isConfirmed) => {
197
+ resolve(isConfirmed);
70
198
  });
71
199
  });
72
200
  }
73
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
74
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DataService, providedIn: 'root' });
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
+ }
312
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
313
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UiService, providedIn: 'root' });
75
314
  }
76
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DataService, decorators: [{
315
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UiService, decorators: [{
77
316
  type: Injectable,
78
317
  args: [{
79
318
  providedIn: 'root'
80
319
  }]
81
320
  }] });
82
321
 
83
- class UiService {
84
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
85
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UiService, providedIn: 'root' });
322
+ class AuthUtilService {
323
+ _authService = inject(AuthService);
324
+ /**
325
+ * Authenticates a user based on the provided login credentials.
326
+ *
327
+ * @param credentials The login credentials.
328
+ * @returns The response from the server.
329
+ */
330
+ async login(credentials) {
331
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
332
+ const response = await firstValueFrom(this._authService.signIn(credentials));
333
+ return response;
334
+ }
335
+ /**
336
+ * Registers a new tenant based on the provided details.
337
+ *
338
+ * @param tenantDetails The tenant details.
339
+ * @returns The response from the server.
340
+ */
341
+ async registerTenant(tenantDetails) {
342
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
343
+ const response = await firstValueFrom(this._authService.registerTenant(tenantDetails));
344
+ return response;
345
+ }
346
+ /**
347
+ * Registers a new user based on the provided user details.
348
+ *
349
+ * @param userDetails The user details.
350
+ * @param headers Optional headers to pass to the server.
351
+ * @returns The response from the server.
352
+ */
353
+ async registerUser(userDetails, headers) {
354
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
355
+ const response = await firstValueFrom(this._authService.register(userDetails, headers));
356
+ return response;
357
+ }
358
+ /**
359
+ * Resets a user's password based on the provided reset password credentials.
360
+ *
361
+ * @param credentials The reset password credentials.
362
+ * @returns The response from the server.
363
+ */
364
+ async resetPassword(credentials) {
365
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
366
+ const response = await firstValueFrom(this._authService.resetPassword(credentials));
367
+ return response;
368
+ }
369
+ /**
370
+ * Changes a user's password based on the provided credentials.
371
+ *
372
+ * @param credentials The credentials containing the user's current and new password.
373
+ * @returns The response from the server.
374
+ */
375
+ async changePassword(credentials) {
376
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
377
+ const response = await firstValueFrom(this._authService.changePassword(credentials));
378
+ return response;
379
+ }
380
+ /**
381
+ * Refreshes a user's token based on the provided refresh token details.
382
+ *
383
+ * @param tokenDetails The refresh token details.
384
+ * @returns The response from the server.
385
+ */
386
+ async refreshToken(tokenDetails) {
387
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
388
+ const response = await firstValueFrom(this._authService.refreshToken(tokenDetails));
389
+ return response;
390
+ }
391
+ /**
392
+ * Gets the user details for the provided user details request.
393
+ *
394
+ * @param userDetailsRequest The user details request.
395
+ * @param headers Optional headers to pass to the server.
396
+ * @returns The response from the server.
397
+ */
398
+ async getUserDetails(userDetailsRequest, headers) {
399
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
400
+ const response = await firstValueFrom(this._authService.getUserDetails(userDetailsRequest, headers));
401
+ return response;
402
+ }
403
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthUtilService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
404
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthUtilService, providedIn: 'root' });
86
405
  }
87
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UiService, decorators: [{
406
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthUtilService, decorators: [{
88
407
  type: Injectable,
89
408
  args: [{
90
409
  providedIn: 'root'
@@ -92,88 +411,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
92
411
  }] });
93
412
 
94
413
  class FormService {
95
- _helperFunctionService = TabSdk.context?.HelperFunctionService;
96
- /**
97
- * Processes form components with individual actions in a single pass
98
- *
99
- * @example
100
- * // Process multiple components with different actions in one pass
101
- * sdk.form.processComponents(
102
- * screenParameters.rendererInstance.form.components,
103
- * [
104
- * {
105
- * keys: 'documentDetails', // Single key
106
- * action: (component) => component.hidden = true,
107
- * type: 'columns' // Optional type filter
108
- * },
109
- * {
110
- * keys: 'documentPreview,documentComments', // Multiple keys as comma-separated string
111
- * action: (component) => component.hidden = false
112
- * }
113
- * ]
114
- * );
115
- */
116
- processComponents(components, processors) {
117
- if (!components || !Array.isArray(components) || !processors?.length) {
118
- return;
119
- }
120
- this._helperFunctionService?.eachComponent(components, (component) => {
121
- processors.forEach(processor => {
122
- // Split the keys string into an array
123
- const keyList = processor.keys.split(',').map(k => k.trim());
124
- // Check if component key is in the list of keys to process
125
- if (!keyList.includes(component.key))
126
- return;
127
- // Check type match if specified
128
- if (processor.type && component.type !== processor.type)
129
- return;
130
- // All criteria matched, execute the action
131
- processor.action(component);
132
- });
133
- });
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;
134
426
  }
135
427
  /**
136
- * Updates visibility of multiple form components at once
428
+ * Retrieves the data for a screen by its ID.
137
429
  *
138
- * @example
139
- * sdk.form.setComponentsVisibility(
140
- * screenParameters.rendererInstance.form.components,
141
- * {
142
- * 'documentDetails': false,
143
- * 'documentComments': true
144
- * }
145
- * );
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.
146
433
  */
147
- setComponentsVisibility(components, visibilityMap) {
148
- const keys = Object.keys(visibilityMap);
149
- this.processComponents(components, keys.map(key => ({
150
- keys: key,
151
- action: (component) => {
152
- component.hidden = visibilityMap[key];
153
- }
154
- })));
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;
155
439
  }
156
440
  /**
157
- * Finds components by key and returns them in a structured object
441
+ * Processes a request using the provided request payload.
158
442
  *
159
- * @example
160
- * const components = sdk.form.findComponentsByKeys(
161
- * form.components,
162
- * ['documentDetails', 'documentPreview', 'documentComments']
163
- * );
443
+ * @param requestPayload The payload to be processed.
444
+ * @returns A promise of the response from the server.
164
445
  */
165
- findComponentsByKeys(components, keys, options) {
166
- const result = {};
167
- if (!components || !Array.isArray(components) || !keys?.length) {
168
- return result;
169
- }
170
- // Use the existing eachComponent helper
171
- this._helperFunctionService.eachComponent(components, (component) => {
172
- if (!options?.type || component.type === options.type) {
173
- result[component.key] = component;
174
- }
175
- }, keys);
176
- return result;
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;
177
477
  }
178
478
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
179
479
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FormService, providedIn: 'root' });
@@ -185,241 +485,1455 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
185
485
  }]
186
486
  }] });
187
487
 
188
- class AuthService {
189
- _sessionStorageService = inject(SessionStorageService);
190
- _localStorageService = inject(LocalStorageService);
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);
191
525
  /**
192
- * Get the current application code/identifier
526
+ * Rebuilds the current app.
193
527
  *
194
- * @example
195
- * const appCode = sdk.config.getAppCode();
528
+ * @returns A promise that resolves to a common API response.
196
529
  */
197
- getAppCode() {
198
- return this._sessionStorageService.getSessionStorage(StorageConstants.applicationCode) ?? '';
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;
199
535
  }
200
536
  /**
201
- * Get the current user ID
537
+ * Retrieves the schema for the current app.
202
538
  *
203
- * @example
204
- * const userId = sdk.auth.getCurrentUserId();
539
+ * @returns A promise that resolves to a common API response containing the schema.
205
540
  */
206
- getCurrentUserId() {
207
- const userInfo = this.getCurrentUser();
208
- return userInfo?.user?.Id ?? '';
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;
209
546
  }
210
547
  /**
211
- * Get the current user information
548
+ * Retrieves the current app's permission.
212
549
  *
213
- * @example
214
- * const user = sdk.auth.getCurrentUser();
550
+ * @returns A promise that resolves to a common API response containing the permission information.
215
551
  */
216
- getCurrentUser() {
217
- const userInfoStr = this._localStorageService.getLocalStorage(StorageConstants.userInfo);
218
- if (userInfoStr) {
219
- return JSON.parse(userInfoStr);
220
- }
221
- return null;
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;
222
653
  }
223
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
224
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, providedIn: 'root' });
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' });
225
656
  }
226
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, decorators: [{
657
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AppService, decorators: [{
227
658
  type: Injectable,
228
659
  args: [{
229
660
  providedIn: 'root'
230
661
  }]
231
662
  }] });
232
663
 
233
- class UtilsService {
234
- _authService = inject(AuthService);
235
- _helperFunctionService = TabSdk.context?.HelperFunctionService;
236
- /**
237
- * Extracts the event name from various event parameter structures
238
- *
239
- * @example
240
- * const eventName = sdk.utils.extractEventName(screenParameters.event);
241
- * if (eventName === 'deleteDocument') {
242
- * // Handle delete document event
243
- * }
244
- */
245
- extractEventName(event) {
246
- if (!event)
247
- return '';
248
- // Check common patterns for event names
249
- return event.event?.component?.configuration?.configScreen?.componentValue?.eventName ??
250
- event.detail?.type ??
251
- event.type ??
252
- event.name ??
253
- '';
254
- }
255
- /**
256
- * Builds an application URL with the specified path and parameters
257
- *
258
- * @example
259
- * // Get full URL with protocol
260
- * const fullUrl = sdk.utils.buildAppUrl('screen/12345', { id: '12345' });
261
- */
262
- buildAppUrl(path, parameters, includeProtocol = true) {
263
- const appCode = this._authService.getAppCode();
264
- const params = new URLSearchParams();
265
- // Add parameters to the URL
266
- if (parameters) {
267
- Object.entries(parameters).forEach(([key, value]) => {
268
- if (value !== undefined && value !== null) {
269
- params.append(key, String(value));
270
- }
271
- });
272
- }
273
- // Build query string
274
- const queryString = params.toString() ? `?${params.toString()}` : '';
275
- // Build URL
276
- if (includeProtocol) {
277
- const host = window.location.host;
278
- return `http://${host}/${appCode}/${path}${queryString}`;
279
- }
280
- else {
281
- return `/${appCode}/${path}${queryString}`;
282
- }
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;
283
678
  }
284
679
  /**
285
- * Generates and copies a screen URL to the clipboard
286
- *
287
- * @example
288
- * // Copy URL to clipboard
289
- * sdk.utils.copyScreenLink('12345', { id: '12345' });
290
- */
291
- copyScreenLinkToClipboard(screenId, parameters) {
292
- const url = this.buildAppUrl(`screen/${screenId}`, parameters);
293
- return this._helperFunctionService.copyToClipboard(url);
294
- }
295
- /**
296
- * Downloads a blob as a file
297
- *
298
- * @example
299
- * // Download a blob as 'report.pdf'
300
- * const pdfBlob = new Blob([pdfContent], { type: 'application/pdf' });
301
- * sdk.utils.downloadBlob(pdfBlob, 'report.pdf');
302
- */
303
- downloadBlob(blob, filename) {
304
- // Create object URL
305
- const url = URL.createObjectURL(blob);
306
- // Create download link
307
- const downloadLink = document.createElement('a');
308
- downloadLink.href = url;
309
- downloadLink.download = filename;
310
- // Append to body, click, and remove
311
- document.body.appendChild(downloadLink);
312
- downloadLink.click();
313
- document.body.removeChild(downloadLink);
314
- // Release object URL after a short delay to ensure download starts
315
- setTimeout(() => URL.revokeObjectURL(url), 100);
316
- }
317
- /**
318
- * Exports HTML content as a Word document (.doc)
319
- *
320
- * @example
321
- * // Export editor content as Word document
322
- * sdk.utils.exportAsWord(editorContent, 'report');
323
- */
324
- exportAsWord(content, filename = 'document') {
325
- // Format content with Word-compatible namespaces
326
- const docContent = `
327
- <html xmlns:o="urn:schemas-microsoft-com:office:office"
328
- xmlns:w="urn:schemas-microsoft-com:office:word"
329
- xmlns="http://www.w3.org/TR/REC-html40">
330
- <head>
331
- <meta charset="utf-8">
332
- <title>${filename}</title>
333
- </head>
334
- <body>${content}</body>
335
- </html>`;
336
- // Create blob with BOM for Word compatibility
337
- const blob = new Blob(['\ufeff', docContent], {
338
- type: 'application/msword'
339
- });
340
- // Use the downloadBlob utility
341
- this.downloadBlob(blob, `${filename}.doc`);
342
- }
343
- /**
344
- * Exports HTML content as PDF using browser print functionality
345
- *
346
- * @example
347
- * // Export content as PDF
348
- * sdk.utils.exportAsPdf(documentContent, 'Invoice');
349
- */
350
- exportAsPdf(content, title = 'Document') {
351
- // Open new window
352
- const printWindow = window.open('', '', 'width=800,height=600');
353
- // Add content with basic styling
354
- printWindow.document?.write(`
355
- <html>
356
- <head>
357
- <title>${title}</title>
358
- <style>
359
- body { font-family: Arial, sans-serif; margin: 20px; }
360
- @media print {
361
- body { margin: 0mm; }
362
- }
363
- </style>
364
- </head>
365
- <body>
366
- ${content}
367
- </body>
368
- </html>
369
- `);
370
- // Prepare for printing
371
- printWindow.document.close();
372
- printWindow.focus();
373
- // Use timeout to ensure content is rendered before printing
374
- setTimeout(() => {
375
- printWindow.print();
376
- // Close window after print dialog is closed or printing is complete
377
- printWindow.addEventListener('afterprint', () => {
378
- printWindow.close();
379
- });
380
- }, 300);
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;
381
690
  }
382
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
383
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UtilsService, providedIn: 'root' });
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' });
384
693
  }
385
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UtilsService, decorators: [{
694
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FileService, decorators: [{
386
695
  type: Injectable,
387
696
  args: [{
388
697
  providedIn: 'root'
389
698
  }]
390
699
  }] });
391
700
 
392
- class TabSdk {
393
- static data;
394
- static ui;
395
- static form;
396
- static auth;
397
- static utils;
398
- static metadataUtils;
399
- static context;
701
+ class ReportService {
702
+ _appHelper = inject(AppHelper);
400
703
  /**
401
- * Initialize the SDK with necessary services
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.
402
708
  */
403
- static init(injector, context) {
404
- // Expose to window for global access if needed
405
- window.TabSdk = TabSdk;
406
- // external services
407
- this.context = context;
408
- // Initialize services
409
- this.data = injector.get(DataService);
410
- this.ui = injector.get(UiService);
411
- this.form = injector.get(FormService);
412
- this.auth = injector.get(AuthService);
413
- this.utils = injector.get(UtilsService);
414
- this.metadataUtils = injector.get(MetadataHelper);
415
- // Freeze the global object to prevent modifications
416
- Object.freeze(this);
417
- Object.freeze(this.context);
418
- Object.freeze(this.data);
419
- Object.freeze(this.ui);
420
- Object.freeze(this.form);
421
- Object.freeze(this.auth);
422
- Object.freeze(this.utils);
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
+
1881
+ class TabSdk {
1882
+ static app;
1883
+ static auth;
1884
+ static ui;
1885
+ static form;
1886
+ static transition;
1887
+ static metadataUtils;
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;
1897
+ /**
1898
+ * Initialize the SDK with necessary services
1899
+ */
1900
+ static init(injector, context) {
1901
+ // Expose to window for global access if needed
1902
+ window.TabSdk = TabSdk;
1903
+ // Initialize services
1904
+ this.app = injector.get(AppService);
1905
+ this.auth = injector.get(AuthUtilService);
1906
+ this.ui = injector.get(UiService);
1907
+ this.form = injector.get(FormService);
1908
+ this.transition = injector.get(TransitionService);
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);
1921
+ // Freeze the global object to prevent modifications
1922
+ Object.freeze(this);
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);
423
1937
  }
424
1938
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabSdk, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
425
1939
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabSdk, providedIn: 'root' });