@onsvisual/svelte-components 0.1.102 → 0.1.103
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_preferences_set=true");
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// extractValue extracts the value from a undecodeable json cookie string
|
|
@@ -100,13 +100,13 @@
|
|
|
100
100
|
let oneYearInSeconds = 60 * 60 * 24 * 365;
|
|
101
101
|
let cookiesDomain = window.location.hostname;
|
|
102
102
|
let cookiesPreference = !0;
|
|
103
|
-
let
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
let acceptAllCookiesPolicy = `{'essential':true,'settings':true,'usage':true,'campaigns':true}`;
|
|
104
|
+
let rejectAllCookiesPolicy = `{'essential':true,'settings':false,'usage':false,'campaigns':false}`;
|
|
105
|
+
let cookiesPolicy = option == "all" ? acceptAllCookiesPolicy : rejectAllCookiesPolicy;
|
|
106
106
|
let cookiesPath = "/";
|
|
107
107
|
|
|
108
|
-
document.cookie = `
|
|
109
|
-
document.cookie = `
|
|
108
|
+
document.cookie = `ons_cookie_message_displayed=${cookiesPreference};max-age=${oneYearInSeconds};domain=${cookiesDomain};path=${cookiesPath};`;
|
|
109
|
+
document.cookie = `ons_cookies_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;
|