H-16: align takeover with channel AI workflow (#2)
* feat(conversations): complete manual AI takeover * fix(conversations): align AI takeover flow with channel AI * fix(conversations): close takeover review gaps --------- Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
@@ -8,7 +8,7 @@ class AssignableAgents extends ApiClient {
|
||||
|
||||
get(inboxIds) {
|
||||
return axios.get(this.url, {
|
||||
params: { inbox_ids: inboxIds, include_agent_bots: true },
|
||||
params: { inbox_ids: inboxIds },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,13 +62,20 @@ class ConversationApi extends ApiClient {
|
||||
});
|
||||
}
|
||||
|
||||
assignAgent({ conversationId, agentId, assigneeType }) {
|
||||
assignAgent({ conversationId, agentId }) {
|
||||
return axios.post(`${this.url}/${conversationId}/assignments`, {
|
||||
assignee_id: agentId,
|
||||
assignee_type: assigneeType,
|
||||
});
|
||||
}
|
||||
|
||||
startAITakeover(conversationId) {
|
||||
return axios.post(`${this.url}/${conversationId}/ai_takeover`);
|
||||
}
|
||||
|
||||
exitAITakeover(conversationId) {
|
||||
return axios.delete(`${this.url}/${conversationId}/ai_takeover`);
|
||||
}
|
||||
|
||||
assignTeam({ conversationId, teamId }) {
|
||||
const params = { team_id: teamId };
|
||||
return axios.post(`${this.url}/${conversationId}/assignments`, params);
|
||||
@@ -111,7 +118,9 @@ class ConversationApi extends ApiClient {
|
||||
}
|
||||
|
||||
sendEmailTranscript({ conversationId, email }) {
|
||||
return axios.post(`${this.url}/${conversationId}/transcript`, { email });
|
||||
return axios.post(`${this.url}/${conversationId}/transcript`, {
|
||||
email,
|
||||
});
|
||||
}
|
||||
|
||||
updateCustomAttributes({ conversationId, customAttributes }) {
|
||||
|
||||
@@ -23,7 +23,6 @@ describe('#AssignableAgentsAPI', () => {
|
||||
expect(axiosMock.get).toHaveBeenCalledWith('/api/v1/assignable_agents', {
|
||||
params: {
|
||||
inbox_ids: [1],
|
||||
include_agent_bots: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,6 +12,8 @@ describe('#ConversationAPI', () => {
|
||||
expect(conversationAPI).toHaveProperty('toggleStatus');
|
||||
expect(conversationAPI).toHaveProperty('assignAgent');
|
||||
expect(conversationAPI).toHaveProperty('assignTeam');
|
||||
expect(conversationAPI).toHaveProperty('startAITakeover');
|
||||
expect(conversationAPI).toHaveProperty('exitAITakeover');
|
||||
expect(conversationAPI).toHaveProperty('markMessageRead');
|
||||
expect(conversationAPI).toHaveProperty('toggleTyping');
|
||||
expect(conversationAPI).toHaveProperty('mute');
|
||||
@@ -79,7 +81,10 @@ describe('#ConversationAPI', () => {
|
||||
});
|
||||
|
||||
it('#toggleStatus', () => {
|
||||
conversationAPI.toggleStatus({ conversationId: 12, status: 'online' });
|
||||
conversationAPI.toggleStatus({
|
||||
conversationId: 12,
|
||||
status: 'online',
|
||||
});
|
||||
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||
`/api/v1/conversations/12/toggle_status`,
|
||||
{
|
||||
@@ -93,17 +98,29 @@ describe('#ConversationAPI', () => {
|
||||
conversationAPI.assignAgent({
|
||||
conversationId: 12,
|
||||
agentId: 34,
|
||||
assigneeType: 'AgentBot',
|
||||
});
|
||||
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||
`/api/v1/conversations/12/assignments`,
|
||||
{
|
||||
assignee_id: 34,
|
||||
assignee_type: 'AgentBot',
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('#startAITakeover', () => {
|
||||
conversationAPI.startAITakeover(12);
|
||||
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||
'/api/v1/conversations/12/ai_takeover'
|
||||
);
|
||||
});
|
||||
|
||||
it('#exitAITakeover', () => {
|
||||
conversationAPI.exitAITakeover(12);
|
||||
expect(axiosMock.delete).toHaveBeenCalledWith(
|
||||
'/api/v1/conversations/12/ai_takeover'
|
||||
);
|
||||
});
|
||||
|
||||
it('#assignTeam', () => {
|
||||
conversationAPI.assignTeam({ conversationId: 12, teamId: 1 });
|
||||
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||
|
||||
Reference in New Issue
Block a user