File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed
Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change 1- <!DOCTYPE html>
1+ <!doctype html>
22< html lang ="en-US ">
33 < head >
44 < link href ="/assets/index.css " rel ="stylesheet " type ="text/css " />
1515 < script type ="text/babel " data-presets ="env,stage-3,react ">
1616 const {
1717 WebChat : {
18- Components : { HeroCardContent }
18+ Components : { HeroCardContent } ,
19+ hooks : { useActivities }
1920 }
2021 } = window ;
2122
2223 run ( async function ( ) {
2324 const store = testHelpers . createStore ( ) ;
2425 const directLine = WebChat . createDirectLine ( { token : await testHelpers . token . fetchDirectLineToken ( ) } ) ;
2526
27+ const AutoDisableHeroCardContent = ( { activity, attachment } ) => {
28+ const [ activities ] = useActivities ( ) ;
29+ const messageActivities = activities . filter ( activity => activity . type === 'message' ) ;
30+ const isMostRecentMessageActivity = messageActivities . pop ( ) === activity ;
31+
32+ return (
33+ < HeroCardContent
34+ actionPerformedClassName = "card__action--performed"
35+ content = { attachment . content }
36+ disabled = { ! isMostRecentMessageActivity }
37+ />
38+ ) ;
39+ } ;
40+
2641 WebChat . renderWebChat (
2742 {
2843 attachmentMiddleware :
3550 const mostRecent = messageActivities . pop ( ) === activity ;
3651
3752 if ( attachment . contentType === 'application/vnd.microsoft.card.hero' ) {
38- return (
39- < HeroCardContent
40- actionPerformedClassName = "card__action--performed"
41- content = { attachment . content }
42- disabled = { ! mostRecent }
43- />
44- ) ;
53+ return < AutoDisableHeroCardContent activity = { activity } attachment = { attachment } /> ;
4554 }
4655
4756 return next ( ...args ) ;
You can’t perform that action at this time.
0 commit comments