From c549898a5147cdb0f298355d914e345d475b2beb Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Mon, 20 Jan 2025 11:37:58 +0000 Subject: [PATCH 01/31] Update types to include isCorp, isUserSignedIn, useNonAdvertisedList --- .../src/consent-management-platform/types/index.ts | 10 +++++++++- .../src/consent-management-platform/types/window.d.ts | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libs/@guardian/libs/src/consent-management-platform/types/index.ts b/libs/@guardian/libs/src/consent-management-platform/types/index.ts index 0b5bbb11c..bf1e98269 100644 --- a/libs/@guardian/libs/src/consent-management-platform/types/index.ts +++ b/libs/@guardian/libs/src/consent-management-platform/types/index.ts @@ -21,6 +21,8 @@ export type CMP = { export type InitCMP = (arg0: { pubData?: PubData; country?: CountryCode; + isUserSignedIn?: boolean; + useNonAdvertisedList?: boolean; }) => void; export type OnConsentChange = ( @@ -46,7 +48,13 @@ export interface PubData { [propName: string]: unknown; } export interface SourcepointImplementation { - init: (framework: ConsentFramework, pubData?: PubData) => void; + init: ( + framework: ConsentFramework, + countryCode: CountryCode, + isUserSignedIn: boolean, + useNonAdvertisedList: boolean, + pubData?: PubData, + ) => void; willShowPrivacyMessage: WillShowPrivacyMessage; showPrivacyManager: () => void; } diff --git a/libs/@guardian/libs/src/consent-management-platform/types/window.d.ts b/libs/@guardian/libs/src/consent-management-platform/types/window.d.ts index dd43b4b6a..802e23326 100644 --- a/libs/@guardian/libs/src/consent-management-platform/types/window.d.ts +++ b/libs/@guardian/libs/src/consent-management-platform/types/window.d.ts @@ -34,6 +34,7 @@ declare global { accountId: number; propertyHref?: Property; propertyId?: number; + campaignEnv: 'prod' | 'stage'; targetingParams: { framework: ConsentFramework; excludePage: boolean; @@ -47,6 +48,8 @@ declare global { targetingParams?: { framework: ConsentFramework; excludePage: boolean; + isCorP: boolean; + isUserSignedIn: boolean; }; }; usnat?: { From 1df95426f0f7aa75176b424fe2157569e97e1245 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:09:11 +0000 Subject: [PATCH 02/31] Update Config for Property Id's and Href --- .../consent-management-platform/lib/sourcepointConfig.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/@guardian/libs/src/consent-management-platform/lib/sourcepointConfig.ts b/libs/@guardian/libs/src/consent-management-platform/lib/sourcepointConfig.ts index 6dbaab03e..bfe59281b 100644 --- a/libs/@guardian/libs/src/consent-management-platform/lib/sourcepointConfig.ts +++ b/libs/@guardian/libs/src/consent-management-platform/lib/sourcepointConfig.ts @@ -2,8 +2,15 @@ import { isGuardianDomain } from './domain'; export const ACCOUNT_ID = 1257; export const PRIVACY_MANAGER_USNAT = 1068329; + export const PROPERTY_ID = 7417; +export const PROPERTY_ID_MAIN = 9398; // TO BE CHANGED +export const PROPERTY_ID_SUPPORT = 38161; // TO BE CHANGED export const PROPERTY_ID_AUSTRALIA = 13348; + +export const PROPERTY_HREF_SUPPORT = 'http://support-test'; +export const PROPERTY_HREF_MAIN = 'http://ui-dev'; + export const PRIVACY_MANAGER_TCFV2 = 106842; export const PRIVACY_MANAGER_AUSTRALIA = 1178486; From 0067a059d76d20dee497fe0a1ea940d9a4cf21a5 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:12:16 +0000 Subject: [PATCH 03/31] Use isUserSignedIn and useNonAdvertisedList in CMP.init --- .../libs/src/consent-management-platform/cmp.ts | 17 +++++++++++++++-- .../src/consent-management-platform/index.ts | 15 +++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/libs/@guardian/libs/src/consent-management-platform/cmp.ts b/libs/@guardian/libs/src/consent-management-platform/cmp.ts index 2b4faba55..5fdd5baf4 100644 --- a/libs/@guardian/libs/src/consent-management-platform/cmp.ts +++ b/libs/@guardian/libs/src/consent-management-platform/cmp.ts @@ -1,3 +1,4 @@ +import { CountryCode } from '../index.test'; import { getCurrentFramework } from './getCurrentFramework'; import { mark } from './lib/mark'; import { @@ -16,9 +17,21 @@ import type { WillShowPrivacyMessage, } from './types'; -const init = (framework: ConsentFramework, pubData?: PubData): void => { +const init = ( + framework: ConsentFramework, + countryCode: CountryCode, + isUserSignedIn: boolean, + useNonAdvertisedList: boolean, + pubData?: PubData, +): void => { mark('cmp-init'); - initSourcepoint(framework, pubData); + initSourcepoint( + framework, + countryCode, + isUserSignedIn, + useNonAdvertisedList, + pubData, + ); }; const willShowPrivacyMessage: WillShowPrivacyMessage = () => diff --git a/libs/@guardian/libs/src/consent-management-platform/index.ts b/libs/@guardian/libs/src/consent-management-platform/index.ts index 96c5eab68..4da6f1c6f 100644 --- a/libs/@guardian/libs/src/consent-management-platform/index.ts +++ b/libs/@guardian/libs/src/consent-management-platform/index.ts @@ -33,7 +33,12 @@ const initialised = new Promise((resolve) => { resolveInitialised = resolve; }); -const init: InitCMP = ({ pubData, country }) => { +const init: InitCMP = ({ + pubData, + country, + isUserSignedIn = false, + useNonAdvertisedList = false, +}) => { if (isDisabled() || isServerSide) { return; } @@ -61,7 +66,13 @@ const init: InitCMP = ({ pubData, country }) => { const framework = getFramework(country); - UnifiedCMP.init(framework, pubData ?? {}); + UnifiedCMP.init( + framework, + country, + isUserSignedIn, + useNonAdvertisedList, + pubData ?? {}, + ); void UnifiedCMP.willShowPrivacyMessage().then((willShowValue) => { _willShowPrivacyMessage = willShowValue; From 800c6a1ac9a5d2bb3f44768ba7e22d489e341106 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:12:41 +0000 Subject: [PATCH 04/31] Create consent or pay function and test --- .../isConsentOrPay.test.js | 11 +++++++++++ .../src/consent-management-platform/isConsentOrPay.ts | 7 +++++++ 2 files changed, 18 insertions(+) create mode 100644 libs/@guardian/libs/src/consent-management-platform/isConsentOrPay.test.js create mode 100644 libs/@guardian/libs/src/consent-management-platform/isConsentOrPay.ts diff --git a/libs/@guardian/libs/src/consent-management-platform/isConsentOrPay.test.js b/libs/@guardian/libs/src/consent-management-platform/isConsentOrPay.test.js new file mode 100644 index 000000000..fa8ffc685 --- /dev/null +++ b/libs/@guardian/libs/src/consent-management-platform/isConsentOrPay.test.js @@ -0,0 +1,11 @@ +import { isConsentOrPay } from './isConsentOrPay.ts'; + +describe('isConsentOrPay', () => { + test('should return false country code is FR', () => { + expect(isConsentOrPay('FR')).toBe(false); + }); + + test('should return true country code is GB', () => { + expect(isConsentOrPay('GB')).toBe(true); + }); +}); diff --git a/libs/@guardian/libs/src/consent-management-platform/isConsentOrPay.ts b/libs/@guardian/libs/src/consent-management-platform/isConsentOrPay.ts new file mode 100644 index 000000000..30305e6a0 --- /dev/null +++ b/libs/@guardian/libs/src/consent-management-platform/isConsentOrPay.ts @@ -0,0 +1,7 @@ +import type { CountryCode } from '../index.test'; + +export const isConsentOrPay = (countryCode: CountryCode) => { + const consentOrPayCountries = ['GB']; + + return consentOrPayCountries.includes(countryCode); +}; From 716039ffcc9e38612b590fa3604c6d64ad27e515 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:33:56 +0000 Subject: [PATCH 05/31] Add type to import --- libs/@guardian/libs/src/consent-management-platform/cmp.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/@guardian/libs/src/consent-management-platform/cmp.ts b/libs/@guardian/libs/src/consent-management-platform/cmp.ts index 5fdd5baf4..1b0b3d217 100644 --- a/libs/@guardian/libs/src/consent-management-platform/cmp.ts +++ b/libs/@guardian/libs/src/consent-management-platform/cmp.ts @@ -1,4 +1,4 @@ -import { CountryCode } from '../index.test'; +import type { CountryCode } from '../index.test'; import { getCurrentFramework } from './getCurrentFramework'; import { mark } from './lib/mark'; import { From 86e864564c40a657986e1360eaa1c89df5664dd9 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:37:20 +0000 Subject: [PATCH 06/31] Update to account for useNonAdvertisedList --- .../sourcepoint.test.js | 107 ++++++++++++------ .../sourcepoint.ts | 62 ++++++++-- 2 files changed, 124 insertions(+), 45 deletions(-) diff --git a/libs/@guardian/libs/src/consent-management-platform/sourcepoint.test.js b/libs/@guardian/libs/src/consent-management-platform/sourcepoint.test.js index 0e50f1976..6cba16f53 100644 --- a/libs/@guardian/libs/src/consent-management-platform/sourcepoint.test.js +++ b/libs/@guardian/libs/src/consent-management-platform/sourcepoint.test.js @@ -1,7 +1,12 @@ import { ACCOUNT_ID, ENDPOINT } from './lib/sourcepointConfig.ts'; import { init } from './sourcepoint.ts'; -const frameworks = ['tcfv2', 'usnat', 'aus']; +// const frameworks = ['tcfv2', 'usnat', 'aus']; +const frameworksAndCountryCodes = [ + { framework: 'tcfv2', countryCode: 'FR' }, + { framework: 'usnat', countryCode: 'US' }, + { framework: 'aus', countryCode: 'AU' }, +]; describe('Sourcepoint unified', () => { beforeEach(() => { @@ -18,10 +23,13 @@ describe('Sourcepoint unified', () => { expect(init).toThrow(); }); - it.each(frameworks)( + it.each(frameworksAndCountryCodes)( "should initialize window._sp_ with the correct config if it doesn't exist", - (framework) => { - init(framework); + (frameworkAndCountryCode) => { + init( + frameworkAndCountryCode.framework, + frameworkAndCountryCode.countryCode, + ); expect(window._sp_).toBeDefined(); expect(window._sp_.config).toBeDefined(); expect(window._sp_.config.baseEndpoint).toEqual(ENDPOINT); @@ -32,27 +40,27 @@ describe('Sourcepoint unified', () => { 'function', ); - if (framework == 'tcfv2') { + if (frameworkAndCountryCode.framework == 'tcfv2') { expect(window._sp_.config.gdpr.targetingParams.framework).toEqual( - framework, + frameworkAndCountryCode.framework, ); expect(window._sp_.config.usnat).toBeUndefined(); expect(window.__tcfapi).toBeDefined(); expect(window.__uspapi).toBeUndefined(); expect(window.__gpp).toBeUndefined(); - } else if (framework == 'usnat') { + } else if (frameworkAndCountryCode.framework == 'usnat') { expect(window._sp_.config.usnat.includeUspApi).toBeTruthy(); expect(window._sp_.config.usnat.transitionCCPAAuth).toBeTruthy(); expect(window._sp_.config.usnat.targetingParams.framework).toEqual( - framework, + frameworkAndCountryCode.framework, ); expect(window._sp_.config.gdpr).toBeUndefined; expect(window.__uspapi).toBeDefined(); expect(window.__tcfapi).toBeUndefined(); expect(window.__gpp).toBeDefined(); - } else if (framework == 'aus') { + } else if (frameworkAndCountryCode.framework == 'aus') { expect(window._sp_.config.ccpa.targetingParams.framework).toEqual( - framework, + frameworkAndCountryCode.framework, ); expect(window._sp_.config.gdpr).toBeUndefined; expect(window.__uspapi).toBeDefined(); @@ -62,34 +70,59 @@ describe('Sourcepoint unified', () => { }, ); - it.each(frameworks)('points at a real file', async (framework) => { - init(framework); - expect(document.getElementById('sourcepoint-lib')).toBeTruthy(); - const src = document.getElementById('sourcepoint-lib')?.getAttribute('src'); + it.each(frameworksAndCountryCodes)( + 'points at a real file', + async (frameworkAndCountryCode) => { + init( + frameworkAndCountryCode.framework, + frameworkAndCountryCode.countryCode, + ); + expect(document.getElementById('sourcepoint-lib')).toBeTruthy(); + const src = document + .getElementById('sourcepoint-lib') + ?.getAttribute('src'); - const response = await fetch(src); - expect(response.ok).toBe(true); - }); + const response = await fetch(src); + expect(response.ok).toBe(true); + }, + ); - it.each(frameworks)('should accept pubData', (framework) => { - const now = new Date().getTime(); - init(framework, { - browserId: 'abc123', - pageViewId: 'abcdef', - cmpInitTimeUtc: 1601511014537, - }); - expect(window._sp_.config.pubData.browserId).toEqual('abc123'); - expect(window._sp_.config.pubData.pageViewId).toEqual('abcdef'); - expect(window._sp_.config.pubData.cmpInitTimeUtc).toBeGreaterThanOrEqual( - now, - ); - }); + it.each(frameworksAndCountryCodes)( + 'should accept pubData', + (frameworkAndCountryCode) => { + const now = new Date().getTime(); + init( + frameworkAndCountryCode.framework, + frameworkAndCountryCode.countryCode, + true, + true, + { + browserId: 'abc123', + pageViewId: 'abcdef', + cmpInitTimeUtc: 1601511014537, + }, + ); + expect(window._sp_.config.pubData.browserId).toEqual('abc123'); + expect(window._sp_.config.pubData.pageViewId).toEqual('abcdef'); + expect(window._sp_.config.pubData.cmpInitTimeUtc).toBeGreaterThanOrEqual( + now, + ); + }, + ); - it.each(frameworks)('should handle no pubData', (framework) => { - const now = new Date().getTime(); - init(framework); - expect(window._sp_.config.pubData.cmpInitTimeUtc).toBeGreaterThanOrEqual( - now, - ); - }); + it.each(frameworksAndCountryCodes)( + 'should handle no pubData', + (frameworkAndCountryCode) => { + const now = new Date().getTime(); + init( + frameworkAndCountryCode.framework, + frameworkAndCountryCode.countryCode, + true, + true, + ); + expect(window._sp_.config.pubData.cmpInitTimeUtc).toBeGreaterThanOrEqual( + now, + ); + }, + ); }); diff --git a/libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts b/libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts index d249923cd..59c413af8 100644 --- a/libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts +++ b/libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts @@ -1,3 +1,4 @@ +import type { CountryCode } from '../index.test'; import { log } from '../logger/logger'; import { isExcludedFromCMP } from './exclusionList'; import { setCurrentFramework } from './getCurrentFramework'; @@ -7,8 +8,12 @@ import type { Property } from './lib/property'; import { ACCOUNT_ID, ENDPOINT, - PROPERTY_ID, + PROPERTY_HREF_MAIN, + PROPERTY_HREF_SUPPORT, + // PROPERTY_ID, PROPERTY_ID_AUSTRALIA, + PROPERTY_ID_MAIN, + PROPERTY_ID_SUPPORT, SourcePointChoiceTypes, } from './lib/sourcepointConfig'; import { invokeCallbacks } from './onConsentChange'; @@ -27,21 +32,43 @@ export const willShowPrivacyMessage = new Promise((resolve) => { * Australia has a single property while the rest of the world has a test and prod property. * TODO: incorporate au.theguardian into *.theguardian.com */ -const getPropertyHref = (framework: ConsentFramework): Property => { +const getPropertyHref = ( + framework: ConsentFramework, + useNonAdvertisedList: boolean, +): Property => { if (framework == 'aus') { return 'https://au.theguardian.com'; } - return isGuardianDomain() ? null : 'https://test.theguardian.com'; + + return isGuardianDomain() + ? null + : useNonAdvertisedList + ? PROPERTY_HREF_SUPPORT + : PROPERTY_HREF_MAIN; }; -const getPropertyId = (framework: ConsentFramework): number => { +const getPropertyId = ( + framework: ConsentFramework, + useNonAdvertisedList: boolean, +): number => { if (framework == 'aus') { return PROPERTY_ID_AUSTRALIA; } - return PROPERTY_ID; + + if (framework == 'usnat') { + return PROPERTY_ID_MAIN; + } + + return useNonAdvertisedList ? PROPERTY_ID_SUPPORT : PROPERTY_ID_MAIN; }; -export const init = (framework: ConsentFramework, pubData = {}): void => { +export const init = ( + framework: ConsentFramework, + countryCode: CountryCode, + isUserSignedIn: boolean, + useNonAdvertisedList: boolean, + pubData = {}, +): void => { stub(framework); // make sure nothing else on the page has accidentally @@ -84,7 +111,9 @@ export const init = (framework: ConsentFramework, pubData = {}): void => { config: { baseEndpoint: ENDPOINT, accountId: ACCOUNT_ID, - propertyHref: getPropertyHref(framework), + propertyId: getPropertyId(framework, useNonAdvertisedList), + propertyHref: getPropertyHref(framework, useNonAdvertisedList), + campaignEnv: 'stage', targetingParams: { framework, excludePage: isExcludedFromCMP(pageSection), @@ -146,6 +175,18 @@ export const init = (framework: ConsentFramework, pubData = {}): void => { ) ) { setTimeout(invokeCallbacks, 0); + + if ( + choiceTypeID === SourcePointChoiceTypes.RejectAll && + message_type === 'gdpr' && + // isConsentOrPay(countryCode) && + !useNonAdvertisedList + ) { + console.log('User has rejected all'); + window.location.replace( + `https://support.theguardian.com/uk/contribute?redirectUrl=${window.location.href}`, + ); + } } }, onPrivacyManagerAction: function (message_type, pmData) { @@ -188,7 +229,10 @@ export const init = (framework: ConsentFramework, pubData = {}): void => { }; if (isInPropertyIdABTest) { - window._sp_.config.propertyId = getPropertyId(framework); + window._sp_.config.propertyId = getPropertyId( + framework, + useNonAdvertisedList, + ); } // NOTE - Contrary to the SourcePoint documentation, it's important that we add EITHER gdpr OR ccpa @@ -203,6 +247,8 @@ export const init = (framework: ConsentFramework, pubData = {}): void => { targetingParams: { framework, excludePage: isExcludedFromCMP(pageSection), + isCorP: false, + isUserSignedIn, }, }; break; From edd1fddb2efeefc5836b65bf1dcf6bcf98358a32 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:54:37 +0000 Subject: [PATCH 07/31] Change to window.open and use isConsentOrPay --- .../libs/src/consent-management-platform/sourcepoint.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts b/libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts index 59c413af8..09ad42502 100644 --- a/libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts +++ b/libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts @@ -2,6 +2,7 @@ import type { CountryCode } from '../index.test'; import { log } from '../logger/logger'; import { isExcludedFromCMP } from './exclusionList'; import { setCurrentFramework } from './getCurrentFramework'; +import { isConsentOrPay } from './isConsentOrPay'; import { isGuardianDomain } from './lib/domain'; import { mark } from './lib/mark'; import type { Property } from './lib/property'; @@ -183,8 +184,9 @@ export const init = ( !useNonAdvertisedList ) { console.log('User has rejected all'); - window.location.replace( + window.open( `https://support.theguardian.com/uk/contribute?redirectUrl=${window.location.href}`, + '_blank', ); } } @@ -247,7 +249,7 @@ export const init = ( targetingParams: { framework, excludePage: isExcludedFromCMP(pageSection), - isCorP: false, + isCorP: isConsentOrPay(countryCode), isUserSignedIn, }, }; From 2a9a39b8c1f74e270ddefd2fafa145d7a3ef2ef8 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Mon, 20 Jan 2025 14:08:29 +0000 Subject: [PATCH 08/31] Add isConsentOrPay to check --- .../libs/src/consent-management-platform/sourcepoint.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts b/libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts index 09ad42502..16335ecc1 100644 --- a/libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts +++ b/libs/@guardian/libs/src/consent-management-platform/sourcepoint.ts @@ -180,7 +180,7 @@ export const init = ( if ( choiceTypeID === SourcePointChoiceTypes.RejectAll && message_type === 'gdpr' && - // isConsentOrPay(countryCode) && + isConsentOrPay(countryCode) && !useNonAdvertisedList ) { console.log('User has rejected all'); From ae77c08fbe02f0d17aa2e8c6f7c0c66a2d81ef75 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Mon, 20 Jan 2025 14:08:43 +0000 Subject: [PATCH 09/31] Update test page --- .../src/components/CmpTest.svelte | 51 +++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/apps/github-pages/src/components/CmpTest.svelte b/apps/github-pages/src/components/CmpTest.svelte index 2186fce56..be43f919e 100644 --- a/apps/github-pages/src/components/CmpTest.svelte +++ b/apps/github-pages/src/components/CmpTest.svelte @@ -3,6 +3,9 @@ import { cmp, onConsentChange, log } from '@guardian/libs'; import { onMount } from 'svelte'; + let useNonAdvertisedList = window.location.search.includes('CMP_MAIN'); + let isUserSignedIn = window.location.search.includes('CMP_SIGNED_IN'); + switch (window.location.hash) { case '#tcfv2': localStorage.setItem('framework', JSON.stringify('tcfv2')); @@ -52,6 +55,29 @@ window.location.reload(); }; + const toggleQueryParams = (param) => { + let queryParams = new URLSearchParams(window.location.search); + queryParams.has(param) + ? queryParams.delete(param) + : queryParams.append(param, ''); + window.location.search = queryParams.toString(); + }; + + const toggleIsFeatureFlagEnabled = () => { + isFeatureFlagEnabled = !isFeatureFlagEnabled; + toggleQueryParams('CMP_COP'); + }; + + const toggleIsUserSignedIn = () => { + isUserSignedIn = !isUserSignedIn; + toggleQueryParams('CMP_SIGNED_IN'); + }; + + const toggleUseNonAdvertisedList = () => { + useNonAdvertisedList = !useNonAdvertisedList; + toggleQueryParams('CMP_MAIN'); + }; + let framework = JSON.parse(localStorage.getItem('framework')); let setLocation = () => { @@ -91,10 +117,11 @@ } // do this loads to make sure that doesn't break things - cmp.init({ country }); - cmp.init({ country }); - cmp.init({ country }); - cmp.init({ country }); + cmp.init({ + country, + isUserSignedIn: isUserSignedIn ?? false, + useNonAdvertisedList: useNonAdvertisedList ?? false, + }); }); @@ -133,6 +160,22 @@ in Australia: CCPA-like + +