@webitel/ui-sdk 24.10.54 → 24.10.56

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.54",
3
+ "version": "24.10.56",
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,
@@ -12,4 +12,7 @@ export const tableActionsOrder = [
12
12
  ];
13
13
 
14
14
  // TODO
15
- export const cardActionsOrder = tableActionsOrder;
15
+ export const cardActionsOrder = [
16
+ ...tableActionsOrder,
17
+ IconAction.EDIT,
18
+ ]
@@ -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
  };
@@ -408,5 +408,6 @@ export default {
408
408
  },
409
409
  errorNotifications: {
410
410
  chatHistoryApi: 'Произошла ошибка загрузки истории чата',
411
+ markChatProcessed: 'Не удалось переместить чат в “Закрытые”'
411
412
  },
412
413
  };
@@ -408,5 +408,6 @@ export default {
408
408
  },
409
409
  errorNotifications: {
410
410
  chatHistoryApi: 'Сталася помилка завантаження історії чату',
411
+ markChatProcessed: 'Не вдалося перемістити чат у “Закриті”'
411
412
  },
412
413
  };