@webitel/ui-sdk 26.8.68 → 26.8.70

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.
Files changed (120) hide show
  1. package/dist/clients-BLoUCVC8.js +39334 -0
  2. package/dist/{components-BoODKBgN.js → components-DBVFjVK_.js} +3 -3
  3. package/dist/{genClient-C_5VsLM9.js → genClient-BqTmfnDx.js} +1 -1
  4. package/dist/ui-sdk.css +1 -1
  5. package/dist/ui-sdk.js +2 -2
  6. package/dist/ui-sdk.umd.cjs +657 -732
  7. package/dist/{wt-chat-emoji-DMSSNCSp.js → wt-chat-emoji-CveWfqBS.js} +1 -1
  8. package/dist/{wt-display-chip-items-BaL81KbX.js → wt-display-chip-items-BmRyOpv7.js} +1 -1
  9. package/dist/{wt-send-message-popup-Cz3tLMAW.js → wt-send-message-popup-Ci3b-7uX.js} +2 -2
  10. package/dist/wt-table-actions-D7harVHK.js +63 -0
  11. package/dist/wt-tree-CfvNlw7N.js +2042 -0
  12. package/dist/{wt-type-extension-value-input-D7eK5MwZ.js → wt-type-extension-value-input-BGb_JCgp.js} +2 -2
  13. package/dist/{wt-vidstack-player-CPk5Y-1M.js → wt-vidstack-player-luoZqZ5-.js} +1 -1
  14. package/package.json +1 -1
  15. package/src/api/clients/index.js +5 -66
  16. package/src/components/wt-table-actions/wt-table-actions.vue +1 -1
  17. package/src/modules/AgentStatusSelect/api/agent-status.ts +44 -0
  18. package/src/modules/AgentStatusSelect/api/pause-cause.ts +54 -0
  19. package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +4 -10
  20. package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +2 -6
  21. package/types/.tsbuildinfo +1 -1
  22. package/types/api/clients/index.d.ts +1 -33
  23. package/types/modules/AgentStatusSelect/api/agent-status.d.ts +4 -12
  24. package/types/modules/AgentStatusSelect/api/pause-cause.d.ts +7 -9
  25. package/dist/clients-CjmnMcur.js +0 -40042
  26. package/dist/side-channel-M3LABDql.js +0 -833
  27. package/dist/wt-table-actions-4-peSVkc.js +0 -63
  28. package/dist/wt-tree-DKSphRxr.js +0 -1216
  29. package/src/api/clients/agents/agentChats.js +0 -79
  30. package/src/api/clients/agents/agents.js +0 -300
  31. package/src/api/clients/buckets/buckets.js +0 -134
  32. package/src/api/clients/calendars/calendars.js +0 -239
  33. package/src/api/clients/caseCloseReasonGroups/caseCloseReasonGroups.js +0 -161
  34. package/src/api/clients/caseCloseReasons/caseCloseReasons.js +0 -165
  35. package/src/api/clients/casePriorities/casePriorities.js +0 -166
  36. package/src/api/clients/caseServiceCatalogs/serviceCatalogs.js +0 -231
  37. package/src/api/clients/caseServices/services.js +0 -221
  38. package/src/api/clients/caseSources/caseSources.ts +0 -2
  39. package/src/api/clients/caseStatusConditions/caseStatusConditions.js +0 -207
  40. package/src/api/clients/caseStatuses/caseStatuses.js +0 -152
  41. package/src/api/clients/catalog/catalog.js +0 -63
  42. package/src/api/clients/chatGateways/chatGateways.js +0 -338
  43. package/src/api/clients/chatGateways/defaults/defaultChatGateway.js +0 -18
  44. package/src/api/clients/chatGateways/defaults/webChatGateway.js +0 -72
  45. package/src/api/clients/chatGateways/enums/WebchatAlternativeChannel.enum.js +0 -14
  46. package/src/api/clients/chatGateways/scripts/generateUri.js +0 -9
  47. package/src/api/clients/communications/communications.js +0 -172
  48. package/src/api/clients/configurations/configurations.js +0 -168
  49. package/src/api/clients/contactGroups/contactGroups.js +0 -221
  50. package/src/api/clients/flows/flow.js +0 -252
  51. package/src/api/clients/gateways/defaults/defaultGateway.js +0 -9
  52. package/src/api/clients/gateways/defaults/registerGateway.js +0 -12
  53. package/src/api/clients/gateways/defaults/trunkingGateway.js +0 -16
  54. package/src/api/clients/gateways/gateways.js +0 -221
  55. package/src/api/clients/labels/labels.js +0 -69
  56. package/src/api/clients/lists/blacklists.js +0 -142
  57. package/src/api/clients/media/media.js +0 -136
  58. package/src/api/clients/object/object.js +0 -138
  59. package/src/api/clients/queues/queues.js +0 -263
  60. package/src/api/clients/quickReplies/quickReplies.ts +0 -2
  61. package/src/api/clients/skills/skills.js +0 -134
  62. package/src/api/clients/slaConditions/slaConditions.js +0 -190
  63. package/src/api/clients/slas/slas.js +0 -148
  64. package/src/api/clients/teams/teams.js +0 -161
  65. package/src/api/clients/users/__tests__/users.spec.js +0 -282
  66. package/src/api/clients/users/users.js +0 -334
  67. package/src/api/clients/wtTypes/_shared/utils/sortDynamicFields.ts +0 -38
  68. package/src/api/clients/wtTypes/sysTypes/sysTypes.ts +0 -92
  69. package/src/api/clients/wtTypes/typeExtensions/typeExtensions.ts +0 -156
  70. package/src/api/clients//321/201ontacts/contactChatMessagesHistory.js +0 -119
  71. package/src/api/clients//321/201ontacts/contacts.js +0 -449
  72. package/src/api/clients//321/201ontacts/enums/ContactsSearchMode.js +0 -9
  73. package/src/api/clients//321/201ontacts/index.js +0 -5
  74. package/src/modules/AgentStatusSelect/api/agent-status.js +0 -30
  75. package/src/modules/AgentStatusSelect/api/pause-cause.js +0 -49
  76. package/types/api/clients/agents/agentChats.d.ts +0 -10
  77. package/types/api/clients/agents/agents.d.ts +0 -55
  78. package/types/api/clients/buckets/buckets.d.ts +0 -30
  79. package/types/api/clients/calendars/calendars.d.ts +0 -35
  80. package/types/api/clients/caseCloseReasonGroups/caseCloseReasonGroups.d.ts +0 -30
  81. package/types/api/clients/caseCloseReasons/caseCloseReasons.d.ts +0 -36
  82. package/types/api/clients/casePriorities/casePriorities.d.ts +0 -30
  83. package/types/api/clients/caseServiceCatalogs/serviceCatalogs.d.ts +0 -30
  84. package/types/api/clients/caseServices/services.d.ts +0 -42
  85. package/types/api/clients/caseSources/caseSources.d.ts +0 -1
  86. package/types/api/clients/caseStatusConditions/caseStatusConditions.d.ts +0 -43
  87. package/types/api/clients/caseStatuses/caseStatuses.d.ts +0 -30
  88. package/types/api/clients/catalog/catalog.d.ts +0 -13
  89. package/types/api/clients/chatGateways/chatGateways.d.ts +0 -35
  90. package/types/api/clients/chatGateways/defaults/defaultChatGateway.d.ts +0 -15
  91. package/types/api/clients/chatGateways/defaults/webChatGateway.d.ts +0 -64
  92. package/types/api/clients/chatGateways/enums/WebchatAlternativeChannel.enum.d.ts +0 -8
  93. package/types/api/clients/chatGateways/scripts/generateUri.d.ts +0 -2
  94. package/types/api/clients/communications/communications.d.ts +0 -35
  95. package/types/api/clients/configurations/configurations.d.ts +0 -35
  96. package/types/api/clients/contactGroups/contactGroups.d.ts +0 -47
  97. package/types/api/clients/flows/flow.d.ts +0 -35
  98. package/types/api/clients/gateways/defaults/defaultGateway.d.ts +0 -8
  99. package/types/api/clients/gateways/defaults/registerGateway.d.ts +0 -13
  100. package/types/api/clients/gateways/defaults/trunkingGateway.d.ts +0 -11
  101. package/types/api/clients/gateways/gateways.d.ts +0 -35
  102. package/types/api/clients/labels/labels.d.ts +0 -13
  103. package/types/api/clients/lists/blacklists.d.ts +0 -30
  104. package/types/api/clients/media/media.d.ts +0 -24
  105. package/types/api/clients/object/object.d.ts +0 -13
  106. package/types/api/clients/queues/queues.d.ts +0 -40
  107. package/types/api/clients/quickReplies/quickReplies.d.ts +0 -1
  108. package/types/api/clients/skills/skills.d.ts +0 -30
  109. package/types/api/clients/slaConditions/slaConditions.d.ts +0 -36
  110. package/types/api/clients/slas/slas.d.ts +0 -30
  111. package/types/api/clients/teams/teams.d.ts +0 -30
  112. package/types/api/clients/users/__tests__/users.spec.d.ts +0 -1
  113. package/types/api/clients/users/users.d.ts +0 -46
  114. package/types/api/clients/wtTypes/_shared/utils/sortDynamicFields.d.ts +0 -2
  115. package/types/api/clients/wtTypes/sysTypes/sysTypes.d.ts +0 -29
  116. package/types/api/clients/wtTypes/typeExtensions/typeExtensions.d.ts +0 -33
  117. package/types/api/clients//321/201ontacts/contactChatMessagesHistory.d.ts +0 -16
  118. package/types/api/clients//321/201ontacts/contacts.d.ts +0 -29
  119. package/types/api/clients//321/201ontacts/enums/ContactsSearchMode.d.ts +0 -8
  120. package/types/api/clients//321/201ontacts/index.d.ts +0 -4
