From 63d7fd824e8a2ef9f3a3a549cb536198cd44df3f Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson Date: Wed, 4 Mar 2026 09:49:54 +0000 Subject: [PATCH 1/5] Bump gu libs to 29.0.1 --- package.json | 2 +- yarn.lock | 25 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 35fceff4936..0e2b1ee1dd4 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "@guardian/eslint-config-typescript": "9.0.1", "@guardian/identity-auth": "6.0.1", "@guardian/identity-auth-frontend": "8.1.0", - "@guardian/libs": "26.1.0", + "@guardian/libs": "29.0.1", "@guardian/prettier": "^8.0.1", "@guardian/shimport": "^1.0.2", "@guardian/source-foundations": "16.0.0", diff --git a/yarn.lock b/yarn.lock index ba349a6f71e..9fffec6882f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2935,7 +2935,7 @@ __metadata: "@guardian/eslint-config-typescript": "npm:9.0.1" "@guardian/identity-auth": "npm:6.0.1" "@guardian/identity-auth-frontend": "npm:8.1.0" - "@guardian/libs": "npm:26.1.0" + "@guardian/libs": "npm:29.0.1" "@guardian/prettier": "npm:^8.0.1" "@guardian/shimport": "npm:^1.0.2" "@guardian/source-foundations": "npm:16.0.0" @@ -3102,19 +3102,19 @@ __metadata: languageName: node linkType: hard -"@guardian/libs@npm:26.1.0": - version: 26.1.0 - resolution: "@guardian/libs@npm:26.1.0" +"@guardian/libs@npm:29.0.1": + version: 29.0.1 + resolution: "@guardian/libs@npm:29.0.1" dependencies: - "@guardian/ophan-tracker-js": "npm:2.2.10" + "@guardian/ophan-tracker-js": "npm:2.8.0" peerDependencies: "@guardian/ophan-tracker-js": ^2.2.10 - tslib: ^2.6.2 - typescript: ~5.5.2 + tslib: ^2.8.1 + typescript: ~5.9.3 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/1735ceb60a5c82ec85eaac2327bc85a875a6372d3d53ffc59c3983b479426892659831df3f8dbb82ca40cd50092744e8ed586a5b2c2642fac0b4716dfaa483da + checksum: 10c0/d60fd79e59caaed562e76c988b9313911683a4214cdc30c63d06dc6e58faf27d37969588ae0ffb52645589afdd7c6c8c6764e7ff895b41166f9eb55b710d2b65 languageName: node linkType: hard @@ -3127,6 +3127,15 @@ __metadata: languageName: node linkType: hard +"@guardian/ophan-tracker-js@npm:2.8.0": + version: 2.8.0 + resolution: "@guardian/ophan-tracker-js@npm:2.8.0" + dependencies: + "@guardian/tsconfig": "npm:^1.0.0" + checksum: 10c0/72f7c374385254b46df671702e26a9d7bcfec0bfdaf084dcc29f810a269a4dd86db8caad835408b9c322c376f13fb87fa85396d39b9e924cc8c339ae0e923c83 + languageName: node + linkType: hard + "@guardian/prettier@npm:^8.0.1": version: 8.0.1 resolution: "@guardian/prettier@npm:8.0.1" From 521533df643cf653c46ea23a388d77d1525e2ad6 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson Date: Wed, 4 Mar 2026 14:06:33 +0000 Subject: [PATCH 2/5] Refactor Ophan tracking for AUS --- static/src/javascripts/boot.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/static/src/javascripts/boot.js b/static/src/javascripts/boot.js index 1763ddf4180..ca40f4467d0 100644 --- a/static/src/javascripts/boot.js +++ b/static/src/javascripts/boot.js @@ -95,7 +95,7 @@ const go = () => { }; } if (consentState.usnat) { - + // Users who interacted with the CCPA banner before the migration to usnat will still have a ccpaUUID cookie. The usnatUUID cookie is set when the USNAT banner is interacted with. We need to check both cookies to ensure we have the correct consentUUID. const consentUUID = getCookie({ name: 'usnatUUID' }) ?? getCookie({ name: 'ccpaUUID' }); @@ -107,9 +107,13 @@ const go = () => { }; } if (consentState.aus) { + // Users who interacted with the CCPA banner before the migration to usnat will still have a ccpaUUID cookie. The usnatUUID cookie is set when the USNAT banner is interacted with. We need to check both cookies to ensure we have the correct consentUUID. + const consentUUID = + getCookie({ name: 'globalcmpUUID' }) ?? + getCookie({ name: 'ccpaUUID' }); return { consentJurisdiction: 'AUS', - consentUUID: getCookie({ name: 'ccpaUUID' }) ?? '', + consentUUID: consentUUID ?? '', consent: consentState.aus.personalisedAdvertising ? 'true' : 'false', From c51ebc6d06140a0652849674fa14ec877b3c7ac6 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson Date: Wed, 4 Mar 2026 14:29:50 +0000 Subject: [PATCH 3/5] Fix tests. --- .../modules/atoms/youtube-player.spec.ts | 14 +++++++++---- .../braze/hasRequiredConsents.spec.ts | 20 ++++++++++++------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/static/src/javascripts/projects/common/modules/atoms/youtube-player.spec.ts b/static/src/javascripts/projects/common/modules/atoms/youtube-player.spec.ts index a034b915b85..aed1f3d0238 100644 --- a/static/src/javascripts/projects/common/modules/atoms/youtube-player.spec.ts +++ b/static/src/javascripts/projects/common/modules/atoms/youtube-player.spec.ts @@ -2,9 +2,14 @@ import type { AdsConfigTCFV2, AdsConfigUSNATorAus, } from '@guardian/commercial-core/dist/cjs/types'; -import type { ConsentState, OnConsentChangeCallback } from '@guardian/libs'; +import type { AUSConsentState, ConsentState, OnConsentChangeCallback } from '@guardian/libs'; import { _ as youtubePlayer } from 'common/modules/atoms/youtube-player'; +const ausConsent: AUSConsentState = { + personalisedAdvertising: true, + signalStatus: 'ready', +}; + jest.mock('common/modules/commercial/build-page-targeting', () => ({ getPageTargeting: jest.fn(() => ({ key: 'value' })), })); @@ -90,6 +95,7 @@ const canTargetUSNAT = (canTarget: boolean): ConsentState => ({ const canTargetAUS = (canTarget: boolean): ConsentState => ({ aus: { personalisedAdvertising: canTarget, + signalStatus: 'ready', }, canTarget, framework: 'aus', @@ -200,7 +206,7 @@ describe('Get Host (no-cookie)', () => { test('`youtube-nocookie.com` with an ad-free', () => { const host = youtubePlayer.getHost({ consentState: { - aus: { personalisedAdvertising: true }, + aus: ausConsent, canTarget: true, framework: 'aus', }, @@ -214,7 +220,7 @@ describe('Get Host (no-cookie)', () => { test('`youtube-nocookie.com` with for other than youtube-media-atom__iframe', () => { const host = youtubePlayer.getHost({ consentState: { - aus: { personalisedAdvertising: true }, + aus: ausConsent, canTarget: true, framework: 'aus', }, @@ -228,7 +234,7 @@ describe('Get Host (no-cookie)', () => { test('`youtube.com` when all three conditions met', () => { const host = youtubePlayer.getHost({ consentState: { - aus: { personalisedAdvertising: true }, + aus: ausConsent, canTarget: true, framework: 'aus', }, diff --git a/static/src/javascripts/projects/common/modules/commercial/braze/hasRequiredConsents.spec.ts b/static/src/javascripts/projects/common/modules/commercial/braze/hasRequiredConsents.spec.ts index b3b29949665..063a92a96d8 100644 --- a/static/src/javascripts/projects/common/modules/commercial/braze/hasRequiredConsents.spec.ts +++ b/static/src/javascripts/projects/common/modules/commercial/braze/hasRequiredConsents.spec.ts @@ -1,9 +1,19 @@ -import type { ConsentState, OnConsentChangeCallback } from '@guardian/libs'; +import type { AUSConsentState, ConsentState, OnConsentChangeCallback } from '@guardian/libs'; import { hasRequiredConsents } from './hasRequiredConsents'; const brazeVendorId = '5ed8c49c4b8ce4571c7ad801'; let mockOnConsentChangeResult: ConsentState | undefined; + +const ausConsent: AUSConsentState = { + personalisedAdvertising: true, + signalStatus: 'ready', +}; + +const ausNonConsent: AUSConsentState = { + personalisedAdvertising: false, + signalStatus: 'ready', +}; jest.mock( '@guardian/libs', () => @@ -96,9 +106,7 @@ describe('hasRequiredConsents', () => { describe('when the user is covered by aus and consent is given', () => { it('returns a promise which resolves with true', async () => { mockOnConsentChangeResult = { - aus: { - personalisedAdvertising: true, - }, + aus: ausConsent, canTarget: true, framework: 'aus', }; @@ -110,9 +118,7 @@ describe('hasRequiredConsents', () => { describe('when the user is covered by aus and consent is not given', () => { it('returns a promise which resolves with false', async () => { mockOnConsentChangeResult = { - aus: { - personalisedAdvertising: false, - }, + aus: ausNonConsent, canTarget: false, framework: 'aus', }; From 5f6e23838ab8de5340cb8011aa473bf18562ad5f Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson Date: Wed, 4 Mar 2026 14:39:58 +0000 Subject: [PATCH 4/5] Use libs getCookies function and lint --- static/src/javascripts/boot.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/static/src/javascripts/boot.js b/static/src/javascripts/boot.js index ca40f4467d0..2710721aa77 100644 --- a/static/src/javascripts/boot.js +++ b/static/src/javascripts/boot.js @@ -7,8 +7,7 @@ import config from 'lib/config'; import { markTime } from 'lib/user-timing'; import { captureOphanInfo } from 'lib/capture-ophan-info'; import { reportError } from 'lib/report-error'; -import { cmp, getLocale, loadScript, onConsentChange } from '@guardian/libs'; -import { getCookie } from 'lib/cookies'; +import { cmp, getLocale, loadScript, onConsentChange, getCookie } from '@guardian/libs'; import { init as detectAdBlockers } from 'commercial/detect-adblock'; import ophan from 'ophan/ng'; import { isUserLoggedIn } from 'common/modules/identity/api'; @@ -95,7 +94,9 @@ const go = () => { }; } if (consentState.usnat) { - // Users who interacted with the CCPA banner before the migration to usnat will still have a ccpaUUID cookie. The usnatUUID cookie is set when the USNAT banner is interacted with. We need to check both cookies to ensure we have the correct consentUUID. + // Users who interacted with the CCPA banner before the migration to usnat will still have a ccpaUUID cookie. + // The usnatUUID cookie is set when the USNAT banner is interacted with. + // We need to check both cookies to ensure we have the correct consentUUID. const consentUUID = getCookie({ name: 'usnatUUID' }) ?? getCookie({ name: 'ccpaUUID' }); @@ -107,7 +108,9 @@ const go = () => { }; } if (consentState.aus) { - // Users who interacted with the CCPA banner before the migration to usnat will still have a ccpaUUID cookie. The usnatUUID cookie is set when the USNAT banner is interacted with. We need to check both cookies to ensure we have the correct consentUUID. + // Users who interacted with the CCPA banner before the migration to globalCmp will still have a ccpaUUID cookie. + // The globalcmpUUID cookie is set when the AUS banner is interacted with. + // We need to check both cookies to ensure we have the correct consentUUID. const consentUUID = getCookie({ name: 'globalcmpUUID' }) ?? getCookie({ name: 'ccpaUUID' }); From b1c6f19053aff25d7bcf2b4dff63b042deb8489a Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson Date: Tue, 24 Mar 2026 12:29:56 +0000 Subject: [PATCH 5/5] Use libs canary --- package.json | 2 +- yarn.lock | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index d665a09b0c5..5729e1323ed 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "@guardian/core-web-vitals": "6.0.0", "@guardian/identity-auth": "6.0.1", "@guardian/identity-auth-frontend": "8.1.0", - "@guardian/libs": "30.1.1", + "@guardian/libs": "0.0.0-canary-20260324113710", "@guardian/prettier": "^8.0.1", "@guardian/shimport": "^1.0.2", "@guardian/source-foundations": "16.0.0", diff --git a/yarn.lock b/yarn.lock index 6b8884cd269..ffc07881f68 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2846,7 +2846,7 @@ __metadata: "@guardian/core-web-vitals": "npm:6.0.0" "@guardian/identity-auth": "npm:6.0.1" "@guardian/identity-auth-frontend": "npm:8.1.0" - "@guardian/libs": "npm:30.1.1" + "@guardian/libs": "npm:0.0.0-canary-20260324113710" "@guardian/prettier": "npm:^8.0.1" "@guardian/shimport": "npm:^1.0.2" "@guardian/source-foundations": "npm:16.0.0" @@ -2984,35 +2984,35 @@ __metadata: languageName: node linkType: hard -"@guardian/libs@npm:25.2.0": - version: 25.2.0 - resolution: "@guardian/libs@npm:25.2.0" +"@guardian/libs@npm:0.0.0-canary-20260324113710": + version: 0.0.0-canary-20260324113710 + resolution: "@guardian/libs@npm:0.0.0-canary-20260324113710" dependencies: - "@guardian/ophan-tracker-js": "npm:2.2.10" + "@guardian/ophan-tracker-js": "npm:2.8.0" peerDependencies: "@guardian/ophan-tracker-js": ^2.2.10 - tslib: ^2.6.2 - typescript: ~5.5.2 + tslib: ^2.8.1 + typescript: ~5.9.3 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/41dd40a6c2ac0d9270924e5b4c2d3e6b703c1aaf8dd84f7a69cd76d4250a6782bd98d9c5e8508d6abd781bf3f2bdf57b001634fb88e9ac8597ff06b728eff998 + checksum: 10c0/fda5b9990d054dbd8bb773366d5a3d95d405b8fcbc8ada775420cea7195df133d59f63e32641a2009b970682a2fb8ac8296577ecb1c2078f8860751bab1c98c7 languageName: node linkType: hard -"@guardian/libs@npm:30.1.1": - version: 30.1.1 - resolution: "@guardian/libs@npm:30.1.1" +"@guardian/libs@npm:25.2.0": + version: 25.2.0 + resolution: "@guardian/libs@npm:25.2.0" dependencies: - "@guardian/ophan-tracker-js": "npm:2.8.0" + "@guardian/ophan-tracker-js": "npm:2.2.10" peerDependencies: "@guardian/ophan-tracker-js": ^2.2.10 - tslib: ^2.8.1 - typescript: ~5.9.3 + tslib: ^2.6.2 + typescript: ~5.5.2 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/d1cbe8ab1729af541eec3b937f4443f1205a79e9efe667b374ac2a4f084238d340652aa2a74cec5558f17cbfd324f4549ffbbea8c89cbcb565c8877103e81414 + checksum: 10c0/41dd40a6c2ac0d9270924e5b4c2d3e6b703c1aaf8dd84f7a69cd76d4250a6782bd98d9c5e8508d6abd781bf3f2bdf57b001634fb88e9ac8597ff06b728eff998 languageName: node linkType: hard