@servicetitan/titan-chat-ui 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/components/chat/__tests-cy__/chat-error.test.d.ts +2 -0
- package/dist/components/chat/__tests-cy__/chat-error.test.d.ts.map +1 -0
- package/dist/components/chat/__tests-cy__/chat-error.test.js +6 -0
- package/dist/components/chat/__tests-cy__/chat-error.test.js.map +1 -0
- package/dist/components/chat/__tests-cy__/chat-input-file.test.d.ts +2 -0
- package/dist/components/chat/__tests-cy__/chat-input-file.test.d.ts.map +1 -0
- package/dist/components/chat/__tests-cy__/chat-input-file.test.js +6 -0
- package/dist/components/chat/__tests-cy__/chat-input-file.test.js.map +1 -0
- package/dist/components/chat/__tests-cy__/chat-input.test.d.ts +2 -0
- package/dist/components/chat/__tests-cy__/chat-input.test.d.ts.map +1 -0
- package/dist/components/chat/__tests-cy__/chat-input.test.js +6 -0
- package/dist/components/chat/__tests-cy__/chat-input.test.js.map +1 -0
- package/dist/components/chat/__tests-cy__/chat-log.test.d.ts +2 -0
- package/dist/components/chat/__tests-cy__/chat-log.test.d.ts.map +1 -0
- package/dist/components/chat/__tests-cy__/chat-log.test.js +6 -0
- package/dist/components/chat/__tests-cy__/chat-log.test.js.map +1 -0
- package/dist/components/chat/__tests-cy__/chat-messages.test.js +2 -91
- package/dist/components/chat/__tests-cy__/chat-messages.test.js.map +1 -1
- package/dist/components/chat/__tests-cy__/chat-notifications.test.d.ts +2 -0
- package/dist/components/chat/__tests-cy__/chat-notifications.test.d.ts.map +1 -0
- package/dist/components/chat/__tests-cy__/chat-notifications.test.js +6 -0
- package/dist/components/chat/__tests-cy__/chat-notifications.test.js.map +1 -0
- package/dist/components/chat/__tests-cy__/chat-timer.test.d.ts +2 -0
- package/dist/components/chat/__tests-cy__/chat-timer.test.d.ts.map +1 -0
- package/dist/components/chat/__tests-cy__/chat-timer.test.js +6 -0
- package/dist/components/chat/__tests-cy__/chat-timer.test.js.map +1 -0
- package/dist/components/chat/__tests-cy__/chat.test.js +3 -123
- package/dist/components/chat/__tests-cy__/chat.test.js.map +1 -1
- package/dist/components/chat/chat-error.d.ts +3 -1
- package/dist/components/chat/chat-error.d.ts.map +1 -1
- package/dist/components/chat/chat-error.js +2 -3
- package/dist/components/chat/chat-error.js.map +1 -1
- package/dist/components/chat/chat-input.d.ts.map +1 -1
- package/dist/components/chat/chat-input.js +2 -1
- package/dist/components/chat/chat-input.js.map +1 -1
- package/dist/components/chat/chat-notifications.js +1 -1
- package/dist/components/chat/chat-notifications.js.map +1 -1
- package/dist/components/message-content/__tests-cy__/message-content-file.test.d.ts +2 -0
- package/dist/components/message-content/__tests-cy__/message-content-file.test.d.ts.map +1 -0
- package/dist/components/message-content/__tests-cy__/message-content-file.test.js +6 -0
- package/dist/components/message-content/__tests-cy__/message-content-file.test.js.map +1 -0
- package/dist/components/messages/__tests-cy__/message-agent.test.js +7 -72
- package/dist/components/messages/__tests-cy__/message-agent.test.js.map +1 -1
- package/dist/components/messages/__tests-cy__/message-system.test.js +5 -14
- package/dist/components/messages/__tests-cy__/message-system.test.js.map +1 -1
- package/dist/components/messages/__tests-cy__/message-timeout.test.js +2 -21
- package/dist/components/messages/__tests-cy__/message-timeout.test.js.map +1 -1
- package/dist/components/messages/__tests-cy__/message-typing.test.js +3 -45
- package/dist/components/messages/__tests-cy__/message-typing.test.js.map +1 -1
- package/dist/components/messages/__tests-cy__/message-user.test.js +3 -23
- package/dist/components/messages/__tests-cy__/message-user.test.js.map +1 -1
- package/package.json +4 -4
- package/src/components/chat/__tests-cy__/chat-error.test.tsx +6 -0
- package/src/components/chat/__tests-cy__/chat-input-file.test.tsx +6 -0
- package/src/components/chat/__tests-cy__/chat-input.test.tsx +6 -0
- package/src/components/chat/__tests-cy__/chat-log.test.tsx +6 -0
- package/src/components/chat/__tests-cy__/chat-messages.test.tsx +2 -107
- package/src/components/chat/__tests-cy__/chat-notifications.test.tsx +6 -0
- package/src/components/chat/__tests-cy__/chat-timer.test.tsx +6 -0
- package/src/components/chat/__tests-cy__/chat.test.tsx +3 -156
- package/src/components/chat/chat-error.tsx +2 -3
- package/src/components/chat/chat-input.tsx +25 -21
- package/src/components/chat/chat-notifications.tsx +1 -1
- package/src/components/message-content/__tests-cy__/message-content-file.test.tsx +6 -0
- package/src/components/messages/__tests-cy__/message-agent.test.tsx +7 -129
- package/src/components/messages/__tests-cy__/message-system.test.tsx +5 -27
- package/src/components/messages/__tests-cy__/message-timeout.test.tsx +2 -25
- package/src/components/messages/__tests-cy__/message-typing.test.tsx +3 -54
- package/src/components/messages/__tests-cy__/message-user.test.tsx +3 -37
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/components/chat/chat-error.module.less +0 -6
- package/src/components/chat/chat-error.module.less +0 -6
- package/src/components/chat/chat-error.module.less.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# v3.1.1 (Thu Aug 14 2025)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- SPA-7016: [Chatbot] Add Anvil2 support for chatbot NPM packages [#41](https://github.com/servicetitan/titan-chatbot-client/pull/41) ([@AlexYarmolchuk](https://github.com/AlexYarmolchuk))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Alexandr Yarmolchuk ([@AlexYarmolchuk](https://github.com/AlexYarmolchuk))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# v3.0.0 (Tue Jul 15 2025)
|
|
2
14
|
|
|
3
15
|
#### 💥 Breaking Change
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-error.test.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-error.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-error.test.js","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-error.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACvB,uBAAuB,CAAC,SAAS,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-input-file.test.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-input-file.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { runChatInputFileSharedTests } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
2
|
+
import { ChatInputFile } from '../chat-input-file';
|
|
3
|
+
describe('ChatInputFile', () => {
|
|
4
|
+
runChatInputFileSharedTests(ChatInputFile);
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=chat-input-file.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-input-file.test.js","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-input-file.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC3B,2BAA2B,CAAC,aAAa,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-input.test.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-input.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-input.test.js","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-input.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACvB,uBAAuB,CAAC,SAAS,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-log.test.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-log.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-log.test.js","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-log.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACvB,qBAAqB,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC"}
|
|
@@ -1,95 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Provider } from '@servicetitan/react-ioc';
|
|
3
|
-
import { CHAT_UI_STORE_TOKEN, mockChatMessageModelText } from '@servicetitan/titan-chat-ui-common';
|
|
4
|
-
import { ChatUiSelectors, CypressMocks } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
5
|
-
import { mount } from 'cypress/react';
|
|
1
|
+
import { runChatMessagesSharedTests } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
6
2
|
import { ChatMessages } from '../chat-messages';
|
|
7
3
|
describe('[ChatMessages]', () => {
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
cy.viewport(780, 600);
|
|
11
|
-
cy.clock(new Date('2023-10-01T10:10:00Z').getTime());
|
|
12
|
-
storeMock = new CypressMocks.ChatUiStoreMock();
|
|
13
|
-
});
|
|
14
|
-
const render = () => {
|
|
15
|
-
return mount(_jsx(Provider, { singletons: [
|
|
16
|
-
{
|
|
17
|
-
provide: CHAT_UI_STORE_TOKEN,
|
|
18
|
-
useValue: storeMock,
|
|
19
|
-
},
|
|
20
|
-
], children: _jsx(ChatMessages, { messages: storeMock.messages }) }));
|
|
21
|
-
};
|
|
22
|
-
it('should render default chat', () => {
|
|
23
|
-
render();
|
|
24
|
-
ChatUiSelectors.chatMessages.should('be.visible');
|
|
25
|
-
ChatUiSelectors.chatMessage.should('have.length', 2);
|
|
26
|
-
});
|
|
27
|
-
it('should render several consecutive agent messages without extra avatars', () => {
|
|
28
|
-
storeMock.messages = [
|
|
29
|
-
mockChatMessageModelText(true, {
|
|
30
|
-
id: 'id1',
|
|
31
|
-
timestamp: new Date('2023-01-01T10:10:00Z'),
|
|
32
|
-
message: 'Hello, this is the first message',
|
|
33
|
-
}),
|
|
34
|
-
mockChatMessageModelText(true, {
|
|
35
|
-
id: 'id2',
|
|
36
|
-
message: 'Hello, this is the second message. '.repeat(5).trim(),
|
|
37
|
-
timestamp: new Date('2023-01-01T10:10:59.999Z'),
|
|
38
|
-
}),
|
|
39
|
-
mockChatMessageModelText(true, {
|
|
40
|
-
id: 'id3',
|
|
41
|
-
message: 'Hello, this is the third message',
|
|
42
|
-
timestamp: new Date('2023-01-01T10:11:00Z'),
|
|
43
|
-
}),
|
|
44
|
-
mockChatMessageModelText(true, {
|
|
45
|
-
id: 'id4',
|
|
46
|
-
message: 'Hello, this is the forth message',
|
|
47
|
-
timestamp: new Date('2023-01-01T10:11:01Z'),
|
|
48
|
-
}),
|
|
49
|
-
mockChatMessageModelText(false, {
|
|
50
|
-
id: 'id11',
|
|
51
|
-
timestamp: new Date('2023-01-01T11:10:00Z'),
|
|
52
|
-
message: 'Hello, this is the first message',
|
|
53
|
-
}),
|
|
54
|
-
mockChatMessageModelText(false, {
|
|
55
|
-
id: 'id22',
|
|
56
|
-
message: 'Hello, this is the second message',
|
|
57
|
-
timestamp: new Date('2023-01-01T11:11:00Z'),
|
|
58
|
-
}),
|
|
59
|
-
mockChatMessageModelText(false, {
|
|
60
|
-
id: 'id33',
|
|
61
|
-
message: 'Hello, this is the third message',
|
|
62
|
-
timestamp: new Date('2023-01-01T11:12:00Z'),
|
|
63
|
-
}),
|
|
64
|
-
mockChatMessageModelText(false, {
|
|
65
|
-
id: 'id44',
|
|
66
|
-
message: 'Hello, this is the forth message',
|
|
67
|
-
timestamp: new Date('2023-01-01T11:12:01Z'),
|
|
68
|
-
}),
|
|
69
|
-
];
|
|
70
|
-
render();
|
|
71
|
-
const getTimestamp = (i) => ChatUiSelectors.chatMessage
|
|
72
|
-
.eq(i)
|
|
73
|
-
.find(`[data-cy="${ChatUiSelectors.cy.chatMessageFooter}"]`);
|
|
74
|
-
ChatUiSelectors.chatMessageAgent.should('have.length', 4);
|
|
75
|
-
ChatUiSelectors.chatMessageUser.should('have.length', 4);
|
|
76
|
-
// Agent avatar should be visible only for the first message in group
|
|
77
|
-
const getAvatar = (i) => ChatUiSelectors.chatMessageAgent
|
|
78
|
-
.find(`[data-cy="${ChatUiSelectors.cy.chatAvatar}"]`)
|
|
79
|
-
.eq(i);
|
|
80
|
-
getAvatar(0).should('be.visible');
|
|
81
|
-
getAvatar(1).should('not.exist');
|
|
82
|
-
getAvatar(2).should('not.exist');
|
|
83
|
-
getAvatar(3).should('not.exist');
|
|
84
|
-
// Footer with date should be visible only for the different formatted timestamps
|
|
85
|
-
getTimestamp(0).should('not.exist');
|
|
86
|
-
getTimestamp(1).should('be.visible').should('contain.text', 'agent • 10:10 AM');
|
|
87
|
-
getTimestamp(2).should('not.exist');
|
|
88
|
-
getTimestamp(3).should('be.visible').should('contain.text', 'agent • 10:11 AM');
|
|
89
|
-
getTimestamp(4).should('be.visible').should('contain.text', '11:10 AM');
|
|
90
|
-
getTimestamp(5).should('be.visible').should('contain.text', '11:11 AM');
|
|
91
|
-
getTimestamp(6).should('not.exist');
|
|
92
|
-
getTimestamp(7).should('be.visible').should('contain.text', '11:12 AM');
|
|
93
|
-
});
|
|
4
|
+
runChatMessagesSharedTests(ChatMessages);
|
|
94
5
|
});
|
|
95
6
|
//# sourceMappingURL=chat-messages.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-messages.test.js","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-messages.test.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chat-messages.test.js","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-messages.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC5B,0BAA0B,CAAC,YAAY,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-notifications.test.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-notifications.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { runChatNotificationsTests } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
2
|
+
import { ChatNotifications } from '../chat-notifications';
|
|
3
|
+
describe('ChatNotifications', () => {
|
|
4
|
+
runChatNotificationsTests(ChatNotifications);
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=chat-notifications.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-notifications.test.js","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-notifications.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC/B,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-timer.test.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-timer.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-timer.test.js","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat-timer.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACvB,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC"}
|
|
@@ -1,126 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Container, provide, useDependencies } from '@servicetitan/react-ioc';
|
|
3
|
-
import { CHAT_UI_BACKEND_STORE_TOKEN, CHAT_UI_STORE_TOKEN, ChatParticipantIcon, ChatUiBackendEchoStore, ChatUiStore, } from '@servicetitan/titan-chat-ui-common';
|
|
4
|
-
import { ChatUiSelectors } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
5
|
-
import { mount } from 'cypress/react';
|
|
6
|
-
import { useEffect } from 'react';
|
|
1
|
+
import { runChatSharedTests } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
7
2
|
import { Chat } from '../chat';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const container = new Container();
|
|
11
|
-
container.parent = rootContainer;
|
|
12
|
-
container.bind(CHAT_UI_STORE_TOKEN).to(ChatUiStore).inSingletonScope();
|
|
13
|
-
container
|
|
14
|
-
.bind(CHAT_UI_BACKEND_STORE_TOKEN)
|
|
15
|
-
.to(ChatUiBackendEchoStore)
|
|
16
|
-
.inSingletonScope();
|
|
17
|
-
return container;
|
|
18
|
-
};
|
|
19
|
-
describe('[Chat]', () => {
|
|
20
|
-
let container;
|
|
21
|
-
let chatUiStore;
|
|
22
|
-
let chatUiBackendStore;
|
|
23
|
-
beforeEach(() => {
|
|
24
|
-
container = initContainer();
|
|
25
|
-
chatUiStore = container.get(CHAT_UI_STORE_TOKEN);
|
|
26
|
-
chatUiBackendStore = container.get(CHAT_UI_BACKEND_STORE_TOKEN);
|
|
27
|
-
cy.viewport(780, 800);
|
|
28
|
-
cy.clock(Date.parse('2023-10-01T00:00:00Z'));
|
|
29
|
-
});
|
|
30
|
-
const render = () => {
|
|
31
|
-
const ChatWrapper = provide({
|
|
32
|
-
singletons: [
|
|
33
|
-
{
|
|
34
|
-
provide: CHAT_UI_STORE_TOKEN,
|
|
35
|
-
useValue: chatUiStore,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
provide: CHAT_UI_BACKEND_STORE_TOKEN,
|
|
39
|
-
useValue: chatUiBackendStore,
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
})(() => {
|
|
43
|
-
const [chatUiStore, chatUiBackendStore] = useDependencies(CHAT_UI_STORE_TOKEN, CHAT_UI_BACKEND_STORE_TOKEN);
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
const init = async () => {
|
|
46
|
-
chatUiBackendStore.subscribe();
|
|
47
|
-
await chatUiStore.run({
|
|
48
|
-
agentName: 'EchoBot',
|
|
49
|
-
agentIcon: ChatParticipantIcon.Bot,
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
init().then(() => { });
|
|
53
|
-
return () => chatUiBackendStore.unsubscribe();
|
|
54
|
-
}, [chatUiStore, chatUiBackendStore]);
|
|
55
|
-
return _jsx(Chat, { className: "h-100vh max-h-100vh" });
|
|
56
|
-
});
|
|
57
|
-
cy.spy(chatUiStore, 'run').as('runSpy');
|
|
58
|
-
mount(_jsx(ChatWrapper, {}));
|
|
59
|
-
ChatUiSelectors.chatConnecting.should('be.visible');
|
|
60
|
-
cy.tick(1000);
|
|
61
|
-
return cy.wrap(new Promise(resolve => {
|
|
62
|
-
cy.get('@runSpy')
|
|
63
|
-
.should('have.been.calledOnce')
|
|
64
|
-
.then((invocation) => {
|
|
65
|
-
const initPromise = invocation.firstCall.returnValue;
|
|
66
|
-
initPromise.then(resolve);
|
|
67
|
-
});
|
|
68
|
-
}));
|
|
69
|
-
};
|
|
70
|
-
const ask = (message) => {
|
|
71
|
-
ChatUiSelectors.chatInput.type(`${message}{enter}`);
|
|
72
|
-
};
|
|
73
|
-
it('should render default chat', () => {
|
|
74
|
-
render().then(() => {
|
|
75
|
-
ChatUiSelectors.chatMessages.should('be.visible');
|
|
76
|
-
ChatUiSelectors.chatMessageAgent.should('have.length', 1).should('be.visible');
|
|
77
|
-
ChatUiSelectors.chatMessageContentAgent
|
|
78
|
-
.should('be.visible')
|
|
79
|
-
.should('contain.text', "Hello! I'm generic echo bot. I can echo your messages. Try it out!");
|
|
80
|
-
ChatUiSelectors.chatNotifications.should('exist');
|
|
81
|
-
ChatUiSelectors.chatSend.should('be.visible').should('be.disabled');
|
|
82
|
-
ChatUiSelectors.chatInput.should('be.visible').should('not.be.disabled');
|
|
83
|
-
ChatUiSelectors.chatInput.type('Hello');
|
|
84
|
-
ChatUiSelectors.chatSend.click();
|
|
85
|
-
ChatUiSelectors.chatMessageUser
|
|
86
|
-
.should('be.visible')
|
|
87
|
-
.should('have.length', 1)
|
|
88
|
-
.should('contain.text', 'Hello');
|
|
89
|
-
ChatUiSelectors.chatMessageTyping.should('be.visible');
|
|
90
|
-
ChatUiSelectors.chatMessageAgent.should('have.length', 1);
|
|
91
|
-
cy.tick(1000);
|
|
92
|
-
ChatUiSelectors.chatMessageTyping.should('not.exist');
|
|
93
|
-
ChatUiSelectors.chatMessageAgent.should('have.length', 2);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
it('should render chat error message', () => {
|
|
97
|
-
render().then(() => {
|
|
98
|
-
chatUiStore.setTimer({ secondsTotal: 100, secondsLeft: 10 });
|
|
99
|
-
chatUiStore.setError('error message', {
|
|
100
|
-
title: 'Custom Error',
|
|
101
|
-
recoverStrategy: {
|
|
102
|
-
recoverButtonTitle: 'Recover button title',
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
ChatUiSelectors.chatTimer.should('not.exist');
|
|
106
|
-
ChatUiSelectors.chatError.should('be.visible');
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
it('should handle send message error and retry', () => {
|
|
110
|
-
render().then(() => {
|
|
111
|
-
ask('[Error]Custom error message');
|
|
112
|
-
cy.tick(1000);
|
|
113
|
-
// Check error message
|
|
114
|
-
ChatUiSelectors.chatMessageError
|
|
115
|
-
.should('be.visible')
|
|
116
|
-
.should('contain.text', 'Message not delivered. Retry');
|
|
117
|
-
ChatUiSelectors.chatError
|
|
118
|
-
.should('be.visible')
|
|
119
|
-
.should('contain.text', ['Custom Error Title', 'Custom error message'].join(''));
|
|
120
|
-
// Retry message
|
|
121
|
-
ChatUiSelectors.chatMessageErrorRetry.should('be.visible').click();
|
|
122
|
-
cy.tick(1000);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
3
|
+
describe('Chat', () => {
|
|
4
|
+
runChatSharedTests(Chat);
|
|
125
5
|
});
|
|
126
6
|
//# sourceMappingURL=chat.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.test.js","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat.test.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chat.test.js","sourceRoot":"","sources":["../../../../src/components/chat/__tests-cy__/chat.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IAClB,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-error.d.ts","sourceRoot":"","sources":["../../../src/components/chat/chat-error.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,EAAE,EAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-error.d.ts","sourceRoot":"","sources":["../../../src/components/chat/chat-error.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,EAAE,EAAe,MAAM,OAAO,CAAC;AAGxC,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAgC/C,CAAC"}
|
|
@@ -5,8 +5,7 @@ import { CHAT_UI_STORE_TOKEN } from '@servicetitan/titan-chat-ui-common';
|
|
|
5
5
|
import { observer } from 'mobx-react';
|
|
6
6
|
import { useCallback } from 'react';
|
|
7
7
|
import { MultilineText } from '../common/multiline-text';
|
|
8
|
-
|
|
9
|
-
export const ChatError = observer(() => {
|
|
8
|
+
export const ChatError = observer(({ className }) => {
|
|
10
9
|
const [chatUiStore] = useDependencies(CHAT_UI_STORE_TOKEN);
|
|
11
10
|
const { error } = chatUiStore;
|
|
12
11
|
const handleReconnect = useCallback(async () => {
|
|
@@ -15,6 +14,6 @@ export const ChatError = observer(() => {
|
|
|
15
14
|
if (!error) {
|
|
16
15
|
return null;
|
|
17
16
|
}
|
|
18
|
-
return (_jsxs(Banner, { status: "critical", title: error.title, icon: true, className:
|
|
17
|
+
return (_jsxs(Banner, { status: "critical", title: error.title, icon: true, className: className, "data-cy": "titan-chat-error", children: [_jsx(MultilineText, { text: error.message, "data-cy": "titan-chat-error-text" }), error.recoverStrategy && (_jsx(Button, { className: "m-t-2 bg-white-i", small: true, onClick: handleReconnect, "data-cy": "titan-chat-error-recover", children: error.recoverStrategy.recoverButtonTitle }))] }));
|
|
19
18
|
});
|
|
20
19
|
//# sourceMappingURL=chat-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-error.js","sourceRoot":"","sources":["../../../src/components/chat/chat-error.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAM,WAAW,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-error.js","sourceRoot":"","sources":["../../../src/components/chat/chat-error.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAM,WAAW,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,CAAC,MAAM,SAAS,GAA+B,QAAQ,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IAC5E,MAAM,CAAC,WAAW,CAAC,GAAG,eAAe,CAAC,mBAAmB,CAAC,CAAC;IAC3D,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAE9B,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QAC3C,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,CACH,MAAC,MAAM,IACH,MAAM,EAAC,UAAU,EACjB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,IAAI,QACJ,SAAS,EAAE,SAAS,aACZ,kBAAkB,aAE1B,KAAC,aAAa,IAAC,IAAI,EAAE,KAAK,CAAC,OAAO,aAAU,uBAAuB,GAAG,EACrE,KAAK,CAAC,eAAe,IAAI,CACtB,KAAC,MAAM,IACH,SAAS,EAAC,kBAAkB,EAC5B,KAAK,QACL,OAAO,EAAE,eAAe,aAChB,0BAA0B,YAEjC,KAAK,CAAC,eAAe,CAAC,kBAAkB,GACpC,CACZ,IACI,CACZ,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-input.d.ts","sourceRoot":"","sources":["../../../src/components/chat/chat-input.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"chat-input.d.ts","sourceRoot":"","sources":["../../../src/components/chat/chat-input.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,EAAE,EAAuD,MAAM,OAAO,CAAC;AAMhF,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAuIhD,CAAC"}
|
|
@@ -15,7 +15,8 @@ export const ChatInput = provide({
|
|
|
15
15
|
const [isSending, setIsSending] = useState(false);
|
|
16
16
|
const textareaRef = useRef(null);
|
|
17
17
|
const [chatUiStore, supportChatInputStore] = useDependencies(CHAT_UI_STORE_TOKEN, ChatInputStore);
|
|
18
|
-
const handleSendMessage = useCallback(async () => {
|
|
18
|
+
const handleSendMessage = useCallback(async (event) => {
|
|
19
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
19
20
|
const validateResult = await supportChatInputStore.formState.validate();
|
|
20
21
|
if (validateResult.hasError) {
|
|
21
22
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-input.js","sourceRoot":"","sources":["../../../src/components/chat/chat-input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"chat-input.js","sourceRoot":"","sources":["../../../src/components/chat/chat-input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAiB,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AAEnD,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,MAAM,CAAC,MAAM,SAAS,GAA+B,OAAO,CAAC;IACzD,UAAU,EAAE,CAAC,cAAc,CAAC;CAC/B,CAAC,CACE,QAAQ,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IACvB,MAAM,gBAAgB,GAAG,MAAM,CAA4C,SAAS,CAAC,CAAC;IACtF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,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AAE,CAAC,WAAW,CAAC,SAAS,IAAI,SAAS,aACrC,kBAAkB,GAC5B,EACF,KAAC,MAAM,IACH,SAAS,EAAC,qBAAqB,EAC/B,QAAQ,EAAC,MAAM,gBACJ,iBAAiB,aACpB,iBAAiB,EACzB,IAAI,EAAC,QAAQ,EACb,OAAO,sBACI,QAAQ,EACnB,QAAQ,EACJ,CAAC,WAAW,CAAC,SAAS;wBACtB,SAAS;wBACT,qBAAqB,CAAC,SAAS,CAAC,QAAQ;wBACxC,qBAAqB,CAAC,OAAO,GAEnC,IACA,GACH,CACV,CAAC;AACN,CAAC,CAAC,CACL,CAAC"}
|
|
@@ -7,6 +7,6 @@ import { ChatError } from './chat-error';
|
|
|
7
7
|
import { ChatTimer } from './chat-timer';
|
|
8
8
|
export const ChatNotifications = observer(() => {
|
|
9
9
|
const [chatUiStore] = useDependencies(CHAT_UI_STORE_TOKEN);
|
|
10
|
-
return (_jsxs(Stack, { direction: "column", spacing: "2", "data-cy": "titan-chat-notifications", children: [chatUiStore.timer && !chatUiStore.isError && _jsx(ChatTimer, {}), chatUiStore.isError && _jsx(ChatError, {})] }));
|
|
10
|
+
return (_jsxs(Stack, { direction: "column", spacing: "2", "data-cy": "titan-chat-notifications", children: [chatUiStore.timer && !chatUiStore.isError && _jsx(ChatTimer, {}), chatUiStore.isError && _jsx(ChatError, { className: "m-x-3" })] }));
|
|
11
11
|
});
|
|
12
12
|
//# sourceMappingURL=chat-notifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-notifications.js","sourceRoot":"","sources":["../../../src/components/chat/chat-notifications.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAA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CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-content-file.test.d.ts","sourceRoot":"","sources":["../../../../src/components/message-content/__tests-cy__/message-content-file.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { runMessageContentFileSharedTests } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
2
|
+
import { MessageContentFile } from '../message-content-file';
|
|
3
|
+
describe('MessageContentFile', () => {
|
|
4
|
+
runMessageContentFileSharedTests(MessageContentFile);
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=message-content-file.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-content-file.test.js","sourceRoot":"","sources":["../../../../src/components/message-content/__tests-cy__/message-content-file.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAChC,gCAAgC,CAAC,kBAAkB,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC"}
|
|
@@ -1,78 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { BodyText, Button, Stack } from '@servicetitan/design-system';
|
|
3
|
-
import {
|
|
4
|
-
import { ChatUiSelectors } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
5
|
-
import { mount } from 'cypress/react';
|
|
2
|
+
import { runMessageAgentSharedTests } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
6
3
|
import { MessageAgent } from '../message-agent';
|
|
7
4
|
import { MessageFooter } from '../message-footer';
|
|
8
|
-
describe('
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
mount(_jsx(MessageAgent, { avatar: {
|
|
15
|
-
name: 'Test User Name',
|
|
16
|
-
icon: ChatParticipantIcon.Bot,
|
|
17
|
-
className: 'custom-class',
|
|
18
|
-
}, children: _jsx(BodyText, { "data-cy": "content", children: "message agent content" }) }));
|
|
19
|
-
ChatUiSelectors.chatMessageAgent.should('be.visible').children().should('have.length', 2);
|
|
20
|
-
ChatUiSelectors.chatAvatarBot.should('be.visible').should('have.class', 'custom-class');
|
|
21
|
-
ChatUiSelectors.chatMessageContentAgent.should('contain.text', 'message agent content');
|
|
22
|
-
});
|
|
23
|
-
it('should be full width', () => {
|
|
24
|
-
mount(_jsx(MessageAgent, { fullWidth: true, avatar: {
|
|
25
|
-
name: 'Test User Name',
|
|
26
|
-
icon: ChatParticipantIcon.Bot,
|
|
27
|
-
}, children: _jsx(BodyText, { children: "message agent content" }) }));
|
|
28
|
-
ChatUiSelectors.chatMessageContentAgent.should('contain.text', 'message agent content');
|
|
29
|
-
});
|
|
30
|
-
it('should render with custom data-cy', () => {
|
|
31
|
-
mount(_jsx(MessageAgent, { "data-cy": "custom-data-cy", avatar: {
|
|
32
|
-
name: 'Test User Name',
|
|
33
|
-
icon: ChatParticipantIcon.Bot,
|
|
34
|
-
}, children: _jsx(BodyText, { children: "message agent content" }) }));
|
|
35
|
-
cy.getCy('custom-data-cy').should('be.visible');
|
|
36
|
-
});
|
|
37
|
-
it('should render custom message footer', () => {
|
|
38
|
-
mount(_jsx(MessageAgent, { messageFooter: _jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [_jsx(MessageFooter, { name: "name", timestamp: new Date() }), _jsxs(Stack, { direction: "row", spacing: "1", children: [_jsx(Button, { iconName: "thumb_up", xsmall: true, fill: "subtle" }), _jsx(Button, { iconName: "thumb_down", xsmall: true, fill: "subtle" })] })] }), avatar: {
|
|
39
|
-
name: 'Test User Name',
|
|
40
|
-
icon: ChatParticipantIcon.Bot,
|
|
41
|
-
}, children: _jsx(BodyText, { children: "message agent content" }) }));
|
|
42
|
-
ChatUiSelectors.chatMessageAgent.should('be.visible').children().should('have.length', 2);
|
|
43
|
-
ChatUiSelectors.chatMessageFooter
|
|
44
|
-
.should('be.visible')
|
|
45
|
-
.should('contain.text', 'name • 10:10 AM');
|
|
46
|
-
});
|
|
47
|
-
it('should render subtle message', () => {
|
|
48
|
-
mount(_jsx(MessageAgent, { subtle: true, avatar: {
|
|
49
|
-
name: 'Test User Name',
|
|
50
|
-
icon: ChatParticipantIcon.Bot,
|
|
51
|
-
}, children: _jsx(Stack, { className: "border h-100", alignItems: "center", "data-cy": "custom-content", children: _jsx(BodyText, { children: "message agent content" }) }) }));
|
|
52
|
-
ChatUiSelectors.chatAvatarBot.should('be.visible');
|
|
53
|
-
cy.getCy('custom-content')
|
|
54
|
-
.should('be.visible')
|
|
55
|
-
.should('contain.text', 'message agent content');
|
|
56
|
-
});
|
|
57
|
-
describe('with different icon types', () => {
|
|
58
|
-
const render = (icon) => {
|
|
59
|
-
return mount(_jsx(MessageAgent, { avatar: {
|
|
60
|
-
name: 'Test User Name',
|
|
61
|
-
icon,
|
|
62
|
-
}, children: _jsx(BodyText, { children: "message agent content" }) }));
|
|
63
|
-
};
|
|
64
|
-
it('icon bot', () => {
|
|
65
|
-
render(ChatParticipantIcon.Bot);
|
|
66
|
-
ChatUiSelectors.chatAvatarBot.should('be.visible');
|
|
67
|
-
});
|
|
68
|
-
it('icon initials', () => {
|
|
69
|
-
render(ChatParticipantIcon.Initials);
|
|
70
|
-
ChatUiSelectors.chatAvatarInitials.should('be.visible').should('contain.text', 'T');
|
|
71
|
-
});
|
|
72
|
-
it('icon empty', () => {
|
|
73
|
-
render(ChatParticipantIcon.Empty);
|
|
74
|
-
ChatUiSelectors.chatAvatarEmpty.should('exist').should('not.be.visible');
|
|
75
|
-
});
|
|
5
|
+
describe('MessageAgent', () => {
|
|
6
|
+
runMessageAgentSharedTests(MessageAgent, {
|
|
7
|
+
TextComponent: BodyText,
|
|
8
|
+
ButtonComponent: Button,
|
|
9
|
+
ContainerComponent: Stack,
|
|
10
|
+
MessageFooterComponent: MessageFooter,
|
|
76
11
|
});
|
|
77
12
|
});
|
|
78
13
|
//# sourceMappingURL=message-agent.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-agent.test.js","sourceRoot":"","sources":["../../../../src/components/messages/__tests-cy__/message-agent.test.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"message-agent.test.js","sourceRoot":"","sources":["../../../../src/components/messages/__tests-cy__/message-agent.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC1B,0BAA0B,CAAC,YAAY,EAAE;QACrC,aAAa,EAAE,QAAQ;QACvB,eAAe,EAAE,MAAM;QACvB,kBAAkB,EAAE,KAAK;QACzB,sBAAsB,EAAE,aAAa;KACxC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|