@webitel/ui-sdk 26.2.75 → 26.2.77

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.2.75",
3
+ "version": "26.2.77",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "make-all": "npm version patch --git-tag-version false && npm run build && (npm run build:types || true) && (npm run biome:format:all || true) && npm run publish-lib",
@@ -419,7 +419,7 @@ const senderVideoMutedIconSizes = {
419
419
  border-radius: var(--p-player-cam-preview-md-border-radius);
420
420
  }
421
421
 
422
- .video-call-sender--md {
422
+ .video-call-sender.video-call-sender--md {
423
423
  position: relative;
424
424
  right: 0;
425
425
  bottom: 0;
@@ -435,7 +435,7 @@ const senderVideoMutedIconSizes = {
435
435
  border-radius: var(--p-player-cam-preview-lg-border-radius);
436
436
  }
437
437
 
438
- .video-call-sender--lg {
438
+ .video-call-sender.video-call-sender--lg {
439
439
  position: relative;
440
440
  right: 0;
441
441
  bottom: 0;
@@ -55,14 +55,18 @@ export default class FilesExport {
55
55
  };
56
56
  }
57
57
 
58
- async _addFilesToZip(items, zip) {
58
+ // Recursively adds files to zip archive, filtering by fileType
59
+ // Supports FileTypeAudio, FileTypeVideo, FileTypeScreensharing (defaults to FileTypeAudio)
60
+ async _addFilesToZip(
61
+ items,
62
+ zip,
63
+ fileType = EngineCallFileType.FileTypeAudio,
64
+ ) {
59
65
  for (const item of items) {
60
66
  if (item.files) {
61
- if (item.files?.[EngineCallFileType.FileTypeAudio]) {
62
- await this._addFilesToZip(
63
- item.files[EngineCallFileType.FileTypeAudio],
64
- zip,
65
- );
67
+ // If item has nested files object, filter by fileType and recurse
68
+ if (item.files?.[fileType]) {
69
+ await this._addFilesToZip(item.files[fileType], zip, fileType);
66
70
  } else continue;
67
71
  } else {
68
72
  try {
@@ -108,7 +112,8 @@ export default class FilesExport {
108
112
  }
109
113
  }
110
114
 
111
- async _fetchAndZip(zip, requestParams) {
115
+ // Fetches history items and adds files of specified type to zip
116
+ async _fetchAndZip(zip, requestParams, fileType) {
112
117
  const params = {
113
118
  from: 0,
114
119
  size: 5000,
@@ -125,20 +130,27 @@ export default class FilesExport {
125
130
  ...params,
126
131
  page,
127
132
  });
128
- await this._addFilesToZip(items, zip);
133
+ // Filter and add files of the specified type
134
+ await this._addFilesToZip(items, zip, fileType);
129
135
 
130
136
  isNext = next;
131
137
  page += 1;
132
138
  } while (isNext);
133
139
  }
134
140
 
135
- async exportFiles(files, { reqParams }) {
141
+ // Exports files to a zip archive
142
+ // fileType: FileTypeAudio (default), FileTypeVideo, or FileTypeScreensharing
143
+ async exportFiles(
144
+ files,
145
+ { reqParams, fileType = EngineCallFileType.FileTypeAudio },
146
+ ) {
136
147
  try {
137
148
  this.isLoading = true;
138
149
  const zip = new JSZip();
139
- if (files?.length) await this._addFilesToZip(files, zip);
150
+ // If files provided, use them; otherwise fetch from API with fileType filter
151
+ if (files?.length) await this._addFilesToZip(files, zip, fileType);
140
152
  else {
141
- await this._fetchAndZip(zip, reqParams);
153
+ await this._fetchAndZip(zip, reqParams, fileType);
142
154
  }
143
155
  const file = await this._generateZip(zip);
144
156
  await this._saveZip(file);
@@ -28,15 +28,18 @@ export default {
28
28
  this.FilesExport = new FilesExport(options);
29
29
  },
30
30
 
31
- getSelectedFiles() {
31
+ // Gets selected files of a specific type from selectedItems
32
+ // fileType: FileTypeAudio (default), FileTypeVideo, or FileTypeScreensharing
33
+ getSelectedFiles(fileType = EngineCallFileType.FileTypeAudio) {
32
34
  let files = null;
33
35
  if (this.selectedItems?.length) {
34
36
  files = this.selectedItems.reduce(
35
37
  (filesAccumulator, next) =>
36
- next.files
38
+ // Check if item has files and contains files of the specified type
39
+ next.files && next.files[fileType]
37
40
  ? [
38
41
  ...filesAccumulator,
39
- ...next.files[EngineCallFileType.FileTypeAudio],
42
+ ...next.files[fileType],
40
43
  ]
41
44
  : filesAccumulator,
42
45
  [],
@@ -45,12 +48,20 @@ export default {
45
48
  return files;
46
49
  },
47
50
 
48
- async exportFiles(files, reqParams = {}) {
51
+ // Exports files of a specific type to a zip archive
52
+ // fileType: FileTypeAudio (default), FileTypeVideo, or FileTypeScreensharing
53
+ async exportFiles(
54
+ files,
55
+ reqParams = {},
56
+ fileType = EngineCallFileType.FileTypeAudio,
57
+ ) {
49
58
  if (!this.FilesExport) throw new Error('FilesExport is not initialized');
50
- const exportFiles = files || this.getSelectedFiles();
59
+ // Use provided files or get from selectedItems filtered by fileType
60
+ const exportFiles = files || this.getSelectedFiles(fileType);
51
61
  try {
52
62
  await this.FilesExport.exportFiles(exportFiles, {
53
63
  reqParams,
64
+ fileType,
54
65
  });
55
66
  } catch (err) {
56
67
  throw err;
@@ -20,11 +20,12 @@ export default class FilesExport {
20
20
  }) => string;
21
21
  _fetchFileBinary(fileId: any): Promise<any>;
22
22
  resetProgress(): void;
23
- _addFilesToZip(items: any, zip: any): Promise<void>;
23
+ _addFilesToZip(items: any, zip: any, fileType?: "file_type_audio"): Promise<void>;
24
24
  _generateZip(zip: any): Promise<any>;
25
25
  _saveZip(file: any): Promise<void>;
26
- _fetchAndZip(zip: any, requestParams: any): Promise<void>;
27
- exportFiles(files: any, { reqParams }: {
26
+ _fetchAndZip(zip: any, requestParams: any, fileType: any): Promise<void>;
27
+ exportFiles(files: any, { reqParams, fileType }: {
28
28
  reqParams: any;
29
+ fileType?: "file_type_audio";
29
30
  }): Promise<void>;
30
31
  }
@@ -9,8 +9,8 @@ declare namespace _default {
9
9
  }
10
10
  namespace methods {
11
11
  function initFilesExport(options: any): void;
12
- function getSelectedFiles(): any;
13
- function exportFiles(files: any, reqParams?: {}): Promise<void>;
12
+ function getSelectedFiles(fileType?: "file_type_audio"): any;
13
+ function exportFiles(files: any, reqParams?: {}, fileType?: "file_type_audio"): Promise<void>;
14
14
  }
15
15
  }
16
16
  export default _default;