@@ -1,239 +0,0 @@
1
- import deepCopy from 'deep-copy';
2
- import { CalendarServiceApiFactory } from 'webitel-sdk';
3
-
4
- import {
5
- getDefaultGetListResponse,
6
- getDefaultGetParams,
7
- getDefaultInstance,
8
- getDefaultOpenAPIConfig,
9
- } from '../../defaults/index.js';
10
- import applyTransform, {
11
- camelToSnake,
12
- merge,
13
- notify,
14
- sanitize,
15
- snakeToCamel,
16
- starToSearch,
17
- } from '../../transformers/index.js';
18
-
19
- const instance = getDefaultInstance();
20
- const configuration = getDefaultOpenAPIConfig();
21
-
22
- const calendarService = new CalendarServiceApiFactory(
23
- configuration,
24
- '',
25
- instance,
26
- );
27
-
28
- const getCalendarList = async (params) => {
29
- const { page, size, search, sort, fields, id } = applyTransform(params, [
30
- merge(getDefaultGetParams()),
31
- starToSearch('search'),
32
- ]);
33
-
34
- try {
35
- const response = await calendarService.searchCalendar(
36
- page,
37
- size,
38
- search,
39
- sort,
40
- fields,
41
- id,
42
- );
43
- const { items, next } = applyTransform(response.data, [
44
- snakeToCamel(),
45
- merge(getDefaultGetListResponse()),
46
- ]);
47
- return {
48
- items,
49
- next,
50
- };
51
- } catch (err) {
52
- throw applyTransform(err, [
53
- notify,
54
- ]);
55
- }
56
- };
57
-
58
- const getCalendar = async ({ itemId: id }) => {
59
- const itemResponseHandler = (item) => {
60
- const copy = deepCopy(item);
61
- const defaultSingleObject = {
62
- name: '',
63
- timezone: {},
64
- description: '',
65
- startAt: Date.now(),
66
- endAt: Date.now(),
67
- expires: !!(copy.startAt || copy.endAt),
68
- accepts: [],
69
- excepts: [],
70
- };
71
-
72
- copy.accepts = copy.accepts.map((accept) => ({
73
- day: accept.day || 0,
74
- disabled: accept.disabled || false,
75
- start: accept.startTimeOfDay || 0,
76
- end: accept.endTimeOfDay || 0,
77
- }));
78
- if (copy.excepts) {
79
- copy.excepts = copy.excepts.map((except) => ({
80
- name: except.name || '',
81
- date: except.date || 0,
82
- repeat: except.repeat || false,
83
- working: except.working || false,
84
- workStart: except.workStart ?? (except.working ? 0 : null),
85
- workStop: except.workStop ?? (except.working ? 0 : null),
86
- }));
87
- }
88
- return {
89
- ...defaultSingleObject,
90
- ...copy,
91
- };
92
- };
93
-
94
- try {
95
- const response = await calendarService.readCalendar(id);
96
- return applyTransform(response.data, [
97
- snakeToCamel(),
98
- itemResponseHandler,
99
- ]);
100
- } catch (err) {
101
- throw applyTransform(err, [
102
- notify,
103
- ]);
104
- }
105
- };
106
-
107
- const fieldsToSend = [
108
- 'name',
109
- 'description',
110
- 'timezone',
111
- 'startAt',
112
- 'endAt',
113
- 'day',
114
- 'accepts',
115
- 'excepts',
116
- 'startTimeOfDay',
117
- 'endTimeOfDay',
118
- 'disabled',
119
- 'date',
120
- 'repeat',
121
- 'working',
122
- 'workStart',
123
- 'workStop',
124
- ];
125
-
126
- const preRequestHandler = (item) => {
127
- const copy = deepCopy(item);
128
- delete copy.timezone.offset;
129
- if (!copy.expires) {
130
- delete copy.startAt;
131
- delete copy.endAt;
132
- }
133
-
134
- copy.accepts = copy.accepts.map((accept) => ({
135
- day: accept.day,
136
- disabled: accept.disabled,
137
- startTimeOfDay: accept.start,
138
- endTimeOfDay: accept.end,
139
- }));
140
- return copy;
141
- };
142
-
143
- const addCalendar = async ({ itemInstance }) => {
144
- const item = applyTransform(itemInstance, [
145
- preRequestHandler,
146
- sanitize(fieldsToSend),
147
- camelToSnake(),
148
- ]);
149
- try {
150
- const response = await calendarService.createCalendar(item);
151
- return applyTransform(response.data, [
152
- snakeToCamel(),
153
- ]);
154
- } catch (err) {
155
- throw applyTransform(err, [
156
- notify,
157
- ]);
158
- }
159
- };
160
-
161
- const updateCalendar = async ({ itemInstance, itemId: id }) => {
162
- const item = applyTransform(itemInstance, [
163
- preRequestHandler,
164
- sanitize(fieldsToSend),
165
- camelToSnake(),
166
- ]);
167
- try {
168
- const response = await calendarService.updateCalendar(id, item);
169
- return applyTransform(response.data, [
170
- snakeToCamel(),
171
- ]);
172
- } catch (err) {
173
- throw applyTransform(err, [
174
- notify,
175
- ]);
176
- }
177
- };
178
-
179
- const deleteCalendar = async ({ id }) => {
180
- try {
181
- const response = await calendarService.deleteCalendar(id);
182
- return applyTransform(response.data, []);
183
- } catch (err) {
184
- throw applyTransform(err, [
185
- notify,
186
- ]);
187
- }
188
- };
189
-
190
- const getCalendarsLookup = (params) =>
191
- getCalendarList({
192
- ...params,
193
- fields: params.fields || [
194
- 'id',
195
- 'name',
196
- ],
197
- });
198
-
199
- const getTimezonesLookup = async (params) => {
200
- const { page, size, search, sort, fields, id } = applyTransform(params, [
201
- merge(getDefaultGetParams()),
202
- starToSearch('search'),
203
- ]);
204
-
205
- try {
206
- const response = await calendarService.searchTimezones(
207
- page,
208
- size,
209
- search,
210
- sort,
211
- fields,
212
- id,
213
- );
214
- const { items, next } = applyTransform(response.data, [
215
- snakeToCamel(),
216
- merge(getDefaultGetListResponse()),
217
- ]);
218
- return {
219
- items,
220
- next,
221
- };
222
- } catch (err) {
223
- throw applyTransform(err, [
224
- notify,
225
- ]);
226
- }
227
- };
228
-
229
- const CalendarsAPI = {
230
- getList: getCalendarList,
231
- get: getCalendar,
232
- add: addCalendar,
233
- update: updateCalendar,
234
- delete: deleteCalendar,
235
- getLookup: getCalendarsLookup,
236
- getTimezonesLookup,
237
- };
238
-
239
- export default CalendarsAPI;
@@ -1,161 +0,0 @@
1
- import { CloseReasonGroupsApiFactory } 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
- } from '../../transformers/index.js';
16
-
17
- const instance = getDefaultInstance();
18
- const configuration = getDefaultOpenAPIConfig();
19
-
20
- const closeReasonGroupsService = new CloseReasonGroupsApiFactory(
21
- configuration,
22
- '',
23
- instance,
24
- );
25
-
26
- const fieldsToSend = [
27
- 'name',
28
- 'description',
29
- ];
30
-
31
- const getCloseReasonGroupsList = async (params) => {
32
- const fieldsToSend = [
33
- 'page',
34
- 'size',
35
- 'q',
36
- 'sort',
37
- 'fields',
38
- 'id',
39
- ];
40
-
41
- const { page, size, fields, sort, id, q } = applyTransform(params, [
42
- merge(getDefaultGetParams()),
43
- (params) => ({
44
- ...params,
45
- q: params.search,
46
- }),
47
- sanitize(fieldsToSend),
48
- camelToSnake(),
49
- ]);
50
- try {
51
- const response = await closeReasonGroupsService.listCloseReasonGroups(
52
- page,
53
- size,
54
- fields,
55
- sort,
56
- id,
57
- q,
58
- );
59
- const { items, next } = applyTransform(response.data, [
60
- merge(getDefaultGetListResponse()),
61
- ]);
62
- return {
63
- items: applyTransform(items, []),
64
- next,
65
- };
66
- } catch (err) {
67
- throw applyTransform(err, [
68
- notify,
69
- ]);
70
- }
71
- };
72
-
73
- const getCloseReasonGroups = async ({ itemId: id }) => {
74
- const itemResponseHandler = (item) => {
75
- return item.closeReasonGroup;
76
- };
77
-
78
- try {
79
- const response = await closeReasonGroupsService.locateCloseReasonGroup(
80
- id,
81
- fieldsToSend,
82
- );
83
- return applyTransform(response.data, [
84
- snakeToCamel(),
85
- itemResponseHandler,
86
- ]);
87
- } catch (err) {
88
- throw applyTransform(err, [
89
- notify,
90
- ]);
91
- }
92
- };
93
-
94
- const addCloseReasonGroups = async ({ itemInstance }) => {
95
- const item = applyTransform(itemInstance, [
96
- camelToSnake(),
97
- sanitize(fieldsToSend),
98
- ]);
99
- try {
100
- const response =
101
- await closeReasonGroupsService.createCloseReasonGroup(item);
102
- return applyTransform(response.data, [
103
- snakeToCamel(),
104
- ]);
105
- } catch (err) {
106
- throw applyTransform(err, [
107
- notify,
108
- ]);
109
- }
110
- };
111
-
112
- const updateCloseReasonGroups = async ({ itemInstance, itemId: id }) => {
113
- const item = applyTransform(itemInstance, [
114
- camelToSnake(),
115
- sanitize(fieldsToSend),
116
- ]);
117
- try {
118
- const response = await closeReasonGroupsService.updateCloseReasonGroup(
119
- id,
120
- item,
121
- );
122
- return applyTransform(response.data, [
123
- snakeToCamel(),
124
- ]);
125
- } catch (err) {
126
- throw applyTransform(err, [
127
- notify,
128
- ]);
129
- }
130
- };
131
-
132
- const deleteCloseReasonGroups = async ({ id }) => {
133
- try {
134
- const response = await closeReasonGroupsService.deleteCloseReasonGroup(id);
135
- return applyTransform(response.data, []);
136
- } catch (err) {
137
- throw applyTransform(err, [
138
- notify,
139
- ]);
140
- }
141
- };
142
-
143
- const getCloseReasonGroupsLookup = async (params) =>
144
- getCloseReasonGroupsList({
145
- ...params,
146
- fields: params.fields || [
147
- 'id',
148
- 'name',
149
- ],
150
- });
151
-
152
- const CaseCloseReasonGroupsAPI = {
153
- getList: getCloseReasonGroupsList,
154
- get: getCloseReasonGroups,
155
- add: addCloseReasonGroups,
156
- update: updateCloseReasonGroups,
157
- delete: deleteCloseReasonGroups,
158
- getLookup: getCloseReasonGroupsLookup,
159
- };
160
-
161
- export default CaseCloseReasonGroupsAPI;
@@ -1,165 +0,0 @@
1
- import { CloseReasonsApiFactory } 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
- } from '../../transformers/index.js';
16
-
17
- const instance = getDefaultInstance();
18
- const configuration = getDefaultOpenAPIConfig();
19
-
20
- const closeReasonsService = new CloseReasonsApiFactory(
21
- configuration,
22
- '',
23
- instance,
24
- );
25
-
26
- const fieldsToSend = [
27
- 'name',
28
- 'description',
29
- ];
30
-
31
- const getCloseReasonsList = async ({ parentId, ...rest }) => {
32
- const fieldsToSend = [
33
- 'page',
34
- 'size',
35
- 'q',
36
- 'sort',
37
- 'fields',
38
- 'id',
39
- ];
40
-
41
- const { page, size, fields, sort, id, q } = applyTransform(rest, [
42
- merge(getDefaultGetParams()),
43
- (params) => ({
44
- ...params,
45
- q: params.search,
46
- }),
47
- sanitize(fieldsToSend),
48
- camelToSnake(),
49
- ]);
50
- try {
51
- const response = await closeReasonsService.listCloseReasons(
52
- parentId,
53
- page,
54
- size,
55
- fields,
56
- sort,
57
- id,
58
- q,
59
- );
60
- const { items, next } = applyTransform(response.data, [
61
- merge(getDefaultGetListResponse()),
62
- ]);
63
- return {
64
- items: applyTransform(items, [
65
- snakeToCamel(),
66
- ]),
67
- next,
68
- };
69
- } catch (err) {
70
- throw applyTransform(err, [
71
- notify,
72
- ]);
73
- }
74
- };
75
-
76
- const getCloseReason = async ({ parentId, itemId: id }) => {
77
- const itemResponseHandler = (item) => {
78
- return item.closeReason;
79
- };
80
-
81
- try {
82
- const response = await closeReasonsService.locateCloseReason(parentId, id);
83
- return applyTransform(response.data, [
84
- snakeToCamel(),
85
- itemResponseHandler,
86
- ]);
87
- } catch (err) {
88
- throw applyTransform(err, [
89
- notify,
90
- ]);
91
- }
92
- };
93
-
94
- const addCloseReason = async ({ itemInstance, parentId }) => {
95
- const item = applyTransform(itemInstance, [
96
- camelToSnake(),
97
- sanitize(fieldsToSend),
98
- ]);
99
-
100
- try {
101
- const response = await closeReasonsService.createCloseReason(
102
- parentId,
103
- item,
104
- );
105
- return applyTransform(response.data, [
106
- snakeToCamel(),
107
- ]);
108
- } catch (err) {
109
- throw applyTransform(err, [
110
- notify,
111
- ]);
112
- }
113
- };
114
-
115
- const updateCloseReason = async ({ itemInstance, itemId: id }) => {
116
- const item = applyTransform(itemInstance, [
117
- camelToSnake(),
118
- ]);
119
-
120
- try {
121
- const response = await closeReasonsService.updateCloseReason(
122
- itemInstance.id,
123
- id,
124
- item,
125
- );
126
- return applyTransform(response.data, [
127
- snakeToCamel(),
128
- ]);
129
- } catch (err) {
130
- throw applyTransform(err, [
131
- notify,
132
- ]);
133
- }
134
- };
135
-
136
- const deleteCloseReason = async ({ id, parentId }) => {
137
- try {
138
- const response = await closeReasonsService.deleteCloseReason(parentId, id);
139
- return applyTransform(response.data, []);
140
- } catch (err) {
141
- throw applyTransform(err, [
142
- notify,
143
- ]);
144
- }
145
- };
146
-
147
- const getCloseReasonLookup = async (params) =>
148
- getCloseReasonsList({
149
- ...params,
150
- fields: params.fields || [
151
- 'id',
152
- 'name',
153
- ],
154
- });
155
-
156
- const CaseCloseReasonsAPI = {
157
- getList: getCloseReasonsList,
158
- getLookup: getCloseReasonLookup,
159
- get: getCloseReason,
160
- add: addCloseReason,
161
- update: updateCloseReason,
162
- delete: deleteCloseReason,
163
- };
164
-
165
- export default CaseCloseReasonsAPI;
@@ -1,166 +0,0 @@
1
- import { PrioritiesApiFactory } 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
- } from '../../transformers/index.js';
16
-
17
- const instance = getDefaultInstance();
18
- const configuration = getDefaultOpenAPIConfig();
19
-
20
- const priorityService = new PrioritiesApiFactory(configuration, '', instance);
21
-
22
- const fieldsToSend = [
23
- 'name',
24
- 'description',
25
- 'color',
26
- ];
27
-
28
- const getPrioritiesList = async (params) => {
29
- const fieldsToSend = [
30
- 'page',
31
- 'size',
32
- 'q',
33
- 'sort',
34
- 'fields',
35
- 'id',
36
- 'notInSla',
37
- 'inSla',
38
- 'inSlaCond',
39
- ];
40
- const {
41
- page,
42
- size,
43
- fields,
44
- sort,
45
- id,
46
- q,
47
- not_in_sla: notInSla,
48
- in_sla_cond: inSlaCond,
49
- } = applyTransform(params, [
50
- merge(getDefaultGetParams()),
51
- (params) => ({
52
- ...params,
53
- q: params.search,
54
- }),
55
- sanitize(fieldsToSend),
56
- camelToSnake(),
57
- ]);
58
- try {
59
- const response = await priorityService.listPriorities(
60
- page,
61
- size,
62
- fields,
63
- sort,
64
- id,
65
- q,
66
- notInSla,
67
- inSlaCond,
68
- );
69
- const { items, next } = applyTransform(response.data, [
70
- merge(getDefaultGetListResponse()),
71
- ]);
72
- return {
73
- items: applyTransform(items, []),
74
- next,
75
- };
76
- } catch (err) {
77
- throw applyTransform(err, [
78
- notify,
79
- ]);
80
- }
81
- };
82
-
83
- const getPriority = async ({ itemId: id }) => {
84
- const itemResponseHandler = (item) => {
85
- return item.priority;
86
- };
87
-
88
- try {
89
- const response = await priorityService.locatePriority(id, fieldsToSend);
90
- return applyTransform(response.data, [
91
- snakeToCamel(),
92
- itemResponseHandler,
93
- ]);
94
- } catch (err) {
95
- throw applyTransform(err, [
96
- notify,
97
- ]);
98
- }
99
- };
100
-
101
- const addPriority = async ({ itemInstance }) => {
102
- const item = applyTransform(itemInstance, [
103
- camelToSnake(),
104
- sanitize(fieldsToSend),
105
- ]);
106
-
107
- try {
108
- const response = await priorityService.createPriority(item);
109
- return applyTransform(response.data, [
110
- snakeToCamel(),
111
- ]);
112
- } catch (err) {
113
- throw applyTransform(err, [
114
- notify,
115
- ]);
116
- }
117
- };
118
-
119
- const updatePriority = async ({ itemInstance, itemId: id }) => {
120
- const item = applyTransform(itemInstance, [
121
- camelToSnake(),
122
- sanitize(fieldsToSend),
123
- ]);
124
-
125
- try {
126
- const response = await priorityService.updatePriority(id, item);
127
- return applyTransform(response.data, [
128
- snakeToCamel(),
129
- ]);
130
- } catch (err) {
131
- throw applyTransform(err, [
132
- notify,
133
- ]);
134
- }
135
- };
136
-
137
- const deletePriority = async ({ id }) => {
138
- try {
139
- const response = await priorityService.deletePriority(id);
140
- return applyTransform(response.data, []);
141
- } catch (err) {
142
- throw applyTransform(err, [
143
- notify,
144
- ]);
145
- }
146
- };
147
-
148
- const getConditionsLookup = (params) =>
149
- getPrioritiesList({
150
- ...params,
151
- fields: params.fields || [
152
- 'id',
153
- 'name',
154
- ],
155
- });
156
-
157
- const CasePrioritiesAPI = {
158
- getList: getPrioritiesList,
159
- get: getPriority,
160
- update: updatePriority,
161
- getLookup: getConditionsLookup,
162
- delete: deletePriority,
163
- add: addPriority,
164
- };
165
-
166
- export default CasePrioritiesAPI;