Skip to content

Commit 16d58ea

Browse files
authored
Merge branch 'main' into jlk/new-ab-testing-definitions
2 parents 97fde55 + 095e662 commit 16d58ea

File tree

81 files changed

+1998
-1264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1998
-1264
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
/dotcom-rendering/src/client/userFeatures/ @guardian/supporter-revenue-stream
2121
/dotcom-rendering/src/components/AdBlock* @guardian/commercial-dev
2222
/dotcom-rendering/src/components/AdSlot* @guardian/commercial-dev
23+
/dotcom-rendering/src/components/Labs* @guardian/commercial-dev
2324
/dotcom-rendering/src/components/AdP* @guardian/commercial-dev
2425
/dotcom-rendering/src/components/marketing/ @guardian/growth
2526
/dotcom-rendering/src/server/ @guardian/dotcom-platform

apps-rendering/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
"@emotion/jest": "11.13.0",
4242
"@emotion/react": "11.14.0",
4343
"@emotion/server": "11.11.0",
44-
"@guardian/apps-rendering-api-models": "11.0.0",
44+
"@guardian/apps-rendering-api-models": "13.0.1",
4545
"@guardian/bridget": "7.0.0",
4646
"@guardian/cdk": "61.4.0",
47-
"@guardian/content-api-models": "26.0.0",
48-
"@guardian/content-atom-model": "4.0.1",
47+
"@guardian/content-api-models": "31.0.0",
48+
"@guardian/content-atom-model": "6.1.0",
4949
"@guardian/eslint-config": "7.0.1",
5050
"@guardian/eslint-config-typescript": "9.0.1",
5151
"@guardian/libs": "22.0.0",

