@guardian/consent-management-platform
Advanced tools
Comparing version 0.0.0-beta-20240206094326 to 0.0.0-beta-20240206103322
@@ -1,3 +0,3 @@ | ||
import type { CountryCode } from '@guardian/libs'; | ||
import type { Framework } from './types'; | ||
export declare const getFramework: (countryCode: CountryCode) => Framework; | ||
import type { Country } from './types/countries'; | ||
export declare const getFramework: (countryCode: Country) => Framework; |
import { log, removeCookie, storage } from '@guardian/libs'; | ||
var version = "0.0.0-beta-20240206094326"; | ||
let currentFramework; | ||
@@ -177,2 +175,3 @@ const setCurrentFramework = (framework) => { | ||
const callBackQueue = []; | ||
const finalCallbackQueue = []; | ||
const awaitingUserInteractionInTCFv2 = (state) => state.tcfv2?.eventStatus === 'cmpuishown'; | ||
@@ -236,3 +235,4 @@ const invokeCallback = (callback, state) => { | ||
const invokeCallbacks = () => { | ||
if (callBackQueue.length === 0) | ||
const callbacksToInvoke = callBackQueue.concat(finalCallbackQueue); | ||
if (callbacksToInvoke.length === 0) | ||
return; | ||
@@ -242,8 +242,13 @@ void getConsentState().then((state) => { | ||
return; | ||
callBackQueue.forEach((callback) => invokeCallback(callback, state)); | ||
callbacksToInvoke.forEach((callback) => invokeCallback(callback, state)); | ||
}); | ||
}; | ||
const onConsentChange$1 = (callBack) => { | ||
const onConsentChange$1 = (callBack, final = false) => { | ||
const newCallback = { fn: callBack }; | ||
callBackQueue.push(newCallback); | ||
if (final) { | ||
finalCallbackQueue.push(newCallback); | ||
} | ||
else { | ||
callBackQueue.push(newCallback); | ||
} | ||
void getConsentState() | ||
@@ -259,129 +264,3 @@ .then((consentState) => { | ||
/* istanbul ignore file */ | ||
// Reference : https://docs.sourcepoint.com/hc/en-us/articles/18007731422099-Enable-GPP-Multi-State-Privacy-String-MSPS-with-U-S-Privacy-CCPA-solution | ||
const stub_gpp_ccpa = () => { | ||
(window.__gpp_addFrame = function (e) { | ||
if (!window.frames[e]) { | ||
if (document.body) { | ||
var t = document.createElement('iframe'); | ||
(t.style.cssText = 'display:none'), | ||
(t.name = e), | ||
document.body.appendChild(t); | ||
} else window.setTimeout(window.__gpp_addFrame, 10, e); | ||
} | ||
}), | ||
(window.__gpp_stub = function () { | ||
var e = arguments; | ||
if ( | ||
((__gpp.queue = __gpp.queue || []), | ||
(__gpp.events = __gpp.events || []), | ||
!e.length || (1 == e.length && 'queue' == e[0])) | ||
) { | ||
return __gpp.queue; | ||
} | ||
if (1 == e.length && 'events' == e[0]) return __gpp.events; | ||
var t = e[0], | ||
p = e.length > 1 ? e[1] : null, | ||
n = e.length > 2 ? e[2] : null; | ||
if ('ping' === t) { | ||
return { | ||
gppVersion: '1.0', | ||
cmpStatus: 'stub', | ||
cmpDisplayStatus: 'hidden', | ||
supportedAPIs: ['tcfeuv2', 'tcfcav2', 'uspv1'], | ||
cmpId: 31, | ||
}; | ||
} | ||
if ('addEventListener' === t) { | ||
'lastId' in __gpp || (__gpp.lastId = 0), __gpp.lastId++; | ||
var a = __gpp.lastId; | ||
return ( | ||
__gpp.events.push({ id: a, callback: p, parameter: n }), | ||
{ | ||
eventName: 'listenerRegistered', | ||
listenerId: a, | ||
data: !0, | ||
pingData: { | ||
gppVersion: '1.0', | ||
cmpStatus: 'stub', | ||
cmpDisplayStatus: 'hidden', | ||
supportedAPIs: ['tcfeuv2', 'tcfva', 'usnat'], | ||
cmpId: 31, | ||
}, | ||
} | ||
); | ||
} | ||
if ('removeEventListener' === t) { | ||
for (var s = !1, i = 0; i < __gpp.events.length; i++) { | ||
if (__gpp.events[i].id == n) { | ||
__gpp.events.splice(i, 1), (s = !0); | ||
break; | ||
} | ||
} | ||
return { | ||
eventName: 'listenerRemoved', | ||
listenerId: n, | ||
data: s, | ||
pingData: { | ||
gppVersion: '1.0', | ||
cmpStatus: 'stub', | ||
cmpDisplayStatus: 'hidden', | ||
supportedAPIs: ['tcfeuv2', 'tcfva', 'usnat'], | ||
cmpId: 31, | ||
}, | ||
}; | ||
} | ||
return 'getGPPData' === t | ||
? { | ||
sectionId: 3, | ||
gppVersion: 1, | ||
sectionList: [], | ||
applicableSections: [0], | ||
gppString: '', | ||
pingData: { | ||
gppVersion: '1.0', | ||
cmpStatus: 'stub', | ||
cmpDisplayStatus: 'hidden', | ||
supportedAPIs: ['tcfeuv2', 'tcfva', 'usnat'], | ||
cmpId: 31, | ||
}, | ||
} | ||
: 'hasSection' === t || 'getSection' === t || 'getField' === t | ||
? null | ||
: void __gpp.queue.push([].slice.apply(e)); | ||
}), | ||
(window.__gpp_msghandler = function (e) { | ||
var t = 'string' == typeof e.data; | ||
try { | ||
var p = t ? JSON.parse(e.data) : e.data; | ||
} catch (e) { | ||
p = null; | ||
} | ||
if ('object' == typeof p && null !== p && '__gppCall' in p) { | ||
var n = p.__gppCall; | ||
window.__gpp( | ||
n.command, | ||
function (p, a) { | ||
var s = { | ||
__gppReturn: { | ||
returnValue: p, | ||
success: a, | ||
callId: n.callId, | ||
}, | ||
}; | ||
e.source.postMessage(t ? JSON.stringify(s) : s, '*'); | ||
}, | ||
'parameter' in n ? n.parameter : null, | ||
'version' in n ? n.version : 1, | ||
); | ||
} | ||
}), | ||
('__gpp' in window && 'function' == typeof window.__gpp) || | ||
((window.__gpp = window.__gpp_stub), | ||
window.addEventListener('message', window.__gpp_msghandler, !1), | ||
window.__gpp_addFrame('__gppLocator')); | ||
}; | ||
/* eslint-disable -- this is third party code */ | ||
/* istanbul ignore file */ | ||
/* | ||
@@ -405,3 +284,4 @@ This code is the TCFv2 stub made available by Sourcepoint. | ||
(n.d = function (t, e, r) { | ||
n.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: r }); | ||
n.o(t, e) || | ||
Object.defineProperty(t, e, { enumerable: !0, get: r }); | ||
}), | ||
@@ -418,3 +298,4 @@ (n.r = function (t) { | ||
if ((1 & e && (t = n(t)), 8 & e)) return t; | ||
if (4 & e && 'object' == typeof t && t && t.__esModule) return t; | ||
if (4 & e && 'object' == typeof t && t && t.__esModule) | ||
return t; | ||
var r = Object.create(null); | ||
@@ -444,6 +325,6 @@ if ( | ||
return t.default; | ||
} | ||
} | ||
: function () { | ||
return t; | ||
}; | ||
}; | ||
return n.d(e, 'a', e), e; | ||
@@ -472,3 +353,5 @@ }), | ||
t.exports = function (t) { | ||
return 'object' == typeof t ? null !== t : 'function' == typeof t; | ||
return 'object' == typeof t | ||
? null !== t | ||
: 'function' == typeof t; | ||
}; | ||
@@ -507,3 +390,5 @@ }, | ||
for ( | ||
var n = arguments.length, r = new Array(n), o = 0; | ||
var n = arguments.length, | ||
r = new Array(n), | ||
o = 0; | ||
o < n; | ||
@@ -518,3 +403,5 @@ o++ | ||
'boolean' == typeof r[3] && | ||
((t = r[3]), 'function' == typeof r[2] && r[2]('set', !0)); | ||
((t = r[3]), | ||
'function' == typeof r[2] && | ||
r[2]('set', !0)); | ||
else if ('ping' === r[0]) { | ||
@@ -557,3 +444,6 @@ var i = { | ||
e && (i = JSON.stringify(i)), | ||
t.source.postMessage(i, '*'); | ||
t.source.postMessage( | ||
i, | ||
'*', | ||
); | ||
}, | ||
@@ -603,3 +493,3 @@ o.parameter, | ||
return 'value' in n && (t[e] = n.value), t; | ||
}; | ||
}; | ||
}, | ||
@@ -669,7 +559,15 @@ function (t, e, n) { | ||
var n, o; | ||
if (e && 'function' == typeof (n = t.toString) && !r((o = n.call(t)))) | ||
if ( | ||
e && | ||
'function' == typeof (n = t.toString) && | ||
!r((o = n.call(t))) | ||
) | ||
return o; | ||
if ('function' == typeof (n = t.valueOf) && !r((o = n.call(t)))) | ||
return o; | ||
if (!e && 'function' == typeof (n = t.toString) && !r((o = n.call(t)))) | ||
if ( | ||
!e && | ||
'function' == typeof (n = t.toString) && | ||
!r((o = n.call(t))) | ||
) | ||
return o; | ||
@@ -756,3 +654,2 @@ throw TypeError("Can't convert object to primitive value"); | ||
stub_uspapi_ccpa(); | ||
stub_gpp_ccpa(); | ||
break; | ||
@@ -871,3 +768,2 @@ case 'aus': | ||
window._sp_.config.ccpa = { | ||
includeGppApi: true, | ||
targetingParams: { | ||
@@ -1003,3 +899,3 @@ framework, | ||
onConsentChange$1((consentState) => { | ||
if (consentState.tcfv2 ?? consentState.ccpa ?? consentState.aus) { | ||
if (consentState.tcfv2 || consentState.ccpa || consentState.aus) { | ||
resolve(consentState); | ||
@@ -1032,3 +928,7 @@ } | ||
ipsos: { | ||
cookies: ['DM_SitId1073', 'DM_SitId1073SecId5802', 'DotMetrics.AmpCookie'], | ||
cookies: [ | ||
'DM_SitId1073', | ||
'DM_SitId1073SecId5802', | ||
'DotMetrics.AmpCookie', | ||
], | ||
localStorage: [ | ||
@@ -1108,4 +1008,3 @@ 'DotmetricsSiteData', | ||
if (!isServerSide) { | ||
if (typeof window.guCmpHotFix === 'undefined') | ||
window.guCmpHotFix = {}; | ||
window.guCmpHotFix ||= {}; | ||
} | ||
@@ -1122,8 +1021,7 @@ let _willShowPrivacyMessage; | ||
if (window.guCmpHotFix.initialised) { | ||
if (window.guCmpHotFix.cmp?.version !== version) { | ||
if (window.guCmpHotFix.cmp?.version !== "0.0.0-beta-20240206103322") | ||
console.warn('Two different versions of the CMP are running:', [ | ||
version, | ||
"0.0.0-beta-20240206103322", | ||
window.guCmpHotFix.cmp?.version, | ||
]); | ||
} | ||
return; | ||
@@ -1164,3 +1062,3 @@ } | ||
showPrivacyManager, | ||
version: version, | ||
version: "0.0.0-beta-20240206103322", | ||
__isDisabled: isDisabled, | ||
@@ -1167,0 +1065,0 @@ __enable: enable, |
@@ -7,4 +7,2 @@ 'use strict'; | ||
var version = "0.0.0-beta-20240206094326"; | ||
let currentFramework; | ||
@@ -182,2 +180,3 @@ const setCurrentFramework = (framework) => { | ||
const callBackQueue = []; | ||
const finalCallbackQueue = []; | ||
const awaitingUserInteractionInTCFv2 = (state) => state.tcfv2?.eventStatus === 'cmpuishown'; | ||
@@ -241,3 +240,4 @@ const invokeCallback = (callback, state) => { | ||
const invokeCallbacks = () => { | ||
if (callBackQueue.length === 0) | ||
const callbacksToInvoke = callBackQueue.concat(finalCallbackQueue); | ||
if (callbacksToInvoke.length === 0) | ||
return; | ||
@@ -247,8 +247,13 @@ void getConsentState().then((state) => { | ||
return; | ||
callBackQueue.forEach((callback) => invokeCallback(callback, state)); | ||
callbacksToInvoke.forEach((callback) => invokeCallback(callback, state)); | ||
}); | ||
}; | ||
const onConsentChange$1 = (callBack) => { | ||
const onConsentChange$1 = (callBack, final = false) => { | ||
const newCallback = { fn: callBack }; | ||
callBackQueue.push(newCallback); | ||
if (final) { | ||
finalCallbackQueue.push(newCallback); | ||
} | ||
else { | ||
callBackQueue.push(newCallback); | ||
} | ||
void getConsentState() | ||
@@ -264,129 +269,3 @@ .then((consentState) => { | ||
/* istanbul ignore file */ | ||
// Reference : https://docs.sourcepoint.com/hc/en-us/articles/18007731422099-Enable-GPP-Multi-State-Privacy-String-MSPS-with-U-S-Privacy-CCPA-solution | ||
const stub_gpp_ccpa = () => { | ||
(window.__gpp_addFrame = function (e) { | ||
if (!window.frames[e]) { | ||
if (document.body) { | ||
var t = document.createElement('iframe'); | ||
(t.style.cssText = 'display:none'), | ||
(t.name = e), | ||
document.body.appendChild(t); | ||
} else window.setTimeout(window.__gpp_addFrame, 10, e); | ||
} | ||
}), | ||
(window.__gpp_stub = function () { | ||
var e = arguments; | ||
if ( | ||
((__gpp.queue = __gpp.queue || []), | ||
(__gpp.events = __gpp.events || []), | ||
!e.length || (1 == e.length && 'queue' == e[0])) | ||
) { | ||
return __gpp.queue; | ||
} | ||
if (1 == e.length && 'events' == e[0]) return __gpp.events; | ||
var t = e[0], | ||
p = e.length > 1 ? e[1] : null, | ||
n = e.length > 2 ? e[2] : null; | ||
if ('ping' === t) { | ||
return { | ||
gppVersion: '1.0', | ||
cmpStatus: 'stub', | ||
cmpDisplayStatus: 'hidden', | ||
supportedAPIs: ['tcfeuv2', 'tcfcav2', 'uspv1'], | ||
cmpId: 31, | ||
}; | ||
} | ||
if ('addEventListener' === t) { | ||
'lastId' in __gpp || (__gpp.lastId = 0), __gpp.lastId++; | ||
var a = __gpp.lastId; | ||
return ( | ||
__gpp.events.push({ id: a, callback: p, parameter: n }), | ||
{ | ||
eventName: 'listenerRegistered', | ||
listenerId: a, | ||
data: !0, | ||
pingData: { | ||
gppVersion: '1.0', | ||
cmpStatus: 'stub', | ||
cmpDisplayStatus: 'hidden', | ||
supportedAPIs: ['tcfeuv2', 'tcfva', 'usnat'], | ||
cmpId: 31, | ||
}, | ||
} | ||
); | ||
} | ||
if ('removeEventListener' === t) { | ||
for (var s = !1, i = 0; i < __gpp.events.length; i++) { | ||
if (__gpp.events[i].id == n) { | ||
__gpp.events.splice(i, 1), (s = !0); | ||
break; | ||
} | ||
} | ||
return { | ||
eventName: 'listenerRemoved', | ||
listenerId: n, | ||
data: s, | ||
pingData: { | ||
gppVersion: '1.0', | ||
cmpStatus: 'stub', | ||
cmpDisplayStatus: 'hidden', | ||
supportedAPIs: ['tcfeuv2', 'tcfva', 'usnat'], | ||
cmpId: 31, | ||
}, | ||
}; | ||
} | ||
return 'getGPPData' === t | ||
? { | ||
sectionId: 3, | ||
gppVersion: 1, | ||
sectionList: [], | ||
applicableSections: [0], | ||
gppString: '', | ||
pingData: { | ||
gppVersion: '1.0', | ||
cmpStatus: 'stub', | ||
cmpDisplayStatus: 'hidden', | ||
supportedAPIs: ['tcfeuv2', 'tcfva', 'usnat'], | ||
cmpId: 31, | ||
}, | ||
} | ||
: 'hasSection' === t || 'getSection' === t || 'getField' === t | ||
? null | ||
: void __gpp.queue.push([].slice.apply(e)); | ||
}), | ||
(window.__gpp_msghandler = function (e) { | ||
var t = 'string' == typeof e.data; | ||
try { | ||
var p = t ? JSON.parse(e.data) : e.data; | ||
} catch (e) { | ||
p = null; | ||
} | ||
if ('object' == typeof p && null !== p && '__gppCall' in p) { | ||
var n = p.__gppCall; | ||
window.__gpp( | ||
n.command, | ||
function (p, a) { | ||
var s = { | ||
__gppReturn: { | ||
returnValue: p, | ||
success: a, | ||
callId: n.callId, | ||
}, | ||
}; | ||
e.source.postMessage(t ? JSON.stringify(s) : s, '*'); | ||
}, | ||
'parameter' in n ? n.parameter : null, | ||
'version' in n ? n.version : 1, | ||
); | ||
} | ||
}), | ||
('__gpp' in window && 'function' == typeof window.__gpp) || | ||
((window.__gpp = window.__gpp_stub), | ||
window.addEventListener('message', window.__gpp_msghandler, !1), | ||
window.__gpp_addFrame('__gppLocator')); | ||
}; | ||
/* eslint-disable -- this is third party code */ | ||
/* istanbul ignore file */ | ||
/* | ||
@@ -410,3 +289,4 @@ This code is the TCFv2 stub made available by Sourcepoint. | ||
(n.d = function (t, e, r) { | ||
n.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: r }); | ||
n.o(t, e) || | ||
Object.defineProperty(t, e, { enumerable: !0, get: r }); | ||
}), | ||
@@ -423,3 +303,4 @@ (n.r = function (t) { | ||
if ((1 & e && (t = n(t)), 8 & e)) return t; | ||
if (4 & e && 'object' == typeof t && t && t.__esModule) return t; | ||
if (4 & e && 'object' == typeof t && t && t.__esModule) | ||
return t; | ||
var r = Object.create(null); | ||
@@ -449,6 +330,6 @@ if ( | ||
return t.default; | ||
} | ||
} | ||
: function () { | ||
return t; | ||
}; | ||
}; | ||
return n.d(e, 'a', e), e; | ||
@@ -477,3 +358,5 @@ }), | ||
t.exports = function (t) { | ||
return 'object' == typeof t ? null !== t : 'function' == typeof t; | ||
return 'object' == typeof t | ||
? null !== t | ||
: 'function' == typeof t; | ||
}; | ||
@@ -512,3 +395,5 @@ }, | ||
for ( | ||
var n = arguments.length, r = new Array(n), o = 0; | ||
var n = arguments.length, | ||
r = new Array(n), | ||
o = 0; | ||
o < n; | ||
@@ -523,3 +408,5 @@ o++ | ||
'boolean' == typeof r[3] && | ||
((t = r[3]), 'function' == typeof r[2] && r[2]('set', !0)); | ||
((t = r[3]), | ||
'function' == typeof r[2] && | ||
r[2]('set', !0)); | ||
else if ('ping' === r[0]) { | ||
@@ -562,3 +449,6 @@ var i = { | ||
e && (i = JSON.stringify(i)), | ||
t.source.postMessage(i, '*'); | ||
t.source.postMessage( | ||
i, | ||
'*', | ||
); | ||
}, | ||
@@ -608,3 +498,3 @@ o.parameter, | ||
return 'value' in n && (t[e] = n.value), t; | ||
}; | ||
}; | ||
}, | ||
@@ -674,7 +564,15 @@ function (t, e, n) { | ||
var n, o; | ||
if (e && 'function' == typeof (n = t.toString) && !r((o = n.call(t)))) | ||
if ( | ||
e && | ||
'function' == typeof (n = t.toString) && | ||
!r((o = n.call(t))) | ||
) | ||
return o; | ||
if ('function' == typeof (n = t.valueOf) && !r((o = n.call(t)))) | ||
return o; | ||
if (!e && 'function' == typeof (n = t.toString) && !r((o = n.call(t)))) | ||
if ( | ||
!e && | ||
'function' == typeof (n = t.toString) && | ||
!r((o = n.call(t))) | ||
) | ||
return o; | ||
@@ -761,3 +659,2 @@ throw TypeError("Can't convert object to primitive value"); | ||
stub_uspapi_ccpa(); | ||
stub_gpp_ccpa(); | ||
break; | ||
@@ -876,3 +773,2 @@ case 'aus': | ||
window._sp_.config.ccpa = { | ||
includeGppApi: true, | ||
targetingParams: { | ||
@@ -1008,3 +904,3 @@ framework, | ||
onConsentChange$1((consentState) => { | ||
if (consentState.tcfv2 ?? consentState.ccpa ?? consentState.aus) { | ||
if (consentState.tcfv2 || consentState.ccpa || consentState.aus) { | ||
resolve(consentState); | ||
@@ -1037,3 +933,7 @@ } | ||
ipsos: { | ||
cookies: ['DM_SitId1073', 'DM_SitId1073SecId5802', 'DotMetrics.AmpCookie'], | ||
cookies: [ | ||
'DM_SitId1073', | ||
'DM_SitId1073SecId5802', | ||
'DotMetrics.AmpCookie', | ||
], | ||
localStorage: [ | ||
@@ -1113,4 +1013,3 @@ 'DotmetricsSiteData', | ||
if (!isServerSide) { | ||
if (typeof window.guCmpHotFix === 'undefined') | ||
window.guCmpHotFix = {}; | ||
window.guCmpHotFix ||= {}; | ||
} | ||
@@ -1127,8 +1026,7 @@ let _willShowPrivacyMessage; | ||
if (window.guCmpHotFix.initialised) { | ||
if (window.guCmpHotFix.cmp?.version !== version) { | ||
if (window.guCmpHotFix.cmp?.version !== "0.0.0-beta-20240206103322") | ||
console.warn('Two different versions of the CMP are running:', [ | ||
version, | ||
"0.0.0-beta-20240206103322", | ||
window.guCmpHotFix.cmp?.version, | ||
]); | ||
} | ||
return; | ||
@@ -1169,3 +1067,3 @@ } | ||
showPrivacyManager, | ||
version: version, | ||
version: "0.0.0-beta-20240206103322", | ||
__isDisabled: isDisabled, | ||
@@ -1172,0 +1070,0 @@ __enable: enable, |
@@ -5,3 +5,3 @@ import type { onConsent as OnConsent } from './onConsent'; | ||
export declare const serverSideWarn: () => void; | ||
export declare const serverSideWarnAndReturn: <T>(arg: T) => () => T; | ||
export declare const serverSideWarnAndReturn: <T extends unknown>(arg: T) => () => T; | ||
export declare const cmp: CMP; | ||
@@ -8,0 +8,0 @@ export declare const onConsent: () => ReturnType<typeof OnConsent>; |
@@ -8,5 +8,1 @@ export interface CCPAConsentState { | ||
} | ||
export interface GPPData { | ||
gppVersion: number; | ||
gppString: string; | ||
} |
@@ -1,5 +0,5 @@ | ||
import type { CountryCode } from '@guardian/libs'; | ||
import type { VendorName } from '../vendors'; | ||
import type { AUSConsentState } from './aus'; | ||
import type { CCPAConsentState } from './ccpa'; | ||
import type { Country } from './countries'; | ||
import type { TCFv2ConsentState } from './tcfv2'; | ||
@@ -20,5 +20,5 @@ export type Framework = 'tcfv2' | 'ccpa' | 'aus'; | ||
pubData?: PubData; | ||
country?: CountryCode; | ||
country?: Country; | ||
}) => void; | ||
export type OnConsentChange = (fn: Callback) => void; | ||
export type OnConsentChange = (fn: Callback, final?: boolean) => void; | ||
export type GetConsentFor = (vendor: VendorName, consent: ConsentState) => boolean; | ||
@@ -25,0 +25,0 @@ export interface ConsentState { |
@@ -1,2 +0,4 @@ | ||
type VendorIDType = Record<string, string[]>; | ||
type VendorIDType = { | ||
[key: string]: string[]; | ||
}; | ||
export declare const TCFV2VendorIDs: VendorIDType; | ||
@@ -3,0 +5,0 @@ export declare const AusVendorIDs: VendorIDType; |
{ | ||
"name": "@guardian/consent-management-platform", | ||
"version": "0.0.0-beta-20240206094326", | ||
"version": "0.0.0-beta-20240206103322", | ||
"description": "Consent management for *.theguardian.com.", | ||
@@ -86,3 +86,2 @@ "homepage": "https://github.com/guardian/consent-management-platform.git", | ||
"rollup-plugin-svelte": "^7.1.6", | ||
"@rollup/plugin-json": "^6.1.0", | ||
"serve": "^14.2.1", | ||
@@ -89,0 +88,0 @@ "start-server-and-test": "~2.0.3", |
@@ -26,3 +26,3 @@ # Consent Management Platform | ||
- [Using Consent](#using-consent) | ||
* [`onConsentChange(callback)`](#onconsentchangecallback) | ||
* [`onConsentChange(callback, final?)`](#onconsentchangecallback-final) | ||
* [`onConsent()`](#onconsent) | ||
@@ -176,3 +176,3 @@ * [`getConsentFor(vendor, consentState)`](#getconsentforvendor-consentstate) | ||
### `onConsentChange(callback)` | ||
### `onConsentChange(callback, final?)` | ||
@@ -189,2 +189,7 @@ returns: `void` | ||
Passing `true` for the optional `final` parameter guarantees that the callback | ||
will be executed after all other callbacks that haven't been registered with the flag when consent state changes. | ||
If more than one callback registered with `final = true`, they will be executed in the order in which they were registered | ||
when consent changes. | ||
#### `callback(consentState)` | ||
@@ -191,0 +196,0 @@ |
50
57
2569
444
102443