@vzm/verizon-media-connectid
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -1,1 +0,1 @@ | ||
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),c=function(e,t){if("string"==typeof e&&e)if(window.crypto&&crypto.subtle&&crypto.subtle.digest){var r=new TextEncoder("utf-8").encode(e.trim().toLowerCase());crypto.subtle.digest("SHA-256",r).then((function(e){var r=Array.from(new Uint8Array(e));t(r.map((function(e){return("00"+e.toString(16)).slice(-2)})).join(""))}))}else t("");else t("")};function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var u=function(){var e={};try{e=JSON.parse(localStorage.getItem("vm-connectid"))||{}}catch(e){}return e},s=function(e){try{localStorage.setItem("vm-connectid",JSON.stringify(e))}catch(e){}},f=function(e){return a({},u()[e]||{})},p=function(e,t){var r=a(a({},u()),{},o()({},e,t));s(r)},d=function(){return u().mostRecentHashedEmail},l=function(e){var t=a(a({},u()),{},{mostRecentHashedEmail:e});s(t)},y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=new XMLHttpRequest,o=Object.keys(t).map((function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])})).join("&");n.onreadystatechange=function(e){if(n.readyState===XMLHttpRequest.DONE)if(0===n.status||n.status>=200&&n.status<400)try{r(JSON.parse(n.responseText))}catch(e){r()}else r()};try{n.withCredentials=!0,n.open("GET","".concat(e,"?").concat(o),!0),n.send(t)}catch(e){}};function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var v={};v.syncHashedEmail=function(e){var t=e.pixelId,r=e.hashedEmail,n=e.gdpr,o=e.gdprConsent,c=e.vm1p;if(t&&r){var i=f(r);if(i.connectId)if(function(e){if(!e)return!1;return(new Date-new Date(e))/36e5<360}(i.connectId.lastUpdated))return;var a="https://ups.analytics.yahoo.com/ups/".concat(t,"/fed"),u=b(b(b({he:r},void 0!==n?{gdpr:n}:{}),void 0!==o?{gdpr_consent:o}:{}),void 0!==c?{"1p":c}:{});y(a,u,(function(e){e&&p(r,b(b({},i),{},{connectId:{value:e.vmuid,lastUpdated:(new Date).toISOString()}}))}))}},v.syncIds=function(e){e.hashedEmail&&v.syncHashedEmail(e)};var g=v;function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var h=function(e,t){var r=e.pixelId,n=e.email,o=e.gdpr,i=e.gdprConsent,a=e.vm1p,u=n||d();r&&u?function(e,t){e.indexOf("@")<0?t(e):c(e,t)}(u,(function(e){l(e),g.syncIds(m(m(m(m({pixelId:r},e?{hashedEmail:e}:{}),void 0!==o?{gdpr:o}:{}),void 0!==i?{gdprConsent:i}:{}),void 0!==a?{vm1p:a}:{}));var n=f(e),c=n.connectId?n.connectId.value:void 0;t(c?{connectId:c}:{})})):t({})};t.default={getIds:h};"undefined"!=typeof exports&&(exports.getIds=h)}]); | ||
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),c=function(e,t){if("string"==typeof e&&e)if(window.crypto&&crypto.subtle&&crypto.subtle.digest){var r=new TextEncoder("utf-8").encode(e.trim().toLowerCase());crypto.subtle.digest("SHA-256",r).then((function(e){var r=Array.from(new Uint8Array(e));t(r.map((function(e){return("00"+e.toString(16)).slice(-2)})).join(""))}))}else t("");else t("")};function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var a=function(){var e={};try{e=JSON.parse(localStorage.getItem("vm-connectid"))||{}}catch(e){}return e},s=function(e){try{localStorage.setItem("vm-connectid",JSON.stringify(e))}catch(e){}},p=function(e){return u({},a()[e]||{})},f=function(e,t){var r=u(u({},a()),{},o()({},e,t));s(r)},d=function(){return a().mostRecentHashedEmail},l=function(e){var t=u(u({},a()),{},{mostRecentHashedEmail:e});s(t)},y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=new XMLHttpRequest,o=Object.keys(t).map((function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])})).join("&");n.onreadystatechange=function(e){if(n.readyState===XMLHttpRequest.DONE)if(0===n.status||n.status>=200&&n.status<400)try{r(JSON.parse(n.responseText))}catch(e){r()}else r()};try{n.withCredentials=!0,n.open("GET","".concat(e,"?").concat(o),!0),n.send(t)}catch(e){}};function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var v={};v.syncHashedEmail=function(e){var t=e.pixelId,r=e.hashedEmail,n=e.gdpr,o=e.gdprConsent,c=e.usPrivacy,i=e.vm1p;if(t&&r){var u=p(r);if(u.connectid)if(function(e){if(!e)return!1;return(new Date-new Date(e))/36e5<360}(u.connectid.lastUpdated))return;var a="https://ups.analytics.yahoo.com/ups/".concat(t,"/fed"),s=b(b(b(b({he:r},void 0!==n?{gdpr:n}:{}),void 0!==o?{gdpr_consent:o}:{}),void 0!==c?{us_privacy:c}:{}),void 0!==i?{"1p":i}:{});y(a,s,(function(e){e&&f(r,b(b({},u),{},{connectid:{value:e.vmuid||e.connectid,lastUpdated:(new Date).toISOString()}}))}))}},v.syncIds=function(e){e.hashedEmail&&v.syncHashedEmail(e)};var g=v;function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var h=function(e,t){var r=e.pixelId,n=e.email,o=e.gdpr,i=e.gdprConsent,u=e.usPrivacy,a=e.vm1p,s=n||d();r&&s?function(e,t){e.indexOf("@")<0?t(e):c(e,t)}(s,(function(e){l(e),g.syncIds(m(m(m(m(m({pixelId:r},e?{hashedEmail:e}:{}),void 0!==o?{gdpr:o}:{}),void 0!==i?{gdprConsent:i}:{}),void 0!==u?{usPrivacy:u}:{}),void 0!==a?{vm1p:a}:{}));var n=p(e),c=n.connectid?n.connectid.value:void 0;t(c?{connectid:c}:{})})):t({})};t.default={getIds:h};"undefined"!=typeof exports&&(exports.getIds=h)}]); |
{ | ||
"name": "@vzm/verizon-media-connectid", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Sync hashed emails to a Verizon Media ConnectID and other user identifiers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,6 +24,7 @@ /* Copyright Verizon Media, Licensed under the terms of the Apache 2.0 license. See LICENSE file in project root for terms. */ | ||
* @param {number} pixelId - (required) publisher specific pixel id | ||
* @param {string?} email - (required) A raw or hashed email. An email is determined to be raw if it contains | ||
* an "@" character. | ||
* @param {string?} email - (optional) A raw or hashed email. An email is determined to be raw if it contains | ||
* an "@" character. If no email is provided, the most recently provided email will be used. | ||
* @param {boolean} gdpr - (required) true if GDPR applies, otherwise false | ||
* @param {string?} gdprConsent - (optional) GDPR consent string. Only required when GDPR applies | ||
* @param {string?} usPrivacy - (optional) | ||
* @param {boolean} vm1p - true if used in a Verizon Media O&O page, otherwise false | ||
@@ -38,2 +39,3 @@ * @param {Function} callback - (required) | ||
gdprConsent, | ||
usPrivacy, | ||
vm1p, | ||
@@ -61,2 +63,3 @@ }, | ||
...gdprConsent !== undefined ? {gdprConsent} : {}, | ||
...usPrivacy !== undefined ? {usPrivacy} : {}, | ||
...vm1p !== undefined ? {vm1p} : {}, | ||
@@ -63,0 +66,0 @@ }); |
@@ -33,2 +33,3 @@ /* Copyright Verizon Media, Licensed under the terms of the Apache 2.0 license. See LICENSE file in project root for terms. */ | ||
* @param {string?} gdprConsent - (optional) GDPR consent string. Required if GDPR applies. | ||
* @param {string?} usPrivacy - (optional) | ||
* @param {boolean} vm1p - true if used in a Verizon Media O&O page, otherwise false | ||
@@ -41,2 +42,3 @@ */ | ||
gdprConsent, | ||
usPrivacy, | ||
vm1p, | ||
@@ -64,2 +66,3 @@ }) => { | ||
...gdprConsent !== undefined ? {gdpr_consent: gdprConsent} : {}, | ||
...usPrivacy !== undefined ? {us_privacy: usPrivacy} : {}, | ||
...vm1p !== undefined ? {'1p': vm1p} : {}, | ||
@@ -66,0 +69,0 @@ }; |
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
37494
286