diff --git a/package-lock.json b/package-lock.json index c0e03dfb..55fbb0a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@vuelidate/core": "^2.0.3", "@vuelidate/validators": "^2.0.4", "@vueuse/core": "^10.10.0", - "@webitel/ui-sdk": "^24.8.22", + "@webitel/ui-sdk": "^24.8.31", "axios": "^1.7.2", "deep-equal": "^2.2.1", "dompurify": "^3.1.2", @@ -2064,9 +2064,9 @@ } }, "node_modules/@webitel/ui-sdk": { - "version": "24.8.22", - "resolved": "https://registry.npmjs.org/@webitel/ui-sdk/-/ui-sdk-24.8.22.tgz", - "integrity": "sha512-SD6YoIJu8uWRR8a0nUYxbN8v7Iepq94unzM8tzku3h/tW4Kfhxle+l1VPjBCcQie5skJZyuN+0eqUmh555YD9A==", + "version": "24.8.31", + "resolved": "https://registry.npmjs.org/@webitel/ui-sdk/-/ui-sdk-24.8.31.tgz", + "integrity": "sha512-8g/EALIm0+Pp4LlJBaGSL6bAh51Oba4bpRD4tCpmWeoPMaXvD/nk+ZkTffC9SGGOmWs7scykjWScQ2kDHP/oqQ==", "dependencies": { "@floating-ui/vue": "^1.0.1", "@morev/vue-transitions": "^3.0.2", @@ -2094,7 +2094,7 @@ "vue-multiselect": "^3.0.0-beta.3", "vue-observe-visibility": "^2.0.0-alpha.1", "vue-router": "^4.1.6", - "webitel-sdk": "^24.2.16", + "webitel-sdk": "^24.8.1", "xlsx": "^0.18.5" } }, @@ -9822,9 +9822,9 @@ } }, "node_modules/webitel-sdk": { - "version": "24.4.16", - "resolved": "https://registry.npmjs.org/webitel-sdk/-/webitel-sdk-24.4.16.tgz", - "integrity": "sha512-evkakLCmVaRa+AwJ5OvXq27En19vRh5t7ibahtyXDUDGQk2IfHzZ4El/4AVm/RFTow5Una6aGhyhL7Ln4CgDZw==", + "version": "24.8.1", + "resolved": "https://registry.npmjs.org/webitel-sdk/-/webitel-sdk-24.8.1.tgz", + "integrity": "sha512-abdjKyIX7OgykvRJwAAJiIZAyvCExGa9aA9obtXbSfQtMvrF9mTXVQFYv5STYWLQGgpU04Q8BSLp2nj+GSFOZQ==", "dependencies": { "@types/webrtc": "~0.0.41", "deep-copy": "1.4.2", diff --git a/package.json b/package.json index 8bf6bf3a..2bc6ab1b 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "@vuelidate/core": "^2.0.3", "@vuelidate/validators": "^2.0.4", "@vueuse/core": "^10.10.0", - "@webitel/ui-sdk": "^24.8.22", + "@webitel/ui-sdk": "^24.8.31", "axios": "^1.7.2", "deep-equal": "^2.2.1", "dompurify": "^3.1.2", diff --git a/src/modules/contacts/modules/timeline/modules/chats/api/MessageHistoryAPI.js b/src/modules/contacts/modules/timeline/modules/chats/api/MessageHistoryAPI.js deleted file mode 100644 index 7be20af9..00000000 --- a/src/modules/contacts/modules/timeline/modules/chats/api/MessageHistoryAPI.js +++ /dev/null @@ -1,43 +0,0 @@ -import applyTransform, { - notify, - snakeToCamel, - camelToSnake, - generateUrl, -} from '@webitel/ui-sdk/src/api/transformers/index.js'; - -import instance from '../../../../../../../app/api/instance'; - -const getList = async (params) => { - const mergeMessageData = ({ peers, messages }) => { - return messages.map(({ from, ...message }) => { - return { - ...message, - peer: peers[from.id - 1], - }; - }); - }; - const url = applyTransform(params, [ - camelToSnake(), - generateUrl(`contacts/${params.parentId}/chat/${params.taskId}/messages`), - ]); - - try { - const response = await instance.get(url); - const { peers, messages } = applyTransform(response.data, [ - snakeToCamel(), - ]); - return { - items: applyTransform({ peers, messages }, [ - mergeMessageData, - ]).reverse(), - }; - } catch (err) { - throw applyTransform(err, [ - notify, - ]); - } -}; - -export default { - getList, -}; diff --git a/src/modules/contacts/modules/timeline/modules/chats/store/chats.js b/src/modules/contacts/modules/timeline/modules/chats/store/chats.js index f387cc23..fbe9160a 100644 --- a/src/modules/contacts/modules/timeline/modules/chats/store/chats.js +++ b/src/modules/contacts/modules/timeline/modules/chats/store/chats.js @@ -1,12 +1,12 @@ import TimelineTaskPointsModule from '../../../store/TimelineTaskPointsModule.js'; -import MessageHistoryAPI from '../api/MessageHistoryAPI.js'; +import MessageHistoryAPI from '@webitel/ui-sdk/src/api/crm/contactChatMessagesHistory.js'; const chats = new TimelineTaskPointsModule({ apiModule: { getList: ({ taskId, parentId }) => MessageHistoryAPI.getList({ - taskId, - parentId, + contactId: parentId, + chatId: taskId, }), }, }) diff --git a/src/modules/contacts/modules/timeline/store/TimelineTaskPointsModule.js b/src/modules/contacts/modules/timeline/store/TimelineTaskPointsModule.js index 9e6adba3..61fd9314 100644 --- a/src/modules/contacts/modules/timeline/store/TimelineTaskPointsModule.js +++ b/src/modules/contacts/modules/timeline/store/TimelineTaskPointsModule.js @@ -1,6 +1,5 @@ import BaseStoreModule from '@webitel/ui-sdk/src/store/BaseStoreModules/BaseStoreModule'; -import MessageHistoryAPI from '../modules/chats/api/MessageHistoryAPI.js'; export default class TimelineTaskPointsModule extends BaseStoreModule { apiModule = null;