Skip to content

Commit 4f8203c

Browse files
committed
Merge remote-tracking branch 'origin/main' into jlk/ab-testing-deploy-lambda
2 parents 43976b3 + cc6194d commit 4f8203c

File tree

15 files changed

+989
-250
lines changed

15 files changed

+989
-250
lines changed

ab-testing/abTests.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ const ABTests: ABTest[] = [
3131
groups: ["control", "variant"],
3232
shouldForceMetricsCollection: true,
3333
},
34+
{
35+
name: "commercial-user-module-ID5",
36+
description:
37+
"Tests whether we can get the users email, hash it and pass pd value to the userId array",
38+
owners: ["[email protected]"],
39+
expirationDate: `2025-12-19`,
40+
type: "client",
41+
status: "ON",
42+
audienceSize: 10 / 100,
43+
audienceSpace: "A",
44+
groups: ["control", "variant"],
45+
shouldForceMetricsCollection: true,
46+
},
3447
];
3548

3649
const activeABtests = ABTests.filter((test) => test.status === "ON");

dotcom-rendering/.storybook/main.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
import path from 'node:path';
2+
import { createRequire } from 'node:module';
23
import webpack from 'webpack';
3-
import { transpileExclude, getLoaders } from '../webpack/webpack.config.client';
44
import { saveStories } from '../scripts/gen-stories/get-stories.mjs';
55
import type { StorybookConfig } from '@storybook/react-webpack5';
66
import { svgr } from '../webpack/svg.cjs';
77
import process from 'node:process';
88

9+
// ESM equivalent of __dirname
10+
const __dirname = import.meta.dirname;
11+
12+
// Import CommonJS webpack config in ESM context
13+
const require = createRequire(import.meta.url);
14+
const {
15+
transpileExclude,
16+
getLoaders,
17+
} = require('../webpack/webpack.config.client.js');
18+
919
// Generate dynamic Card and Layout stories
1020
saveStories();
1121

dotcom-rendering/docs/development/run-prod-bundle-locally.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,16 @@ production build locally.
66
To do this:
77

88
$ make build
9-
$ node dist/server.js
9+
$ make ci
1010

11-
_Note, you will need AWS `frontend` credentials to run the service._
11+
The PROD server should start on its default port 9000.
1212

13-
You can then use the provided GET endpoints for testing:
13+
You can then use the provided POST endpoints for testing e.g.:
1414

1515
/Article
16-
/AMPArticle
16+
/Front
1717

18-
Similar to the dev server, both endpoints support a `url` parameter to customise
19-
the article used. E.g.
18+
Unlike the DEV server, the DCAR PROD server does _not_ implement GET endpoints.
2019

21-
GET /Article/https://www.theguardian.com/my-test-article.
22-
23-
_Note, PROD Frontend doesn't use these endpoints. Instead, it `POSTs` data to
24-
DCR and receives a JSON response. A tool like Postman can help if you want to
25-
replicate this exactly._
20+
As in production, it expects the Frontend JSON data model to be
21+
`POSTed` to DCAR.

dotcom-rendering/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const esModules = [
77
'data-uri-to-buffer',
88
'fetch-blob',
99
'formdata-polyfill',
10+
'storybook',
1011
].join('|');
1112

