prebid-universal-creative 1.17.0 → 1.17.1
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/dist/{caf7688498213fb0c19f.max.js → 0df2612ebfffd5ad651a.max.js} +6 -2
- package/dist/amp.js +3 -3
- package/dist/banner.js +2 -2
- package/dist/creative.js +3 -3
- package/dist/mobile.js +3 -3
- package/dist/native-render.js +2 -2
- package/dist/native-trk.js +2 -2
- package/dist/native.js +2 -2
- package/dist/uid.js +2 -2
- package/dist/video.js +2 -2
- package/package.json +1 -1
- package/src/adHtmlRender.js +7 -3
- package/test/spec/mobileAndAmpRender_spec.js +13 -2
@@ -1031,12 +1031,16 @@ function registerMRAIDViewableEvent(callback) {
|
|
1031
1031
|
"use strict";
|
1032
1032
|
/* harmony export (immutable) */ __webpack_exports__["a"] = writeAdHtml;
|
1033
1033
|
function writeAdHtml(markup) {
|
1034
|
-
var insertHTML = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
1034
|
+
var insertHTML = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : appendToBody;
|
1035
1035
|
// remove <?xml> and <!doctype> tags
|
1036
1036
|
// https://github.com/prebid/prebid-universal-creative/issues/134
|
1037
1037
|
markup = markup.replace(/\<(\?xml|(\!DOCTYPE[^\>\[]+(\[[^\]]+)?))+[^>]+\>/gi, '');
|
1038
|
+
insertHTML(markup);
|
1039
|
+
}
|
1040
|
+
function appendToBody(html) {
|
1038
1041
|
try {
|
1039
|
-
|
1042
|
+
var fragment = document.createRange().createContextualFragment(html);
|
1043
|
+
document.body.append(fragment);
|
1040
1044
|
} catch (error) {
|
1041
1045
|
console.error(error);
|
1042
1046
|
}
|
package/dist/amp.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* prebid-universal-creative v1.17.
|
2
|
-
Updated : 2025-03-
|
3
|
-
!function(n){var r={};function i(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=n,i.c=r,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1)}([function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}t.a=function(e,t){return function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=e.createElement("iframe");return Object.entries(r({frameborder:0,scrolling:"no",marginheight:0,marginwidth:0,TOPMARGIN:0,LEFTMARGIN:0,allowtransparency:"true"},t)).forEach(function(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}(e,2),n=t[0],r=t[1];i.setAttribute(n,r)}),i}(document,{height:e,width:t})},t.b=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){}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);window.ucTag=window.ucTag||{},window.ucTag.renderAd=function(e,t){Object(r.a)(t)}},function(e,t,n){"use strict";t.a=function(e){var t=Object(f.g)(e),n=t.cacheHost,r=t.cachePath,i=t.uuid,o=t.size,a=t.hbPb,c="Prebid_";if((i=i||"").substr(0,c.length)===c)!function(e){var t=window.localStorage.getItem(e);p(!0)(t)}(i),g(o);else{var u="".concat(function(e,t){var n=void 0===t||""===t?b:t;return"https://".concat(void 0===e||""===e?s:e).concat(n)}(n,r),"?uuid=").concat(i);g(o),Object(f.f)(u,p(Object(d.a)(t.env),a))}};var f=n(3),d=n(4),l=n(0),h=n(5),s="prebid.adnxs.com",b="/pbc/v1/cache";function g(e){if(e){var t=e.split("x").map(Number);!function(r,i){var o=window.innerWidth,a=window.innerHeight;if(o!==r||a!==i){if(Object(d.b)(window)){window.$sf.ext.register(r,i,function(e){var t=r-o,n=i-a;window.$sf.ext.expand({r:t,b:n,push:!0})})}window.parent.postMessage({sentinel:"amp",type:"embed-size",width:r,height:i},"*")}}(t[0],t[1])}else console.log("Targeting key hb_size not found to resize creative")}function p(d,s){return function(e){var t=function(e){var t;try{t=JSON.parse(e)}catch(e){console.log("Error parsing response from cache host: ".concat(e))}return t}(e),n=t.price||s,r=Object(f.c)(t),i=t.width?t.width:t.w,o=t.height?t.height:t.h;if(t.wurl&&Object(f.h)(decodeURIComponent(t.wurl)),t.adm){if(t.adm=n?t.adm.replace("${AUCTION_PRICE}",n):t.adm.replace("${AUCTION_PRICE}",""),r+=d?v(t.adm,i,o):t.adm,t.nurl&&(r+=Object(f.a)(decodeURIComponent(t.nurl))),t.burl){var a=function(){Object(f.h)(t.burl)};if(d)Object(f.e)(window,"mraid.js",function(){!function(t){function n(e){0<e&&(mraid.removeEventListener("exposureChange",n),t())}function r(e){e&&(mraid.removeEventListener("viewableChange",r),t())}function i(){window.MRAID_ENV&&3<=parseFloat(window.MRAID_ENV.version)?mraid.addEventListener("exposureChange",n):window.MRAID_ENV&&parseFloat(window.MRAID_ENV.version)<3&&(mraid.isViewable()?t():mraid.addEventListener("viewableChange",r))}return!(!window.mraid||!window.MRAID_ENV)&&("loading"==mraid.getState()?mraid.addEventListener("ready",function e(){mraid.removeEventListener("ready",e),i()}):i(),!0)}(a)&&a()},a);else a()}Object(h.a)(r)}else if(t.nurl)if(d){r+=v(Object(f.e)(window,t.nurl).outerHTML,i,o),Object(h.a)(r)}else{var c=t.nurl,u=Object(f.b)(t);Object(l.b)(u,document,"body"),Object(f.i)(c,i,o)}}}function v(e,t,n){var r=Object(f.d)();return'<div id="'.concat(r,'" style="border-style: none; position: absolute; width:100%; height:100%;">\n <div id="').concat(r,'_inner" style="margin: 0 auto; width:').concat(t,"px; height:").concat(n,'px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">').concat(e,"</div>\n </div>")}},function(e,t,n){"use strict";t.h=function(e,t){var n=new Image;t&&"function"==typeof t&&(n.addEventListener("load",t),n.addEventListener("error",t));n.src=e},t.a=function(e){if(!e)return"";var t=encodeURI(e);return'<div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="'.concat(t,'"></div>')},t.i=function(e,t,n){var r=i.a(n,t);r.src=e,document.body.appendChild(r)},t.f=function(e,t){var n=new XMLHttpRequest;n.addEventListener("load",function(){t(n.responseText)}),n.open("GET",e),n.send()},t.d=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===e?t:3&t|8).toString(16)})},t.e=function(e,t,n,r){var i=e.document,o=i.createElement("script");o.type="text/javascript",n&&"function"==typeof n&&(o.readyState?o.onreadystatechange=function(){"loaded"!==o.readyState&&"complete"!==o.readyState||(o.onreadystatechange=null,n())}:o.onload=function(){n()});r&&"function"==typeof r&&(o.onerror=function(){r()});o.src=t;var a=i.getElementsByTagName("head");(a=a.length?a:i.getElementsByTagName("body")).length&&(a=a[0]).insertBefore(o,a.firstChild);return o},t.b=r,t.c=function(e){var t=r(e),n=document.createElement("div");return n.appendChild(t),n.innerHTML},t.g=function(t){var n={hb_adid:"adId",hb_cache_host:"cacheHost",hb_cache_path:"cachePath",hb_cache_id:"uuid",hb_format:"mediaType",hb_env:"env",hb_size:"size",hb_pb:"hbPb"};function e(e){return!(!t[e]||!(function(e){return o(e,"Object")}(t[e])&&0<Object.keys(t[e]).length||a(t[e])&&""!==t[e]))}var r={},i={};e("targetingMap")?i=function(t){var n={};return Object.keys(t).forEach(function(e){Array.isArray(t[e])&&0<t[e].length&&(n[e]=t[e][0])}),n}(t.targetingMap):e("targetingKeywords")&&(i=function(e){var i={},t=e.split(",");return 0<t.length&&t.forEach(function(e){var t=e.split(":");if(2===t.length){var n=t[0],r=t[1];i[n]=r}}),i}(t.targetingKeywords));return function(t){Object.keys(t).forEach(function(e){r[n[e]||e]=t[e]})}(i),Object.keys(t).forEach(function(e){"targetingMap"!==e&&"targetingKeywords"!==e&&a(t[e])&&""!==t[e]&&(r[e]=t[e])}),r};var i=n(0);function r(e){return document.createComment("Creative ".concat(e.crid," served by Prebid.js Header Bidding"))}function o(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function a(e){return o(e,"String")}},function(e,t,n){"use strict";t.b=function(e){return!(!e.$sf||!e.$sf.ext)},t.a=function(e){return e&&"mobile-app"===e}},function(e,t,n){"use strict";t.a=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:
|
1
|
+
/* prebid-universal-creative v1.17.1
|
2
|
+
Updated : 2025-03-19 */
|
3
|
+
!function(n){var r={};function i(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=n,i.c=r,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1)}([function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}t.a=function(e,t){return function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=e.createElement("iframe");return Object.entries(r({frameborder:0,scrolling:"no",marginheight:0,marginwidth:0,TOPMARGIN:0,LEFTMARGIN:0,allowtransparency:"true"},t)).forEach(function(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}(e,2),n=t[0],r=t[1];i.setAttribute(n,r)}),i}(document,{height:e,width:t})},t.b=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){}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);window.ucTag=window.ucTag||{},window.ucTag.renderAd=function(e,t){Object(r.a)(t)}},function(e,t,n){"use strict";t.a=function(e){var t=Object(f.g)(e),n=t.cacheHost,r=t.cachePath,i=t.uuid,o=t.size,a=t.hbPb,c="Prebid_";if((i=i||"").substr(0,c.length)===c)!function(e){var t=window.localStorage.getItem(e);p(!0)(t)}(i),g(o);else{var u="".concat(function(e,t){var n=void 0===t||""===t?b:t;return"https://".concat(void 0===e||""===e?s:e).concat(n)}(n,r),"?uuid=").concat(i);g(o),Object(f.f)(u,p(Object(d.a)(t.env),a))}};var f=n(3),d=n(4),l=n(0),h=n(5),s="prebid.adnxs.com",b="/pbc/v1/cache";function g(e){if(e){var t=e.split("x").map(Number);!function(r,i){var o=window.innerWidth,a=window.innerHeight;if(o!==r||a!==i){if(Object(d.b)(window)){window.$sf.ext.register(r,i,function(e){var t=r-o,n=i-a;window.$sf.ext.expand({r:t,b:n,push:!0})})}window.parent.postMessage({sentinel:"amp",type:"embed-size",width:r,height:i},"*")}}(t[0],t[1])}else console.log("Targeting key hb_size not found to resize creative")}function p(d,s){return function(e){var t=function(e){var t;try{t=JSON.parse(e)}catch(e){console.log("Error parsing response from cache host: ".concat(e))}return t}(e),n=t.price||s,r=Object(f.c)(t),i=t.width?t.width:t.w,o=t.height?t.height:t.h;if(t.wurl&&Object(f.h)(decodeURIComponent(t.wurl)),t.adm){if(t.adm=n?t.adm.replace("${AUCTION_PRICE}",n):t.adm.replace("${AUCTION_PRICE}",""),r+=d?v(t.adm,i,o):t.adm,t.nurl&&(r+=Object(f.a)(decodeURIComponent(t.nurl))),t.burl){var a=function(){Object(f.h)(t.burl)};if(d)Object(f.e)(window,"mraid.js",function(){!function(t){function n(e){0<e&&(mraid.removeEventListener("exposureChange",n),t())}function r(e){e&&(mraid.removeEventListener("viewableChange",r),t())}function i(){window.MRAID_ENV&&3<=parseFloat(window.MRAID_ENV.version)?mraid.addEventListener("exposureChange",n):window.MRAID_ENV&&parseFloat(window.MRAID_ENV.version)<3&&(mraid.isViewable()?t():mraid.addEventListener("viewableChange",r))}return!(!window.mraid||!window.MRAID_ENV)&&("loading"==mraid.getState()?mraid.addEventListener("ready",function e(){mraid.removeEventListener("ready",e),i()}):i(),!0)}(a)&&a()},a);else a()}Object(h.a)(r)}else if(t.nurl)if(d){r+=v(Object(f.e)(window,t.nurl).outerHTML,i,o),Object(h.a)(r)}else{var c=t.nurl,u=Object(f.b)(t);Object(l.b)(u,document,"body"),Object(f.i)(c,i,o)}}}function v(e,t,n){var r=Object(f.d)();return'<div id="'.concat(r,'" style="border-style: none; position: absolute; width:100%; height:100%;">\n <div id="').concat(r,'_inner" style="margin: 0 auto; width:').concat(t,"px; height:").concat(n,'px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">').concat(e,"</div>\n </div>")}},function(e,t,n){"use strict";t.h=function(e,t){var n=new Image;t&&"function"==typeof t&&(n.addEventListener("load",t),n.addEventListener("error",t));n.src=e},t.a=function(e){if(!e)return"";var t=encodeURI(e);return'<div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="'.concat(t,'"></div>')},t.i=function(e,t,n){var r=i.a(n,t);r.src=e,document.body.appendChild(r)},t.f=function(e,t){var n=new XMLHttpRequest;n.addEventListener("load",function(){t(n.responseText)}),n.open("GET",e),n.send()},t.d=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===e?t:3&t|8).toString(16)})},t.e=function(e,t,n,r){var i=e.document,o=i.createElement("script");o.type="text/javascript",n&&"function"==typeof n&&(o.readyState?o.onreadystatechange=function(){"loaded"!==o.readyState&&"complete"!==o.readyState||(o.onreadystatechange=null,n())}:o.onload=function(){n()});r&&"function"==typeof r&&(o.onerror=function(){r()});o.src=t;var a=i.getElementsByTagName("head");(a=a.length?a:i.getElementsByTagName("body")).length&&(a=a[0]).insertBefore(o,a.firstChild);return o},t.b=r,t.c=function(e){var t=r(e),n=document.createElement("div");return n.appendChild(t),n.innerHTML},t.g=function(t){var n={hb_adid:"adId",hb_cache_host:"cacheHost",hb_cache_path:"cachePath",hb_cache_id:"uuid",hb_format:"mediaType",hb_env:"env",hb_size:"size",hb_pb:"hbPb"};function e(e){return!(!t[e]||!(function(e){return o(e,"Object")}(t[e])&&0<Object.keys(t[e]).length||a(t[e])&&""!==t[e]))}var r={},i={};e("targetingMap")?i=function(t){var n={};return Object.keys(t).forEach(function(e){Array.isArray(t[e])&&0<t[e].length&&(n[e]=t[e][0])}),n}(t.targetingMap):e("targetingKeywords")&&(i=function(e){var i={},t=e.split(",");return 0<t.length&&t.forEach(function(e){var t=e.split(":");if(2===t.length){var n=t[0],r=t[1];i[n]=r}}),i}(t.targetingKeywords));return function(t){Object.keys(t).forEach(function(e){r[n[e]||e]=t[e]})}(i),Object.keys(t).forEach(function(e){"targetingMap"!==e&&"targetingKeywords"!==e&&a(t[e])&&""!==t[e]&&(r[e]=t[e])}),r};var i=n(0);function r(e){return document.createComment("Creative ".concat(e.crid," served by Prebid.js Header Bidding"))}function o(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function a(e){return o(e,"String")}},function(e,t,n){"use strict";t.b=function(e){return!(!e.$sf||!e.$sf.ext)},t.a=function(e){return e&&"mobile-app"===e}},function(e,t,n){"use strict";function r(e){try{var t=document.createRange().createContextualFragment(e);document.body.append(t)}catch(e){console.error(e)}}t.a=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:r;e=e.replace(/\<(\?xml|(\!DOCTYPE[^\>\[]+(\[[^\]]+)?))+[^>]+\>/gi,""),t(e)}}]);
|
package/dist/banner.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* prebid-universal-creative v1.17.
|
2
|
-
Updated : 2025-03-
|
1
|
+
/* prebid-universal-creative v1.17.1
|
2
|
+
Updated : 2025-03-19 */
|
3
3
|
!function(t){var r={};function o(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=t,o.c=r,o.d=function(e,n,t){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="",o(o.s=3)}([function(e,n,t){"use strict";function a(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var t=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return t}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function r(){return(r=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function o(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=e.createElement("iframe");return Object.entries(r({frameborder:0,scrolling:"no",marginheight:0,marginwidth:0,TOPMARGIN:0,LEFTMARGIN:0,allowtransparency:"true"},n)).forEach(function(e){var n=a(e,2),t=n[0],r=n[1];o.setAttribute(t,r)}),o}n.c=o,n.a=function(e,n){return o(document,{height:e,width:n})},n.b=function(e,n,t){var r;n=n||document,r=t?n.getElementsByTagName(t):n.getElementsByTagName("head");try{(r=r.length?r:n.getElementsByTagName("body")).length&&(r=r[0]).insertBefore(e,r.firstChild)}catch(e){}}},function(e,n,t){"use strict";n.b=function(n){var t={hb_adid:"adId",hb_cache_host:"cacheHost",hb_cache_path:"cachePath",hb_cache_id:"uuid",hb_format:"mediaType",hb_env:"env",hb_size:"size",hb_pb:"hbPb"};function e(e){return!(!n[e]||!(function(e){return a(e,"Object")}(n[e])&&0<Object.keys(n[e]).length||i(n[e])&&""!==n[e]))}var r={},o={};e("targetingMap")?o=function(n){var t={};return Object.keys(n).forEach(function(e){Array.isArray(n[e])&&0<n[e].length&&(t[e]=n[e][0])}),t}(n.targetingMap):e("targetingKeywords")&&(o=function(e){var o={},n=e.split(",");return 0<n.length&&n.forEach(function(e){var n=e.split(":");if(2===n.length){var t=n[0],r=n[1];o[t]=r}}),o}(n.targetingKeywords));return function(n){Object.keys(n).forEach(function(e){r[t[e]||e]=n[e]})}(o),Object.keys(n).forEach(function(e){"targetingMap"!==e&&"targetingKeywords"!==e&&i(n[e])&&""!==n[e]&&(r[e]=n[e])}),r},n.a=function(e){var n=document.createElement("a");return n.href=decodeURIComponent(e),{href:n.href,protocol:(n.protocol||"").replace(/:$/,""),hostname:n.hostname,port:+n.port,pathname:n.pathname.replace(/^(?!\/)/,"/"),hash:(n.hash||"").replace(/^#/,""),host:(n.host||window.location.host).replace(/:(443|80)$/,"")}};t(0);function a(e,n){return Object.prototype.toString.call(e)==="[object "+n+"]"}function i(e){return a(e,"String")}},function(e,n,t){"use strict";n.a=function(n){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:window,i=function(){if(null==n)return null;var e=Object(r.a)(n);return e.protocol+"://"+e.host}();function e(e){return e&&e.frames&&e.frames.__pb_locator__}var c=a.parent;try{for(;null!=c&&c!==a.top&&!e(c);)c=c.parent;e(c)||(c=a.parent)}catch(e){}return function(e,n){if(null==i)throw new Error("Missing pubUrl");var t;if(e=JSON.stringify(e),null==n)c.postMessage(e,i);else{var r=new MessageChannel;(t=r.port1).onmessage=n,a.addEventListener("message",o),c.postMessage(e,i,[r.port2])}return function(){null!=t&&(a.removeEventListener("message",o),t.onmessage=null,t=null)};function o(e){(e.origin||e.originalEvent&&e.originalEvent.origin)===i&&n(e)}}},n.b=function(e,n){return o({adId:e,message:a,event:n?c:i},n?{info:n}:null)};var r=t(1);function o(){return(o=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}var a="Prebid Event",i="adRenderSucceeded",c="adRenderFailed"},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t(4);window.ucTag=window.ucTag||{},window.ucTag.renderAd=r.a},function(e,n,t){"use strict";n.a=function(e,n){var t=Object(r.b)(n);Object(o.a)(window)?function(e,n){for(var t=!1,r=window,o=0;o<10;o++)if((r=r.parent).pbjs)try{r.pbjs.renderAd(e,n),t=!0;break}catch(e){continue}t||console.error("Unable to locate pbjs.renderAd function!")}(e,t.adId):function(l,d){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"",n=3<arguments.length?arguments[3]:void 0,t=l.location,r=e||l.location.hostname,o=t.protocol+"//"+r,f=Object(i.a)(n,l),h=function(e){return f(Object(i.b)(d,e))};function a(e){var n=e.message?"message":"data",t={};try{t=JSON.parse(e[n])}catch(e){return}if(t.message&&"Prebid Response"===t.message&&t.adId===d){if(Object(g.a)(t))return void Object(g.b)(d,t,f,l);try{var r=l.document.body,o=t.ad,a=t.adUrl,i=t.width,c=t.height;if("video"===t.mediaType)h({reason:"preventWritingOnMainDocument",message:"Cannot render video ad ".concat(d)}),console.log("Error trying to write ad.");else if(o){var s=Object(p.a)(t.height,t.width);r.appendChild(s),s.contentDocument.open(),s.contentDocument.write(o),s.contentDocument.close(),h()}else if(a){var u=Object(p.a)(c,i);u.style.display="inline",u.style.overflow="hidden",u.src=a,Object(p.b)(u,document,"body"),h()}else h({reason:"noAd",message:"No ad for ".concat(d)}),console.log("Error trying to write ad. No ad markup or adUrl for ".concat(d))}catch(e){h({reason:"exception",message:e.message}),console.log("Error in rendering ad",e)}}}f({message:"Prebid Request",adId:d,adServerDomain:o},a)}(window,t.adId,t.adServerDomain,t.pubUrl)};var r=t(1),o=t(5),p=t(0),i=t(2),g=t(6)},function(e,n,t){"use strict";n.a=function(e){var n=!1,t=e;for(;!n;){try{if(t.pbjs){n=!0;break}}catch(e){}if(t===window.top)break;t=t.parent}return n}},function(e,n,t){"use strict";n.a=function(e){return"string"==typeof e.renderer&&parseInt(e.rendererVersion,10)>=o},n.b=function(a,i,c){var s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:window,u=4<arguments.length&&void 0!==arguments[4]?arguments[4]:r.c,l=u(s.document,{width:0,height:0,style:"display: none",srcdoc:"<script>".concat(i.renderer,"<\/script>"),name:"__pb_renderer__"});return new Promise(function(n,t){function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};c(Object(d.b)(a,{reason:e.reason||"exception",message:e.message})),e.stack&&console.error(e),t(e)}function o(e){return function(){try{return e.apply(this,arguments)}catch(e){r(e)}}}l.onload=o(function(){var e=l.contentWindow;e.Promise.resolve(e.render(i,{mkFrame:u,sendMessage:function(e,n,t){return c(f({adId:a,message:e},n),t?o(t):void 0)}},s)).then(function(){return c(Object(d.b)(a))},r).then(n)}),s.document.body.appendChild(l)})};var r=t(0),d=t(2);function f(){return(f=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}var o=3}]);
|
package/dist/creative.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* v1.17.
|
2
|
-
Updated : 2025-03-
|
1
|
+
/* v1.17.1
|
2
|
+
Updated : 2025-03-19
|
3
3
|
DEPRECATED, please use creative based on hb_format targeting */
|
4
|
-
!function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=4)}([function(e,t,n){"use strict";t.i=function(e,t){var n=new Image;t&&"function"==typeof t&&(n.addEventListener("load",t),n.addEventListener("error",t));n.src=e},t.a=function(e){if(!e)return"";var t=encodeURI(e);return'<div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="'.concat(t,'"></div>')},t.j=function(e,t,n){var r=o.a(n,t);r.src=e,document.body.appendChild(r)},t.g=function(e,t){var n=new XMLHttpRequest;n.addEventListener("load",function(){t(n.responseText)}),n.open("GET",e),n.send()},t.d=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===e?t:3&t|8).toString(16)})},t.e=function(e,t,n,r){var o=e.document,a=o.createElement("script");a.type="text/javascript",n&&"function"==typeof n&&(a.readyState?a.onreadystatechange=function(){"loaded"!==a.readyState&&"complete"!==a.readyState||(a.onreadystatechange=null,n())}:a.onload=function(){n()});r&&"function"==typeof r&&(a.onerror=function(){r()});a.src=t;var i=o.getElementsByTagName("head");(i=i.length?i:o.getElementsByTagName("body")).length&&(i=i[0]).insertBefore(a,i.firstChild);return a},t.b=r,t.c=function(e){var t=r(e),n=document.createElement("div");return n.appendChild(t),n.innerHTML},t.h=function(t){var n={hb_adid:"adId",hb_cache_host:"cacheHost",hb_cache_path:"cachePath",hb_cache_id:"uuid",hb_format:"mediaType",hb_env:"env",hb_size:"size",hb_pb:"hbPb"};function e(e){return!(!t[e]||!(function(e){return a(e,"Object")}(t[e])&&0<Object.keys(t[e]).length||i(t[e])&&""!==t[e]))}var r={},o={};e("targetingMap")?o=function(t){var n={};return Object.keys(t).forEach(function(e){Array.isArray(t[e])&&0<t[e].length&&(n[e]=t[e][0])}),n}(t.targetingMap):e("targetingKeywords")&&(o=function(e){var o={},t=e.split(",");return 0<t.length&&t.forEach(function(e){var t=e.split(":");if(2===t.length){var n=t[0],r=t[1];o[n]=r}}),o}(t.targetingKeywords));return function(t){Object.keys(t).forEach(function(e){r[n[e]||e]=t[e]})}(o),Object.keys(t).forEach(function(e){"targetingMap"!==e&&"targetingKeywords"!==e&&i(t[e])&&""!==t[e]&&(r[e]=t[e])}),r},t.f=function(e){var t=document.createElement("a");return t.href=decodeURIComponent(e),{href:t.href,protocol:(t.protocol||"").replace(/:$/,""),hostname:t.hostname,port:+t.port,pathname:t.pathname.replace(/^(?!\/)/,"/"),hash:(t.hash||"").replace(/^#/,""),host:(t.host||window.location.host).replace(/:(443|80)$/,"")}};var o=n(1);function r(e){return document.createComment("Creative ".concat(e.crid," served by Prebid.js Header Bidding"))}function a(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function i(e){return a(e,"String")}},function(e,t,n){"use strict";function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=e.createElement("iframe");return Object.entries(r({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}t.c=o,t.a=function(e,t){return o(document,{height:e,width:t})},t.b=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){}}},function(e,t,n){"use strict";t.b=function(e,t){return"string"==typeof e&&""!==e&&function(e){return e.top!==e&&!function(e){try{return e.top.location.toString(),!0}catch(e){return!1}}(e)}(t)},t.d=function(e){return!(!e.$sf||!e.$sf.ext)},t.a=function(e){var t=!1,n=e;for(;!t;){try{if(n.pbjs){t=!0;break}}catch(e){}if(n===window.top)break;n=n.parent}return t},t.c=function(e){return e&&"mobile-app"===e}},function(e,t,n){"use strict";t.a=function(t){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:window,i=function(){if(null==t)return null;var e=Object(r.f)(t);return e.protocol+"://"+e.host}();function e(e){return e&&e.frames&&e.frames.__pb_locator__}var c=a.parent;try{for(;null!=c&&c!==a.top&&!e(c);)c=c.parent;e(c)||(c=a.parent)}catch(e){}return function(e,t){if(null==i)throw new Error("Missing pubUrl");var n;if(e=JSON.stringify(e),null==t)c.postMessage(e,i);else{var r=new MessageChannel;(n=r.port1).onmessage=t,a.addEventListener("message",o),c.postMessage(e,i,[r.port2])}return function(){null!=n&&(a.removeEventListener("message",o),n.onmessage=null,n=null)};function o(e){(e.origin||e.originalEvent&&e.originalEvent.origin)===i&&t(e)}}},t.b=function(e,t){return o({adId:e,message:a,event:t?c:i},t?{info:t}:null)};var r=n(0);function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var a="Prebid Event",i="adRenderSucceeded",c="adRenderFailed"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(5),a=n(7),i=n(2);window.ucTag=window.ucTag||{},window.ucTag.renderAd=function(e,t){var n=Object(r.h)(t);Object(i.c)(n.env)||Object(i.b)(n.uuid,window)?Object(a.a)(t):Object(o.a)(e,t)}},function(e,t,n){"use strict";t.a=function(e,t){var n=Object(r.h)(t);Object(o.a)(window)?function(e,t){for(var n=!1,r=window,o=0;o<10;o++)if((r=r.parent).pbjs)try{r.pbjs.renderAd(e,t),n=!0;break}catch(e){continue}n||console.error("Unable to locate pbjs.renderAd function!")}(e,n.adId):function(s,l){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"",t=3<arguments.length?arguments[3]:void 0,n=s.location,r=e||s.location.hostname,o=n.protocol+"//"+r,f=Object(i.a)(t,s),h=function(e){return f(Object(i.b)(l,e))};function a(e){var t=e.message?"message":"data",n={};try{n=JSON.parse(e[t])}catch(e){return}if(n.message&&"Prebid Response"===n.message&&n.adId===l){if(Object(v.a)(n))return void Object(v.b)(l,n,f,s);try{var r=s.document.body,o=n.ad,a=n.adUrl,i=n.width,c=n.height;if("video"===n.mediaType)h({reason:"preventWritingOnMainDocument",message:"Cannot render video ad ".concat(l)}),console.log("Error trying to write ad.");else if(o){var u=Object(p.a)(n.height,n.width);r.appendChild(u),u.contentDocument.open(),u.contentDocument.write(o),u.contentDocument.close(),h()}else if(a){var d=Object(p.a)(c,i);d.style.display="inline",d.style.overflow="hidden",d.src=a,Object(p.b)(d,document,"body"),h()}else h({reason:"noAd",message:"No ad for ".concat(l)}),console.log("Error trying to write ad. No ad markup or adUrl for ".concat(l))}catch(e){h({reason:"exception",message:e.message}),console.log("Error in rendering ad",e)}}}f({message:"Prebid Request",adId:l,adServerDomain:o},a)}(window,n.adId,n.adServerDomain,n.pubUrl)};var r=n(0),o=n(2),p=n(1),i=n(3),v=n(6)},function(e,t,n){"use strict";t.a=function(e){return"string"==typeof e.renderer&&parseInt(e.rendererVersion,10)>=o},t.b=function(a,i,c){var u=3<arguments.length&&void 0!==arguments[3]?arguments[3]:window,d=4<arguments.length&&void 0!==arguments[4]?arguments[4]:r.c,s=d(u.document,{width:0,height:0,style:"display: none",srcdoc:"<script>".concat(i.renderer,"<\/script>"),name:"__pb_renderer__"});return new Promise(function(t,n){function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};c(Object(l.b)(a,{reason:e.reason||"exception",message:e.message})),e.stack&&console.error(e),n(e)}function o(e){return function(){try{return e.apply(this,arguments)}catch(e){r(e)}}}s.onload=o(function(){var e=s.contentWindow;e.Promise.resolve(e.render(i,{mkFrame:d,sendMessage:function(e,t,n){return c(f({adId:a,message:e},t),n?o(n):void 0)}},u)).then(function(){return c(Object(l.b)(a))},r).then(t)}),u.document.body.appendChild(s)})};var r=n(1),l=n(3);function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var o=3},function(e,t,n){"use strict";t.a=function(e){var t=Object(l.h)(e),n=t.cacheHost,r=t.cachePath,o=t.uuid,a=t.size,i=t.hbPb,c="Prebid_";if((o=o||"").substr(0,c.length)===c)!function(e){var t=window.localStorage.getItem(e);b(!0)(t)}(o),v(a);else{var u="".concat(function(e,t){var n=void 0===t||""===t?p:t;return"https://".concat(void 0===e||""===e?s:e).concat(n)}(n,r),"?uuid=").concat(o);v(a),Object(l.g)(u,b(Object(d.c)(t.env),i))}};var l=n(0),d=n(2),f=n(1),h=n(8),s="prebid.adnxs.com",p="/pbc/v1/cache";function v(e){if(e){var t=e.split("x").map(Number);!function(r,o){var a=window.innerWidth,i=window.innerHeight;if(a!==r||i!==o){if(Object(d.d)(window)){window.$sf.ext.register(r,o,function(e){var t=r-a,n=o-i;window.$sf.ext.expand({r:t,b:n,push:!0})})}window.parent.postMessage({sentinel:"amp",type:"embed-size",width:r,height:o},"*")}}(t[0],t[1])}else console.log("Targeting key hb_size not found to resize creative")}function b(d,s){return function(e){var t=function(e){var t;try{t=JSON.parse(e)}catch(e){console.log("Error parsing response from cache host: ".concat(e))}return t}(e),n=t.price||s,r=Object(l.c)(t),o=t.width?t.width:t.w,a=t.height?t.height:t.h;if(t.wurl&&Object(l.i)(decodeURIComponent(t.wurl)),t.adm){if(t.adm=n?t.adm.replace("${AUCTION_PRICE}",n):t.adm.replace("${AUCTION_PRICE}",""),r+=d?g(t.adm,o,a):t.adm,t.nurl&&(r+=Object(l.a)(decodeURIComponent(t.nurl))),t.burl){var i=function(){Object(l.i)(t.burl)};if(d)Object(l.e)(window,"mraid.js",function(){!function(t){function n(e){0<e&&(mraid.removeEventListener("exposureChange",n),t())}function r(e){e&&(mraid.removeEventListener("viewableChange",r),t())}function o(){window.MRAID_ENV&&3<=parseFloat(window.MRAID_ENV.version)?mraid.addEventListener("exposureChange",n):window.MRAID_ENV&&parseFloat(window.MRAID_ENV.version)<3&&(mraid.isViewable()?t():mraid.addEventListener("viewableChange",r))}return!(!window.mraid||!window.MRAID_ENV)&&("loading"==mraid.getState()?mraid.addEventListener("ready",function e(){mraid.removeEventListener("ready",e),o()}):o(),!0)}(i)&&i()},i);else i()}Object(h.a)(r)}else if(t.nurl)if(d){r+=g(Object(l.e)(window,t.nurl).outerHTML,o,a),Object(h.a)(r)}else{var c=t.nurl,u=Object(l.b)(t);Object(f.b)(u,document,"body"),Object(l.j)(c,o,a)}}}function g(e,t,n){var r=Object(l.d)();return'<div id="'.concat(r,'" style="border-style: none; position: absolute; width:100%; height:100%;">\n <div id="').concat(r,'_inner" style="margin: 0 auto; width:').concat(t,"px; height:").concat(n,'px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">').concat(e,"</div>\n </div>")}},function(e,t,n){"use strict";t.a=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:document.body.insertAdjacentHTML.bind(document.body);e=e.replace(/\<(\?xml|(\!DOCTYPE[^\>\[]+(\[[^\]]+)?))+[^>]+\>/gi,"");try{t("beforeend",e)}catch(e){console.error(e)}}}]);
|
4
|
+
!function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=4)}([function(e,t,n){"use strict";t.i=function(e,t){var n=new Image;t&&"function"==typeof t&&(n.addEventListener("load",t),n.addEventListener("error",t));n.src=e},t.a=function(e){if(!e)return"";var t=encodeURI(e);return'<div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="'.concat(t,'"></div>')},t.j=function(e,t,n){var r=o.a(n,t);r.src=e,document.body.appendChild(r)},t.g=function(e,t){var n=new XMLHttpRequest;n.addEventListener("load",function(){t(n.responseText)}),n.open("GET",e),n.send()},t.d=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===e?t:3&t|8).toString(16)})},t.e=function(e,t,n,r){var o=e.document,a=o.createElement("script");a.type="text/javascript",n&&"function"==typeof n&&(a.readyState?a.onreadystatechange=function(){"loaded"!==a.readyState&&"complete"!==a.readyState||(a.onreadystatechange=null,n())}:a.onload=function(){n()});r&&"function"==typeof r&&(a.onerror=function(){r()});a.src=t;var i=o.getElementsByTagName("head");(i=i.length?i:o.getElementsByTagName("body")).length&&(i=i[0]).insertBefore(a,i.firstChild);return a},t.b=r,t.c=function(e){var t=r(e),n=document.createElement("div");return n.appendChild(t),n.innerHTML},t.h=function(t){var n={hb_adid:"adId",hb_cache_host:"cacheHost",hb_cache_path:"cachePath",hb_cache_id:"uuid",hb_format:"mediaType",hb_env:"env",hb_size:"size",hb_pb:"hbPb"};function e(e){return!(!t[e]||!(function(e){return a(e,"Object")}(t[e])&&0<Object.keys(t[e]).length||i(t[e])&&""!==t[e]))}var r={},o={};e("targetingMap")?o=function(t){var n={};return Object.keys(t).forEach(function(e){Array.isArray(t[e])&&0<t[e].length&&(n[e]=t[e][0])}),n}(t.targetingMap):e("targetingKeywords")&&(o=function(e){var o={},t=e.split(",");return 0<t.length&&t.forEach(function(e){var t=e.split(":");if(2===t.length){var n=t[0],r=t[1];o[n]=r}}),o}(t.targetingKeywords));return function(t){Object.keys(t).forEach(function(e){r[n[e]||e]=t[e]})}(o),Object.keys(t).forEach(function(e){"targetingMap"!==e&&"targetingKeywords"!==e&&i(t[e])&&""!==t[e]&&(r[e]=t[e])}),r},t.f=function(e){var t=document.createElement("a");return t.href=decodeURIComponent(e),{href:t.href,protocol:(t.protocol||"").replace(/:$/,""),hostname:t.hostname,port:+t.port,pathname:t.pathname.replace(/^(?!\/)/,"/"),hash:(t.hash||"").replace(/^#/,""),host:(t.host||window.location.host).replace(/:(443|80)$/,"")}};var o=n(1);function r(e){return document.createComment("Creative ".concat(e.crid," served by Prebid.js Header Bidding"))}function a(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function i(e){return a(e,"String")}},function(e,t,n){"use strict";function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=e.createElement("iframe");return Object.entries(r({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}t.c=o,t.a=function(e,t){return o(document,{height:e,width:t})},t.b=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){}}},function(e,t,n){"use strict";t.b=function(e,t){return"string"==typeof e&&""!==e&&function(e){return e.top!==e&&!function(e){try{return e.top.location.toString(),!0}catch(e){return!1}}(e)}(t)},t.d=function(e){return!(!e.$sf||!e.$sf.ext)},t.a=function(e){var t=!1,n=e;for(;!t;){try{if(n.pbjs){t=!0;break}}catch(e){}if(n===window.top)break;n=n.parent}return t},t.c=function(e){return e&&"mobile-app"===e}},function(e,t,n){"use strict";t.a=function(t){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:window,i=function(){if(null==t)return null;var e=Object(r.f)(t);return e.protocol+"://"+e.host}();function e(e){return e&&e.frames&&e.frames.__pb_locator__}var c=a.parent;try{for(;null!=c&&c!==a.top&&!e(c);)c=c.parent;e(c)||(c=a.parent)}catch(e){}return function(e,t){if(null==i)throw new Error("Missing pubUrl");var n;if(e=JSON.stringify(e),null==t)c.postMessage(e,i);else{var r=new MessageChannel;(n=r.port1).onmessage=t,a.addEventListener("message",o),c.postMessage(e,i,[r.port2])}return function(){null!=n&&(a.removeEventListener("message",o),n.onmessage=null,n=null)};function o(e){(e.origin||e.originalEvent&&e.originalEvent.origin)===i&&t(e)}}},t.b=function(e,t){return o({adId:e,message:a,event:t?c:i},t?{info:t}:null)};var r=n(0);function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var a="Prebid Event",i="adRenderSucceeded",c="adRenderFailed"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(5),a=n(7),i=n(2);window.ucTag=window.ucTag||{},window.ucTag.renderAd=function(e,t){var n=Object(r.h)(t);Object(i.c)(n.env)||Object(i.b)(n.uuid,window)?Object(a.a)(t):Object(o.a)(e,t)}},function(e,t,n){"use strict";t.a=function(e,t){var n=Object(r.h)(t);Object(o.a)(window)?function(e,t){for(var n=!1,r=window,o=0;o<10;o++)if((r=r.parent).pbjs)try{r.pbjs.renderAd(e,t),n=!0;break}catch(e){continue}n||console.error("Unable to locate pbjs.renderAd function!")}(e,n.adId):function(d,l){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"",t=3<arguments.length?arguments[3]:void 0,n=d.location,r=e||d.location.hostname,o=n.protocol+"//"+r,f=Object(i.a)(t,d),h=function(e){return f(Object(i.b)(l,e))};function a(e){var t=e.message?"message":"data",n={};try{n=JSON.parse(e[t])}catch(e){return}if(n.message&&"Prebid Response"===n.message&&n.adId===l){if(Object(g.a)(n))return void Object(g.b)(l,n,f,d);try{var r=d.document.body,o=n.ad,a=n.adUrl,i=n.width,c=n.height;if("video"===n.mediaType)h({reason:"preventWritingOnMainDocument",message:"Cannot render video ad ".concat(l)}),console.log("Error trying to write ad.");else if(o){var u=Object(p.a)(n.height,n.width);r.appendChild(u),u.contentDocument.open(),u.contentDocument.write(o),u.contentDocument.close(),h()}else if(a){var s=Object(p.a)(c,i);s.style.display="inline",s.style.overflow="hidden",s.src=a,Object(p.b)(s,document,"body"),h()}else h({reason:"noAd",message:"No ad for ".concat(l)}),console.log("Error trying to write ad. No ad markup or adUrl for ".concat(l))}catch(e){h({reason:"exception",message:e.message}),console.log("Error in rendering ad",e)}}}f({message:"Prebid Request",adId:l,adServerDomain:o},a)}(window,n.adId,n.adServerDomain,n.pubUrl)};var r=n(0),o=n(2),p=n(1),i=n(3),g=n(6)},function(e,t,n){"use strict";t.a=function(e){return"string"==typeof e.renderer&&parseInt(e.rendererVersion,10)>=o},t.b=function(a,i,c){var u=3<arguments.length&&void 0!==arguments[3]?arguments[3]:window,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:r.c,d=s(u.document,{width:0,height:0,style:"display: none",srcdoc:"<script>".concat(i.renderer,"<\/script>"),name:"__pb_renderer__"});return new Promise(function(t,n){function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};c(Object(l.b)(a,{reason:e.reason||"exception",message:e.message})),e.stack&&console.error(e),n(e)}function o(e){return function(){try{return e.apply(this,arguments)}catch(e){r(e)}}}d.onload=o(function(){var e=d.contentWindow;e.Promise.resolve(e.render(i,{mkFrame:s,sendMessage:function(e,t,n){return c(f({adId:a,message:e},t),n?o(n):void 0)}},u)).then(function(){return c(Object(l.b)(a))},r).then(t)}),u.document.body.appendChild(d)})};var r=n(1),l=n(3);function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var o=3},function(e,t,n){"use strict";t.a=function(e){var t=Object(l.h)(e),n=t.cacheHost,r=t.cachePath,o=t.uuid,a=t.size,i=t.hbPb,c="Prebid_";if((o=o||"").substr(0,c.length)===c)!function(e){var t=window.localStorage.getItem(e);v(!0)(t)}(o),g(a);else{var u="".concat(function(e,t){var n=void 0===t||""===t?p:t;return"https://".concat(void 0===e||""===e?d:e).concat(n)}(n,r),"?uuid=").concat(o);g(a),Object(l.g)(u,v(Object(s.c)(t.env),i))}};var l=n(0),s=n(2),f=n(1),h=n(8),d="prebid.adnxs.com",p="/pbc/v1/cache";function g(e){if(e){var t=e.split("x").map(Number);!function(r,o){var a=window.innerWidth,i=window.innerHeight;if(a!==r||i!==o){if(Object(s.d)(window)){window.$sf.ext.register(r,o,function(e){var t=r-a,n=o-i;window.$sf.ext.expand({r:t,b:n,push:!0})})}window.parent.postMessage({sentinel:"amp",type:"embed-size",width:r,height:o},"*")}}(t[0],t[1])}else console.log("Targeting key hb_size not found to resize creative")}function v(s,d){return function(e){var t=function(e){var t;try{t=JSON.parse(e)}catch(e){console.log("Error parsing response from cache host: ".concat(e))}return t}(e),n=t.price||d,r=Object(l.c)(t),o=t.width?t.width:t.w,a=t.height?t.height:t.h;if(t.wurl&&Object(l.i)(decodeURIComponent(t.wurl)),t.adm){if(t.adm=n?t.adm.replace("${AUCTION_PRICE}",n):t.adm.replace("${AUCTION_PRICE}",""),r+=s?b(t.adm,o,a):t.adm,t.nurl&&(r+=Object(l.a)(decodeURIComponent(t.nurl))),t.burl){var i=function(){Object(l.i)(t.burl)};if(s)Object(l.e)(window,"mraid.js",function(){!function(t){function n(e){0<e&&(mraid.removeEventListener("exposureChange",n),t())}function r(e){e&&(mraid.removeEventListener("viewableChange",r),t())}function o(){window.MRAID_ENV&&3<=parseFloat(window.MRAID_ENV.version)?mraid.addEventListener("exposureChange",n):window.MRAID_ENV&&parseFloat(window.MRAID_ENV.version)<3&&(mraid.isViewable()?t():mraid.addEventListener("viewableChange",r))}return!(!window.mraid||!window.MRAID_ENV)&&("loading"==mraid.getState()?mraid.addEventListener("ready",function e(){mraid.removeEventListener("ready",e),o()}):o(),!0)}(i)&&i()},i);else i()}Object(h.a)(r)}else if(t.nurl)if(s){r+=b(Object(l.e)(window,t.nurl).outerHTML,o,a),Object(h.a)(r)}else{var c=t.nurl,u=Object(l.b)(t);Object(f.b)(u,document,"body"),Object(l.j)(c,o,a)}}}function b(e,t,n){var r=Object(l.d)();return'<div id="'.concat(r,'" style="border-style: none; position: absolute; width:100%; height:100%;">\n <div id="').concat(r,'_inner" style="margin: 0 auto; width:').concat(t,"px; height:").concat(n,'px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">').concat(e,"</div>\n </div>")}},function(e,t,n){"use strict";function r(e){try{var t=document.createRange().createContextualFragment(e);document.body.append(t)}catch(e){console.error(e)}}t.a=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:r;e=e.replace(/\<(\?xml|(\!DOCTYPE[^\>\[]+(\[[^\]]+)?))+[^>]+\>/gi,""),t(e)}}]);
|
package/dist/mobile.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* prebid-universal-creative v1.17.
|
2
|
-
Updated : 2025-03-
|
3
|
-
!function(n){var r={};function i(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=n,i.c=r,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1)}([function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}t.a=function(e,t){return function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=e.createElement("iframe");return Object.entries(r({frameborder:0,scrolling:"no",marginheight:0,marginwidth:0,TOPMARGIN:0,LEFTMARGIN:0,allowtransparency:"true"},t)).forEach(function(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}(e,2),n=t[0],r=t[1];i.setAttribute(n,r)}),i}(document,{height:e,width:t})},t.b=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){}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);window.ucTag=window.ucTag||{},window.ucTag.renderAd=function(e,t){Object(r.a)(t)}},function(e,t,n){"use strict";t.a=function(e){var t=Object(f.g)(e),n=t.cacheHost,r=t.cachePath,i=t.uuid,o=t.size,a=t.hbPb,c="Prebid_";if((i=i||"").substr(0,c.length)===c)!function(e){var t=window.localStorage.getItem(e);p(!0)(t)}(i),g(o);else{var u="".concat(function(e,t){var n=void 0===t||""===t?b:t;return"https://".concat(void 0===e||""===e?s:e).concat(n)}(n,r),"?uuid=").concat(i);g(o),Object(f.f)(u,p(Object(d.a)(t.env),a))}};var f=n(3),d=n(4),l=n(0),h=n(5),s="prebid.adnxs.com",b="/pbc/v1/cache";function g(e){if(e){var t=e.split("x").map(Number);!function(r,i){var o=window.innerWidth,a=window.innerHeight;if(o!==r||a!==i){if(Object(d.b)(window)){window.$sf.ext.register(r,i,function(e){var t=r-o,n=i-a;window.$sf.ext.expand({r:t,b:n,push:!0})})}window.parent.postMessage({sentinel:"amp",type:"embed-size",width:r,height:i},"*")}}(t[0],t[1])}else console.log("Targeting key hb_size not found to resize creative")}function p(d,s){return function(e){var t=function(e){var t;try{t=JSON.parse(e)}catch(e){console.log("Error parsing response from cache host: ".concat(e))}return t}(e),n=t.price||s,r=Object(f.c)(t),i=t.width?t.width:t.w,o=t.height?t.height:t.h;if(t.wurl&&Object(f.h)(decodeURIComponent(t.wurl)),t.adm){if(t.adm=n?t.adm.replace("${AUCTION_PRICE}",n):t.adm.replace("${AUCTION_PRICE}",""),r+=d?v(t.adm,i,o):t.adm,t.nurl&&(r+=Object(f.a)(decodeURIComponent(t.nurl))),t.burl){var a=function(){Object(f.h)(t.burl)};if(d)Object(f.e)(window,"mraid.js",function(){!function(t){function n(e){0<e&&(mraid.removeEventListener("exposureChange",n),t())}function r(e){e&&(mraid.removeEventListener("viewableChange",r),t())}function i(){window.MRAID_ENV&&3<=parseFloat(window.MRAID_ENV.version)?mraid.addEventListener("exposureChange",n):window.MRAID_ENV&&parseFloat(window.MRAID_ENV.version)<3&&(mraid.isViewable()?t():mraid.addEventListener("viewableChange",r))}return!(!window.mraid||!window.MRAID_ENV)&&("loading"==mraid.getState()?mraid.addEventListener("ready",function e(){mraid.removeEventListener("ready",e),i()}):i(),!0)}(a)&&a()},a);else a()}Object(h.a)(r)}else if(t.nurl)if(d){r+=v(Object(f.e)(window,t.nurl).outerHTML,i,o),Object(h.a)(r)}else{var c=t.nurl,u=Object(f.b)(t);Object(l.b)(u,document,"body"),Object(f.i)(c,i,o)}}}function v(e,t,n){var r=Object(f.d)();return'<div id="'.concat(r,'" style="border-style: none; position: absolute; width:100%; height:100%;">\n <div id="').concat(r,'_inner" style="margin: 0 auto; width:').concat(t,"px; height:").concat(n,'px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">').concat(e,"</div>\n </div>")}},function(e,t,n){"use strict";t.h=function(e,t){var n=new Image;t&&"function"==typeof t&&(n.addEventListener("load",t),n.addEventListener("error",t));n.src=e},t.a=function(e){if(!e)return"";var t=encodeURI(e);return'<div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="'.concat(t,'"></div>')},t.i=function(e,t,n){var r=i.a(n,t);r.src=e,document.body.appendChild(r)},t.f=function(e,t){var n=new XMLHttpRequest;n.addEventListener("load",function(){t(n.responseText)}),n.open("GET",e),n.send()},t.d=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===e?t:3&t|8).toString(16)})},t.e=function(e,t,n,r){var i=e.document,o=i.createElement("script");o.type="text/javascript",n&&"function"==typeof n&&(o.readyState?o.onreadystatechange=function(){"loaded"!==o.readyState&&"complete"!==o.readyState||(o.onreadystatechange=null,n())}:o.onload=function(){n()});r&&"function"==typeof r&&(o.onerror=function(){r()});o.src=t;var a=i.getElementsByTagName("head");(a=a.length?a:i.getElementsByTagName("body")).length&&(a=a[0]).insertBefore(o,a.firstChild);return o},t.b=r,t.c=function(e){var t=r(e),n=document.createElement("div");return n.appendChild(t),n.innerHTML},t.g=function(t){var n={hb_adid:"adId",hb_cache_host:"cacheHost",hb_cache_path:"cachePath",hb_cache_id:"uuid",hb_format:"mediaType",hb_env:"env",hb_size:"size",hb_pb:"hbPb"};function e(e){return!(!t[e]||!(function(e){return o(e,"Object")}(t[e])&&0<Object.keys(t[e]).length||a(t[e])&&""!==t[e]))}var r={},i={};e("targetingMap")?i=function(t){var n={};return Object.keys(t).forEach(function(e){Array.isArray(t[e])&&0<t[e].length&&(n[e]=t[e][0])}),n}(t.targetingMap):e("targetingKeywords")&&(i=function(e){var i={},t=e.split(",");return 0<t.length&&t.forEach(function(e){var t=e.split(":");if(2===t.length){var n=t[0],r=t[1];i[n]=r}}),i}(t.targetingKeywords));return function(t){Object.keys(t).forEach(function(e){r[n[e]||e]=t[e]})}(i),Object.keys(t).forEach(function(e){"targetingMap"!==e&&"targetingKeywords"!==e&&a(t[e])&&""!==t[e]&&(r[e]=t[e])}),r};var i=n(0);function r(e){return document.createComment("Creative ".concat(e.crid," served by Prebid.js Header Bidding"))}function o(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function a(e){return o(e,"String")}},function(e,t,n){"use strict";t.b=function(e){return!(!e.$sf||!e.$sf.ext)},t.a=function(e){return e&&"mobile-app"===e}},function(e,t,n){"use strict";t.a=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:
|
1
|
+
/* prebid-universal-creative v1.17.1
|
2
|
+
Updated : 2025-03-19 */
|
3
|
+
!function(n){var r={};function i(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=n,i.c=r,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1)}([function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}t.a=function(e,t){return function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=e.createElement("iframe");return Object.entries(r({frameborder:0,scrolling:"no",marginheight:0,marginwidth:0,TOPMARGIN:0,LEFTMARGIN:0,allowtransparency:"true"},t)).forEach(function(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}(e,2),n=t[0],r=t[1];i.setAttribute(n,r)}),i}(document,{height:e,width:t})},t.b=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){}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);window.ucTag=window.ucTag||{},window.ucTag.renderAd=function(e,t){Object(r.a)(t)}},function(e,t,n){"use strict";t.a=function(e){var t=Object(f.g)(e),n=t.cacheHost,r=t.cachePath,i=t.uuid,o=t.size,a=t.hbPb,c="Prebid_";if((i=i||"").substr(0,c.length)===c)!function(e){var t=window.localStorage.getItem(e);p(!0)(t)}(i),g(o);else{var u="".concat(function(e,t){var n=void 0===t||""===t?b:t;return"https://".concat(void 0===e||""===e?s:e).concat(n)}(n,r),"?uuid=").concat(i);g(o),Object(f.f)(u,p(Object(d.a)(t.env),a))}};var f=n(3),d=n(4),l=n(0),h=n(5),s="prebid.adnxs.com",b="/pbc/v1/cache";function g(e){if(e){var t=e.split("x").map(Number);!function(r,i){var o=window.innerWidth,a=window.innerHeight;if(o!==r||a!==i){if(Object(d.b)(window)){window.$sf.ext.register(r,i,function(e){var t=r-o,n=i-a;window.$sf.ext.expand({r:t,b:n,push:!0})})}window.parent.postMessage({sentinel:"amp",type:"embed-size",width:r,height:i},"*")}}(t[0],t[1])}else console.log("Targeting key hb_size not found to resize creative")}function p(d,s){return function(e){var t=function(e){var t;try{t=JSON.parse(e)}catch(e){console.log("Error parsing response from cache host: ".concat(e))}return t}(e),n=t.price||s,r=Object(f.c)(t),i=t.width?t.width:t.w,o=t.height?t.height:t.h;if(t.wurl&&Object(f.h)(decodeURIComponent(t.wurl)),t.adm){if(t.adm=n?t.adm.replace("${AUCTION_PRICE}",n):t.adm.replace("${AUCTION_PRICE}",""),r+=d?v(t.adm,i,o):t.adm,t.nurl&&(r+=Object(f.a)(decodeURIComponent(t.nurl))),t.burl){var a=function(){Object(f.h)(t.burl)};if(d)Object(f.e)(window,"mraid.js",function(){!function(t){function n(e){0<e&&(mraid.removeEventListener("exposureChange",n),t())}function r(e){e&&(mraid.removeEventListener("viewableChange",r),t())}function i(){window.MRAID_ENV&&3<=parseFloat(window.MRAID_ENV.version)?mraid.addEventListener("exposureChange",n):window.MRAID_ENV&&parseFloat(window.MRAID_ENV.version)<3&&(mraid.isViewable()?t():mraid.addEventListener("viewableChange",r))}return!(!window.mraid||!window.MRAID_ENV)&&("loading"==mraid.getState()?mraid.addEventListener("ready",function e(){mraid.removeEventListener("ready",e),i()}):i(),!0)}(a)&&a()},a);else a()}Object(h.a)(r)}else if(t.nurl)if(d){r+=v(Object(f.e)(window,t.nurl).outerHTML,i,o),Object(h.a)(r)}else{var c=t.nurl,u=Object(f.b)(t);Object(l.b)(u,document,"body"),Object(f.i)(c,i,o)}}}function v(e,t,n){var r=Object(f.d)();return'<div id="'.concat(r,'" style="border-style: none; position: absolute; width:100%; height:100%;">\n <div id="').concat(r,'_inner" style="margin: 0 auto; width:').concat(t,"px; height:").concat(n,'px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">').concat(e,"</div>\n </div>")}},function(e,t,n){"use strict";t.h=function(e,t){var n=new Image;t&&"function"==typeof t&&(n.addEventListener("load",t),n.addEventListener("error",t));n.src=e},t.a=function(e){if(!e)return"";var t=encodeURI(e);return'<div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="'.concat(t,'"></div>')},t.i=function(e,t,n){var r=i.a(n,t);r.src=e,document.body.appendChild(r)},t.f=function(e,t){var n=new XMLHttpRequest;n.addEventListener("load",function(){t(n.responseText)}),n.open("GET",e),n.send()},t.d=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===e?t:3&t|8).toString(16)})},t.e=function(e,t,n,r){var i=e.document,o=i.createElement("script");o.type="text/javascript",n&&"function"==typeof n&&(o.readyState?o.onreadystatechange=function(){"loaded"!==o.readyState&&"complete"!==o.readyState||(o.onreadystatechange=null,n())}:o.onload=function(){n()});r&&"function"==typeof r&&(o.onerror=function(){r()});o.src=t;var a=i.getElementsByTagName("head");(a=a.length?a:i.getElementsByTagName("body")).length&&(a=a[0]).insertBefore(o,a.firstChild);return o},t.b=r,t.c=function(e){var t=r(e),n=document.createElement("div");return n.appendChild(t),n.innerHTML},t.g=function(t){var n={hb_adid:"adId",hb_cache_host:"cacheHost",hb_cache_path:"cachePath",hb_cache_id:"uuid",hb_format:"mediaType",hb_env:"env",hb_size:"size",hb_pb:"hbPb"};function e(e){return!(!t[e]||!(function(e){return o(e,"Object")}(t[e])&&0<Object.keys(t[e]).length||a(t[e])&&""!==t[e]))}var r={},i={};e("targetingMap")?i=function(t){var n={};return Object.keys(t).forEach(function(e){Array.isArray(t[e])&&0<t[e].length&&(n[e]=t[e][0])}),n}(t.targetingMap):e("targetingKeywords")&&(i=function(e){var i={},t=e.split(",");return 0<t.length&&t.forEach(function(e){var t=e.split(":");if(2===t.length){var n=t[0],r=t[1];i[n]=r}}),i}(t.targetingKeywords));return function(t){Object.keys(t).forEach(function(e){r[n[e]||e]=t[e]})}(i),Object.keys(t).forEach(function(e){"targetingMap"!==e&&"targetingKeywords"!==e&&a(t[e])&&""!==t[e]&&(r[e]=t[e])}),r};var i=n(0);function r(e){return document.createComment("Creative ".concat(e.crid," served by Prebid.js Header Bidding"))}function o(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function a(e){return o(e,"String")}},function(e,t,n){"use strict";t.b=function(e){return!(!e.$sf||!e.$sf.ext)},t.a=function(e){return e&&"mobile-app"===e}},function(e,t,n){"use strict";function r(e){try{var t=document.createRange().createContextualFragment(e);document.body.append(t)}catch(e){console.error(e)}}t.a=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:r;e=e.replace(/\<(\?xml|(\!DOCTYPE[^\>\[]+(\[[^\]]+)?))+[^>]+\>/gi,""),t(e)}}]);
|
package/dist/native-render.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* prebid-universal-creative v1.17.
|
2
|
-
Updated : 2025-03-
|
1
|
+
/* prebid-universal-creative v1.17.1
|
2
|
+
Updated : 2025-03-19 */
|
3
3
|
!function(n){var r={};function a(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=n,a.c=r,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=3)}([function(e,t,n){"use strict";t.c=function(e,t){var n=new XMLHttpRequest;n.addEventListener("load",function(){t(n.responseText)}),n.open("GET",e),n.send()},t.a=function(e,t,n,r){var a=e.document,i=a.createElement("script");i.type="text/javascript",n&&"function"==typeof n&&(i.readyState?i.onreadystatechange=function(){"loaded"!==i.readyState&&"complete"!==i.readyState||(i.onreadystatechange=null,n())}:i.onload=function(){n()});r&&"function"==typeof r&&(i.onerror=function(){r()});i.src=t;var o=a.getElementsByTagName("head");(o=o.length?o:a.getElementsByTagName("body")).length&&(o=o[0]).insertBefore(i,o.firstChild);return i},t.b=function(e){var t=document.createElement("a");return t.href=decodeURIComponent(e),{href:t.href,protocol:(t.protocol||"").replace(/:$/,""),hostname:t.hostname,port:+t.port,pathname:t.pathname.replace(/^(?!\/)/,"/"),hash:(t.hash||"").replace(/^#/,""),host:(t.host||window.location.host).replace(/:(443|80)$/,"")}};n(2)},function(e,t,n){"use strict";t.a=function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:window,o=function(){if(null==t)return null;var e=Object(r.b)(t);return e.protocol+"://"+e.host}();function e(e){return e&&e.frames&&e.frames.__pb_locator__}var c=i.parent;try{for(;null!=c&&c!==i.top&&!e(c);)c=c.parent;e(c)||(c=i.parent)}catch(e){}return function(e,t){if(null==o)throw new Error("Missing pubUrl");var n;if(e=JSON.stringify(e),null==t)c.postMessage(e,o);else{var r=new MessageChannel;(n=r.port1).onmessage=t,i.addEventListener("message",a),c.postMessage(e,o,[r.port2])}return function(){null!=n&&(i.removeEventListener("message",a),n.onmessage=null,n=null)};function a(e){(e.origin||e.originalEvent&&e.originalEvent.origin)===o&&t(e)}}},t.b=function(e,t){return a({adId:e,message:i,event:t?c:o},t?{info:t}:null)};var r=n(0);function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var i="Prebid Event",o="adRenderSucceeded",c="adRenderFailed"},function(e,t,n){"use strict";function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,a=!1,i=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function a(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=e.createElement("iframe");return Object.entries(r({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];a.setAttribute(n,r)}),a}t.b=a,t.a=function(e,t){return a(document,{height:e,width:t})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4);window.pbNativeTag=window.pbNativeTag||{},window.nativeRenderManager=Object(r.a)(window),window.pbNativeTag.renderNativeAd=function(e){return nativeRenderManager.renderNativeAd.call(null,document,e)}},function(e,t,n){"use strict";t.a=function(i){var o,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:d.a,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:r.a;return{renderNativeAd:function(e,t){function n(e,t){o(Object(d.b)(e,t))}window.pbNativeData=t,o=c(t.pubUrl,i);try{var r=s(window,t);if(null!=t.adId){if(t.hasOwnProperty("rendererUrl")&&!t.rendererUrl.match(/##.*##/i)){var a=e.createElement("SCRIPT");a.src=t.rendererUrl,a.id="pb-native-renderer",e.body.appendChild(a)}r.loadAssets(t.adId,function(){n(t.adId)},function(e){n(t.adId,{reason:"exception",message:e.message})})}else n(null,{reason:"missingDocOrAdid"}),console.warn("Prebid Native Tag object was missing 'adId'.")}catch(e){n(t&&t.adId,{reason:"exception",message:e.message}),console.error("Error rendering ad",e)}}}};var r=n(5),d=n(1)},function(e,t,n){"use strict";t.a=function(s,e){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:w.a;e.clickUrlUnesc&&e.clickUrlUnesc!==I&&(U=e.clickUrlUnesc);var d,l,a,n=e.pubUrl,u=t(n,s),f=0;function v(){null!=a&&(a(),a=null)}function i(e){var t;try{t=JSON.parse(e)}catch(e){console.log("Error parsing response from cache host: ".concat(e))}return t}function r(e){var t=e.uuid,n="".concat(function(e,t){var n=void 0===t||""===t?T:t;return"https://".concat(void 0===e||""===e?E:e).concat(n)}(e.cacheHost,e.cachePath),"?uuid=").concat(t);Object(_.c)(n,function(e){var t=i(e);if(t&&t.adm){var n=i(t.adm);if(n&&n.assets){var r=function(e){var t,n=[];return e.assets.forEach(function(e){e.img?N.image[e.img.type]?n.push({key:N.image[e.img.type],value:e.img.url}):console.log("ERROR: Invalid image type for image asset"):e.data?N.data[e.data.type]?n.push({key:N.data[e.data.type],value:e.data.value}):console.log("ERROR: Invalid data type for data asset"):e.title&&n.push({key:"title",value:e.title.text})}),e.link&&(e.link.clicktrackers&&(t=e.link.clicktrackers),n.push({key:"clickUrl",value:e.link.url})),{assets:n,clicktrackers:t,imptrackers:e.imptrackers,eventtrackers:e.eventtrackers}}(n),a=y(s.document.body.innerHTML,r);s.document.body.innerHTML=a,d&&d({clickTrackers:r.clicktrackers,impTrackers:r.imptrackers,eventtrackers:r.eventtrackers})}}})}function p(){return void 0!==s.pbNativeData}function h(e,t){return t&&!p()?"".concat(e,":").concat(t):p()?"##".concat(e,"##"):e}function c(s){for(var e=arguments.length,d=new Array(1<e?e-1:0),t=1;t<e;t++)d[t-1]=arguments[t];return Object.values(A).reduce(function(e,t){var n=h(t,s),r=!0,a=!1,i=void 0;try{for(var o,c=d.filter(Boolean)[Symbol.iterator]();!(r=(o=c.next()).done);r=!0){if(0<=o.value.indexOf(n)){e.push(t);break}}}catch(e){a=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw i}}return e},[])}function o(e){return c(e,s.document.body.innerHTML,s.document.head.innerHTML)}function b(c){return function(e){try{var t={};try{t=JSON.parse(e.data)}catch(e){if(10<f++)throw v(),e;return}if("assetResponse"===t.message&&t.adId===c){if(Object(O.a)(t))return void Object(O.b)(c,t,u,s);t.clickUrlUnesc=U;var n=s.document.body.innerHTML,r=s.document.head.innerHTML;o=d,d=function(){Object(g.b)(t.adId,u),Object(g.a)(t.adId,u),o&&o()},r&&(s.document.head.innerHTML=y(r,t)),t.assets=t.assets||[];var a=t.assets;if(t.ortb&&(a.ortb=t.ortb),t.hasOwnProperty("rendererUrl")&&t.rendererUrl||p()&&s.pbNativeData.hasOwnProperty("rendererUrl"))if(s.renderAd)m(s.renderAd&&s.renderAd(a)||"",t);else document.getElementById("pb-native-renderer")?document.getElementById("pb-native-renderer").addEventListener("load",function(){m(s.renderAd&&s.renderAd(a)||"",t)}):Object(_.a)(s,p()&&s.pbNativeData.hasOwnProperty("rendererUrl")&&s.pbNativeData.rendererUrl||t.rendererUrl,function(){m(s.renderAd&&s.renderAd(a)||"",t)});else if(t.hasOwnProperty("adTemplate")&&t.adTemplate||p()&&s.pbNativeData.hasOwnProperty("adTemplate")){m(y(p()&&s.pbNativeData.hasOwnProperty("adTemplate")&&s.pbNativeData.adTemplate||t.adTemplate,t),t)}else{var i=y(n,t);s.document.body.innerHTML=i,d&&d(),v()}}}catch(e){l&&l(e)}var o}}function m(e,t){if(!Object(k.a)(window)){var n=function(e){try{for(var t,n=e;n!==e.top;){if(!(t=n.parent).frames||!t.frames.length)return null;for(var r=0;r<t.frames.length;r++)if(t.frames[r]===n){if(!t.document)return null;var a=!0,i=!1,o=void 0;try{for(var c,s=t.document.getElementsByTagName("iframe")[Symbol.iterator]();!(a=(c=s.next()).done);a=!0){var d=c.value;if(!d.contentWindow)return null;if(d.contentWindow===n)return d.parentElement}}catch(e){i=!0,o=e}finally{try{a||null==s.return||s.return()}finally{if(i)throw o}}}}}catch(e){}}(s);if(n&&n.children&&n.children[0]){var r=n.children[0];if("1"===r.width&&"1"===r.height){var a=n.getBoundingClientRect().width;s.document.body.style.width="".concat(a,"px")}}}e=e.replaceAll(I,t.clickUrlUnesc||""),s.document.body.innerHTML+=e,d&&d(),v();function i(){return function(e,t,n){u({message:"Prebid Native",action:"resizeNativeHeight",adId:e,height:t,width:n})}(t.adId,document.body.clientHeight||document.body.offsetHeight,1<document.body.clientWidth?document.body.clientWidth:void 0)}"complete"===document.readyState?i():window.onload=i,"function"==typeof window.postRenderAd&&window.postRenderAd(t)}function y(a,e){var i=e.assets,t=e.ortb,o=e.adId;if(t)a=function(t,e){return e.assets.forEach(function(e){t=t.replaceAll("##hb_native_asset_id_".concat(e.id,"##"),function(e){return e.img?e.img.url:e.data?e.data.value:e.title?e.title.text:e.video?e.video.vasttag:""}(e)),e.link&&e.link.url&&(t=t.replaceAll("##hb_native_asset_link_id_".concat(e.id,"##"),e.link.url))}),t=t.replaceAll(/##hb_native_asset_id_\d+##/gm,""),e.privacy&&(t=t.replaceAll("##hb_native_privacy##",e.privacy)),e.link&&(t=t.replaceAll("##hb_native_linkurl##",e.link.url)),t}(a,t);else if(!Array.isArray(i))return a;return i=i||[],c(o,a).forEach(function(t){var e=h(t,o),n=new RegExp(e,"g"),r=i.find(function(e){return t===A[e.key]});a=a.replace(n,r?r.value:"")}),a}return{loadAssets:function(e,t,n){l=n;var r=o(e);p()&&s.pbNativeData.hasOwnProperty("assetsToReplace")&&s.pbNativeData.assetsToReplace.forEach(function(e){var t=e.match(/hb_native_/i)?e:A[e];t&&r.push(t)}),p()&&s.pbNativeData.hasOwnProperty("requestAllAssets")&&s.pbNativeData.requestAllAssets?(d=t,a=function(e){return u({message:"Prebid Native",action:"allAssetRequest",adId:e},b(e))}(e)):0<r.length?(d=t,a=function(e,t){return u({message:"Prebid Native",action:"assetRequest",adId:e,assets:t},b(e))}(e,r)):n&&n(new Error("No assets to load: no placeholders found in template"))},loadMobileAssets:function(e,t){0<o().length&&(d=t,r(e))}}};var g=n(6),_=n(0),w=n(1),k=n(7),O=n(8),A={title:"hb_native_title",body:"hb_native_body",body2:"hb_native_body2",privacyLink:"hb_native_privacy",privacyIcon:"hb_native_privicon",sponsoredBy:"hb_native_brand",image:"hb_native_image",icon:"hb_native_icon",clickUrl:"hb_native_linkurl",displayUrl:"hb_native_displayurl",cta:"hb_native_cta",rating:"hb_native_rating",address:"hb_native_address",downloads:"hb_native_downloads",likes:"hb_native_likes",phone:"hb_native_phone",price:"hb_native_price",salePrice:"hb_native_saleprice",rendererUrl:"hb_renderer_url"},N={image:{1:"icon",3:"image"},data:{1:"sponsoredBy",2:"body",3:"rating",4:"likes",5:"downloads",6:"price",7:"salePrice",8:"phone",9:"address",10:"body2",11:"displayUrl",12:"cta"}},E="prebid.adnxs.com",T="/pbc/v1/cache",I="%%CLICK_URL_UNESC%%",U=""},function(e,t,n){"use strict";t.b=function(e,t){t({message:"Prebid Native",action:"fireNativeImpressionTrackers",adId:e})},t.a=function(e,r){for(var a={message:"Prebid Native",action:"click",adId:e},t=document.getElementsByClassName(i)||[],n=0;n<t.length;n++)t[n].addEventListener("pointerdown",function(e){var t=e.target,n=t&&t.getAttribute(o);a.assetId=n,r(a)},!0)};n(0);var i="pb-click",o="hb_native_asset_id"},function(e,t,n){"use strict";t.a=function(e){return!(!e.$sf||!e.$sf.ext)}},function(e,t,n){"use strict";t.a=function(e){return"string"==typeof e.renderer&&parseInt(e.rendererVersion,10)>=a},t.b=function(i,o,c){var s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:window,d=4<arguments.length&&void 0!==arguments[4]?arguments[4]:r.b,l=d(s.document,{width:0,height:0,style:"display: none",srcdoc:"<script>".concat(o.renderer,"<\/script>"),name:"__pb_renderer__"});return new Promise(function(t,n){function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};c(Object(u.b)(i,{reason:e.reason||"exception",message:e.message})),e.stack&&console.error(e),n(e)}function a(e){return function(){try{return e.apply(this,arguments)}catch(e){r(e)}}}l.onload=a(function(){var e=l.contentWindow;e.Promise.resolve(e.render(o,{mkFrame:d,sendMessage:function(e,t,n){return c(f({adId:i,message:e},t),n?a(n):void 0)}},s)).then(function(){return c(Object(u.b)(i))},r).then(t)}),s.document.body.appendChild(l)})};var r=n(2),u=n(1);function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var a=3}]);
|
package/dist/native-trk.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* prebid-universal-creative v1.17.
|
2
|
-
Updated : 2025-03-
|
1
|
+
/* prebid-universal-creative v1.17.1
|
2
|
+
Updated : 2025-03-19 */
|
3
3
|
!function(n){var r={};function a(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=n,a.c=r,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=3)}([function(e,t,n){"use strict";t.e=function(e,t){var n=new Image;t&&"function"==typeof t&&(n.addEventListener("load",t),n.addEventListener("error",t));n.src=e},t.c=function(e,t){var n=new XMLHttpRequest;n.addEventListener("load",function(){t(n.responseText)}),n.open("GET",e),n.send()},t.a=function(e,t,n,r){var a=e.document,i=a.createElement("script");i.type="text/javascript",n&&"function"==typeof n&&(i.readyState?i.onreadystatechange=function(){"loaded"!==i.readyState&&"complete"!==i.readyState||(i.onreadystatechange=null,n())}:i.onload=function(){n()});r&&"function"==typeof r&&(i.onerror=function(){r()});i.src=t;var o=a.getElementsByTagName("head");(o=o.length?o:a.getElementsByTagName("body")).length&&(o=o[0]).insertBefore(i,o.firstChild);return i},t.d=function(t){var n={hb_adid:"adId",hb_cache_host:"cacheHost",hb_cache_path:"cachePath",hb_cache_id:"uuid",hb_format:"mediaType",hb_env:"env",hb_size:"size",hb_pb:"hbPb"};function e(e){return!(!t[e]||!(function(e){return i(e,"Object")}(t[e])&&0<Object.keys(t[e]).length||o(t[e])&&""!==t[e]))}var r={},a={};e("targetingMap")?a=function(t){var n={};return Object.keys(t).forEach(function(e){Array.isArray(t[e])&&0<t[e].length&&(n[e]=t[e][0])}),n}(t.targetingMap):e("targetingKeywords")&&(a=function(e){var a={},t=e.split(",");return 0<t.length&&t.forEach(function(e){var t=e.split(":");if(2===t.length){var n=t[0],r=t[1];a[n]=r}}),a}(t.targetingKeywords));return function(t){Object.keys(t).forEach(function(e){r[n[e]||e]=t[e]})}(a),Object.keys(t).forEach(function(e){"targetingMap"!==e&&"targetingKeywords"!==e&&o(t[e])&&""!==t[e]&&(r[e]=t[e])}),r},t.b=function(e){var t=document.createElement("a");return t.href=decodeURIComponent(e),{href:t.href,protocol:(t.protocol||"").replace(/:$/,""),hostname:t.hostname,port:+t.port,pathname:t.pathname.replace(/^(?!\/)/,"/"),hash:(t.hash||"").replace(/^#/,""),host:(t.host||window.location.host).replace(/:(443|80)$/,"")}};n(2);function i(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function o(e){return i(e,"String")}},function(e,t,n){"use strict";t.a=function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:window,o=function(){if(null==t)return null;var e=Object(r.b)(t);return e.protocol+"://"+e.host}();function e(e){return e&&e.frames&&e.frames.__pb_locator__}var c=i.parent;try{for(;null!=c&&c!==i.top&&!e(c);)c=c.parent;e(c)||(c=i.parent)}catch(e){}return function(e,t){if(null==o)throw new Error("Missing pubUrl");var n;if(e=JSON.stringify(e),null==t)c.postMessage(e,o);else{var r=new MessageChannel;(n=r.port1).onmessage=t,i.addEventListener("message",a),c.postMessage(e,o,[r.port2])}return function(){null!=n&&(i.removeEventListener("message",a),n.onmessage=null,n=null)};function a(e){(e.origin||e.originalEvent&&e.originalEvent.origin)===o&&t(e)}}},t.b=function(e,t){return a({adId:e,message:i,event:t?c:o},t?{info:t}:null)};var r=n(0);function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var i="Prebid Event",o="adRenderSucceeded",c="adRenderFailed"},function(e,t,n){"use strict";function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,a=!1,i=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function a(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=e.createElement("iframe");return Object.entries(r({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];a.setAttribute(n,r)}),a}t.b=a,t.a=function(e,t){return a(document,{height:e,width:t})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4);window.pbNativeTag=window.pbNativeTag||{};var a=Object(r.a)(window);window.pbNativeTag.startTrackers=a.startTrackers},function(e,t,n){"use strict";t.a=function(a){var i;function o(e){return a.document.getElementsByClassName(e)||[]}function c(e){return e.attributes&&e.attributes[h]&&e.attributes[h].value||""}function s(e,t){l(t,"click")}function u(n){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:s;n=n||o(p);for(var e=function(e){var t=c(n[e]);n[e].addEventListener("pointerdown",function(e){r(e,t)},!0)},t=0;t<n.length;t++)e(t)}function l(e,t){if(""===e)console.warn("Prebid tracking event was missing 'adId'. Was adId macro set in the HTML attribute "+h+"on the ad's anchor element");else{var n={message:"Prebid Native",adId:e};"click"===t&&(n.action="click"),i(n)}}return{startTrackers:function(e){var t=Object(d.d)(e);i=Object(v.a)(t.pubUrl,a);var n=Object(f.a)(window,t.pubUrl);if(t&&"mobile-app"===t.env){n.loadMobileAssets(t,function(e){var t=0<arguments.length&&void 0!==e?e:{},n=t.clickTrackers,r=t.impTrackers,a=t.eventtrackers;u(!1,function(e){(e||[]).forEach(d.e)}.bind(null,n)),(r||[]).forEach(d.e),a.filter(function(e){return 1===e.event&&1===e.method}).map(function(e){return e.url}).forEach(d.e),a.filter(function(e){return 1===e.event&&2===e.method}).map(function(e){return e.url}).forEach(function(e){return loadScript(document,e)})})}else{var r=o(p);n.loadAssets(function(e){return 0<e.length&&e[0].attributes&&e[0].attributes[h]&&e[0].attributes[h].value||""}(r),u),u(r,s),0<r.length&&function(e){for(var t=0;t<e.length;t++){l(c(e[t]),"impression")}}(r)}}}};var d=n(0),f=n(5),v=n(1),p="pb-click",h="pbAdId"},function(e,t,n){"use strict";t.a=function(s,e){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:w.a;e.clickUrlUnesc&&e.clickUrlUnesc!==N&&(I=e.clickUrlUnesc);var u,l,a,n=e.pubUrl,d=t(n,s),f=0;function v(){null!=a&&(a(),a=null)}function i(e){var t;try{t=JSON.parse(e)}catch(e){console.log("Error parsing response from cache host: ".concat(e))}return t}function r(e){var t=e.uuid,n="".concat(function(e,t){var n=void 0===t||""===t?j:t;return"https://".concat(void 0===e||""===e?A:e).concat(n)}(e.cacheHost,e.cachePath),"?uuid=").concat(t);Object(_.c)(n,function(e){var t=i(e);if(t&&t.adm){var n=i(t.adm);if(n&&n.assets){var r=function(e){var t,n=[];return e.assets.forEach(function(e){e.img?T.image[e.img.type]?n.push({key:T.image[e.img.type],value:e.img.url}):console.log("ERROR: Invalid image type for image asset"):e.data?T.data[e.data.type]?n.push({key:T.data[e.data.type],value:e.data.value}):console.log("ERROR: Invalid data type for data asset"):e.title&&n.push({key:"title",value:e.title.text})}),e.link&&(e.link.clicktrackers&&(t=e.link.clicktrackers),n.push({key:"clickUrl",value:e.link.url})),{assets:n,clicktrackers:t,imptrackers:e.imptrackers,eventtrackers:e.eventtrackers}}(n),a=g(s.document.body.innerHTML,r);s.document.body.innerHTML=a,u&&u({clickTrackers:r.clicktrackers,impTrackers:r.imptrackers,eventtrackers:r.eventtrackers})}}})}function p(){return void 0!==s.pbNativeData}function h(e,t){return t&&!p()?"".concat(e,":").concat(t):p()?"##".concat(e,"##"):e}function c(s){for(var e=arguments.length,u=new Array(1<e?e-1:0),t=1;t<e;t++)u[t-1]=arguments[t];return Object.values(E).reduce(function(e,t){var n=h(t,s),r=!0,a=!1,i=void 0;try{for(var o,c=u.filter(Boolean)[Symbol.iterator]();!(r=(o=c.next()).done);r=!0){if(0<=o.value.indexOf(n)){e.push(t);break}}}catch(e){a=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw i}}return e},[])}function o(e){return c(e,s.document.body.innerHTML,s.document.head.innerHTML)}function b(c){return function(e){try{var t={};try{t=JSON.parse(e.data)}catch(e){if(10<f++)throw v(),e;return}if("assetResponse"===t.message&&t.adId===c){if(Object(O.a)(t))return void Object(O.b)(c,t,d,s);t.clickUrlUnesc=I;var n=s.document.body.innerHTML,r=s.document.head.innerHTML;o=u,u=function(){Object(y.b)(t.adId,d),Object(y.a)(t.adId,d),o&&o()},r&&(s.document.head.innerHTML=g(r,t)),t.assets=t.assets||[];var a=t.assets;if(t.ortb&&(a.ortb=t.ortb),t.hasOwnProperty("rendererUrl")&&t.rendererUrl||p()&&s.pbNativeData.hasOwnProperty("rendererUrl"))if(s.renderAd)m(s.renderAd&&s.renderAd(a)||"",t);else document.getElementById("pb-native-renderer")?document.getElementById("pb-native-renderer").addEventListener("load",function(){m(s.renderAd&&s.renderAd(a)||"",t)}):Object(_.a)(s,p()&&s.pbNativeData.hasOwnProperty("rendererUrl")&&s.pbNativeData.rendererUrl||t.rendererUrl,function(){m(s.renderAd&&s.renderAd(a)||"",t)});else if(t.hasOwnProperty("adTemplate")&&t.adTemplate||p()&&s.pbNativeData.hasOwnProperty("adTemplate")){m(g(p()&&s.pbNativeData.hasOwnProperty("adTemplate")&&s.pbNativeData.adTemplate||t.adTemplate,t),t)}else{var i=g(n,t);s.document.body.innerHTML=i,u&&u(),v()}}}catch(e){l&&l(e)}var o}}function m(e,t){if(!Object(k.a)(window)){var n=function(e){try{for(var t,n=e;n!==e.top;){if(!(t=n.parent).frames||!t.frames.length)return null;for(var r=0;r<t.frames.length;r++)if(t.frames[r]===n){if(!t.document)return null;var a=!0,i=!1,o=void 0;try{for(var c,s=t.document.getElementsByTagName("iframe")[Symbol.iterator]();!(a=(c=s.next()).done);a=!0){var u=c.value;if(!u.contentWindow)return null;if(u.contentWindow===n)return u.parentElement}}catch(e){i=!0,o=e}finally{try{a||null==s.return||s.return()}finally{if(i)throw o}}}}}catch(e){}}(s);if(n&&n.children&&n.children[0]){var r=n.children[0];if("1"===r.width&&"1"===r.height){var a=n.getBoundingClientRect().width;s.document.body.style.width="".concat(a,"px")}}}e=e.replaceAll(N,t.clickUrlUnesc||""),s.document.body.innerHTML+=e,u&&u(),v();function i(){return function(e,t,n){d({message:"Prebid Native",action:"resizeNativeHeight",adId:e,height:t,width:n})}(t.adId,document.body.clientHeight||document.body.offsetHeight,1<document.body.clientWidth?document.body.clientWidth:void 0)}"complete"===document.readyState?i():window.onload=i,"function"==typeof window.postRenderAd&&window.postRenderAd(t)}function g(a,e){var i=e.assets,t=e.ortb,o=e.adId;if(t)a=function(t,e){return e.assets.forEach(function(e){t=t.replaceAll("##hb_native_asset_id_".concat(e.id,"##"),function(e){return e.img?e.img.url:e.data?e.data.value:e.title?e.title.text:e.video?e.video.vasttag:""}(e)),e.link&&e.link.url&&(t=t.replaceAll("##hb_native_asset_link_id_".concat(e.id,"##"),e.link.url))}),t=t.replaceAll(/##hb_native_asset_id_\d+##/gm,""),e.privacy&&(t=t.replaceAll("##hb_native_privacy##",e.privacy)),e.link&&(t=t.replaceAll("##hb_native_linkurl##",e.link.url)),t}(a,t);else if(!Array.isArray(i))return a;return i=i||[],c(o,a).forEach(function(t){var e=h(t,o),n=new RegExp(e,"g"),r=i.find(function(e){return t===E[e.key]});a=a.replace(n,r?r.value:"")}),a}return{loadAssets:function(e,t,n){l=n;var r=o(e);p()&&s.pbNativeData.hasOwnProperty("assetsToReplace")&&s.pbNativeData.assetsToReplace.forEach(function(e){var t=e.match(/hb_native_/i)?e:E[e];t&&r.push(t)}),p()&&s.pbNativeData.hasOwnProperty("requestAllAssets")&&s.pbNativeData.requestAllAssets?(u=t,a=function(e){return d({message:"Prebid Native",action:"allAssetRequest",adId:e},b(e))}(e)):0<r.length?(u=t,a=function(e,t){return d({message:"Prebid Native",action:"assetRequest",adId:e,assets:t},b(e))}(e,r)):n&&n(new Error("No assets to load: no placeholders found in template"))},loadMobileAssets:function(e,t){0<o().length&&(u=t,r(e))}}};var y=n(6),_=n(0),w=n(1),k=n(7),O=n(8),E={title:"hb_native_title",body:"hb_native_body",body2:"hb_native_body2",privacyLink:"hb_native_privacy",privacyIcon:"hb_native_privicon",sponsoredBy:"hb_native_brand",image:"hb_native_image",icon:"hb_native_icon",clickUrl:"hb_native_linkurl",displayUrl:"hb_native_displayurl",cta:"hb_native_cta",rating:"hb_native_rating",address:"hb_native_address",downloads:"hb_native_downloads",likes:"hb_native_likes",phone:"hb_native_phone",price:"hb_native_price",salePrice:"hb_native_saleprice",rendererUrl:"hb_renderer_url"},T={image:{1:"icon",3:"image"},data:{1:"sponsoredBy",2:"body",3:"rating",4:"likes",5:"downloads",6:"price",7:"salePrice",8:"phone",9:"address",10:"body2",11:"displayUrl",12:"cta"}},A="prebid.adnxs.com",j="/pbc/v1/cache",N="%%CLICK_URL_UNESC%%",I=""},function(e,t,n){"use strict";t.b=function(e,t){t({message:"Prebid Native",action:"fireNativeImpressionTrackers",adId:e})},t.a=function(e,r){for(var a={message:"Prebid Native",action:"click",adId:e},t=document.getElementsByClassName(i)||[],n=0;n<t.length;n++)t[n].addEventListener("pointerdown",function(e){var t=e.target,n=t&&t.getAttribute(o);a.assetId=n,r(a)},!0)};n(0);var i="pb-click",o="hb_native_asset_id"},function(e,t,n){"use strict";t.a=function(e){return!(!e.$sf||!e.$sf.ext)}},function(e,t,n){"use strict";t.a=function(e){return"string"==typeof e.renderer&&parseInt(e.rendererVersion,10)>=a},t.b=function(i,o,c){var s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:window,u=4<arguments.length&&void 0!==arguments[4]?arguments[4]:r.b,l=u(s.document,{width:0,height:0,style:"display: none",srcdoc:"<script>".concat(o.renderer,"<\/script>"),name:"__pb_renderer__"});return new Promise(function(t,n){function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};c(Object(d.b)(i,{reason:e.reason||"exception",message:e.message})),e.stack&&console.error(e),n(e)}function a(e){return function(){try{return e.apply(this,arguments)}catch(e){r(e)}}}l.onload=a(function(){var e=l.contentWindow;e.Promise.resolve(e.render(o,{mkFrame:u,sendMessage:function(e,t,n){return c(f({adId:i,message:e},t),n?a(n):void 0)}},s)).then(function(){return c(Object(d.b)(i))},r).then(t)}),s.document.body.appendChild(l)})};var r=n(2),d=n(1);function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var a=3}]);
|
package/dist/native.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* prebid-universal-creative v1.17.
|
2
|
-
Updated : 2025-03-
|
1
|
+
/* prebid-universal-creative v1.17.1
|
2
|
+
Updated : 2025-03-19 */
|
3
3
|
!function(n){var r={};function a(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=n,a.c=r,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=3)}([function(e,t,n){"use strict";t.c=function(e,t){var n=new XMLHttpRequest;n.addEventListener("load",function(){t(n.responseText)}),n.open("GET",e),n.send()},t.a=function(e,t,n,r){var a=e.document,i=a.createElement("script");i.type="text/javascript",n&&"function"==typeof n&&(i.readyState?i.onreadystatechange=function(){"loaded"!==i.readyState&&"complete"!==i.readyState||(i.onreadystatechange=null,n())}:i.onload=function(){n()});r&&"function"==typeof r&&(i.onerror=function(){r()});i.src=t;var o=a.getElementsByTagName("head");(o=o.length?o:a.getElementsByTagName("body")).length&&(o=o[0]).insertBefore(i,o.firstChild);return i},t.b=function(e){var t=document.createElement("a");return t.href=decodeURIComponent(e),{href:t.href,protocol:(t.protocol||"").replace(/:$/,""),hostname:t.hostname,port:+t.port,pathname:t.pathname.replace(/^(?!\/)/,"/"),hash:(t.hash||"").replace(/^#/,""),host:(t.host||window.location.host).replace(/:(443|80)$/,"")}};n(2)},function(e,t,n){"use strict";t.a=function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:window,o=function(){if(null==t)return null;var e=Object(r.b)(t);return e.protocol+"://"+e.host}();function e(e){return e&&e.frames&&e.frames.__pb_locator__}var c=i.parent;try{for(;null!=c&&c!==i.top&&!e(c);)c=c.parent;e(c)||(c=i.parent)}catch(e){}return function(e,t){if(null==o)throw new Error("Missing pubUrl");var n;if(e=JSON.stringify(e),null==t)c.postMessage(e,o);else{var r=new MessageChannel;(n=r.port1).onmessage=t,i.addEventListener("message",a),c.postMessage(e,o,[r.port2])}return function(){null!=n&&(i.removeEventListener("message",a),n.onmessage=null,n=null)};function a(e){(e.origin||e.originalEvent&&e.originalEvent.origin)===o&&t(e)}}},t.b=function(e,t){return a({adId:e,message:i,event:t?c:o},t?{info:t}:null)};var r=n(0);function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var i="Prebid Event",o="adRenderSucceeded",c="adRenderFailed"},function(e,t,n){"use strict";function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,a=!1,i=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function a(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=e.createElement("iframe");return Object.entries(r({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];a.setAttribute(n,r)}),a}t.b=a,t.a=function(e,t){return a(document,{height:e,width:t})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),a=Object(r.a)(window);window.ucTag=window.ucTag||{},window.ucTag.renderAd=a.renderNativeAd},function(e,t,n){"use strict";t.a=function(i){var o,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:d.a,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:r.a;return{renderNativeAd:function(e,t){function n(e,t){o(Object(d.b)(e,t))}window.pbNativeData=t,o=c(t.pubUrl,i);try{var r=s(window,t);if(null!=t.adId){if(t.hasOwnProperty("rendererUrl")&&!t.rendererUrl.match(/##.*##/i)){var a=e.createElement("SCRIPT");a.src=t.rendererUrl,a.id="pb-native-renderer",e.body.appendChild(a)}r.loadAssets(t.adId,function(){n(t.adId)},function(e){n(t.adId,{reason:"exception",message:e.message})})}else n(null,{reason:"missingDocOrAdid"}),console.warn("Prebid Native Tag object was missing 'adId'.")}catch(e){n(t&&t.adId,{reason:"exception",message:e.message}),console.error("Error rendering ad",e)}}}};var r=n(5),d=n(1)},function(e,t,n){"use strict";t.a=function(s,e){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:w.a;e.clickUrlUnesc&&e.clickUrlUnesc!==I&&(U=e.clickUrlUnesc);var d,l,a,n=e.pubUrl,u=t(n,s),f=0;function v(){null!=a&&(a(),a=null)}function i(e){var t;try{t=JSON.parse(e)}catch(e){console.log("Error parsing response from cache host: ".concat(e))}return t}function r(e){var t=e.uuid,n="".concat(function(e,t){var n=void 0===t||""===t?T:t;return"https://".concat(void 0===e||""===e?N:e).concat(n)}(e.cacheHost,e.cachePath),"?uuid=").concat(t);Object(_.c)(n,function(e){var t=i(e);if(t&&t.adm){var n=i(t.adm);if(n&&n.assets){var r=function(e){var t,n=[];return e.assets.forEach(function(e){e.img?E.image[e.img.type]?n.push({key:E.image[e.img.type],value:e.img.url}):console.log("ERROR: Invalid image type for image asset"):e.data?E.data[e.data.type]?n.push({key:E.data[e.data.type],value:e.data.value}):console.log("ERROR: Invalid data type for data asset"):e.title&&n.push({key:"title",value:e.title.text})}),e.link&&(e.link.clicktrackers&&(t=e.link.clicktrackers),n.push({key:"clickUrl",value:e.link.url})),{assets:n,clicktrackers:t,imptrackers:e.imptrackers,eventtrackers:e.eventtrackers}}(n),a=y(s.document.body.innerHTML,r);s.document.body.innerHTML=a,d&&d({clickTrackers:r.clicktrackers,impTrackers:r.imptrackers,eventtrackers:r.eventtrackers})}}})}function p(){return void 0!==s.pbNativeData}function h(e,t){return t&&!p()?"".concat(e,":").concat(t):p()?"##".concat(e,"##"):e}function c(s){for(var e=arguments.length,d=new Array(1<e?e-1:0),t=1;t<e;t++)d[t-1]=arguments[t];return Object.values(A).reduce(function(e,t){var n=h(t,s),r=!0,a=!1,i=void 0;try{for(var o,c=d.filter(Boolean)[Symbol.iterator]();!(r=(o=c.next()).done);r=!0){if(0<=o.value.indexOf(n)){e.push(t);break}}}catch(e){a=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw i}}return e},[])}function o(e){return c(e,s.document.body.innerHTML,s.document.head.innerHTML)}function b(c){return function(e){try{var t={};try{t=JSON.parse(e.data)}catch(e){if(10<f++)throw v(),e;return}if("assetResponse"===t.message&&t.adId===c){if(Object(O.a)(t))return void Object(O.b)(c,t,u,s);t.clickUrlUnesc=U;var n=s.document.body.innerHTML,r=s.document.head.innerHTML;o=d,d=function(){Object(g.b)(t.adId,u),Object(g.a)(t.adId,u),o&&o()},r&&(s.document.head.innerHTML=y(r,t)),t.assets=t.assets||[];var a=t.assets;if(t.ortb&&(a.ortb=t.ortb),t.hasOwnProperty("rendererUrl")&&t.rendererUrl||p()&&s.pbNativeData.hasOwnProperty("rendererUrl"))if(s.renderAd)m(s.renderAd&&s.renderAd(a)||"",t);else document.getElementById("pb-native-renderer")?document.getElementById("pb-native-renderer").addEventListener("load",function(){m(s.renderAd&&s.renderAd(a)||"",t)}):Object(_.a)(s,p()&&s.pbNativeData.hasOwnProperty("rendererUrl")&&s.pbNativeData.rendererUrl||t.rendererUrl,function(){m(s.renderAd&&s.renderAd(a)||"",t)});else if(t.hasOwnProperty("adTemplate")&&t.adTemplate||p()&&s.pbNativeData.hasOwnProperty("adTemplate")){m(y(p()&&s.pbNativeData.hasOwnProperty("adTemplate")&&s.pbNativeData.adTemplate||t.adTemplate,t),t)}else{var i=y(n,t);s.document.body.innerHTML=i,d&&d(),v()}}}catch(e){l&&l(e)}var o}}function m(e,t){if(!Object(k.a)(window)){var n=function(e){try{for(var t,n=e;n!==e.top;){if(!(t=n.parent).frames||!t.frames.length)return null;for(var r=0;r<t.frames.length;r++)if(t.frames[r]===n){if(!t.document)return null;var a=!0,i=!1,o=void 0;try{for(var c,s=t.document.getElementsByTagName("iframe")[Symbol.iterator]();!(a=(c=s.next()).done);a=!0){var d=c.value;if(!d.contentWindow)return null;if(d.contentWindow===n)return d.parentElement}}catch(e){i=!0,o=e}finally{try{a||null==s.return||s.return()}finally{if(i)throw o}}}}}catch(e){}}(s);if(n&&n.children&&n.children[0]){var r=n.children[0];if("1"===r.width&&"1"===r.height){var a=n.getBoundingClientRect().width;s.document.body.style.width="".concat(a,"px")}}}e=e.replaceAll(I,t.clickUrlUnesc||""),s.document.body.innerHTML+=e,d&&d(),v();function i(){return function(e,t,n){u({message:"Prebid Native",action:"resizeNativeHeight",adId:e,height:t,width:n})}(t.adId,document.body.clientHeight||document.body.offsetHeight,1<document.body.clientWidth?document.body.clientWidth:void 0)}"complete"===document.readyState?i():window.onload=i,"function"==typeof window.postRenderAd&&window.postRenderAd(t)}function y(a,e){var i=e.assets,t=e.ortb,o=e.adId;if(t)a=function(t,e){return e.assets.forEach(function(e){t=t.replaceAll("##hb_native_asset_id_".concat(e.id,"##"),function(e){return e.img?e.img.url:e.data?e.data.value:e.title?e.title.text:e.video?e.video.vasttag:""}(e)),e.link&&e.link.url&&(t=t.replaceAll("##hb_native_asset_link_id_".concat(e.id,"##"),e.link.url))}),t=t.replaceAll(/##hb_native_asset_id_\d+##/gm,""),e.privacy&&(t=t.replaceAll("##hb_native_privacy##",e.privacy)),e.link&&(t=t.replaceAll("##hb_native_linkurl##",e.link.url)),t}(a,t);else if(!Array.isArray(i))return a;return i=i||[],c(o,a).forEach(function(t){var e=h(t,o),n=new RegExp(e,"g"),r=i.find(function(e){return t===A[e.key]});a=a.replace(n,r?r.value:"")}),a}return{loadAssets:function(e,t,n){l=n;var r=o(e);p()&&s.pbNativeData.hasOwnProperty("assetsToReplace")&&s.pbNativeData.assetsToReplace.forEach(function(e){var t=e.match(/hb_native_/i)?e:A[e];t&&r.push(t)}),p()&&s.pbNativeData.hasOwnProperty("requestAllAssets")&&s.pbNativeData.requestAllAssets?(d=t,a=function(e){return u({message:"Prebid Native",action:"allAssetRequest",adId:e},b(e))}(e)):0<r.length?(d=t,a=function(e,t){return u({message:"Prebid Native",action:"assetRequest",adId:e,assets:t},b(e))}(e,r)):n&&n(new Error("No assets to load: no placeholders found in template"))},loadMobileAssets:function(e,t){0<o().length&&(d=t,r(e))}}};var g=n(6),_=n(0),w=n(1),k=n(7),O=n(8),A={title:"hb_native_title",body:"hb_native_body",body2:"hb_native_body2",privacyLink:"hb_native_privacy",privacyIcon:"hb_native_privicon",sponsoredBy:"hb_native_brand",image:"hb_native_image",icon:"hb_native_icon",clickUrl:"hb_native_linkurl",displayUrl:"hb_native_displayurl",cta:"hb_native_cta",rating:"hb_native_rating",address:"hb_native_address",downloads:"hb_native_downloads",likes:"hb_native_likes",phone:"hb_native_phone",price:"hb_native_price",salePrice:"hb_native_saleprice",rendererUrl:"hb_renderer_url"},E={image:{1:"icon",3:"image"},data:{1:"sponsoredBy",2:"body",3:"rating",4:"likes",5:"downloads",6:"price",7:"salePrice",8:"phone",9:"address",10:"body2",11:"displayUrl",12:"cta"}},N="prebid.adnxs.com",T="/pbc/v1/cache",I="%%CLICK_URL_UNESC%%",U=""},function(e,t,n){"use strict";t.b=function(e,t){t({message:"Prebid Native",action:"fireNativeImpressionTrackers",adId:e})},t.a=function(e,r){for(var a={message:"Prebid Native",action:"click",adId:e},t=document.getElementsByClassName(i)||[],n=0;n<t.length;n++)t[n].addEventListener("pointerdown",function(e){var t=e.target,n=t&&t.getAttribute(o);a.assetId=n,r(a)},!0)};n(0);var i="pb-click",o="hb_native_asset_id"},function(e,t,n){"use strict";t.a=function(e){return!(!e.$sf||!e.$sf.ext)}},function(e,t,n){"use strict";t.a=function(e){return"string"==typeof e.renderer&&parseInt(e.rendererVersion,10)>=a},t.b=function(i,o,c){var s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:window,d=4<arguments.length&&void 0!==arguments[4]?arguments[4]:r.b,l=d(s.document,{width:0,height:0,style:"display: none",srcdoc:"<script>".concat(o.renderer,"<\/script>"),name:"__pb_renderer__"});return new Promise(function(t,n){function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};c(Object(u.b)(i,{reason:e.reason||"exception",message:e.message})),e.stack&&console.error(e),n(e)}function a(e){return function(){try{return e.apply(this,arguments)}catch(e){r(e)}}}l.onload=a(function(){var e=l.contentWindow;e.Promise.resolve(e.render(o,{mkFrame:d,sendMessage:function(e,t,n){return c(f({adId:i,message:e},t),n?a(n):void 0)}},s)).then(function(){return c(Object(u.b)(i))},r).then(t)}),s.document.body.appendChild(l)})};var r=n(2),u=n(1);function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var a=3}]);
|
package/dist/uid.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* v1.17.
|
2
|
-
Updated : 2025-03-
|
1
|
+
/* v1.17.1
|
2
|
+
Updated : 2025-03-19 */
|
3
3
|
!function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBuyerUids=c,e.loadData=i;var o=n(1);window.pbs=window.pbs||{},window.pbs.getBuyerUids=c;var r="https://prebid.adnxs.com/pbs/v1/getuids",s="ssp-buyeruids",u=14;function c(e){var t=o.b(s);if(a(t))i(e);else{try{t=JSON.parse(t)}catch(t){return void e(t,null)}delete t.lastUpdated,e(null,t)}}function i(e){a(o.b(s))&&o.a(r,function(t){try{(t=JSON.parse(t)).lastUpdated=o.d(),o.c(s,JSON.stringify(t)),delete t.lastUpdated,e(null,t)}catch(t){e(t,null)}},null,{withCredentials:!0})}function a(t){return!t||o.d()>t.lastUpdated+24*u*60*60*1e3}i(function(){})},function(t,e,n){"use strict";function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){try{return!!window.localStorage}catch(t){console.log("Local storage api disabled")}}e.c=function(t,e){o()&&window.localStorage.setItem(t,e)},e.b=function(t){if(o())return window.localStorage.getItem(t)},e.d=function(){return(new Date).getTime()},e.a=function(t,e,n){var o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};try{var r,s=o.method||(n?"POST":"GET"),u="object"===a(e)?e:{success:function(){console.log("xhr success")},error:function(t){console.log("xhr error",null,t)}};if("function"==typeof e&&(u.success=e),(r=new window.XMLHttpRequest).onreadystatechange=function(){if(4===r.readyState){var t=r.status;200<=t&&t<300||304===t?u.success(r.responseText,r):u.error(r.statusText,r)}},r.ontimeout=function(){console.log("xhr timeout after ",r.timeout,"ms")},"GET"===s&&n){var c=parseURL(t,o);i(c.search,n),t=formatURL(c)}r.open(s,t),r.timeout=3e3,o.withCredentials&&(r.withCredentials=!0),o.preflight&&r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r.setRequestHeader("Content-Type",o.contentType||"text/plain"),"POST"===s&&n?r.send(n):r.send()}catch(t){console.log("xhr construction",t)}}}]);
|
package/dist/video.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* prebid-universal-creative v1.17.
|
2
|
-
Updated : 2025-03-
|
1
|
+
/* prebid-universal-creative v1.17.1
|
2
|
+
Updated : 2025-03-19 */
|
3
3
|
!function(t){var r={};function o(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=t,o.c=r,o.d=function(e,n,t){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="",o(o.s=3)}([function(e,n,t){"use strict";function a(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var t=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return t}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function r(){return(r=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function o(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=e.createElement("iframe");return Object.entries(r({frameborder:0,scrolling:"no",marginheight:0,marginwidth:0,TOPMARGIN:0,LEFTMARGIN:0,allowtransparency:"true"},n)).forEach(function(e){var n=a(e,2),t=n[0],r=n[1];o.setAttribute(t,r)}),o}n.c=o,n.a=function(e,n){return o(document,{height:e,width:n})},n.b=function(e,n,t){var r;n=n||document,r=t?n.getElementsByTagName(t):n.getElementsByTagName("head");try{(r=r.length?r:n.getElementsByTagName("body")).length&&(r=r[0]).insertBefore(e,r.firstChild)}catch(e){}}},function(e,n,t){"use strict";n.b=function(n){var t={hb_adid:"adId",hb_cache_host:"cacheHost",hb_cache_path:"cachePath",hb_cache_id:"uuid",hb_format:"mediaType",hb_env:"env",hb_size:"size",hb_pb:"hbPb"};function e(e){return!(!n[e]||!(function(e){return a(e,"Object")}(n[e])&&0<Object.keys(n[e]).length||i(n[e])&&""!==n[e]))}var r={},o={};e("targetingMap")?o=function(n){var t={};return Object.keys(n).forEach(function(e){Array.isArray(n[e])&&0<n[e].length&&(t[e]=n[e][0])}),t}(n.targetingMap):e("targetingKeywords")&&(o=function(e){var o={},n=e.split(",");return 0<n.length&&n.forEach(function(e){var n=e.split(":");if(2===n.length){var t=n[0],r=n[1];o[t]=r}}),o}(n.targetingKeywords));return function(n){Object.keys(n).forEach(function(e){r[t[e]||e]=n[e]})}(o),Object.keys(n).forEach(function(e){"targetingMap"!==e&&"targetingKeywords"!==e&&i(n[e])&&""!==n[e]&&(r[e]=n[e])}),r},n.a=function(e){var n=document.createElement("a");return n.href=decodeURIComponent(e),{href:n.href,protocol:(n.protocol||"").replace(/:$/,""),hostname:n.hostname,port:+n.port,pathname:n.pathname.replace(/^(?!\/)/,"/"),hash:(n.hash||"").replace(/^#/,""),host:(n.host||window.location.host).replace(/:(443|80)$/,"")}};t(0);function a(e,n){return Object.prototype.toString.call(e)==="[object "+n+"]"}function i(e){return a(e,"String")}},function(e,n,t){"use strict";n.a=function(n){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:window,i=function(){if(null==n)return null;var e=Object(r.a)(n);return e.protocol+"://"+e.host}();function e(e){return e&&e.frames&&e.frames.__pb_locator__}var c=a.parent;try{for(;null!=c&&c!==a.top&&!e(c);)c=c.parent;e(c)||(c=a.parent)}catch(e){}return function(e,n){if(null==i)throw new Error("Missing pubUrl");var t;if(e=JSON.stringify(e),null==n)c.postMessage(e,i);else{var r=new MessageChannel;(t=r.port1).onmessage=n,a.addEventListener("message",o),c.postMessage(e,i,[r.port2])}return function(){null!=t&&(a.removeEventListener("message",o),t.onmessage=null,t=null)};function o(e){(e.origin||e.originalEvent&&e.originalEvent.origin)===i&&n(e)}}},n.b=function(e,n){return o({adId:e,message:a,event:n?c:i},n?{info:n}:null)};var r=t(1);function o(){return(o=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}var a="Prebid Event",i="adRenderSucceeded",c="adRenderFailed"},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t(4);window.ucTag=window.ucTag||{},window.ucTag.renderAd=r.a},function(e,n,t){"use strict";n.a=function(e,n){var t=Object(r.b)(n);Object(o.a)(window)?function(e,n){for(var t=!1,r=window,o=0;o<10;o++)if((r=r.parent).pbjs)try{r.pbjs.renderAd(e,n),t=!0;break}catch(e){continue}t||console.error("Unable to locate pbjs.renderAd function!")}(e,t.adId):function(l,d){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"",n=3<arguments.length?arguments[3]:void 0,t=l.location,r=e||l.location.hostname,o=t.protocol+"//"+r,f=Object(i.a)(n,l),h=function(e){return f(Object(i.b)(d,e))};function a(e){var n=e.message?"message":"data",t={};try{t=JSON.parse(e[n])}catch(e){return}if(t.message&&"Prebid Response"===t.message&&t.adId===d){if(Object(g.a)(t))return void Object(g.b)(d,t,f,l);try{var r=l.document.body,o=t.ad,a=t.adUrl,i=t.width,c=t.height;if("video"===t.mediaType)h({reason:"preventWritingOnMainDocument",message:"Cannot render video ad ".concat(d)}),console.log("Error trying to write ad.");else if(o){var s=Object(p.a)(t.height,t.width);r.appendChild(s),s.contentDocument.open(),s.contentDocument.write(o),s.contentDocument.close(),h()}else if(a){var u=Object(p.a)(c,i);u.style.display="inline",u.style.overflow="hidden",u.src=a,Object(p.b)(u,document,"body"),h()}else h({reason:"noAd",message:"No ad for ".concat(d)}),console.log("Error trying to write ad. No ad markup or adUrl for ".concat(d))}catch(e){h({reason:"exception",message:e.message}),console.log("Error in rendering ad",e)}}}f({message:"Prebid Request",adId:d,adServerDomain:o},a)}(window,t.adId,t.adServerDomain,t.pubUrl)};var r=t(1),o=t(5),p=t(0),i=t(2),g=t(6)},function(e,n,t){"use strict";n.a=function(e){var n=!1,t=e;for(;!n;){try{if(t.pbjs){n=!0;break}}catch(e){}if(t===window.top)break;t=t.parent}return n}},function(e,n,t){"use strict";n.a=function(e){return"string"==typeof e.renderer&&parseInt(e.rendererVersion,10)>=o},n.b=function(a,i,c){var s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:window,u=4<arguments.length&&void 0!==arguments[4]?arguments[4]:r.c,l=u(s.document,{width:0,height:0,style:"display: none",srcdoc:"<script>".concat(i.renderer,"<\/script>"),name:"__pb_renderer__"});return new Promise(function(n,t){function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};c(Object(d.b)(a,{reason:e.reason||"exception",message:e.message})),e.stack&&console.error(e),t(e)}function o(e){return function(){try{return e.apply(this,arguments)}catch(e){r(e)}}}l.onload=o(function(){var e=l.contentWindow;e.Promise.resolve(e.render(i,{mkFrame:u,sendMessage:function(e,n,t){return c(f({adId:a,message:e},n),t?o(t):void 0)}},s)).then(function(){return c(Object(d.b)(a))},r).then(n)}),s.document.body.appendChild(l)})};var r=t(0),d=t(2);function f(){return(f=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}var o=3}]);
|
package/package.json
CHANGED
package/src/adHtmlRender.js
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
-
export function writeAdHtml(markup, insertHTML =
|
1
|
+
export function writeAdHtml(markup, insertHTML = appendToBody) {
|
2
2
|
// remove <?xml> and <!doctype> tags
|
3
3
|
// https://github.com/prebid/prebid-universal-creative/issues/134
|
4
4
|
markup = markup.replace(/\<(\?xml|(\!DOCTYPE[^\>\[]+(\[[^\]]+)?))+[^>]+\>/gi, '');
|
5
|
+
insertHTML(markup);
|
6
|
+
}
|
5
7
|
|
8
|
+
function appendToBody(html) {
|
6
9
|
try {
|
7
|
-
|
10
|
+
const fragment = document.createRange().createContextualFragment(html);
|
11
|
+
document.body.append(fragment);
|
8
12
|
} catch (error) {
|
9
13
|
console.error(error);
|
10
14
|
}
|
11
|
-
}
|
15
|
+
}
|
@@ -284,15 +284,26 @@ describe("renderingManager", function () {
|
|
284
284
|
});
|
285
285
|
|
286
286
|
describe('writeAdHtml', () => {
|
287
|
+
|
288
|
+
afterEach(() => {
|
289
|
+
window.testScriptExecuted = undefined;
|
290
|
+
});
|
291
|
+
|
287
292
|
it('removes DOCTYPE from markup', () => {
|
288
293
|
const ps = sinon.stub();
|
289
294
|
writeAdHtml('<!DOCTYPE html><div>mock-ad</div>', ps);
|
290
|
-
sinon.assert.calledWith(ps,
|
295
|
+
sinon.assert.calledWith(ps, '<div>mock-ad</div>')
|
291
296
|
});
|
292
297
|
|
293
298
|
it('removes lowercase doctype from markup', () => {
|
294
299
|
const ps = sinon.stub();
|
295
300
|
writeAdHtml('<!doctype html><div>mock-ad</div>', ps);
|
296
|
-
sinon.assert.calledWith(ps,
|
301
|
+
sinon.assert.calledWith(ps, '<div>mock-ad</div>')
|
302
|
+
});
|
303
|
+
|
304
|
+
it('should execute script tag inserted into the body', () => {
|
305
|
+
const markup = '<script>window.testScriptExecuted=true;</script>'
|
306
|
+
writeAdHtml(markup);
|
307
|
+
expect(window.testScriptExecuted).to.equal(true);
|
297
308
|
});
|
298
309
|
})
|