Skip to content

Commit 4df27b8

Browse files
OEvgenycompulim
andauthored
Fluent: allow displaying feedback inside activity actions toolbar (#5407)
* Fluent: allow displaying feedback inside activity actions toolbar * Snapshots --------- Co-authored-by: William Wong <compulim@users.noreply.github.com>
1 parent cf2b542 commit 4df27b8

File tree

64 files changed

+907
-133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+907
-133
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
7474
- Added support for math blocks using `$$` delimiter alongside existing `\[...\]` and `\(...\)` notations, in PR [#5381](https://github.com/microsoft/BotFramework-WebChat/pull/5381), by [@OEvgeny](https://github.com/OEvgeny)
7575
- Added support for speech recognition initial silence timeout when using Azure Speech, in PR [#5400](https://github.com/microsoft/BotFramework/WebChat/pull/5400), by [@compulim](https://github.com/compulim)
7676
- Introduced syntax highlighting for markdown code blocks, in PR [#5389](https://github.com/microsoft/BotFramework-WebChat/pull/5389), by [@OEvgeny](https://github.com/OEvgeny)
77+
- (Experimental) Added `feedbackActionsPlacement` style option to control feedback button placement, in PR [#5407](https://github.com/microsoft/BotFramework-WebChat/pull/5407), by [@OEvgeny](https://github.com/OEvgeny)
78+
- New style option supports two values: `'activity-actions'` and `'activity-status'` (default)
79+
- When set to `'activity-actions'`, feedback buttons are displayed in the activity actions toolbar
80+
- When set to `'activity-status'`, feedback buttons appear in the activity status area (default behavior)
7781

7882
### Changed
7983

__tests__/html/assets/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ body {
2121
width: 360px;
2222
}
2323

24+
.webchat__tooltip {
25+
transition-duration: 0.01ms !important;
26+
}
27+
2428
body.jest input,
2529
body.jest textarea,
2630
body.jest [contenteditable] {

__tests__/html/fluentTheme/side-by-side.wide.dark.html

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,91 @@
612612
613613
$ pip install numpy matplotlib`
614614
}
615+
], [
616+
{
617+
from:{
618+
role: "bot"
619+
},
620+
id: "a-00000",
621+
type: "message",
622+
text: "This is compleded feedback action example.",
623+
timestamp: timestamp(),
624+
entities: [
625+
{
626+
...aiMessageEntity,
627+
keywords: ['AIGeneratedContent', 'AllowCopy'],
628+
potentialAction: [
629+
{
630+
"@type": "LikeAction",
631+
actionStatus: "CompletedActionStatus",
632+
target: {
633+
"@type": "EntryPoint",
634+
urlTemplate: "ms-directline://postback?interaction=like"
635+
}
636+
},
637+
{
638+
"@type": "DislikeAction",
639+
actionStatus: "PotentialActionStatus",
640+
result: {
641+
"@type": "Review",
642+
reviewBody: "I don't like it.",
643+
"reviewBody-input": {
644+
"@type": "PropertyValueSpecification",
645+
valueMinLength: 3,
646+
valueName: "reason"
647+
}
648+
},
649+
target: {
650+
"@type": "EntryPoint",
651+
urlTemplate: "ms-directline://postback?interaction=dislike{&reason}"
652+
}
653+
}
654+
]
655+
}
656+
]
657+
},
658+
{
659+
from:{
660+
role: "bot"
661+
},
662+
id: "a-00001",
663+
type: "message",
664+
text: "Hi! I'm Cody, the devbot. How can I help?",
665+
timestamp: timestamp(),
666+
entities: [
667+
{
668+
...aiMessageEntity,
669+
keywords: ['AIGeneratedContent', 'AllowCopy'],
670+
potentialAction: [
671+
{
672+
"@type": "LikeAction",
673+
actionStatus: "PotentialActionStatus",
674+
target: {
675+
"@type": "EntryPoint",
676+
urlTemplate: "ms-directline://postback?interaction=like"
677+
}
678+
},
679+
{
680+
"@type": "DislikeAction",
681+
actionStatus: "PotentialActionStatus",
682+
result: {
683+
"@type": "Review",
684+
reviewBody: "I don't like it.",
685+
"reviewBody-input": {
686+
"@type": "PropertyValueSpecification",
687+
valueMinLength: 3,
688+
valueName: "reason"
689+
}
690+
},
691+
target: {
692+
"@type": "EntryPoint",
693+
urlTemplate: "ms-directline://postback?interaction=dislike{&reason}"
694+
}
695+
}
696+
]
697+
}
698+
]
699+
}
615700
]];
616701

617702
const leftStore = testHelpers.createStore();
@@ -726,6 +811,24 @@
726811
await host.snapshot();
727812
await host.sendKeys('ENTER');
728813
await host.snapshot();
814+
},
815+
likeDislike: async sendbox => {
816+
sendbox.focus();
817+
await host.sendShiftTab();
818+
await host.sendKeys('ARROW_UP');
819+
await host.sendKeys('ENTER');
820+
await host.snapshot();
821+
await host.sendKeys('TAB');
822+
await host.snapshot();
823+
await host.sendKeys('ENTER');
824+
await host.snapshot();
825+
await host.sendKeys('TAB');
826+
await host.snapshot();
827+
await host.sendKeys('ENTER');
828+
await host.snapshot();
829+
await host.sendKeys('ESCAPE');
830+
await host.sendKeys('ESCAPE');
831+
await host.snapshot();
729832
}
730833
}));
731834

__tests__/html/fluentTheme/side-by-side.wide.dark.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ describe('Fluent theme applied', () => {
1717
test('side by side left - transcript, right - codeblock', () =>
1818
runHTML('fluentTheme/side-by-side.wide.dark?transcript=0&transcript=5&focus=1&focus-preset=viewCode'));
1919
test('side by side left - transcript, right - codeblock dark', () =>
20-
runHTML('fluentTheme/side-by-side.wide.dark?transcript=0&transcript=5&focus=1&focus-preset=viewCode&codeBlockTheme=github-dark-default'));
20+
runHTML(
21+
'fluentTheme/side-by-side.wide.dark?transcript=0&transcript=5&focus=1&focus-preset=viewCode&codeBlockTheme=github-dark-default'
22+
));
23+
test('side by side left - transcript, right - feedback', () =>
24+
runHTML('fluentTheme/side-by-side.wide.dark?transcript=0&transcript=6&focus=1&focus-preset=likeDislike'));
2125
});
2226
});

__tests__/html/fluentTheme/side-by-side.wide.html

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,91 @@
622622
623623
$ pip install numpy matplotlib`
624624
}
625+
], [
626+
{
627+
from:{
628+
role: "bot"
629+
},
630+
id: "a-00000",
631+
type: "message",
632+
text: "This is compleded feedback action example.",
633+
timestamp: timestamp(),
634+
entities: [
635+
{
636+
...aiMessageEntity,
637+
keywords: ['AIGeneratedContent', 'AllowCopy'],
638+
potentialAction: [
639+
{
640+
"@type": "LikeAction",
641+
actionStatus: "CompletedActionStatus",
642+
target: {
643+
"@type": "EntryPoint",
644+
urlTemplate: "ms-directline://postback?interaction=like"
645+
}
646+
},
647+
{
648+
"@type": "DislikeAction",
649+
actionStatus: "PotentialActionStatus",
650+
result: {
651+
"@type": "Review",
652+
reviewBody: "I don't like it.",
653+
"reviewBody-input": {
654+
"@type": "PropertyValueSpecification",
655+
valueMinLength: 3,
656+
valueName: "reason"
657+
}
658+
},
659+
target: {
660+
"@type": "EntryPoint",
661+
urlTemplate: "ms-directline://postback?interaction=dislike{&reason}"
662+
}
663+
}
664+
]
665+
}
666+
]
667+
},
668+
{
669+
from:{
670+
role: "bot"
671+
},
672+
id: "a-00001",
673+
type: "message",
674+
text: "Hi! I'm Cody, the devbot. How can I help?",
675+
timestamp: timestamp(),
676+
entities: [
677+
{
678+
...aiMessageEntity,
679+
keywords: ['AIGeneratedContent', 'AllowCopy'],
680+
potentialAction: [
681+
{
682+
"@type": "LikeAction",
683+
actionStatus: "PotentialActionStatus",
684+
target: {
685+
"@type": "EntryPoint",
686+
urlTemplate: "ms-directline://postback?interaction=like"
687+
}
688+
},
689+
{
690+
"@type": "DislikeAction",
691+
actionStatus: "PotentialActionStatus",
692+
result: {
693+
"@type": "Review",
694+
reviewBody: "I don't like it.",
695+
"reviewBody-input": {
696+
"@type": "PropertyValueSpecification",
697+
valueMinLength: 3,
698+
valueName: "reason"
699+
}
700+
},
701+
target: {
702+
"@type": "EntryPoint",
703+
urlTemplate: "ms-directline://postback?interaction=dislike{&reason}"
704+
}
705+
}
706+
]
707+
}
708+
]
709+
}
625710
]];
626711

627712
const leftStore = testHelpers.createStore();
@@ -709,6 +794,24 @@
709794
await host.snapshot();
710795
await host.sendKeys('ENTER');
711796
await host.snapshot();
797+
},
798+
likeDislike: async sendbox => {
799+
sendbox.focus();
800+
await host.sendShiftTab();
801+
await host.sendKeys('ARROW_UP');
802+
await host.sendKeys('ENTER');
803+
await host.snapshot();
804+
await host.sendKeys('TAB');
805+
await host.snapshot();
806+
await host.sendKeys('ENTER');
807+
await host.snapshot();
808+
await host.sendKeys('TAB');
809+
await host.snapshot();
810+
await host.sendKeys('ENTER');
811+
await host.snapshot();
812+
await host.sendKeys('ESCAPE');
813+
await host.sendKeys('ESCAPE');
814+
await host.snapshot();
712815
}
713816
}));
714817

__tests__/html/fluentTheme/side-by-side.wide.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,9 @@ describe('Fluent theme applied', () => {
1616
test('side by side left - transcript, right - codeblock', () =>
1717
runHTML('fluentTheme/side-by-side.wide?transcript=0&transcript=5&focus=1&focus-preset=viewCode'));
1818
test('side by side left - transcript, right - codeblock dark', () =>
19-
runHTML('fluentTheme/side-by-side.wide?transcript=0&transcript=5&focus=1&focus-preset=viewCode&codeBlockTheme=github-dark-default'));
19+
runHTML(
20+
'fluentTheme/side-by-side.wide?transcript=0&transcript=5&focus=1&focus-preset=viewCode&codeBlockTheme=github-dark-default'
21+
));
22+
test('side by side left - transcript, right - feedback', () =>
23+
runHTML('fluentTheme/side-by-side.wide?transcript=0&transcript=6&focus=1&focus-preset=likeDislike'));
2024
});

0 commit comments

Comments
 (0)