@@ -12,9 +12,11 @@ import {
1212 Flex ,
1313} from '@chakra-ui/react'
1414import { IconButton } from '@opengovsg/design-system-react'
15+ import { Rating } from 'lens-widget'
1516
1617import FlowStep from '@/components/FlowStep'
1718import FlowStepGroup from '@/components/FlowStepGroup'
19+ import appConfig from '@/config/app'
1820import { EditorContext } from '@/contexts/Editor'
1921import {
2022 StepExecutionsToIncludeContext ,
@@ -24,6 +26,7 @@ import { CREATE_STEP } from '@/graphql/mutations/create-step'
2426import { UPDATE_STEP } from '@/graphql/mutations/update-step'
2527import { GET_APPS } from '@/graphql/queries/get-apps'
2628import { GET_FLOW } from '@/graphql/queries/get-flow'
29+ import useAuthentication from '@/hooks/useAuthentication'
2730
2831interface AddStepButtonProps {
2932 onClick : ( ) => void
@@ -97,6 +100,9 @@ export default function Editor(props: EditorProps): React.ReactElement {
97100 )
98101
99102 const { flow, steps : rawSteps } = props
103+ const showSurvey = flow . active && flow . config ?. showSurvey
104+ const { currentUser } = useAuthentication ( )
105+
100106 const steps = useMemo (
101107 // Populate each step's flowId so that IStep isn't LYING about flowId being
102108 // non-undefined. We do it here instead of fetching in GraphQL since all
@@ -294,6 +300,18 @@ export default function Editor(props: EditorProps): React.ReactElement {
294300 ) }
295301 </ StepExecutionsToIncludeProvider >
296302 </ Flex >
303+
304+ { showSurvey && (
305+ < Rating
306+ clientKey = { appConfig . lensSurveyClientKey }
307+ brandColour = "#cf1a68"
308+ attributes = { [
309+ `FlowId: ${ flow . id } ` ,
310+ `UserEmail: ${ currentUser ?. email } ` ,
311+ ...( appConfig . env !== 'prod' ? [ `Env: ${ appConfig . env } ` ] : [ ] ) ,
312+ ] }
313+ />
314+ ) }
297315 </ Flex >
298316 )
299317}
0 commit comments