@webitel/api-services 0.0.67 → 0.0.69
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
|
@@ -2,8 +2,10 @@ import { getAgentChatService } from '@webitel/api-services/gen';
|
|
|
2
2
|
import { getDefaultGetParams } from '../../defaults';
|
|
3
3
|
import {
|
|
4
4
|
applyTransform,
|
|
5
|
+
camelToSnake,
|
|
5
6
|
merge,
|
|
6
7
|
notify,
|
|
8
|
+
sanitize,
|
|
7
9
|
snakeToCamel,
|
|
8
10
|
} from '../../transformers';
|
|
9
11
|
|
|
@@ -30,16 +32,18 @@ const getChatsList = async (params) => {
|
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
const getChatCount = async (params) => {
|
|
33
|
-
const
|
|
35
|
+
const fieldsToSend = ['only_closed', 'only_unprocessed'];
|
|
36
|
+
const requestParams = applyTransform(params, [
|
|
37
|
+
camelToSnake(),
|
|
34
38
|
merge(getDefaultGetParams()),
|
|
39
|
+
sanitize(fieldsToSend),
|
|
35
40
|
]);
|
|
36
41
|
|
|
37
42
|
try {
|
|
38
43
|
const response =
|
|
39
|
-
await getAgentChatService().agentChatServiceGetAgentChatsCounter(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
44
|
+
await getAgentChatService().agentChatServiceGetAgentChatsCounter(
|
|
45
|
+
requestParams,
|
|
46
|
+
);
|
|
43
47
|
const { count } = applyTransform(response.data, [snakeToCamel()]);
|
|
44
48
|
return count;
|
|
45
49
|
} catch (err) {
|
|
@@ -72,7 +72,11 @@ export const downloadMedia = async (id) => {
|
|
|
72
72
|
export const downloadFile = (id) => {
|
|
73
73
|
const accessToken = localStorage.getItem('access-token'); // after auth token variable is null
|
|
74
74
|
const url = `${baseUrl}/storage/file/${id}/download?access_token=${accessToken}`;
|
|
75
|
-
|
|
75
|
+
const link = document.createElement('a');
|
|
76
|
+
link.href = url;
|
|
77
|
+
document.body.appendChild(link);
|
|
78
|
+
link.click();
|
|
79
|
+
document.body.removeChild(link);
|
|
76
80
|
};
|
|
77
81
|
|
|
78
82
|
export const getScreenRecordingMediaUrl = (id, isThumb = false) => {
|