prebid-universal-creative 1.17.2 → 1.18.0
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.
- package/.circleci/config.yml +1 -1
- package/README.md +74 -7
- package/browsers.json +12 -12
- package/dist/amp.js +3 -3
- package/dist/banner.js +3 -3
- package/dist/creative.js +3 -3
- package/dist/load-cookie-with-consent.html +1 -1
- package/dist/load-cookie.html +1 -1
- package/dist/{2088600fa2b5f5e3c29c.max.js → main.max.js} +403 -371
- package/dist/mobile.js +3 -3
- package/dist/native-render.js +3 -3
- package/dist/native-trk.js +3 -3
- package/dist/native.js +3 -3
- package/dist/uid.js +3 -3
- package/dist/video.js +3 -3
- package/gulpfile.js +35 -11
- package/karma.conf.maker.js +22 -10
- package/package.json +15 -16
- package/src/cookieSync.js +2 -0
- package/src/cookieSyncWithConsent.js +2 -0
- package/src/mobileAndAmpRender.js +2 -2
- package/src/nativeAssetManager.js +1 -1
- package/src/nativeORTBTrackerManager.js +0 -2
- package/src/nativeTrackerManager.js +1 -1
- package/src/postscribeRender.js +63 -2
- package/src/renderingManager.js +1 -1
- package/test/spec/mobileAndAmpRender_spec.js +86 -93
- package/test/spec/nativeAssetManager_spec.js +20 -8
- package/test/spec/nativeORTBTrackerManager_spec.js +2 -2
- package/test/spec/nativeTrackerManager_spec.js +3 -8
- package/test/spec/renderingManager_spec.js +4 -24
- package/test/spec/uid_spec.js +10 -29
- package/test/test_index.js +1 -1
- package/webpack.conf.js +12 -15
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<title>Document</title>
|
|
8
8
|
<script type="text/javascript">
|
|
9
9
|
// cookie-sync start
|
|
10
|
-
!function(
|
|
10
|
+
!function(){"use strict";var r=[,function(e,t){function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)!{}.hasOwnProperty.call(n,r)||(e[r]=n[r])}return e}).apply(null,arguments)}function o(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=e.createElement("iframe");return Object.entries(n({frameborder:0,scrolling:"no",marginheight:0,marginwidth:0,TOPMARGIN:0,LEFTMARGIN:0,allowtransparency:"true"},t)).forEach(function(e){var t=a(e,2),n=t[0],r=t[1];o.setAttribute(n,r)}),o}Object.defineProperty(t,"__esModule",{value:!0}),t.getEmptyIframe=function(e,t){return o(document,{height:e,width:t})},t.insertElement=function(e,t,n){var r;t=t||document,r=n?t.getElementsByTagName(n):t.getElementsByTagName("head");try{(r=r.length?r:t.getElementsByTagName("body")).length&&(r=r[0]).insertBefore(e,r.firstChild)}catch(e){}},t.makeIframe=o}],o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,a),n.exports}var i,e,t,n,c,s,u,l,f,d,p,y,m,g,h,v,b,w,x;function S(e,t){if("function"==typeof WeakMap)var i=new WeakMap,c=new WeakMap;return(S=function(e,t){if(!t&&e&&e.__esModule)return e;var n,r,o={__proto__:null,default:e};if(null===e||"object"!=O(e)&&"function"!=typeof e)return o;if(n=t?c:i){if(n.has(e))return n.get(e);n.set(e,o)}for(var a in e)"default"!==a&&{}.hasOwnProperty.call(e,a)&&((r=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,a))&&(r.get||r.set)?n(o,a,r):o[a]=e[a]);return o})(e,t)}function _(){return(_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)!{}.hasOwnProperty.call(n,r)||(e[r]=n[r])}return e}).apply(null,arguments)}function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function I(e){return new RegExp(/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i).test(e)}function E(e,t,n,r){t&&I(t)?"image"===e||"redirect"===e?(console.log('Invoking image pixel user sync for bidder: "'.concat(n,'"')),function(e,t){var n=new Image;n.addEventListener("load",t),n.addEventListener("error",t),n.src=e}(t,r)):"iframe"==e?(console.log('Invoking iframe pixel user sync for bidder: "'.concat(n,'"')),function(e,t,n){if(!e)return;var r=i.getEmptyIframe(0,0);r.id="sync_".concat(t,"_").concat(Date.now()),r.src=e,r.onload=n,i.insertElement(r,document,"html")}(t,n,r)):(console.log('User sync type "'.concat(e,'" not supported for bidder: "').concat(n,'"')),r()):(console.log('No valid sync url for bidder "'.concat(n,'": ').concat(t)),r())}function j(e){var t=JSON.parse(e);"ok"!==t.status&&"no_cookie"!==t.status||t.bidder_status&&!function e(t){if(0!==t.length){var n=t.pop();n.no_cookie?E(n.usersync.type,n.usersync.url,n.bidder,e.bind(null,t)):e(t)}}(t.bidder_status)}function T(e,t){var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))}function M(e){var t=e&&"object"===O(e)?e:{};return t.limit=p,t.coopSync=m,l&&(t.filterSettings={iframe:{bidders:"*",filter:"exclude"}}),f&&(t.bidders=f),v&&(t.account=v),t=function(e){return b.consentMetadata&&(b.consentMetadata.gdprApplies?(e.gdpr=1,e.gdpr_consent=b.consentString||""):e.gdpr=0),e}(t),JSON.stringify(t)}function k(){w=!0,function(e,t,n,r){var o=3<arguments.length&&void 0!==r?r:{};try{var a,i=o.method||(n?"POST":"GET"),c="object"===O(t)?t:{success:function(){console.log("xhr success")},error:function(e){console.log("xhr error",null,e)}};if("function"==typeof t&&(c.success=t),(a=new window.XMLHttpRequest).onreadystatechange=function(){if(4===a.readyState){var e=a.status;200<=e&&e<300||304===e?c.success(a.responseText,a):c.error(a.statusText,a)}},a.ontimeout=function(){console.log("xhr timeout after ",a.timeout,"ms")},"GET"===i&&n){var s=parseURL(e,o);_(s.search,n),e=formatURL(s)}a.open(i,e),a.timeout=3e3,o.withCredentials&&(a.withCredentials=!0),o.preflight&&a.setRequestHeader("X-Requested-With","XMLHttpRequest"),a.setRequestHeader("Content-Type",o.contentType||"text/plain"),"POST"===i&&n?a.send(n):a.send()}catch(e){console.log("xhr construction",e)}}(s,j,M(u),{withCredentials:!0})}i=S(a(1)),c={rubicon:"https://prebid-server.rubiconproject.com/cookie_sync",appnexus:"https://prebid.adnxs.com/pbs/v1/cookie_sync"},s=function(e){var t="https://prebid.adnxs.com/pbs/v1/cookie_sync";if(!e)return t;var n=c[e]||decodeURIComponent(e)||"";return I(n)?n:t}(T("endpoint",window.location.search)),u=function(e){if(e){var t=e.split(",").reduce(function(e,t){var n=t.split(":");return 2===n.length&&""!==n[0]&&""!==n[1]&&(e[n[0]]=/^\d+$/.test(n[1])?parseInt(n[1]):n[1]),e},{});return t&&Object.keys(t).length?t:void 0}}(T("args",window.location.search)),l=(e=T("source",window.location.search))&&"amp"===e.toLowerCase(),f=function(e){if(e){var t=e.split(",").filter(function(e){return!!e});if(0<t.length)return t}}(T("bidders",window.location.search)),d=T("max_sync_count",window.location.search),p=function(e){if(isNaN(e)||e<0)return 9007199254740991;return e}(parseInt(d||10,10)),y=T("coop_sync",window.location.search),m=!y||"true"===y||!!parseInt(y),t=parseInt(T("timeout",window.location.search),10),g=isNaN(t)||t!==parseInt(t,10)?1e4:t,h=0!==(n=parseInt(T("defaultGdprScope",window.location.search),10))&&1!==n?1:n,v=T("account",window.location.search),w=!(b={}),x=setTimeout(function(){w||(h||k(),console.log("Message listener timed out. No consent data was returned."))},g),window.addEventListener("message",function(e){"consent-data"===e.data.type&&(b=e.data,clearTimeout(x),w||k())},!1),window.parent.postMessage({sentinel:"amp",type:"send-consent-data"},"*")}();
|
|
11
11
|
// end.
|
|
12
12
|
</script>
|
|
13
13
|
</head>
|
package/dist/load-cookie.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<title>Document</title>
|
|
8
8
|
<script type="text/javascript">
|
|
9
9
|
// cookie-sync start
|
|
10
|
-
!function(
|
|
10
|
+
!function(){"use strict";var r=[,function(e,t){function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)!{}.hasOwnProperty.call(n,r)||(e[r]=n[r])}return e}).apply(null,arguments)}function o(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=e.createElement("iframe");return Object.entries(n({frameborder:0,scrolling:"no",marginheight:0,marginwidth:0,TOPMARGIN:0,LEFTMARGIN:0,allowtransparency:"true"},t)).forEach(function(e){var t=i(e,2),n=t[0],r=t[1];o.setAttribute(n,r)}),o}Object.defineProperty(t,"__esModule",{value:!0}),t.getEmptyIframe=function(e,t){return o(document,{height:e,width:t})},t.insertElement=function(e,t,n){var r;t=t||document,r=n?t.getElementsByTagName(n):t.getElementsByTagName("head");try{(r=r.length?r:t.getElementsByTagName("body")).length&&(r=r[0]).insertBefore(e,r.firstChild)}catch(e){}},t.makeIframe=o}],o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,i),n.exports}var a,e,t,n,c,s,u,l,f,d,p,y,g,m,h,b;function v(e,t){if("function"==typeof WeakMap)var a=new WeakMap,c=new WeakMap;return(v=function(e,t){if(!t&&e&&e.__esModule)return e;var n,r,o={__proto__:null,default:e};if(null===e||"object"!=_(e)&&"function"!=typeof e)return o;if(n=t?c:a){if(n.has(e))return n.get(e);n.set(e,o)}for(var i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((r=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,i))&&(r.get||r.set)?n(o,i,r):o[i]=e[i]);return o})(e,t)}function w(){return(w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)!{}.hasOwnProperty.call(n,r)||(e[r]=n[r])}return e}).apply(null,arguments)}function _(e){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function x(e){return new RegExp(/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i).test(e)}function O(e,t,n,r){t&&x(t)?"image"===e||"redirect"===e?(console.log('Invoking image pixel user sync for bidder: "'.concat(n,'"')),function(e,t){var n=new Image;n.addEventListener("load",t),n.addEventListener("error",t),n.src=e}(t,r)):"iframe"==e?(console.log('Invoking iframe pixel user sync for bidder: "'.concat(n,'"')),function(e,t,n){if(!e)return;var r=a.getEmptyIframe(0,0);r.id="sync_".concat(t,"_").concat(Date.now()),r.src=e,r.onload=n,a.insertElement(r,document,"html")}(t,n,r)):(console.log('User sync type "'.concat(e,'" not supported for bidder: "').concat(n,'"')),r()):(console.log('No valid sync url for bidder "'.concat(n,'": ').concat(t)),r())}function S(e,t){var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))}a=v(i(1)),c={rubicon:"https://prebid-server.rubiconproject.com/cookie_sync",appnexus:"https://prebid.adnxs.com/pbs/v1/cookie_sync"},s=function(e){var t="https://prebid.adnxs.com/pbs/v1/cookie_sync";if(!e)return t;var n=c[e]||decodeURIComponent(e)||"";return x(n)?n:t}(S("endpoint",window.location.search)),u=function(e){if(e){var t=e.split(",").reduce(function(e,t){var n=t.split(":");return 2===n.length&&""!==n[0]&&""!==n[1]&&(e[n[0]]=/^\d+$/.test(n[1])?parseInt(n[1]):n[1]),e},{});return t&&Object.keys(t).length?t:void 0}}(S("args",window.location.search)),l=function(e){if(e){var t=e.split(",").filter(function(e){return!!e});if(0<t.length)return t}}(S("bidders",window.location.search)),f=(e=S("source",window.location.search))&&"amp"===e.toLowerCase(),d=S("max_sync_count",window.location.search),p=function(e){if(isNaN(e)||e<0)return 9007199254740991;return e}(parseInt(d||10,10)),y=S("coop_sync",window.location.search),g=!y||"true"===y||!!parseInt(y),m=function(e){if(0===e||1===e)return e;console.log("Ignoring gdpr param, it should be 1 or 0")}(parseInt(S("gdpr",window.location.search),10)),h=function(e){if(e)return e;console.log("Ignoring gdpr_consent param, it should be a non empty value")}(S("gdpr_consent",window.location.search)),b=S("account",window.location.search),function(e,t,n,r){var o=3<arguments.length&&void 0!==r?r:{};try{var i,a=o.method||(n?"POST":"GET"),c="object"===_(t)?t:{success:function(){console.log("xhr success")},error:function(e){console.log("xhr error",null,e)}};if("function"==typeof t&&(c.success=t),(i=new window.XMLHttpRequest).onreadystatechange=function(){if(4===i.readyState){var e=i.status;200<=e&&e<300||304===e?c.success(i.responseText,i):c.error(i.statusText,i)}},i.ontimeout=function(){console.log("xhr timeout after ",i.timeout,"ms")},"GET"===a&&n){var s=parseURL(e,o);w(s.search,n),e=formatURL(s)}i.open(a,e),i.timeout=3e3,o.withCredentials&&(i.withCredentials=!0),o.preflight&&i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.setRequestHeader("Content-Type",o.contentType||"text/plain"),"POST"===a&&n?i.send(n):i.send()}catch(e){console.log("xhr construction",e)}}(s,function(e){var t=JSON.parse(e);"ok"!==t.status&&"no_cookie"!==t.status||t.bidder_status&&!function e(t){if(0!==t.length){var n=t.pop();n.no_cookie?O(n.usersync.type,n.usersync.url,n.bidder,e.bind(null,t)):e(t)}}(t.bidder_status)},((n=(t=u)&&"object"===_(t)?t:{}).limit=p,n.coopSync=g,m&&(n.gdpr=m),h&&(n.gdpr_consent=h),f&&(n.filterSettings={iframe:{bidders:"*",filter:"exclude"}}),l&&(n.bidders=l),b&&(n.account=b),JSON.stringify(n)),{withCredentials:!0})}();
|
|
11
11
|
// end.
|
|
12
12
|
</script>
|
|
13
13
|
</head>
|