apps-rendering/src/atoms.test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ describe('parseAtom', () => {
653653
let atoms: Atoms;
654654
let media: Atom;
655655
let mediaAtom: MediaAtom;
656+
const assetVersion = new Int64(1);
656657

657658
beforeEach(() => {
658659
blockElement.contentAtomTypeData = {
@@ -662,10 +663,16 @@ describe('parseAtom', () => {
662663
mediaAtom = {
663664
title: '',
664665
assets: [
666+
{
667+
assetType: AssetType.SUBTITLES,
668+
id: 'subtitles-asset-id',
669+
version: assetVersion,
670+
platform: Platform.YOUTUBE,
671+
},
665672
{
666673
assetType: AssetType.VIDEO,
667-
id: 'asset-id',
668-
version: new Int64(1),
674+
id: 'video-asset-id',
675+
version: assetVersion,
669676
platform: Platform.YOUTUBE,
670677
},
671678
],
@@ -726,7 +733,7 @@ describe('parseAtom', () => {
726733
posterUrl: 'poster-url',
727734
caption: some(frag),
728735
duration: some(1000),
729-
videoId: 'asset-id',
736+
videoId: 'video-asset-id',
730737
id: atomId,
731738
title: '',
732739
}),

apps-rendering/src/atoms.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { isValidDate } from 'date';
88
import type { Int64 } from 'thrift';
99
import type { DocParser } from 'parserContext';
1010
import { Result } from 'result';
11+
import type { MediaAtom } from '@guardian/content-atom-model/media/mediaAtom';
12+
import { AssetType } from '@guardian/content-atom-model/media/assetType';
1113

1214
interface TimelineEvent {
1315
title: string;
@@ -248,10 +250,12 @@ function parseAtom(
248250
return Result.err(`No atom matched this id: ${id}`);
249251
}
250252

253+
const mediaAtom: MediaAtom = atom.data.media;
251254
const { posterUrl, duration, assets, activeVersion, title } =
252-
atom.data.media;
255+
mediaAtom;
253256
const videoId = assets.find(
254257
(asset) =>
258+
asset.assetType === AssetType.VIDEO &&
255259
asset.version.toNumber() === activeVersion?.toNumber(),
256260
)?.id;
257261
const caption = docParser(title);

apps-rendering/src/components/Callout/calloutComponents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const Disclaimer = () => (
2222
will only use the data you provide us for the purpose of the feature and
2323
we will delete any personal data when we no longer require it for this
2424
purpose. For true anonymity please use our{' '}
25-
<a href="https://www.theguardian.com/securedrop">SecureDrop</a> service
25+
<a href="https://www.theguardian.com/tips">Secure Messaging</a> service
2626
instead.
2727
</div>
2828
);

apps-rendering/src/components/Callout/calloutContact.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ const Disclaimer = ({ contacts }: { contacts: Contact[] }) => {
7676
</span>
7777
);
7878

79-
const secureDropText = (
79+
const secureMessagingText = (
8080
<span css={[info, calloutLinkContainer]}>
8181
For true anonymity please use our{' '}
82-
<a href="https://www.theguardian.com/securedrop">SecureDrop</a>{' '}
82+
<a href="https://www.theguardian.com/tips">Secure Messaging</a>{' '}
8383
service instead.
8484
</span>
8585
);
@@ -88,7 +88,7 @@ const Disclaimer = ({ contacts }: { contacts: Contact[] }) => {
8888
<>
8989
{contactText}
9090
{contacts.some((c) => !!c.guidance) && guidanceText}{' '}
91-
{secureDropText}
91+
{secureMessagingText}
9292
</>
9393
);
9494
};

apps-rendering/src/video.test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ describe('parseVideo', () => {
2222
let mediaAtom: MediaAtom;
2323
const atomId = 'atomId2';
2424
const posterUrl = 'poster-url';
25-
const assetId = 'asset-id';
25+
const videoAssetId = 'video-asset-id';
26+
const subtitlesAssetId = 'subtitles-asset-id';
2627
const mediaAtomTitle = 'mediaTitle';
2728
const assetVersion = new Int64(2);
2829

@@ -43,9 +44,15 @@ describe('parseVideo', () => {
4344

4445
mediaAtom = {
4546
assets: [
47+
{
48+
assetType: AssetType.SUBTITLES,
49+
id: subtitlesAssetId,
50+
version: assetVersion,
51+
platform: Platform.YOUTUBE,
52+
},
4653
{
4754
assetType: AssetType.VIDEO,
48-
id: assetId,
55+
id: videoAssetId,
4956
version: assetVersion,
5057
platform: Platform.YOUTUBE,
5158
},
@@ -79,7 +86,7 @@ describe('parseVideo', () => {
7986
test('returns video', () => {
8087
const expected = Optional.some({
8188
posterUrl: posterUrl,
82-
videoId: assetId,
89+
videoId: videoAssetId,
8390
duration: undefined,
8491
atomId: atomId,
8592
title: mediaAtomTitle,

apps-rendering/src/video.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { Atoms } from '@guardian/content-api-models/v1/atoms';
22
import type { BlockElement } from '@guardian/content-api-models/v1/blockElement';
33
import { Optional } from 'optional';
4+
import type { MediaAtom } from '@guardian/content-atom-model/media/mediaAtom';
5+
import { AssetType } from '@guardian/content-atom-model/media/assetType';
46

57
interface Video {
68
posterUrl: string;
@@ -23,10 +25,12 @@ const parseVideo =
2325
if (atom?.data.kind !== 'media') {
2426
return Optional.none();
2527
}
26-
27-
const { posterUrl, duration, assets, activeVersion, title } =
28-
atom.data.media;
29-
const videoId = assets.find(
28+
const mediaAtom: MediaAtom = atom.data.media;
29+
const { posterUrl, duration, assets, activeVersion, title } = mediaAtom;
30+
const videoAssets = assets.filter(
31+
(asset) => asset.assetType === AssetType.VIDEO,
32+
);
33+
const videoId = videoAssets.find(
3034
(asset) => asset.version.toNumber() === activeVersion?.toNumber(),
3135
)?.id;
3236

dotcom-rendering/package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939
"@guardian/identity-auth": "6.0.1",
4040
"@guardian/identity-auth-frontend": "8.1.0",
4141
"@guardian/libs": "26.0.0",
42-
"@guardian/ophan-tracker-js": "2.3.2",
42+
"@guardian/ophan-tracker-js": "2.6.1",
4343
"@guardian/react-crossword": "6.3.0",
4444
"@guardian/shimport": "1.0.2",
4545
"@guardian/source": "11.3.0",
4646
"@guardian/source-development-kitchen": "18.1.1",
47-
"@guardian/support-dotcom-components": "7.7.0",
47+
"@guardian/support-dotcom-components": "7.8.1",
4848
"@guardian/tsconfig": "0.2.0",
4949
"@playwright/test": "1.52.0",
5050
"@sentry/browser": "10.10.0",
@@ -91,7 +91,6 @@
9191
"@types/sanitize-html": "2.11.0",
9292
"@types/scheduler": "0.16.2",
9393
"@types/semver": "7.5.6",
94-
"@types/tough-cookie": "4.0.2",
9594
"@types/trusted-types": "2.0.7",
9695
"@types/twitter-for-web": "0.0.6",
9796
"@types/webpack-bundle-analyzer": "4.7.0",
@@ -105,7 +104,6 @@
105104
"body-parser": "1.20.3",
106105
"browserslist": "4.24.4",
107106
"buffer": "6.0.3",
108-
"chalk": "4.1.2",
109107
"clean-css": "5.3.3",
110108
"compare-versions": "6.1.0",
111109
"compression": "1.7.4",
@@ -162,7 +160,6 @@
162160
"swc-loader": "0.2.6",
163161
"swr": "1.3.0",
164162
"to-string-loader": "1.2.0",
165-
"tough-cookie": "4.1.3",
166163
"trusted-types": "2.0.0",
167164
"ts-loader": "9.5.2",
168165
"ts-unused-exports": "10.1.0",

dotcom-rendering/src/client/ophan/recordInitialPageEvents.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { type EditionId } from '../../lib/edition';
22
import type { RenderingTarget } from '../../types/renderingTarget';
3-
import { getOphan, recordExperiences, recordPerformance } from './ophan';
3+
import {
4+
getOphan,
5+
recordExperiences,
6+
recordPerformance,
7+
submitComponentEvent,
8+
} from './ophan';
49

510
const getEditionForOphan = (editionId: EditionId) => {
611
switch (editionId) {
@@ -29,4 +34,20 @@ export const recordInitialPageEvents = async (
2934
void recordPerformance(renderingTarget);
3035
window.removeEventListener('load', load, false);
3136
});
37+
38+
window.addEventListener('pageshow', (event: PageTransitionEvent) => {
39+
if (!event.persisted) {
40+
return;
41+
}
42+
43+
void submitComponentEvent(
44+
{
45+
action: 'VIEW',
46+
component: {
47+
componentType: 'BF_CACHE',
48+
},
49+
},
50+
renderingTarget,
51+
);
52+
});
3253
};

0 commit comments

Comments
 (0)