Initial commit: Add logistics and order_detail message types
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled

- Add Logistics component with progress tracking
- Add OrderDetail component for order information
- Support data-driven steps and actions
- Add blue color scale to widget SCSS
- Fix node overflow and progress bar rendering issues
- Add English translations for dashboard components

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Liang XJ
2026-01-26 11:16:56 +08:00
commit 092fb2e083
7646 changed files with 975643 additions and 0 deletions

View File

@@ -0,0 +1,210 @@
import { actions } from '../../conversationSearch';
import types from '../../../mutation-types';
import axios from 'axios';
const commit = vi.fn();
const dispatch = vi.fn();
global.axios = axios;
vi.mock('axios');
describe('#actions', () => {
beforeEach(() => {
commit.mockClear();
dispatch.mockClear();
axios.get.mockClear();
});
describe('#get', () => {
it('sends correct actions if no query param is provided', () => {
actions.get({ commit }, { q: '' });
expect(commit.mock.calls).toEqual([[types.SEARCH_CONVERSATIONS_SET, []]]);
});
it('sends correct actions if query param is provided and API call is success', async () => {
axios.get.mockResolvedValue({
data: {
payload: [{ messages: [{ id: 1, content: 'value testing' }], id: 1 }],
},
});
await actions.get({ commit }, { q: 'value' });
expect(commit.mock.calls).toEqual([
[types.SEARCH_CONVERSATIONS_SET, []],
[types.SEARCH_CONVERSATIONS_SET_UI_FLAG, { isFetching: true }],
[
types.SEARCH_CONVERSATIONS_SET,
[{ messages: [{ id: 1, content: 'value testing' }], id: 1 }],
],
[types.SEARCH_CONVERSATIONS_SET_UI_FLAG, { isFetching: false }],
]);
});
it('sends correct actions if query param is provided and API call is errored', async () => {
axios.get.mockRejectedValue({});
await actions.get({ commit }, { q: 'value' });
expect(commit.mock.calls).toEqual([
[types.SEARCH_CONVERSATIONS_SET, []],
[types.SEARCH_CONVERSATIONS_SET_UI_FLAG, { isFetching: true }],
[types.SEARCH_CONVERSATIONS_SET_UI_FLAG, { isFetching: false }],
]);
});
});
describe('#fullSearch', () => {
it('should not dispatch any actions if no query provided', async () => {
await actions.fullSearch({ commit, dispatch }, { q: '' });
expect(dispatch).not.toHaveBeenCalled();
});
it('should dispatch all search actions and set UI flags correctly', async () => {
await actions.fullSearch({ commit, dispatch }, { q: 'test' });
expect(commit.mock.calls).toEqual([
[
types.FULL_SEARCH_SET_UI_FLAG,
{ isFetching: true, isSearchCompleted: false },
],
[
types.FULL_SEARCH_SET_UI_FLAG,
{ isFetching: false, isSearchCompleted: true },
],
]);
expect(dispatch).toHaveBeenCalledWith('contactSearch', { q: 'test' });
expect(dispatch).toHaveBeenCalledWith('conversationSearch', {
q: 'test',
});
expect(dispatch).toHaveBeenCalledWith('messageSearch', { q: 'test' });
expect(dispatch).toHaveBeenCalledWith('articleSearch', { q: 'test' });
});
it('should pass filters to all search actions including articleSearch', async () => {
const payload = { q: 'test', since: 1700000000, until: 1732000000 };
await actions.fullSearch({ commit, dispatch }, payload);
expect(dispatch).toHaveBeenCalledWith('contactSearch', payload);
expect(dispatch).toHaveBeenCalledWith('conversationSearch', payload);
expect(dispatch).toHaveBeenCalledWith('messageSearch', payload);
expect(dispatch).toHaveBeenCalledWith('articleSearch', payload);
});
});
describe('#contactSearch', () => {
it('should handle successful contact search', async () => {
axios.get.mockResolvedValue({
data: { payload: { contacts: [{ id: 1 }] } },
});
await actions.contactSearch({ commit }, { q: 'test', page: 1 });
expect(commit.mock.calls).toEqual([
[types.CONTACT_SEARCH_SET_UI_FLAG, { isFetching: true }],
[types.CONTACT_SEARCH_SET, [{ id: 1 }]],
[types.CONTACT_SEARCH_SET_UI_FLAG, { isFetching: false }],
]);
});
it('should handle failed contact search', async () => {
axios.get.mockRejectedValue({});
await actions.contactSearch({ commit }, { q: 'test' });
expect(commit.mock.calls).toEqual([
[types.CONTACT_SEARCH_SET_UI_FLAG, { isFetching: true }],
[types.CONTACT_SEARCH_SET_UI_FLAG, { isFetching: false }],
]);
});
});
describe('#conversationSearch', () => {
it('should handle successful conversation search', async () => {
axios.get.mockResolvedValue({
data: { payload: { conversations: [{ id: 1 }] } },
});
await actions.conversationSearch({ commit }, { q: 'test', page: 1 });
expect(commit.mock.calls).toEqual([
[types.CONVERSATION_SEARCH_SET_UI_FLAG, { isFetching: true }],
[types.CONVERSATION_SEARCH_SET, [{ id: 1 }]],
[types.CONVERSATION_SEARCH_SET_UI_FLAG, { isFetching: false }],
]);
});
it('should handle failed conversation search', async () => {
axios.get.mockRejectedValue({});
await actions.conversationSearch({ commit }, { q: 'test' });
expect(commit.mock.calls).toEqual([
[types.CONVERSATION_SEARCH_SET_UI_FLAG, { isFetching: true }],
[types.CONVERSATION_SEARCH_SET_UI_FLAG, { isFetching: false }],
]);
});
});
describe('#messageSearch', () => {
it('should handle successful message search', async () => {
axios.get.mockResolvedValue({
data: { payload: { messages: [{ id: 1 }] } },
});
await actions.messageSearch({ commit }, { q: 'test', page: 1 });
expect(commit.mock.calls).toEqual([
[types.MESSAGE_SEARCH_SET_UI_FLAG, { isFetching: true }],
[types.MESSAGE_SEARCH_SET, [{ id: 1 }]],
[types.MESSAGE_SEARCH_SET_UI_FLAG, { isFetching: false }],
]);
});
it('should handle failed message search', async () => {
axios.get.mockRejectedValue({});
await actions.messageSearch({ commit }, { q: 'test' });
expect(commit.mock.calls).toEqual([
[types.MESSAGE_SEARCH_SET_UI_FLAG, { isFetching: true }],
[types.MESSAGE_SEARCH_SET_UI_FLAG, { isFetching: false }],
]);
});
});
describe('#articleSearch', () => {
it('should handle successful article search', async () => {
axios.get.mockResolvedValue({
data: { payload: { articles: [{ id: 1 }] } },
});
await actions.articleSearch({ commit }, { q: 'test', page: 1 });
expect(commit.mock.calls).toEqual([
[types.ARTICLE_SEARCH_SET_UI_FLAG, { isFetching: true }],
[types.ARTICLE_SEARCH_SET, [{ id: 1 }]],
[types.ARTICLE_SEARCH_SET_UI_FLAG, { isFetching: false }],
]);
});
it('should handle article search with date filters', async () => {
axios.get.mockResolvedValue({
data: { payload: { articles: [{ id: 1 }] } },
});
await actions.articleSearch(
{ commit },
{ q: 'test', page: 1, since: 1700000000, until: 1732000000 }
);
expect(commit.mock.calls).toEqual([
[types.ARTICLE_SEARCH_SET_UI_FLAG, { isFetching: true }],
[types.ARTICLE_SEARCH_SET, [{ id: 1 }]],
[types.ARTICLE_SEARCH_SET_UI_FLAG, { isFetching: false }],
]);
});
it('should handle failed article search', async () => {
axios.get.mockRejectedValue({});
await actions.articleSearch({ commit }, { q: 'test' });
expect(commit.mock.calls).toEqual([
[types.ARTICLE_SEARCH_SET_UI_FLAG, { isFetching: true }],
[types.ARTICLE_SEARCH_SET_UI_FLAG, { isFetching: false }],
]);
});
});
describe('#clearSearchResults', () => {
it('should commit clear search results mutation', () => {
actions.clearSearchResults({ commit });
expect(commit).toHaveBeenCalledWith(types.CLEAR_SEARCH_RESULTS);
});
});
});

