diff --git a/modules/33acrossIdSystem.js b/modules/33acrossIdSystem.js index 936b6b1fe47..277cb8b2f6d 100644 --- a/modules/33acrossIdSystem.js +++ b/modules/33acrossIdSystem.js @@ -145,7 +145,7 @@ function getStoredValue(key, enabledStorageTypes) { return storedValue; } -function filterEnabledSupplementalIds({ tp, fp, hem }, { storeFpid, storeTpid, privacyConsent }) { +function filterEnabledSupplementalIds({ tp, fp, hem }, { storeFpid, storeTpid, envelopeAvailable }) { const ids = []; if (storeFpid) { @@ -154,38 +154,38 @@ function filterEnabledSupplementalIds({ tp, fp, hem }, { storeFpid, storeTpid, p * [ * , * < ID value to store or remove >, - * < clear flag: indicates if existing storage item should be removed or not when the new ID is falsy> + * < clear flag: indicates if existing storage item should be removed or not based on certain condition> * ] */ - [STORAGE_FPID_KEY, fp, true], - [STORAGE_HEM_KEY, hem, privacyConsent === false] // hashed email should be cleared if there's no privacy consent. + [STORAGE_FPID_KEY, fp, !fp], + [STORAGE_HEM_KEY, hem, !envelopeAvailable] // Clear hashed email if envelope is not available ); } if (storeTpid) { - ids.push([STORAGE_TPID_KEY, tp, true]); + ids.push([STORAGE_TPID_KEY, tp, !tp]); } return ids; } -function handleEnabledSupplementalId(supplementalId, storageConfig) { +function updateSupplementalIdStorage(supplementalId, storageConfig) { const [ key, id, clear ] = supplementalId; - if (id) { - storeValue(key, id, storageConfig); + if (clear) { + deleteFromStorage(key); return; } - if (clear) { - deleteFromStorage(key); + if (id) { + storeValue(key, id, storageConfig); } } function handleSupplementalIds(ids, { enabledStorageTypes, expires, ...options }) { filterEnabledSupplementalIds(ids, options).forEach((supplementalId) => { - handleEnabledSupplementalId(supplementalId, { + updateSupplementalIdStorage(supplementalId, { enabledStorageTypes, expires }) @@ -268,7 +268,7 @@ export const thirtyThreeAcrossIdSubmodule = { }, { storeFpid, storeTpid, - privacyConsent: !!responseObj.envelope, + envelopeAvailable: !!responseObj.envelope, enabledStorageTypes, expires: storageConfig.expires }); diff --git a/modules/33acrossIdSystem.md b/modules/33acrossIdSystem.md index 9765f432aa2..7dabb08eebd 100644 --- a/modules/33acrossIdSystem.md +++ b/modules/33acrossIdSystem.md @@ -57,5 +57,5 @@ The following settings are available in the `params` property in `userSync.userI ### HEM Collection -33Across ID System supports user's hashed emails (HEMs). HEMs could be collected from 3 different -sources: `hem` configuration parameter, global `_33across.hem.sha256` field or from storage (cookie or local storage). +33Across ID System supports user's hashed emails (HEMs). HEMs could be collected from 3 different sources in following +priority order: `hem` configuration parameter, global `_33across.hem.sha256` field or from storage (cookie or local storage).