@webitel/api-services 26.8.72 → 26.8.74
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 +1 -1
- package/src/api/clients/fileServices/__tests__/fileServices.spec.ts +20 -0
- package/src/api/clients/fileServices/fileServices.ts +53 -0
- package/src/api/clients/pdfServices/__tests__/downloadCallScreenrecordingArchive.spec.ts +60 -0
- package/src/api/clients/pdfServices/pdfServices.ts +42 -0
- package/src/validations/_shared/__tests__/phoneNumber.validations.spec.ts +1 -1
- package/src/validations/_shared/phoneNumber.validations.ts +3 -15
- package/types/.tsbuildinfo +1 -1
- package/types/api/clients/fileServices/fileServices.d.ts +8 -1
- package/types/api/clients/pdfServices/pdfServices.d.ts +4 -1
- package/types/validations/_shared/phoneNumber.validations.d.ts +0 -6
package/package.json
CHANGED
|
@@ -129,3 +129,23 @@ describe('FileServicesAPI.getListByCall', () => {
|
|
|
129
129
|
});
|
|
130
130
|
});
|
|
131
131
|
});
|
|
132
|
+
|
|
133
|
+
describe('FileServicesAPI.getScreenRecordingsByCall', () => {
|
|
134
|
+
it('sends start_at range filters for call screen recordings', async () => {
|
|
135
|
+
await FileServicesAPI.getScreenRecordingsByCall({
|
|
136
|
+
callId: 'call-1',
|
|
137
|
+
startAtFrom: '1700000000000',
|
|
138
|
+
startAtTo: '1700000009999',
|
|
139
|
+
type: 'SCREENSHARING',
|
|
140
|
+
channel: 'SCREENRECORDING',
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
expect(captured[0].url).toBe('/storage/call/call-1');
|
|
144
|
+
expect(sentParams()).toMatchObject({
|
|
145
|
+
'start_at.from': '1700000000000',
|
|
146
|
+
'start_at.to': '1700000009999',
|
|
147
|
+
type: 'SCREENSHARING',
|
|
148
|
+
channel: 'SCREENRECORDING',
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
});
|
|
@@ -2,6 +2,7 @@ import type {
|
|
|
2
2
|
SearchFilesByCallParams,
|
|
3
3
|
SearchFilesParams,
|
|
4
4
|
SearchScreenRecordingsByAgentParams,
|
|
5
|
+
SearchScreenRecordingsByCallParams,
|
|
5
6
|
SearchScreenRecordingsParams,
|
|
6
7
|
} from '@webitel/api-services/gen/models';
|
|
7
8
|
import { getShallowFieldsToSendFromZodSchema } from '@webitel/api-services/gen/utils';
|
|
@@ -10,12 +11,14 @@ import {
|
|
|
10
11
|
SearchFilesByCallQueryParams,
|
|
11
12
|
SearchFilesQueryParams,
|
|
12
13
|
SearchScreenRecordingsByAgentQueryParams,
|
|
14
|
+
SearchScreenRecordingsByCallQueryParams,
|
|
13
15
|
SearchScreenRecordingsQueryParams,
|
|
14
16
|
} from '../../../gen-wire';
|
|
15
17
|
import type {
|
|
16
18
|
SearchFilesByCallParams as SearchFilesByCallWireParams,
|
|
17
19
|
SearchFilesParams as SearchFilesWireParams,
|
|
18
20
|
SearchScreenRecordingsByAgentParams as SearchScreenRecordingsByAgentWireParams,
|
|
21
|
+
SearchScreenRecordingsByCallParams as SearchScreenRecordingsByCallWireParams,
|
|
19
22
|
SearchScreenRecordingsParams as SearchScreenRecordingsWireParams,
|
|
20
23
|
} from '../../../gen-wire/_models';
|
|
21
24
|
import type {
|
|
@@ -222,6 +225,55 @@ const getScreenRecordingsByAgent = async (
|
|
|
222
225
|
}
|
|
223
226
|
};
|
|
224
227
|
|
|
228
|
+
const getScreenRecordingsByCall = async (
|
|
229
|
+
params: SearchScreenRecordingsByCallParams & {
|
|
230
|
+
callId: ApiId;
|
|
231
|
+
search?: string;
|
|
232
|
+
},
|
|
233
|
+
) => {
|
|
234
|
+
const fieldsToSend = getShallowFieldsToSendFromZodSchema(
|
|
235
|
+
SearchScreenRecordingsByCallQueryParams,
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
const requestParams = applyTransform<SearchScreenRecordingsByCallWireParams>(
|
|
239
|
+
params,
|
|
240
|
+
[
|
|
241
|
+
merge(getDefaultGetParams()),
|
|
242
|
+
sanitizeToWire(fieldsToSend),
|
|
243
|
+
camelToSnake(),
|
|
244
|
+
],
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
try {
|
|
248
|
+
const response = await getFileService().searchScreenRecordingsByCall(
|
|
249
|
+
String(params.callId),
|
|
250
|
+
{
|
|
251
|
+
...requestParams,
|
|
252
|
+
q: requestParams.q || params.search,
|
|
253
|
+
fields: [
|
|
254
|
+
'id',
|
|
255
|
+
'view_name',
|
|
256
|
+
'mime_type',
|
|
257
|
+
...(requestParams.fields ?? []),
|
|
258
|
+
],
|
|
259
|
+
},
|
|
260
|
+
);
|
|
261
|
+
const { items, next } = applyTransform(response.data, [
|
|
262
|
+
merge(getDefaultGetListResponse()),
|
|
263
|
+
]);
|
|
264
|
+
return {
|
|
265
|
+
items: applyTransform(items, [
|
|
266
|
+
snakeToCamel(),
|
|
267
|
+
]),
|
|
268
|
+
next,
|
|
269
|
+
};
|
|
270
|
+
} catch (err) {
|
|
271
|
+
throw applyTransform(err, [
|
|
272
|
+
notify,
|
|
273
|
+
]);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
|
|
225
277
|
const deleteScreenRecordingsByAgent = async ({
|
|
226
278
|
agentId,
|
|
227
279
|
id,
|
|
@@ -295,6 +347,7 @@ export const FileServicesAPI = {
|
|
|
295
347
|
getScreenRecordingsByUser,
|
|
296
348
|
deleteScreenRecordingsByUser,
|
|
297
349
|
getScreenRecordingsByAgent,
|
|
350
|
+
getScreenRecordingsByCall,
|
|
298
351
|
deleteScreenRecordingsByAgent,
|
|
299
352
|
getListByCall: getFilesListByCall,
|
|
300
353
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
const downloadCallScreenrecordingArchive = vi.fn();
|
|
4
|
+
|
|
5
|
+
vi.mock('../../../../gen-wire', async () => {
|
|
6
|
+
const actual = await vi.importActual<typeof import('../../../../gen-wire')>(
|
|
7
|
+
'../../../../gen-wire',
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
...actual,
|
|
12
|
+
getPdfService: () => ({
|
|
13
|
+
downloadCallScreenrecordingArchive,
|
|
14
|
+
}),
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const { PdfServicesAPI } = await import('../pdfServices');
|
|
19
|
+
|
|
20
|
+
describe('PdfServicesAPI.downloadCallScreenrecordingArchive', () => {
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
downloadCallScreenrecordingArchive.mockReset();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('requests a blob archive with snake_case query params', async () => {
|
|
26
|
+
const response = {
|
|
27
|
+
data: new Blob([
|
|
28
|
+
'zip',
|
|
29
|
+
]),
|
|
30
|
+
};
|
|
31
|
+
downloadCallScreenrecordingArchive.mockResolvedValue(response);
|
|
32
|
+
|
|
33
|
+
await expect(
|
|
34
|
+
PdfServicesAPI.downloadCallScreenrecordingArchive({
|
|
35
|
+
callId: 'call-1',
|
|
36
|
+
fileIds: [
|
|
37
|
+
'123',
|
|
38
|
+
'456',
|
|
39
|
+
],
|
|
40
|
+
from: '1700000000000',
|
|
41
|
+
to: '170000000100000',
|
|
42
|
+
}),
|
|
43
|
+
).resolves.toBe(response);
|
|
44
|
+
|
|
45
|
+
expect(downloadCallScreenrecordingArchive).toHaveBeenCalledWith(
|
|
46
|
+
'call-1',
|
|
47
|
+
{
|
|
48
|
+
file_ids: [
|
|
49
|
+
'123',
|
|
50
|
+
'456',
|
|
51
|
+
],
|
|
52
|
+
from: '1700000000000',
|
|
53
|
+
to: '170000000100000',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
responseType: 'blob',
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
DownloadCallScreenrecordingArchiveParams,
|
|
2
3
|
ListCallExportsParams,
|
|
3
4
|
ListScreenrecordingExportsParams,
|
|
4
5
|
} from '@webitel/api-services/gen/models';
|
|
@@ -7,6 +8,7 @@ import {
|
|
|
7
8
|
CreateCallExportBody,
|
|
8
9
|
CreateScreenrecordingExportBody,
|
|
9
10
|
DownloadCallArchiveQueryParams,
|
|
11
|
+
DownloadCallScreenrecordingArchiveQueryParams,
|
|
10
12
|
DownloadScreenrecordingArchiveQueryParams,
|
|
11
13
|
DownloadScreenshotArchiveQueryParams,
|
|
12
14
|
getPdfService,
|
|
@@ -211,6 +213,45 @@ const downloadCallArchive = async ({
|
|
|
211
213
|
}
|
|
212
214
|
};
|
|
213
215
|
|
|
216
|
+
const downloadCallScreenrecordingArchive = async ({
|
|
217
|
+
callId,
|
|
218
|
+
fileIds,
|
|
219
|
+
from,
|
|
220
|
+
to,
|
|
221
|
+
}: DownloadCallScreenrecordingArchiveParams & {
|
|
222
|
+
callId: ApiId;
|
|
223
|
+
}) => {
|
|
224
|
+
const fieldsToSend = getShallowFieldsToSendFromZodSchema(
|
|
225
|
+
DownloadCallScreenrecordingArchiveQueryParams,
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
const params = applyTransform(
|
|
229
|
+
{
|
|
230
|
+
fileIds,
|
|
231
|
+
from,
|
|
232
|
+
to,
|
|
233
|
+
},
|
|
234
|
+
[
|
|
235
|
+
sanitizeToWire(fieldsToSend),
|
|
236
|
+
camelToSnake(),
|
|
237
|
+
],
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
try {
|
|
241
|
+
return await getPdfService().downloadCallScreenrecordingArchive(
|
|
242
|
+
String(callId),
|
|
243
|
+
params,
|
|
244
|
+
{
|
|
245
|
+
responseType: 'blob',
|
|
246
|
+
},
|
|
247
|
+
);
|
|
248
|
+
} catch (err) {
|
|
249
|
+
throw applyTransform(err, [
|
|
250
|
+
notify,
|
|
251
|
+
]);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
|
|
214
255
|
const downloadScreenrecordingArchive = async ({
|
|
215
256
|
agentId,
|
|
216
257
|
fileIds,
|
|
@@ -314,6 +355,7 @@ export const PdfServicesAPI = {
|
|
|
314
355
|
createCallExport,
|
|
315
356
|
listCallExports,
|
|
316
357
|
downloadCallArchive,
|
|
358
|
+
downloadCallScreenrecordingArchive,
|
|
317
359
|
downloadScreenrecordingArchive,
|
|
318
360
|
downloadScreenshotArchive,
|
|
319
361
|
delete: deleteExport,
|
|
@@ -19,12 +19,12 @@ describe('phoneNumberSchema', () => {
|
|
|
19
19
|
'1-800-FLOWERS',
|
|
20
20
|
"a.b!c~d*e'f(g)",
|
|
21
21
|
'+(044)123-45-67',
|
|
22
|
+
'+',
|
|
22
23
|
])('accepts %j', (value) => {
|
|
23
24
|
expect(phoneNumberSchema.safeParse(value).success).toBe(true);
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
it.each([
|
|
27
|
-
'+',
|
|
28
28
|
'++380',
|
|
29
29
|
'380+',
|
|
30
30
|
'38+0',
|
|
@@ -2,22 +2,10 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
import { i18nIssue } from './i18nIssue';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* `+` only as a leading sign. Shared by all phone-shaped fields (member
|
|
8
|
-
* destination, resource number, csv imports).
|
|
9
|
-
*
|
|
10
|
-
* [WTEL-9678](https://webitel.atlassian.net/browse/WTEL-9678),
|
|
11
|
-
* [WTEL-10374](https://webitel.atlassian.net/browse/WTEL-10374)
|
|
12
|
-
*/
|
|
13
|
-
const phoneNumberPattern = /^\+?[A-Za-z0-9\-_.!~*'()]+$/;
|
|
5
|
+
// optional leading `+`, then latin letters, digits and `- _ . ! ~ * ' ( )`
|
|
6
|
+
const phoneNumberPattern = /^\+?[A-Za-z0-9\-_.!~*'()]*$/;
|
|
14
7
|
|
|
15
|
-
|
|
16
|
-
* Required phone-shaped value.
|
|
17
|
-
*
|
|
18
|
-
* `refine`, not `regex`: only a `custom` issue passes `params.i18nKey` to the ui.
|
|
19
|
-
* Empty string passes the refinement, so a blank field reports only `required`.
|
|
20
|
-
*/
|
|
8
|
+
// `refine`, not `regex`: only a `custom` issue carries `params.i18nKey`
|
|
21
9
|
export const phoneNumberSchema = z
|
|
22
10
|
.string()
|
|
23
11
|
.min(1)
|