@servicetitan/titan-chatbot-ui 3.0.1 → 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/chatbot/__tests-cy__/chatbot-help-center.test.js +2 -156
- package/dist/components/chatbot/__tests-cy__/chatbot-help-center.test.js.map +1 -1
- package/dist/components/chatbot/__tests-cy__/chatbot-live.test.js +2 -94
- package/dist/components/chatbot/__tests-cy__/chatbot-live.test.js.map +1 -1
- package/dist/components/chatbot/__tests-cy__/chatbot-titan-chatbot.test.js +2 -151
- package/dist/components/chatbot/__tests-cy__/chatbot-titan-chatbot.test.js.map +1 -1
- package/dist/components/chatbot/__tests-cy__/chatbot.test.js +2 -151
- package/dist/components/chatbot/__tests-cy__/chatbot.test.js.map +1 -1
- package/dist/components/chatbot/chatbot.d.ts +2 -1
- package/dist/components/chatbot/chatbot.d.ts.map +1 -1
- package/dist/components/chatbot/chatbot.js +2 -2
- package/dist/components/chatbot/chatbot.js.map +1 -1
- package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-dialog.test.d.ts +2 -0
- package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-dialog.test.d.ts.map +1 -0
- package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-dialog.test.js +6 -0
- package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-dialog.test.js.map +1 -0
- package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-link.test.d.ts +2 -0
- package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-link.test.d.ts.map +1 -0
- package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-link.test.js +6 -0
- package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-link.test.js.map +1 -0
- package/dist/components/chatbot/dialog/chatbot-restart-dialog.d.ts.map +1 -1
- package/dist/components/chatbot/dialog/chatbot-restart-dialog.js +1 -1
- package/dist/components/chatbot/dialog/chatbot-restart-dialog.js.map +1 -1
- package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-form-guardrail.test.js +2 -61
- package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-form-guardrail.test.js.map +1 -1
- package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-form.test.js +2 -96
- package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-form.test.js.map +1 -1
- package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-popover.test.d.ts +2 -0
- package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-popover.test.d.ts.map +1 -0
- package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-popover.test.js +6 -0
- package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-popover.test.js.map +1 -0
- package/dist/components/chatbot/feedback/__tests-cy__/chatbot-session-feedback-modal.test.d.ts +2 -0
- package/dist/components/chatbot/feedback/__tests-cy__/chatbot-session-feedback-modal.test.d.ts.map +1 -0
- package/dist/components/chatbot/feedback/__tests-cy__/chatbot-session-feedback-modal.test.js +6 -0
- package/dist/components/chatbot/feedback/__tests-cy__/chatbot-session-feedback-modal.test.js.map +1 -0
- package/dist/components/chatbot/feedback/chatbot-message-feedback-form-guardrail.d.ts.map +1 -1
- package/dist/components/chatbot/feedback/chatbot-message-feedback-form-guardrail.js +1 -1
- package/dist/components/chatbot/feedback/chatbot-message-feedback-form-guardrail.js.map +1 -1
- package/dist/components/chatbot/feedback/chatbot-message-feedback-form.d.ts.map +1 -1
- package/dist/components/chatbot/feedback/chatbot-message-feedback-form.js +1 -1
- package/dist/components/chatbot/feedback/chatbot-message-feedback-form.js.map +1 -1
- package/dist/components/chatbot/feedback/chatbot-message-feedback-popover.d.ts.map +1 -1
- package/dist/components/chatbot/feedback/chatbot-message-feedback-popover.js +2 -4
- package/dist/components/chatbot/feedback/chatbot-message-feedback-popover.js.map +1 -1
- package/dist/components/chatbot/feedback/chatbot-session-feedback-modal.d.ts.map +1 -1
- package/dist/components/chatbot/feedback/chatbot-session-feedback-modal.js +1 -2
- package/dist/components/chatbot/feedback/chatbot-session-feedback-modal.js.map +1 -1
- package/dist/components/chatbot/filters/__tests-cy__/chatbot-filters.test.d.ts +2 -0
- package/dist/components/chatbot/filters/__tests-cy__/chatbot-filters.test.d.ts.map +1 -0
- package/dist/components/chatbot/filters/__tests-cy__/chatbot-filters.test.js +6 -0
- package/dist/components/chatbot/filters/__tests-cy__/chatbot-filters.test.js.map +1 -0
- package/dist/components/chatbot/filters/chatbot-filter.js +1 -1
- package/dist/components/chatbot/filters/chatbot-filter.js.map +1 -1
- package/dist/components/chatbot/messages/__tests-cy__/chatbot-links.test.d.ts +2 -0
- package/dist/components/chatbot/messages/__tests-cy__/chatbot-links.test.d.ts.map +1 -0
- package/dist/components/chatbot/messages/__tests-cy__/chatbot-links.test.js +6 -0
- package/dist/components/chatbot/messages/__tests-cy__/chatbot-links.test.js.map +1 -0
- package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-answer-readonly.test.d.ts +2 -0
- package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-answer-readonly.test.d.ts.map +1 -0
- package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-answer-readonly.test.js +6 -0
- package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-answer-readonly.test.js.map +1 -0
- package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-answer.test.js +3 -82
- package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-answer.test.js.map +1 -1
- package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-typing.test.js +3 -54
- package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-typing.test.js.map +1 -1
- package/package.json +6 -6
- package/src/components/chatbot/__tests-cy__/chatbot-help-center.test.tsx +2 -206
- package/src/components/chatbot/__tests-cy__/chatbot-live.test.tsx +2 -128
- package/src/components/chatbot/__tests-cy__/chatbot-titan-chatbot.test.tsx +2 -202
- package/src/components/chatbot/__tests-cy__/chatbot.test.tsx +2 -197
- package/src/components/chatbot/chatbot.tsx +66 -63
- package/src/components/chatbot/dialog/__tests-cy__/chatbot-restart-dialog.test.tsx +6 -0
- package/src/components/chatbot/dialog/__tests-cy__/chatbot-restart-link.test.tsx +6 -0
- package/src/components/chatbot/dialog/chatbot-restart-dialog.tsx +1 -0
- package/src/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-form-guardrail.test.tsx +2 -85
- package/src/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-form.test.tsx +2 -127
- package/src/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-popover.test.tsx +6 -0
- package/src/components/chatbot/feedback/__tests-cy__/chatbot-session-feedback-modal.test.tsx +6 -0
- package/src/components/chatbot/feedback/chatbot-message-feedback-form-guardrail.tsx +1 -1
- package/src/components/chatbot/feedback/chatbot-message-feedback-form.tsx +1 -1
- package/src/components/chatbot/feedback/chatbot-message-feedback-popover.tsx +8 -5
- package/src/components/chatbot/feedback/chatbot-session-feedback-modal.tsx +1 -2
- package/src/components/chatbot/filters/__tests-cy__/chatbot-filters.test.tsx +6 -0
- package/src/components/chatbot/filters/chatbot-filter.tsx +1 -1
- package/src/components/chatbot/messages/__tests-cy__/chatbot-links.test.tsx +6 -0
- package/src/components/chatbot/messages/__tests-cy__/chatbot-message-answer-readonly.test.tsx +6 -0
- package/src/components/chatbot/messages/__tests-cy__/chatbot-message-answer.test.tsx +3 -107
- package/src/components/chatbot/messages/__tests-cy__/chatbot-message-typing.test.tsx +3 -68
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/stores/__tests__/message-feedback-guardrail.store.test.d.ts +0 -2
- package/dist/stores/__tests__/message-feedback-guardrail.store.test.d.ts.map +0 -1
- package/dist/stores/__tests__/message-feedback-guardrail.store.test.js +0 -49
- package/dist/stores/__tests__/message-feedback-guardrail.store.test.js.map +0 -1
- package/dist/stores/__tests__/message-feedback.store.test.d.ts +0 -2
- package/dist/stores/__tests__/message-feedback.store.test.d.ts.map +0 -1
- package/dist/stores/__tests__/message-feedback.store.test.js +0 -114
- package/dist/stores/__tests__/message-feedback.store.test.js.map +0 -1
- package/dist/stores/__tests__/session-feedback.store.test.d.ts +0 -2
- package/dist/stores/__tests__/session-feedback.store.test.d.ts.map +0 -1
- package/dist/stores/__tests__/session-feedback.store.test.js +0 -39
- package/dist/stores/__tests__/session-feedback.store.test.js.map +0 -1
- package/dist/stores/message-feedback-base.store.d.ts +0 -8
- package/dist/stores/message-feedback-base.store.d.ts.map +0 -1
- package/dist/stores/message-feedback-base.store.js +0 -2
- package/dist/stores/message-feedback-base.store.js.map +0 -1
- package/dist/stores/message-feedback-guardrail.store.d.ts +0 -16
- package/dist/stores/message-feedback-guardrail.store.d.ts.map +0 -1
- package/dist/stores/message-feedback-guardrail.store.js +0 -85
- package/dist/stores/message-feedback-guardrail.store.js.map +0 -1
- package/dist/stores/message-feedback.store.d.ts +0 -23
- package/dist/stores/message-feedback.store.d.ts.map +0 -1
- package/dist/stores/message-feedback.store.js +0 -145
- package/dist/stores/message-feedback.store.js.map +0 -1
- package/dist/stores/session-feedback.store.d.ts +0 -15
- package/dist/stores/session-feedback.store.d.ts.map +0 -1
- package/dist/stores/session-feedback.store.js +0 -75
- package/dist/stores/session-feedback.store.js.map +0 -1
- package/dist/utils/__tests__/axios-utils.test.d.ts +0 -2
- package/dist/utils/__tests__/axios-utils.test.d.ts.map +0 -1
- package/dist/utils/__tests__/axios-utils.test.js +0 -33
- package/dist/utils/__tests__/axios-utils.test.js.map +0 -1
- package/dist/utils/axios-utils.d.ts +0 -5
- package/dist/utils/axios-utils.d.ts.map +0 -1
- package/dist/utils/axios-utils.js +0 -23
- package/dist/utils/axios-utils.js.map +0 -1
- package/dist/utils/test-utils.d.ts +0 -5
- package/dist/utils/test-utils.d.ts.map +0 -1
- package/dist/utils/test-utils.js +0 -17
- package/dist/utils/test-utils.js.map +0 -1
- package/src/stores/__tests__/message-feedback-guardrail.store.test.ts +0 -61
- package/src/stores/__tests__/message-feedback.store.test.ts +0 -121
- package/src/stores/__tests__/session-feedback.store.test.ts +0 -47
- package/src/stores/message-feedback-base.store.ts +0 -8
- package/src/stores/message-feedback-guardrail.store.ts +0 -60
- package/src/stores/message-feedback.store.ts +0 -113
- package/src/stores/session-feedback.store.ts +0 -44
- package/src/utils/__tests__/axios-utils.test.ts +0 -40
- package/src/utils/axios-utils.ts +0 -25
- package/src/utils/test-utils.ts +0 -22
|
@@ -1,131 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Container, Provider, useDependencies } from '@servicetitan/react-ioc';
|
|
3
|
-
import {
|
|
4
|
-
CHATBOT_UI_STORE_TOKEN,
|
|
5
|
-
ChatbotUiStore,
|
|
6
|
-
IChatbotUiStore,
|
|
7
|
-
} from '@servicetitan/titan-chatbot-api';
|
|
8
|
-
import { ChatUiSelectors } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
9
|
-
import { mount } from 'cypress/react';
|
|
10
|
-
import { FC } from 'react';
|
|
11
|
-
import { MessageFeedbackStore } from '../../../../stores/message-feedback.store';
|
|
1
|
+
import { runChatbotMessageFeedbackFormSharedTests } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
12
2
|
import { ChatbotMessageFeedbackForm } from '../chatbot-message-feedback-form';
|
|
13
3
|
|
|
14
|
-
const initContainer = () => {
|
|
15
|
-
const rootContainer = new Container();
|
|
16
|
-
const container = new Container();
|
|
17
|
-
container.parent = rootContainer;
|
|
18
|
-
container.bind<IChatbotUiStore>(CHATBOT_UI_STORE_TOKEN).to(ChatbotUiStore).inSingletonScope();
|
|
19
|
-
container.bind<MessageFeedbackStore>(MessageFeedbackStore).toSelf().inSingletonScope();
|
|
20
|
-
return container;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
4
|
describe('[ChatbotMessageFeedbackForm]', () => {
|
|
24
|
-
|
|
25
|
-
let uiStore: ChatbotUiStore;
|
|
26
|
-
let messageFeedbackStore: MessageFeedbackStore;
|
|
27
|
-
|
|
28
|
-
beforeEach(() => {
|
|
29
|
-
container = initContainer();
|
|
30
|
-
uiStore = container.get<ChatbotUiStore>(CHATBOT_UI_STORE_TOKEN);
|
|
31
|
-
messageFeedbackStore = container.get<MessageFeedbackStore>(MessageFeedbackStore);
|
|
32
|
-
cy.viewport(780, 800);
|
|
33
|
-
cy.clock(Date.parse('2023-10-01T00:00:00Z'));
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const getFormError = () => ChatUiSelectors.chatbotMessageFeedback.find('.FormField__errorText');
|
|
37
|
-
const checkValid = () => {
|
|
38
|
-
cy.getCy('validator').click();
|
|
39
|
-
getFormError().should('not.exist');
|
|
40
|
-
};
|
|
41
|
-
const checkInvalid = () => {
|
|
42
|
-
cy.getCy('validator').click();
|
|
43
|
-
getFormError().should('be.visible');
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const render = () => {
|
|
47
|
-
const Wrapper: FC = () => {
|
|
48
|
-
const Validator: FC = () => {
|
|
49
|
-
const [formStore] = useDependencies(MessageFeedbackStore);
|
|
50
|
-
return (
|
|
51
|
-
<Button
|
|
52
|
-
className="m-t-3"
|
|
53
|
-
data-cy="validator"
|
|
54
|
-
onClick={() => formStore.formState.validate()}
|
|
55
|
-
>
|
|
56
|
-
Validate
|
|
57
|
-
</Button>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
return (
|
|
61
|
-
<Provider
|
|
62
|
-
singletons={[
|
|
63
|
-
{
|
|
64
|
-
provide: CHATBOT_UI_STORE_TOKEN,
|
|
65
|
-
useValue: uiStore,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
provide: MessageFeedbackStore,
|
|
69
|
-
useValue: messageFeedbackStore,
|
|
70
|
-
},
|
|
71
|
-
]}
|
|
72
|
-
>
|
|
73
|
-
<ChatbotMessageFeedbackForm />
|
|
74
|
-
<Validator />
|
|
75
|
-
</Provider>
|
|
76
|
-
);
|
|
77
|
-
};
|
|
78
|
-
mount(<Wrapper />);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
it('should render default state external', () => {
|
|
82
|
-
render();
|
|
83
|
-
|
|
84
|
-
// Default render
|
|
85
|
-
ChatUiSelectors.chatbotMessageFeedback.should('be.visible');
|
|
86
|
-
ChatUiSelectors.chatbotMessageFeedbackUnrelated.should('be.visible');
|
|
87
|
-
ChatUiSelectors.chatbotMessageFeedbackUnclear.should('be.visible');
|
|
88
|
-
ChatUiSelectors.chatbotMessageFeedbackNotFull.should('be.visible');
|
|
89
|
-
ChatUiSelectors.chatbotMessageFeedbackIncorrect.should('be.visible');
|
|
90
|
-
ChatUiSelectors.chatbotMessageFeedbackOther.should('be.visible');
|
|
91
|
-
ChatUiSelectors.chatbotMessageFeedbackOtherComment.should('not.exist');
|
|
92
|
-
checkValid();
|
|
93
|
-
|
|
94
|
-
// Click 'other' and check comment textarea
|
|
95
|
-
ChatUiSelectors.chatbotMessageFeedbackOther.click();
|
|
96
|
-
ChatUiSelectors.chatbotMessageFeedbackOtherComment
|
|
97
|
-
.should('be.visible')
|
|
98
|
-
.type('Test comment');
|
|
99
|
-
getFormError().should('not.exist');
|
|
100
|
-
checkValid();
|
|
101
|
-
|
|
102
|
-
ChatUiSelectors.chatbotMessageFeedbackOtherComment.clear().blur();
|
|
103
|
-
getFormError().should('be.visible').should('contain.text', 'Enter details.');
|
|
104
|
-
checkInvalid();
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('should render default state internal', () => {
|
|
108
|
-
uiStore.customizations.feedback = {
|
|
109
|
-
isCommentAlwaysRequired: true,
|
|
110
|
-
};
|
|
111
|
-
render();
|
|
112
|
-
|
|
113
|
-
// Default render
|
|
114
|
-
ChatUiSelectors.chatbotMessageFeedback.should('be.visible');
|
|
115
|
-
ChatUiSelectors.chatbotMessageFeedbackUnrelated.should('be.visible');
|
|
116
|
-
ChatUiSelectors.chatbotMessageFeedbackUnclear.should('be.visible');
|
|
117
|
-
ChatUiSelectors.chatbotMessageFeedbackNotFull.should('be.visible');
|
|
118
|
-
ChatUiSelectors.chatbotMessageFeedbackIncorrect.should('be.visible');
|
|
119
|
-
ChatUiSelectors.chatbotMessageFeedbackOther.should('be.visible');
|
|
120
|
-
ChatUiSelectors.chatbotMessageFeedbackOtherComment.should('be.visible');
|
|
121
|
-
checkInvalid();
|
|
122
|
-
|
|
123
|
-
// Don't click 'other' and check comment textarea: should be mandatory
|
|
124
|
-
ChatUiSelectors.chatbotMessageFeedbackOtherComment.focus().blur();
|
|
125
|
-
getFormError().should('be.visible').should('contain.text', 'Enter details.');
|
|
126
|
-
checkInvalid();
|
|
127
|
-
|
|
128
|
-
ChatUiSelectors.chatbotMessageFeedbackOtherComment.type('Test comment');
|
|
129
|
-
checkValid();
|
|
130
|
-
});
|
|
5
|
+
runChatbotMessageFeedbackFormSharedTests(ChatbotMessageFeedbackForm);
|
|
131
6
|
});
|
package/src/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-popover.test.tsx
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { runChatbotMessageFeedbackPopoverSharedTests } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
2
|
+
import { ChatbotMessageFeedbackPopover } from '../chatbot-message-feedback-popover';
|
|
3
|
+
|
|
4
|
+
describe('[ChatbotMessageFeedbackPopover]', () => {
|
|
5
|
+
runChatbotMessageFeedbackPopoverSharedTests(ChatbotMessageFeedbackPopover);
|
|
6
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { runChatbotSessionFeedbackModalSharedTests } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
2
|
+
import { ChatbotSessionFeedbackModal } from '../chatbot-session-feedback-modal';
|
|
3
|
+
|
|
4
|
+
describe('[ChatbotSessionFeedbackModal]', () => {
|
|
5
|
+
runChatbotSessionFeedbackModalSharedTests(ChatbotSessionFeedbackModal);
|
|
6
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Form, Stack } from '@servicetitan/design-system';
|
|
2
2
|
import { FormStateErrorBanner } from '@servicetitan/form';
|
|
3
3
|
import { useDependencies } from '@servicetitan/react-ioc';
|
|
4
|
+
import { MessageFeedbackGuardrailStore } from '@servicetitan/titan-chatbot-api';
|
|
4
5
|
import classNames from 'classnames';
|
|
5
6
|
import { observer } from 'mobx-react';
|
|
6
7
|
import { FC } from 'react';
|
|
7
|
-
import { MessageFeedbackGuardrailStore } from '../../../stores/message-feedback-guardrail.store';
|
|
8
8
|
import * as Styles from './chatbot-message-feedback-form.module.less';
|
|
9
9
|
|
|
10
10
|
export const ChatbotMessageFeedbackFormGuardrail: FC = observer(() => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BodyText, Form } from '@servicetitan/design-system';
|
|
2
2
|
import { useDependencies } from '@servicetitan/react-ioc';
|
|
3
|
+
import { MessageFeedbackStore } from '@servicetitan/titan-chatbot-api';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
5
|
import { observer } from 'mobx-react';
|
|
5
6
|
import { FC } from 'react';
|
|
6
|
-
import { MessageFeedbackStore } from '../../../stores/message-feedback.store';
|
|
7
7
|
import * as Styles from './chatbot-message-feedback-form.module.less';
|
|
8
8
|
|
|
9
9
|
export const ChatbotMessageFeedbackForm: FC = observer(() => {
|
|
@@ -11,13 +11,16 @@ import {
|
|
|
11
11
|
Stack,
|
|
12
12
|
} from '@servicetitan/design-system';
|
|
13
13
|
import { provide, useDependencies } from '@servicetitan/react-ioc';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
CHATBOT_UI_STORE_TOKEN,
|
|
16
|
+
IMessageFeedbackBaseStore,
|
|
17
|
+
MessageFeedbackGuardrailStore,
|
|
18
|
+
MessageFeedbackStore,
|
|
19
|
+
Models,
|
|
20
|
+
} from '@servicetitan/titan-chatbot-api';
|
|
15
21
|
import classNames from 'classnames';
|
|
16
22
|
import { observer } from 'mobx-react';
|
|
17
23
|
import { FC, useCallback, useState } from 'react';
|
|
18
|
-
import { IMessageFeedbackBaseStore } from '../../../stores/message-feedback-base.store';
|
|
19
|
-
import { MessageFeedbackGuardrailStore } from '../../../stores/message-feedback-guardrail.store';
|
|
20
|
-
import { MessageFeedbackStore } from '../../../stores/message-feedback.store';
|
|
21
24
|
import { ChatbotMessageFeedbackForm } from './chatbot-message-feedback-form';
|
|
22
25
|
import { ChatbotMessageFeedbackFormGuardrail } from './chatbot-message-feedback-form-guardrail';
|
|
23
26
|
import * as Styles from './chatbot-message-feedback-popover.module.less';
|
|
@@ -161,7 +164,7 @@ export const ChatbotMessageFeedbackPopover: FC<IChatbotMessageFeedbackProps> = p
|
|
|
161
164
|
<Headline size="small">
|
|
162
165
|
{isGuardrail
|
|
163
166
|
? 'Provide correct answer'
|
|
164
|
-
:
|
|
167
|
+
: "Why didn't this answer solve your problem?"}
|
|
165
168
|
</Headline>
|
|
166
169
|
</Stack>
|
|
167
170
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { BodyText, Button, ButtonGroup, Form, Modal, Stack } from '@servicetitan/design-system';
|
|
2
2
|
import { provide, useDependencies } from '@servicetitan/react-ioc';
|
|
3
|
-
import { CHATBOT_UI_STORE_TOKEN } from '@servicetitan/titan-chatbot-api';
|
|
3
|
+
import { CHATBOT_UI_STORE_TOKEN, SessionFeedbackStore } from '@servicetitan/titan-chatbot-api';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
5
|
import { FC, useCallback } from 'react';
|
|
6
|
-
import { SessionFeedbackStore } from '../../../stores/session-feedback.store';
|
|
7
6
|
|
|
8
7
|
export const ChatbotSessionFeedbackModal: FC<{ onClose: () => void }> = provide({
|
|
9
8
|
singletons: [SessionFeedbackStore],
|
|
@@ -23,7 +23,7 @@ export const ChatFilter: FC<IChatFilterProps> = observer(({ filter }: IChatFilte
|
|
|
23
23
|
const [open, setOpen] = useState(false);
|
|
24
24
|
const [listMaxHeight, setListMaxHeight] = useState(400);
|
|
25
25
|
const [{ filterStore }] = useDependencies(CHATBOT_UI_STORE_TOKEN);
|
|
26
|
-
const filterLabel = filterStore.getFilterLabel(filter.displayName ?? filter.key);
|
|
26
|
+
const filterLabel = filterStore.getFilterLabel(filter.displayName ?? filter.key).trim();
|
|
27
27
|
const triggerRef = useRef<HTMLDivElement>(null);
|
|
28
28
|
|
|
29
29
|
const allOptions = useMemo(() => {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { runChatbotMessageAnswerReadonlySharedTests } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
2
|
+
import { ChatbotMessageAnswerReadonly } from '../chatbot-message-answer-readonly';
|
|
3
|
+
|
|
4
|
+
describe('[ChatbotMessageAnswerReadonly]', () => {
|
|
5
|
+
runChatbotMessageAnswerReadonlySharedTests(ChatbotMessageAnswerReadonly);
|
|
6
|
+
});
|
|
@@ -1,110 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ChatMessageModelText, mockChatMessageModelText } from '@servicetitan/titan-chat-ui-common';
|
|
3
|
-
import {
|
|
4
|
-
CHATBOT_UI_STORE_TOKEN,
|
|
5
|
-
ChatbotUiStore,
|
|
6
|
-
Models,
|
|
7
|
-
ModelsMocks,
|
|
8
|
-
} from '@servicetitan/titan-chatbot-api';
|
|
9
|
-
import { ChatUiSelectors } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
10
|
-
import { mount } from 'cypress/react';
|
|
11
|
-
import { FC } from 'react';
|
|
1
|
+
import { runChatbotMessageAnswerSharedTests } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
12
2
|
import { ChatbotMessageAnswer } from '../chatbot-message-answer';
|
|
13
3
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
container.bind(CHATBOT_UI_STORE_TOKEN).to(ChatbotUiStore).inSingletonScope();
|
|
17
|
-
return container;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
describe('<ChatbotMessageAnswer />', () => {
|
|
21
|
-
let container: Container;
|
|
22
|
-
let uiStore: ChatbotUiStore;
|
|
23
|
-
|
|
24
|
-
beforeEach(() => {
|
|
25
|
-
container = initContainer();
|
|
26
|
-
uiStore = container.get<ChatbotUiStore>(CHATBOT_UI_STORE_TOKEN);
|
|
27
|
-
cy.viewport(780, 800);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const renderComponent = (message: ChatMessageModelText) => {
|
|
31
|
-
const Wrapper: FC = () => (
|
|
32
|
-
<Provider
|
|
33
|
-
singletons={[
|
|
34
|
-
{
|
|
35
|
-
provide: CHATBOT_UI_STORE_TOKEN,
|
|
36
|
-
useValue: uiStore,
|
|
37
|
-
},
|
|
38
|
-
]}
|
|
39
|
-
>
|
|
40
|
-
<ChatbotMessageAnswer message={message} />
|
|
41
|
-
</Provider>
|
|
42
|
-
);
|
|
43
|
-
mount(<Wrapper />);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
it('should render MultilineText and ChatbotLinks when chatbotMessageData exists', () => {
|
|
47
|
-
cy.clock();
|
|
48
|
-
cy.spy(uiStore, 'triggerScroll').as('triggerScroll');
|
|
49
|
-
const botMessage: Models.IBotMessage = ModelsMocks.mockBotMessage({
|
|
50
|
-
scoredUrls: ModelsMocks.mockScoredUrls(),
|
|
51
|
-
});
|
|
52
|
-
const message = mockChatMessageModelText(true, {
|
|
53
|
-
message: 'Test message',
|
|
54
|
-
data: botMessage,
|
|
55
|
-
});
|
|
56
|
-
uiStore.setMessages([message]);
|
|
57
|
-
|
|
58
|
-
renderComponent(message);
|
|
59
|
-
|
|
60
|
-
ChatUiSelectors.chatbotMessageAnswer.should('contain.text', 'Test message');
|
|
61
|
-
ChatUiSelectors.chatbotLinksLink.should('not.be.visible');
|
|
62
|
-
|
|
63
|
-
// Expand links
|
|
64
|
-
ChatUiSelectors.chatbotLinksMore
|
|
65
|
-
.should('be.visible')
|
|
66
|
-
.should('have.text', 'Learn more')
|
|
67
|
-
.click();
|
|
68
|
-
|
|
69
|
-
cy.tick(100);
|
|
70
|
-
cy.get('@triggerScroll').should('be.called');
|
|
71
|
-
ChatUiSelectors.chatbotLinksLink.should('be.visible').should('have.length', 2);
|
|
72
|
-
|
|
73
|
-
// Collapse links
|
|
74
|
-
ChatUiSelectors.chatbotLinksMore
|
|
75
|
-
.should('be.visible')
|
|
76
|
-
.should('have.text', 'Learn less')
|
|
77
|
-
.click();
|
|
78
|
-
|
|
79
|
-
cy.tick(100);
|
|
80
|
-
cy.get('@triggerScroll').should('be.called');
|
|
81
|
-
ChatUiSelectors.chatbotLinksLink.should('not.be.visible');
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('should not render ChatbotLinks when no links exist', () => {
|
|
85
|
-
const botMessage: Models.IBotMessage = ModelsMocks.mockBotMessage({
|
|
86
|
-
scoredUrls: [],
|
|
87
|
-
});
|
|
88
|
-
const message = mockChatMessageModelText(true, {
|
|
89
|
-
message: 'Test message',
|
|
90
|
-
data: botMessage,
|
|
91
|
-
});
|
|
92
|
-
renderComponent(message);
|
|
93
|
-
|
|
94
|
-
ChatUiSelectors.chatbotMessageAnswer.should('contain.text', 'Test message');
|
|
95
|
-
ChatUiSelectors.chatbotLinksMore.should('not.exist');
|
|
96
|
-
ChatUiSelectors.chatbotLinksLink.should('not.exist');
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('should not render ChatbotLinks when chatbotMessageData is undefined', () => {
|
|
100
|
-
const message = mockChatMessageModelText(true, {
|
|
101
|
-
message: 'Test message',
|
|
102
|
-
data: undefined,
|
|
103
|
-
});
|
|
104
|
-
renderComponent(message);
|
|
105
|
-
|
|
106
|
-
ChatUiSelectors.chatbotMessageAnswer.should('contain.text', 'Test message');
|
|
107
|
-
ChatUiSelectors.chatbotLinksMore.should('not.exist');
|
|
108
|
-
ChatUiSelectors.chatbotLinksLink.should('not.exist');
|
|
109
|
-
});
|
|
4
|
+
describe('[ChatbotMessageAnswer]', () => {
|
|
5
|
+
runChatbotMessageAnswerSharedTests(ChatbotMessageAnswer);
|
|
110
6
|
});
|
|
@@ -1,71 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ChatParticipantIcon } from '@servicetitan/titan-chat-ui-common';
|
|
3
|
-
import { ChatUiSelectors } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
4
|
-
import { mount } from 'cypress/react';
|
|
1
|
+
import { runChatbotMessageTypingSharedTests } from '@servicetitan/titan-chatbot-ui-cypress';
|
|
5
2
|
import { ChatbotMessageTyping } from '../chatbot-message-typing';
|
|
6
3
|
|
|
7
|
-
describe('ChatbotMessageTyping', () => {
|
|
8
|
-
|
|
9
|
-
const avatar: IMessageAvatarProps = {
|
|
10
|
-
name: 'Test User Name',
|
|
11
|
-
icon,
|
|
12
|
-
};
|
|
13
|
-
mount(<ChatbotMessageTyping avatar={avatar} />);
|
|
14
|
-
ChatUiSelectors.chatMessageTyping.should('be.visible');
|
|
15
|
-
ChatUiSelectors.chatMessageTypingDots.should('be.visible');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
it('should render message with bot icon', () => {
|
|
19
|
-
render(ChatParticipantIcon.Bot);
|
|
20
|
-
ChatUiSelectors.chatAvatarBot
|
|
21
|
-
.should('be.visible')
|
|
22
|
-
.invoke('css', 'background-image')
|
|
23
|
-
.then(bgColor => {
|
|
24
|
-
const isSvg = Boolean(
|
|
25
|
-
(bgColor as any as string).indexOf('data:image/svg+xml;base64') >= 0
|
|
26
|
-
);
|
|
27
|
-
expect(isSvg).to.eq(true);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should render message with empty icon', () => {
|
|
32
|
-
render(ChatParticipantIcon.Empty);
|
|
33
|
-
ChatUiSelectors.chatAvatarBot.should('not.exist');
|
|
34
|
-
ChatUiSelectors.chatAvatarInitials.should('not.exist');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('should render message with initials', () => {
|
|
38
|
-
render(ChatParticipantIcon.Initials);
|
|
39
|
-
ChatUiSelectors.chatAvatarInitials.should('be.visible').should('contain.text', 'TU');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('should show different messages during the time', () => {
|
|
43
|
-
cy.clock();
|
|
44
|
-
render(ChatParticipantIcon.Bot);
|
|
45
|
-
// Verify the rendered component + check the dots animation doesn't change over the time
|
|
46
|
-
ChatUiSelectors.chatMessageTypingDots.should('be.visible');
|
|
47
|
-
cy.tick(11000);
|
|
48
|
-
ChatUiSelectors.chatMessageContentAgent
|
|
49
|
-
.should('be.visible')
|
|
50
|
-
.should('contain.text', 'Looking for the final details');
|
|
51
|
-
|
|
52
|
-
ChatUiSelectors.chatMessageTypingDots.should('not.exist');
|
|
53
|
-
cy.tick(10000);
|
|
54
|
-
ChatUiSelectors.chatMessageContentAgent
|
|
55
|
-
.should('be.visible')
|
|
56
|
-
.should(
|
|
57
|
-
'contain.text',
|
|
58
|
-
'This is taking longer than usual, please give me a little bit more time'
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
ChatUiSelectors.chatMessageTypingDots.should('not.exist');
|
|
62
|
-
cy.tick(60000);
|
|
63
|
-
ChatUiSelectors.chatMessageContentAgent
|
|
64
|
-
.should('be.visible')
|
|
65
|
-
.should(
|
|
66
|
-
'contain.text',
|
|
67
|
-
'This is taking longer than usual, please give me a little bit more time'
|
|
68
|
-
);
|
|
69
|
-
ChatUiSelectors.chatMessageTypingDots.should('not.exist');
|
|
70
|
-
});
|
|
4
|
+
describe('[ChatbotMessageTyping]', () => {
|
|
5
|
+
runChatbotMessageTypingSharedTests(ChatbotMessageTyping);
|
|
71
6
|
});
|