@techextensor/tab-sdk 0.0.7 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Injectable } from '@angular/core';
3
- import { NotificationService, ConfirmationService, NotificationType, AuthService, TabFormioService, TemplateHelper, TabBlueprintService, AppHelper, MediaUploadHelper, TabReleaseService, TranslationService, TabCrudService, TabGetService, LocalStorageService, SessionStorageService, StorageConstants, MetadataHelper } from '@techextensor/tab-core-utility';
3
+ import { NotificationService, ConfirmationService, NotificationType, AuthService, TabFormioService, TemplateHelper, TabBlueprintService, AppHelper, MediaUploadHelper, ApiService, TabReleaseService, TranslationService, TabCrudService, TabGetService, LocalStorageService, SessionStorageService, StorageConstants, MetadataHelper } from '@techextensor/tab-core-utility';
4
4
  import { firstValueFrom } from 'rxjs';
5
5
 
6
6
  var ScreenDisplayMode;
@@ -26,19 +26,19 @@ class UiService {
26
26
  * @param options The options for opening the screen.
27
27
  */
28
28
  openScreen(options) {
29
- const { mode, screenId, reqtokens, submission, title, width, height, customClass } = options;
29
+ const { mode, ...otherOptions } = options;
30
30
  switch (mode) {
31
31
  case ScreenDisplayMode.Sidebar:
32
- this.showSidebar({ screenId, reqtokens, submission, title, width, height, customClass });
32
+ this.showSidebar(otherOptions);
33
33
  break;
34
34
  case ScreenDisplayMode.Popup:
35
- this.showDialog({ screenId, reqtokens, submission, title, width, height, customClass });
35
+ this.showDialog(otherOptions);
36
36
  break;
37
37
  case ScreenDisplayMode.SameTab:
38
- this.navigateTo({ screenId, reqtokens });
38
+ this.navigateTo(otherOptions);
39
39
  break;
40
40
  case ScreenDisplayMode.NewTab:
41
- this.openInNewTab({ screenId, reqtokens });
41
+ this.openInNewTab(otherOptions);
42
42
  break;
43
43
  }
44
44
  }
@@ -699,6 +699,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
699
699
 
700
700
  class FileService {
701
701
  _mediaUploadHelper = inject(MediaUploadHelper);
702
+ apiService = inject(ApiService);
702
703
  /**
703
704
  * Uploads media files using the provided payload and optional headers.
704
705
  *
@@ -724,6 +725,47 @@ class FileService {
724
725
  // Return the response from the server
725
726
  return response;
726
727
  }
728
+ /**
729
+ * Processes an FTP URL and returns a processed URL.
730
+ *
731
+ * @param params - The parameters containing data, an optional defaultHeader, and an optional imgElement.
732
+ * @returns A promise that resolves to the processed URL or null if an error occurs.
733
+ */
734
+ async processFtpUrl(params) {
735
+ // Return null if the data is invalid
736
+ if (!params?.data || params?.data === 'null' || params?.data === 'undefined')
737
+ return null;
738
+ try {
739
+ let url = params.data;
740
+ // Extract the value from a JSON string if it contains 'value'
741
+ if (url?.includes('value')) {
742
+ url = JSON.parse(url).value;
743
+ }
744
+ // Check if the URL is an image from the FileManager service
745
+ if (url.includes('FileManager/GetImage')) {
746
+ const options = { responseType: 'blob' };
747
+ // Add default headers if specified
748
+ if (params.defaultHeader) {
749
+ options.headers = TabSdk.util?.getDefaultAppHeaders();
750
+ }
751
+ // Fetch the image as a blob
752
+ const blob = await firstValueFrom(this.apiService.getByUrl(url, options));
753
+ // Create an object URL from the blob
754
+ url = URL.createObjectURL(blob);
755
+ }
756
+ // Set the image element's source to the processed URL
757
+ if (params.imgElement) {
758
+ params.imgElement.src = url;
759
+ params.imgElement.onload = null;
760
+ }
761
+ return url;
762
+ }
763
+ catch (e) {
764
+ // Log any errors that occur during processing
765
+ console.error("Error processing FTP", e);
766
+ return null;
767
+ }
768
+ }
727
769
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FileService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
728
770
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FileService, providedIn: 'root' });
729
771
  }
@@ -1216,6 +1258,34 @@ class StoreService {
1216
1258
  // Save the updated organization info back to storage
1217
1259
  this.setOrgInfo(orgInfo);
1218
1260
  }
1261
+ /**
1262
+ * Retrieves the locale settings from the organization info.
1263
+ *
1264
+ * @returns The locale settings if they exist, otherwise `null`.
1265
+ */
1266
+ get orgLocaleSettings() {
1267
+ // Retrieve the locale settings from the organization info
1268
+ let localSettings = this.getOrgInfo()?.LocaleSettings;
1269
+ // If the locale settings are a string, parse them as JSON
1270
+ if (typeof localSettings === 'string') {
1271
+ localSettings = JSON.parse(localSettings);
1272
+ }
1273
+ // Return the locale settings
1274
+ return localSettings;
1275
+ }
1276
+ /**
1277
+ * Sets the locale settings in the organization info.
1278
+ *
1279
+ * @param value - The locale settings to set.
1280
+ */
1281
+ set orgLocaleSettings(value) {
1282
+ // Retrieve the existing organization info or initialize a new object
1283
+ const orgInfo = this.getOrgInfo() || {};
1284
+ // Update the locale settings value
1285
+ orgInfo.LocaleSettings = value;
1286
+ // Save the updated organization info back to storage
1287
+ this.setOrgInfo(orgInfo);
1288
+ }
1219
1289
  /**
1220
1290
  * Retrieves the app ID from the app info.
1221
1291
  *