Vendor Chatwoot Vue 3 frontend into frontend/
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/
This commit is contained in:
+95
@@ -0,0 +1,95 @@
|
||||
import endPoints from 'widget/api/endPoints';
|
||||
import { API } from 'widget/helpers/axios';
|
||||
|
||||
const createConversationAPI = async content => {
|
||||
const urlData = endPoints.createConversation(content);
|
||||
return API.post(urlData.url, urlData.params);
|
||||
};
|
||||
|
||||
const sendMessageAPI = async (
|
||||
content,
|
||||
replyTo = null,
|
||||
{ customAttributes, labels } = {}
|
||||
) => {
|
||||
const urlData = endPoints.sendMessage(content, replyTo, {
|
||||
customAttributes,
|
||||
labels,
|
||||
});
|
||||
return API.post(urlData.url, urlData.params);
|
||||
};
|
||||
|
||||
const sendAttachmentAPI = async (
|
||||
attachment,
|
||||
{ customAttributes, labels } = {}
|
||||
) => {
|
||||
const urlData = endPoints.sendAttachment(attachment, {
|
||||
customAttributes,
|
||||
labels,
|
||||
});
|
||||
return API.post(urlData.url, urlData.params);
|
||||
};
|
||||
|
||||
const getMessagesAPI = async ({ before, after }) => {
|
||||
const urlData = endPoints.getConversation({ before, after });
|
||||
return API.get(urlData.url, { params: urlData.params });
|
||||
};
|
||||
|
||||
const getConversationAPI = async () => {
|
||||
return API.get(`/api/v1/widget/conversations${window.location.search}`);
|
||||
};
|
||||
|
||||
const toggleTyping = async ({ typingStatus }) => {
|
||||
return API.post(
|
||||
`/api/v1/widget/conversations/toggle_typing${window.location.search}`,
|
||||
{ typing_status: typingStatus }
|
||||
);
|
||||
};
|
||||
|
||||
const setUserLastSeenAt = async ({ lastSeen }) => {
|
||||
return API.post(
|
||||
`/api/v1/widget/conversations/update_last_seen${window.location.search}`,
|
||||
{ contact_last_seen_at: lastSeen }
|
||||
);
|
||||
};
|
||||
const sendEmailTranscript = async () => {
|
||||
return API.post(
|
||||
`/api/v1/widget/conversations/transcript${window.location.search}`
|
||||
);
|
||||
};
|
||||
const toggleStatus = async () => {
|
||||
return API.get(
|
||||
`/api/v1/widget/conversations/toggle_status${window.location.search}`
|
||||
);
|
||||
};
|
||||
|
||||
const setCustomAttributes = async customAttributes => {
|
||||
return API.post(
|
||||
`/api/v1/widget/conversations/set_custom_attributes${window.location.search}`,
|
||||
{
|
||||
custom_attributes: customAttributes,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const deleteCustomAttribute = async customAttribute => {
|
||||
return API.post(
|
||||
`/api/v1/widget/conversations/destroy_custom_attributes${window.location.search}`,
|
||||
{
|
||||
custom_attribute: [customAttribute],
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export {
|
||||
createConversationAPI,
|
||||
sendMessageAPI,
|
||||
getConversationAPI,
|
||||
getMessagesAPI,
|
||||
sendAttachmentAPI,
|
||||
toggleTyping,
|
||||
setUserLastSeenAt,
|
||||
sendEmailTranscript,
|
||||
toggleStatus,
|
||||
setCustomAttributes,
|
||||
deleteCustomAttribute,
|
||||
};
|
||||
Reference in New Issue
Block a user