@webitel/ui-sdk 24.10.53 → 24.10.55

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": "24.10.53",
3
+ "version": "24.10.55",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -128,7 +128,7 @@
128
128
  "vue-multiselect": "^3.0.0-beta.3",
129
129
  "vue-observe-visibility": "^2.0.0-alpha.1",
130
130
  "vue-router": "^4.1.6",
131
- "webitel-sdk": "^24.8.2",
131
+ "webitel-sdk": "^24.8.5",
132
132
  "xlsx": "^0.18.5"
133
133
  },
134
134
  "devDependencies": {
@@ -7,13 +7,16 @@ import applyTransform, {
7
7
  notify,
8
8
  snakeToCamel,
9
9
  } from '../../transformers/index.js';
10
+ import i18n from '../../../locale/i18n.js';
11
+
12
+ const { t } = i18n.global;
10
13
 
11
14
  const instance = getDefaultInstance();
12
15
  const configuration = getDefaultOpenAPIConfig();
13
16
 
14
17
  const agentChatsService = new AgentChatsServiceApi(configuration, '', instance);
15
18
 
16
- const getList = async (params) => {
19
+ const getChatsList = async (params) => {
17
20
  const { onlyClosed } = params;
18
21
 
19
22
  try {
@@ -34,8 +37,25 @@ const getList = async (params) => {
34
37
  }
35
38
  };
36
39
 
40
+ const markChatProcessed = async (chatId) => { // add to chat unprocessedClose: true
41
+ try {
42
+ const response = await agentChatsService.markChatProcessed(chatId);
43
+ return applyTransform(response.data, [
44
+ snakeToCamel(),
45
+ ]);
46
+ } catch (err) {
47
+ throw applyTransform(err, [
48
+ notify(({ callback }) => callback({
49
+ type: 'error',
50
+ text: t('errorNotifications.markChatProcessed'),
51
+ })),
52
+ ]);
53
+ }
54
+ };
55
+
37
56
  const AgentChatsAPI = {
38
- getList,
57
+ getList: getChatsList,
58
+ markChatProcessed,
39
59
  };
40
60
 
41
61
  export default AgentChatsAPI;
@@ -0,0 +1,44 @@
1
+ import { CatalogApiFactory } from 'webitel-sdk';
2
+ import {
3
+ getDefaultInstance,
4
+ getDefaultOpenAPIConfig,
5
+ } from '../../defaults/index.js';
6
+ import applyTransform, {
7
+ notify,
8
+ snakeToCamel,
9
+ } from '../../transformers/index.js';
10
+
11
+ const instance = getDefaultInstance();
12
+ const configuration = getDefaultOpenAPIConfig();
13
+
14
+ const catalogService = new CatalogApiFactory(configuration, '', instance);
15
+
16
+ const getChatMessagesList = async ({ chatId }) => {
17
+ const mergeMessagesData = ({ messages, peers }) => {
18
+ return messages.map(({ from, ...message }) => {
19
+ return {
20
+ ...message,
21
+ peer: peers[from.id - 1],
22
+ };
23
+ });
24
+ };
25
+
26
+ try {
27
+ const response = await catalogService.getHistory(chatId);
28
+ const { messages, peers } = applyTransform(response.data, [
29
+ snakeToCamel(),
30
+ ]);
31
+ return {
32
+ items: applyTransform({ messages, peers }, [mergeMessagesData]),
33
+ peers,
34
+ };
35
+ } catch (err) {
36
+ throw applyTransform(err, [notify]);
37
+ }
38
+ };
39
+
40
+ const CatalogAPI = {
41
+ getChatMessagesList,
42
+ };
43
+
44
+ export default CatalogAPI;
@@ -2,6 +2,7 @@ import agents from './agents/agents.js';
2
2
  import agentChats from './agents/agentChats.js';
3
3
  import buckets from './buckets/buckets.js';
4
4
  import calendars from './calendars/calendars.js';
5
+ import catalog from './catalog/catalog.js';
5
6
  import chatGateways from './chatGateways/chatGateways.js';
6
7
  import communications from './communications/communications.js';
7
8
  import configurations from './configurations/configurations.js';
@@ -19,6 +20,7 @@ export {
19
20
  agentChats,
20
21
  buckets,
21
22
  calendars,
23
+ catalog,
22
24
  chatGateways,
23
25
  communications,
24
26
  flows,
@@ -2,7 +2,7 @@ const CrmSections = Object.freeze({
2
2
  CONTACTS: 'contacts',
3
3
 
4
4
  // CONFIGURATION - LOOKUPS
5
- SLA: 'sla',
5
+ SLAS: 'slas',
6
6
  SERVICE_CATALOG: 'service-catalog',
7
7
  PRIORITIES: 'priorities',
8
8
  STATUSES: 'statuses',
@@ -220,7 +220,7 @@ export default {
220
220
  name: 'CRM',
221
221
  sections: {
222
222
  [CrmSections.CONTACTS]: 'Contacts',
223
- [CrmSections.SLA]: 'SLA',
223
+ [CrmSections.SLAS]: 'SLAS',
224
224
  },
225
225
  },
226
226
  [WebitelApplications.HISTORY]: { name: 'Call History' },
@@ -411,5 +411,6 @@ export default {
411
411
  },
412
412
  errorNotifications: {
413
413
  chatHistoryApi: 'There was an error loading the chat history',
414
+ markChatProcessed: 'Failed to move the chat to “Closed”',
414
415
  },
415
416
  };
@@ -219,7 +219,7 @@ export default {
219
219
  name: 'CRM',
220
220
  sections: {
221
221
  [CrmSections.CONTACTS]: 'Контакты',
222
- [CrmSections.SLA]: 'SLA',
222
+ [CrmSections.SLAS]: 'SLAS',
223
223
  },
224
224
  },
225
225
  [WebitelApplications.HISTORY]: { name: 'Call History' },
@@ -408,5 +408,6 @@ export default {
408
408
  },
409
409
  errorNotifications: {
410
410
  chatHistoryApi: 'Произошла ошибка загрузки истории чата',
411
+ markChatProcessed: 'Не удалось переместить чат в “Закрытые”'
411
412
  },
412
413
  };
@@ -219,7 +219,7 @@ export default {
219
219
  name: 'CRM',
220
220
  sections: {
221
221
  [CrmSections.CONTACTS]: 'Контакти',
222
- [CrmSections.SLA]: 'SLA',
222
+ [CrmSections.SLAS]: 'SLAS',
223
223
  },
224
224
  },
225
225
  [WebitelApplications.HISTORY]: { name: 'Call History' },
@@ -408,5 +408,6 @@ export default {
408
408
  },
409
409
  errorNotifications: {
410
410
  chatHistoryApi: 'Сталася помилка завантаження історії чату',
411
+ markChatProcessed: 'Не вдалося перемістити чат у “Закриті”'
411
412
  },
412
413
  };
@@ -194,9 +194,9 @@ const applicationsAccess = (value = true) => ({
194
194
  _enabled: value,
195
195
  _locale: `WebitelApplications.${WebitelApplications.CRM}.sections.${CrmSections.CONTACTS}`,
196
196
  },
197
- [CrmSections.SLA]: {
197
+ [CrmSections.SLAS]: {
198
198
  _enabled: value,
199
- _locale: `WebitelApplications.${WebitelApplications.CRM}.sections.${CrmSections.SLA}`,
199
+ _locale: `WebitelApplications.${WebitelApplications.CRM}.sections.${CrmSections.SLAS}`,
200
200
  },
201
201
  },
202
202
  });