Skip to content

Commit f111a2e

Browse files
author
Juarez Mota
committed
Merge branch 'main' of github.com:guardian/dotcom-rendering into jm/new-sign-in-gate
2 parents aa078cb + abfad6c commit f111a2e

File tree

144 files changed

+3740
-4104
lines changed

Some content is hidden

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

144 files changed

+3740
-4104
lines changed

.github/workflows/compress.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflows/playwright.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ jobs:
2626
- name: Set up Node environment
2727
uses: ./.github/actions/setup-node-env
2828

29+
- name: Turn off mandb updates
30+
run: |
31+
sudo mv /usr/bin/mandb /usr/bin/mandb-OFF
32+
sudo cp -p /bin/true /usr/bin/mandb
33+
2934
- name: Install Playwright Browsers
3035
run: pnpm playwright install --with-deps chromium
3136
working-directory: ./dotcom-rendering

apps-rendering/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
"@storybook/react-webpack5": "8.6.14",
6464
"@storybook/theming": "8.6.14",
6565
"@types/clean-css": "4.2.11",
66-
"@types/compression": "1.7.5",
67-
"@types/express": "4.17.21",
66+
"@types/compression": "1.8.1",
67+
"@types/express": "5.0.1",
6868
"@types/html-webpack-plugin": "3.2.9",
6969
"@types/jest": "29.5.14",
7070
"@types/jsdom": "16.2.15",
@@ -79,13 +79,13 @@
7979
"buffer": "6.0.3",
8080
"clean-css": "5.3.3",
8181
"compare-versions": "6.1.0",
82-
"compression": "1.7.4",
82+
"compression": "1.8.0",
8383
"constructs": "10.4.2",
8484
"core-js": "3.33.3",
8585
"eslint": "8.56.0",
8686
"eslint-plugin-jsx-a11y": "6.7.1",
8787
"eslint-plugin-react": "7.33.2",
88-
"express": "4.21.2",
88+
"express": "5.1.0",
8989
"html-webpack-plugin": "5.6.3",
9090
"jest": "29.7.0",
9191
"jest-environment-jsdom": "29.7.0",

apps-rendering/src/server/server.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ app.use('/assets', express.static(path.resolve(__dirname, '../assets')));
396396
app.use('/assets', express.static(path.resolve(__dirname, '../dist/assets')));
397397
app.use(compression());
398398