View File

@@ -0,0 +1,69 @@
import { getters } from '../../conversationSearch';
describe('#getters', () => {
it('getConversations', () => {
const state = {
records: [{ id: 1, messages: [{ id: 1, content: 'value' }] }],
};
expect(getters.getConversations(state)).toEqual([
{ id: 1, messages: [{ id: 1, content: 'value' }] },
]);
});
it('getContactRecords', () => {
const state = {
contactRecords: [{ id: 1, name: 'Contact 1' }],
};
expect(getters.getContactRecords(state)).toEqual([
{ id: 1, name: 'Contact 1' },
]);
});
it('getConversationRecords', () => {
const state = {
conversationRecords: [{ id: 1, title: 'Conversation 1' }],
};
expect(getters.getConversationRecords(state)).toEqual([
{ id: 1, title: 'Conversation 1' },
]);
});
it('getMessageRecords', () => {
const state = {
messageRecords: [{ id: 1, content: 'Message 1' }],
};
expect(getters.getMessageRecords(state)).toEqual([
{ id: 1, content: 'Message 1' },
]);
});
it('getArticleRecords', () => {
const state = {
articleRecords: [{ id: 1, title: 'Article 1' }],
};
expect(getters.getArticleRecords(state)).toEqual([
{ id: 1, title: 'Article 1' },
]);
});
it('getUIFlags', () => {
const state = {
uiFlags: {
isFetching: false,
isSearchCompleted: true,
contact: { isFetching: true },
message: { isFetching: false },
conversation: { isFetching: false },
article: { isFetching: false },
},
};
expect(getters.getUIFlags(state)).toEqual({
isFetching: false,
isSearchCompleted: true,
contact: { isFetching: true },
message: { isFetching: false },
conversation: { isFetching: false },
article: { isFetching: false },
});
});
});

