Skip to content

Commit c731e43

Browse files
committed
Revert "add option to hide feedbackform"
This reverts commit c39f110.
1 parent 4a91579 commit c731e43

6 files changed

Lines changed: 114 additions & 195 deletions

File tree

Lines changed: 111 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,132 @@
11
<!doctype html>
22
<html lang="en-US">
3-
<head>
4-
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5-
<script crossorigin="anonymous" src="https://unpkg.com/@babel/standalone@7.8.7/babel.min.js"></script>
6-
<script crossorigin="anonymous" src="https://unpkg.com/react@16.8.6/umd/react.production.min.js"></script>
7-
<script crossorigin="anonymous" src="https://unpkg.com/react-dom@16.8.6/umd/react-dom.production.min.js"></script>
8-
<script crossorigin="anonymous" src="/test-harness.js"></script>
9-
<script crossorigin="anonymous" src="/test-page-object.js"></script>
10-
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
11-
<script crossorigin="anonymous" src="/__dist__/botframework-webchat-fluent-theme.production.min.js"></script>
12-
</head>
13-
14-
<body>
15-
<main id="webchat"></main>
16-
<script type="text/babel">
17-
run(async function () {
18-
const {
19-
React,
20-
ReactDOM: { render },
21-
WebChat: { FluentThemeProvider, ReactWebChat }
22-
} = window; // Imports in UMD fashion.
23-
24-
const { directLine, store } = testHelpers.createDirectLineEmulator();
25-
26-
const App = () => <ReactWebChat directLine={directLine} store={store} />;
27-
28-
render(
29-
<FluentThemeProvider>
30-
<App />
31-
</FluentThemeProvider>,
32-
document.getElementById('webchat')
33-
);
34-
35-
await pageConditions.uiConnected();
36-
37-
await directLine.emulateIncomingActivity({
38-
type: 'message',
39-
id: 'a-00000',
40-
timestamp: 0,
41-
text: 'This is a test message to show feedback buttons',
42-
from: {
43-
role: 'bot'
44-
},
45-
locale: 'en-US',
46-
entities: [],
47-
channelData: {
48-
feedbackLoop: {
49-
type: 'default',
50-
disclaimer: 'This is a test disclaimer message'
51-
}
3+
4+
<head>
5+
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
6+
<script crossorigin="anonymous" src="https://unpkg.com/@babel/standalone@7.8.7/babel.min.js"></script>
7+
<script crossorigin="anonymous" src="https://unpkg.com/react@16.8.6/umd/react.production.min.js"></script>
8+
<script crossorigin="anonymous" src="https://unpkg.com/react-dom@16.8.6/umd/react-dom.production.min.js"></script>
9+
<script crossorigin="anonymous" src="/test-harness.js"></script>
10+
<script crossorigin="anonymous" src="/test-page-object.js"></script>
11+
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
12+
<script crossorigin="anonymous" src="/__dist__/botframework-webchat-fluent-theme.production.min.js"></script>
13+
</head>
14+
15+
<body>
16+
<main id="webchat"></main>
17+
<script type="text/babel">
18+
run(async function () {
19+
const {
20+
React,
21+
ReactDOM: { render },
22+
WebChat: { FluentThemeProvider, ReactWebChat }
23+
} = window; // Imports in UMD fashion.
24+
25+
const { directLine, store } = testHelpers.createDirectLineEmulator();
26+
27+
const App = () => <ReactWebChat directLine={directLine} store={store} />;
28+
29+
render(
30+
<FluentThemeProvider>
31+
<App />
32+
</FluentThemeProvider>,
33+
document.getElementById('webchat')
34+
);
35+
36+
await pageConditions.uiConnected();
37+
38+
await directLine.emulateIncomingActivity({
39+
type: 'message',
40+
id: 'a-00000',
41+
timestamp: 0,
42+
text: 'This is a test message to show feedback buttons',
43+
from: {
44+
role: 'bot'
45+
},
46+
locale: 'en-US',
47+
entities: [],
48+
channelData: {
49+
feedbackLoop: {
50+
type: 'default',
51+
disclaimer: 'This is a test disclaimer message'
5252
}
53-
});
53+
}
54+
});
5455

55-
await pageConditions.numActivitiesShown(1);
56+
await pageConditions.numActivitiesShown(1);
5657

57-
pageElements.byTestId('send box text area').focus();
58-
await host.sendShiftTab(2);
58+
pageElements.byTestId('send box text area').focus();
59+
await host.sendShiftTab(2);
5960

60-
await host.sendKeys('ENTER');
61-
await host.sendKeys('ENTER');
61+
await host.sendKeys('ENTER');
62+
await host.sendKeys('ENTER');
6263

63-
await host.snapshot('local');
64+
await host.snapshot('local');
6465

65-
// Dismiss like button
66-
await host.sendShiftTab(2);
67-
await host.sendKeys('ENTER');
66+
// Dismiss like button
67+
await host.sendShiftTab(2);
68+
await host.sendKeys('ENTER');
6869

69-
// Click like button
70-
await host.sendKeys('ENTER');
70+
// Click like button
71+
await host.sendKeys('ENTER');
7172

72-
await pageConditions.became(
73-
'feedback form is open',
74-
() => document.activeElement === pageElements.byTestId('feedback sendbox'),
75-
1000
76-
);
73+
await pageConditions.became(
74+
'feedback form is open',
75+
() => document.activeElement === pageElements.byTestId('feedback sendbox'),
76+
1000
77+
);
7778

78-
// Go to cancel button
79-
await host.sendTab(2);
80-
await host.sendKeys('ENTER');
79+
// Go to cancel button
80+
await host.sendTab(2);
81+
await host.sendKeys('ENTER');
8182

82-
await host.snapshot('local');
83+
await host.snapshot('local');
8384

84-
pageElements.byTestId('send box text area').focus();
85-
await host.sendShiftTab(2);
85+
pageElements.byTestId('send box text area').focus();
86+
await host.sendShiftTab(2);
8687

87-
await host.sendKeys('ENTER');
88-
// Send dislike
88+
await host.sendKeys('ENTER');
89+
// Send dislike
90+
await host.sendTab(1);
91+
await host.sendKeys('ENTER');
92+
93+
await pageConditions.became(
94+
'feedback form is open',
95+
() => document.activeElement === pageElements.byTestId('feedback sendbox'),
96+
1000
97+
);
98+
99+
await host.sendKeys('Test feedback');
100+
101+
await host.snapshot('local');
102+
103+
const { activity } = await directLine.actPostActivity(async () => {
89104
await host.sendTab(1);
90105
await host.sendKeys('ENTER');
106+
});
91107

92-
await pageConditions.became(
93-
'feedback form is open',
94-
() => document.activeElement === pageElements.byTestId('feedback sendbox'),
95-
1000
96-
);
97-
98-
await host.sendKeys('Test feedback');
99-
100-
await host.snapshot('local');
101-
102-
const { activity } = await directLine.actPostActivity(async () => {
103-
await host.sendTab(1);
104-
await host.sendKeys('ENTER');
105-
});
106-
107-
expect(activity).toEqual(
108-
expect.objectContaining({
109-
type: 'invoke',
110-
name: 'message/submitAction',
111-
value: {
112-
actionName: 'feedback',
113-
actionValue: {
114-
reaction: 'dislike',
115-
feedback: {
116-
feedbackText: 'Test feedback'
117-
}
108+
expect(activity).toEqual(
109+
expect.objectContaining({
110+
type: 'invoke',
111+
name: 'message/submitAction',
112+
value: {
113+
actionName: 'feedback',
114+
actionValue: {
115+
reaction: 'dislike',
116+
feedback: {
117+
feedbackText: 'Test feedback'
118118
}
119119
}
120-
})
121-
);
120+
}
121+
})
122+
);
122123

123-
await expect(pageElements.byTestId('feedback sendbox')).toBeFalsy();
124+
await expect(pageElements.byTestId('feedback sendbox')).toBeFalsy();
124125

125-
// Feedback button state should persist
126-
await host.snapshot('local');
127-
});
128-
</script>
129-
</body>
130-
</html>
126+
// Feedback button state should persist
127+
await host.snapshot('local');
128+
});
129+
</script>
130+
</body>
131+
132+
</html>

__tests__/html2/fluentTheme/feedbackform.hidden.html

Lines changed: 0 additions & 74 deletions
This file was deleted.
-15.3 KB
Binary file not shown.

packages/api/src/StyleOptions.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ type StyleOptions = {
932932
/**
933933
* (EXPERIMENTAL) Feedback buttons placement
934934
*
935-
* - `'activity-actions'` - place feedback buttons inside activity actions - Includes feedback form
935+
* - `'activity-actions'` - place feedback buttons inside activity actions - will show feedback form
936936
* - `'activity-status'` - place feedback buttons inside activity status
937937
*
938938
* @default 'activity-status'
@@ -943,13 +943,6 @@ type StyleOptions = {
943943
*/
944944
feedbackActionsPlacement?: 'activity-actions' | 'activity-status';
945945

946-
/**
947-
* Feedback form is on by default but can be hidden
948-
* @default false
949-
*
950-
*/
951-
hideFeedbackForm?: boolean;
952-
953946
/**
954947
* Use continuous mode for speech recognition. Default to `false`.
955948
*

packages/api/src/defaultStyleOptions.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,6 @@ const DEFAULT_OPTIONS: Required<StyleOptions> = {
308308

309309
feedbackActionsPlacement: 'activity-status' as const,
310310

311-
hideFeedbackForm: false,
312-
313311
// Speech recognition
314312
speechRecognitionContinuous: false
315313
};

packages/component/src/Activity/ActivityFeedback.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const defaultFeedbackEntities = {
4242
};
4343

4444
function ActivityFeedback({ activity }: ActivityFeedbackProps) {
45-
const [{ feedbackActionsPlacement, hideFeedbackForm }] = useStyleOptions();
45+
const [{ feedbackActionsPlacement }] = useStyleOptions();
4646
const [{ feedbackForm }] = useStyleSet();
4747

4848
const [selectedAction, setSelectedAction] = useState<OrgSchemaAction | undefined>();
@@ -138,7 +138,7 @@ function ActivityFeedback({ activity }: ActivityFeedbackProps) {
138138
[activity, handleFeedbackFormReset, selectedAction]
139139
);
140140

141-
if (!hideFeedbackForm && feedbackActionsPlacement === 'activity-actions' && isFeedbackLoopSupported) {
141+
if (feedbackActionsPlacement === 'activity-actions' && isFeedbackLoopSupported) {
142142
return (
143143
<div className={classNames('webchat__feedback-form__root-container', feedbackForm + '')}>
144144
<div className={classNames('webchat__feedback-form__root-container__child', feedbackForm + '')}>

0 commit comments

Comments
 (0)