xcoobee-cookie-kit-core
Advanced tools
Comparing version 1.0.9 to 1.0.11
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.xcoobeeCookiesKey = exports.xbApiUrl = exports.tokenKey = exports.requiredFields = exports.positions = exports.locales = exports.localeKey = exports.links = exports.expirationTime = exports.euCountries = exports.defaultConfig = exports.cssHref = exports.countryCodeKey = exports.cookieTypes = exports.cookieDefns = exports.consentStatuses = exports.consentsSources = exports.configFields = exports.animations = void 0; | ||
exports.xcoobeeCookiesKey = exports.xbApiUrl = exports.tokenKey = exports.requiredFields = exports.positions = exports.locales = exports.localeKey = exports.links = exports.fingerprintConsentKey = exports.expirationTime = exports.euCountries = exports.defaultConfig = exports.cssHref = exports.countryCodeKey = exports.cookieTypes = exports.cookieOptionsKeys = exports.cookieDefns = exports.consentStatuses = exports.consentsSources = exports.configFields = exports.animations = void 0; | ||
var xbApiUrl = process.env.XB_API_URL || "https://api.xcoobee.net"; | ||
@@ -51,2 +51,4 @@ exports.xbApiUrl = xbApiUrl; | ||
exports.cookieDefns = cookieDefns; | ||
var fingerprintConsentKey = "device_identifiers"; | ||
exports.fingerprintConsentKey = fingerprintConsentKey; | ||
var cookieTypes = cookieDefns.map(function (defn) { | ||
@@ -83,3 +85,3 @@ return defn.type; | ||
exports.cssHref = cssHref; | ||
var euCountries = ["AT", "BE", "BG", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE", "GB"]; | ||
var euCountries = ["AT", "BE", "BG", "CY", "CZ", "DK", "EE", "ES", "FI", "FR", "DE", "GB", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "SE"]; | ||
exports.euCountries = euCountries; | ||
@@ -94,3 +96,9 @@ var consentsSources = ["cached", "crowdAi", "hostsDefaults", "usersDefaults", "usersSaved", "unknown"]; | ||
exports.consentStatuses = consentStatuses; | ||
var configFields = ["campaignReference", "checkByDefaultTypes", "companyLogo", "cookieHandler", "cssAutoLoad", "displayOnlyForEU", "expirationTime", "hideBrandTag", "hideOnComplete", "position", "privacyUrl", "requestDataTypes", "targetUrl", "termsUrl", "testMode", "textMessage"]; | ||
var cookieOptionsKeys = { | ||
savedPreferences: "set", | ||
userSettings: "user", | ||
crowdAi: "ci" | ||
}; | ||
exports.cookieOptionsKeys = cookieOptionsKeys; | ||
var configFields = ["displayFingerprint", "campaignReference", "checkByDefaultTypes", "companyLogo", "cookieHandler", "cssAutoLoad", "detectCountry", "displayOnlyForEU", "expirationTime", "hideBrandTag", "hideOnComplete", "position", "privacyUrl", "requestDataTypes", "targetUrl", "termsUrl", "testMode", "textMessage"]; | ||
exports.configFields = configFields; | ||
@@ -97,0 +105,0 @@ var requiredFields = ["privacyUrl", "termsUrl", "textMessage"]; // Expiration time of cookie consents cached locally (in milliseconds) |
@@ -18,5 +18,9 @@ "use strict"; | ||
// TODO: Save as a LUT (aka consentSettings) instead of an array. | ||
var fingerprint = cookieConsents.find(function (consent) { | ||
return consent.type === "fingerprint"; | ||
}); | ||
var xcoobeeCookies = { | ||
timestamp: Date.now(), | ||
cookies: [] | ||
cookies: [], | ||
fingerprintConsent: fingerprint ? fingerprint.checked : false | ||
}; | ||
@@ -46,2 +50,3 @@ | ||
var consents = xcoobeeCookies.cookies, | ||
fingerprintConsent = xcoobeeCookies.fingerprintConsent, | ||
timestamp = xcoobeeCookies.timestamp; // If the cached cookie consents have not expired, then extract it. | ||
@@ -56,2 +61,6 @@ | ||
}); | ||
cookieConsents.push({ | ||
type: "fingerprint", | ||
checked: !!fingerprintConsent | ||
}); | ||
} | ||
@@ -58,0 +67,0 @@ } catch (err) { |
@@ -21,6 +21,6 @@ "use strict"; | ||
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); | ||
expires = "; expires=" + date.toUTCString(); | ||
expires = "; expires=".concat(date.toUTCString()); | ||
} | ||
document.cookie = name + "=" + (value || "") + expires + "; path=/"; | ||
document.cookie = "".concat(name, "=").concat(value || "").concat(expires, "; path=/"); | ||
} | ||
@@ -35,3 +35,3 @@ /** | ||
function xckEraseCookie(name) { | ||
document.cookie = name + "=; Max-Age=-99999999; path=/"; | ||
document.cookie = "".concat(name, "=; Max-Age=-99999999; path=/"); | ||
} | ||
@@ -92,3 +92,3 @@ /** | ||
// Load and save the cookies set for this category | ||
var storeName = "xck_cat_" + category; | ||
var storeName = "xck_cat_".concat(category); | ||
var currentCategoryCookies = localStorage.getItem(storeName); | ||
@@ -100,3 +100,3 @@ | ||
} else { | ||
currentCategoryCookies = currentCategoryCookies + "," + aAddedCookies.join(); | ||
currentCategoryCookies = "".concat(currentCategoryCookies, ",").concat(aAddedCookies.join()); | ||
} | ||
@@ -176,3 +176,3 @@ | ||
var category = entries[i]; | ||
var storeName = "xck_cat_" + category[0]; // Check whether we need to delete the category | ||
var storeName = "xck_cat_".concat(category[0]); // Check whether we need to delete the category | ||
@@ -196,2 +196,19 @@ if (!category[1]) { | ||
/** | ||
* Parse html encoded script directives | ||
* | ||
* @param {Array} htmlData - string with script tags to be loaded | ||
* @return {Object} the fully parsed html elements in HtmlCollection | ||
*/ | ||
function xckParseHtml(htmlData) { | ||
// Parse encoded via text area | ||
var txt = document.createElement("textarea"); | ||
txt.innerHTML = htmlData; // Now add this as html to our shadow doc | ||
var el = document.createElement("html"); | ||
el.innerHTML = txt.innerText; | ||
return el; | ||
} | ||
/** | ||
* Scans document for HTML defined xbee-script tags and converts them into | ||
@@ -219,4 +236,4 @@ * scripts that will be loaded once user grants consent. Will also look for | ||
// We use this notation to cause error when required attributes are not present | ||
var scriptAction = item.attributes["action"].value; | ||
var scriptCategory = item.attributes["category"].value; // For setting continue if user has responded, we are allowed the category, and action matches | ||
var scriptAction = item.attributes.action.value; | ||
var scriptCategory = item.attributes.category.value; // For setting continue if user has responded, we are allowed the category, and action matches | ||
@@ -226,3 +243,3 @@ if (scriptAction === "set" && cookieTypes[scriptCategory]) { | ||
script = script.replace(/xbee-script/ig, "script"); | ||
resolvedScripts = resolvedScripts + script; | ||
resolvedScripts += script; | ||
} // For un-setting getCookieTypes() has to be false we use separate condition for easier readability | ||
@@ -234,3 +251,3 @@ | ||
script = script.replace(/xbee-script/ig, "script"); | ||
resolvedScripts = resolvedScripts + script; | ||
resolvedScripts += script; | ||
} // Parse and load text scripts if we can find them | ||
@@ -278,4 +295,4 @@ | ||
var cookieName = item.attributes["name"].value; | ||
var cookieCategory = item.attributes["category"].value; | ||
var cookieName = item.attributes.name.value; | ||
var cookieCategory = item.attributes.category.value; | ||
var cookieDays = 0; // Days is optional so we use this notation to retrieve it | ||
@@ -282,0 +299,0 @@ |
@@ -8,4 +8,2 @@ "use strict"; | ||
var _AccessTokenManager = _interopRequireDefault(require("./AccessTokenManager")); | ||
var _configs = _interopRequireDefault(require("./configs")); | ||
@@ -15,4 +13,2 @@ | ||
var _CookieConsentsManager = _interopRequireDefault(require("./CookieConsentsManager")); | ||
var _graphql = _interopRequireDefault(require("./graphql")); | ||
@@ -27,6 +23,4 @@ | ||
var core = { | ||
AccessTokenManager: _AccessTokenManager.default, | ||
configs: _configs.default, | ||
cookieConsentsCache: _cookieConsentsCache.default, | ||
CookieConsentsManager: _CookieConsentsManager.default, | ||
graphql: _graphql.default, | ||
@@ -33,0 +27,0 @@ NotAuthorizedError: _NotAuthorizedError.default, |
@@ -5,4 +5,6 @@ { | ||
"CookieKit.CheckAllButton": "Alle aktivieren", | ||
"CookieKit.FingerprintLabel": "Allow use of Fingerprinting (de-de)", | ||
"CookieKit.LoginLink": "Login", | ||
"CookieKit.ManageLink": "Verwalten", | ||
"CookieKit.MoreInfo": "Mehr Info", | ||
"CookieKit.OkButton": "OK", | ||
@@ -9,0 +11,0 @@ "CookieKit.PolicyLink": "Cookie-Richtlinie", |
@@ -5,4 +5,6 @@ { | ||
"CookieKit.CheckAllButton": "Check All", | ||
"CookieKit.FingerprintLabel": "Allow use of Fingerprinting", | ||
"CookieKit.LoginLink": "Login", | ||
"CookieKit.ManageLink": "Manage", | ||
"CookieKit.MoreInfo": "More info", | ||
"CookieKit.OkButton": "OK", | ||
@@ -9,0 +11,0 @@ "CookieKit.PolicyLink": "Cookie Policy", |
@@ -5,4 +5,6 @@ { | ||
"CookieKit.CheckAllButton": "Marcar todo", | ||
"CookieKit.FingerprintLabel": "Allow use of Fingerprinting (es-419)", | ||
"CookieKit.LoginLink": "Iniciar sesión", | ||
"CookieKit.ManageLink": "Gestionar", | ||
"CookieKit.MoreInfo": "Más información", | ||
"CookieKit.OkButton": "De acuerdo", | ||
@@ -9,0 +11,0 @@ "CookieKit.PolicyLink": "Política de cookies", |
@@ -5,4 +5,6 @@ { | ||
"CookieKit.CheckAllButton": "Tout vérifier", | ||
"CookieKit.FingerprintLabel": "Allow use of Fingerprinting (fr-fr)", | ||
"CookieKit.LoginLink": "Connexion", | ||
"CookieKit.ManageLink": "Gérer", | ||
"CookieKit.MoreInfo": "Plus d'informations", | ||
"CookieKit.OkButton": "OK", | ||
@@ -9,0 +11,0 @@ "CookieKit.PolicyLink": "Politique en matière de cookies.", |
@@ -12,2 +12,4 @@ "use strict"; | ||
exports.saveCountryCode = saveCountryCode; | ||
exports.fetchCountryCode = fetchCountryCode; | ||
exports.fetchCountryCodeForSubscribers = fetchCountryCodeForSubscribers; | ||
@@ -40,2 +42,24 @@ var _configs = require("./configs"); | ||
localStorage.setItem(_configs.countryCodeKey, countryCode); | ||
} | ||
function fetchCountryCode() { | ||
// console.log("LocaleManager#fetchCountryCode fetching..."); | ||
return fetch("http://ip-api.com/json").then(function (res) { | ||
return res.json(); | ||
}).then(function (res) { | ||
// console.log("LocaleManager#fetchCountryCode fetched."); | ||
var countryCode = res ? res.countryCode : "EU"; | ||
return countryCode; | ||
}); | ||
} | ||
function fetchCountryCodeForSubscribers(campaignReference) { | ||
// console.log("LocaleManager#fetchCountryCodeForSubscribers fetching..."); | ||
return fetch("".concat(_configs.xbApiUrl, "/geoip?reference=").concat(campaignReference)).then(function (res) { | ||
return res.json(); | ||
}).then(function (res) { | ||
// console.log("LocaleManager#fetchCountryCodeForSubscribers fetched."); | ||
var countryCode = res ? res.country : "EU"; | ||
return countryCode; | ||
}); | ||
} |
{ | ||
"name": "xcoobee-cookie-kit-core", | ||
"version": "1.0.9", | ||
"version": "1.0.11", | ||
"description": "Cookie Consent Management for Websites", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -19,3 +19,3 @@ # XcooBee Cookie Kit Core | ||
[Cookie Kit Tutorial](https://www.youtube.com/watch?v=X2DNrckHLBI) | ||
[Cookie Kit Tutorial](https://youtu.be/gKYNoARNXRo) | ||
@@ -22,0 +22,0 @@ ## What is the difference |
@@ -48,2 +48,3 @@ const xbApiUrl = process.env.XB_API_URL || "https://api.xcoobee.net"; | ||
]; | ||
const fingerprintConsentKey = "device_identifiers"; | ||
@@ -77,5 +78,4 @@ const cookieTypes = cookieDefns.map(defn => defn.type); | ||
const euCountries = [ | ||
"AT", "BE", "BG", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IE", | ||
"IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE", | ||
"GB", | ||
"AT", "BE", "BG", "CY", "CZ", "DK", "EE", "ES", "FI", "FR", "DE", "GB", "GR", "HU", | ||
"IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "SE", | ||
]; | ||
@@ -98,3 +98,10 @@ | ||
const cookieOptionsKeys = { | ||
savedPreferences: "set", | ||
userSettings: "user", | ||
crowdAi: "ci", | ||
}; | ||
const configFields = [ | ||
"displayFingerprint", | ||
"campaignReference", | ||
@@ -105,2 +112,3 @@ "checkByDefaultTypes", | ||
"cssAutoLoad", | ||
"detectCountry", | ||
"displayOnlyForEU", | ||
@@ -129,2 +137,3 @@ "expirationTime", | ||
cookieDefns, | ||
cookieOptionsKeys, | ||
cookieTypes, | ||
@@ -136,2 +145,3 @@ countryCodeKey, | ||
expirationTime, | ||
fingerprintConsentKey, | ||
links, | ||
@@ -138,0 +148,0 @@ localeKey, |
@@ -17,3 +17,8 @@ | ||
// TODO: Save as a LUT (aka consentSettings) instead of an array. | ||
const xcoobeeCookies = { timestamp: Date.now(), cookies: [] }; | ||
const fingerprint = cookieConsents.find(consent => consent.type === "fingerprint"); | ||
const xcoobeeCookies = { | ||
timestamp: Date.now(), | ||
cookies: [], | ||
fingerprintConsent: fingerprint ? fingerprint.checked : false, | ||
}; | ||
cookieDefns.forEach((cookieDefn) => { | ||
@@ -38,3 +43,3 @@ const cookieConsent = cookieConsents.find(item => item.type === cookieDefn.type); | ||
const xcoobeeCookies = JSON.parse(localStorage[xcoobeeCookiesKey]); | ||
const { cookies: consents, timestamp } = xcoobeeCookies; | ||
const { cookies: consents, fingerprintConsent, timestamp } = xcoobeeCookies; | ||
@@ -47,2 +52,3 @@ // If the cached cookie consents have not expired, then extract it. | ||
})); | ||
cookieConsents.push({ type: "fingerprint", checked: !!fingerprintConsent }); | ||
} | ||
@@ -49,0 +55,0 @@ } catch (err) { |
@@ -12,8 +12,8 @@ /** | ||
if (days) { | ||
let date = new Date(); | ||
const date = new Date(); | ||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); | ||
expires = "; expires=" + date.toUTCString(); | ||
expires = `; expires=${date.toUTCString()}`; | ||
} | ||
document.cookie = name + "=" + (value || "") + expires + "; path=/"; | ||
document.cookie = `${name}=${value || ""}${expires}; path=/`; | ||
} | ||
@@ -27,3 +27,3 @@ | ||
function xckEraseCookie(name) { | ||
document.cookie = name + "=; Max-Age=-99999999; path=/"; | ||
document.cookie = `${name}=; Max-Age=-99999999; path=/`; | ||
} | ||
@@ -41,3 +41,3 @@ | ||
for (let i = 0; i < ca.length; i++) { | ||
let c = ca[i].split("=")[0].trim(); | ||
const c = ca[i].split("=")[0].trim(); | ||
@@ -57,8 +57,8 @@ ra.push(c); | ||
function xckReturnNewElements(oldArray, newArray) { | ||
let ra = []; | ||
const ra = []; | ||
for (let i = 0; i < newArray.length; i++) { | ||
let item = newArray[i]; | ||
const item = newArray[i]; | ||
if (oldArray.indexOf(item)===-1) { | ||
if (oldArray.indexOf(item) === -1) { | ||
ra.push(item); | ||
@@ -76,5 +76,5 @@ } | ||
*/ | ||
function xckSaveCookieState(aInitialCookies,category) { | ||
let aNewCookies = xckGetCookieNames(); | ||
let aAddedCookies = xckReturnNewElements(aInitialCookies, aNewCookies); | ||
function xckSaveCookieState(aInitialCookies, category) { | ||
const aNewCookies = xckGetCookieNames(); | ||
const aAddedCookies = xckReturnNewElements(aInitialCookies, aNewCookies); | ||
@@ -84,10 +84,10 @@ // Check what cookies are set now and save this to our local store | ||
// Load and save the cookies set for this category | ||
let storeName = "xck_cat_" + category; | ||
const storeName = `xck_cat_${category}`; | ||
let currentCategoryCookies = localStorage.getItem(storeName); | ||
if (aAddedCookies.length > 0 ) { | ||
if (aAddedCookies.length > 0) { | ||
if (currentCategoryCookies === null) { | ||
currentCategoryCookies = aAddedCookies.join(); | ||
} else { | ||
currentCategoryCookies = currentCategoryCookies + "," + aAddedCookies.join(); | ||
currentCategoryCookies = `${currentCategoryCookies},${aAddedCookies.join()}`; | ||
} | ||
@@ -106,8 +106,8 @@ localStorage.setItem(storeName, currentCategoryCookies); | ||
function xckLoadJs(loadScripts, category) { | ||
let aInitialCookies = xckGetCookieNames(); | ||
const aInitialCookies = xckGetCookieNames(); | ||
if (loadScripts.length > 0) { | ||
for (let i = 0; i < loadScripts.length; i++) { | ||
let item = loadScripts[i]; | ||
let script = document.createElement("script"); | ||
const item = loadScripts[i]; | ||
const script = document.createElement("script"); | ||
@@ -155,11 +155,11 @@ if (item.src === "") { | ||
for (let i = 0; i < entries.length; i++) { | ||
let category = entries[i]; | ||
let storeName = "xck_cat_" + category[0]; | ||
const category = entries[i]; | ||
const storeName = `xck_cat_${category[0]}`; | ||
// Check whether we need to delete the category | ||
if (!category[1]) { | ||
let currentSetCookies = localStorage.getItem(storeName); | ||
const currentSetCookies = localStorage.getItem(storeName); | ||
if (currentSetCookies !== null) { | ||
let cookies = currentSetCookies.split(","); | ||
const cookies = currentSetCookies.split(","); | ||
@@ -178,2 +178,20 @@ // Iterate and delete | ||
/** | ||
* Parse html encoded script directives | ||
* | ||
* @param {Array} htmlData - string with script tags to be loaded | ||
* @return {Object} the fully parsed html elements in HtmlCollection | ||
*/ | ||
function xckParseHtml(htmlData) { | ||
// Parse encoded via text area | ||
const txt = document.createElement("textarea"); | ||
txt.innerHTML = htmlData; | ||
// Now add this as html to our shadow doc | ||
const el = document.createElement("html"); | ||
el.innerHTML = txt.innerText; | ||
return el; | ||
} | ||
/** | ||
* Scans document for HTML defined xbee-script tags and converts them into | ||
@@ -187,3 +205,3 @@ * scripts that will be loaded once user grants consent. Will also look for | ||
function xckHandleXbeeScriptTags(cookieTypes) { | ||
let xbeCookieScripts = document.getElementsByTagName("xbee-script"); | ||
const xbeCookieScripts = document.getElementsByTagName("xbee-script"); | ||
let i = 0; | ||
@@ -194,3 +212,3 @@ let resolvedScripts = ""; | ||
for (i = 0; i < xbeCookieScripts.length; i++) { | ||
let item = xbeCookieScripts[i]; | ||
const item = xbeCookieScripts[i]; | ||
let script = item.outerHTML; | ||
@@ -202,4 +220,4 @@ | ||
// We use this notation to cause error when required attributes are not present | ||
let scriptAction = item.attributes["action"].value; | ||
let scriptCategory = item.attributes["category"].value; | ||
const scriptAction = item.attributes.action.value; | ||
const scriptCategory = item.attributes.category.value; | ||
@@ -210,3 +228,3 @@ // For setting continue if user has responded, we are allowed the category, and action matches | ||
script = script.replace(/xbee-script/ig, "script"); | ||
resolvedScripts = resolvedScripts + script; | ||
resolvedScripts += script; | ||
} | ||
@@ -217,13 +235,13 @@ // For un-setting getCookieTypes() has to be false we use separate condition for easier readability | ||
script = script.replace(/xbee-script/ig, "script"); | ||
resolvedScripts = resolvedScripts + script; | ||
resolvedScripts += script; | ||
} | ||
// Parse and load text scripts if we can find them | ||
if (resolvedScripts !== "") { | ||
let runnableScripts = xckParseHtml(resolvedScripts); | ||
const runnableScripts = xckParseHtml(resolvedScripts); | ||
// Load scripts presumably to set cookies | ||
xckLoadJs(runnableScripts.getElementsByTagName("script"),scriptCategory); | ||
xckLoadJs(runnableScripts.getElementsByTagName("script"), scriptCategory); | ||
} | ||
} catch (error) { | ||
// Error happened | ||
console.log("Tag caused error, please make sure you have supplied required attributes:", script.substr(0,40)); | ||
console.log("Tag caused error, please make sure you have supplied required attributes:", script.substr(0, 40)); | ||
if (XcooBee.kit.getParam("testMode")) { | ||
@@ -245,3 +263,3 @@ console.log(error); | ||
function xckHandleXbeeCookieTags(cookieTypes) { | ||
let xbeCookieTags = document.getElementsByTagName("xbee-cookie"); | ||
const xbeCookieTags = document.getElementsByTagName("xbee-cookie"); | ||
let i = 0; | ||
@@ -251,11 +269,11 @@ | ||
for (i = 0; i < xbeCookieTags.length; i++) { | ||
let item = xbeCookieTags[i]; | ||
const item = xbeCookieTags[i]; | ||
let cookieValue = item.innerHTML; | ||
let itemOuter = item.outerHTML; | ||
const itemOuter = item.outerHTML; | ||
try { | ||
// We use the array notation since it will throw error when we have missing required attributes | ||
cookieValue = cookieValue.replace(/\r?\n|\r/g,""); // Remove CRLF | ||
let cookieName = item.attributes["name"].value; | ||
let cookieCategory = item.attributes["category"].value; | ||
cookieValue = cookieValue.replace(/\r?\n|\r/g, ""); // Remove CRLF | ||
const cookieName = item.attributes.name.value; | ||
const cookieCategory = item.attributes.category.value; | ||
let cookieDays = 0; | ||
@@ -277,3 +295,3 @@ | ||
// Error happened | ||
console.log("error in cookie definition in tag:", itemOuter.substr(0,30)); | ||
console.log("error in cookie definition in tag:", itemOuter.substr(0, 30)); | ||
if (XcooBee.kit.getParam("testMode")) { | ||
@@ -280,0 +298,0 @@ console.log(error); |
@@ -1,5 +0,3 @@ | ||
import AccessTokenManager from "./AccessTokenManager"; | ||
import configs from "./configs"; | ||
import cookieConsentsCache from "./cookieConsentsCache"; | ||
import CookieConsentsManager from "./CookieConsentsManager"; | ||
import graphql from "./graphql"; | ||
@@ -10,6 +8,4 @@ import NotAuthorizedError from "./NotAuthorizedError"; | ||
const core = { | ||
AccessTokenManager, | ||
configs, | ||
cookieConsentsCache, | ||
CookieConsentsManager, | ||
graphql, | ||
@@ -16,0 +12,0 @@ NotAuthorizedError, |
@@ -5,4 +5,6 @@ { | ||
"CookieKit.CheckAllButton": "Alle aktivieren", | ||
"CookieKit.FingerprintLabel": "Allow use of Fingerprinting (de-de)", | ||
"CookieKit.LoginLink": "Login", | ||
"CookieKit.ManageLink": "Verwalten", | ||
"CookieKit.MoreInfo": "Mehr Info", | ||
"CookieKit.OkButton": "OK", | ||
@@ -9,0 +11,0 @@ "CookieKit.PolicyLink": "Cookie-Richtlinie", |
@@ -5,4 +5,6 @@ { | ||
"CookieKit.CheckAllButton": "Check All", | ||
"CookieKit.FingerprintLabel": "Allow use of Fingerprinting", | ||
"CookieKit.LoginLink": "Login", | ||
"CookieKit.ManageLink": "Manage", | ||
"CookieKit.MoreInfo": "More info", | ||
"CookieKit.OkButton": "OK", | ||
@@ -9,0 +11,0 @@ "CookieKit.PolicyLink": "Cookie Policy", |
@@ -5,4 +5,6 @@ { | ||
"CookieKit.CheckAllButton": "Marcar todo", | ||
"CookieKit.FingerprintLabel": "Allow use of Fingerprinting (es-419)", | ||
"CookieKit.LoginLink": "Iniciar sesión", | ||
"CookieKit.ManageLink": "Gestionar", | ||
"CookieKit.MoreInfo": "Más información", | ||
"CookieKit.OkButton": "De acuerdo", | ||
@@ -9,0 +11,0 @@ "CookieKit.PolicyLink": "Política de cookies", |
@@ -5,4 +5,6 @@ { | ||
"CookieKit.CheckAllButton": "Tout vérifier", | ||
"CookieKit.FingerprintLabel": "Allow use of Fingerprinting (fr-fr)", | ||
"CookieKit.LoginLink": "Connexion", | ||
"CookieKit.ManageLink": "Gérer", | ||
"CookieKit.MoreInfo": "Plus d'informations", | ||
"CookieKit.OkButton": "OK", | ||
@@ -9,0 +11,0 @@ "CookieKit.PolicyLink": "Politique en matière de cookies.", |
@@ -1,2 +0,2 @@ | ||
import { localeKey, countryCodeKey } from "./configs"; | ||
import { localeKey, countryCodeKey, xbApiUrl } from "./configs"; | ||
@@ -28,1 +28,23 @@ export function clearLocale() { | ||
} | ||
export function fetchCountryCode() { | ||
// console.log("LocaleManager#fetchCountryCode fetching..."); | ||
return fetch("http://ip-api.com/json") | ||
.then(res => res.json()) | ||
.then((res) => { | ||
// console.log("LocaleManager#fetchCountryCode fetched."); | ||
const countryCode = res ? res.countryCode : "EU"; | ||
return countryCode; | ||
}); | ||
} | ||
export function fetchCountryCodeForSubscribers(campaignReference) { | ||
// console.log("LocaleManager#fetchCountryCodeForSubscribers fetching..."); | ||
return fetch(`${xbApiUrl}/geoip?reference=${campaignReference}`) | ||
.then(res => res.json()) | ||
.then((res) => { | ||
// console.log("LocaleManager#fetchCountryCodeForSubscribers fetched."); | ||
const countryCode = res ? res.country : "EU"; | ||
return countryCode; | ||
}); | ||
} |
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
69255
29
1306
5