Copy the Chatwoot (v4.14.0) frontend runnable subset into frontend/ for customization: - app/javascript/ (Vue SPA: dashboard, widget, sdk, portal, superadmin) - app/views/ (ERB templates for vite-plugin-ruby entrypoint resolution) - app/helpers/, app/assets/ (Rails view helpers, static assets) - enterprise/ (Enterprise edition frontend overlay) - config/vite.json, vite.config.ts, bin/vite (Vite-Rails toolchain) - package.json, pnpm-lock.yaml, tailwind/postcss/eslint configs - Gemfile, Gemfile.lock (vite_rails gem for bin/vite binstub) Excluded Rails backend: controllers, models, services, jobs, mailers, policies, db, lib, spec, public, node_modules. Update references to the new frontend location: - .gitignore: exclude frontend build artifacts (node_modules, tmp, packs), keep frontend/bin/ and frontend/vendor/ via negation - backend/scripts/parity_frontend_smoke.sh: CHATWOOT_DIR default reference/chatwoot -> ../frontend - backend/scripts/parity_frontend_browser_smoke.mjs: same default update - AGENTS.md: add frontend section with Rails/Vite coupling notes - README: architecture tree includes frontend/
60 lines
1.3 KiB
JavaScript
60 lines
1.3 KiB
JavaScript
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,
|
|
};
|