@@ -3,8 +3,10 @@ import { space } from '@guardian/source/foundations';
33import type { IconProps } from '@guardian/source/react-components' ;
44import type { Dispatch , SetStateAction , SyntheticEvent } from 'react' ;
55import { forwardRef } from 'react' ;
6+ import { submitClickComponentEvent } from '../client/ophan/ophan' ;
67import { palette } from '../palette' ;
78import { narrowPlayIconWidth , PlayIcon } from './Card/components/PlayIcon' ;
9+ import { useConfig } from './ConfigContext' ;
810import { LoopVideoProgressBar } from './LoopVideoProgressBar' ;
911
1012const videoStyles = ( width : number , height : number ) => css `
@@ -113,6 +115,7 @@ export const LoopVideoPlayer = forwardRef(
113115 ) => {
114116 // Assumes that the video is unique on the page.
115117 const loopVideoId = `loop-video-${ videoId } ` ;
118+ const { renderingTarget } = useConfig ( ) ;
116119
117120 return (
118121 < >
@@ -161,14 +164,10 @@ export const LoopVideoPlayer = forwardRef(
161164 < button
162165 type = "button"
163166 onClick = { ( event ) => {
164- if (
165- window . guardian ?. ophan
166- ?. trackClickComponentEvent
167- ) {
168- window . guardian . ophan . trackClickComponentEvent (
169- event . currentTarget ,
170- ) ;
171- }
167+ void submitClickComponentEvent (
168+ event . currentTarget ,
169+ renderingTarget ,
170+ ) ;
172171 handleClick ( event ) ;
173172 } }
174173 css = { playIconStyles }
@@ -187,14 +186,10 @@ export const LoopVideoPlayer = forwardRef(
187186 < button
188187 type = "button"
189188 onClick = { ( event ) => {
190- if (
191- window . guardian ?. ophan
192- ?. trackClickComponentEvent
193- ) {
194- window . guardian . ophan . trackClickComponentEvent (
195- event . currentTarget ,
196- ) ;
197- }
189+ void submitClickComponentEvent (
190+ event . currentTarget ,
191+ renderingTarget ,
192+ ) ;
198193 event . stopPropagation ( ) ; // Don't pause the video
199194 setIsMuted ( ! isMuted ) ;
200195 } }
0 commit comments