View File

@@ -0,0 +1,139 @@
import types from '../../../mutation-types';
import { mutations } from '../../conversationSearch';
describe('#mutations', () => {
describe('#SEARCH_CONVERSATIONS_SET', () => {
it('set records correctly', () => {
const state = { records: [] };
mutations[types.SEARCH_CONVERSATIONS_SET](state, [{ id: 1 }]);
expect(state.records).toEqual([{ id: 1 }]);
});
});
describe('#SEARCH_CONVERSATIONS_SET_UI_FLAG', () => {
it('set uiFlags correctly', () => {
const state = { uiFlags: { isFetching: true } };
mutations[types.SEARCH_CONVERSATIONS_SET_UI_FLAG](state, {
isFetching: false,
});
expect(state.uiFlags).toEqual({ isFetching: false });
});
});
describe('#CONTACT_SEARCH_SET', () => {
it('should append new contact records to existing ones', () => {
const state = { contactRecords: [{ id: 1 }] };
mutations[types.CONTACT_SEARCH_SET](state, [{ id: 2 }]);
expect(state.contactRecords).toEqual([{ id: 1 }, { id: 2 }]);
});
});
describe('#CONVERSATION_SEARCH_SET', () => {
it('should append new conversation records to existing ones', () => {
const state = { conversationRecords: [{ id: 1 }] };
mutations[types.CONVERSATION_SEARCH_SET](state, [{ id: 2 }]);
expect(state.conversationRecords).toEqual([{ id: 1 }, { id: 2 }]);
});
});
describe('#MESSAGE_SEARCH_SET', () => {
it('should append new message records to existing ones', () => {
const state = { messageRecords: [{ id: 1 }] };
mutations[types.MESSAGE_SEARCH_SET](state, [{ id: 2 }]);
expect(state.messageRecords).toEqual([{ id: 1 }, { id: 2 }]);
});
});
describe('#FULL_SEARCH_SET_UI_FLAG', () => {
it('set full search UI flags correctly', () => {
const state = {
uiFlags: {
isFetching: true,
isSearchCompleted: false,
},
};
mutations[types.FULL_SEARCH_SET_UI_FLAG](state, {
isFetching: false,
isSearchCompleted: true,
});
expect(state.uiFlags).toEqual({
isFetching: false,
isSearchCompleted: true,
});
});
});
describe('#CONTACT_SEARCH_SET_UI_FLAG', () => {
it('set contact search UI flags correctly', () => {
const state = {
uiFlags: {
contact: { isFetching: true },
},
};
mutations[types.CONTACT_SEARCH_SET_UI_FLAG](state, { isFetching: false });
expect(state.uiFlags.contact).toEqual({ isFetching: false });
});
});
describe('#CONVERSATION_SEARCH_SET_UI_FLAG', () => {
it('set conversation search UI flags correctly', () => {
const state = {
uiFlags: {
conversation: { isFetching: true },
},
};
mutations[types.CONVERSATION_SEARCH_SET_UI_FLAG](state, {
isFetching: false,
});
expect(state.uiFlags.conversation).toEqual({ isFetching: false });
});
});
describe('#MESSAGE_SEARCH_SET_UI_FLAG', () => {
it('set message search UI flags correctly', () => {
const state = {
uiFlags: {
message: { isFetching: true },
},
};
mutations[types.MESSAGE_SEARCH_SET_UI_FLAG](state, { isFetching: false });
expect(state.uiFlags.message).toEqual({ isFetching: false });
});
});
describe('#ARTICLE_SEARCH_SET', () => {
it('should append new article records to existing ones', () => {
const state = { articleRecords: [{ id: 1 }] };
mutations[types.ARTICLE_SEARCH_SET](state, [{ id: 2 }]);
expect(state.articleRecords).toEqual([{ id: 1 }, { id: 2 }]);
});
});
describe('#ARTICLE_SEARCH_SET_UI_FLAG', () => {
it('set article search UI flags correctly', () => {
const state = {
uiFlags: {
article: { isFetching: true },
},
};
mutations[types.ARTICLE_SEARCH_SET_UI_FLAG](state, { isFetching: false });
expect(state.uiFlags.article).toEqual({ isFetching: false });
});
});
describe('#CLEAR_SEARCH_RESULTS', () => {
it('should clear all search records', () => {
const state = {
contactRecords: [{ id: 1 }],
conversationRecords: [{ id: 1 }],
messageRecords: [{ id: 1 }],
articleRecords: [{ id: 1 }],
};
mutations[types.CLEAR_SEARCH_RESULTS](state);
expect(state.contactRecords).toEqual([]);
expect(state.conversationRecords).toEqual([]);
expect(state.messageRecords).toEqual([]);
expect(state.articleRecords).toEqual([]);
});
});
});