diff --git a/src/app/components/FrostedGlassPromo/index.test.tsx b/src/app/components/FrostedGlassPromo/index.test.tsx index f7cfbdd48c2..83e6c53109d 100644 --- a/src/app/components/FrostedGlassPromo/index.test.tsx +++ b/src/app/components/FrostedGlassPromo/index.test.tsx @@ -1,13 +1,10 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { PropsWithChildren } from 'react'; - import { ToggleContextProvider } from '../../contexts/ToggleContext'; import { RequestContextProvider } from '../../contexts/RequestContext'; import { ServiceContextProvider } from '../../contexts/ServiceContext'; - import { STORY_PAGE } from '../../routes/utils/pageTypes'; import makeRelativeUrlPath from '../../lib/utilities/makeRelativeUrlPath'; -import * as clickTracking from '../../hooks/useClickTrackerHandler'; import { render } from '../react-testing-library-with-providers'; import { Services, Variants } from '../../models/types/global'; @@ -185,18 +182,8 @@ describe('Frosted Glass Promo', () => { expect(container).toBeEmptyDOMElement(); }); - // Only expecting clicks to be emitted from here - view tracking is handled at + // Expects view tracking to be handled at // the list level - eg containers/CpsFeatureAnalysis - it('should track clicks', () => { - const clickTrackerSpy = jest.spyOn(clickTracking, 'default'); - render(); - - expect(clickTrackerSpy).toHaveBeenCalledWith({ - componentName: 'features', - url: cpsPromoFixture.item.locators.assetUri, - }); - }); - it('should render lazyload component for frosted glass section', () => { const { getByTestId } = render( , diff --git a/src/app/components/FrostedGlassPromo/index.tsx b/src/app/components/FrostedGlassPromo/index.tsx index 4a6e4fae8c1..ed2eea6ac21 100644 --- a/src/app/components/FrostedGlassPromo/index.tsx +++ b/src/app/components/FrostedGlassPromo/index.tsx @@ -4,18 +4,15 @@ import type { ReactNode } from 'react'; import { PropsWithChildren, use } from 'react'; import pick from 'ramda/src/pick'; import Lazyload from 'react-lazyload'; - import IMAGE from '../Image'; import makeRelativeUrlPath from '../../lib/utilities/makeRelativeUrlPath'; -import useClickTrackerHandler from '../../hooks/useClickTrackerHandler'; import { RequestContext } from '../../contexts/RequestContext'; - import FrostedGlassPanel from './FrostedGlassPanel'; import withData from './withData'; - import styles from './styles'; import { EventTrackingBlock } from '../../models/types/eventTracking'; import { PromoProps } from './types'; +import Link from '../Link'; const PANEL_OFFSET = 250; @@ -54,15 +51,15 @@ const FrostedGlassPromo = ({ const isCanonical = !isAmp; const relativeUrl = makeRelativeUrlPath(url); - const clickTracker = useClickTrackerHandler({ + const eventTrackingInfo = { ...(eventTrackingData || {}), url: relativeUrl, - }); + }; const promoText = ( <>

- [ styles.anchor, { @@ -74,10 +71,10 @@ const FrostedGlassPromo = ({ }, ]} href={relativeUrl} - {...(eventTrackingData && clickTracker)} + eventTrackingData={eventTrackingInfo} > {children} - +

{footer} @@ -88,10 +85,10 @@ const FrostedGlassPromo = ({ /* eslint-disable react/self-closing-comp */ return (
-