Restructure omni services and add Chatwoot research snapshot

This commit is contained in:
Ruslan Bakiev
2026-02-21 11:11:27 +07:00
parent edea7a0034
commit b73babbbf6
7732 changed files with 978203 additions and 32 deletions

View File

@@ -0,0 +1,59 @@
import {
SET_CONVERSATION_ATTRIBUTES,
UPDATE_CONVERSATION_ATTRIBUTES,
CLEAR_CONVERSATION_ATTRIBUTES,
} from '../types';
import { getConversationAPI } from '../../api/conversation';
const state = {
id: '',
status: '',
};
export const getters = {
getConversationParams: $state => $state,
};
export const actions = {
getAttributes: async ({ commit }) => {
try {
const { data } = await getConversationAPI();
const { contact_last_seen_at: lastSeen } = data;
commit(SET_CONVERSATION_ATTRIBUTES, data);
commit('conversation/setMetaUserLastSeenAt', lastSeen, { root: true });
} catch (error) {
// Ignore error
}
},
update({ commit }, data) {
commit(UPDATE_CONVERSATION_ATTRIBUTES, data);
},
clearConversationAttributes: ({ commit }) => {
commit('CLEAR_CONVERSATION_ATTRIBUTES');
},
};
export const mutations = {
[SET_CONVERSATION_ATTRIBUTES]($state, data) {
$state.id = data.id;
$state.status = data.status;
},
[UPDATE_CONVERSATION_ATTRIBUTES]($state, data) {
if (data.id === $state.id) {
$state.id = data.id;
$state.status = data.status;
}
},
[CLEAR_CONVERSATION_ATTRIBUTES]($state) {
$state.id = '';
$state.status = '';
},
};
export default {
namespaced: true,
state,
getters,
actions,
mutations,
};