@onsvisual/svelte-components 0.1.103 → 0.1.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
let baseurl = "//www.ons.gov.uk";
|
|
50
50
|
|
|
51
51
|
function hasCookiesPreferencesSet() {
|
|
52
|
-
return -1 < document.cookie.indexOf("
|
|
52
|
+
return -1 < document.cookie.indexOf("ons_cookie_message_displayed=true");
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// extractValue extracts the value from a undecodeable json cookie string
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
// Check if usage cookies are allowed (for Google Analytics + Hotjar)
|
|
67
67
|
// note: this ported function returns the inverse truth value to the dp-renderer code that it's based on
|
|
68
68
|
// ----------------------
|
|
69
|
-
// getUsageCookieValue reads the legacy cookies_policy and
|
|
69
|
+
// getUsageCookieValue reads the legacy cookies_policy and ons_cookie_policy to determine the user's usage preference.
|
|
70
70
|
// The legacy policy takes precedence over the new policy. When no policy is found, the user is opted out by default.
|
|
71
71
|
function getUsageCookieValue() {
|
|
72
72
|
// TODO: this is the legacy cookie (cookies_policy) handling and will be removed in due course
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
let cookiesPath = "/";
|
|
107
107
|
|
|
108
108
|
document.cookie = `ons_cookie_message_displayed=${cookiesPreference};max-age=${oneYearInSeconds};domain=${cookiesDomain};path=${cookiesPath};`;
|
|
109
|
-
document.cookie = `
|
|
109
|
+
document.cookie = `ons_cookie_policy=${cookiesPolicy};max-age=${oneYearInSeconds};domain=${cookiesDomain};path=${cookiesPath};`;
|
|
110
110
|
|
|
111
111
|
message = `You have ${option == "all" ? "accepted" : "rejected"} all additional cookies.`;
|
|
112
112
|
if (option == "all") usageCookies = true;
|