@webitel/ui-sdk 26.8.68 → 26.8.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/dist/clients-D5pO5FKV.js +39334 -0
- package/dist/{components-BoODKBgN.js → components-BH_gLkO3.js} +3 -3
- package/dist/{genClient-C_5VsLM9.js → genClient-DtYJ9KWy.js} +1 -1
- package/dist/ui-sdk.js +2 -2
- package/dist/ui-sdk.umd.cjs +657 -732
- package/dist/{wt-chat-emoji-DMSSNCSp.js → wt-chat-emoji-B-FoXVDr.js} +1 -1
- package/dist/{wt-display-chip-items-BaL81KbX.js → wt-display-chip-items-CZzcHtcb.js} +1 -1
- package/dist/{wt-send-message-popup-Cz3tLMAW.js → wt-send-message-popup-Cc92sY9q.js} +2 -2
- package/dist/wt-tree-CfvNlw7N.js +2042 -0
- package/dist/{wt-type-extension-value-input-D7eK5MwZ.js → wt-type-extension-value-input-DfbrgPNa.js} +2 -2
- package/dist/{wt-vidstack-player-CPk5Y-1M.js → wt-vidstack-player-DtbNeGgs.js} +1 -1
- package/package.json +1 -1
- package/src/api/clients/index.js +5 -66
- package/src/modules/AgentStatusSelect/api/agent-status.ts +44 -0
- package/src/modules/AgentStatusSelect/api/pause-cause.ts +54 -0
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +4 -10
- package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +2 -6
- package/types/.tsbuildinfo +1 -1
- package/types/api/clients/index.d.ts +1 -33
- package/types/modules/AgentStatusSelect/api/agent-status.d.ts +4 -12
- package/types/modules/AgentStatusSelect/api/pause-cause.d.ts +7 -9
- package/dist/clients-CjmnMcur.js +0 -40042
- package/dist/side-channel-M3LABDql.js +0 -833
- package/dist/wt-tree-DKSphRxr.js +0 -1216
- package/src/api/clients/agents/agentChats.js +0 -79
- package/src/api/clients/agents/agents.js +0 -300
- package/src/api/clients/buckets/buckets.js +0 -134
- package/src/api/clients/calendars/calendars.js +0 -239
- package/src/api/clients/caseCloseReasonGroups/caseCloseReasonGroups.js +0 -161
- package/src/api/clients/caseCloseReasons/caseCloseReasons.js +0 -165
- package/src/api/clients/casePriorities/casePriorities.js +0 -166
- package/src/api/clients/caseServiceCatalogs/serviceCatalogs.js +0 -231
- package/src/api/clients/caseServices/services.js +0 -221
- package/src/api/clients/caseSources/caseSources.ts +0 -2
- package/src/api/clients/caseStatusConditions/caseStatusConditions.js +0 -207
- package/src/api/clients/caseStatuses/caseStatuses.js +0 -152
- package/src/api/clients/catalog/catalog.js +0 -63
- package/src/api/clients/chatGateways/chatGateways.js +0 -338
- package/src/api/clients/chatGateways/defaults/defaultChatGateway.js +0 -18
- package/src/api/clients/chatGateways/defaults/webChatGateway.js +0 -72
- package/src/api/clients/chatGateways/enums/WebchatAlternativeChannel.enum.js +0 -14
- package/src/api/clients/chatGateways/scripts/generateUri.js +0 -9
- package/src/api/clients/communications/communications.js +0 -172
- package/src/api/clients/configurations/configurations.js +0 -168
- package/src/api/clients/contactGroups/contactGroups.js +0 -221
- package/src/api/clients/flows/flow.js +0 -252
- package/src/api/clients/gateways/defaults/defaultGateway.js +0 -9
- package/src/api/clients/gateways/defaults/registerGateway.js +0 -12
- package/src/api/clients/gateways/defaults/trunkingGateway.js +0 -16
- package/src/api/clients/gateways/gateways.js +0 -221
- package/src/api/clients/labels/labels.js +0 -69
- package/src/api/clients/lists/blacklists.js +0 -142
- package/src/api/clients/media/media.js +0 -136
- package/src/api/clients/object/object.js +0 -138
- package/src/api/clients/queues/queues.js +0 -263
- package/src/api/clients/quickReplies/quickReplies.ts +0 -2
- package/src/api/clients/skills/skills.js +0 -134
- package/src/api/clients/slaConditions/slaConditions.js +0 -190
- package/src/api/clients/slas/slas.js +0 -148
- package/src/api/clients/teams/teams.js +0 -161
- package/src/api/clients/users/__tests__/users.spec.js +0 -282
- package/src/api/clients/users/users.js +0 -334
- package/src/api/clients/wtTypes/_shared/utils/sortDynamicFields.ts +0 -38
- package/src/api/clients/wtTypes/sysTypes/sysTypes.ts +0 -92
- package/src/api/clients/wtTypes/typeExtensions/typeExtensions.ts +0 -156
- package/src/api/clients//321/201ontacts/contactChatMessagesHistory.js +0 -119
- package/src/api/clients//321/201ontacts/contacts.js +0 -449
- package/src/api/clients//321/201ontacts/enums/ContactsSearchMode.js +0 -9
- package/src/api/clients//321/201ontacts/index.js +0 -5
- package/src/modules/AgentStatusSelect/api/agent-status.js +0 -30
- package/src/modules/AgentStatusSelect/api/pause-cause.js +0 -49
- package/types/api/clients/agents/agentChats.d.ts +0 -10
- package/types/api/clients/agents/agents.d.ts +0 -55
- package/types/api/clients/buckets/buckets.d.ts +0 -30
- package/types/api/clients/calendars/calendars.d.ts +0 -35
- package/types/api/clients/caseCloseReasonGroups/caseCloseReasonGroups.d.ts +0 -30
- package/types/api/clients/caseCloseReasons/caseCloseReasons.d.ts +0 -36
- package/types/api/clients/casePriorities/casePriorities.d.ts +0 -30
- package/types/api/clients/caseServiceCatalogs/serviceCatalogs.d.ts +0 -30
- package/types/api/clients/caseServices/services.d.ts +0 -42
- package/types/api/clients/caseSources/caseSources.d.ts +0 -1
- package/types/api/clients/caseStatusConditions/caseStatusConditions.d.ts +0 -43
- package/types/api/clients/caseStatuses/caseStatuses.d.ts +0 -30
- package/types/api/clients/catalog/catalog.d.ts +0 -13
- package/types/api/clients/chatGateways/chatGateways.d.ts +0 -35
- package/types/api/clients/chatGateways/defaults/defaultChatGateway.d.ts +0 -15
- package/types/api/clients/chatGateways/defaults/webChatGateway.d.ts +0 -64
- package/types/api/clients/chatGateways/enums/WebchatAlternativeChannel.enum.d.ts +0 -8
- package/types/api/clients/chatGateways/scripts/generateUri.d.ts +0 -2
- package/types/api/clients/communications/communications.d.ts +0 -35
- package/types/api/clients/configurations/configurations.d.ts +0 -35
- package/types/api/clients/contactGroups/contactGroups.d.ts +0 -47
- package/types/api/clients/flows/flow.d.ts +0 -35
- package/types/api/clients/gateways/defaults/defaultGateway.d.ts +0 -8
- package/types/api/clients/gateways/defaults/registerGateway.d.ts +0 -13
- package/types/api/clients/gateways/defaults/trunkingGateway.d.ts +0 -11
- package/types/api/clients/gateways/gateways.d.ts +0 -35
- package/types/api/clients/labels/labels.d.ts +0 -13
- package/types/api/clients/lists/blacklists.d.ts +0 -30
- package/types/api/clients/media/media.d.ts +0 -24
- package/types/api/clients/object/object.d.ts +0 -13
- package/types/api/clients/queues/queues.d.ts +0 -40
- package/types/api/clients/quickReplies/quickReplies.d.ts +0 -1
- package/types/api/clients/skills/skills.d.ts +0 -30
- package/types/api/clients/slaConditions/slaConditions.d.ts +0 -36
- package/types/api/clients/slas/slas.d.ts +0 -30
- package/types/api/clients/teams/teams.d.ts +0 -30
- package/types/api/clients/users/__tests__/users.spec.d.ts +0 -1
- package/types/api/clients/users/users.d.ts +0 -46
- package/types/api/clients/wtTypes/_shared/utils/sortDynamicFields.d.ts +0 -2
- package/types/api/clients/wtTypes/sysTypes/sysTypes.d.ts +0 -29
- package/types/api/clients/wtTypes/typeExtensions/typeExtensions.d.ts +0 -33
- package/types/api/clients//321/201ontacts/contactChatMessagesHistory.d.ts +0 -16
- package/types/api/clients//321/201ontacts/contacts.d.ts +0 -29
- package/types/api/clients//321/201ontacts/enums/ContactsSearchMode.d.ts +0 -8
- package/types/api/clients//321/201ontacts/index.d.ts +0 -4
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { MediaFileServiceApiFactory } from 'webitel-sdk';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
getDefaultGetListResponse,
|
|
6
|
-
getDefaultGetParams,
|
|
7
|
-
getDefaultInstance,
|
|
8
|
-
getDefaultOpenAPIConfig,
|
|
9
|
-
} from '../../defaults/index.js';
|
|
10
|
-
import applyTransform, {
|
|
11
|
-
merge,
|
|
12
|
-
notify,
|
|
13
|
-
snakeToCamel,
|
|
14
|
-
starToSearch,
|
|
15
|
-
} from '../../transformers/index.js';
|
|
16
|
-
|
|
17
|
-
const instance = getDefaultInstance();
|
|
18
|
-
const configuration = getDefaultOpenAPIConfig();
|
|
19
|
-
|
|
20
|
-
const mediaService = new MediaFileServiceApiFactory(
|
|
21
|
-
configuration,
|
|
22
|
-
'',
|
|
23
|
-
instance,
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const token = localStorage.getItem('access-token');
|
|
27
|
-
const baseUrl = import.meta.env.VITE_API_URL;
|
|
28
|
-
|
|
29
|
-
const getMediaList = async (params) => {
|
|
30
|
-
const { page, size, search, sort, fields, id } = applyTransform(params, [
|
|
31
|
-
merge(getDefaultGetParams()),
|
|
32
|
-
starToSearch('search'),
|
|
33
|
-
]);
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
const response = await mediaService.searchMediaFile(
|
|
37
|
-
page,
|
|
38
|
-
size,
|
|
39
|
-
search,
|
|
40
|
-
sort,
|
|
41
|
-
fields,
|
|
42
|
-
id,
|
|
43
|
-
);
|
|
44
|
-
const { items, next } = applyTransform(response.data, [
|
|
45
|
-
snakeToCamel(),
|
|
46
|
-
merge(getDefaultGetListResponse()),
|
|
47
|
-
]);
|
|
48
|
-
return {
|
|
49
|
-
items,
|
|
50
|
-
next,
|
|
51
|
-
};
|
|
52
|
-
} catch (err) {
|
|
53
|
-
throw applyTransform(err, [
|
|
54
|
-
notify,
|
|
55
|
-
]);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const getMedia = async ({ itemId }) => {
|
|
60
|
-
const url = `${baseUrl}/storage/media/${itemId}/stream?access_token=${token}`;
|
|
61
|
-
try {
|
|
62
|
-
return await instance.get(url);
|
|
63
|
-
} catch (err) {
|
|
64
|
-
throw applyTransform(err, [
|
|
65
|
-
notify,
|
|
66
|
-
]);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const downloadMedia = async (id) => {
|
|
71
|
-
const url = `${baseUrl}/storage/media/${id}/download?access_token=${token}`;
|
|
72
|
-
try {
|
|
73
|
-
return await instance.get(url);
|
|
74
|
-
} catch (err) {
|
|
75
|
-
throw applyTransform(err, [
|
|
76
|
-
notify,
|
|
77
|
-
]);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const addMediaInstance = axios.create({
|
|
82
|
-
headers: {
|
|
83
|
-
'content-type': 'multipart/form-data',
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const addMedia = async (params) => {
|
|
88
|
-
const url = `${baseUrl}/storage/media?access_token=${token}`;
|
|
89
|
-
|
|
90
|
-
const formData = new FormData();
|
|
91
|
-
formData.append('file', params.itemInstance);
|
|
92
|
-
try {
|
|
93
|
-
const response = await addMediaInstance.post(url, formData);
|
|
94
|
-
applyTransform(response, [
|
|
95
|
-
notify(() => ({
|
|
96
|
-
type: 'success',
|
|
97
|
-
text: 'Successfully added',
|
|
98
|
-
})),
|
|
99
|
-
]);
|
|
100
|
-
return response;
|
|
101
|
-
} catch (err) {
|
|
102
|
-
throw applyTransform(err, [
|
|
103
|
-
notify,
|
|
104
|
-
]);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const deleteMedia = async ({ id }) => {
|
|
109
|
-
try {
|
|
110
|
-
const response = await mediaService.deleteMediaFile(id);
|
|
111
|
-
return applyTransform(response.data, []);
|
|
112
|
-
} catch (err) {
|
|
113
|
-
throw applyTransform(err, [
|
|
114
|
-
notify,
|
|
115
|
-
]);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const getMediaLookup = (params) =>
|
|
120
|
-
getMediaList({
|
|
121
|
-
...params,
|
|
122
|
-
fields: params.fields || [
|
|
123
|
-
'id',
|
|
124
|
-
'name',
|
|
125
|
-
],
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
const MediaAPI = {
|
|
129
|
-
getList: getMediaList,
|
|
130
|
-
get: getMedia,
|
|
131
|
-
add: addMedia,
|
|
132
|
-
delete: deleteMedia,
|
|
133
|
-
getLookup: getMediaLookup,
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export default MediaAPI;
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { TypesApiFactory } from 'webitel-sdk';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
getDefaultGetListResponse,
|
|
5
|
-
getDefaultGetParams,
|
|
6
|
-
getDefaultInstance,
|
|
7
|
-
getDefaultOpenAPIConfig,
|
|
8
|
-
} from '../../defaults/index';
|
|
9
|
-
import applyTransform, {
|
|
10
|
-
camelToSnake,
|
|
11
|
-
generateUrl,
|
|
12
|
-
merge,
|
|
13
|
-
notify,
|
|
14
|
-
sanitize,
|
|
15
|
-
snakeToCamel,
|
|
16
|
-
starToSearch,
|
|
17
|
-
} from '../../transformers/index';
|
|
18
|
-
|
|
19
|
-
const instance = getDefaultInstance();
|
|
20
|
-
const configuration = getDefaultOpenAPIConfig();
|
|
21
|
-
|
|
22
|
-
const typeService = new TypesApiFactory(configuration, '', instance);
|
|
23
|
-
|
|
24
|
-
const getObjectList = async (params) => {
|
|
25
|
-
const fieldsToSend = [
|
|
26
|
-
'page',
|
|
27
|
-
'size',
|
|
28
|
-
'q',
|
|
29
|
-
'sort',
|
|
30
|
-
'fields',
|
|
31
|
-
'id',
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
const { page, size, fields, sort, id, q } = applyTransform(params, [
|
|
35
|
-
merge(getDefaultGetParams()),
|
|
36
|
-
starToSearch('search'),
|
|
37
|
-
(params) => ({
|
|
38
|
-
...params,
|
|
39
|
-
q: params.search,
|
|
40
|
-
}),
|
|
41
|
-
sanitize(fieldsToSend),
|
|
42
|
-
camelToSnake(),
|
|
43
|
-
]);
|
|
44
|
-
try {
|
|
45
|
-
const response = await typeService.search(
|
|
46
|
-
q,
|
|
47
|
-
id,
|
|
48
|
-
undefined,
|
|
49
|
-
undefined,
|
|
50
|
-
undefined,
|
|
51
|
-
undefined,
|
|
52
|
-
undefined,
|
|
53
|
-
undefined,
|
|
54
|
-
undefined,
|
|
55
|
-
size,
|
|
56
|
-
page,
|
|
57
|
-
sort,
|
|
58
|
-
fields,
|
|
59
|
-
);
|
|
60
|
-
const { data, next } = applyTransform(response.data, [
|
|
61
|
-
merge(getDefaultGetListResponse()),
|
|
62
|
-
]);
|
|
63
|
-
|
|
64
|
-
const itemResponseHandler = (items) =>
|
|
65
|
-
(items || []).map((item) => ({
|
|
66
|
-
...item,
|
|
67
|
-
id: item.repo,
|
|
68
|
-
}));
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
items: applyTransform(data, [
|
|
72
|
-
snakeToCamel(),
|
|
73
|
-
itemResponseHandler,
|
|
74
|
-
]),
|
|
75
|
-
next,
|
|
76
|
-
};
|
|
77
|
-
} catch (err) {
|
|
78
|
-
throw applyTransform(err, [
|
|
79
|
-
notify,
|
|
80
|
-
]);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const getObjectLookupList = async ({ ...params }) => {
|
|
85
|
-
const fieldsToSend = [
|
|
86
|
-
'page',
|
|
87
|
-
'size',
|
|
88
|
-
'q',
|
|
89
|
-
'sort',
|
|
90
|
-
'extensions',
|
|
91
|
-
'fields',
|
|
92
|
-
'id',
|
|
93
|
-
];
|
|
94
|
-
|
|
95
|
-
const url = applyTransform(params, [
|
|
96
|
-
merge(getDefaultGetParams()),
|
|
97
|
-
(params) => ({
|
|
98
|
-
...params,
|
|
99
|
-
q: params.search,
|
|
100
|
-
extensions: false,
|
|
101
|
-
}),
|
|
102
|
-
sanitize(fieldsToSend),
|
|
103
|
-
camelToSnake(),
|
|
104
|
-
generateUrl('types'),
|
|
105
|
-
]);
|
|
106
|
-
try {
|
|
107
|
-
const response = await instance.get(url);
|
|
108
|
-
const { data, next } = applyTransform(response.data, [
|
|
109
|
-
snakeToCamel(),
|
|
110
|
-
merge(getDefaultGetListResponse()),
|
|
111
|
-
]);
|
|
112
|
-
|
|
113
|
-
return {
|
|
114
|
-
items: data ?? [],
|
|
115
|
-
next,
|
|
116
|
-
};
|
|
117
|
-
} catch (err) {
|
|
118
|
-
throw applyTransform(err, [
|
|
119
|
-
notify,
|
|
120
|
-
]);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const getObjectLookup = async (params) =>
|
|
125
|
-
getObjectLookupList({
|
|
126
|
-
...params,
|
|
127
|
-
fields: params.fields || [
|
|
128
|
-
'id',
|
|
129
|
-
'name',
|
|
130
|
-
],
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
const ObjectsApi = {
|
|
134
|
-
getList: getObjectList,
|
|
135
|
-
getLookup: getObjectLookup,
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export default ObjectsApi;
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import deepCopy from 'deep-copy';
|
|
2
|
-
import { QueueServiceApiFactory } from 'webitel-sdk';
|
|
3
|
-
|
|
4
|
-
import isEmpty from '../../../scripts/isEmpty.js';
|
|
5
|
-
import {
|
|
6
|
-
getDefaultGetListResponse,
|
|
7
|
-
getDefaultGetParams,
|
|
8
|
-
getDefaultInstance,
|
|
9
|
-
getDefaultOpenAPIConfig,
|
|
10
|
-
} from '../../defaults/index.js';
|
|
11
|
-
import applyTransform, {
|
|
12
|
-
camelToSnake,
|
|
13
|
-
merge,
|
|
14
|
-
mergeEach,
|
|
15
|
-
notify,
|
|
16
|
-
sanitize,
|
|
17
|
-
snakeToCamel,
|
|
18
|
-
starToSearch,
|
|
19
|
-
} from '../../transformers/index.js';
|
|
20
|
-
import processing from './defaults/processing.js';
|
|
21
|
-
|
|
22
|
-
const instance = getDefaultInstance();
|
|
23
|
-
const configuration = getDefaultOpenAPIConfig();
|
|
24
|
-
|
|
25
|
-
const queueService = new QueueServiceApiFactory(configuration, '', instance);
|
|
26
|
-
|
|
27
|
-
const doNotConvertKeys = [
|
|
28
|
-
'variables',
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
const fieldsToSend = [
|
|
32
|
-
'name',
|
|
33
|
-
'type',
|
|
34
|
-
'strategy',
|
|
35
|
-
'team',
|
|
36
|
-
'priority',
|
|
37
|
-
'dncList',
|
|
38
|
-
'schema',
|
|
39
|
-
'payload',
|
|
40
|
-
'taskProcessing',
|
|
41
|
-
'maxOfRetry',
|
|
42
|
-
'timeout',
|
|
43
|
-
'secBetweenRetries',
|
|
44
|
-
'variables',
|
|
45
|
-
'calendar',
|
|
46
|
-
'description',
|
|
47
|
-
'enabled',
|
|
48
|
-
'ringtone',
|
|
49
|
-
'doSchema',
|
|
50
|
-
'afterSchema',
|
|
51
|
-
'stickyAgent',
|
|
52
|
-
'grantee',
|
|
53
|
-
'tags',
|
|
54
|
-
];
|
|
55
|
-
|
|
56
|
-
const preRequestHandler = (item) => {
|
|
57
|
-
const copy = deepCopy(item);
|
|
58
|
-
copy.variables = copy.variables.reduce((variables, variable) => {
|
|
59
|
-
if (!variable.key) return variables;
|
|
60
|
-
variables[variable.key] = variable.value;
|
|
61
|
-
return variables;
|
|
62
|
-
}, {});
|
|
63
|
-
return copy;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const getQueuesList = async (params) => {
|
|
67
|
-
const defaultObject = {
|
|
68
|
-
type: 0,
|
|
69
|
-
enabled: false,
|
|
70
|
-
active: 0,
|
|
71
|
-
waiting: 0,
|
|
72
|
-
priority: '0',
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const { page, size, search, sort, fields, id, queueType, team, tags } =
|
|
76
|
-
applyTransform(params, [
|
|
77
|
-
merge(getDefaultGetParams()),
|
|
78
|
-
starToSearch('search'),
|
|
79
|
-
]);
|
|
80
|
-
|
|
81
|
-
try {
|
|
82
|
-
const response = await queueService.searchQueue(
|
|
83
|
-
page,
|
|
84
|
-
size,
|
|
85
|
-
search,
|
|
86
|
-
sort,
|
|
87
|
-
fields,
|
|
88
|
-
id,
|
|
89
|
-
queueType,
|
|
90
|
-
team,
|
|
91
|
-
tags,
|
|
92
|
-
);
|
|
93
|
-
const { items, next } = applyTransform(response.data, [
|
|
94
|
-
snakeToCamel(doNotConvertKeys),
|
|
95
|
-
merge(getDefaultGetListResponse()),
|
|
96
|
-
]);
|
|
97
|
-
return {
|
|
98
|
-
items: applyTransform(items, [
|
|
99
|
-
mergeEach(defaultObject),
|
|
100
|
-
]),
|
|
101
|
-
next,
|
|
102
|
-
};
|
|
103
|
-
} catch (err) {
|
|
104
|
-
throw applyTransform(err, [
|
|
105
|
-
notify,
|
|
106
|
-
]);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const getQueue = async ({ itemId: id }) => {
|
|
111
|
-
const defaultObject = {
|
|
112
|
-
tags: [],
|
|
113
|
-
type: 0,
|
|
114
|
-
formSchema: {},
|
|
115
|
-
taskProcessing: {},
|
|
116
|
-
};
|
|
117
|
-
const responseHandler = (item) => {
|
|
118
|
-
const copy = deepCopy(item);
|
|
119
|
-
if (copy.variables) {
|
|
120
|
-
copy.variables = Object.keys(copy.variables).map((key) => ({
|
|
121
|
-
key,
|
|
122
|
-
value: copy.variables[key],
|
|
123
|
-
}));
|
|
124
|
-
}
|
|
125
|
-
if (isEmpty(copy.taskProcessing)) {
|
|
126
|
-
copy.taskProcessing = processing({
|
|
127
|
-
enabled: !!copy.processing,
|
|
128
|
-
formSchema: copy.formSchema,
|
|
129
|
-
sec: copy.processingSec || 0,
|
|
130
|
-
renewalSec: copy.processingRenewalSec || 0,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
return copy;
|
|
134
|
-
};
|
|
135
|
-
try {
|
|
136
|
-
const response = await queueService.readQueue(id);
|
|
137
|
-
return applyTransform(response.data, [
|
|
138
|
-
snakeToCamel(doNotConvertKeys),
|
|
139
|
-
merge(defaultObject),
|
|
140
|
-
responseHandler,
|
|
141
|
-
]);
|
|
142
|
-
} catch (err) {
|
|
143
|
-
throw applyTransform(err, [
|
|
144
|
-
notify,
|
|
145
|
-
]);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
const addQueue = async ({ itemInstance }) => {
|
|
150
|
-
const item = applyTransform(itemInstance, [
|
|
151
|
-
preRequestHandler,
|
|
152
|
-
sanitize(fieldsToSend),
|
|
153
|
-
camelToSnake(doNotConvertKeys),
|
|
154
|
-
]);
|
|
155
|
-
try {
|
|
156
|
-
const response = await queueService.createQueue(item);
|
|
157
|
-
return applyTransform(response.data, [
|
|
158
|
-
snakeToCamel(doNotConvertKeys),
|
|
159
|
-
]);
|
|
160
|
-
} catch (err) {
|
|
161
|
-
throw applyTransform(err, [
|
|
162
|
-
notify,
|
|
163
|
-
]);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
const updateQueue = async ({ itemInstance, itemId: id }) => {
|
|
168
|
-
const item = applyTransform(itemInstance, [
|
|
169
|
-
preRequestHandler,
|
|
170
|
-
sanitize(fieldsToSend),
|
|
171
|
-
camelToSnake(doNotConvertKeys),
|
|
172
|
-
]);
|
|
173
|
-
try {
|
|
174
|
-
const response = await queueService.updateQueue(id, item);
|
|
175
|
-
return applyTransform(response.data, [
|
|
176
|
-
snakeToCamel(doNotConvertKeys),
|
|
177
|
-
]);
|
|
178
|
-
} catch (err) {
|
|
179
|
-
throw applyTransform(err, [
|
|
180
|
-
notify,
|
|
181
|
-
]);
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const patchQueue = async ({ id, changes }) => {
|
|
186
|
-
const item = applyTransform(changes, [
|
|
187
|
-
sanitize(fieldsToSend),
|
|
188
|
-
camelToSnake(doNotConvertKeys),
|
|
189
|
-
]);
|
|
190
|
-
try {
|
|
191
|
-
const response = await queueService.patchQueue(id, item);
|
|
192
|
-
return applyTransform(response.data, [
|
|
193
|
-
snakeToCamel(doNotConvertKeys),
|
|
194
|
-
]);
|
|
195
|
-
} catch (err) {
|
|
196
|
-
throw applyTransform(err, [
|
|
197
|
-
notify,
|
|
198
|
-
]);
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const deleteQueue = async ({ id }) => {
|
|
203
|
-
try {
|
|
204
|
-
const response = await queueService.deleteQueue(id);
|
|
205
|
-
return applyTransform(response.data, []);
|
|
206
|
-
} catch (err) {
|
|
207
|
-
throw applyTransform(err, [
|
|
208
|
-
notify,
|
|
209
|
-
]);
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
const getQueuesLookup = (params) =>
|
|
214
|
-
getQueuesList({
|
|
215
|
-
...params,
|
|
216
|
-
fields: params.fields || [
|
|
217
|
-
'id',
|
|
218
|
-
'name',
|
|
219
|
-
'type',
|
|
220
|
-
],
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
const getQueuesTags = async (params) => {
|
|
224
|
-
const { page, size, search, sort, fields } = applyTransform(params, [
|
|
225
|
-
merge(getDefaultGetParams()),
|
|
226
|
-
starToSearch(),
|
|
227
|
-
camelToSnake(doNotConvertKeys),
|
|
228
|
-
]);
|
|
229
|
-
try {
|
|
230
|
-
const response = await queueService.searchQueueTags(
|
|
231
|
-
page,
|
|
232
|
-
size,
|
|
233
|
-
search,
|
|
234
|
-
sort,
|
|
235
|
-
fields,
|
|
236
|
-
);
|
|
237
|
-
const { items, next } = applyTransform(response.data, [
|
|
238
|
-
snakeToCamel(doNotConvertKeys),
|
|
239
|
-
merge(getDefaultGetListResponse()),
|
|
240
|
-
]);
|
|
241
|
-
return {
|
|
242
|
-
items,
|
|
243
|
-
next,
|
|
244
|
-
};
|
|
245
|
-
} catch (err) {
|
|
246
|
-
throw applyTransform(err, [
|
|
247
|
-
notify,
|
|
248
|
-
]);
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
const QueuesAPI = {
|
|
253
|
-
getList: getQueuesList,
|
|
254
|
-
get: getQueue,
|
|
255
|
-
add: addQueue,
|
|
256
|
-
patch: patchQueue,
|
|
257
|
-
update: updateQueue,
|
|
258
|
-
delete: deleteQueue,
|
|
259
|
-
getLookup: getQueuesLookup,
|
|
260
|
-
getQueuesTags,
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
export default QueuesAPI;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { SkillServiceApiFactory } from 'webitel-sdk';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
getDefaultGetListResponse,
|
|
5
|
-
getDefaultGetParams,
|
|
6
|
-
getDefaultInstance,
|
|
7
|
-
getDefaultOpenAPIConfig,
|
|
8
|
-
} from '../../defaults/index.js';
|
|
9
|
-
import applyTransform, {
|
|
10
|
-
camelToSnake,
|
|
11
|
-
merge,
|
|
12
|
-
notify,
|
|
13
|
-
sanitize,
|
|
14
|
-
snakeToCamel,
|
|
15
|
-
starToSearch,
|
|
16
|
-
} from '../../transformers/index.js';
|
|
17
|
-
|
|
18
|
-
const instance = getDefaultInstance();
|
|
19
|
-
const configuration = getDefaultOpenAPIConfig();
|
|
20
|
-
|
|
21
|
-
const skillService = new SkillServiceApiFactory(configuration, '', instance);
|
|
22
|
-
|
|
23
|
-
const getSkillsList = async (params) => {
|
|
24
|
-
const { page, size, search, sort, fields, id } = applyTransform(params, [
|
|
25
|
-
merge(getDefaultGetParams()),
|
|
26
|
-
starToSearch('search'),
|
|
27
|
-
]);
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
const response = await skillService.searchSkill(
|
|
31
|
-
page,
|
|
32
|
-
size,
|
|
33
|
-
search,
|
|
34
|
-
sort,
|
|
35
|
-
fields,
|
|
36
|
-
id,
|
|
37
|
-
);
|
|
38
|
-
const { items, next } = applyTransform(response.data, [
|
|
39
|
-
snakeToCamel(),
|
|
40
|
-
merge(getDefaultGetListResponse()),
|
|
41
|
-
]);
|
|
42
|
-
return {
|
|
43
|
-
items,
|
|
44
|
-
next,
|
|
45
|
-
};
|
|
46
|
-
} catch (err) {
|
|
47
|
-
throw applyTransform(err, [
|
|
48
|
-
notify,
|
|
49
|
-
]);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const getSkill = async ({ itemId: id }) => {
|
|
54
|
-
try {
|
|
55
|
-
const response = await skillService.readSkill(id);
|
|
56
|
-
return applyTransform(response.data, [
|
|
57
|
-
snakeToCamel(),
|
|
58
|
-
]);
|
|
59
|
-
} catch (err) {
|
|
60
|
-
throw applyTransform(err, [
|
|
61
|
-
notify,
|
|
62
|
-
]);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const fieldsToSend = [
|
|
67
|
-
'name',
|
|
68
|
-
'description',
|
|
69
|
-
];
|
|
70
|
-
|
|
71
|
-
const addSkill = async ({ itemInstance }) => {
|
|
72
|
-
const item = applyTransform(itemInstance, [
|
|
73
|
-
sanitize(fieldsToSend),
|
|
74
|
-
camelToSnake(),
|
|
75
|
-
]);
|
|
76
|
-
try {
|
|
77
|
-
const response = await skillService.createSkill(item);
|
|
78
|
-
return applyTransform(response.data, [
|
|
79
|
-
snakeToCamel(),
|
|
80
|
-
]);
|
|
81
|
-
} catch (err) {
|
|
82
|
-
throw applyTransform(err, [
|
|
83
|
-
notify,
|
|
84
|
-
]);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const updateSkill = async ({ itemInstance, itemId: id }) => {
|
|
89
|
-
const item = applyTransform(itemInstance, [
|
|
90
|
-
sanitize(fieldsToSend),
|
|
91
|
-
camelToSnake(),
|
|
92
|
-
]);
|
|
93
|
-
try {
|
|
94
|
-
const response = await skillService.updateSkill(id, item);
|
|
95
|
-
return applyTransform(response.data, [
|
|
96
|
-
snakeToCamel(),
|
|
97
|
-
]);
|
|
98
|
-
} catch (err) {
|
|
99
|
-
throw applyTransform(err, [
|
|
100
|
-
notify,
|
|
101
|
-
]);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const deleteSkill = async ({ id }) => {
|
|
106
|
-
try {
|
|
107
|
-
const response = await skillService.deleteSkill(id);
|
|
108
|
-
return applyTransform(response.data, []);
|
|
109
|
-
} catch (err) {
|
|
110
|
-
throw applyTransform(err, [
|
|
111
|
-
notify,
|
|
112
|
-
]);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const getSkillsLookup = (params) =>
|
|
117
|
-
getSkillsList({
|
|
118
|
-
...params,
|
|
119
|
-
fields: params.fields || [
|
|
120
|
-
'id',
|
|
121
|
-
'name',
|
|
122
|
-
],
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
const SkillsAPI = {
|
|
126
|
-
getList: getSkillsList,
|
|
127
|
-
get: getSkill,
|
|
128
|
-
add: addSkill,
|
|
129
|
-
update: updateSkill,
|
|
130
|
-
delete: deleteSkill,
|
|
131
|
-
getLookup: getSkillsLookup,
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export default SkillsAPI;
|