import { recordTracksEvent } from '@automattic/calypso-analytics'; import { GetSupport } from '@automattic/odie-client/src/components/message/get-support'; import { useCanConnectToZendeskMessaging } from '@automattic/zendesk-client'; import { useI18n } from '@wordpress/react-i18n'; import { useState } from 'react'; import { useChatStatus } from '../hooks'; import { ThumbsDownIcon, ThumbsUpIcon } from '../icons/thumbs'; import './help-center-feedback-form.scss'; const HelpCenterFeedbackForm = ( { postId }: { postId: number } ) => { const { __ } = useI18n(); const [ startedFeedback, setStartedFeedback ] = useState< boolean | null >( null ); const [ answerValue, setAnswerValue ] = useState< number | null >( null ); const { isEligibleForChat, forceEmailSupport } = useChatStatus(); const { data: canConnectToZendesk } = useCanConnectToZendeskMessaging(); const handleFeedbackClick = ( value: number ) => { setStartedFeedback( true ); setAnswerValue( value ); recordTracksEvent( 'calypso_inlinehelp_article_feedback_click', { did_the_article_help: value === 1 ? 'yes' : 'no', post_id: postId, } ); }; const FeedbackButtons = () => { return ( <>
{ __( 'Was this helpful?', __i18n_text_domain__ ) }
{ __( 'Great! Thanks.', __i18n_text_domain__ ) }
) } { startedFeedback !== null && answerValue === 2 && ( <>{ __( 'Would you like to get support? Select an option below:', __i18n_text_domain__ ) }