@webitel/api-services 0.0.65 → 0.0.67

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/api-services",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "make-all": "npm run gen:api && npm version patch && (npm run build:types || true) && (npm run format:all || true) && npm run publish-lib",
@@ -28,51 +28,35 @@ const getAgentsList = async (params) => {
28
28
  statusDuration: convertStatusDuration(item.statusDuration),
29
29
  }));
30
30
  };
31
-
32
- const {
33
- page,
34
- size,
35
- search,
36
- sort,
37
- fields,
38
- id,
39
- allowChannels,
40
- team,
41
- regionId,
42
- auditorId,
43
- skill,
44
- queueId,
45
- isSupervisor,
46
- isNotSupervisor,
47
- userId,
48
- notTeamId,
49
- supervisorId,
50
- notSkillId,
51
- notUserId,
52
- } = applyTransform(params, [merge(getDefaultGetParams())]);
31
+ const fieldsToSend = [
32
+ 'page',
33
+ 'size',
34
+ 'search',
35
+ 'sort',
36
+ 'fields',
37
+ 'id',
38
+ 'allow_channels',
39
+ 'team',
40
+ 'region_id',
41
+ 'auditor_id',
42
+ 'skill',
43
+ 'queue_id',
44
+ 'is_supervisor',
45
+ 'is_not_Supervisor',
46
+ 'user_id',
47
+ 'not_team_id',
48
+ 'supervisor_id',
49
+ 'not_skill_id',
50
+ 'not_user_id',
51
+ ];
52
+ const requestParams = applyTransform(params, [
53
+ camelToSnake(),
54
+ merge(getDefaultGetListResponse()),
55
+ sanitize(fieldsToSend),
56
+ ]);
53
57
 
54
58
  try {
55
- const response = await getAgentService().searchAgent({
56
- page,
57
- size,
58
- search,
59
- sort,
60
- fields,
61
- id,
62
- allowChannels,
63
- supervisorId,
64
- team,
65
- regionId,
66
- auditorId,
67
- isSupervisor,
68
- skill,
69
- queueId,
70
- isNotSupervisor,
71
- userId,
72
- notTeamId,
73
- notSkillId,
74
- notUserId,
75
- });
59
+ const response = await getAgentService().searchAgent(requestParams);
76
60
  const { items, next } = applyTransform(response.data, [
77
61
  snakeToCamel(),
78
62
  merge(getDefaultGetListResponse()),
@@ -238,6 +222,37 @@ const getAgentUsersOptions = async (params) => {
238
222
  throw applyTransform(err, [notify]);
239
223
  }
240
224
  };
225
+
226
+ const getUsersStatus = async (params) => {
227
+ const fieldsToSend = [
228
+ 'page',
229
+ 'size',
230
+ 'search',
231
+ 'sort',
232
+ 'fields',
233
+ 'not_user_id',
234
+ ];
235
+ const requestParams = applyTransform(params, [
236
+ camelToSnake(),
237
+ merge(getDefaultGetParams()),
238
+ starToSearch('search'),
239
+ sanitize(fieldsToSend),
240
+ ]);
241
+
242
+ try {
243
+ const response = await getAgentService().searchUserStatus(requestParams);
244
+ const { items, next } = applyTransform(response.data, [
245
+ snakeToCamel(),
246
+ merge(getDefaultGetListResponse()),
247
+ ]);
248
+ return {
249
+ items,
250
+ next,
251
+ };
252
+ } catch (err) {
253
+ throw applyTransform(err, [notify]);
254
+ }
255
+ };
241
256
  const getSupervisorOptions = async (params) => {
242
257
  const isSupervisor = true;
243
258
  return getAgentsList({ ...params, isSupervisor });
@@ -261,4 +276,5 @@ export const AgentsAPI = {
261
276
  getRegularAgentsOptions,
262
277
  getAgentUsersOptions,
263
278
  getSupervisorOptions,
279
+ getUsersStatus,
264
280
  };
@@ -40,4 +40,8 @@ export declare const AgentsAPI: {
40
40
  items: any;
41
41
  next: any;
42
42
  }>;
43
+ getUsersStatus: (params: any) => Promise<{
44
+ items: any;
45
+ next: any;
46
+ }>;
43
47
  };