@blotoutio/edgetag-sdk-js
Advanced tools
Comparing version 0.34.0 to 0.35.0
@@ -7,2 +7,3 @@ 'use strict'; | ||
get data () { return data; }, | ||
get getConsent () { return getConsent; }, | ||
get getData () { return getData; }, | ||
@@ -338,3 +339,3 @@ get getUserId () { return getUserId; }, | ||
locale: getLocale(), | ||
sdkVersion: "0.34.0" , | ||
sdkVersion: "0.35.0" , | ||
...(payload || {}), | ||
@@ -443,3 +444,3 @@ }; | ||
}; | ||
const getConsent = () => { | ||
const getConsent$1 = () => { | ||
const storageConsent = getDataPerKey('local', tagStorage, consentKey); | ||
@@ -620,3 +621,3 @@ if (storageConsent) { | ||
const providerData = {}; | ||
const consent = getConsent(); | ||
const consent = getConsent$1(); | ||
for (const pkg of Object.values(providerPackages)) { | ||
@@ -688,3 +689,3 @@ if (!pkg || !pkg.name || !pkg.tag) { | ||
const userId = handleGetUserId(); | ||
const consent = getConsent(); | ||
const consent = getConsent$1(); | ||
for (const pkg of Object.values(providerPackages)) { | ||
@@ -888,3 +889,3 @@ if (!pkg || !pkg.user || !pkg.name) { | ||
} | ||
const consent = getConsent(); | ||
const consent = getConsent$1(); | ||
if (result.consent && !consent) { | ||
@@ -908,3 +909,3 @@ saveConsent(result.consent); | ||
const configuredTags = getConfiguredTags(); | ||
const consent = getConsent(); | ||
const consent = getConsent$1(); | ||
const userId = handleGetUserId(); | ||
@@ -951,2 +952,20 @@ for (const pkg of Object.values(providerPackages)) { | ||
const handleGetConsent = (callback) => { | ||
getRequest(getConsentURL()) | ||
.then((result) => { | ||
// this will try to return the consent data stored in Edge | ||
return result === null || result === void 0 ? void 0 : result.result; | ||
}) | ||
.catch(() => undefined) | ||
.then((result) => { | ||
const consent = result !== null && result !== void 0 ? result : getConsent$1(); // this is a default value i.e. value from local storage and memory incase Edge doesn't have consent | ||
if (consent) { | ||
callback(consent); | ||
} | ||
else { | ||
callback(null, new Error('Consent not found for Current User!')); | ||
} | ||
}); | ||
}; | ||
const init = (preferences) => { | ||
@@ -976,5 +995,9 @@ handleInit(preferences); | ||
}; | ||
const getConsent = (callback) => { | ||
handleGetConsent(callback); | ||
}; | ||
exports.consent = consent; | ||
exports.data = data; | ||
exports.getConsent = getConsent; | ||
exports.getData = getData; | ||
@@ -981,0 +1004,0 @@ exports.getUserId = getUserId; |
{ | ||
"name": "@blotoutio/edgetag-sdk-js", | ||
"version": "0.34.0", | ||
"version": "0.35.0", | ||
"description": "JS SDK for EdgeTag", | ||
@@ -5,0 +5,0 @@ "author": "Blotout", |
Sorry, the diff of this file is not supported yet
59377
2069