1213
module.exports = {

dotcom-rendering/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@
4747
"@guardian/tsconfig": "0.2.0",
4848
"@playwright/test": "1.56.1",
4949
"@sentry/browser": "10.24.0",
50-
"@storybook/addon-a11y": "9.1.13",
51-
"@storybook/addon-docs": "9.1.13",
52-
"@storybook/addon-webpack5-compiler-swc": "4.0.1",
53-
"@storybook/react-webpack5": "9.1.13",
50+
"@storybook/addon-a11y": "10.0.7",
51+
"@storybook/addon-docs": "10.0.7",
52+
"@storybook/addon-webpack5-compiler-swc": "4.0.2",
53+
"@storybook/react-webpack5": "10.0.7",
5454
"@svgr/webpack": "8.1.0",
5555
"@swc/cli": "0.7.8",
5656
"@swc/core": "1.13.5",
@@ -115,7 +115,7 @@
115115
"eslint-plugin-react": "7.33.2",
116116
"eslint-plugin-react-hooks": "4.6.0",
117117
"eslint-plugin-ssr-friendly": "1.3.0",
118-
"eslint-plugin-storybook": "9.1.13",
118+
"eslint-plugin-storybook": "10.0.7",
119119
"eslint-plugin-unicorn": "48.0.1",
120120
"eslint-stats": "1.0.1",
121121
"express": "5.1.0",
@@ -147,7 +147,7 @@
147147
"screenfull": "6.0.2",
148148
"semver": "7.5.4",
149149
"source-map": "0.7.4",
150-
"storybook": "9.1.13",
150+
"storybook": "10.0.7",
151151
"stylelint": "16.5.0",
152152
"stylelint-config-recommended": "14.0.0",
153153
"swc-loader": "0.2.6",

dotcom-rendering/src/components/Card/components/CardLink.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,19 @@ type Props = {
2121
headlineText: string;
2222
dataLinkName?: string;
2323
isExternalLink: boolean;
24+
trackCardClick?: () => void;
2425
};
2526

2627
const InternalLink = ({
2728
linkTo,
2829
headlineText,
2930
dataLinkName,
31+
trackCardClick,
3032
}: {
3133
linkTo: string;
3234
headlineText: string;
3335
dataLinkName?: string;
36+
trackCardClick?: () => void;
3437
}) => {
3538
return (
3639
// eslint-disable-next-line jsx-a11y/anchor-has-content -- we have an aria-label attribute describing the content
@@ -39,6 +42,7 @@ const InternalLink = ({
3942
css={fauxLinkStyles}
4043
data-link-name={dataLinkName}
4144
aria-label={headlineText}
45+
onClick={trackCardClick}
4246
/>
4347
);
4448
};
@@ -47,10 +51,12 @@ const ExternalLink = ({
4751
linkTo,
4852
headlineText,
4953
dataLinkName,
54+
trackCardClick,
5055
}: {
5156
linkTo: string;
5257
headlineText: string;
5358
dataLinkName?: string;
59+
trackCardClick?: () => void;
5460
}) => {
5561
return (
5662
// eslint-disable-next-line jsx-a11y/anchor-has-content -- we have an aria-label attribute describing the content
@@ -61,6 +67,7 @@ const ExternalLink = ({
6167
aria-label={headlineText + ' (opens in new tab)'}
6268
target="_blank"
6369
rel="noreferrer"
70+
onClick={trackCardClick}
6471
/>
6572
);
6673
};
@@ -70,6 +77,7 @@ export const CardLink = ({
7077
headlineText,
7178
dataLinkName = 'article', //this makes sense if the link is to an article, but should this say something like "external" if it's an external link? are there any other uses/alternatives?
7279
isExternalLink,
80+
trackCardClick,
7381
}: Props) => {
7482
return (
7583
<>
@@ -78,13 +86,15 @@ export const CardLink = ({
7886
linkTo={linkTo}
7987
headlineText={headlineText}
8088
dataLinkName={dataLinkName}
89+
trackCardClick={trackCardClick}
8190
/>
8291
)}
8392
{!isExternalLink && (
8493
<InternalLink
8594
linkTo={linkTo}
8695
headlineText={headlineText}
8796
dataLinkName={dataLinkName}
97+
trackCardClick={trackCardClick}
8898
/>
8999
)}
90100
</>

dotcom-rendering/src/components/DecideContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export const DecideContainer = ({
233233
return <NavList trails={trails} showImage={true} />;
234234
case 'scrollable/highlights':
235235
return (
236-
<Island priority="feature" defer={{ until: 'visible' }}>
236+
<Island priority="critical">
237237
<ScrollableHighlights trails={trails} frontId={frontId} />
238238
</Island>
239239
);

dotcom-rendering/src/components/Masthead/HighlightsCard.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export type HighlightsCardProps = {
3232
byline?: string;
3333
isExternalLink: boolean;
3434
starRating?: Rating;
35+
trackCardClick: () => void;
3536
};
3637

3738
const container = css`
@@ -133,6 +134,7 @@ export const HighlightsCard = ({
133134
byline,
134135
isExternalLink,
135136
starRating,
137+
trackCardClick,
136138
}: HighlightsCardProps) => {
137139
const isMediaCard = isMedia(format);
138140

@@ -144,6 +146,7 @@ export const HighlightsCard = ({
144146
headlineText={headlineText}
145147
dataLinkName={dataLinkName}
146148
isExternalLink={isExternalLink}
149+
trackCardClick={trackCardClick}
147150
/>
148151

149152
<div css={content}>

0 commit comments

Comments
 (0)