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,115 @@
import axios from 'axios';
import { actions } from '../../teams/actions';
import {
SET_TEAM_UI_FLAG,
CLEAR_TEAMS,
SET_TEAMS,
SET_TEAM_ITEM,
EDIT_TEAM,
DELETE_TEAM,
} from '../../teams/types';
import teamsList from './fixtures';
const commit = vi.fn();
global.axios = axios;
vi.mock('axios');
describe('#actions', () => {
describe('#get', () => {
it('sends correct actions if API is success', async () => {
const mockedGet = vi.fn(url => {
if (url === '/api/v1/teams') {
return Promise.resolve({ data: teamsList[1] });
}
if (url === '/api/v1/accounts//cache_keys') {
return Promise.resolve({ data: { cache_keys: { teams: 0 } } });
}
// Return default value or throw an error for unexpected requests
return Promise.reject(new Error('Unexpected request: ' + url));
});
axios.get = mockedGet;
await actions.get({ commit });
expect(commit.mock.calls).toEqual([
[SET_TEAM_UI_FLAG, { isFetching: true }],
[CLEAR_TEAMS],
[SET_TEAMS, teamsList[1]],
[SET_TEAM_UI_FLAG, { isFetching: false }],
]);
});
it('sends correct actions if API is error', async () => {
axios.get.mockRejectedValue({ message: 'Incorrect header' });
await expect(actions.get({ commit })).rejects.toThrow(Error);
expect(commit.mock.calls).toEqual([
[SET_TEAM_UI_FLAG, { isFetching: true }],
[SET_TEAM_UI_FLAG, { isFetching: false }],
]);
});
});
describe('#create', () => {
it('sends correct actions if API is success', async () => {
axios.post.mockResolvedValue({ data: teamsList[1] });
await actions.create({ commit }, teamsList[1]);
expect(commit.mock.calls).toEqual([
[SET_TEAM_UI_FLAG, { isCreating: true }],
[SET_TEAM_ITEM, teamsList[1]],
[SET_TEAM_UI_FLAG, { isCreating: false }],
]);
});
it('sends correct actions if API is error', async () => {
axios.post.mockRejectedValue({ message: 'Incorrect header' });
await expect(actions.create({ commit })).rejects.toThrow(Error);
expect(commit.mock.calls).toEqual([
[SET_TEAM_UI_FLAG, { isCreating: true }],
[SET_TEAM_UI_FLAG, { isCreating: false }],
]);
});
});
describe('#update', () => {
it('sends correct actions if API is success', async () => {
axios.patch.mockResolvedValue({ data: teamsList[1] });
await actions.update({ commit }, teamsList[1]);
expect(commit.mock.calls).toEqual([
[SET_TEAM_UI_FLAG, { isUpdating: true }],
[EDIT_TEAM, teamsList[1]],
[SET_TEAM_UI_FLAG, { isUpdating: false }],
]);
});
it('sends correct actions if API is error', async () => {
axios.patch.mockRejectedValue({ message: 'Incorrect header' });
await expect(actions.update({ commit }, teamsList[1])).rejects.toThrow(
Error
);
expect(commit.mock.calls).toEqual([
[SET_TEAM_UI_FLAG, { isUpdating: true }],
[SET_TEAM_UI_FLAG, { isUpdating: false }],
]);
});
});
describe('#delete', () => {
it('sends correct actions if API is success', async () => {
axios.delete.mockResolvedValue();
await actions.delete({ commit }, 1);
expect(commit.mock.calls).toEqual([
[SET_TEAM_UI_FLAG, { isDeleting: true }],
[DELETE_TEAM, 1],
[SET_TEAM_UI_FLAG, { isDeleting: false }],
]);
});
it('sends correct actions if API is error', async () => {
axios.delete.mockRejectedValue({ message: 'Incorrect header' });
await expect(actions.delete({ commit }, 1)).rejects.toThrow(Error);
expect(commit.mock.calls).toEqual([
[SET_TEAM_UI_FLAG, { isDeleting: true }],
[SET_TEAM_UI_FLAG, { isDeleting: false }],
]);
});
});
});

View File

@@ -0,0 +1,16 @@
export default {
1: {
id: 1,
account_id: 1,
name: 'Test',
description: 'Some team',
is_member: true,
},
2: {
id: 2,
account_id: 1,
name: 'Test 1',
description: 'Some team',
is_member: false,
},
};

View File

@@ -0,0 +1,52 @@
import { getters } from '../../teams/getters';
import teamsList from './fixtures';
describe('#getters', () => {
it('getTeams', () => {
const state = {
records: teamsList,
};
expect(getters.getTeams(state)).toEqual([teamsList[1], teamsList[2]]);
});
it('getMyTeams', () => {
const state = {
records: teamsList,
};
expect(
getters.getMyTeams(state, {
getTeams: [teamsList[1], teamsList[2]],
})
).toEqual([teamsList[1]]);
});
it('getTeam', () => {
const state = {
records: teamsList,
};
expect(getters.getTeam(state)(1)).toEqual({
id: 1,
account_id: 1,
name: 'Test',
description: 'Some team',
is_member: true,
});
});
it('getUIFlags', () => {
const state = {
uiFlags: {
isFetching: false,
isCreating: false,
isUpdating: false,
isDeleting: false,
},
};
expect(getters.getUIFlags(state)).toEqual({
isFetching: false,
isCreating: false,
isUpdating: false,
isDeleting: false,
});
});
});

View File

@@ -0,0 +1,54 @@
import {
CLEAR_TEAMS,
SET_TEAMS,
SET_TEAM_ITEM,
EDIT_TEAM,
DELETE_TEAM,
} from '../../teams/types';
import { mutations } from '../../teams/mutations';
import teams from './fixtures';
describe('#mutations', () => {
describe('#SET_teams', () => {
it('set teams records', () => {
const state = { records: {} };
mutations[SET_TEAMS](state, [teams[1]]);
mutations[SET_TEAMS](state, [teams[2]]);
expect(state.records).toEqual(teams);
});
});
describe('#ADD_TEAM', () => {
it('push newly created teams to the store', () => {
const state = { records: {} };
mutations[SET_TEAM_ITEM](state, teams[1]);
expect(state.records).toEqual({ 1: teams[1] });
});
});
describe('#EDIT_TEAM', () => {
it('update teams record', () => {
const state = { records: [teams[1]] };
mutations[EDIT_TEAM](state, {
id: 1,
name: 'customer-support',
});
expect(state.records[1].name).toEqual('customer-support');
});
});
describe('#DELETE_TEAM', () => {
it('delete teams record', () => {
const state = { records: { 1: teams[1] } };
mutations[DELETE_TEAM](state, 1);
expect(state.records).toEqual({});
});
});
describe('#CLEAR_TEAMS', () => {
it('delete teams record', () => {
const state = { records: { 1: teams[1] } };
mutations[CLEAR_TEAMS](state);
expect(state.records).toEqual({});
});
});
});