From e7e0c9e4a0c39b2bdee71fdc30a3d7309a96e910 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:08:37 +0100 Subject: [PATCH 01/20] installed beta --- package.json | 2 +- pnpm-lock.yaml | 38 ++++++++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 71437c449..edff611cd 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@guardian/eslint-config-typescript": "^9.0.1", "@guardian/identity-auth": "^2.1.0", "@guardian/identity-auth-frontend": "^4.0.0", - "@guardian/libs": "16.1.2", + "@guardian/libs": "0.0.0-canary-20240605094526", "@guardian/prettier": "4.0.0", "@guardian/source-foundations": "14.1.4", "@playwright/test": "1.40.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 89d5ab75e..33ca0b3f2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -81,19 +81,19 @@ devDependencies: version: 5.1.0(browserslist@4.23.0)(tslib@2.6.2) '@guardian/core-web-vitals': specifier: 6.0.0 - version: 6.0.0(@guardian/libs@16.1.2)(tslib@2.6.2)(typescript@5.3.3)(web-vitals@3.5.2) + version: 6.0.0(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3)(web-vitals@3.5.2) '@guardian/eslint-config-typescript': specifier: ^9.0.1 version: 9.0.1(eslint@8.57.0)(tslib@2.6.2)(typescript@5.3.3) '@guardian/identity-auth': specifier: ^2.1.0 - version: 2.1.0(@guardian/libs@16.1.2)(tslib@2.6.2)(typescript@5.3.3) + version: 2.1.0(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3) '@guardian/identity-auth-frontend': specifier: ^4.0.0 - version: 4.0.0(@guardian/identity-auth@2.1.0)(@guardian/libs@16.1.2)(tslib@2.6.2)(typescript@5.3.3) + version: 4.0.0(@guardian/identity-auth@2.1.0)(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3) '@guardian/libs': - specifier: 16.1.2 - version: 16.1.2(tslib@2.6.2)(typescript@5.3.3) + specifier: 0.0.0-canary-20240605094526 + version: 0.0.0-canary-20240605094526(tslib@2.6.2)(typescript@5.3.3) '@guardian/prettier': specifier: 4.0.0 version: 4.0.0(prettier@2.8.8)(tslib@2.6.2) @@ -1750,7 +1750,7 @@ packages: tslib: 2.6.2 dev: true - /@guardian/core-web-vitals@6.0.0(@guardian/libs@16.1.2)(tslib@2.6.2)(typescript@5.3.3)(web-vitals@3.5.2): + /@guardian/core-web-vitals@6.0.0(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3)(web-vitals@3.5.2): resolution: {integrity: sha512-kwH1VsQQMn+sPZis1zYYcCYzedNpen6tk3CtVjJlmtHV4nK6i6FnMfhHgbtqECDsqrHdTzRbwN2Lodh1f8D5lA==} peerDependencies: '@guardian/libs': ^16.0.0 @@ -1761,7 +1761,7 @@ packages: typescript: optional: true dependencies: - '@guardian/libs': 16.1.2(tslib@2.6.2)(typescript@5.3.3) + '@guardian/libs': 0.0.0-canary-20240605094526(tslib@2.6.2)(typescript@5.3.3) tslib: 2.6.2 typescript: 5.3.3 web-vitals: 3.5.2 @@ -1806,7 +1806,7 @@ packages: - supports-color dev: true - /@guardian/identity-auth-frontend@4.0.0(@guardian/identity-auth@2.1.0)(@guardian/libs@16.1.2)(tslib@2.6.2)(typescript@5.3.3): + /@guardian/identity-auth-frontend@4.0.0(@guardian/identity-auth@2.1.0)(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3): resolution: {integrity: sha512-lSXpRF54eEkxbQXEzJTXYDqzMDHl345Ac/Y7M8/OnKee0vtbR1hCjfm70HbcIXpUyx+TaNV8Ka4bqkR9VwJCPA==} peerDependencies: '@guardian/identity-auth': ^2.1.0 @@ -1817,13 +1817,13 @@ packages: typescript: optional: true dependencies: - '@guardian/identity-auth': 2.1.0(@guardian/libs@16.1.2)(tslib@2.6.2)(typescript@5.3.3) - '@guardian/libs': 16.1.2(tslib@2.6.2)(typescript@5.3.3) + '@guardian/identity-auth': 2.1.0(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3) + '@guardian/libs': 0.0.0-canary-20240605094526(tslib@2.6.2)(typescript@5.3.3) tslib: 2.6.2 typescript: 5.3.3 dev: true - /@guardian/identity-auth@2.1.0(@guardian/libs@16.1.2)(tslib@2.6.2)(typescript@5.3.3): + /@guardian/identity-auth@2.1.0(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3): resolution: {integrity: sha512-+AM0pcmRvRZUf92RYGJ2Q6KK1JpnQIxZ6pafsaBMGnF0IwiIk9DdfhaYZl0cyPQ3PwLTJJw2aSl453ivPAmHbw==} peerDependencies: '@guardian/libs': ^16.0.0 @@ -1833,7 +1833,20 @@ packages: typescript: optional: true dependencies: - '@guardian/libs': 16.1.2(tslib@2.6.2)(typescript@5.3.3) + '@guardian/libs': 0.0.0-canary-20240605094526(tslib@2.6.2)(typescript@5.3.3) + tslib: 2.6.2 + typescript: 5.3.3 + dev: true + + /@guardian/libs@0.0.0-canary-20240605094526(tslib@2.6.2)(typescript@5.3.3): + resolution: {integrity: sha512-Ldz7/8IWZnufVA/1wPFUpzD0CzmqfAqsBriMYJ/Vv93K1/cTJuACXt8d4pQUJn5ozZFyKhr1CjIXPj/q79uQng==} + peerDependencies: + tslib: ^2.6.2 + typescript: ~5.3.3 + peerDependenciesMeta: + typescript: + optional: true + dependencies: tslib: 2.6.2 typescript: 5.3.3 dev: true @@ -1849,6 +1862,7 @@ packages: dependencies: tslib: 2.6.2 typescript: 5.3.3 + dev: false /@guardian/ophan-tracker-js@2.0.4: resolution: {integrity: sha512-kwUNUSfnL8SQwzTlVzInYh7a6VSMFy3zEq2A6Hm7cmKSbl8D7ed03y7ANqquViFuPffRZRQ0IrkJHSbMnsRmrA==} From 4abb7eb624b69c63928de50313b5bb09e5828450 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:08:46 +0100 Subject: [PATCH 02/20] Update tests --- src/core/send-commercial-metrics.spec.ts | 4 ++-- src/core/track-gpc-signal.spec.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/send-commercial-metrics.spec.ts b/src/core/send-commercial-metrics.spec.ts index 161cda385..bdff96d06 100644 --- a/src/core/send-commercial-metrics.spec.ts +++ b/src/core/send-commercial-metrics.spec.ts @@ -104,13 +104,13 @@ const tcfv2AllConsentExceptPurpose8: ConsentState = { }; const ccpaConsent: ConsentState = { - ccpa: { doNotSell: false }, + ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, framework: 'ccpa', }; const ccpaNonConsent: ConsentState = { - ccpa: { doNotSell: true }, + ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, framework: 'ccpa', }; diff --git a/src/core/track-gpc-signal.spec.ts b/src/core/track-gpc-signal.spec.ts index 737c9c762..7c4c2ac7c 100644 --- a/src/core/track-gpc-signal.spec.ts +++ b/src/core/track-gpc-signal.spec.ts @@ -9,6 +9,7 @@ describe('initTrackGpcSignal', () => { const consentState: ConsentState = { ccpa: { doNotSell: false, + signalStatus: 'ready', }, canTarget: true, framework: 'ccpa', From de327cc5725e1966f3f5a1f9da994a2266232a7f Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:19:37 +0100 Subject: [PATCH 03/20] Update tests --- src/core/targeting/build-page-targeting.spec.ts | 4 ++-- src/core/targeting/personalised.spec.ts | 14 +++++++------- src/core/targeting/youtube.spec.ts | 3 +++ src/core/track-gpc-signal.spec.ts | 2 ++ src/init/consented/comscore.spec.ts | 2 ++ src/init/consented/prepare-googletag.spec.ts | 4 ++-- src/init/consented/prepare-prebid.spec.ts | 4 ++-- src/init/consented/redplanet.spec.ts | 2 +- src/init/consented/third-party-tags.spec.ts | 4 ++-- src/lib/header-bidding/a9/a9.spec.ts | 2 +- 10 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/core/targeting/build-page-targeting.spec.ts b/src/core/targeting/build-page-targeting.spec.ts index 92d057b35..ddff0e154 100644 --- a/src/core/targeting/build-page-targeting.spec.ts +++ b/src/core/targeting/build-page-targeting.spec.ts @@ -54,13 +54,13 @@ const mockViewport = (width: number, height: number): void => { // CCPA const ccpaWithConsentMock: ConsentState = { - ccpa: { doNotSell: false }, + ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, framework: 'ccpa', }; const ccpaWithoutConsentMock: ConsentState = { - ccpa: { doNotSell: true }, + ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, framework: 'ccpa', }; diff --git a/src/core/targeting/personalised.spec.ts b/src/core/targeting/personalised.spec.ts index 71f2014ed..60e27d0ca 100644 --- a/src/core/targeting/personalised.spec.ts +++ b/src/core/targeting/personalised.spec.ts @@ -75,7 +75,7 @@ describe('Personalised targeting', () => { describe('CCPA', () => { it('Full Consent', () => { const state: ConsentState = { - ccpa: { doNotSell: false }, + ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, framework: 'ccpa', }; @@ -97,7 +97,7 @@ describe('Personalised targeting', () => { it('Do Not Sell', () => { const state: ConsentState = { - ccpa: { doNotSell: true }, + ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, framework: 'ccpa', }; @@ -191,7 +191,7 @@ describe('Personalised targeting', () => { ]; test.each(frequencies)('Should get `%s` for %f', (fr, val) => { const state: ConsentState = { - ccpa: { doNotSell: false }, + ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, framework: 'ccpa', }; @@ -232,7 +232,7 @@ describe('Personalised targeting', () => { test.each(groups)('Should get `%s` if it exists', (amtgrp, val) => { const state: ConsentState = { - ccpa: { doNotSell: false }, + ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, framework: 'ccpa', }; @@ -279,7 +279,7 @@ describe('Personalised targeting', () => { test('Ad manager group IS set if ccpa and consent not given', () => { const state: ConsentState = { - ccpa: { doNotSell: true }, + ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, framework: 'ccpa', }; @@ -311,7 +311,7 @@ describe('Personalised targeting', () => { test('Should set `permutive` to correct values if `youtube` is set to false', () => { const state: ConsentState = { - ccpa: { doNotSell: false }, + ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, framework: 'ccpa', }; @@ -328,7 +328,7 @@ describe('Personalised targeting', () => { test('Should set `permutive` to correct values if `youtube` is set to true', () => { const state: ConsentState = { - ccpa: { doNotSell: false }, + ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, framework: 'ccpa', }; diff --git a/src/core/targeting/youtube.spec.ts b/src/core/targeting/youtube.spec.ts index e1c05b665..427df3338 100644 --- a/src/core/targeting/youtube.spec.ts +++ b/src/core/targeting/youtube.spec.ts @@ -16,6 +16,7 @@ describe('YouTube Ad Targeting Object for consent frameworks', () => { consentState: { ccpa: { doNotSell: false, // * + signalStatus: 'ready', }, canTarget: true, framework: 'ccpa', @@ -42,6 +43,7 @@ describe('YouTube Ad Targeting Object for consent frameworks', () => { consentState: { ccpa: { doNotSell: true, // * + signalStatus: 'ready', }, canTarget: false, framework: 'ccpa', @@ -68,6 +70,7 @@ describe('YouTube Ad Targeting Object for consent frameworks', () => { consentState: { ccpa: { doNotSell: false, + signalStatus: 'ready', }, canTarget: true, framework: 'ccpa', diff --git a/src/core/track-gpc-signal.spec.ts b/src/core/track-gpc-signal.spec.ts index 7c4c2ac7c..510e9ec35 100644 --- a/src/core/track-gpc-signal.spec.ts +++ b/src/core/track-gpc-signal.spec.ts @@ -26,6 +26,7 @@ describe('initTrackGpcSignal', () => { const consentState: ConsentState = { ccpa: { doNotSell: false, + signalStatus: 'ready', }, canTarget: true, framework: 'ccpa', @@ -43,6 +44,7 @@ describe('initTrackGpcSignal', () => { const consentState: ConsentState = { ccpa: { doNotSell: false, + signalStatus: 'ready', }, canTarget: true, framework: 'ccpa', diff --git a/src/init/consented/comscore.spec.ts b/src/init/consented/comscore.spec.ts index 37807be0e..81e88ca3f 100644 --- a/src/init/consented/comscore.spec.ts +++ b/src/init/consented/comscore.spec.ts @@ -41,6 +41,7 @@ const tcfv2WithoutConsent = { const ccpaWithConsent = { ccpa: { doNotSell: false, + signalStatus: 'ready', }, canTarget: true, framework: 'ccpa', @@ -49,6 +50,7 @@ const ccpaWithConsent = { const ccpaWithoutConsent = { ccpa: { doNotSell: true, + signalStatus: 'ready', }, canTarget: false, framework: 'ccpa', diff --git a/src/init/consented/prepare-googletag.spec.ts b/src/init/consented/prepare-googletag.spec.ts index b3bdfd76a..529d49479 100644 --- a/src/init/consented/prepare-googletag.spec.ts +++ b/src/init/consented/prepare-googletag.spec.ts @@ -216,13 +216,13 @@ const ausRejected: ConsentState = { }; const ccpaWithConsent: ConsentState = { - ccpa: { doNotSell: false }, + ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, framework: 'ccpa', }; const ccpaWithoutConsent: ConsentState = { - ccpa: { doNotSell: true }, + ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, framework: 'ccpa', }; diff --git a/src/init/consented/prepare-prebid.spec.ts b/src/init/consented/prepare-prebid.spec.ts index 8c5220b9f..9a322086d 100644 --- a/src/init/consented/prepare-prebid.spec.ts +++ b/src/init/consented/prepare-prebid.spec.ts @@ -92,13 +92,13 @@ const tcfv2WithoutConsent = { } as ConsentState; const ccpaWithConsent = { - ccpa: { doNotSell: false }, + ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, framework: 'ccpa', } as ConsentState; const ccpaWithoutConsent = { - ccpa: { doNotSell: true }, + ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, framework: 'ccpa', } as ConsentState; diff --git a/src/init/consented/redplanet.spec.ts b/src/init/consented/redplanet.spec.ts index 770d1a393..7f6a6e070 100644 --- a/src/init/consented/redplanet.spec.ts +++ b/src/init/consented/redplanet.spec.ts @@ -19,7 +19,7 @@ const AusWithoutConsent = { } as ConsentState; const CcpaWithConsent = { - ccpa: { doNotSell: false }, + ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, framework: 'ccpa', } as ConsentState; diff --git a/src/init/consented/third-party-tags.spec.ts b/src/init/consented/third-party-tags.spec.ts index 1bbaf51b1..4b3440795 100644 --- a/src/init/consented/third-party-tags.spec.ts +++ b/src/init/consented/third-party-tags.spec.ts @@ -198,7 +198,7 @@ describe('third party tags', () => { }); it('should add scripts to the document when CCPA consent has been given', async () => { mockOnConsent({ - ccpa: { doNotSell: false }, + ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, framework: 'ccpa', }); @@ -211,7 +211,7 @@ describe('third party tags', () => { }); it('should only add performance scripts to the document when CCPA consent has not been given', async () => { mockOnConsent({ - ccpa: { doNotSell: true }, + ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, framework: 'ccpa', }); diff --git a/src/lib/header-bidding/a9/a9.spec.ts b/src/lib/header-bidding/a9/a9.spec.ts index d2f6f2da3..c03a64da6 100644 --- a/src/lib/header-bidding/a9/a9.spec.ts +++ b/src/lib/header-bidding/a9/a9.spec.ts @@ -29,7 +29,7 @@ const tcfv2WithConsentMock = (callback: OnConsentChangeCallback) => const CcpaWithConsentMock = (callback: OnConsentChangeCallback) => callback({ - ccpa: { doNotSell: false }, + ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, framework: 'ccpa', }); From 25a6f171278d48fd0bdf7fbe948e2df9da822fc0 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:51:55 +0100 Subject: [PATCH 04/20] Bump libs beta --- package.json | 2 +- pnpm-lock.yaml | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index edff611cd..1a69d0ee7 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@guardian/eslint-config-typescript": "^9.0.1", "@guardian/identity-auth": "^2.1.0", "@guardian/identity-auth-frontend": "^4.0.0", - "@guardian/libs": "0.0.0-canary-20240605094526", + "@guardian/libs": "0.0.0-canary-20240606084326", "@guardian/prettier": "4.0.0", "@guardian/source-foundations": "14.1.4", "@playwright/test": "1.40.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 33ca0b3f2..ee2820b17 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -81,19 +81,19 @@ devDependencies: version: 5.1.0(browserslist@4.23.0)(tslib@2.6.2) '@guardian/core-web-vitals': specifier: 6.0.0 - version: 6.0.0(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3)(web-vitals@3.5.2) + version: 6.0.0(@guardian/libs@0.0.0-canary-20240606084326)(tslib@2.6.2)(typescript@5.3.3)(web-vitals@3.5.2) '@guardian/eslint-config-typescript': specifier: ^9.0.1 version: 9.0.1(eslint@8.57.0)(tslib@2.6.2)(typescript@5.3.3) '@guardian/identity-auth': specifier: ^2.1.0 - version: 2.1.0(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3) + version: 2.1.0(@guardian/libs@0.0.0-canary-20240606084326)(tslib@2.6.2)(typescript@5.3.3) '@guardian/identity-auth-frontend': specifier: ^4.0.0 - version: 4.0.0(@guardian/identity-auth@2.1.0)(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3) + version: 4.0.0(@guardian/identity-auth@2.1.0)(@guardian/libs@0.0.0-canary-20240606084326)(tslib@2.6.2)(typescript@5.3.3) '@guardian/libs': - specifier: 0.0.0-canary-20240605094526 - version: 0.0.0-canary-20240605094526(tslib@2.6.2)(typescript@5.3.3) + specifier: 0.0.0-canary-20240606084326 + version: 0.0.0-canary-20240606084326(tslib@2.6.2)(typescript@5.3.3) '@guardian/prettier': specifier: 4.0.0 version: 4.0.0(prettier@2.8.8)(tslib@2.6.2) @@ -1750,7 +1750,7 @@ packages: tslib: 2.6.2 dev: true - /@guardian/core-web-vitals@6.0.0(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3)(web-vitals@3.5.2): + /@guardian/core-web-vitals@6.0.0(@guardian/libs@0.0.0-canary-20240606084326)(tslib@2.6.2)(typescript@5.3.3)(web-vitals@3.5.2): resolution: {integrity: sha512-kwH1VsQQMn+sPZis1zYYcCYzedNpen6tk3CtVjJlmtHV4nK6i6FnMfhHgbtqECDsqrHdTzRbwN2Lodh1f8D5lA==} peerDependencies: '@guardian/libs': ^16.0.0 @@ -1761,7 +1761,7 @@ packages: typescript: optional: true dependencies: - '@guardian/libs': 0.0.0-canary-20240605094526(tslib@2.6.2)(typescript@5.3.3) + '@guardian/libs': 0.0.0-canary-20240606084326(tslib@2.6.2)(typescript@5.3.3) tslib: 2.6.2 typescript: 5.3.3 web-vitals: 3.5.2 @@ -1806,7 +1806,7 @@ packages: - supports-color dev: true - /@guardian/identity-auth-frontend@4.0.0(@guardian/identity-auth@2.1.0)(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3): + /@guardian/identity-auth-frontend@4.0.0(@guardian/identity-auth@2.1.0)(@guardian/libs@0.0.0-canary-20240606084326)(tslib@2.6.2)(typescript@5.3.3): resolution: {integrity: sha512-lSXpRF54eEkxbQXEzJTXYDqzMDHl345Ac/Y7M8/OnKee0vtbR1hCjfm70HbcIXpUyx+TaNV8Ka4bqkR9VwJCPA==} peerDependencies: '@guardian/identity-auth': ^2.1.0 @@ -1817,13 +1817,13 @@ packages: typescript: optional: true dependencies: - '@guardian/identity-auth': 2.1.0(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3) - '@guardian/libs': 0.0.0-canary-20240605094526(tslib@2.6.2)(typescript@5.3.3) + '@guardian/identity-auth': 2.1.0(@guardian/libs@0.0.0-canary-20240606084326)(tslib@2.6.2)(typescript@5.3.3) + '@guardian/libs': 0.0.0-canary-20240606084326(tslib@2.6.2)(typescript@5.3.3) tslib: 2.6.2 typescript: 5.3.3 dev: true - /@guardian/identity-auth@2.1.0(@guardian/libs@0.0.0-canary-20240605094526)(tslib@2.6.2)(typescript@5.3.3): + /@guardian/identity-auth@2.1.0(@guardian/libs@0.0.0-canary-20240606084326)(tslib@2.6.2)(typescript@5.3.3): resolution: {integrity: sha512-+AM0pcmRvRZUf92RYGJ2Q6KK1JpnQIxZ6pafsaBMGnF0IwiIk9DdfhaYZl0cyPQ3PwLTJJw2aSl453ivPAmHbw==} peerDependencies: '@guardian/libs': ^16.0.0 @@ -1833,13 +1833,13 @@ packages: typescript: optional: true dependencies: - '@guardian/libs': 0.0.0-canary-20240605094526(tslib@2.6.2)(typescript@5.3.3) + '@guardian/libs': 0.0.0-canary-20240606084326(tslib@2.6.2)(typescript@5.3.3) tslib: 2.6.2 typescript: 5.3.3 dev: true - /@guardian/libs@0.0.0-canary-20240605094526(tslib@2.6.2)(typescript@5.3.3): - resolution: {integrity: sha512-Ldz7/8IWZnufVA/1wPFUpzD0CzmqfAqsBriMYJ/Vv93K1/cTJuACXt8d4pQUJn5ozZFyKhr1CjIXPj/q79uQng==} + /@guardian/libs@0.0.0-canary-20240606084326(tslib@2.6.2)(typescript@5.3.3): + resolution: {integrity: sha512-APrDDfD+6OiUJLjYXpsaXHjELb4i+CGMdPzVnDO4O2PoYenWbBxn0U5/mtYO6QOWhTPZZD+tp0ZQRCJWE1UO8g==} peerDependencies: tslib: ^2.6.2 typescript: ~5.3.3 From a48835b5fe3c039c9cccd7f658afb038dba7186e Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Tue, 20 Aug 2024 14:45:42 +0100 Subject: [PATCH 05/20] Change ccpa to usnat --- src/core/targeting/youtube.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/targeting/youtube.ts b/src/core/targeting/youtube.ts index 64a7ceee7..7d1ae44fd 100644 --- a/src/core/targeting/youtube.ts +++ b/src/core/targeting/youtube.ts @@ -41,7 +41,7 @@ const buildAdsConfig = ( }, }; - if (cmpConsent.framework === 'ccpa' || cmpConsent.framework === 'aus') { + if (cmpConsent.framework === 'usnat' || cmpConsent.framework === 'aus') { return { ...defaultAdsConfig, restrictedDataProcessor: !cmpConsent.canTarget, From cea0fb335d8dbe1ba6fa032c19f9c4c23f62f87f Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Tue, 20 Aug 2024 14:48:39 +0100 Subject: [PATCH 06/20] Use updated beta package --- package.json | 2 +- pnpm-lock.yaml | 40 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 12a80a667..9bbc4ebd1 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@guardian/eslint-config-typescript": "^11.0.0", "@guardian/identity-auth": "^3.0.0", "@guardian/identity-auth-frontend": "^5.0.0", - "@guardian/libs": "18.0.0", + "@guardian/libs": "0.0.0-canary-20240819084206", "@guardian/prettier": "8.0.1", "@guardian/source": "6.1.0", "@playwright/test": "1.46.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b7a75de2d..425010e6f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -78,19 +78,19 @@ devDependencies: version: 6.1.1(browserslist@4.23.0)(tslib@2.6.2) '@guardian/core-web-vitals': specifier: 7.0.0 - version: 7.0.0(@guardian/libs@18.0.0)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3) + version: 7.0.0(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3) '@guardian/eslint-config-typescript': specifier: ^11.0.0 version: 11.0.0(eslint@8.57.0)(tslib@2.6.2)(typescript@5.5.4) '@guardian/identity-auth': specifier: ^3.0.0 - version: 3.0.1(@guardian/libs@18.0.0)(tslib@2.6.2)(typescript@5.5.4) + version: 3.0.1(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4) '@guardian/identity-auth-frontend': specifier: ^5.0.0 - version: 5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@18.0.0)(tslib@2.6.2)(typescript@5.5.4) + version: 5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4) '@guardian/libs': - specifier: 18.0.0 - version: 18.0.0(tslib@2.6.2)(typescript@5.5.4) + specifier: 0.0.0-canary-20240819084206 + version: 0.0.0-canary-20240819084206(tslib@2.6.2)(typescript@5.5.4) '@guardian/prettier': specifier: 8.0.1 version: 8.0.1(prettier@3.3.3)(tslib@2.6.2) @@ -1744,7 +1744,7 @@ packages: tslib: 2.6.2 dev: true - /@guardian/core-web-vitals@7.0.0(@guardian/libs@18.0.0)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3): + /@guardian/core-web-vitals@7.0.0(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3): resolution: {integrity: sha512-1JLUQjkLY8SXYJqcy0TiE9/9hCcmyIlmMpRoW8Ygn/qGtyNxG+zzwkwsgtJIP+B0ZjtDqfukra2IV9l7wX5A0g==} peerDependencies: '@guardian/libs': ^18.0.0 @@ -1755,7 +1755,7 @@ packages: typescript: optional: true dependencies: - '@guardian/libs': 18.0.0(tslib@2.6.2)(typescript@5.5.4) + '@guardian/libs': 0.0.0-canary-20240819084206(tslib@2.6.2)(typescript@5.5.4) tslib: 2.6.2 typescript: 5.5.4 web-vitals: 4.2.3 @@ -1800,7 +1800,7 @@ packages: - supports-color dev: true - /@guardian/identity-auth-frontend@5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@18.0.0)(tslib@2.6.2)(typescript@5.5.4): + /@guardian/identity-auth-frontend@5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4): resolution: {integrity: sha512-Y5wIg8Zo92jl/ChZ4v/Ve3CGQWnoZSfkrhwSOIoZPm88YvijEASxHteVF04QOy/rhVs1O6AQJfl5Ilx244zS6w==} peerDependencies: '@guardian/identity-auth': ^3.0.0 @@ -1811,13 +1811,13 @@ packages: typescript: optional: true dependencies: - '@guardian/identity-auth': 3.0.1(@guardian/libs@18.0.0)(tslib@2.6.2)(typescript@5.5.4) - '@guardian/libs': 18.0.0(tslib@2.6.2)(typescript@5.5.4) + '@guardian/identity-auth': 3.0.1(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4) + '@guardian/libs': 0.0.0-canary-20240819084206(tslib@2.6.2)(typescript@5.5.4) tslib: 2.6.2 typescript: 5.5.4 dev: true - /@guardian/identity-auth@3.0.1(@guardian/libs@18.0.0)(tslib@2.6.2)(typescript@5.5.4): + /@guardian/identity-auth@3.0.1(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4): resolution: {integrity: sha512-QwvQY6BmirP9Me2DkVkNCq0VQeNMzko9zG73G9l0XpQKk5+tTPUf31kyj06Uw11pWUfNacscjbfSU4rDqZOxCA==} peerDependencies: '@guardian/libs': ^18.0.0 @@ -1827,36 +1827,36 @@ packages: typescript: optional: true dependencies: - '@guardian/libs': 18.0.0(tslib@2.6.2)(typescript@5.5.4) + '@guardian/libs': 0.0.0-canary-20240819084206(tslib@2.6.2)(typescript@5.5.4) tslib: 2.6.2 typescript: 5.5.4 dev: true - /@guardian/libs@16.1.2(tslib@2.6.2)(typescript@5.5.4): - resolution: {integrity: sha512-lE0mzuKWvf03mTPvvcdlfDQwNewfRKFzQqqz3r6ghpHLsTwt9crBrC5/ZCS+R4eymPORB5SrUsfjsp7BQizcpg==} + /@guardian/libs@0.0.0-canary-20240819084206(tslib@2.6.2)(typescript@5.5.4): + resolution: {integrity: sha512-t9P6LBuE7qXzF7XXLJ5ZvUAhgcGTvxnu0o4zFBejeaalogTslBqkvai+eYHLuGnaD0daCMGxAA33FNY47cRf9A==} peerDependencies: tslib: ^2.6.2 - typescript: ~5.3.3 + typescript: ~5.5.2 peerDependenciesMeta: typescript: optional: true dependencies: tslib: 2.6.2 typescript: 5.5.4 - dev: false + dev: true - /@guardian/libs@18.0.0(tslib@2.6.2)(typescript@5.5.4): - resolution: {integrity: sha512-V/aVeCg3yEDBiw6ykAIRux3HCpORKPAzTReDogg2ZHf8BV0v7P2ysc/etO5TW4+8FVd6X8SpX3GmTP3YePx8FQ==} + /@guardian/libs@16.1.2(tslib@2.6.2)(typescript@5.5.4): + resolution: {integrity: sha512-lE0mzuKWvf03mTPvvcdlfDQwNewfRKFzQqqz3r6ghpHLsTwt9crBrC5/ZCS+R4eymPORB5SrUsfjsp7BQizcpg==} peerDependencies: tslib: ^2.6.2 - typescript: ~5.5.2 + typescript: ~5.3.3 peerDependenciesMeta: typescript: optional: true dependencies: tslib: 2.6.2 typescript: 5.5.4 - dev: true + dev: false /@guardian/prebid.js@8.52.0-1(babel-core@7.0.0-bridge.0)(tslib@2.6.2)(typescript@5.5.4): resolution: {integrity: sha512-nXEKVwJ0dGpKFZp31tiAHQ4gQAgLq6Ob/e3X6cxx1P87FeFBg7zFj3pgk6VfxySz6R6SXIL5BOts/SSTkVwlUQ==} From d8ec1539e7c6719229d4287d846d83979d86747b Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Tue, 20 Aug 2024 14:58:55 +0100 Subject: [PATCH 07/20] Replace ccpa with usnat as framework --- src/lib/header-bidding/prebid/prebid.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/header-bidding/prebid/prebid.ts b/src/lib/header-bidding/prebid/prebid.ts index 3143cbb72..fee79b42c 100644 --- a/src/lib/header-bidding/prebid/prebid.ts +++ b/src/lib/header-bidding/prebid/prebid.ts @@ -261,7 +261,7 @@ const initialise = ( const consentManagement = (): ConsentManagement => { switch (framework) { case 'aus': - case 'ccpa': + case 'usnat': // https://docs.prebid.org/dev-docs/modules/consentManagementUsp.html return { usp: { From 1249c993f9f4d3d1ab23e77a57121802f3fc98ac Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Tue, 20 Aug 2024 14:59:31 +0100 Subject: [PATCH 08/20] Update framework to usnat in tests --- src/core/send-commercial-metrics.spec.ts | 4 ++-- src/core/targeting/build-page-targeting.spec.ts | 4 ++-- src/core/targeting/personalised.spec.ts | 14 +++++++------- src/core/targeting/youtube.spec.ts | 6 +++--- src/core/track-gpc-signal.spec.ts | 6 +++--- src/init/consented/comscore.spec.ts | 4 ++-- src/init/consented/prepare-googletag.spec.ts | 4 ++-- src/init/consented/prepare-prebid.spec.ts | 4 ++-- src/init/consented/third-party-tags.spec.ts | 4 ++-- src/lib/header-bidding/a9/a9.spec.ts | 2 +- src/lib/header-bidding/prebid/prebid.spec.ts | 2 +- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/core/send-commercial-metrics.spec.ts b/src/core/send-commercial-metrics.spec.ts index bdff96d06..38334c484 100644 --- a/src/core/send-commercial-metrics.spec.ts +++ b/src/core/send-commercial-metrics.spec.ts @@ -106,13 +106,13 @@ const tcfv2AllConsentExceptPurpose8: ConsentState = { const ccpaConsent: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; const ccpaNonConsent: ConsentState = { ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'ccpa', + framework: 'usnat', }; const setVisibility = (value: 'hidden' | 'visible'): void => { diff --git a/src/core/targeting/build-page-targeting.spec.ts b/src/core/targeting/build-page-targeting.spec.ts index 36e5c6587..0807bb8df 100644 --- a/src/core/targeting/build-page-targeting.spec.ts +++ b/src/core/targeting/build-page-targeting.spec.ts @@ -56,13 +56,13 @@ const mockViewport = (width: number, height: number): void => { const ccpaWithConsentMock: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; const ccpaWithoutConsentMock: ConsentState = { ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'ccpa', + framework: 'usnat', }; // AUS diff --git a/src/core/targeting/personalised.spec.ts b/src/core/targeting/personalised.spec.ts index 60e27d0ca..718eadc01 100644 --- a/src/core/targeting/personalised.spec.ts +++ b/src/core/targeting/personalised.spec.ts @@ -77,7 +77,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; storage.local.setRaw(FREQUENCY_KEY, '4'); @@ -99,7 +99,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'ccpa', + framework: 'usnat', }; storage.local.setRaw(FREQUENCY_KEY, '4'); @@ -193,7 +193,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; storage.local.setRaw(FREQUENCY_KEY, String(val)); @@ -234,7 +234,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; storage.local.remove(AMTGRP_STORAGE_KEY); @@ -281,7 +281,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'ccpa', + framework: 'usnat', }; const targeting = getPersonalisedTargeting({ @@ -313,7 +313,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; storage.local.setRaw(PERMUTIVE_KEY, '[1, 2, 3]'); @@ -330,7 +330,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; storage.local.setRaw(PERMUTIVE_KEY, '[]'); diff --git a/src/core/targeting/youtube.spec.ts b/src/core/targeting/youtube.spec.ts index 427df3338..5a03641a9 100644 --- a/src/core/targeting/youtube.spec.ts +++ b/src/core/targeting/youtube.spec.ts @@ -19,7 +19,7 @@ describe('YouTube Ad Targeting Object for consent frameworks', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', } as ConsentState, isAdFreeUser: false, adUnit: 'someAdUnit', @@ -46,7 +46,7 @@ describe('YouTube Ad Targeting Object for consent frameworks', () => { signalStatus: 'ready', }, canTarget: false, - framework: 'ccpa', + framework: 'usnat', } as ConsentState, isAdFreeUser: false, adUnit: 'someAdUnit', @@ -73,7 +73,7 @@ describe('YouTube Ad Targeting Object for consent frameworks', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', } as ConsentState, isAdFreeUser: false, adUnit: 'someAdUnit', diff --git a/src/core/track-gpc-signal.spec.ts b/src/core/track-gpc-signal.spec.ts index 510e9ec35..b0aa44568 100644 --- a/src/core/track-gpc-signal.spec.ts +++ b/src/core/track-gpc-signal.spec.ts @@ -12,7 +12,7 @@ describe('initTrackGpcSignal', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; initTrackGpcSignal(consentState); @@ -29,7 +29,7 @@ describe('initTrackGpcSignal', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', gpcSignal: false, }; @@ -47,7 +47,7 @@ describe('initTrackGpcSignal', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', gpcSignal: true, }; diff --git a/src/init/consented/comscore.spec.ts b/src/init/consented/comscore.spec.ts index 81e88ca3f..da5d2f50c 100644 --- a/src/init/consented/comscore.spec.ts +++ b/src/init/consented/comscore.spec.ts @@ -44,7 +44,7 @@ const ccpaWithConsent = { signalStatus: 'ready', }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', } as ConsentState; const ccpaWithoutConsent = { @@ -53,7 +53,7 @@ const ccpaWithoutConsent = { signalStatus: 'ready', }, canTarget: false, - framework: 'ccpa', + framework: 'usnat', } as ConsentState; const AusWithoutConsent = { diff --git a/src/init/consented/prepare-googletag.spec.ts b/src/init/consented/prepare-googletag.spec.ts index 41fe3c22d..9505bf93c 100644 --- a/src/init/consented/prepare-googletag.spec.ts +++ b/src/init/consented/prepare-googletag.spec.ts @@ -216,13 +216,13 @@ const ausRejected: ConsentState = { const ccpaWithConsent: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; const ccpaWithoutConsent: ConsentState = { ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'ccpa', + framework: 'usnat', }; describe('DFP', () => { diff --git a/src/init/consented/prepare-prebid.spec.ts b/src/init/consented/prepare-prebid.spec.ts index 9a322086d..bb0d7a241 100644 --- a/src/init/consented/prepare-prebid.spec.ts +++ b/src/init/consented/prepare-prebid.spec.ts @@ -94,13 +94,13 @@ const tcfv2WithoutConsent = { const ccpaWithConsent = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', } as ConsentState; const ccpaWithoutConsent = { ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'ccpa', + framework: 'usnat', } as ConsentState; const ausWithConsent = { diff --git a/src/init/consented/third-party-tags.spec.ts b/src/init/consented/third-party-tags.spec.ts index 020bdac5f..24392c0df 100644 --- a/src/init/consented/third-party-tags.spec.ts +++ b/src/init/consented/third-party-tags.spec.ts @@ -198,7 +198,7 @@ describe('third party tags', () => { mockOnConsent({ ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }); mockGetConsentFor(true); await insertScripts( @@ -211,7 +211,7 @@ describe('third party tags', () => { mockOnConsent({ ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'ccpa', + framework: 'usnat', }); mockGetConsentFor(false); await insertScripts( diff --git a/src/lib/header-bidding/a9/a9.spec.ts b/src/lib/header-bidding/a9/a9.spec.ts index c03a64da6..fe2333abe 100644 --- a/src/lib/header-bidding/a9/a9.spec.ts +++ b/src/lib/header-bidding/a9/a9.spec.ts @@ -31,7 +31,7 @@ const CcpaWithConsentMock = (callback: OnConsentChangeCallback) => callback({ ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }); jest.mock('define/Advert', () => diff --git a/src/lib/header-bidding/prebid/prebid.spec.ts b/src/lib/header-bidding/prebid/prebid.spec.ts index 6ad67c90a..50d8c5810 100644 --- a/src/lib/header-bidding/prebid/prebid.spec.ts +++ b/src/lib/header-bidding/prebid/prebid.spec.ts @@ -112,7 +112,7 @@ describe('initialise', () => { }); test('should generate correct Prebid config consent management in CCPA', () => { - prebid.initialise(window, 'ccpa'); + prebid.initialise(window, 'usnat'); expect(window.pbjs?.getConfig('consentManagement')).toEqual({ usp: { cmpApi: 'iab', From 13bc1b7c9660448ee50d951017b77233098df3f6 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Tue, 27 Aug 2024 09:56:59 +0100 Subject: [PATCH 09/20] Bumping @guardian/libs beta version --- package.json | 2 +- pnpm-lock.yaml | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 9bbc4ebd1..92aecf992 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@guardian/eslint-config-typescript": "^11.0.0", "@guardian/identity-auth": "^3.0.0", "@guardian/identity-auth-frontend": "^5.0.0", - "@guardian/libs": "0.0.0-canary-20240819084206", + "@guardian/libs": "0.0.0-canary-20240827084710", "@guardian/prettier": "8.0.1", "@guardian/source": "6.1.0", "@playwright/test": "1.46.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 425010e6f..5e09dd10d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -78,19 +78,19 @@ devDependencies: version: 6.1.1(browserslist@4.23.0)(tslib@2.6.2) '@guardian/core-web-vitals': specifier: 7.0.0 - version: 7.0.0(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3) + version: 7.0.0(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3) '@guardian/eslint-config-typescript': specifier: ^11.0.0 version: 11.0.0(eslint@8.57.0)(tslib@2.6.2)(typescript@5.5.4) '@guardian/identity-auth': specifier: ^3.0.0 - version: 3.0.1(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4) + version: 3.0.1(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4) '@guardian/identity-auth-frontend': specifier: ^5.0.0 - version: 5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4) + version: 5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4) '@guardian/libs': - specifier: 0.0.0-canary-20240819084206 - version: 0.0.0-canary-20240819084206(tslib@2.6.2)(typescript@5.5.4) + specifier: 0.0.0-canary-20240827084710 + version: 0.0.0-canary-20240827084710(tslib@2.6.2)(typescript@5.5.4) '@guardian/prettier': specifier: 8.0.1 version: 8.0.1(prettier@3.3.3)(tslib@2.6.2) @@ -1744,7 +1744,7 @@ packages: tslib: 2.6.2 dev: true - /@guardian/core-web-vitals@7.0.0(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3): + /@guardian/core-web-vitals@7.0.0(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3): resolution: {integrity: sha512-1JLUQjkLY8SXYJqcy0TiE9/9hCcmyIlmMpRoW8Ygn/qGtyNxG+zzwkwsgtJIP+B0ZjtDqfukra2IV9l7wX5A0g==} peerDependencies: '@guardian/libs': ^18.0.0 @@ -1755,7 +1755,7 @@ packages: typescript: optional: true dependencies: - '@guardian/libs': 0.0.0-canary-20240819084206(tslib@2.6.2)(typescript@5.5.4) + '@guardian/libs': 0.0.0-canary-20240827084710(tslib@2.6.2)(typescript@5.5.4) tslib: 2.6.2 typescript: 5.5.4 web-vitals: 4.2.3 @@ -1800,7 +1800,7 @@ packages: - supports-color dev: true - /@guardian/identity-auth-frontend@5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4): + /@guardian/identity-auth-frontend@5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4): resolution: {integrity: sha512-Y5wIg8Zo92jl/ChZ4v/Ve3CGQWnoZSfkrhwSOIoZPm88YvijEASxHteVF04QOy/rhVs1O6AQJfl5Ilx244zS6w==} peerDependencies: '@guardian/identity-auth': ^3.0.0 @@ -1811,13 +1811,13 @@ packages: typescript: optional: true dependencies: - '@guardian/identity-auth': 3.0.1(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4) - '@guardian/libs': 0.0.0-canary-20240819084206(tslib@2.6.2)(typescript@5.5.4) + '@guardian/identity-auth': 3.0.1(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4) + '@guardian/libs': 0.0.0-canary-20240827084710(tslib@2.6.2)(typescript@5.5.4) tslib: 2.6.2 typescript: 5.5.4 dev: true - /@guardian/identity-auth@3.0.1(@guardian/libs@0.0.0-canary-20240819084206)(tslib@2.6.2)(typescript@5.5.4): + /@guardian/identity-auth@3.0.1(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4): resolution: {integrity: sha512-QwvQY6BmirP9Me2DkVkNCq0VQeNMzko9zG73G9l0XpQKk5+tTPUf31kyj06Uw11pWUfNacscjbfSU4rDqZOxCA==} peerDependencies: '@guardian/libs': ^18.0.0 @@ -1827,13 +1827,13 @@ packages: typescript: optional: true dependencies: - '@guardian/libs': 0.0.0-canary-20240819084206(tslib@2.6.2)(typescript@5.5.4) + '@guardian/libs': 0.0.0-canary-20240827084710(tslib@2.6.2)(typescript@5.5.4) tslib: 2.6.2 typescript: 5.5.4 dev: true - /@guardian/libs@0.0.0-canary-20240819084206(tslib@2.6.2)(typescript@5.5.4): - resolution: {integrity: sha512-t9P6LBuE7qXzF7XXLJ5ZvUAhgcGTvxnu0o4zFBejeaalogTslBqkvai+eYHLuGnaD0daCMGxAA33FNY47cRf9A==} + /@guardian/libs@0.0.0-canary-20240827084710(tslib@2.6.2)(typescript@5.5.4): + resolution: {integrity: sha512-1iVPyOU+PGmQXKkcwvU/Icxd+0xWGBxCQ07/5bxcGD3z3/FbBxRRPGR5jnW+Iv7Xr16gZUxDJldBVonDPj213w==} peerDependencies: tslib: ^2.6.2 typescript: ~5.5.2 From dc1f4ee2bec373215bcc90238e8bf480ebc3ac6c Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:16:47 +0100 Subject: [PATCH 10/20] Include ccpa in framework check --- src/core/targeting/youtube.ts | 6 +++++- src/lib/header-bidding/prebid/prebid.ts | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/targeting/youtube.ts b/src/core/targeting/youtube.ts index 7d1ae44fd..001b5b44e 100644 --- a/src/core/targeting/youtube.ts +++ b/src/core/targeting/youtube.ts @@ -41,7 +41,11 @@ const buildAdsConfig = ( }, }; - if (cmpConsent.framework === 'usnat' || cmpConsent.framework === 'aus') { + if ( + cmpConsent.framework === 'ccpa' || + cmpConsent.framework === 'usnat' || + cmpConsent.framework === 'aus' + ) { return { ...defaultAdsConfig, restrictedDataProcessor: !cmpConsent.canTarget, diff --git a/src/lib/header-bidding/prebid/prebid.ts b/src/lib/header-bidding/prebid/prebid.ts index fee79b42c..46a54e446 100644 --- a/src/lib/header-bidding/prebid/prebid.ts +++ b/src/lib/header-bidding/prebid/prebid.ts @@ -262,6 +262,7 @@ const initialise = ( switch (framework) { case 'aus': case 'usnat': + case 'ccpa': // https://docs.prebid.org/dev-docs/modules/consentManagementUsp.html return { usp: { From 9cd5172a408794e420105e55e6aff7da04034409 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:17:55 +0100 Subject: [PATCH 11/20] Revert framework in tests to ccpa --- src/core/send-commercial-metrics.spec.ts | 4 ++-- src/core/targeting/build-page-targeting.spec.ts | 4 ++-- src/core/targeting/personalised.spec.ts | 14 +++++++------- src/core/targeting/youtube.spec.ts | 6 +++--- src/init/consented/comscore.spec.ts | 4 ++-- src/init/consented/prepare-googletag.spec.ts | 4 ++-- src/init/consented/prepare-prebid.spec.ts | 4 ++-- src/init/consented/third-party-tags.spec.ts | 4 ++-- src/lib/header-bidding/a9/a9.spec.ts | 2 +- src/lib/header-bidding/prebid/prebid.spec.ts | 2 +- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/core/send-commercial-metrics.spec.ts b/src/core/send-commercial-metrics.spec.ts index 38334c484..bdff96d06 100644 --- a/src/core/send-commercial-metrics.spec.ts +++ b/src/core/send-commercial-metrics.spec.ts @@ -106,13 +106,13 @@ const tcfv2AllConsentExceptPurpose8: ConsentState = { const ccpaConsent: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', }; const ccpaNonConsent: ConsentState = { ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'usnat', + framework: 'ccpa', }; const setVisibility = (value: 'hidden' | 'visible'): void => { diff --git a/src/core/targeting/build-page-targeting.spec.ts b/src/core/targeting/build-page-targeting.spec.ts index 0807bb8df..36e5c6587 100644 --- a/src/core/targeting/build-page-targeting.spec.ts +++ b/src/core/targeting/build-page-targeting.spec.ts @@ -56,13 +56,13 @@ const mockViewport = (width: number, height: number): void => { const ccpaWithConsentMock: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', }; const ccpaWithoutConsentMock: ConsentState = { ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'usnat', + framework: 'ccpa', }; // AUS diff --git a/src/core/targeting/personalised.spec.ts b/src/core/targeting/personalised.spec.ts index 718eadc01..60e27d0ca 100644 --- a/src/core/targeting/personalised.spec.ts +++ b/src/core/targeting/personalised.spec.ts @@ -77,7 +77,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', }; storage.local.setRaw(FREQUENCY_KEY, '4'); @@ -99,7 +99,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'usnat', + framework: 'ccpa', }; storage.local.setRaw(FREQUENCY_KEY, '4'); @@ -193,7 +193,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', }; storage.local.setRaw(FREQUENCY_KEY, String(val)); @@ -234,7 +234,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', }; storage.local.remove(AMTGRP_STORAGE_KEY); @@ -281,7 +281,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'usnat', + framework: 'ccpa', }; const targeting = getPersonalisedTargeting({ @@ -313,7 +313,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', }; storage.local.setRaw(PERMUTIVE_KEY, '[1, 2, 3]'); @@ -330,7 +330,7 @@ describe('Personalised targeting', () => { const state: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', }; storage.local.setRaw(PERMUTIVE_KEY, '[]'); diff --git a/src/core/targeting/youtube.spec.ts b/src/core/targeting/youtube.spec.ts index 5a03641a9..427df3338 100644 --- a/src/core/targeting/youtube.spec.ts +++ b/src/core/targeting/youtube.spec.ts @@ -19,7 +19,7 @@ describe('YouTube Ad Targeting Object for consent frameworks', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', } as ConsentState, isAdFreeUser: false, adUnit: 'someAdUnit', @@ -46,7 +46,7 @@ describe('YouTube Ad Targeting Object for consent frameworks', () => { signalStatus: 'ready', }, canTarget: false, - framework: 'usnat', + framework: 'ccpa', } as ConsentState, isAdFreeUser: false, adUnit: 'someAdUnit', @@ -73,7 +73,7 @@ describe('YouTube Ad Targeting Object for consent frameworks', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', } as ConsentState, isAdFreeUser: false, adUnit: 'someAdUnit', diff --git a/src/init/consented/comscore.spec.ts b/src/init/consented/comscore.spec.ts index da5d2f50c..81e88ca3f 100644 --- a/src/init/consented/comscore.spec.ts +++ b/src/init/consented/comscore.spec.ts @@ -44,7 +44,7 @@ const ccpaWithConsent = { signalStatus: 'ready', }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', } as ConsentState; const ccpaWithoutConsent = { @@ -53,7 +53,7 @@ const ccpaWithoutConsent = { signalStatus: 'ready', }, canTarget: false, - framework: 'usnat', + framework: 'ccpa', } as ConsentState; const AusWithoutConsent = { diff --git a/src/init/consented/prepare-googletag.spec.ts b/src/init/consented/prepare-googletag.spec.ts index 9505bf93c..41fe3c22d 100644 --- a/src/init/consented/prepare-googletag.spec.ts +++ b/src/init/consented/prepare-googletag.spec.ts @@ -216,13 +216,13 @@ const ausRejected: ConsentState = { const ccpaWithConsent: ConsentState = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', }; const ccpaWithoutConsent: ConsentState = { ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'usnat', + framework: 'ccpa', }; describe('DFP', () => { diff --git a/src/init/consented/prepare-prebid.spec.ts b/src/init/consented/prepare-prebid.spec.ts index bb0d7a241..9a322086d 100644 --- a/src/init/consented/prepare-prebid.spec.ts +++ b/src/init/consented/prepare-prebid.spec.ts @@ -94,13 +94,13 @@ const tcfv2WithoutConsent = { const ccpaWithConsent = { ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', } as ConsentState; const ccpaWithoutConsent = { ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'usnat', + framework: 'ccpa', } as ConsentState; const ausWithConsent = { diff --git a/src/init/consented/third-party-tags.spec.ts b/src/init/consented/third-party-tags.spec.ts index 24392c0df..020bdac5f 100644 --- a/src/init/consented/third-party-tags.spec.ts +++ b/src/init/consented/third-party-tags.spec.ts @@ -198,7 +198,7 @@ describe('third party tags', () => { mockOnConsent({ ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', }); mockGetConsentFor(true); await insertScripts( @@ -211,7 +211,7 @@ describe('third party tags', () => { mockOnConsent({ ccpa: { doNotSell: true, signalStatus: 'ready' }, canTarget: false, - framework: 'usnat', + framework: 'ccpa', }); mockGetConsentFor(false); await insertScripts( diff --git a/src/lib/header-bidding/a9/a9.spec.ts b/src/lib/header-bidding/a9/a9.spec.ts index fe2333abe..c03a64da6 100644 --- a/src/lib/header-bidding/a9/a9.spec.ts +++ b/src/lib/header-bidding/a9/a9.spec.ts @@ -31,7 +31,7 @@ const CcpaWithConsentMock = (callback: OnConsentChangeCallback) => callback({ ccpa: { doNotSell: false, signalStatus: 'ready' }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', }); jest.mock('define/Advert', () => diff --git a/src/lib/header-bidding/prebid/prebid.spec.ts b/src/lib/header-bidding/prebid/prebid.spec.ts index 50d8c5810..6ad67c90a 100644 --- a/src/lib/header-bidding/prebid/prebid.spec.ts +++ b/src/lib/header-bidding/prebid/prebid.spec.ts @@ -112,7 +112,7 @@ describe('initialise', () => { }); test('should generate correct Prebid config consent management in CCPA', () => { - prebid.initialise(window, 'usnat'); + prebid.initialise(window, 'ccpa'); expect(window.pbjs?.getConfig('consentManagement')).toEqual({ usp: { cmpApi: 'iab', From 845f81f1066a7564b5eb6e78faebe50ae0257216 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:59:36 +0100 Subject: [PATCH 12/20] Create lovely-balloons-sin.md --- .changeset/lovely-balloons-sin.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lovely-balloons-sin.md diff --git a/.changeset/lovely-balloons-sin.md b/.changeset/lovely-balloons-sin.md new file mode 100644 index 000000000..54021c952 --- /dev/null +++ b/.changeset/lovely-balloons-sin.md @@ -0,0 +1,5 @@ +--- +"@guardian/commercial": patch +--- + +Update @guardian/libs version which has updated its ConsentState object From 76304361278068ced627791ab8e376d854ed2ee9 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Wed, 28 Aug 2024 12:52:06 +0100 Subject: [PATCH 13/20] Remove traces of usnat. To be re-added in a later pr --- src/core/targeting/youtube.ts | 6 +----- src/core/track-gpc-signal.spec.ts | 6 +++--- src/lib/header-bidding/prebid/prebid.ts | 1 - 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/core/targeting/youtube.ts b/src/core/targeting/youtube.ts index 001b5b44e..64a7ceee7 100644 --- a/src/core/targeting/youtube.ts +++ b/src/core/targeting/youtube.ts @@ -41,11 +41,7 @@ const buildAdsConfig = ( }, }; - if ( - cmpConsent.framework === 'ccpa' || - cmpConsent.framework === 'usnat' || - cmpConsent.framework === 'aus' - ) { + if (cmpConsent.framework === 'ccpa' || cmpConsent.framework === 'aus') { return { ...defaultAdsConfig, restrictedDataProcessor: !cmpConsent.canTarget, diff --git a/src/core/track-gpc-signal.spec.ts b/src/core/track-gpc-signal.spec.ts index b0aa44568..510e9ec35 100644 --- a/src/core/track-gpc-signal.spec.ts +++ b/src/core/track-gpc-signal.spec.ts @@ -12,7 +12,7 @@ describe('initTrackGpcSignal', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', }; initTrackGpcSignal(consentState); @@ -29,7 +29,7 @@ describe('initTrackGpcSignal', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', gpcSignal: false, }; @@ -47,7 +47,7 @@ describe('initTrackGpcSignal', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'usnat', + framework: 'ccpa', gpcSignal: true, }; diff --git a/src/lib/header-bidding/prebid/prebid.ts b/src/lib/header-bidding/prebid/prebid.ts index 46a54e446..3143cbb72 100644 --- a/src/lib/header-bidding/prebid/prebid.ts +++ b/src/lib/header-bidding/prebid/prebid.ts @@ -261,7 +261,6 @@ const initialise = ( const consentManagement = (): ConsentManagement => { switch (framework) { case 'aus': - case 'usnat': case 'ccpa': // https://docs.prebid.org/dev-docs/modules/consentManagementUsp.html return { From 326174434e40f7875a74bc7ac6d364465af91e4e Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Thu, 29 Aug 2024 08:38:54 +0100 Subject: [PATCH 14/20] Revert "Remove traces of usnat." This reverts commit 76304361278068ced627791ab8e376d854ed2ee9. --- src/core/targeting/youtube.ts | 6 +++++- src/core/track-gpc-signal.spec.ts | 6 +++--- src/lib/header-bidding/prebid/prebid.ts | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/core/targeting/youtube.ts b/src/core/targeting/youtube.ts index 64a7ceee7..001b5b44e 100644 --- a/src/core/targeting/youtube.ts +++ b/src/core/targeting/youtube.ts @@ -41,7 +41,11 @@ const buildAdsConfig = ( }, }; - if (cmpConsent.framework === 'ccpa' || cmpConsent.framework === 'aus') { + if ( + cmpConsent.framework === 'ccpa' || + cmpConsent.framework === 'usnat' || + cmpConsent.framework === 'aus' + ) { return { ...defaultAdsConfig, restrictedDataProcessor: !cmpConsent.canTarget, diff --git a/src/core/track-gpc-signal.spec.ts b/src/core/track-gpc-signal.spec.ts index 510e9ec35..b0aa44568 100644 --- a/src/core/track-gpc-signal.spec.ts +++ b/src/core/track-gpc-signal.spec.ts @@ -12,7 +12,7 @@ describe('initTrackGpcSignal', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; initTrackGpcSignal(consentState); @@ -29,7 +29,7 @@ describe('initTrackGpcSignal', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', gpcSignal: false, }; @@ -47,7 +47,7 @@ describe('initTrackGpcSignal', () => { signalStatus: 'ready', }, canTarget: true, - framework: 'ccpa', + framework: 'usnat', gpcSignal: true, }; diff --git a/src/lib/header-bidding/prebid/prebid.ts b/src/lib/header-bidding/prebid/prebid.ts index 3143cbb72..46a54e446 100644 --- a/src/lib/header-bidding/prebid/prebid.ts +++ b/src/lib/header-bidding/prebid/prebid.ts @@ -261,6 +261,7 @@ const initialise = ( const consentManagement = (): ConsentManagement => { switch (framework) { case 'aus': + case 'usnat': case 'ccpa': // https://docs.prebid.org/dev-docs/modules/consentManagementUsp.html return { From eb37c7b6dbd824aa01d6fab332d1136a3269e217 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Thu, 29 Aug 2024 08:40:49 +0100 Subject: [PATCH 15/20] Update libs beta --- package.json | 2 +- pnpm-lock.yaml | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 92aecf992..8dc9f78a5 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@guardian/eslint-config-typescript": "^11.0.0", "@guardian/identity-auth": "^3.0.0", "@guardian/identity-auth-frontend": "^5.0.0", - "@guardian/libs": "0.0.0-canary-20240827084710", + "@guardian/libs": "0.0.0-canary-20240829071655", "@guardian/prettier": "8.0.1", "@guardian/source": "6.1.0", "@playwright/test": "1.46.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5e09dd10d..528f32d31 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -78,19 +78,19 @@ devDependencies: version: 6.1.1(browserslist@4.23.0)(tslib@2.6.2) '@guardian/core-web-vitals': specifier: 7.0.0 - version: 7.0.0(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3) + version: 7.0.0(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3) '@guardian/eslint-config-typescript': specifier: ^11.0.0 version: 11.0.0(eslint@8.57.0)(tslib@2.6.2)(typescript@5.5.4) '@guardian/identity-auth': specifier: ^3.0.0 - version: 3.0.1(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4) + version: 3.0.1(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4) '@guardian/identity-auth-frontend': specifier: ^5.0.0 - version: 5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4) + version: 5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4) '@guardian/libs': - specifier: 0.0.0-canary-20240827084710 - version: 0.0.0-canary-20240827084710(tslib@2.6.2)(typescript@5.5.4) + specifier: 0.0.0-canary-20240829071655 + version: 0.0.0-canary-20240829071655(tslib@2.6.2)(typescript@5.5.4) '@guardian/prettier': specifier: 8.0.1 version: 8.0.1(prettier@3.3.3)(tslib@2.6.2) @@ -1744,7 +1744,7 @@ packages: tslib: 2.6.2 dev: true - /@guardian/core-web-vitals@7.0.0(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3): + /@guardian/core-web-vitals@7.0.0(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3): resolution: {integrity: sha512-1JLUQjkLY8SXYJqcy0TiE9/9hCcmyIlmMpRoW8Ygn/qGtyNxG+zzwkwsgtJIP+B0ZjtDqfukra2IV9l7wX5A0g==} peerDependencies: '@guardian/libs': ^18.0.0 @@ -1755,7 +1755,7 @@ packages: typescript: optional: true dependencies: - '@guardian/libs': 0.0.0-canary-20240827084710(tslib@2.6.2)(typescript@5.5.4) + '@guardian/libs': 0.0.0-canary-20240829071655(tslib@2.6.2)(typescript@5.5.4) tslib: 2.6.2 typescript: 5.5.4 web-vitals: 4.2.3 @@ -1800,7 +1800,7 @@ packages: - supports-color dev: true - /@guardian/identity-auth-frontend@5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4): + /@guardian/identity-auth-frontend@5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4): resolution: {integrity: sha512-Y5wIg8Zo92jl/ChZ4v/Ve3CGQWnoZSfkrhwSOIoZPm88YvijEASxHteVF04QOy/rhVs1O6AQJfl5Ilx244zS6w==} peerDependencies: '@guardian/identity-auth': ^3.0.0 @@ -1811,13 +1811,13 @@ packages: typescript: optional: true dependencies: - '@guardian/identity-auth': 3.0.1(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4) - '@guardian/libs': 0.0.0-canary-20240827084710(tslib@2.6.2)(typescript@5.5.4) + '@guardian/identity-auth': 3.0.1(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4) + '@guardian/libs': 0.0.0-canary-20240829071655(tslib@2.6.2)(typescript@5.5.4) tslib: 2.6.2 typescript: 5.5.4 dev: true - /@guardian/identity-auth@3.0.1(@guardian/libs@0.0.0-canary-20240827084710)(tslib@2.6.2)(typescript@5.5.4): + /@guardian/identity-auth@3.0.1(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4): resolution: {integrity: sha512-QwvQY6BmirP9Me2DkVkNCq0VQeNMzko9zG73G9l0XpQKk5+tTPUf31kyj06Uw11pWUfNacscjbfSU4rDqZOxCA==} peerDependencies: '@guardian/libs': ^18.0.0 @@ -1827,13 +1827,13 @@ packages: typescript: optional: true dependencies: - '@guardian/libs': 0.0.0-canary-20240827084710(tslib@2.6.2)(typescript@5.5.4) + '@guardian/libs': 0.0.0-canary-20240829071655(tslib@2.6.2)(typescript@5.5.4) tslib: 2.6.2 typescript: 5.5.4 dev: true - /@guardian/libs@0.0.0-canary-20240827084710(tslib@2.6.2)(typescript@5.5.4): - resolution: {integrity: sha512-1iVPyOU+PGmQXKkcwvU/Icxd+0xWGBxCQ07/5bxcGD3z3/FbBxRRPGR5jnW+Iv7Xr16gZUxDJldBVonDPj213w==} + /@guardian/libs@0.0.0-canary-20240829071655(tslib@2.6.2)(typescript@5.5.4): + resolution: {integrity: sha512-KIbhPRiJiKaDArdL0NjjgjD1dnQsLfeg3VNqo7AJJ5cgZlxt7HqLvFA3+xyEf43oc8V9xTfAXnT7/geOj7Un0g==} peerDependencies: tslib: ^2.6.2 typescript: ~5.5.2 From 9db3e24c38d8e058d920bc4d75ea1b42d25b296b Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:10:45 +0100 Subject: [PATCH 16/20] Bump libs beta --- package.json | 2 +- pnpm-lock.yaml | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 8dc9f78a5..01a79a3d1 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@guardian/eslint-config-typescript": "^11.0.0", "@guardian/identity-auth": "^3.0.0", "@guardian/identity-auth-frontend": "^5.0.0", - "@guardian/libs": "0.0.0-canary-20240829071655", + "@guardian/libs": "0.0.0-canary-20240829110247", "@guardian/prettier": "8.0.1", "@guardian/source": "6.1.0", "@playwright/test": "1.46.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 528f32d31..7a6888492 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -78,19 +78,19 @@ devDependencies: version: 6.1.1(browserslist@4.23.0)(tslib@2.6.2) '@guardian/core-web-vitals': specifier: 7.0.0 - version: 7.0.0(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3) + version: 7.0.0(@guardian/libs@0.0.0-canary-20240829110247)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3) '@guardian/eslint-config-typescript': specifier: ^11.0.0 version: 11.0.0(eslint@8.57.0)(tslib@2.6.2)(typescript@5.5.4) '@guardian/identity-auth': specifier: ^3.0.0 - version: 3.0.1(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4) + version: 3.0.1(@guardian/libs@0.0.0-canary-20240829110247)(tslib@2.6.2)(typescript@5.5.4) '@guardian/identity-auth-frontend': specifier: ^5.0.0 - version: 5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4) + version: 5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240829110247)(tslib@2.6.2)(typescript@5.5.4) '@guardian/libs': - specifier: 0.0.0-canary-20240829071655 - version: 0.0.0-canary-20240829071655(tslib@2.6.2)(typescript@5.5.4) + specifier: 0.0.0-canary-20240829110247 + version: 0.0.0-canary-20240829110247(tslib@2.6.2)(typescript@5.5.4) '@guardian/prettier': specifier: 8.0.1 version: 8.0.1(prettier@3.3.3)(tslib@2.6.2) @@ -1744,7 +1744,7 @@ packages: tslib: 2.6.2 dev: true - /@guardian/core-web-vitals@7.0.0(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3): + /@guardian/core-web-vitals@7.0.0(@guardian/libs@0.0.0-canary-20240829110247)(tslib@2.6.2)(typescript@5.5.4)(web-vitals@4.2.3): resolution: {integrity: sha512-1JLUQjkLY8SXYJqcy0TiE9/9hCcmyIlmMpRoW8Ygn/qGtyNxG+zzwkwsgtJIP+B0ZjtDqfukra2IV9l7wX5A0g==} peerDependencies: '@guardian/libs': ^18.0.0 @@ -1755,7 +1755,7 @@ packages: typescript: optional: true dependencies: - '@guardian/libs': 0.0.0-canary-20240829071655(tslib@2.6.2)(typescript@5.5.4) + '@guardian/libs': 0.0.0-canary-20240829110247(tslib@2.6.2)(typescript@5.5.4) tslib: 2.6.2 typescript: 5.5.4 web-vitals: 4.2.3 @@ -1800,7 +1800,7 @@ packages: - supports-color dev: true - /@guardian/identity-auth-frontend@5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4): + /@guardian/identity-auth-frontend@5.0.0(@guardian/identity-auth@3.0.1)(@guardian/libs@0.0.0-canary-20240829110247)(tslib@2.6.2)(typescript@5.5.4): resolution: {integrity: sha512-Y5wIg8Zo92jl/ChZ4v/Ve3CGQWnoZSfkrhwSOIoZPm88YvijEASxHteVF04QOy/rhVs1O6AQJfl5Ilx244zS6w==} peerDependencies: '@guardian/identity-auth': ^3.0.0 @@ -1811,13 +1811,13 @@ packages: typescript: optional: true dependencies: - '@guardian/identity-auth': 3.0.1(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4) - '@guardian/libs': 0.0.0-canary-20240829071655(tslib@2.6.2)(typescript@5.5.4) + '@guardian/identity-auth': 3.0.1(@guardian/libs@0.0.0-canary-20240829110247)(tslib@2.6.2)(typescript@5.5.4) + '@guardian/libs': 0.0.0-canary-20240829110247(tslib@2.6.2)(typescript@5.5.4) tslib: 2.6.2 typescript: 5.5.4 dev: true - /@guardian/identity-auth@3.0.1(@guardian/libs@0.0.0-canary-20240829071655)(tslib@2.6.2)(typescript@5.5.4): + /@guardian/identity-auth@3.0.1(@guardian/libs@0.0.0-canary-20240829110247)(tslib@2.6.2)(typescript@5.5.4): resolution: {integrity: sha512-QwvQY6BmirP9Me2DkVkNCq0VQeNMzko9zG73G9l0XpQKk5+tTPUf31kyj06Uw11pWUfNacscjbfSU4rDqZOxCA==} peerDependencies: '@guardian/libs': ^18.0.0 @@ -1827,13 +1827,13 @@ packages: typescript: optional: true dependencies: - '@guardian/libs': 0.0.0-canary-20240829071655(tslib@2.6.2)(typescript@5.5.4) + '@guardian/libs': 0.0.0-canary-20240829110247(tslib@2.6.2)(typescript@5.5.4) tslib: 2.6.2 typescript: 5.5.4 dev: true - /@guardian/libs@0.0.0-canary-20240829071655(tslib@2.6.2)(typescript@5.5.4): - resolution: {integrity: sha512-KIbhPRiJiKaDArdL0NjjgjD1dnQsLfeg3VNqo7AJJ5cgZlxt7HqLvFA3+xyEf43oc8V9xTfAXnT7/geOj7Un0g==} + /@guardian/libs@0.0.0-canary-20240829110247(tslib@2.6.2)(typescript@5.5.4): + resolution: {integrity: sha512-nYEAcP7OzK5/9Vt5hSYLddrd4WGk51hdGHb36X3EJFwHID8JkuLjNsXLyX4K5XohLrUNc2TD9f1c4z1XkGNaUw==} peerDependencies: tslib: ^2.6.2 typescript: ~5.5.2 From b7f6e34a8b7ea8fe5d187a9d0e1a5d8d2f9af10a Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:27:58 +0100 Subject: [PATCH 17/20] Replace ccpa with usnat throughout code --- docs/e2e-testing/# E2E testing.md | 2 +- src/core/targeting/personalised.ts | 6 +++--- src/core/targeting/youtube.ts | 6 +----- src/init/consented/comscore.ts | 7 ++++--- src/init/consented/prepare-googletag.ts | 4 ++-- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/docs/e2e-testing/# E2E testing.md b/docs/e2e-testing/# E2E testing.md index 379126ac8..9746a0caf 100644 --- a/docs/e2e-testing/# E2E testing.md +++ b/docs/e2e-testing/# E2E testing.md @@ -29,7 +29,7 @@ - TCF: If the user doesn't consent we shouldn't show ads. - TCF: Ads don't render until the user gives consent. - AUS: Check if a user selects "non personalized advertising" that the targeting is different. - - CCPA: Check if a user selects "do not sell my information" that the targeting is different. + - USNAT: Check if a user selects "do not sell my information" that the targeting is different. - Lower priorities features: - Commercial metrics diff --git a/src/core/targeting/personalised.ts b/src/core/targeting/personalised.ts index 07b4afe4f..810196151 100644 --- a/src/core/targeting/personalised.ts +++ b/src/core/targeting/personalised.ts @@ -125,8 +125,8 @@ const getRawWithConsent = (key: string, state: ConsentState): string | null => { if (state.tcfv2) { if (state.tcfv2.consents['1']) return storage.local.getRaw(key); } - if (state.ccpa) { - if (!state.ccpa.doNotSell) return storage.local.getRaw(key); + if (state.usnat) { + if (!state.usnat.doNotSell) return storage.local.getRaw(key); } if (state.aus) { if (state.aus.personalisedAdvertising) return storage.local.getRaw(key); @@ -175,7 +175,7 @@ const getCMPTargeting = (state: ConsentState): CMPTargeting => { }; } - if (state.ccpa) { + if (state.usnat) { return { consent_tcfv2: 'na', rdp: !state.canTarget ? 't' : 'f', diff --git a/src/core/targeting/youtube.ts b/src/core/targeting/youtube.ts index 001b5b44e..7d1ae44fd 100644 --- a/src/core/targeting/youtube.ts +++ b/src/core/targeting/youtube.ts @@ -41,11 +41,7 @@ const buildAdsConfig = ( }, }; - if ( - cmpConsent.framework === 'ccpa' || - cmpConsent.framework === 'usnat' || - cmpConsent.framework === 'aus' - ) { + if (cmpConsent.framework === 'usnat' || cmpConsent.framework === 'aus') { return { ...defaultAdsConfig, restrictedDataProcessor: !cmpConsent.canTarget, diff --git a/src/init/consented/comscore.ts b/src/init/consented/comscore.ts index 1b9c96226..bc558b432 100644 --- a/src/init/consented/comscore.ts +++ b/src/init/consented/comscore.ts @@ -44,16 +44,17 @@ const setupComscore = async (): Promise => { /* Rule is that comscore can run: - in Tcfv2: Based on consent for comscore - in Australia: Always - - in CCPA: If the user hasn't chosen Do Not Sell + - in USNAT: If the user hasn't chosen Do Not Sell TODO move this logic to getConsentFor */ const canRunTcfv2 = (consentState.tcfv2 && getConsentFor('comscore', consentState)) ?? false; const canRunAus = !!consentState.aus; - const canRunCcpa = !!consentState.ccpa && !consentState.ccpa.doNotSell; + const canRunUsnat = + !!consentState.usnat && !consentState.usnat.doNotSell; - if (!(canRunTcfv2 || canRunAus || canRunCcpa)) { + if (!(canRunTcfv2 || canRunAus || canRunUsnat)) { throw Error('No consent for comscore'); } await initOnConsent(); diff --git a/src/init/consented/prepare-googletag.ts b/src/init/consented/prepare-googletag.ts index f30992a33..2717c768b 100644 --- a/src/init/consented/prepare-googletag.ts +++ b/src/init/consented/prepare-googletag.ts @@ -51,8 +51,8 @@ export const init = (): Promise => { window.googletag.cmd.push(setCookieDeprecationLabel); } - if (consentState.ccpa) { - // CCPA mode + if (consentState.usnat) { + // USNAT mode // canRun stays true, set RDP flag window.googletag.cmd.push(() => { window.googletag.pubads().setPrivacySettings({ From 0670f693d30257e370fd6c3965ddb0f3d5ceae4f Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:28:13 +0100 Subject: [PATCH 18/20] Replace ccpa with usnat throughout tests --- src/core/send-commercial-metrics.spec.ts | 30 +++++++--- .../targeting/build-page-targeting.spec.ts | 60 ++++++++++++------- src/core/targeting/personalised.spec.ts | 51 ++++++++++------ src/core/targeting/youtube.spec.ts | 42 +++++++------ src/core/track-gpc-signal.spec.ts | 24 ++++---- src/init/consented/comscore.spec.ts | 44 ++++++++------ src/init/consented/prepare-googletag.spec.ts | 34 +++++++---- src/init/consented/prepare-prebid.spec.ts | 38 ++++++++---- src/init/consented/third-party-tags.spec.ts | 25 +++++--- src/lib/header-bidding/a9/a9.spec.ts | 21 +++++-- src/lib/header-bidding/prebid/prebid.spec.ts | 4 +- 11 files changed, 239 insertions(+), 134 deletions(-) diff --git a/src/core/send-commercial-metrics.spec.ts b/src/core/send-commercial-metrics.spec.ts index bdff96d06..3727431fa 100644 --- a/src/core/send-commercial-metrics.spec.ts +++ b/src/core/send-commercial-metrics.spec.ts @@ -1,4 +1,4 @@ -import type { ConsentState } from '@guardian/libs'; +import type { ConsentState, USNATConsentState } from '@guardian/libs'; import { onConsent } from '@guardian/libs'; import { EventTimer } from './event-timer'; import { @@ -103,16 +103,28 @@ const tcfv2AllConsentExceptPurpose8: ConsentState = { framework: 'tcfv2', }; -const ccpaConsent: ConsentState = { - ccpa: { doNotSell: false, signalStatus: 'ready' }, +const usnatNonConsentObject: USNATConsentState = { + doNotSell: true, + signalStatus: 'ready', +}; + +const usnatConsentObject: USNATConsentState = { + doNotSell: false, + signalStatus: 'ready', +}; + +const usnatConsent: ConsentState = { + ccpa: usnatConsentObject, + usnat: usnatConsentObject, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; -const ccpaNonConsent: ConsentState = { - ccpa: { doNotSell: true, signalStatus: 'ready' }, +const usnatNonConsent: ConsentState = { + ccpa: usnatNonConsentObject, + usnat: usnatNonConsentObject, canTarget: false, - framework: 'ccpa', + framework: 'usnat', }; const setVisibility = (value: 'hidden' | 'visible'): void => { @@ -212,7 +224,7 @@ describe('send commercial metrics', () => { }); it('sends metrics when non-TCFv2 user (i.e. USA or Australia) consents', async () => { - mockOnConsent(ccpaConsent); + mockOnConsent(usnatConsent); await initCommercialMetrics({ pageViewId: PAGE_VIEW_ID, @@ -231,7 +243,7 @@ describe('send commercial metrics', () => { }); it('sends metrics when non-TCFv2 user (i.e. USA or Australia) does not consent', async () => { - mockOnConsent(ccpaNonConsent); + mockOnConsent(usnatNonConsent); await initCommercialMetrics({ pageViewId: PAGE_VIEW_ID, diff --git a/src/core/targeting/build-page-targeting.spec.ts b/src/core/targeting/build-page-targeting.spec.ts index 36e5c6587..4977a1f9b 100644 --- a/src/core/targeting/build-page-targeting.spec.ts +++ b/src/core/targeting/build-page-targeting.spec.ts @@ -1,4 +1,8 @@ -import type { ConsentState, TCFv2ConsentState } from '@guardian/libs'; +import type { + ConsentState, + TCFv2ConsentState, + USNATConsentState, +} from '@guardian/libs'; import { cmp as cmp_, setCookie, storage } from '@guardian/libs'; import { getAuthStatus as getAuthStatus_ } from 'lib/identity/api'; import type { AuthStatus } from 'lib/identity/api'; @@ -52,17 +56,29 @@ const mockViewport = (width: number, height: number): void => { }); }; -// CCPA -const ccpaWithConsentMock: ConsentState = { - ccpa: { doNotSell: false, signalStatus: 'ready' }, +const usnatConsent: USNATConsentState = { + doNotSell: false, + signalStatus: 'ready', +}; + +const usnatNonConsent: USNATConsentState = { + doNotSell: true, + signalStatus: 'ready', +}; + +// USNAT +const usnatWithConsentMock: ConsentState = { + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; -const ccpaWithoutConsentMock: ConsentState = { - ccpa: { doNotSell: true, signalStatus: 'ready' }, +const usnatWithoutConsentMock: ConsentState = { + ccpa: usnatNonConsent, + usnat: usnatNonConsent, canTarget: false, - framework: 'ccpa', + framework: 'usnat', }; // AUS @@ -258,7 +274,7 @@ describe('Build Page Targeting', () => { buildPageTargeting({ adFree: false, clientSideParticipations: {}, - consentState: ccpaWithConsentMock, + consentState: usnatWithConsentMock, isSignedIn: true, }).pa, ).toBe('t'); @@ -266,7 +282,7 @@ describe('Build Page Targeting', () => { buildPageTargeting({ adFree: false, clientSideParticipations: {}, - consentState: ccpaWithoutConsentMock, + consentState: usnatWithoutConsentMock, isSignedIn: true, }).pa, ).toBe('f'); @@ -293,7 +309,7 @@ describe('Build Page Targeting', () => { buildPageTargeting({ adFree: false, clientSideParticipations: {}, - consentState: ccpaWithConsentMock, + consentState: usnatWithConsentMock, isSignedIn: true, }).rdp, ).toBe('f'); @@ -301,7 +317,7 @@ describe('Build Page Targeting', () => { buildPageTargeting({ adFree: false, clientSideParticipations: {}, - consentState: ccpaWithoutConsentMock, + consentState: usnatWithoutConsentMock, isSignedIn: true, }).rdp, ).toBe('t'); @@ -598,7 +614,7 @@ describe('Build Page Targeting', () => { buildPageTargeting({ adFree: false, clientSideParticipations: {}, - consentState: ccpaWithConsentMock, + consentState: usnatWithConsentMock, isSignedIn: true, }).permutive, ).toEqual(['1', '2', '3']); @@ -612,7 +628,7 @@ describe('Build Page Targeting', () => { buildPageTargeting({ adFree: false, clientSideParticipations: {}, - consentState: ccpaWithConsentMock, + consentState: usnatWithConsentMock, isSignedIn: true, }).fr, ).toEqual('5'); @@ -624,7 +640,7 @@ describe('Build Page Targeting', () => { buildPageTargeting({ adFree: false, clientSideParticipations: {}, - consentState: ccpaWithConsentMock, + consentState: usnatWithConsentMock, isSignedIn: true, }).fr, ).toEqual('16-19'); @@ -636,7 +652,7 @@ describe('Build Page Targeting', () => { buildPageTargeting({ adFree: false, clientSideParticipations: {}, - consentState: ccpaWithConsentMock, + consentState: usnatWithConsentMock, isSignedIn: true, }).fr, ).toEqual('30plus'); @@ -648,7 +664,7 @@ describe('Build Page Targeting', () => { buildPageTargeting({ adFree: false, clientSideParticipations: {}, - consentState: ccpaWithConsentMock, + consentState: usnatWithConsentMock, isSignedIn: true, }).fr, ).toEqual('0'); @@ -660,7 +676,7 @@ describe('Build Page Targeting', () => { buildPageTargeting({ adFree: false, clientSideParticipations: {}, - consentState: ccpaWithConsentMock, + consentState: usnatWithConsentMock, isSignedIn: true, }).fr, ).toEqual('0'); @@ -672,7 +688,7 @@ describe('Build Page Targeting', () => { buildPageTargeting({ adFree: false, clientSideParticipations: {}, - consentState: ccpaWithoutConsentMock, + consentState: usnatWithoutConsentMock, isSignedIn: true, }).fr, ).toEqual('0'); @@ -902,8 +918,8 @@ describe('Build Page Targeting', () => { }); it.each([ - [ccpaWithConsentMock, '9'], - [ccpaWithoutConsentMock, '9'], + [usnatWithConsentMock, '9'], + [usnatWithoutConsentMock, '9'], [ausWithConsentMock, '9'], [ausWithoutConsentMock, '9'], @@ -1126,7 +1142,7 @@ describe('Build Page Targeting', () => { buildPageTargeting({ adFree: false, clientSideParticipations: {}, - consentState: ccpaWithConsentMock, + consentState: usnatWithConsentMock, isSignedIn: true, }).firstvisit, ).toBeUndefined(); diff --git a/src/core/targeting/personalised.spec.ts b/src/core/targeting/personalised.spec.ts index 60e27d0ca..e5727f035 100644 --- a/src/core/targeting/personalised.spec.ts +++ b/src/core/targeting/personalised.spec.ts @@ -1,4 +1,4 @@ -import type { ConsentState } from '@guardian/libs'; +import type { ConsentState, USNATConsentState } from '@guardian/libs'; import { storage } from '@guardian/libs'; import type { PersonalisedTargeting } from './personalised'; import { getPersonalisedTargeting } from './personalised'; @@ -6,6 +6,16 @@ import { getPersonalisedTargeting } from './personalised'; const FREQUENCY_KEY = 'gu.alreadyVisited'; const AMTGRP_STORAGE_KEY = 'gu.adManagerGroup'; +const usnatConsent: USNATConsentState = { + doNotSell: false, + signalStatus: 'ready', +}; + +const usnatNonConsent: USNATConsentState = { + doNotSell: true, + signalStatus: 'ready', +}; + describe('Personalised targeting', () => { describe('TCFv2', () => { test('Full consent', () => { @@ -72,12 +82,13 @@ describe('Personalised targeting', () => { }); }); - describe('CCPA', () => { + describe('USNAT', () => { it('Full Consent', () => { const state: ConsentState = { - ccpa: { doNotSell: false, signalStatus: 'ready' }, + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; storage.local.setRaw(FREQUENCY_KEY, '4'); @@ -97,9 +108,10 @@ describe('Personalised targeting', () => { it('Do Not Sell', () => { const state: ConsentState = { - ccpa: { doNotSell: true, signalStatus: 'ready' }, + ccpa: usnatNonConsent, + usnat: usnatNonConsent, canTarget: false, - framework: 'ccpa', + framework: 'usnat', }; storage.local.setRaw(FREQUENCY_KEY, '4'); @@ -191,9 +203,10 @@ describe('Personalised targeting', () => { ]; test.each(frequencies)('Should get `%s` for %f', (fr, val) => { const state: ConsentState = { - ccpa: { doNotSell: false, signalStatus: 'ready' }, + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; storage.local.setRaw(FREQUENCY_KEY, String(val)); @@ -232,9 +245,10 @@ describe('Personalised targeting', () => { test.each(groups)('Should get `%s` if it exists', (amtgrp, val) => { const state: ConsentState = { - ccpa: { doNotSell: false, signalStatus: 'ready' }, + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; storage.local.remove(AMTGRP_STORAGE_KEY); @@ -277,11 +291,12 @@ describe('Personalised targeting', () => { expect(storage.local.get(AMTGRP_STORAGE_KEY)).toBeNull(); }); - test('Ad manager group IS set if ccpa and consent not given', () => { + test('Ad manager group IS set if usnat and consent not given', () => { const state: ConsentState = { - ccpa: { doNotSell: true, signalStatus: 'ready' }, + ccpa: usnatNonConsent, + usnat: usnatNonConsent, canTarget: false, - framework: 'ccpa', + framework: 'usnat', }; const targeting = getPersonalisedTargeting({ @@ -311,9 +326,10 @@ describe('Personalised targeting', () => { test('Should set `permutive` to correct values if `youtube` is set to false', () => { const state: ConsentState = { - ccpa: { doNotSell: false, signalStatus: 'ready' }, + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; storage.local.setRaw(PERMUTIVE_KEY, '[1, 2, 3]'); @@ -328,9 +344,10 @@ describe('Personalised targeting', () => { test('Should set `permutive` to correct values if `youtube` is set to true', () => { const state: ConsentState = { - ccpa: { doNotSell: false, signalStatus: 'ready' }, + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; storage.local.setRaw(PERMUTIVE_KEY, '[]'); diff --git a/src/core/targeting/youtube.spec.ts b/src/core/targeting/youtube.spec.ts index 427df3338..119327fad 100644 --- a/src/core/targeting/youtube.spec.ts +++ b/src/core/targeting/youtube.spec.ts @@ -1,4 +1,4 @@ -import type { ConsentState } from '@guardian/libs'; +import type { ConsentState, USNATConsentState } from '@guardian/libs'; import { buildPageTargeting } from './build-page-targeting'; import { buildAdsConfigWithConsent } from './youtube'; @@ -8,18 +8,26 @@ afterEach(() => { jest.clearAllMocks(); }); +const usnatConsent: USNATConsentState = { + doNotSell: false, + signalStatus: 'ready', +}; + +const usnatNonConsent: USNATConsentState = { + doNotSell: true, + signalStatus: 'ready', +}; + describe('YouTube Ad Targeting Object for consent frameworks', () => { test.each([ { - msg: 'creates adsConfig for CCPA personalised targeting allowed', + msg: 'creates adsConfig for USNAT personalised targeting allowed', isSignedIn: 't', consentState: { - ccpa: { - doNotSell: false, // * - signalStatus: 'ready', - }, + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', } as ConsentState, isAdFreeUser: false, adUnit: 'someAdUnit', @@ -38,15 +46,13 @@ describe('YouTube Ad Targeting Object for consent frameworks', () => { }, }, { - msg: 'creates adsConfig for CCPA personalised targeting NOT allowed', + msg: 'creates adsConfig for USNAT personalised targeting NOT allowed', isSignedIn: 't', consentState: { - ccpa: { - doNotSell: true, // * - signalStatus: 'ready', - }, + ccpa: usnatNonConsent, + usnat: usnatNonConsent, canTarget: false, - framework: 'ccpa', + framework: 'usnat', } as ConsentState, isAdFreeUser: false, adUnit: 'someAdUnit', @@ -65,15 +71,13 @@ describe('YouTube Ad Targeting Object for consent frameworks', () => { }, }, { - msg: 'creates adsConfig for CCPA when user is signed out', + msg: 'creates adsConfig for USNAT when user is signed out', isSignedIn: 'f', // * consentState: { - ccpa: { - doNotSell: false, - signalStatus: 'ready', - }, + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', } as ConsentState, isAdFreeUser: false, adUnit: 'someAdUnit', diff --git a/src/core/track-gpc-signal.spec.ts b/src/core/track-gpc-signal.spec.ts index b0aa44568..319a460ca 100644 --- a/src/core/track-gpc-signal.spec.ts +++ b/src/core/track-gpc-signal.spec.ts @@ -1,16 +1,18 @@ -import type { ConsentState } from '@guardian/libs'; +import type { ConsentState, USNATConsentState } from '@guardian/libs'; import { EventTimer } from './event-timer'; import { initTrackGpcSignal } from './track-gpc-signal'; describe('initTrackGpcSignal', () => { + const usnatConsent: USNATConsentState = { + doNotSell: false, + signalStatus: 'ready', + }; test('tracks an undefined gpcSignal on ConsentState', () => { const eventTimer = EventTimer.get(); const consentState: ConsentState = { - ccpa: { - doNotSell: false, - signalStatus: 'ready', - }, + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, framework: 'usnat', }; @@ -24,10 +26,8 @@ describe('initTrackGpcSignal', () => { const eventTimer = EventTimer.get(); const consentState: ConsentState = { - ccpa: { - doNotSell: false, - signalStatus: 'ready', - }, + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, framework: 'usnat', gpcSignal: false, @@ -42,10 +42,8 @@ describe('initTrackGpcSignal', () => { const eventTimer = EventTimer.get(); const consentState: ConsentState = { - ccpa: { - doNotSell: false, - signalStatus: 'ready', - }, + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, framework: 'usnat', gpcSignal: true, diff --git a/src/init/consented/comscore.spec.ts b/src/init/consented/comscore.spec.ts index 81e88ca3f..a1bef80e6 100644 --- a/src/init/consented/comscore.spec.ts +++ b/src/init/consented/comscore.spec.ts @@ -1,4 +1,8 @@ -import type { ConsentState, TCFv2ConsentState } from '@guardian/libs'; +import type { + ConsentState, + TCFv2ConsentState, + USNATConsentState, +} from '@guardian/libs'; import { getConsentFor, loadScript, onConsent } from '@guardian/libs'; import { commercialFeatures } from 'lib/commercial-features'; import { _ } from './comscore'; @@ -16,6 +20,16 @@ const defaultTCFv2State = { tcString: 'YAAA', } as TCFv2ConsentState; +const usnatConsent: USNATConsentState = { + doNotSell: false, + signalStatus: 'ready', +}; + +const usnatNonConsent: USNATConsentState = { + doNotSell: true, + signalStatus: 'ready', +}; + const tcfv2WithConsent = { tcfv2: { ...defaultTCFv2State, @@ -38,22 +52,18 @@ const tcfv2WithoutConsent = { framework: 'tcfv2', } as ConsentState; -const ccpaWithConsent = { - ccpa: { - doNotSell: false, - signalStatus: 'ready', - }, +const usnatWithConsent = { + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', } as ConsentState; -const ccpaWithoutConsent = { - ccpa: { - doNotSell: true, - signalStatus: 'ready', - }, +const usnatWithoutConsent = { + ccpa: usnatNonConsent, + usnat: usnatNonConsent, canTarget: false, - framework: 'ccpa', + framework: 'usnat', } as ConsentState; const AusWithoutConsent = { @@ -123,14 +133,14 @@ describe('setupComscore', () => { await setupComscore(); expect(loadScript).not.toBeCalled(); }); - it('CCPA with consent: runs', async () => { - mockOnConsent(ccpaWithConsent); + it('USNAT with consent: runs', async () => { + mockOnConsent(usnatWithConsent); await setupComscore(); expect(loadScript).toBeCalled(); }); - it('CCPA without consent: does not run', async () => { - mockOnConsent(ccpaWithoutConsent); + it('USNAT without consent: does not run', async () => { + mockOnConsent(usnatWithoutConsent); await setupComscore(); expect(loadScript).not.toBeCalled(); }); diff --git a/src/init/consented/prepare-googletag.spec.ts b/src/init/consented/prepare-googletag.spec.ts index 41fe3c22d..5bf17cb36 100644 --- a/src/init/consented/prepare-googletag.spec.ts +++ b/src/init/consented/prepare-googletag.spec.ts @@ -1,4 +1,4 @@ -import type { ConsentState } from '@guardian/libs'; +import type { ConsentState, USNATConsentState } from '@guardian/libs'; import { getConsentFor, loadScript, onConsent } from '@guardian/libs'; import type * as AdSizesType from 'core/ad-sizes'; import { commercialFeatures } from 'lib/commercial-features'; @@ -50,6 +50,16 @@ const getCurrentBreakpoint = getCurrentBreakpoint_ as jest.MockedFunction< typeof getCurrentBreakpoint_ >; +const usnatConsent: USNATConsentState = { + doNotSell: false, + signalStatus: 'ready', +}; + +const usnatNonConsent: USNATConsentState = { + doNotSell: true, + signalStatus: 'ready', +}; + jest.mock('define/init-slot-ias', () => ({ initSlotIas: jest.fn(() => Promise.resolve()), })); @@ -213,16 +223,18 @@ const ausRejected: ConsentState = { framework: 'aus', }; -const ccpaWithConsent: ConsentState = { - ccpa: { doNotSell: false, signalStatus: 'ready' }, +const usnatWithConsent: ConsentState = { + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }; -const ccpaWithoutConsent: ConsentState = { - ccpa: { doNotSell: true, signalStatus: 'ready' }, +const usnatWithoutConsent: ConsentState = { + ccpa: usnatNonConsent, + usnat: usnatNonConsent, canTarget: false, - framework: 'ccpa', + framework: 'usnat', }; describe('DFP', () => { @@ -582,9 +594,9 @@ describe('DFP', () => { }); }); }); - describe('restrictDataProcessing flag in CCPA', () => { - it('when CCPA consent is given', async () => { - mockOnConsent(ccpaWithConsent); + describe('restrictDataProcessing flag in USNAT', () => { + it('when USNAT consent is given', async () => { + mockOnConsent(usnatWithConsent); mockGetConsentFor(true); await prepareGoogletag(); expect(pubAds.setPrivacySettings).toHaveBeenCalledWith({ @@ -592,7 +604,7 @@ describe('DFP', () => { }); }); it('when CCPA consent is denied', async () => { - mockOnConsent(ccpaWithoutConsent); + mockOnConsent(usnatWithoutConsent); mockGetConsentFor(false); await prepareGoogletag(); expect(pubAds.setPrivacySettings).toHaveBeenCalledWith({ diff --git a/src/init/consented/prepare-prebid.spec.ts b/src/init/consented/prepare-prebid.spec.ts index 9a322086d..f30f06469 100644 --- a/src/init/consented/prepare-prebid.spec.ts +++ b/src/init/consented/prepare-prebid.spec.ts @@ -1,4 +1,8 @@ -import type { ConsentState, TCFv2ConsentState } from '@guardian/libs'; +import type { + ConsentState, + TCFv2ConsentState, + USNATConsentState, +} from '@guardian/libs'; import { getConsentFor, log, onConsent } from '@guardian/libs'; import { commercialFeatures } from 'lib/commercial-features'; import { isInCanada } from 'utils/geo-utils'; @@ -91,16 +95,28 @@ const tcfv2WithoutConsent = { framework: 'tcfv2', } as ConsentState; -const ccpaWithConsent = { - ccpa: { doNotSell: false, signalStatus: 'ready' }, +const usnatConsent: USNATConsentState = { + doNotSell: false, + signalStatus: 'ready', +}; + +const usnatNonConsent: USNATConsentState = { + doNotSell: true, + signalStatus: 'ready', +}; + +const usnatWithConsent = { + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', } as ConsentState; -const ccpaWithoutConsent = { - ccpa: { doNotSell: true, signalStatus: 'ready' }, +const usnatWithoutConsent = { + ccpa: usnatNonConsent, + usnat: usnatNonConsent, canTarget: false, - framework: 'ccpa', + framework: 'usnat', } as ConsentState; const ausWithConsent = { @@ -306,7 +322,7 @@ describe('init', () => { expect(prebid.initialise).not.toBeCalled(); }); - it('should initialise Prebid in CCPA if doNotSell is false', async () => { + it('should initialise Prebid in USNAT if doNotSell is false', async () => { expect.hasAssertions(); window.guardian.config.switches = { @@ -314,13 +330,13 @@ describe('init', () => { }; commercialFeatures.shouldLoadGoogletag = true; commercialFeatures.adFree = false; - mockOnConsent(ccpaWithConsent); + mockOnConsent(usnatWithConsent); mockGetConsentFor(true); await setupPrebid(); expect(prebid.initialise).toBeCalled(); }); - it('should not initialise Prebid in CCPA if doNotSell is true', async () => { + it('should not initialise Prebid in USNAT if doNotSell is true', async () => { expect.assertions(2); window.guardian.config.switches = { @@ -328,7 +344,7 @@ describe('init', () => { }; commercialFeatures.shouldLoadGoogletag = true; commercialFeatures.adFree = false; - mockOnConsent(ccpaWithoutConsent); + mockOnConsent(usnatWithoutConsent); mockGetConsentFor(false); await setupPrebid(); diff --git a/src/init/consented/third-party-tags.spec.ts b/src/init/consented/third-party-tags.spec.ts index 020bdac5f..a6c1640d9 100644 --- a/src/init/consented/third-party-tags.spec.ts +++ b/src/init/consented/third-party-tags.spec.ts @@ -1,5 +1,5 @@ import { getConsentFor, onConsent } from '@guardian/libs'; -import type { ConsentState } from '@guardian/libs'; +import type { ConsentState, USNATConsentState } from '@guardian/libs'; import { commercialFeatures } from 'lib/commercial-features'; import type { ThirdPartyTag } from 'types/global'; import { _, init } from './third-party-tags'; @@ -85,6 +85,16 @@ const tcfv2WithoutConsent = { framework: 'tcfv2', } as ConsentState; +const usnatConsent: USNATConsentState = { + doNotSell: false, + signalStatus: 'ready', +}; + +const usnatNonConsent: USNATConsentState = { + doNotSell: true, + signalStatus: 'ready', +}; + beforeEach(() => { const firstScript = document.createElement('script'); document.body.appendChild(firstScript); @@ -194,11 +204,12 @@ describe('third party tags', () => { ); expect(document.scripts.length).toBe(2); }); - it('should add scripts to the document when CCPA consent has been given', async () => { + it('should add scripts to the document when USNAT consent has been given', async () => { mockOnConsent({ - ccpa: { doNotSell: false, signalStatus: 'ready' }, + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }); mockGetConsentFor(true); await insertScripts( @@ -207,11 +218,11 @@ describe('third party tags', () => { ); expect(document.scripts.length).toBe(3); }); - it('should only add performance scripts to the document when CCPA consent has not been given', async () => { + it('should only add performance scripts to the document when USNAT consent has not been given', async () => { mockOnConsent({ - ccpa: { doNotSell: true, signalStatus: 'ready' }, + ccpa: usnatNonConsent, canTarget: false, - framework: 'ccpa', + framework: 'usnat', }); mockGetConsentFor(false); await insertScripts( diff --git a/src/lib/header-bidding/a9/a9.spec.ts b/src/lib/header-bidding/a9/a9.spec.ts index c03a64da6..f12c6f4bb 100644 --- a/src/lib/header-bidding/a9/a9.spec.ts +++ b/src/lib/header-bidding/a9/a9.spec.ts @@ -1,5 +1,8 @@ import { getConsentFor, onConsentChange } from '@guardian/libs'; -import type { OnConsentChangeCallback } from '@guardian/libs'; +import type { + OnConsentChangeCallback, + USNATConsentState, +} from '@guardian/libs'; import { _, a9 } from './a9'; const tcfv2WithConsentMock = (callback: OnConsentChangeCallback) => @@ -27,11 +30,17 @@ const tcfv2WithConsentMock = (callback: OnConsentChangeCallback) => framework: 'tcfv2', }); -const CcpaWithConsentMock = (callback: OnConsentChangeCallback) => +const usnatConsent: USNATConsentState = { + doNotSell: false, + signalStatus: 'ready', +}; + +const usnatWithConsentMock = (callback: OnConsentChangeCallback) => callback({ - ccpa: { doNotSell: false, signalStatus: 'ready' }, + ccpa: usnatConsent, + usnat: usnatConsent, canTarget: true, - framework: 'ccpa', + framework: 'usnat', }); jest.mock('define/Advert', () => @@ -88,8 +97,8 @@ describe('initialise', () => { expect(window.apstag?.init).toHaveBeenCalled(); }); - it('should generate initialise A9 library when CCPA consent has been given', () => { - mockOnConsentChange(CcpaWithConsentMock); + it('should generate initialise A9 library when USNAT consent has been given', () => { + mockOnConsentChange(usnatWithConsentMock); mockGetConsentFor(true); a9.initialise(); expect(window.apstag).toBeDefined(); diff --git a/src/lib/header-bidding/prebid/prebid.spec.ts b/src/lib/header-bidding/prebid/prebid.spec.ts index 6ad67c90a..356141ac8 100644 --- a/src/lib/header-bidding/prebid/prebid.spec.ts +++ b/src/lib/header-bidding/prebid/prebid.spec.ts @@ -111,8 +111,8 @@ describe('initialise', () => { }); }); - test('should generate correct Prebid config consent management in CCPA', () => { - prebid.initialise(window, 'ccpa'); + test('should generate correct Prebid config consent management in USNAT', () => { + prebid.initialise(window, 'usnat'); expect(window.pbjs?.getConfig('consentManagement')).toEqual({ usp: { cmpApi: 'iab', From 5f0ac2f566d1776dcaa82a0c60e6c69c0c953e9f Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Thu, 29 Aug 2024 13:56:04 +0100 Subject: [PATCH 19/20] Adding config for gpp in prebid. --- src/lib/header-bidding/prebid/prebid.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib/header-bidding/prebid/prebid.ts b/src/lib/header-bidding/prebid/prebid.ts index 46a54e446..cfec3953d 100644 --- a/src/lib/header-bidding/prebid/prebid.ts +++ b/src/lib/header-bidding/prebid/prebid.ts @@ -51,6 +51,9 @@ type ConsentManagement = } | { usp: USPConfig; + } + | { + gpp: USPConfig; }; type UserSync = @@ -261,8 +264,6 @@ const initialise = ( const consentManagement = (): ConsentManagement => { switch (framework) { case 'aus': - case 'usnat': - case 'ccpa': // https://docs.prebid.org/dev-docs/modules/consentManagementUsp.html return { usp: { @@ -270,6 +271,15 @@ const initialise = ( timeout: 1500, }, }; + case 'usnat': + case 'ccpa': + // https://docs.prebid.org/dev-docs/modules/consentManagementGpp.html + return { + gpp: { + cmpApi: 'iab', + timeout: 1500, + }, + }; case 'tcfv2': default: // https://docs.prebid.org/dev-docs/modules/consentManagement.html From 66e51ab1a92c1d9e79d04006728b2426c9bb946e Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:04:03 +0100 Subject: [PATCH 20/20] Update prebid.spec.ts --- src/lib/header-bidding/prebid/prebid.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/header-bidding/prebid/prebid.spec.ts b/src/lib/header-bidding/prebid/prebid.spec.ts index 356141ac8..176a6c19f 100644 --- a/src/lib/header-bidding/prebid/prebid.spec.ts +++ b/src/lib/header-bidding/prebid/prebid.spec.ts @@ -114,7 +114,7 @@ describe('initialise', () => { test('should generate correct Prebid config consent management in USNAT', () => { prebid.initialise(window, 'usnat'); expect(window.pbjs?.getConfig('consentManagement')).toEqual({ - usp: { + gpp: { cmpApi: 'iab', timeout: 1500, },