@webitel/ui-sdk 25.4.73 → 25.4.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "25.4.73",
3
+ "version": "25.4.74",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -28,6 +28,7 @@ import users from './users/users.js';
28
28
  import sysTypes from './wtTypes/sysTypes/sysTypes';
29
29
  import typeExtensions from './wtTypes/typeExtensions/typeExtensions';
30
30
  import { contactChatMessagesHistory, contacts } from './сontacts/index.js';
31
+ import labels from './labels/labels.js';
31
32
 
32
33
  export {
33
34
  agentChats,
@@ -61,4 +62,5 @@ export {
61
62
  teams,
62
63
  typeExtensions,
63
64
  users,
65
+ labels,
64
66
  };
@@ -0,0 +1,56 @@
1
+ import {
2
+ getDefaultGetParams,
3
+ getDefaultInstance, getDefaultOpenAPIConfig,
4
+ } from '../../defaults/index';
5
+ import applyTransform, {
6
+ camelToSnake,
7
+ merge,
8
+ notify,
9
+ sanitize,
10
+ snakeToCamel,
11
+ starToSearch,
12
+ } from '../../transformers/index';
13
+ import { LabelsApiFactory } from 'webitel-sdk';
14
+
15
+ const instance = getDefaultInstance();
16
+ const configuration = getDefaultOpenAPIConfig();
17
+
18
+ const service = new LabelsApiFactory(configuration, '', instance);
19
+
20
+ const getList = async (params) => {
21
+ const fieldsToSend = ['page', 'size', 'search', 'sort', 'fields', 'id'];
22
+ const {
23
+ page,
24
+ size,
25
+ search,
26
+ } = applyTransform(params, [
27
+ sanitize(fieldsToSend),
28
+ merge(getDefaultGetParams()),
29
+ starToSearch('search'),
30
+ camelToSnake(),
31
+ ]);
32
+ try {
33
+ const response = await service.getLabels(page, size, search);
34
+ const { labels, next } = applyTransform(response.data, [
35
+ snakeToCamel(),
36
+ merge({ labels: [], next: false }),
37
+ ]);
38
+ return {
39
+ items: labels,
40
+ next,
41
+ };
42
+ } catch (err) {
43
+ throw applyTransform(err, [notify]);
44
+ }
45
+ };
46
+
47
+ const getLabelsLookup = (params) =>
48
+ getList({
49
+ ...params,
50
+ fields: params.fields || ['id', 'name'],
51
+ });
52
+
53
+ export default {
54
+ getList,
55
+ getLookup: getLabelsLookup,
56
+ };
@@ -38,8 +38,11 @@ const getList = async (params) => {
38
38
  'fields',
39
39
  'id',
40
40
  'qin',
41
- 'groupId',
42
41
  'notIdGroup',
42
+ 'group',
43
+ 'owner',
44
+ 'label',
45
+ 'user',
43
46
  ];
44
47
 
45
48
  if (!params.fields) {
@@ -112,6 +115,20 @@ const getList = async (params) => {
112
115
  if (params.parentId) {
113
116
  changedParams.groupId = [params.parentId];
114
117
  }
118
+
119
+ if(params.hasUser != null) {
120
+ changedParams.user = params.hasUser;
121
+ }
122
+
123
+ if(params.contactGroup) {
124
+ changedParams.group = [...params.contactGroup.list];
125
+ }
126
+ if(params.contactLabel) {
127
+ changedParams.label = params.contactLabel.map(item => item.label);
128
+ }
129
+ if(params.contactOwner) {
130
+ changedParams.owner = params.contactOwner;
131
+ }
115
132
  }
116
133
 
117
134
  const transformations = [
@@ -120,7 +137,7 @@ const getList = async (params) => {
120
137
  camelToSnake(),
121
138
  ];
122
139
 
123
- const { page, size, q, sort, fields, id, qin, mode, group_id, not_id_group } =
140
+ const { page, size, q, sort, fields, id, qin, mode, group_id, group, not_id_group, owner, label, user } =
124
141
  applyTransform(changedParams, transformations);
125
142
 
126
143
  try {
@@ -134,7 +151,10 @@ const getList = async (params) => {
134
151
  qin,
135
152
  mode,
136
153
  not_id_group,
137
- group_id,
154
+ group,
155
+ owner,
156
+ label,
157
+ user,
138
158
  );
139
159
 
140
160
  const { items, next } = applyTransform(
@@ -19,6 +19,7 @@ import CrmSections from '../../enums/WebitelApplications/CrmSections.enum.js';
19
19
  import AdminSections from '../../enums/WebitelApplications/AdminSections.enum.js';
20
20
  import { AccessMode } from '../../modules/ObjectPermissions/_internals/enums/AccessMode.enum.js';
21
21
  import { snakeToCamel } from '../../scripts';
22
+ import { FilterOption } from '../../../packages/ui-datalist/src/modules/filters/modules/filterConfig/enums/FilterOption';
22
23
 
23
24
  export default {
24
25
  // describes reusable buttons, actions, default titles, and other ui elements
@@ -169,6 +170,7 @@ export default {
169
170
  totalDuration: 'Total duration',
170
171
  transcription: 'Transcription',
171
172
  attachment: 'Attachment | Attachments',
173
+ owner: 'Owner | Owners',
172
174
  queue: {
173
175
  queue: 'Queue | Queues',
174
176
  type: {
@@ -555,7 +557,7 @@ export default {
555
557
  contact: ({ linked }) => {
556
558
  return linked('vocabulary.contact');
557
559
  },
558
- contactGroup: ({ linked }) => {
560
+ [FilterOption.ContactGroup]: ({ linked }) => {
559
561
  return linked('cases.groupPerformers');
560
562
  },
561
563
  createdAt: ({ linked }) => {
@@ -585,9 +587,18 @@ export default {
585
587
  hasTranscription: ({ linked }) => {
586
588
  return linked('objects.transcription');
587
589
  },
590
+ [FilterOption.HasUser]: ({ linked }) => {
591
+ return linked('objects.user');
592
+ },
588
593
  impacted: ({ linked }) => {
589
594
  return linked('cases.impacted');
590
595
  },
596
+ [FilterOption.ContactLabel]: ({ linked }) => {
597
+ return linked('vocabulary.labels');
598
+ },
599
+ [FilterOption.ContactOwner]: ({ linked }) => {
600
+ return linked('objects.owner');
601
+ },
591
602
  priority: ({ linked }) => {
592
603
  return linked('vocabulary.priority');
593
604
  },
@@ -5,6 +5,7 @@ import {
5
5
  ChannelType,
6
6
  EngineRoutingSchemaType,
7
7
  } from 'webitel-sdk';
8
+ import { FilterOption } from '../../../packages/ui-datalist/src/modules/filters/modules/filterConfig/enums/FilterOption';
8
9
 
9
10
  import {
10
11
  AuditorSections,
@@ -168,6 +169,7 @@ export default {
168
169
  totalDuration: 'Общая длительность',
169
170
  transcription: 'Транскрипция',
170
171
  attachment: 'Вложение | Вложения',
172
+ owner: 'Владелец | Владельцы',
171
173
  queue: {
172
174
  queue: 'Очередь | Очереди',
173
175
  type: {
@@ -551,7 +553,7 @@ export default {
551
553
  contact: ({ linked }) => {
552
554
  return linked('vocabulary.contact');
553
555
  },
554
- contactGroup: ({ linked }) => {
556
+ [FilterOption.ContactGroup]: ({ linked }) => {
555
557
  return linked('cases.groupPerformers');
556
558
  },
557
559
  createdAt: ({ linked }) => {
@@ -581,9 +583,18 @@ export default {
581
583
  hasTranscription: ({ linked }) => {
582
584
  return linked('objects.transcription');
583
585
  },
586
+ [FilterOption.HasUser]: ({ linked }) => {
587
+ return linked('objects.user');
588
+ },
584
589
  impacted: ({ linked }) => {
585
590
  return linked('cases.impacted');
586
591
  },
592
+ [FilterOption.ContactLabel]: ({ linked }) => {
593
+ return linked('vocabulary.labels');
594
+ },
595
+ [FilterOption.ContactOwner]: ({ linked }) => {
596
+ return linked('objects.owner');
597
+ },
587
598
  priority: ({ linked }) => {
588
599
  return linked('vocabulary.priority');
589
600
  },
@@ -5,6 +5,7 @@ import {
5
5
  ChannelType,
6
6
  EngineRoutingSchemaType,
7
7
  } from 'webitel-sdk';
8
+ import { FilterOption } from '../../../packages/ui-datalist/src/modules/filters/modules/filterConfig/enums/FilterOption';
8
9
 
9
10
  import {
10
11
  AuditorSections,
@@ -168,6 +169,7 @@ export default {
168
169
  totalDuration: 'Загальна тривалість',
169
170
  transcription: 'Транскрипція',
170
171
  attachment: 'Вкладення | Вкладення',
172
+ owner: 'Власник | Власники',
171
173
  queue: {
172
174
  queue: 'Черга | Черги',
173
175
  type: {
@@ -551,7 +553,7 @@ export default {
551
553
  contact: ({ linked }) => {
552
554
  return linked('vocabulary.contact');
553
555
  },
554
- contactGroup: ({ linked }) => {
556
+ [FilterOption.ContactGroup]: ({ linked }) => {
555
557
  return linked('cases.groupPerformers');
556
558
  },
557
559
  createdAt: ({ linked }) => {
@@ -581,9 +583,18 @@ export default {
581
583
  hasTranscription: ({ linked }) => {
582
584
  return linked('objects.transcription');
583
585
  },
586
+ [FilterOption.HasUser]: ({ linked }) => {
587
+ return linked('objects.user');
588
+ },
584
589
  impacted: ({ linked }) => {
585
590
  return linked('cases.impacted');
586
591
  },
592
+ [FilterOption.ContactLabel]: ({ linked }) => {
593
+ return linked('vocabulary.labels');
594
+ },
595
+ [FilterOption.ContactOwner]: ({ linked }) => {
596
+ return linked('objects.owner');
597
+ },
587
598
  priority: ({ linked }) => {
588
599
  return linked('vocabulary.priority');
589
600
  },