@guardian/libs
Advanced tools
Comparing version 0.0.0-canary-20240717085735 to 0.0.0-canary-20240729085532
import { getCurrentFramework } from './getCurrentFramework.js'; | ||
import { mark } from './lib/mark.js'; | ||
import { PRIVACY_MANAGER_AUSTRALIA, PRIVACY_MANAGER_CCPA, PRIVACY_MANAGER_TCFV2 } from './lib/sourcepointConfig.js'; | ||
import { PRIVACY_MANAGER_AUSTRALIA, PRIVACY_MANAGER_USNAT, PRIVACY_MANAGER_TCFV2 } from './lib/sourcepointConfig.js'; | ||
import { init as init$1, willShowPrivacyMessage as willShowPrivacyMessage$1 } from './sourcepoint.js'; | ||
@@ -16,4 +16,4 @@ | ||
break; | ||
case "ccpa": | ||
window._sp_?.ccpa?.loadPrivacyManagerModal?.(PRIVACY_MANAGER_CCPA); | ||
case "usnat": | ||
window._sp_?.usnat?.loadPrivacyManagerModal?.(PRIVACY_MANAGER_USNAT); | ||
break; | ||
@@ -20,0 +20,0 @@ case "aus": |
@@ -5,3 +5,3 @@ const getFramework = (countryCode) => { | ||
case "US": | ||
framework = "ccpa"; | ||
framework = "usnat"; | ||
break; | ||
@@ -8,0 +8,0 @@ case "AU": |
import { isGuardianDomain } from './domain.js'; | ||
const ACCOUNT_ID = 1257; | ||
const PRIVACY_MANAGER_USNAT = 1068329; | ||
const PROPERTY_ID = 7417; | ||
const PROPERTY_ID_AUSTRALIA = 13348; | ||
const PRIVACY_MANAGER_CCPA = 540252; | ||
const PRIVACY_MANAGER_TCFV2 = 106842; | ||
@@ -11,2 +11,2 @@ const PRIVACY_MANAGER_AUSTRALIA = 540341; | ||
export { ACCOUNT_ID, ENDPOINT, PRIVACY_MANAGER_AUSTRALIA, PRIVACY_MANAGER_CCPA, PRIVACY_MANAGER_TCFV2, PROPERTY_ID, PROPERTY_ID_AUSTRALIA }; | ||
export { ACCOUNT_ID, ENDPOINT, PRIVACY_MANAGER_AUSTRALIA, PRIVACY_MANAGER_TCFV2, PRIVACY_MANAGER_USNAT, PROPERTY_ID, PROPERTY_ID_AUSTRALIA }; |
import { getConsentState as getConsentState$3 } from './aus/getConsentState.js'; | ||
import { getConsentState as getConsentState$2 } from './ccpa/getConsentState.js'; | ||
import { getCurrentFramework } from './getCurrentFramework.js'; | ||
import { getGpcSignal } from './lib/signals.js'; | ||
import { getConsentState as getConsentState$1 } from './tcfv2/getConsentState.js'; | ||
import { getConsentState as getConsentState$2 } from './usnat/getConsentState.js'; | ||
@@ -10,4 +10,5 @@ const callBackQueue = []; | ||
const awaitingUserInteractionInTCFv2 = (state) => state.tcfv2?.eventStatus === "cmpuishown"; | ||
const awaitingUserInteractionInUSNAT = (state) => state.ccpa?.signalStatus === "not ready"; | ||
const invokeCallback = (callback, state) => { | ||
if (awaitingUserInteractionInTCFv2(state)) { | ||
if (awaitingUserInteractionInTCFv2(state) || awaitingUserInteractionInUSNAT(state)) { | ||
return; | ||
@@ -35,5 +36,12 @@ } | ||
canTarget: !consentState.ccpa.doNotSell, | ||
framework: "ccpa", | ||
framework: "usnat", | ||
gpcSignal | ||
}; | ||
} else if (consentState.usnat) { | ||
return { | ||
...consentState, | ||
canTarget: !consentState.usnat.doNotSell, | ||
framework: "usnat", | ||
gpcSignal | ||
}; | ||
} else if (consentState.aus) { | ||
@@ -60,2 +68,9 @@ return { | ||
return enhanceConsentState({ ccpa: await getConsentState$2() }); | ||
case "usnat": { | ||
const usnatConsentState = await getConsentState$2(); | ||
return enhanceConsentState({ | ||
ccpa: usnatConsentState, | ||
usnat: usnatConsentState | ||
}); | ||
} | ||
case "tcfv2": | ||
@@ -73,3 +88,3 @@ return enhanceConsentState({ tcfv2: await getConsentState$1() }); | ||
void getConsentState().then((state) => { | ||
if (awaitingUserInteractionInTCFv2(state)) { | ||
if (awaitingUserInteractionInTCFv2(state) || awaitingUserInteractionInUSNAT(state)) { | ||
return; | ||
@@ -76,0 +91,0 @@ } |
@@ -32,3 +32,15 @@ import { log } from '../logger/logger.js'; | ||
invokeCallbacks(); | ||
const frameworkMessageType = framework == "tcfv2" ? "gdpr" : "ccpa"; | ||
let frameworkMessageType; | ||
switch (framework) { | ||
case "usnat": | ||
frameworkMessageType = "usnat"; | ||
break; | ||
case "aus": | ||
frameworkMessageType = "ccpa"; | ||
break; | ||
case "tcfv2": | ||
default: | ||
frameworkMessageType = "gdpr"; | ||
break; | ||
} | ||
const isInPropertyIdABTest = window.guardian?.config?.tests?.useSourcepointPropertyIdVariant === "variant"; | ||
@@ -135,7 +147,9 @@ log("cmp", `framework: ${framework}`); | ||
break; | ||
case "ccpa": | ||
window._sp_.config.ccpa = { | ||
case "usnat": | ||
window._sp_.config.usnat = { | ||
targetingParams: { | ||
framework | ||
} | ||
}, | ||
includeUspApi: true, | ||
transitionCCPAAuth: true | ||
}; | ||
@@ -142,0 +156,0 @@ break; |
@@ -0,1 +1,2 @@ | ||
import { stub_gpp_usnat } from './stub_gpp_usnat.js'; | ||
import { stub_tcfv2 } from './stub_tcfv2.js'; | ||
@@ -9,3 +10,4 @@ import { stub_uspapi_ccpa } from './stub_uspapi_ccpa.js'; | ||
break; | ||
case "ccpa": | ||
case "usnat": | ||
stub_gpp_usnat(); | ||
stub_uspapi_ccpa(); | ||
@@ -12,0 +14,0 @@ break; |
import { CountryCode } from '../../countries/@types/CountryCode.js'; | ||
import { VendorName } from '../vendors.js'; | ||
import { AUSConsentState } from './aus.js'; | ||
import { CCPAConsentState } from './ccpa.js'; | ||
import { TCFv2ConsentState } from './tcfv2/index.js'; | ||
import { USNATConsentState } from './usnat.js'; | ||
type ConsentFramework = 'tcfv2' | 'ccpa' | 'aus'; | ||
type ConsentFramework = 'tcfv2' | 'ccpa' | 'aus' | 'usnat'; | ||
type CMP = { | ||
@@ -27,3 +27,5 @@ init: InitCMP; | ||
tcfv2?: TCFv2ConsentState; | ||
ccpa?: CCPAConsentState; | ||
/** @deprecated CCPA has been deprecated. Please use usnat */ | ||
ccpa?: USNATConsentState; | ||
usnat?: USNATConsentState; | ||
aus?: AUSConsentState; | ||
@@ -30,0 +32,0 @@ gpcSignal?: boolean; |
@@ -1,3 +0,3 @@ | ||
var version = "0.0.0-canary-20240717085735"; | ||
var version = "0.0.0-canary-20240729085532"; | ||
export { version }; |
{ | ||
"name": "@guardian/libs", | ||
"version": "0.0.0-canary-20240717085735", | ||
"version": "0.0.0-canary-20240729085532", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "A collection of JavaScript libraries and TypeScript types for Guardian projects", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
238923
181
7653