399-
app.all('*', (request, response, next) => {
399+
app.all('/{*splat}', (request, response, next) => {
400400
const start = Date.now();
401401

402402
response.once('finish', () => {
@@ -409,22 +409,29 @@ app.all('*', (request, response, next) => {
409409
next();
410410
});
411411

412-
app.get('/healthcheck', (_req, res) => res.send('Ok'));
412+
app.get('/healthcheck', (_req, res) => {
413+
res.status(200).send('Ok');
414+
});
413415

414-
app.get('/favicon.ico', (_, res) => res.status(404).end());
415-
app.get('/fontSize.css', (_, res) => res.status(404).end());
416+
app.get('/favicon.ico', (_, res) => {
417+
res.sendStatus(404);
418+
});
419+
420+
app.get('/fontSize.css', (_, res) => {
421+
res.sendStatus(404);
422+
});
416423

417424
/**
418425
To enable testing in the mobile device emulators,
419426
this route handler adds compatability with DCR's route for apps articles.
420427
The DCR route follows the pattern:
421-
/AppsArticle/https://www.theguardian.com/cities/2019/sep/13/reclaimed-lakes-and-giant-airports-how-mexico-city-might-have-looked
428+
AppsArticle/https://www.theguardian.com/food/2020/mar/15/easter-taste-test-dan-lepard-hot-cross-bun-milk-dark-chocolate-mini-eggs-bunny-sloth
422429
*/
423430
app.get(
424-
'/AppsArticle/*',
431+
'/AppsArticle/*url',
425432
express.raw(),
426433
(req, res, next) => {
427-
const contentWebUrl = req.params[0];
434+
const contentWebUrl = req.originalUrl.split('/').slice(2).join('/');
428435
const articleId = new URL(contentWebUrl).pathname;
429436
req.params = {
430437
0: articleId,
@@ -436,16 +443,13 @@ app.get(
436443
);
437444

438445
app.get(
439-
'/:edition(uk|us|au|europe|international)?/rendered-items/*',
440-
express.raw(),
441-
serveArticleGet,
442-
);
443-
app.get(
444-
'/:edition(uk|us|au|europe|international)?/*',
446+
['/:edition/rendered-items/*path', '/rendered-items/*path'],
445447
express.raw(),
446448
serveArticleGet,
447449
);
448450

451+
app.get(['/:edition/*path', '/*path'], express.raw(), serveArticleGet);
452+
449453
app.post('/article', express.raw(), serveArticlePost);
450454

451455
app.post('/editions-article', express.raw(), serveEditionsArticlePost);

dotcom-rendering/.storybook/mocks/bridgetApi.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ export const getInteractivesClient: BridgetApi<
9696
getNativePlatform: async () => 0,
9797
});
9898

99+
export const getListenToArticleClient: BridgetApi<
100+
'getListenToArticleClient'
101+
> = () => ({
102+
isAvailable: async () => true,
103+
isPlaying: async () => false,
104+
});
99105
export const ensure_all_exports_are_present = {
100106
getUserClient,
101107
getAcquisitionsClient,
@@ -112,6 +118,7 @@ export const ensure_all_exports_are_present = {
112118
getTagClient,
113119
getInteractionClient,
114120
getInteractivesClient,
121+
getListenToArticleClient,
115122
} satisfies {
116123
[Method in keyof BridgeModule]: BridgetApi<Method>;
117124
};

dotcom-rendering/.storybook/modes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,8 @@ export const allModes = {
6565
globalColourScheme: 'light',
6666
viewport: breakpoints.desktop,
6767
},
68+
'light leftCol': {
69+
globalColourScheme: 'light',
70+
viewport: breakpoints.leftCol,
71+
},
6872
};

dotcom-rendering/fixtures/manual/trails.ts

Lines changed: 5 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,7 @@ export const trails: [
9999
height: 288,
100100
origin: 'The Guardian',
101101
expired: false,
102-
images: [
103-
{
104-
url: 'https://i.guim.co.uk/img/media/e060e9b7c92433b3dfeccc98b9206778cda8b8e8/0_180_6680_4009/master/6680.jpg?width=600&quality=45&dpr=2&s=none',
105-
width: 600,
106-
},
107-
],
102+
image: 'https://i.guim.co.uk/img/media/e060e9b7c92433b3dfeccc98b9206778cda8b8e8/0_180_6680_4009/master/6680.jpg?width=600&quality=45&dpr=2&s=none',
108103
},
109104
isExternalLink: false,
110105
showLivePlayable: false,
@@ -465,24 +460,7 @@ export const trails: [
465460
width: 500,
466461
height: 300,
467462
origin: 'The Guardian',
468-
images: [
469-
{
470-
url: 'https://media.guim.co.uk/13dd7e5c4ca32a53cd22dfd90ac1845ef5e5d643/0_0_1920_1080/1000.jpg',
471-
width: 1000,
472-
},
473-
{
474-
url: 'https://media.guim.co.uk/13dd7e5c4ca32a53cd22dfd90ac1845ef5e5d643/0_0_1920_1080/500.jpg',
475-
width: 500,
476-
},
477-
{
478-
url: 'https://media.guim.co.uk/13dd7e5c4ca32a53cd22dfd90ac1845ef5e5d643/0_0_1920_1080/140.jpg',
479-
width: 140,
480-
},
481-
{
482-
url: 'https://media.guim.co.uk/13dd7e5c4ca32a53cd22dfd90ac1845ef5e5d643/0_0_1920_1080/1920.jpg',
483-
width: 1920,
484-
},
485-
],
463+
image: 'https://media.guim.co.uk/13dd7e5c4ca32a53cd22dfd90ac1845ef5e5d643/0_0_1920_1080/1920.jpg',
486464
expired: false,
487465
},
488466
isExternalLink: false,
@@ -608,12 +586,7 @@ export const trails: [
608586
height: 288,
609587
origin: 'The Guardian',
610588
expired: false,
611-
images: [
612-
{
613-
url: 'https://i.guim.co.uk/img/media/e060e9b7c92433b3dfeccc98b9206778cda8b8e8/0_180_6680_4009/master/6680.jpg?width=600&quality=45&dpr=2&s=none',
614-
width: 600,
615-
},
616-
],
589+
image: 'https://i.guim.co.uk/img/media/e060e9b7c92433b3dfeccc98b9206778cda8b8e8/0_180_6680_4009/master/6680.jpg?width=600&quality=45&dpr=2&s=none',
617590
},
618591
isExternalLink: false,
619592
showLivePlayable: false,
@@ -794,28 +767,7 @@ export const videoTrails: [DCRFrontCard, DCRFrontCard] = [
794767
height: 300,
795768
origin: 'SNTV',
796769
expired: false,
797-
images: [
798-
{
799-
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/2000.jpg',
800-
width: 2000,
801-
},
802-
{
803-
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/1000.jpg',
804-
width: 1000,
805-
},
806-
{
807-
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/500.jpg',
808-
width: 500,
809-
},
810-
{
811-
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/140.jpg',
812-
width: 140,
813-
},
814-
{
815-
url: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/3000.jpg',
816-
width: 3000,
817-
},
818-
],
770+
image: 'https://media.guim.co.uk/0cab2d745b3423b0fac318c9ee09b79678f568f8/0_56_3000_1688/3000.jpg',
819771
},
820772
showVideo: true,
821773
image: {
@@ -849,28 +801,7 @@ export const videoTrails: [DCRFrontCard, DCRFrontCard] = [
849801
height: 300,
850802
origin: 'Reuters',
851803
expired: false,
852-
images: [
853-
{
854-
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/2000.jpg',
855-
width: 2000,
856-
},
857-
{
858-
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/1000.jpg',
859-
width: 1000,
860-
},
861-
{
862-
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/500.jpg',
863-
width: 500,
864-
},
865-
{
866-
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/140.jpg',
867-
width: 140,
868-
},
869-
{
870-
url: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/5358.jpg',
871-
width: 5358,
872-
},
873-
],
804+
image: 'https://media.guim.co.uk/908aa315f66a09bc6ea607b6049cd72decd2dfa6/0_0_5358_3014/5358.jpg',
874805
},
875806
showVideo: true,
876807
image: {

dotcom-rendering/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@emotion/server": "11.11.0",
2929
"@guardian/ab-core": "8.0.0",
3030
"@guardian/braze-components": "22.2.0",
31-
"@guardian/bridget": "8.4.0",
31+
"@guardian/bridget": "8.5.1",
3232
"@guardian/browserslist-config": "6.1.0",
3333
"@guardian/cdk": "61.4.0",
3434
"@guardian/commercial": "26.1.2",
@@ -38,12 +38,12 @@
3838
"@guardian/identity-auth": "6.0.1",
3939
"@guardian/identity-auth-frontend": "8.1.0",
4040
"@guardian/libs": "23.0.0",
41-
"@guardian/ophan-tracker-js": "2.2.10",
41+
"@guardian/ophan-tracker-js": "2.3.0",
4242
"@guardian/react-crossword": "6.3.0",
4343
"@guardian/shimport": "1.0.2",
4444
"@guardian/source": "9.0.0",
4545
"@guardian/source-development-kitchen": "18.1.1",
46-
"@guardian/support-dotcom-components": "7.4.0",
46+
"@guardian/support-dotcom-components": "7.5.0",
4747
"@guardian/tsconfig": "0.2.0",
4848
"@playwright/test": "1.52.0",
4949
"@sentry/browser": "7.75.1",
@@ -73,7 +73,7 @@
7373
"@types/compression": "1.7.5",
7474
"@types/connect": "3.4.38",
7575
"@types/dompurify": "3.0.2",
76-
"@types/express": "4.17.21",
76+
"@types/express": "5.0.1",
7777
"@types/he": "1.2.0",
7878
"@types/html-minifier-terser": "7.0.2",
7979
"@types/jest": "29.5.14",
@@ -130,7 +130,7 @@
130130
"eslint-plugin-unicorn": "48.0.1",
131131
"eslint-stats": "1.0.1",
132132
"execa": "5.1.1",
133-
"express": "4.21.2",
133+
"express": "5.1.0",
134134
"find": "0.3.0",
135135
"he": "1.2.0",
136136
"html-minifier-terser": "7.2.0",

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ export const getOphan = async (
3232
);
3333
}
3434
},
35+
trackClickComponentEvent: (e) => {
36+
if (e instanceof Error) {
37+
window.guardian.modules.sentry.reportError(
38+
e,
39+
"We are in DCAR but Ophan trackClickComponentEvent method got called. This shouldn't have happened. Please investigate why",
40+
);
41+
}
42+
},
3543
viewId: 'Apps',
3644
pageViewId: 'Apps',
3745
};
@@ -73,6 +81,14 @@ export const submitComponentEvent = async (
7381
ophan.record({ componentEvent });
7482
};
7583

84+
export const submitClickComponentEvent = async (
85+
element: Element,
86+
renderingTarget: RenderingTarget,
87+
): Promise<void> => {
88+
const ophan = await getOphan(renderingTarget);
89+
ophan.trackClickComponentEvent(element);
90+
};
91+
7692
interface SdcTestMeta {
7793
abTestName: NonNullable<ComponentEvent['abTest']>['name'];
7894
abTestVariant: NonNullable<ComponentEvent['abTest']>['name'];

dotcom-rendering/src/components/AdSlot.web.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ const frontsBannerAdStyles = css`
261261

262262
const articleEndAdStyles = css`
263263
position: relative;
264-
min-height: ${getMinHeight(adSizes.outstreamDesktop.height)}px;
264+
min-height: 450px;
265265
266266
&.ad-slot--fluid {
267267
min-height: 450px;

0 commit comments

Comments
 (0)