HH-547: allow cross-origin widget requests (#126)
* HH-547: allow cross-origin widget requests * fix(HH-547): align production preflight with wildcard CORS --------- Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
@@ -186,7 +186,8 @@ export const actions = {
|
||||
commit('toggleAgentTypingStatus', data);
|
||||
},
|
||||
|
||||
toggleUserTyping: async (_, data) => {
|
||||
toggleUserTyping: async ({ getters }, data) => {
|
||||
if (!getters.getConversationSize) return;
|
||||
try {
|
||||
await toggleTyping(data);
|
||||
} catch (error) {
|
||||
|
||||
@@ -206,6 +206,34 @@ describe('#actions', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#toggleUserTyping', () => {
|
||||
it('does not request typing before a conversation exists', async () => {
|
||||
API.post.mockClear();
|
||||
|
||||
await actions.toggleUserTyping(
|
||||
{ getters: { getConversationSize: 0 } },
|
||||
{ typingStatus: 'on' }
|
||||
);
|
||||
|
||||
expect(API.post).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('requests typing when a conversation exists', async () => {
|
||||
API.post.mockClear();
|
||||
API.post.mockResolvedValue({ data: {} });
|
||||
|
||||
await actions.toggleUserTyping(
|
||||
{ getters: { getConversationSize: 1 } },
|
||||
{ typingStatus: 'on' }
|
||||
);
|
||||
|
||||
expect(API.post).toHaveBeenCalledWith(
|
||||
'/api/v1/widget/conversations/toggle_typing',
|
||||
{ typing_status: 'on' }
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#setCustomAttributes', () => {
|
||||
it('queues to pending state when no conversation exists', async () => {
|
||||
const rootGetters = {
|
||||
|
||||
Reference in New Issue
Block a user