11import { hooks } from 'botframework-webchat-api' ;
2- import { reactNode , validateProps } from 'botframework-webchat-react-valibot' ;
32import {
43 getOrgSchemaMessage ,
54 parseAction ,
65 type OrgSchemaAction ,
76 type WebChatActivity
87} from 'botframework-webchat-core' ;
8+ import { reactNode , validateProps } from 'botframework-webchat-react-valibot' ;
99import random from 'math-random' ;
1010import React , { memo , useCallback , useMemo , useRef , useState , type Dispatch , type SetStateAction } from 'react' ;
1111import { wrapWith } from 'react-wrap-with' ;
@@ -19,6 +19,7 @@ import getDisclaimerFromFeedbackLoop from '../private/getDisclaimerFromFeedbackL
1919import hasFeedbackLoop from '../private/hasFeedbackLoop' ;
2020import ActivityFeedbackContext , { type ActivityFeedbackContextType } from './private/ActivityFeedbackContext' ;
2121import { ActivityFeedbackFocusPropagationScope , usePropagateActivityFeedbackFocus } from './private/FocusPropagation' ;
22+ import isActionRequireReview from '../private/isActionRequireReview' ;
2223
2324const { usePonyfill, usePostActivity } = hooks ;
2425
@@ -45,12 +46,10 @@ function ActivityFeedbackComposer(props: ActivityFeedbackComposerProps) {
4546 const [ { clearTimeout, setTimeout } ] = usePonyfill ( ) ;
4647 const [ feedbackText , setFeedbackText , feedbackTextRef ] = useStateWithRef < string | undefined > ( ) ;
4748
48- const isFeedbackLoopEnabled = useMemo ( ( ) => hasFeedbackLoop ( activityFromProps ) , [ activityFromProps ] ) ;
49-
5049 const activity : WebChatActivity = useMemo (
5150 ( ) =>
5251 // Force enable feedback loop until service fixed their issue.
53- isFeedbackLoopEnabled
52+ hasFeedbackLoop ( activityFromProps )
5453 ? Object . freeze ( {
5554 ...activityFromProps ,
5655 entities : [
@@ -86,7 +85,7 @@ function ActivityFeedbackComposer(props: ActivityFeedbackComposerProps) {
8685 ]
8786 } )
8887 : activityFromProps ,
89- [ activityFromProps , isFeedbackLoopEnabled ]
88+ [ activityFromProps ]
9089 ) ;
9190
9291 const activityRef = useRefFrom ( activity ) ;
@@ -223,7 +222,7 @@ function ActivityFeedbackComposer(props: ActivityFeedbackComposerProps) {
223222 const isLegacyAction = action [ '@type' ] === 'VoteAction' ;
224223
225224 // TODO: We should update this to use W3C Hydra.1
226- if ( isFeedbackLoopEnabled ) {
225+ if ( isActionRequireReview ( action ) ) {
227226 postActivity ( {
228227 name : 'message/submitAction' ,
229228 replyToId : activityRef . current . id ,
@@ -244,15 +243,7 @@ function ActivityFeedbackComposer(props: ActivityFeedbackComposerProps) {
244243 } as any ) ;
245244 }
246245 } ,
247- [
248- actionsRef ,
249- actionStateRef ,
250- activityRef ,
251- feedbackTextRef ,
252- isFeedbackLoopEnabled ,
253- postActivity ,
254- setActionStateWithRefresh
255- ]
246+ [ actionsRef , actionStateRef , activityRef , feedbackTextRef , postActivity , setActionStateWithRefresh ]
256247 ) ;
257248
258249 const selectedAction = useMemo < OrgSchemaAction | undefined > (
0 commit comments