WS-TRANSCRIPT: Adds transcript component#13716
WS-TRANSCRIPT: Adds transcript component#13716Isabella-Mitchell wants to merge 15 commits intolatestfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Transcript component (with view/click tracking) and wires it into MediaLoader so transcripts can render both on canonical pages and Lite pages, along with supporting fixtures/stories/tests and updated integration snapshots.
Changes:
- Introduces
TranscriptUI (details/summary + timestamped items) with tracking for default/open/end states. - Updates
MediaLoaderto detect transcript blocks and render transcript (including Lite-site rendering path). - Adds service translation typing + Mundo service copy, plus supporting fixtures/stories/tests and snapshot/bundle-size updates.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| ws-nextjs-app/integration/pages/onDemandAudioPage/pashtoBrand/snapshots/canonical.test.ts.snap | Snapshot update due to media loader styling/classname changes. |
| ws-nextjs-app/integration/pages/onDemandAudioPage/pashto/snapshots/canonical.test.ts.snap | Snapshot update due to media loader styling/classname changes. |
| ws-nextjs-app/integration/pages/onDemandAudioPage/indonesia/snapshots/canonical.test.ts.snap | Snapshot update due to media loader styling/classname changes. |
| ws-nextjs-app/integration/pages/live/pidgin/snapshots/canonical.test.ts.snap | Snapshot update due to media loader + caption styling/classname changes. |
| ws-nextjs-app/integration/pages/av-embeds/russian/snapshots/canonical.test.ts.snap | Snapshot update due to media loader styling/classname changes. |
| ws-nextjs-app/integration/pages/articles/persianMediaPlayer/snapshots/canonical.test.ts.snap | Snapshot update due to media loader + caption styling/classname changes. |
| ws-nextjs-app/integration/pages/articles/afrique/snapshots/canonical.test.ts.snap | Snapshot update due to media loader + caption styling/classname changes. |
| src/integration/pages/podcastPage/portugueseEpisode/snapshots/canonical.test.js.snap | Snapshot update due to media loader styling/classname changes. |
| src/integration/pages/podcastPage/portugueseBrand/snapshots/canonical.test.js.snap | Snapshot update due to media loader styling/classname changes. |
| src/integration/pages/onDemandTVPage/pashtoBrand/snapshots/canonical.test.js.snap | Snapshot update due to media loader styling/classname changes. |
| src/integration/pages/onDemandTVPage/hausa/snapshots/canonical.test.js.snap | Snapshot update due to media loader styling/classname changes. |
| src/integration/pages/liveRadio/kyrgyz/snapshots/canonical.test.js.snap | Snapshot update due to media loader styling/classname changes. |
| src/integration/pages/liveRadio/korean/snapshots/canonical.test.js.snap | Snapshot update due to media loader styling/classname changes. |
| src/integration/pages/liveRadio/gahuza/snapshots/canonical.test.js.snap | Snapshot update due to media loader styling/classname changes. |
| src/app/pages/ArticlePage/index.stories.tsx | Adds an ArticlePage story using new transcript fixture data. |
| src/app/models/types/translations.ts | Adds a transcript translations shape to the shared Translations type. |
| src/app/lib/config/services/mundo.ts | Adds Mundo transcript translation strings. |
| src/app/components/icons/index.tsx | Adds a right-arrow SVG used by the transcript summary. |
| src/app/components/Transcript/types.ts | Introduces transcript block/item TS types. |
| src/app/components/Transcript/metadata.json | Adds component metadata (a11y/AC references). |
| src/app/components/Transcript/index.tsx | New Transcript component with tracking and rendering logic. |
| src/app/components/Transcript/index.test.tsx | Unit tests for transcript rendering + tracking hook usage. |
| src/app/components/Transcript/index.styles.ts | Transcript Emotion styles. |
| src/app/components/Transcript/index.stories.tsx | Storybook stories for transcript on different page types. |
| src/app/components/Transcript/fixture.json | Transcript fixture data for stories/tests. |
| src/app/components/Transcript/TranscriptTimestamp/index.tsx | Timestamp subcomponent. |
| src/app/components/Transcript/TranscriptTimestamp/index.styles.ts | Timestamp subcomponent styles. |
| src/app/components/Transcript/README.md | Transcript component documentation. |
| src/app/components/MediaLoader/utils/getTranscriptBlock/index.ts | Utility to extract transcript block from media blocks. |
| src/app/components/MediaLoader/utils/getTranscriptBlock/index.test.ts | Tests for transcript block extraction. |
| src/app/components/MediaLoader/utils/getTitleForLiteSiteTranscriptBlock/index.ts | Utility to find media title for Lite transcript rendering. |
| src/app/components/MediaLoader/utils/getTitleForLiteSiteTranscriptBlock/index.test.ts | Tests for Lite transcript title extraction. |
| src/app/components/MediaLoader/types.ts | Updates MediaLoader types to account for transcript-related data. |
| src/app/components/MediaLoader/index.tsx | Renders Transcript from MediaLoader (including Lite path) and applies transcript-specific styles. |
| src/app/components/MediaLoader/index.test.tsx | Adds MediaLoader tests verifying transcript renders (canonical + Lite). |
| src/app/components/MediaLoader/index.styles.ts | Adds styles used when transcript is present (figure/caption tweaks). |
| src/app/components/MediaLoader/index.stories.tsx | Adds a MediaLoader story exercising transcript rendering. |
| src/app/components/MediaLoader/fixture.ts | Adds fixture blocks array including transcript block. |
| scripts/bundleSize/bundleSizeConfig.js | Updates expected bundle size bounds. |
| data/mundo/articles/cle16n19nd9o.json | Adds Mundo article fixture data containing a transcript block. |
| readTranscript: 'Read transcript', | ||
| disclaimer: | ||
| ' This transcript has been reviewed by a journalist, it was generated with AI (Artificial Intelligence).', |
There was a problem hiding this comment.
The new transcript translations in the Mundo service config are in English, and the disclaimer string starts with a leading space. This will render incorrect UI copy for mundo (Spanish) and may cause awkward spacing. Please provide Spanish translations here and remove the leading whitespace.
| readTranscript: 'Read transcript', | |
| disclaimer: | |
| ' This transcript has been reviewed by a journalist, it was generated with AI (Artificial Intelligence).', | |
| readTranscript: 'Leer transcripción', | |
| disclaimer: | |
| 'Esta transcripción ha sido revisada por una persona periodista y fue generada con IA (inteligencia artificial).', |
| <img | ||
| {...viewTrackerForTranscriptEnd} | ||
| height="1px" | ||
| width="1px" | ||
| alt="" | ||
| style={{ position: 'absolute' }} |
There was a problem hiding this comment.
The tracking sentinel at the end of the component renders an <img> without a src. In browsers this is invalid HTML and can trigger console warnings or unintended requests. Consider using a non-image element (e.g. div/span) for the IntersectionObserver target, or provide an explicit src if an image is required.
| <img | |
| {...viewTrackerForTranscriptEnd} | |
| height="1px" | |
| width="1px" | |
| alt="" | |
| style={{ position: 'absolute' }} | |
| <span | |
| {...viewTrackerForTranscriptEnd} | |
| aria-hidden="true" | |
| style={{ position: 'absolute', width: '1px', height: '1px' }} |
| ## Example | ||
|
|
||
| ```tsx | ||
| <Transcript transcript={transcriptBlock} title={mediaTitle} hideDisclaimer /> |
There was a problem hiding this comment.
The README example uses a hideDisclaimer prop, but the Transcript component currently only accepts transcript and optional title. This makes the docs misleading; either remove hideDisclaimer from the example or implement/support that prop.
| <Transcript transcript={transcriptBlock} title={mediaTitle} hideDisclaimer /> | |
| <Transcript transcript={transcriptBlock} title={mediaTitle} /> |
| type: 'aresMedia'; | ||
| model: { | ||
| blocks: [AresMediaMetadataBlock | OptimoImageBlock]; | ||
| blocks: [AresMediaMetadataBlock | OptimoImageBlock | TranscriptBlock]; |
There was a problem hiding this comment.
TranscriptBlock is being added to AresMediaBlock['model']['blocks'], but in the Ares/Optimo data shape the transcript block is a sibling of the aresMedia block (not nested inside it). To keep types accurate, add TranscriptBlock to the MediaBlock union instead (and keep AresMediaBlock.model.blocks limited to its actual child block types).
| blocks: [AresMediaMetadataBlock | OptimoImageBlock | TranscriptBlock]; | |
| blocks: [AresMediaMetadataBlock | OptimoImageBlock]; |
Resolves JIRA: WS-TRANSCRIPT (10% project). Notes to reviewers
Summary
Adds transcript component
This PR replaces the Transcript First Video PR: #12201. This PR was getting messy because it covers lots of non-MVP features. This PR also contains the view and click tracking here: #12251.
Code changes
Testing
Article Page
Media Loader
Transcript
Useful Links