@guardian/consent-management-platform
Advanced tools
Comparing version 0.0.0-beta-20240207133608 to 0.0.0-beta-20240208100931
import { log, removeCookie, storage } from '@guardian/libs'; | ||
var version = "0.0.0-beta-20240207133608"; | ||
var version = "0.0.0-beta-20240208100931"; | ||
@@ -962,6 +962,2 @@ let currentFramework; | ||
if (!isServerSide) { | ||
if (typeof window.guCmpHotFix === 'undefined') | ||
window.guCmpHotFix = {}; | ||
} | ||
let _willShowPrivacyMessage; | ||
@@ -976,7 +972,7 @@ let initComplete = false; | ||
return; | ||
if (window.guCmpHotFix.initialised) { | ||
if (window.guCmpHotFix.cmp?.version !== version) { | ||
if (window.guCmpHotFix?.initialised) { | ||
if (window.guCmpHotFix.cmp.version !== version) { | ||
console.warn('Two different versions of the CMP are running:', [ | ||
version, | ||
window.guCmpHotFix.cmp?.version, | ||
window.guCmpHotFix.cmp.version, | ||
]); | ||
@@ -986,3 +982,4 @@ } | ||
} | ||
window.guCmpHotFix.initialised = true; | ||
if (window.guCmpHotFix) | ||
window.guCmpHotFix.initialised = true; | ||
if (typeof country === 'undefined') { | ||
@@ -1014,3 +1011,3 @@ throw new Error('CMP initialised without `country` property. A 2-letter, ISO ISO_3166-1 country code is required.'); | ||
? cmp$1 | ||
: (window.guCmpHotFix.cmp ||= { | ||
: { | ||
init, | ||
@@ -1025,13 +1022,24 @@ willShowPrivacyMessage, | ||
__disable: disable, | ||
}); | ||
}; | ||
const onConsent = isServerSide | ||
? onConsent$2 | ||
: (window.guCmpHotFix.onConsent ||= onConsent$1); | ||
: onConsent$1; | ||
const onConsentChange = isServerSide | ||
? onConsentChange$2 | ||
: (window.guCmpHotFix.onConsentChange ||= onConsentChange$1); | ||
: onConsentChange$1; | ||
const getConsentFor = isServerSide | ||
? getConsentFor$2 | ||
: (window.guCmpHotFix.getConsentFor ||= getConsentFor$1); | ||
: getConsentFor$1; | ||
if (!isServerSide) { | ||
if (typeof window.guCmpHotFix === 'undefined') { | ||
window.guCmpHotFix = { | ||
initialised: hasInitialised(), | ||
cmp: cmp, | ||
onConsent: onConsent, | ||
onConsentChange: onConsentChange, | ||
getConsentFor: getConsentFor | ||
}; | ||
} | ||
} | ||
export { cmp, getConsentFor, onConsent, onConsentChange }; |
@@ -7,3 +7,3 @@ 'use strict'; | ||
var version = "0.0.0-beta-20240207133608"; | ||
var version = "0.0.0-beta-20240208100931"; | ||
@@ -967,6 +967,2 @@ let currentFramework; | ||
if (!isServerSide) { | ||
if (typeof window.guCmpHotFix === 'undefined') | ||
window.guCmpHotFix = {}; | ||
} | ||
let _willShowPrivacyMessage; | ||
@@ -981,7 +977,7 @@ let initComplete = false; | ||
return; | ||
if (window.guCmpHotFix.initialised) { | ||
if (window.guCmpHotFix.cmp?.version !== version) { | ||
if (window.guCmpHotFix?.initialised) { | ||
if (window.guCmpHotFix.cmp.version !== version) { | ||
console.warn('Two different versions of the CMP are running:', [ | ||
version, | ||
window.guCmpHotFix.cmp?.version, | ||
window.guCmpHotFix.cmp.version, | ||
]); | ||
@@ -991,3 +987,4 @@ } | ||
} | ||
window.guCmpHotFix.initialised = true; | ||
if (window.guCmpHotFix) | ||
window.guCmpHotFix.initialised = true; | ||
if (typeof country === 'undefined') { | ||
@@ -1019,3 +1016,3 @@ throw new Error('CMP initialised without `country` property. A 2-letter, ISO ISO_3166-1 country code is required.'); | ||
? cmp$1 | ||
: (window.guCmpHotFix.cmp ||= { | ||
: { | ||
init, | ||
@@ -1030,12 +1027,23 @@ willShowPrivacyMessage, | ||
__disable: disable, | ||
}); | ||
}; | ||
const onConsent = isServerSide | ||
? onConsent$2 | ||
: (window.guCmpHotFix.onConsent ||= onConsent$1); | ||
: onConsent$1; | ||
const onConsentChange = isServerSide | ||
? onConsentChange$2 | ||
: (window.guCmpHotFix.onConsentChange ||= onConsentChange$1); | ||
: onConsentChange$1; | ||
const getConsentFor = isServerSide | ||
? getConsentFor$2 | ||
: (window.guCmpHotFix.getConsentFor ||= getConsentFor$1); | ||
: getConsentFor$1; | ||
if (!isServerSide) { | ||
if (typeof window.guCmpHotFix === 'undefined') { | ||
window.guCmpHotFix = { | ||
initialised: hasInitialised(), | ||
cmp: cmp, | ||
onConsent: onConsent, | ||
onConsentChange: onConsentChange, | ||
getConsentFor: getConsentFor | ||
}; | ||
} | ||
} | ||
@@ -1042,0 +1050,0 @@ exports.cmp = cmp; |
import type { CountryCode } from '@guardian/libs'; | ||
import type { getConsentFor } from '../getConsentFor'; | ||
import type { onConsent } from '../onConsent'; | ||
import type { onConsentChange } from '../onConsentChange'; | ||
import type { VendorName } from '../vendors'; | ||
@@ -55,1 +58,8 @@ import type { AUSConsentState } from './aus'; | ||
export type { VendorName }; | ||
export type GuCmpHotFix = { | ||
initialised: boolean; | ||
cmp: CMP; | ||
onConsent: typeof onConsent; | ||
onConsentChange: typeof onConsentChange; | ||
getConsentFor: typeof getConsentFor; | ||
}; |
{ | ||
"name": "@guardian/consent-management-platform", | ||
"version": "0.0.0-beta-20240207133608", | ||
"version": "0.0.0-beta-20240208100931", | ||
"description": "Consent management for *.theguardian.com.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/guardian/consent-management-platform.git", |
96407
2286