@guardian/libs
Advanced tools
Comparing version 0.0.0-canary-20240902115558 to 0.0.0-canary-20240909092337
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; | ||
const PRIVACY_MANAGER_AUSTRALIA = 540341; | ||
const PRIVACY_MANAGER_AUSTRALIA = 1178486; | ||
const ENDPOINT = isGuardianDomain() ? "https://sourcepoint.theguardian.com" : "https://cdn.privacy-mgmt.com"; | ||
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/index.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; |
@@ -22,10 +22,11 @@ declare enum ArticleDesign { | ||
PhotoEssay = 19, | ||
Obituary = 20, | ||
Correction = 21, | ||
FullPageInteractive = 22, | ||
NewsletterSignup = 23, | ||
Timeline = 24, | ||
Profile = 25 | ||
PrintShop = 20, | ||
Obituary = 21, | ||
Correction = 22, | ||
FullPageInteractive = 23, | ||
NewsletterSignup = 24, | ||
Timeline = 25, | ||
Profile = 26 | ||
} | ||
export { ArticleDesign }; |
@@ -22,8 +22,9 @@ var ArticleDesign = /* @__PURE__ */ ((ArticleDesign2) => { | ||
ArticleDesign2[ArticleDesign2["PhotoEssay"] = 19] = "PhotoEssay"; | ||
ArticleDesign2[ArticleDesign2["Obituary"] = 20] = "Obituary"; | ||
ArticleDesign2[ArticleDesign2["Correction"] = 21] = "Correction"; | ||
ArticleDesign2[ArticleDesign2["FullPageInteractive"] = 22] = "FullPageInteractive"; | ||
ArticleDesign2[ArticleDesign2["NewsletterSignup"] = 23] = "NewsletterSignup"; | ||
ArticleDesign2[ArticleDesign2["Timeline"] = 24] = "Timeline"; | ||
ArticleDesign2[ArticleDesign2["Profile"] = 25] = "Profile"; | ||
ArticleDesign2[ArticleDesign2["PrintShop"] = 20] = "PrintShop"; | ||
ArticleDesign2[ArticleDesign2["Obituary"] = 21] = "Obituary"; | ||
ArticleDesign2[ArticleDesign2["Correction"] = 22] = "Correction"; | ||
ArticleDesign2[ArticleDesign2["FullPageInteractive"] = 23] = "FullPageInteractive"; | ||
ArticleDesign2[ArticleDesign2["NewsletterSignup"] = 24] = "NewsletterSignup"; | ||
ArticleDesign2[ArticleDesign2["Timeline"] = 25] = "Timeline"; | ||
ArticleDesign2[ArticleDesign2["Profile"] = 26] = "Profile"; | ||
return ArticleDesign2; | ||
@@ -30,0 +31,0 @@ })(ArticleDesign || {}); |
@@ -5,2 +5,3 @@ export { ArticlePillar, TeamName } from './deprecated-exports.js'; | ||
export { TCEventStatusCode, TCFv2ConsentState } from './consent-management-platform/types/tcfv2/index.js'; | ||
export { USNATConsentState } from './consent-management-platform/types/usnat/index.js'; | ||
export { cmp, getConsentFor, onConsent, onConsentChange } from './consent-management-platform/index.js'; | ||
@@ -7,0 +8,0 @@ export { getCookie } from './cookies/getCookie.js'; |
@@ -1,3 +0,3 @@ | ||
var version = "0.0.0-canary-20240902115558"; | ||
var version = "0.0.0-canary-20240909092337"; | ||
export { version }; |
{ | ||
"name": "@guardian/libs", | ||
"version": "0.0.0-canary-20240902115558", | ||
"version": "0.0.0-canary-20240909092337", | ||
"private": false, | ||
@@ -22,2 +22,3 @@ "description": "A collection of JavaScript libraries and TypeScript types for Guardian projects", | ||
"@types/wcag-contrast": "3.0.3", | ||
"eslint": "9.9.0", | ||
"jest": "29.7.0", | ||
@@ -30,6 +31,7 @@ "jest-environment-jsdom": "29.7.0", | ||
"tslib": "2.6.2", | ||
"tsx": "4.17.0", | ||
"tsx": "4.19.0", | ||
"typescript": "5.5.2", | ||
"wcag-contrast": "3.0.0", | ||
"wireit": "0.14.8" | ||
"wireit": "0.14.8", | ||
"@guardian/eslint-config": "10.0.0-beta.2" | ||
}, | ||
@@ -89,3 +91,2 @@ "peerDependencies": { | ||
"**", | ||
"../../../.eslint*", | ||
"!(dist)/**", | ||
@@ -106,3 +107,2 @@ "!.eslintcache" | ||
"**", | ||
"../../../.eslint*", | ||
"!(dist)/**", | ||
@@ -109,0 +109,0 @@ "!.eslintcache" |
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
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
239032
181
7654
16