@webitel/ui-sdk 26.8.31 → 26.8.32
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
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
:load-data-list="loadDataList"
|
|
7
7
|
:ask-delete-confirmation="askDeleteConfirmation"
|
|
8
8
|
:handle-delete="handleDelete"
|
|
9
|
+
:download-archive="downloadArchive"
|
|
10
|
+
:is-downloading-archive="isDownloadingArchive"
|
|
9
11
|
/>
|
|
10
12
|
|
|
11
13
|
<delete-confirmation-popup
|
|
@@ -110,18 +112,23 @@ import {
|
|
|
110
112
|
type WebitelMediaExporterExportRecord,
|
|
111
113
|
WebitelMediaExporterExportStatus,
|
|
112
114
|
} from '@webitel/api-services/gen/models';
|
|
115
|
+
import {
|
|
116
|
+
downloadFile as downloadArchiveFile,
|
|
117
|
+
FileFormat,
|
|
118
|
+
} from '@webitel/api-services/scripts';
|
|
113
119
|
import { WtEmpty } from '@webitel/ui-sdk/components';
|
|
114
120
|
import { getEndOfDay, getStartOfDay } from '@webitel/ui-sdk/scripts';
|
|
115
121
|
import DeleteConfirmationPopup from '@webitel/ui-sdk/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue';
|
|
116
122
|
import { useDeleteConfirmationPopup } from '@webitel/ui-sdk/src/modules/DeleteConfirmationPopup/composables/useDeleteConfirmationPopup';
|
|
117
123
|
import { useTableEmpty } from '@webitel/ui-sdk/src/modules/TableComponentModule/composables/useTableEmpty';
|
|
118
124
|
import { storeToRefs } from 'pinia';
|
|
119
|
-
import { computed } from 'vue';
|
|
125
|
+
import { computed, ref } from 'vue';
|
|
120
126
|
import { DatetimeFormat } from 'vue-i18n';
|
|
121
127
|
|
|
122
128
|
import { CrudAction } from '../../../enums';
|
|
123
129
|
import { FormatDateMode } from '../../../enums/FormatDateMode/FormatDateMode';
|
|
124
130
|
import { formatDate } from '../../../utils/formatDate';
|
|
131
|
+
import type { AskDeleteConfirmationParams } from '../../DeleteConfirmationPopup/composables/useDeleteConfirmationPopup';
|
|
125
132
|
import PdfStatus from './pdf-status.vue';
|
|
126
133
|
import PdfStatusPreview from './pdf-status-preview.vue';
|
|
127
134
|
|
|
@@ -134,6 +141,17 @@ const props = defineProps<{
|
|
|
134
141
|
access?: Partial<Record<CrudAction, boolean>>;
|
|
135
142
|
}>();
|
|
136
143
|
|
|
144
|
+
defineSlots<{
|
|
145
|
+
header(props: {
|
|
146
|
+
selected: WebitelMediaExporterExportRecord[];
|
|
147
|
+
loadDataList: () => Promise<void>;
|
|
148
|
+
askDeleteConfirmation: (params: AskDeleteConfirmationParams) => void;
|
|
149
|
+
handleDelete: (items: WebitelMediaExporterExportRecord[]) => Promise<void>;
|
|
150
|
+
downloadArchive: () => Promise<void>;
|
|
151
|
+
isDownloadingArchive: boolean;
|
|
152
|
+
}): unknown;
|
|
153
|
+
}>();
|
|
154
|
+
|
|
137
155
|
const tableStore = props.store;
|
|
138
156
|
|
|
139
157
|
const {
|
|
@@ -238,10 +256,10 @@ const {
|
|
|
238
256
|
isLoading,
|
|
239
257
|
});
|
|
240
258
|
|
|
241
|
-
const handleDelete = async (items: []) => {
|
|
242
|
-
const deleteEl = (el) => {
|
|
259
|
+
const handleDelete = async (items: WebitelMediaExporterExportRecord[]) => {
|
|
260
|
+
const deleteEl = (el: WebitelMediaExporterExportRecord) => {
|
|
243
261
|
// If status is failed, use deletePdfExportRecord with the export id
|
|
244
|
-
if (el.status === WebitelMediaExporterExportStatus.Failed) {
|
|
262
|
+
if (el.status === WebitelMediaExporterExportStatus.Failed && el.id) {
|
|
245
263
|
return PdfServicesAPI.delete(el.id);
|
|
246
264
|
}
|
|
247
265
|
// Otherwise, use custom delete function if provided
|
|
@@ -249,8 +267,11 @@ const handleDelete = async (items: []) => {
|
|
|
249
267
|
return props.onDeleteItem(el);
|
|
250
268
|
}
|
|
251
269
|
// Fallback to default implementation
|
|
270
|
+
if (!el.fileId) return Promise.resolve();
|
|
252
271
|
return FileServicesAPI.deleteScreenRecordingsByAgent({
|
|
253
|
-
id:
|
|
272
|
+
id: [
|
|
273
|
+
el.fileId,
|
|
274
|
+
],
|
|
254
275
|
agentId: props.entityIdValue,
|
|
255
276
|
});
|
|
256
277
|
};
|
|
@@ -271,6 +292,34 @@ const downloadPdf = async (id: string) => {
|
|
|
271
292
|
await downloadFile(id);
|
|
272
293
|
};
|
|
273
294
|
|
|
295
|
+
const isDownloadingArchive = ref(false);
|
|
296
|
+
|
|
297
|
+
const downloadArchive = async () => {
|
|
298
|
+
if (!props.entityIdValue) return;
|
|
299
|
+
|
|
300
|
+
isDownloadingArchive.value = true;
|
|
301
|
+
try {
|
|
302
|
+
const fileIds = selected.value.length
|
|
303
|
+
? selected.value.map(
|
|
304
|
+
(item: WebitelMediaExporterExportRecord) => item.fileId,
|
|
305
|
+
)
|
|
306
|
+
: undefined;
|
|
307
|
+
|
|
308
|
+
const response = await PdfServicesAPI.downloadCallArchive({
|
|
309
|
+
callId: props.entityIdValue,
|
|
310
|
+
fileIds,
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
downloadArchiveFile({
|
|
314
|
+
response,
|
|
315
|
+
fileFormat: FileFormat.ZIP,
|
|
316
|
+
filename: `pdfs-${props.entityIdValue}`,
|
|
317
|
+
});
|
|
318
|
+
} finally {
|
|
319
|
+
isDownloadingArchive.value = false;
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
|
|
274
323
|
const openPdfInNewWindow = (fileId: string) => {
|
|
275
324
|
try {
|
|
276
325
|
const pdfUrl = getMediaUrl(fileId);
|