prebid-universal-creative 1.15.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/issue_tracker.yml +32 -16
- package/README.md +2 -0
- package/dist/amp.js +3 -3
- package/dist/banner.js +3 -3
- package/dist/creative.js +3 -3
- package/dist/creative.max.js +11 -10
- package/dist/mobile.js +3 -3
- package/dist/native-render.js +3 -3
- package/dist/native-trk.js +3 -3
- package/dist/native.js +3 -3
- package/dist/uid.js +2 -2
- package/dist/video.js +3 -3
- package/gulpfile.js +3 -7
- package/karma.conf.maker.js +4 -6
- package/package.json +4 -4
- package/src/nativeAssetManager.js +91 -56
- package/src/nativeORTBTrackerManager.js +2 -2
- package/src/nativeRenderManager.js +47 -70
- package/src/postscribeRender.js +7 -5
- package/src/renderingManager.js +5 -0
- package/src/utils.js +0 -9
- package/test/spec/mobileAndAmpRender_spec.js +8 -0
- package/test/spec/nativeAssetManager_spec.js +226 -79
- package/test/spec/nativeORTBTrackerManager_spec.js +3 -19
- package/test/spec/nativeRenderManager_spec.js +77 -56
package/dist/mobile.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* prebid-universal-creative v1.
|
2
|
-
Updated : 2023-
|
3
|
-
!function(n){var r={};function o(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}o.m=n,o.c=r,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=1)}([function(t,e,n){"use strict";e.a=function(t,e){var n=document.createElement("iframe");return n.setAttribute("frameborder",0),n.setAttribute("scrolling","no"),n.setAttribute("marginheight",0),n.setAttribute("marginwidth",0),n.setAttribute("TOPMARGIN",0),n.setAttribute("LEFTMARGIN",0),n.setAttribute("allowtransparency","true"),n.setAttribute("width",e),n.setAttribute("height",t),n},e.b=function(t,e,n){var r;e=e||document,r=n?e.getElementsByTagName(n):e.getElementsByTagName("head");try{(r=r.length?r:e.getElementsByTagName("body")).length&&(r=r[0]).insertBefore(t,r.firstChild)}catch(t){}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2);window.ucTag=window.ucTag||{},window.ucTag.renderAd=function(t,e){Object(r.a)(e)}},function(t,e,n){"use strict";e.a=function(t){var e=Object(f.g)(t),n=e.cacheHost,r=e.cachePath,o=e.uuid,i=e.size,a=e.hbPb,s="Prebid_";if((o=o||"").substr(0,s.length)===s)!function(t){var e=window.localStorage.getItem(t);m(!0)(e)}(o),y(i);else{var c="".concat(function(t,e){var n=void 0===e||""===e?d:e;return"https://".concat(void 0===t||""===t?l:t).concat(n)}(n,r),"?uuid=").concat(o);y(i),Object(f.f)(c,m(Object(u.a)(e.env),a))}};var f=n(3),u=n(4),p=n(0),h=n(5),l="prebid.adnxs.com",d="/pbc/v1/cache";function y(t){if(t){var e=t.split("x").map(Number);!function(r,o){if(Object(u.b)(window)){var i=window.innerWidth,a=window.innerHeight;i===r&&a===o||(window.$sf.ext.register(r,o,function(t){var e=r-i,n=o-a;window.$sf.ext.expand({r:e,b:n,push:!0})}),window.parent.postMessage({sentinel:"amp",type:"embed-size",width:r,height:o},"*"))}}(e[0],e[1])}else console.log("Targeting key hb_size not found to resize creative")}function m(u,l){return function(t){var e=function(t){var e;try{e=JSON.parse(t)}catch(t){console.log("Error parsing response from cache host: ".concat(t))}return e}(t),n=e.price||l,r=Object(f.c)(e),o=e.width?e.width:e.w,i=e.height?e.height:e.h;if(e.wurl&&Object(f.h)(decodeURIComponent(e.wurl)),e.adm){if(e.adm=n?e.adm.replace("${AUCTION_PRICE}",n):e.adm.replace("${AUCTION_PRICE}",""),r+=u?g(e.adm,o,i):e.adm,e.nurl&&(r+=Object(f.a)(decodeURIComponent(e.nurl))),e.burl){var a=function(){Object(f.h)(e.burl)};if(u)Object(f.e)(window,"mraid.js",function(){!function(e){function n(t){0<t&&(mraid.removeEventListener("exposureChange",n),e())}function r(t){t&&(mraid.removeEventListener("viewableChange",r),e())}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()?e():mraid.addEventListener("viewableChange",r))}return!(!window.mraid||!window.MRAID_ENV)&&("loading"==mraid.getState()?mraid.addEventListener("ready",function t(){mraid.removeEventListener("ready",t),o()}):o(),!0)}(a)&&a()},a);else a()}Object(h.a)(r)}else if(e.nurl)if(u){r+=g(Object(f.e)(window,e.nurl).outerHTML,o,i),Object(h.a)(r)}else{var s=e.nurl,c=Object(f.b)(e);Object(p.b)(c,document,"body"),Object(f.i)(s,o,i)}}}function g(t,e,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(e,"px; height:").concat(n,'px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">').concat(t,"</div>\n </div>")}},function(t,e,n){"use strict";e.h=function(t,e){var n=new Image;e&&"function"==typeof e&&(n.addEventListener("load",e),n.addEventListener("error",e));n.src=t},e.a=function(t){if(!t)return"";var e=encodeURI(t);return'<div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="'.concat(e,'"></div>')},e.i=function(t,e,n){var r=o.a(n,e);r.src=t,document.body.appendChild(r)},e.f=function(t,e){var n=new XMLHttpRequest;n.addEventListener("load",function(){e(n.responseText)}),n.open("GET",t),n.send()},e.d=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===t?e:3&e|8).toString(16)})},e.e=function(t,e,n,r){var o=t.document,i=o.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=e;var a=o.getElementsByTagName("head");(a=a.length?a:o.getElementsByTagName("body")).length&&(a=a[0]).insertBefore(i,a.firstChild);return i},e.b=r,e.c=function(t){var e=r(t),n=document.createElement("div");return n.appendChild(e),n.innerHTML},e.g=function(e){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 t(t){return!(!e[t]||!(function(t){return i(t,"Object")}(e[t])&&0<Object.keys(e[t]).length||a(e[t])&&""!==e[t]))}var r={},o={};t("targetingMap")?o=function(e){var n={};return Object.keys(e).forEach(function(t){Array.isArray(e[t])&&0<e[t].length&&(n[t]=e[t][0])}),n}(e.targetingMap):t("targetingKeywords")&&(o=function(t){var o={},e=t.split(",");return 0<e.length&&e.forEach(function(t){var e=t.split(":");if(2===e.length){var n=e[0],r=e[1];o[n]=r}}),o}(e.targetingKeywords));return function(e){Object.keys(e).forEach(function(t){r[n[t]||t]=e[t]})}(o),Object.keys(e).forEach(function(t){"targetingMap"!==t&&"targetingKeywords"!==t&&a(e[t])&&""!==e[t]&&(r[t]=e[t])}),r};var o=n(0);function r(t){return document.createComment("Creative ".concat(t.crid," served by Prebid.js Header Bidding"))}function i(t,e){return Object.prototype.toString.call(t)==="[object "+e+"]"}function a(t){return i(t,"String")}},function(t,e,n){"use strict";e.b=function(t){return!(!t.$sf||!t.$sf.ext)},e.a=function(t){return t&&"mobile-app"===t}},function(t,e,n){"use strict";e.a=function(t){o()(document.body,t,{error:console.error})};var r=n(6),o=n.n(r)},function(t,e,n){var r;r=function(){return o={},n.m=r=[function(t,e,n){"use strict";var r,o=n(1),i=(r=o)&&r.__esModule?r:{default:r};t.exports=i.default},function(t,e,n){"use strict";e.__esModule=!0;var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=d;var r,o=n(2),c=(r=o)&&r.__esModule?r:{default:r},i=function(t){{if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}}(n(4));function u(){}var a={afterAsync:u,afterDequeue:u,afterStreamStart:u,afterWrite:u,autoFix:!0,beforeEnqueue:u,beforeWriteToken:function(t){return t},beforeWrite:function(t){return t},done:u,error:function(t){throw new Error(t.msg)},releaseAsync:!1},l=0,f=[],p=null;function h(){var t=f.shift();if(t){var e=i.last(t);e.afterDequeue(),t.stream=function(t,e,r){(p=new c.default(t,r)).id=l++,p.name=r.name||p.id,d.streams[p.name]=p;var n=t.ownerDocument,o={close:n.close,open:n.open,write:n.write,writeln:n.writeln};function i(t){t=r.beforeWrite(t),p.write(t),r.afterWrite(t)}s(n,{close:u,open:u,write:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return i(e.join(""))},writeln:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return i(e.join("")+"\n")}});var a=p.win.onerror||u;return p.win.onerror=function(t,e,n){r.error({msg:t+" - "+e+": "+n}),a.apply(p.win,[t,e,n])},p.write(e,function(){s(n,o),p.win.onerror=a,r.done(),p=null,h()}),p}.apply(void 0,t),e.afterStreamStart()}}function d(t,e,n){if(i.isFunction(n))n={done:n};else if("clear"===n)return f=[],p=null,void(l=0);n=i.defaults(n,a);var r=[t=/^#/.test(t)?window.document.getElementById(t.substr(1)):t.jquery?t[0]:t,e,n];return t.postscribe={cancel:function(){r.stream?r.stream.abort():r[1]=u}},n.beforeEnqueue(r),f.push(r),p||h(),t.postscribe}s(d,{streams:{},queue:f,WriteStream:c.default})},function(t,e,n){"use strict";e.__esModule=!0;var r,s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},o=n(3),i=(r=o)&&r.__esModule?r:{default:r},a=function(t){{if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}}(n(4));var l="data-ps-",f="ps-style",p="ps-script";function c(t,e){var n=l+e,r=t.getAttribute(n);return a.existy(r)?String(r):r}function u(t,e,n){var r=2<arguments.length&&void 0!==n?n:null,o=l+e;a.existy(r)&&""!==r?t.setAttribute(o,r):t.removeAttribute(o)}var h=(d.prototype.write=function(){var t;for((t=this.writeQueue).push.apply(t,arguments);!this.deferredRemote&&this.writeQueue.length;){var e=this.writeQueue.shift();a.isFunction(e)?this._callFunction(e):this._writeImpl(e)}},d.prototype._callFunction=function(t){var e={type:"function",value:t.name||t.toString()};this._onScriptStart(e),t.call(this.win,this.doc),this._onScriptDone(e)},d.prototype._writeImpl=function(t){this.parser.append(t);for(var e=void 0,n=void 0,r=void 0,o=[];(e=this.parser.readToken())&&!(n=a.isScript(e))&&!(r=a.isStyle(e));)(e=this.options.beforeWriteToken(e))&&o.push(e);0<o.length&&this._writeStaticTokens(o),n&&this._handleScriptToken(e),r&&this._handleStyleToken(e)},d.prototype._writeStaticTokens=function(t){var e=this._buildChunk(t);return e.actual?(e.html=this.proxyHistory+e.actual,this.proxyHistory+=e.proxy,this.proxyRoot.innerHTML=e.html,this._walkChunk(),e):null},d.prototype._buildChunk=function(t){for(var e=this.actuals.length,n=[],r=[],o=[],i=t.length,a=0;a<i;a++){var s=t[a],c=s.toString();if(n.push(c),s.attrs){if(!/^noscript$/i.test(s.tagName)){var u=e++;r.push(c.replace(/(\/?>)/," "+l+"id="+u+" $1")),s.attrs.id!==p&&s.attrs.id!==f&&o.push("atomicTag"===s.type?"":"<"+s.tagName+" "+l+"proxyof="+u+(s.unary?" />":">"))}}else r.push(c),o.push("endTag"===s.type?c:"")}return{tokens:t,raw:n.join(""),actual:r.join(""),proxy:o.join("")}},d.prototype._walkChunk=function(){for(var t=void 0,e=[this.proxyRoot];a.existy(t=e.shift());){var n=1===t.nodeType;if(!n||!c(t,"proxyof")){n&&u(this.actuals[c(t,"id")]=t,"id");var r=t.parentNode&&c(t.parentNode,"proxyof");r&&this.actuals[r].appendChild(t)}e.unshift.apply(e,a.toArray(t.childNodes))}},d.prototype._handleScriptToken=function(t){var e=this,n=this.parser.clear();n&&this.writeQueue.unshift(n),t.src=t.attrs.src||t.attrs.SRC,(t=this.options.beforeWriteToken(t))&&(t.src&&this.scriptStack.length?this.deferredRemote=t:this._onScriptStart(t),this._writeScriptToken(t,function(){e._onScriptDone(t)}))},d.prototype._handleStyleToken=function(t){var e=this.parser.clear();e&&this.writeQueue.unshift(e),t.type=t.attrs.type||t.attrs.TYPE||"text/css",(t=this.options.beforeWriteToken(t))&&this._writeStyleToken(t),e&&this.write()},d.prototype._writeStyleToken=function(t){var e=this._buildStyle(t);this._insertCursor(e,f),t.content&&(e.styleSheet&&!e.sheet?e.styleSheet.cssText=t.content:e.appendChild(this.doc.createTextNode(t.content)))},d.prototype._buildStyle=function(t){var n=this.doc.createElement(t.tagName);return n.setAttribute("type",t.type),a.eachKey(t.attrs,function(t,e){n.setAttribute(t,e)}),n},d.prototype._insertCursor=function(t,e){this._writeImpl('<span id="'+e+'"/>');var n=this.doc.getElementById(e);n&&n.parentNode.replaceChild(t,n)},d.prototype._onScriptStart=function(t){t.outerWrites=this.writeQueue,this.writeQueue=[],this.scriptStack.unshift(t)},d.prototype._onScriptDone=function(t){t===this.scriptStack[0]?(this.scriptStack.shift(),this.write.apply(this,t.outerWrites),!this.scriptStack.length&&this.deferredRemote&&(this._onScriptStart(this.deferredRemote),this.deferredRemote=null)):this.options.error({msg:"Bad script nesting or script finished twice"})},d.prototype._writeScriptToken=function(t,e){var n=this._buildScript(t),r=this._shouldRelease(n),o=this.options.afterAsync;t.src&&(n.src=t.src,this._scriptLoadHandler(n,r?o:function(){e(),o()}));try{this._insertCursor(n,p),n.src&&!r||e()}catch(t){this.options.error(t),e()}},d.prototype._buildScript=function(t){var n=this.doc.createElement(t.tagName);return a.eachKey(t.attrs,function(t,e){n.setAttribute(t,e)}),t.content&&(n.text=t.content),n},d.prototype._scriptLoadHandler=function(e,n){function r(){e=e.onload=e.onreadystatechange=e.onerror=null}var o=this.options.error;function t(){r(),null!=n&&n(),n=null}function i(t){r(),o(t),null!=n&&n(),n=null}function a(t,e){var n=t["on"+e];null!=n&&(t["_on"+e]=n)}a(e,"load"),a(e,"error"),s(e,{onload:function(){if(e._onload)try{e._onload.apply(this,Array.prototype.slice.call(arguments,0))}catch(t){i({msg:"onload handler failed "+t+" @ "+e.src})}t()},onerror:function(){if(e._onerror)try{e._onerror.apply(this,Array.prototype.slice.call(arguments,0))}catch(t){return void i({msg:"onerror handler failed "+t+" @ "+e.src})}i({msg:"remote script failed "+e.src})},onreadystatechange:function(){/^(loaded|complete)$/.test(e.readyState)&&t()}})},d.prototype._shouldRelease=function(t){return!/^script$/i.test(t.nodeName)||!!(this.options.releaseAsync&&t.src&&t.hasAttribute("async"))},d);function d(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,d),this.root=t,this.options=e,this.doc=t.ownerDocument,this.win=this.doc.defaultView||this.doc.parentWindow,this.parser=new i.default("",{autoFix:e.autoFix}),this.actuals=[t],this.proxyHistory="",this.proxyRoot=this.doc.createElement(t.nodeName),this.scriptStack=[],this.writeQueue=[],u(this.proxyRoot,"proxyof",0)}e.default=h},function(t,e,n){var r;r=function(){return o={},n.m=r=[function(t,e,n){"use strict";var r,o=n(1),i=(r=o)&&r.__esModule?r:{default:r};t.exports=i.default},function(t,e,n){"use strict";e.__esModule=!0;var r,a=u(n(2)),o=u(n(3)),i=n(6),s=(r=i)&&r.__esModule?r:{default:r},c=n(5);function u(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}var l={comment:/^<!--/,endTag:/^<\//,atomicTag:/^<\s*(script|style|noscript|iframe|textarea)[\s\/>]/i,startTag:/^</,chars:/^[^<]/},f=(p.prototype.append=function(t){this.stream+=t},p.prototype.prepend=function(t){this.stream=t+this.stream},p.prototype._readTokenImpl=function(){var t=this._peekTokenImpl();if(t)return this.stream=this.stream.slice(t.length),t},p.prototype._peekTokenImpl=function(){for(var t in l)if(l.hasOwnProperty(t)&&l[t].test(this.stream)){var e=o[t](this.stream);if(e)return"startTag"===e.type&&/script|style/i.test(e.tagName)?null:(e.text=this.stream.substr(0,e.length),e)}},p.prototype.peekToken=function(){return this._peekToken()},p.prototype.readToken=function(){return this._readToken()},p.prototype.readTokens=function(t){for(var e=void 0;e=this.readToken();)if(t[e.type]&&!1===t[e.type](e))return},p.prototype.clear=function(){var t=this.stream;return this.stream="",t},p.prototype.rest=function(){return this.stream},p);function p(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),this.stream=e;var r=!1,o={};for(var i in a)a.hasOwnProperty(i)&&(n.autoFix&&(o[i+"Fix"]=!0),r=r||o[i+"Fix"]);r?(this._readToken=(0,s.default)(this,o,function(){return t._readTokenImpl()}),this._peekToken=(0,s.default)(this,o,function(){return t._peekTokenImpl()})):(this._readToken=this._readTokenImpl,this._peekToken=this._peekTokenImpl)}for(var h in(e.default=f).tokenToString=function(t){return t.toString()},f.escapeAttributes=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=(0,c.escapeQuotes)(t[n],null));return e},f.supports=a)a.hasOwnProperty(h)&&(f.browserHasFlaw=f.browserHasFlaw||!a[h]&&h)},function(t,e){"use strict";var n=!(e.__esModule=!0),r=!1,o=window.document.createElement("div");try{var i="<P><I></P></I>";o.innerHTML=i,e.tagSoup=n=o.innerHTML!==i}catch(t){e.tagSoup=n=!1}try{o.innerHTML="<P><i><P></P></i></P>",e.selfClose=r=2===o.childNodes.length}catch(t){e.selfClose=r=!1}o=null,e.tagSoup=n,e.selfClose=r},function(t,e,n){"use strict";e.__esModule=!0;var 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};e.comment=function(t){var e=t.indexOf("--\x3e");if(0<=e)return new s.CommentToken(t.substr(4,e-1),e+3)},e.chars=function(t){var e=t.indexOf("<");return new s.CharsToken(0<=e?e:t.length)},e.startTag=o,e.atomicTag=function(t){var e=o(t);if(e){var n=t.slice(e.length);if(n.match(new RegExp("</\\s*"+e.tagName+"\\s*>","i"))){var r=n.match(new RegExp("([\\s\\S]*?)</\\s*"+e.tagName+"\\s*>","i"));if(r)return new s.AtomicTagToken(e.tagName,r[0].length+e.length,e.attrs,e.booleanAttrs,r[1])}}},e.endTag=function(t){var e=t.match(c.endTag);if(e)return new s.EndTagToken(e[1],e[0].length)};var s=n(4),c={startTag:/^<([\-A-Za-z0-9_]+)((?:\s+[\w\-]+(?:\s*=?\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,endTag:/^<\/([\-A-Za-z0-9_]+)[^>]*>/,attr:/(?:([\-A-Za-z0-9_]+)\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))|(?:([\-A-Za-z0-9_]+)(\s|$)+)/g,fillAttr:/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noresize|noshade|nowrap|readonly|selected)$/i};function o(t){var n,r,o;if(-1!==t.indexOf(">")){var e=t.match(c.startTag);if(e){var i=(n={},r={},o=e[2],e[2].replace(c.attr,function(t,e){arguments[2]||arguments[3]||arguments[4]||arguments[5]?arguments[5]?(n[arguments[5]]="",r[arguments[5]]=!0):n[e]=arguments[2]||arguments[3]||arguments[4]||c.fillAttr.test(e)&&e||"":n[e]="",o=o.replace(t,"")}),{v:new s.StartTagToken(e[1],e[0].length,n,r,!!e[3],o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""))});if("object"===(void 0===i?"undefined":a(i)))return i.v}}}},function(t,e,n){"use strict";e.__esModule=!0,e.EndTagToken=e.AtomicTagToken=e.StartTagToken=e.TagToken=e.CharsToken=e.CommentToken=e.Token=void 0;var a=n(5);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.Token=function t(e,n){s(this,t),this.type=e,this.length=n,this.text=""},e.CommentToken=(r.prototype.toString=function(){return"\x3c!--"+this.content},r);function r(t,e){s(this,r),this.type="comment",this.length=e||(t?t.length:0),this.text="",this.content=t}e.CharsToken=(o.prototype.toString=function(){return this.text},o);function o(t){s(this,o),this.type="chars",this.length=t,this.text=""}var i=e.TagToken=(c.formatTag=function(t,e){var n=1<arguments.length&&void 0!==e?e:null,r="<"+t.tagName;for(var o in t.attrs)if(t.attrs.hasOwnProperty(o)){r+=" "+o;var i=t.attrs[o];void 0!==t.booleanAttrs&&void 0!==t.booleanAttrs[o]||(r+='="'+(0,a.escapeQuotes)(i)+'"')}return t.rest&&(r+=" "+t.rest),t.unary&&!t.html5Unary?r+="/>":r+=">",null!=n&&(r+=n+"</"+t.tagName+">"),r},c);function c(t,e,n,r,o){s(this,c),this.type=t,this.length=n,this.text="",this.tagName=e,this.attrs=r,this.booleanAttrs=o,this.unary=!1,this.html5Unary=!1}e.StartTagToken=(u.prototype.toString=function(){return i.formatTag(this)},u);function u(t,e,n,r,o,i){s(this,u),this.type="startTag",this.length=e,this.text="",this.tagName=t,this.attrs=n,this.booleanAttrs=r,this.html5Unary=!1,this.unary=o,this.rest=i}e.AtomicTagToken=(l.prototype.toString=function(){return i.formatTag(this,this.content)},l);function l(t,e,n,r,o){s(this,l),this.type="atomicTag",this.length=e,this.text="",this.tagName=t,this.attrs=n,this.booleanAttrs=r,this.unary=!1,this.html5Unary=!1,this.content=o}e.EndTagToken=(f.prototype.toString=function(){return"</"+this.tagName+">"},f);function f(t,e){s(this,f),this.type="endTag",this.length=e,this.text="",this.tagName=t}},function(t,e){"use strict";e.__esModule=!0,e.escapeQuotes=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";return t?t.replace(/([^"]*)"/g,function(t,e){return/\\/.test(e)?e+'"':e+'\\"'}):e}},function(t,e){"use strict";e.__esModule=!0,e.default=function(n,r,e){var o=function(){var t=[];return t.last=function(){return this[this.length-1]},t.lastTagNameEq=function(t){var e=this.last();return e&&e.tagName&&e.tagName.toUpperCase()===t.toUpperCase()},t.containsTagName=function(t){for(var e,n=0;e=this[n];n++)if(e.tagName===t)return!0;return!1},t}(),i={startTag:function(t){var e=t.tagName;"TR"===e.toUpperCase()&&o.lastTagNameEq("TABLE")?(n.prepend("<TBODY>"),a()):r.selfCloseFix&&s.test(e)&&o.containsTagName(e)?o.lastTagNameEq(e)?u(n,o):(n.prepend("</"+t.tagName+">"),a()):t.unary||o.push(t)},endTag:function(t){o.last()?r.tagSoupFix&&!o.lastTagNameEq(t.tagName)?u(n,o):o.pop():r.tagSoupFix&&(e(),a())}};function a(){var t=function(t,e){var n=t.stream,r=c(e());return t.stream=n,r}(n,e);t&&i[t.type]&&i[t.type](t)}return function(){return a(),c(e())}};var n=/^(AREA|BASE|BASEFONT|BR|COL|FRAME|HR|IMG|INPUT|ISINDEX|LINK|META|PARAM|EMBED)$/i,s=/^(COLGROUP|DD|DT|LI|OPTIONS|P|TD|TFOOT|TH|THEAD|TR)$/i;function c(t){return t&&"startTag"===t.type&&(t.unary=n.test(t.tagName)||t.unary,t.html5Unary=!/\/>$/.test(t.text)),t}function u(t,e){var n=e.pop();t.prepend("</"+n.tagName+">")}}],n.c=o,n.p="",n(0);function n(t){if(o[t])return o[t].exports;var e=o[t]={exports:{},id:t,loaded:!1};return r[t].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var r,o},t.exports=r()},function(t,e){"use strict";e.__esModule=!0;var r="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};function o(t){return null!=t}function i(t,e,n){var r=void 0,o=t&&t.length||0;for(r=0;r<o;r++)e.call(n,t[r],r)}function a(t,e,n){for(var r in t)t.hasOwnProperty(r)&&e.call(n,r,t[r])}function n(t,e){return!(!t||"startTag"!==t.type&&"atomicTag"!==t.type||!("tagName"in t))&&!!~t.tagName.toLowerCase().indexOf(e)}e.existy=o,e.isFunction=function(t){return"function"==typeof t},e.each=i,e.eachKey=a,e.defaults=function(n,t){return n=n||{},a(t,function(t,e){o(n[t])||(n[t]=e)}),n},e.toArray=function(n){try{return Array.prototype.slice.call(n)}catch(t){var e=function(){var e=[];return i(n,function(t){e.push(t)}),{v:e}}();if("object"===(void 0===e?"undefined":r(e)))return e.v}},e.last=function(t){return t[t.length-1]},e.isTag=n,e.isScript=function(t){return n(t,"script")},e.isStyle=function(t){return n(t,"style")}}],n.c=o,n.p="",n(0);function n(t){if(o[t])return o[t].exports;var e=o[t]={exports:{},id:t,loaded:!1};return r[t].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var r,o},t.exports=r()}]);
|
1
|
+
/* prebid-universal-creative v1.16.0
|
2
|
+
Updated : 2023-10-12 */
|
3
|
+
!function(n){var r={};function o(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}o.m=n,o.c=r,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=1)}([function(t,e,n){"use strict";e.a=function(t,e){var n=document.createElement("iframe");return n.setAttribute("frameborder",0),n.setAttribute("scrolling","no"),n.setAttribute("marginheight",0),n.setAttribute("marginwidth",0),n.setAttribute("TOPMARGIN",0),n.setAttribute("LEFTMARGIN",0),n.setAttribute("allowtransparency","true"),n.setAttribute("width",e),n.setAttribute("height",t),n},e.b=function(t,e,n){var r;e=e||document,r=n?e.getElementsByTagName(n):e.getElementsByTagName("head");try{(r=r.length?r:e.getElementsByTagName("body")).length&&(r=r[0]).insertBefore(t,r.firstChild)}catch(t){}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2);window.ucTag=window.ucTag||{},window.ucTag.renderAd=function(t,e){Object(r.a)(e)}},function(t,e,n){"use strict";e.a=function(t){var e=Object(f.g)(t),n=e.cacheHost,r=e.cachePath,o=e.uuid,i=e.size,a=e.hbPb,s="Prebid_";if((o=o||"").substr(0,s.length)===s)!function(t){var e=window.localStorage.getItem(t);m(!0)(e)}(o),y(i);else{var c="".concat(function(t,e){var n=void 0===e||""===e?d:e;return"https://".concat(void 0===t||""===t?l:t).concat(n)}(n,r),"?uuid=").concat(o);y(i),Object(f.f)(c,m(Object(u.a)(e.env),a))}};var f=n(3),u=n(4),p=n(0),h=n(5),l="prebid.adnxs.com",d="/pbc/v1/cache";function y(t){if(t){var e=t.split("x").map(Number);!function(r,o){if(Object(u.b)(window)){var i=window.innerWidth,a=window.innerHeight;i===r&&a===o||(window.$sf.ext.register(r,o,function(t){var e=r-i,n=o-a;window.$sf.ext.expand({r:e,b:n,push:!0})}),window.parent.postMessage({sentinel:"amp",type:"embed-size",width:r,height:o},"*"))}}(e[0],e[1])}else console.log("Targeting key hb_size not found to resize creative")}function m(u,l){return function(t){var e=function(t){var e;try{e=JSON.parse(t)}catch(t){console.log("Error parsing response from cache host: ".concat(t))}return e}(t),n=e.price||l,r=Object(f.c)(e),o=e.width?e.width:e.w,i=e.height?e.height:e.h;if(e.wurl&&Object(f.h)(decodeURIComponent(e.wurl)),e.adm){if(e.adm=n?e.adm.replace("${AUCTION_PRICE}",n):e.adm.replace("${AUCTION_PRICE}",""),r+=u?g(e.adm,o,i):e.adm,e.nurl&&(r+=Object(f.a)(decodeURIComponent(e.nurl))),e.burl){var a=function(){Object(f.h)(e.burl)};if(u)Object(f.e)(window,"mraid.js",function(){!function(e){function n(t){0<t&&(mraid.removeEventListener("exposureChange",n),e())}function r(t){t&&(mraid.removeEventListener("viewableChange",r),e())}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()?e():mraid.addEventListener("viewableChange",r))}return!(!window.mraid||!window.MRAID_ENV)&&("loading"==mraid.getState()?mraid.addEventListener("ready",function t(){mraid.removeEventListener("ready",t),o()}):o(),!0)}(a)&&a()},a);else a()}Object(h.a)(r)}else if(e.nurl)if(u){r+=g(Object(f.e)(window,e.nurl).outerHTML,o,i),Object(h.a)(r)}else{var s=e.nurl,c=Object(f.b)(e);Object(p.b)(c,document,"body"),Object(f.i)(s,o,i)}}}function g(t,e,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(e,"px; height:").concat(n,'px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">').concat(t,"</div>\n </div>")}},function(t,e,n){"use strict";e.h=function(t,e){var n=new Image;e&&"function"==typeof e&&(n.addEventListener("load",e),n.addEventListener("error",e));n.src=t},e.a=function(t){if(!t)return"";var e=encodeURI(t);return'<div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="'.concat(e,'"></div>')},e.i=function(t,e,n){var r=o.a(n,e);r.src=t,document.body.appendChild(r)},e.f=function(t,e){var n=new XMLHttpRequest;n.addEventListener("load",function(){e(n.responseText)}),n.open("GET",t),n.send()},e.d=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===t?e:3&e|8).toString(16)})},e.e=function(t,e,n,r){var o=t.document,i=o.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=e;var a=o.getElementsByTagName("head");(a=a.length?a:o.getElementsByTagName("body")).length&&(a=a[0]).insertBefore(i,a.firstChild);return i},e.b=r,e.c=function(t){var e=r(t),n=document.createElement("div");return n.appendChild(e),n.innerHTML},e.g=function(e){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 t(t){return!(!e[t]||!(function(t){return i(t,"Object")}(e[t])&&0<Object.keys(e[t]).length||a(e[t])&&""!==e[t]))}var r={},o={};t("targetingMap")?o=function(e){var n={};return Object.keys(e).forEach(function(t){Array.isArray(e[t])&&0<e[t].length&&(n[t]=e[t][0])}),n}(e.targetingMap):t("targetingKeywords")&&(o=function(t){var o={},e=t.split(",");return 0<e.length&&e.forEach(function(t){var e=t.split(":");if(2===e.length){var n=e[0],r=e[1];o[n]=r}}),o}(e.targetingKeywords));return function(e){Object.keys(e).forEach(function(t){r[n[t]||t]=e[t]})}(o),Object.keys(e).forEach(function(t){"targetingMap"!==t&&"targetingKeywords"!==t&&a(e[t])&&""!==e[t]&&(r[t]=e[t])}),r};var o=n(0);function r(t){return document.createComment("Creative ".concat(t.crid," served by Prebid.js Header Bidding"))}function i(t,e){return Object.prototype.toString.call(t)==="[object "+e+"]"}function a(t){return i(t,"String")}},function(t,e,n){"use strict";e.b=function(t){return!(!t.$sf||!t.$sf.ext)},e.a=function(t){return t&&"mobile-app"===t}},function(t,e,n){"use strict";e.a=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:o.a;t=t.replace(/\<(\?xml|(\!DOCTYPE[^\>\[]+(\[[^\]]+)?))+[^>]+\>/g,""),e(document.body,t,{error:console.error})};var r=n(6),o=n.n(r)},function(t,e,n){var r;r=function(){return o={},n.m=r=[function(t,e,n){"use strict";var r,o=n(1),i=(r=o)&&r.__esModule?r:{default:r};t.exports=i.default},function(t,e,n){"use strict";e.__esModule=!0;var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=d;var r,o=n(2),c=(r=o)&&r.__esModule?r:{default:r},i=function(t){{if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}}(n(4));function u(){}var a={afterAsync:u,afterDequeue:u,afterStreamStart:u,afterWrite:u,autoFix:!0,beforeEnqueue:u,beforeWriteToken:function(t){return t},beforeWrite:function(t){return t},done:u,error:function(t){throw new Error(t.msg)},releaseAsync:!1},l=0,f=[],p=null;function h(){var t=f.shift();if(t){var e=i.last(t);e.afterDequeue(),t.stream=function(t,e,r){(p=new c.default(t,r)).id=l++,p.name=r.name||p.id,d.streams[p.name]=p;var n=t.ownerDocument,o={close:n.close,open:n.open,write:n.write,writeln:n.writeln};function i(t){t=r.beforeWrite(t),p.write(t),r.afterWrite(t)}s(n,{close:u,open:u,write:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return i(e.join(""))},writeln:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return i(e.join("")+"\n")}});var a=p.win.onerror||u;return p.win.onerror=function(t,e,n){r.error({msg:t+" - "+e+": "+n}),a.apply(p.win,[t,e,n])},p.write(e,function(){s(n,o),p.win.onerror=a,r.done(),p=null,h()}),p}.apply(void 0,t),e.afterStreamStart()}}function d(t,e,n){if(i.isFunction(n))n={done:n};else if("clear"===n)return f=[],p=null,void(l=0);n=i.defaults(n,a);var r=[t=/^#/.test(t)?window.document.getElementById(t.substr(1)):t.jquery?t[0]:t,e,n];return t.postscribe={cancel:function(){r.stream?r.stream.abort():r[1]=u}},n.beforeEnqueue(r),f.push(r),p||h(),t.postscribe}s(d,{streams:{},queue:f,WriteStream:c.default})},function(t,e,n){"use strict";e.__esModule=!0;var r,s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},o=n(3),i=(r=o)&&r.__esModule?r:{default:r},a=function(t){{if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}}(n(4));var l="data-ps-",f="ps-style",p="ps-script";function c(t,e){var n=l+e,r=t.getAttribute(n);return a.existy(r)?String(r):r}function u(t,e,n){var r=2<arguments.length&&void 0!==n?n:null,o=l+e;a.existy(r)&&""!==r?t.setAttribute(o,r):t.removeAttribute(o)}var h=(d.prototype.write=function(){var t;for((t=this.writeQueue).push.apply(t,arguments);!this.deferredRemote&&this.writeQueue.length;){var e=this.writeQueue.shift();a.isFunction(e)?this._callFunction(e):this._writeImpl(e)}},d.prototype._callFunction=function(t){var e={type:"function",value:t.name||t.toString()};this._onScriptStart(e),t.call(this.win,this.doc),this._onScriptDone(e)},d.prototype._writeImpl=function(t){this.parser.append(t);for(var e=void 0,n=void 0,r=void 0,o=[];(e=this.parser.readToken())&&!(n=a.isScript(e))&&!(r=a.isStyle(e));)(e=this.options.beforeWriteToken(e))&&o.push(e);0<o.length&&this._writeStaticTokens(o),n&&this._handleScriptToken(e),r&&this._handleStyleToken(e)},d.prototype._writeStaticTokens=function(t){var e=this._buildChunk(t);return e.actual?(e.html=this.proxyHistory+e.actual,this.proxyHistory+=e.proxy,this.proxyRoot.innerHTML=e.html,this._walkChunk(),e):null},d.prototype._buildChunk=function(t){for(var e=this.actuals.length,n=[],r=[],o=[],i=t.length,a=0;a<i;a++){var s=t[a],c=s.toString();if(n.push(c),s.attrs){if(!/^noscript$/i.test(s.tagName)){var u=e++;r.push(c.replace(/(\/?>)/," "+l+"id="+u+" $1")),s.attrs.id!==p&&s.attrs.id!==f&&o.push("atomicTag"===s.type?"":"<"+s.tagName+" "+l+"proxyof="+u+(s.unary?" />":">"))}}else r.push(c),o.push("endTag"===s.type?c:"")}return{tokens:t,raw:n.join(""),actual:r.join(""),proxy:o.join("")}},d.prototype._walkChunk=function(){for(var t=void 0,e=[this.proxyRoot];a.existy(t=e.shift());){var n=1===t.nodeType;if(!n||!c(t,"proxyof")){n&&u(this.actuals[c(t,"id")]=t,"id");var r=t.parentNode&&c(t.parentNode,"proxyof");r&&this.actuals[r].appendChild(t)}e.unshift.apply(e,a.toArray(t.childNodes))}},d.prototype._handleScriptToken=function(t){var e=this,n=this.parser.clear();n&&this.writeQueue.unshift(n),t.src=t.attrs.src||t.attrs.SRC,(t=this.options.beforeWriteToken(t))&&(t.src&&this.scriptStack.length?this.deferredRemote=t:this._onScriptStart(t),this._writeScriptToken(t,function(){e._onScriptDone(t)}))},d.prototype._handleStyleToken=function(t){var e=this.parser.clear();e&&this.writeQueue.unshift(e),t.type=t.attrs.type||t.attrs.TYPE||"text/css",(t=this.options.beforeWriteToken(t))&&this._writeStyleToken(t),e&&this.write()},d.prototype._writeStyleToken=function(t){var e=this._buildStyle(t);this._insertCursor(e,f),t.content&&(e.styleSheet&&!e.sheet?e.styleSheet.cssText=t.content:e.appendChild(this.doc.createTextNode(t.content)))},d.prototype._buildStyle=function(t){var n=this.doc.createElement(t.tagName);return n.setAttribute("type",t.type),a.eachKey(t.attrs,function(t,e){n.setAttribute(t,e)}),n},d.prototype._insertCursor=function(t,e){this._writeImpl('<span id="'+e+'"/>');var n=this.doc.getElementById(e);n&&n.parentNode.replaceChild(t,n)},d.prototype._onScriptStart=function(t){t.outerWrites=this.writeQueue,this.writeQueue=[],this.scriptStack.unshift(t)},d.prototype._onScriptDone=function(t){t===this.scriptStack[0]?(this.scriptStack.shift(),this.write.apply(this,t.outerWrites),!this.scriptStack.length&&this.deferredRemote&&(this._onScriptStart(this.deferredRemote),this.deferredRemote=null)):this.options.error({msg:"Bad script nesting or script finished twice"})},d.prototype._writeScriptToken=function(t,e){var n=this._buildScript(t),r=this._shouldRelease(n),o=this.options.afterAsync;t.src&&(n.src=t.src,this._scriptLoadHandler(n,r?o:function(){e(),o()}));try{this._insertCursor(n,p),n.src&&!r||e()}catch(t){this.options.error(t),e()}},d.prototype._buildScript=function(t){var n=this.doc.createElement(t.tagName);return a.eachKey(t.attrs,function(t,e){n.setAttribute(t,e)}),t.content&&(n.text=t.content),n},d.prototype._scriptLoadHandler=function(e,n){function r(){e=e.onload=e.onreadystatechange=e.onerror=null}var o=this.options.error;function t(){r(),null!=n&&n(),n=null}function i(t){r(),o(t),null!=n&&n(),n=null}function a(t,e){var n=t["on"+e];null!=n&&(t["_on"+e]=n)}a(e,"load"),a(e,"error"),s(e,{onload:function(){if(e._onload)try{e._onload.apply(this,Array.prototype.slice.call(arguments,0))}catch(t){i({msg:"onload handler failed "+t+" @ "+e.src})}t()},onerror:function(){if(e._onerror)try{e._onerror.apply(this,Array.prototype.slice.call(arguments,0))}catch(t){return void i({msg:"onerror handler failed "+t+" @ "+e.src})}i({msg:"remote script failed "+e.src})},onreadystatechange:function(){/^(loaded|complete)$/.test(e.readyState)&&t()}})},d.prototype._shouldRelease=function(t){return!/^script$/i.test(t.nodeName)||!!(this.options.releaseAsync&&t.src&&t.hasAttribute("async"))},d);function d(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,d),this.root=t,this.options=e,this.doc=t.ownerDocument,this.win=this.doc.defaultView||this.doc.parentWindow,this.parser=new i.default("",{autoFix:e.autoFix}),this.actuals=[t],this.proxyHistory="",this.proxyRoot=this.doc.createElement(t.nodeName),this.scriptStack=[],this.writeQueue=[],u(this.proxyRoot,"proxyof",0)}e.default=h},function(t,e,n){var r;r=function(){return o={},n.m=r=[function(t,e,n){"use strict";var r,o=n(1),i=(r=o)&&r.__esModule?r:{default:r};t.exports=i.default},function(t,e,n){"use strict";e.__esModule=!0;var r,a=u(n(2)),o=u(n(3)),i=n(6),s=(r=i)&&r.__esModule?r:{default:r},c=n(5);function u(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}var l={comment:/^<!--/,endTag:/^<\//,atomicTag:/^<\s*(script|style|noscript|iframe|textarea)[\s\/>]/i,startTag:/^</,chars:/^[^<]/},f=(p.prototype.append=function(t){this.stream+=t},p.prototype.prepend=function(t){this.stream=t+this.stream},p.prototype._readTokenImpl=function(){var t=this._peekTokenImpl();if(t)return this.stream=this.stream.slice(t.length),t},p.prototype._peekTokenImpl=function(){for(var t in l)if(l.hasOwnProperty(t)&&l[t].test(this.stream)){var e=o[t](this.stream);if(e)return"startTag"===e.type&&/script|style/i.test(e.tagName)?null:(e.text=this.stream.substr(0,e.length),e)}},p.prototype.peekToken=function(){return this._peekToken()},p.prototype.readToken=function(){return this._readToken()},p.prototype.readTokens=function(t){for(var e=void 0;e=this.readToken();)if(t[e.type]&&!1===t[e.type](e))return},p.prototype.clear=function(){var t=this.stream;return this.stream="",t},p.prototype.rest=function(){return this.stream},p);function p(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),this.stream=e;var r=!1,o={};for(var i in a)a.hasOwnProperty(i)&&(n.autoFix&&(o[i+"Fix"]=!0),r=r||o[i+"Fix"]);r?(this._readToken=(0,s.default)(this,o,function(){return t._readTokenImpl()}),this._peekToken=(0,s.default)(this,o,function(){return t._peekTokenImpl()})):(this._readToken=this._readTokenImpl,this._peekToken=this._peekTokenImpl)}for(var h in(e.default=f).tokenToString=function(t){return t.toString()},f.escapeAttributes=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=(0,c.escapeQuotes)(t[n],null));return e},f.supports=a)a.hasOwnProperty(h)&&(f.browserHasFlaw=f.browserHasFlaw||!a[h]&&h)},function(t,e){"use strict";var n=!(e.__esModule=!0),r=!1,o=window.document.createElement("div");try{var i="<P><I></P></I>";o.innerHTML=i,e.tagSoup=n=o.innerHTML!==i}catch(t){e.tagSoup=n=!1}try{o.innerHTML="<P><i><P></P></i></P>",e.selfClose=r=2===o.childNodes.length}catch(t){e.selfClose=r=!1}o=null,e.tagSoup=n,e.selfClose=r},function(t,e,n){"use strict";e.__esModule=!0;var 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};e.comment=function(t){var e=t.indexOf("--\x3e");if(0<=e)return new s.CommentToken(t.substr(4,e-1),e+3)},e.chars=function(t){var e=t.indexOf("<");return new s.CharsToken(0<=e?e:t.length)},e.startTag=o,e.atomicTag=function(t){var e=o(t);if(e){var n=t.slice(e.length);if(n.match(new RegExp("</\\s*"+e.tagName+"\\s*>","i"))){var r=n.match(new RegExp("([\\s\\S]*?)</\\s*"+e.tagName+"\\s*>","i"));if(r)return new s.AtomicTagToken(e.tagName,r[0].length+e.length,e.attrs,e.booleanAttrs,r[1])}}},e.endTag=function(t){var e=t.match(c.endTag);if(e)return new s.EndTagToken(e[1],e[0].length)};var s=n(4),c={startTag:/^<([\-A-Za-z0-9_]+)((?:\s+[\w\-]+(?:\s*=?\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,endTag:/^<\/([\-A-Za-z0-9_]+)[^>]*>/,attr:/(?:([\-A-Za-z0-9_]+)\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))|(?:([\-A-Za-z0-9_]+)(\s|$)+)/g,fillAttr:/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noresize|noshade|nowrap|readonly|selected)$/i};function o(t){var n,r,o;if(-1!==t.indexOf(">")){var e=t.match(c.startTag);if(e){var i=(n={},r={},o=e[2],e[2].replace(c.attr,function(t,e){arguments[2]||arguments[3]||arguments[4]||arguments[5]?arguments[5]?(n[arguments[5]]="",r[arguments[5]]=!0):n[e]=arguments[2]||arguments[3]||arguments[4]||c.fillAttr.test(e)&&e||"":n[e]="",o=o.replace(t,"")}),{v:new s.StartTagToken(e[1],e[0].length,n,r,!!e[3],o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""))});if("object"===(void 0===i?"undefined":a(i)))return i.v}}}},function(t,e,n){"use strict";e.__esModule=!0,e.EndTagToken=e.AtomicTagToken=e.StartTagToken=e.TagToken=e.CharsToken=e.CommentToken=e.Token=void 0;var a=n(5);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.Token=function t(e,n){s(this,t),this.type=e,this.length=n,this.text=""},e.CommentToken=(r.prototype.toString=function(){return"\x3c!--"+this.content},r);function r(t,e){s(this,r),this.type="comment",this.length=e||(t?t.length:0),this.text="",this.content=t}e.CharsToken=(o.prototype.toString=function(){return this.text},o);function o(t){s(this,o),this.type="chars",this.length=t,this.text=""}var i=e.TagToken=(c.formatTag=function(t,e){var n=1<arguments.length&&void 0!==e?e:null,r="<"+t.tagName;for(var o in t.attrs)if(t.attrs.hasOwnProperty(o)){r+=" "+o;var i=t.attrs[o];void 0!==t.booleanAttrs&&void 0!==t.booleanAttrs[o]||(r+='="'+(0,a.escapeQuotes)(i)+'"')}return t.rest&&(r+=" "+t.rest),t.unary&&!t.html5Unary?r+="/>":r+=">",null!=n&&(r+=n+"</"+t.tagName+">"),r},c);function c(t,e,n,r,o){s(this,c),this.type=t,this.length=n,this.text="",this.tagName=e,this.attrs=r,this.booleanAttrs=o,this.unary=!1,this.html5Unary=!1}e.StartTagToken=(u.prototype.toString=function(){return i.formatTag(this)},u);function u(t,e,n,r,o,i){s(this,u),this.type="startTag",this.length=e,this.text="",this.tagName=t,this.attrs=n,this.booleanAttrs=r,this.html5Unary=!1,this.unary=o,this.rest=i}e.AtomicTagToken=(l.prototype.toString=function(){return i.formatTag(this,this.content)},l);function l(t,e,n,r,o){s(this,l),this.type="atomicTag",this.length=e,this.text="",this.tagName=t,this.attrs=n,this.booleanAttrs=r,this.unary=!1,this.html5Unary=!1,this.content=o}e.EndTagToken=(f.prototype.toString=function(){return"</"+this.tagName+">"},f);function f(t,e){s(this,f),this.type="endTag",this.length=e,this.text="",this.tagName=t}},function(t,e){"use strict";e.__esModule=!0,e.escapeQuotes=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";return t?t.replace(/([^"]*)"/g,function(t,e){return/\\/.test(e)?e+'"':e+'\\"'}):e}},function(t,e){"use strict";e.__esModule=!0,e.default=function(n,r,e){var o=function(){var t=[];return t.last=function(){return this[this.length-1]},t.lastTagNameEq=function(t){var e=this.last();return e&&e.tagName&&e.tagName.toUpperCase()===t.toUpperCase()},t.containsTagName=function(t){for(var e,n=0;e=this[n];n++)if(e.tagName===t)return!0;return!1},t}(),i={startTag:function(t){var e=t.tagName;"TR"===e.toUpperCase()&&o.lastTagNameEq("TABLE")?(n.prepend("<TBODY>"),a()):r.selfCloseFix&&s.test(e)&&o.containsTagName(e)?o.lastTagNameEq(e)?u(n,o):(n.prepend("</"+t.tagName+">"),a()):t.unary||o.push(t)},endTag:function(t){o.last()?r.tagSoupFix&&!o.lastTagNameEq(t.tagName)?u(n,o):o.pop():r.tagSoupFix&&(e(),a())}};function a(){var t=function(t,e){var n=t.stream,r=c(e());return t.stream=n,r}(n,e);t&&i[t.type]&&i[t.type](t)}return function(){return a(),c(e())}};var n=/^(AREA|BASE|BASEFONT|BR|COL|FRAME|HR|IMG|INPUT|ISINDEX|LINK|META|PARAM|EMBED)$/i,s=/^(COLGROUP|DD|DT|LI|OPTIONS|P|TD|TFOOT|TH|THEAD|TR)$/i;function c(t){return t&&"startTag"===t.type&&(t.unary=n.test(t.tagName)||t.unary,t.html5Unary=!/\/>$/.test(t.text)),t}function u(t,e){var n=e.pop();t.prepend("</"+n.tagName+">")}}],n.c=o,n.p="",n(0);function n(t){if(o[t])return o[t].exports;var e=o[t]={exports:{},id:t,loaded:!1};return r[t].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var r,o},t.exports=r()},function(t,e){"use strict";e.__esModule=!0;var r="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};function o(t){return null!=t}function i(t,e,n){var r=void 0,o=t&&t.length||0;for(r=0;r<o;r++)e.call(n,t[r],r)}function a(t,e,n){for(var r in t)t.hasOwnProperty(r)&&e.call(n,r,t[r])}function n(t,e){return!(!t||"startTag"!==t.type&&"atomicTag"!==t.type||!("tagName"in t))&&!!~t.tagName.toLowerCase().indexOf(e)}e.existy=o,e.isFunction=function(t){return"function"==typeof t},e.each=i,e.eachKey=a,e.defaults=function(n,t){return n=n||{},a(t,function(t,e){o(n[t])||(n[t]=e)}),n},e.toArray=function(n){try{return Array.prototype.slice.call(n)}catch(t){var e=function(){var e=[];return i(n,function(t){e.push(t)}),{v:e}}();if("object"===(void 0===e?"undefined":r(e)))return e.v}},e.last=function(t){return t[t.length-1]},e.isTag=n,e.isScript=function(t){return n(t,"script")},e.isStyle=function(t){return n(t,"style")}}],n.c=o,n.p="",n(0);function n(t){if(o[t])return o[t].exports;var e=o[t]={exports:{},id:t,loaded:!1};return r[t].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var r,o},t.exports=r()}]);
|
package/dist/native-render.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* prebid-universal-creative v1.
|
2
|
-
Updated : 2023-
|
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=2)}([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(6)},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}();return function(e,t){if(null==o)throw new Error("Missing pubUrl");var n;if(e=JSON.stringify(e),null==t)i.parent.postMessage(e,o);else{var r=new MessageChannel;(n=r.port1).onmessage=t,i.addEventListener("message",a),i.parent.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)}}};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3);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(a){var i;function o(e,t){if(""===e)console.warn("Prebid tracking event was missing 'adId'. Was adId macro set in the HTML attribute "+l+"on the ad's anchor element");else{var n={message:"Prebid Native",adId:e};"click"===t&&(n.action="click"),i(n)}}function c(){for(var e=function(e){return a.document.getElementsByClassName(e)||[]}(r),t=0;t<e.length;t++)e[t].addEventListener("click",function(e){o(window.pbNativeData.adId,"click")},!0)}return{renderNativeAd:function(e,t){window.pbNativeData=t,i=Object(d.a)(t.pubUrl,a);var n=Object(s.a)(window,t.pubUrl);if(t.hasOwnProperty("adId")){if(t.hasOwnProperty("rendererUrl")&&!t.rendererUrl.match(/##.*##/i)){var r=e.createElement("SCRIPT");r.src=t.rendererUrl,r.id="pb-native-renderer",e.body.appendChild(r)}n.loadAssets(t.adId,function(){!function(e){o(e,"impression")}(t.adId),c()})}else console.warn("Prebid Native Tag object was missing 'adId'.")}}};var s=n(4),d=n(1),r="pb-click",l="pbAdId"},function(e,t,n){"use strict";t.a=function(o,e){var c,r,s=Object(y.a)(e,o),d=0;function l(){null!=r&&(r(),r=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 n(e){var t=e.uuid,n="".concat(function(e,t){var n=void 0===t||""===t?A:t;return"https://".concat(void 0===e||""===e?N:e).concat(n)}(e.cacheHost,e.cachePath),"?uuid=").concat(t);Object(g.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?k.image[e.img.type]?n.push({key:k.image[e.img.type],value:e.img.url}):console.log("ERROR: Invalid image type for image asset"):e.data?k.data[e.data.type]?n.push({key:k.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=b(o.document.body.innerHTML,r);o.document.body.innerHTML=a,c&&c({clickTrackers:r.clicktrackers,impTrackers:r.imptrackers,eventtrackers:r.eventtrackers})}}})}function u(){return void 0!==o.pbNativeData}function v(e,t){return t&&!u()?"".concat(e,":").concat(t):u()?"##".concat(e,"##"):e}function f(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(w).reduce(function(e,t){var n=v(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 a(e){return f(e,o.document.body.innerHTML,o.document.head.innerHTML)}function p(e){var t={};try{t=JSON.parse(e.data)}catch(e){return void(10<d++&&l())}if("assetResponse"===t.message){var n=o.document.body.innerHTML,r=o.document.head.innerHTML;if(u()&&t.adId!==o.pbNativeData.adId)return;r&&(o.document.head.innerHTML=b(r,t)),t.assets=t.assets||[];var a=t.assets;if(t.ortb&&(a.ortb=t.ortb,c=function(){Object(m.b)(t.adId,s),Object(m.a)(t.adId,t.ortb,s)}),t.hasOwnProperty("rendererUrl")&&t.rendererUrl||u()&&o.pbNativeData.hasOwnProperty("rendererUrl"))if(o.renderAd)h(o.renderAd&&o.renderAd(a)||"",t);else document.getElementById("pb-native-renderer")?document.getElementById("pb-native-renderer").addEventListener("load",function(){h(o.renderAd&&o.renderAd(a)||"",t)}):Object(g.a)(o,u()&&o.pbNativeData.hasOwnProperty("rendererUrl")&&o.pbNativeData.rendererUrl||t.rendererUrl,function(){h(o.renderAd&&o.renderAd(a)||"",t)});else if(t.hasOwnProperty("adTemplate")&&t.adTemplate||u()&&o.pbNativeData.hasOwnProperty("adTemplate")){h(b(u()&&o.pbNativeData.hasOwnProperty("adTemplate")&&o.pbNativeData.adTemplate||t.adTemplate,t),t)}else{var i=b(n,t);o.document.body.innerHTML=i,c&&c(),l()}}}function h(e,t){if(!Object(_.a)(window)){var n=function(e){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}}}}}(o);if(n&&n.children&&n.children[0]){var r=n.children[0];if("1"===r.width&&"1"===r.height){var a=n.getBoundingClientRect().width;o.document.body.style.width="".concat(a,"px")}}}o.document.body.innerHTML+=e,c&&c(),o.removeEventListener("message",p),l(),function(e,t,n){s({message:"Prebid Native",action:"resizeNativeHeight",adId:e,height:t,width:n})}(t.adId,document.body.clientHeight||document.body.offsetHeight,document.body.clientWidth),"function"==typeof window.postRenderAd&&window.postRenderAd(t)}function b(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.replace("##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.replace("##hb_native_asset_link_id_".concat(e.id,"##"),e.link.url))}),t=t.replaceAll(/##hb_native_asset_id_\d+##/gm,""),e.privacy&&(t=t.replace("##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||[],f(o,a).forEach(function(t){var e=v(t,o),n=new RegExp(e,"g"),r=i.find(function(e){return t===w[e.key]});a=a.replace(n,r?r.value:"")}),a}return{loadAssets:function(e,t){var n=a(e);u()&&o.pbNativeData.hasOwnProperty("assetsToReplace")&&o.pbNativeData.assetsToReplace.forEach(function(e){var t=e.match(/hb_native_/i)?e:w[e];t&&n.push(t)}),u()&&o.pbNativeData.hasOwnProperty("requestAllAssets")&&o.pbNativeData.requestAllAssets?(c=t,r=function(e){return s({message:"Prebid Native",action:"allAssetRequest",adId:e},p)}(e)):0<n.length&&(c=t,r=function(e,t){return s({message:"Prebid Native",action:"assetRequest",adId:e,assets:t},p)}(e,n))},loadMobileAssets:function(e,t){0<a().length&&(c=t,n(e))}}};var m=n(5),g=n(0),y=n(1),_=n(7),w={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"},k={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",A="/pbc/v1/cache"},function(e,t,n){"use strict";t.b=function(e,t){t({message:"Prebid Native",action:"fireNativeImpressionTrackers",adId:e})},t.a=function(e,t,r){for(var a={message:"Prebid Native",action:"click",adId:e},n=document.getElementsByClassName(o)||[],i=0;i<n.length;i++)n[i].addEventListener("click",function(e){var t=e.target,n=t&&t.getAttribute(c);a.assetId=n,r(a)},!0)};n(0);var o="pb-click",c="hb_native_asset_id"},function(e,t,n){"use strict";t.a=function(e,t){var n=document.createElement("iframe");return n.setAttribute("frameborder",0),n.setAttribute("scrolling","no"),n.setAttribute("marginheight",0),n.setAttribute("marginwidth",0),n.setAttribute("TOPMARGIN",0),n.setAttribute("LEFTMARGIN",0),n.setAttribute("allowtransparency","true"),n.setAttribute("width",t),n.setAttribute("height",e),n}},function(e,t,n){"use strict";t.a=function(e){return!(!e.$sf||!e.$sf.ext)}}]);
|
1
|
+
/* prebid-universal-creative v1.16.0
|
2
|
+
Updated : 2023-10-12 */
|
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=2)}([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(6)},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}();return function(e,t){if(null==o)throw new Error("Missing pubUrl");var n;if(e=JSON.stringify(e),null==t)i.parent.postMessage(e,o);else{var r=new MessageChannel;(n=r.port1).onmessage=t,i.addEventListener("message",a),i.parent.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)}}};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3);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]:a.a,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:r.a;return{renderNativeAd:function(e,t){function n(e,t,n){o({message:"Prebid Event",adId:e,event:t?"adRenderSucceeded":"adRenderFailed",info:n})}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,!0)},function(e){n(t.adId,!1,{reason:"exception",message:e.message})})}else n(null,!1,{reason:"missingDocOrAdid"}),console.warn("Prebid Native Tag object was missing 'adId'.")}catch(e){n(t&&t.adId,!1,{reason:"exception",message:e.message}),console.error("Error rendering ad",e)}}}};var r=n(4),a=n(1)},function(e,t,n){"use strict";t.a=function(c,e){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:w.a;e.clickUrlUnesc&&e.clickUrlUnesc!==I&&(U=e.clickUrlUnesc);var s,d,a,n=e.pubUrl,l=t(n,c),u=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=g(c.document.body.innerHTML,r);c.document.body.innerHTML=a,s&&s({clickTrackers:r.clicktrackers,impTrackers:r.imptrackers,eventtrackers:r.eventtrackers})}}})}function f(){return void 0!==c.pbNativeData}function p(e,t){return t&&!f()?"".concat(e,":").concat(t):f()?"##".concat(e,"##"):e}function h(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=p(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 h(e,c.document.body.innerHTML,c.document.head.innerHTML)}function b(e){try{var t={};try{t=JSON.parse(e.data)}catch(e){if(10<u++)throw v(),e;return}if("assetResponse"===t.message){t.clickUrlUnesc=U;var n=c.document.body.innerHTML,r=c.document.head.innerHTML;if(f()&&t.adId!==c.pbNativeData.adId)return;o=s,s=function(){Object(y.b)(t.adId,l),Object(y.a)(t.adId,l),o&&o()},r&&(c.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||f()&&c.pbNativeData.hasOwnProperty("rendererUrl"))if(c.renderAd)m(c.renderAd&&c.renderAd(a)||"",t);else document.getElementById("pb-native-renderer")?document.getElementById("pb-native-renderer").addEventListener("load",function(){m(c.renderAd&&c.renderAd(a)||"",t)}):Object(_.a)(c,f()&&c.pbNativeData.hasOwnProperty("rendererUrl")&&c.pbNativeData.rendererUrl||t.rendererUrl,function(){m(c.renderAd&&c.renderAd(a)||"",t)});else if(t.hasOwnProperty("adTemplate")&&t.adTemplate||f()&&c.pbNativeData.hasOwnProperty("adTemplate")){m(g(f()&&c.pbNativeData.hasOwnProperty("adTemplate")&&c.pbNativeData.adTemplate||t.adTemplate,t),t)}else{var i=g(n,t);c.document.body.innerHTML=i,s&&s(),v()}}}catch(e){d&&d(e)}var o}function m(e,t){if(!Object(k.a)(window)){var n=function(e){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}}}}}(c);if(n&&n.children&&n.children[0]){var r=n.children[0];if("1"===r.width&&"1"===r.height){var a=n.getBoundingClientRect().width;c.document.body.style.width="".concat(a,"px")}}}e=e.replaceAll(I,t.clickUrlUnesc||""),c.document.body.innerHTML+=e,s&&s(),c.removeEventListener("message",b),v();function i(){return function(e,t,n){l({message:"Prebid Native",action:"resizeNativeHeight",adId:e,height:t,width:n})}(t.adId,document.body.clientHeight||document.body.offsetHeight,document.body.clientWidth)}"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||[],h(o,a).forEach(function(t){var e=p(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){d=n;var r=o(e);f()&&c.pbNativeData.hasOwnProperty("assetsToReplace")&&c.pbNativeData.assetsToReplace.forEach(function(e){var t=e.match(/hb_native_/i)?e:A[e];t&&r.push(t)}),f()&&c.pbNativeData.hasOwnProperty("requestAllAssets")&&c.pbNativeData.requestAllAssets?(s=t,a=function(e){return l({message:"Prebid Native",action:"allAssetRequest",adId:e},b)}(e)):0<r.length?(s=t,a=function(e,t){return l({message:"Prebid Native",action:"assetRequest",adId:e,assets:t},b)}(e,r)):n&&n(new Error("No assets to load: no placeholders found in template"))},loadMobileAssets:function(e,t){0<o().length&&(s=t,r(e))}}};var y=n(5),_=n(0),w=n(1),k=n(7),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("click",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,t){var n=document.createElement("iframe");return n.setAttribute("frameborder",0),n.setAttribute("scrolling","no"),n.setAttribute("marginheight",0),n.setAttribute("marginwidth",0),n.setAttribute("TOPMARGIN",0),n.setAttribute("LEFTMARGIN",0),n.setAttribute("allowtransparency","true"),n.setAttribute("width",t),n.setAttribute("height",e),n}},function(e,t,n){"use strict";t.a=function(e){return!(!e.$sf||!e.$sf.ext)}}]);
|
package/dist/native-trk.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* prebid-universal-creative v1.
|
2
|
-
Updated : 2023-
|
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=2)}([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(4);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}();return function(e,t){if(null==o)throw new Error("Missing pubUrl");var n;if(e=JSON.stringify(e),null==t)i.parent.postMessage(e,o);else{var r=new MessageChannel;(n=r.port1).onmessage=t,i.addEventListener("message",a),i.parent.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)}}};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3);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[p]&&e.attributes[p].value||""}function s(e,t){d(t,"click")}function u(n){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:s;n=n||o(h);for(var e=function(e){var t=c(n[e]);n[e].addEventListener("click",function(e){r(e,t)},!0)},t=0;t<n.length;t++)e(t)}function d(e,t){if(""===e)console.warn("Prebid tracking event was missing 'adId'. Was adId macro set in the HTML attribute "+p+"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(l.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(l.e)}.bind(null,n)),(r||[]).forEach(l.e),a.filter(function(e){return 1===e.event&&1===e.method}).map(function(e){return e.url}).forEach(l.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(h);n.loadAssets(function(e){return 0<e.length&&e[0].attributes&&e[0].attributes[p]&&e[0].attributes[p].value||""}(r),u),u(r,s),0<r.length&&function(e){for(var t=0;t<e.length;t++){d(c(e[t]),"impression")}}(r)}}}};var l=n(0),f=n(5),v=n(1),h="pb-click",p="pbAdId"},function(e,t,n){"use strict";t.a=function(e,t){var n=document.createElement("iframe");return n.setAttribute("frameborder",0),n.setAttribute("scrolling","no"),n.setAttribute("marginheight",0),n.setAttribute("marginwidth",0),n.setAttribute("TOPMARGIN",0),n.setAttribute("LEFTMARGIN",0),n.setAttribute("allowtransparency","true"),n.setAttribute("width",t),n.setAttribute("height",e),n}},function(e,t,n){"use strict";t.a=function(o,e){var c,r,s=Object(y.a)(e,o),u=0;function d(){null!=r&&(r(),r=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 n(e){var t=e.uuid,n="".concat(function(e,t){var n=void 0===t||""===t?A:t;return"https://".concat(void 0===e||""===e?E:e).concat(n)}(e.cacheHost,e.cachePath),"?uuid=").concat(t);Object(g.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?w.image[e.img.type]?n.push({key:w.image[e.img.type],value:e.img.url}):console.log("ERROR: Invalid image type for image asset"):e.data?w.data[e.data.type]?n.push({key:w.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=b(o.document.body.innerHTML,r);o.document.body.innerHTML=a,c&&c({clickTrackers:r.clicktrackers,impTrackers:r.imptrackers,eventtrackers:r.eventtrackers})}}})}function l(){return void 0!==o.pbNativeData}function f(e,t){return t&&!l()?"".concat(e,":").concat(t):l()?"##".concat(e,"##"):e}function v(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(k).reduce(function(e,t){var n=f(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 a(e){return v(e,o.document.body.innerHTML,o.document.head.innerHTML)}function h(e){var t={};try{t=JSON.parse(e.data)}catch(e){return void(10<u++&&d())}if("assetResponse"===t.message){var n=o.document.body.innerHTML,r=o.document.head.innerHTML;if(l()&&t.adId!==o.pbNativeData.adId)return;r&&(o.document.head.innerHTML=b(r,t)),t.assets=t.assets||[];var a=t.assets;if(t.ortb&&(a.ortb=t.ortb,c=function(){Object(m.b)(t.adId,s),Object(m.a)(t.adId,t.ortb,s)}),t.hasOwnProperty("rendererUrl")&&t.rendererUrl||l()&&o.pbNativeData.hasOwnProperty("rendererUrl"))if(o.renderAd)p(o.renderAd&&o.renderAd(a)||"",t);else document.getElementById("pb-native-renderer")?document.getElementById("pb-native-renderer").addEventListener("load",function(){p(o.renderAd&&o.renderAd(a)||"",t)}):Object(g.a)(o,l()&&o.pbNativeData.hasOwnProperty("rendererUrl")&&o.pbNativeData.rendererUrl||t.rendererUrl,function(){p(o.renderAd&&o.renderAd(a)||"",t)});else if(t.hasOwnProperty("adTemplate")&&t.adTemplate||l()&&o.pbNativeData.hasOwnProperty("adTemplate")){p(b(l()&&o.pbNativeData.hasOwnProperty("adTemplate")&&o.pbNativeData.adTemplate||t.adTemplate,t),t)}else{var i=b(n,t);o.document.body.innerHTML=i,c&&c(),d()}}}function p(e,t){if(!Object(_.a)(window)){var n=function(e){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}}}}}(o);if(n&&n.children&&n.children[0]){var r=n.children[0];if("1"===r.width&&"1"===r.height){var a=n.getBoundingClientRect().width;o.document.body.style.width="".concat(a,"px")}}}o.document.body.innerHTML+=e,c&&c(),o.removeEventListener("message",h),d(),function(e,t,n){s({message:"Prebid Native",action:"resizeNativeHeight",adId:e,height:t,width:n})}(t.adId,document.body.clientHeight||document.body.offsetHeight,document.body.clientWidth),"function"==typeof window.postRenderAd&&window.postRenderAd(t)}function b(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.replace("##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.replace("##hb_native_asset_link_id_".concat(e.id,"##"),e.link.url))}),t=t.replaceAll(/##hb_native_asset_id_\d+##/gm,""),e.privacy&&(t=t.replace("##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||[],v(o,a).forEach(function(t){var e=f(t,o),n=new RegExp(e,"g"),r=i.find(function(e){return t===k[e.key]});a=a.replace(n,r?r.value:"")}),a}return{loadAssets:function(e,t){var n=a(e);l()&&o.pbNativeData.hasOwnProperty("assetsToReplace")&&o.pbNativeData.assetsToReplace.forEach(function(e){var t=e.match(/hb_native_/i)?e:k[e];t&&n.push(t)}),l()&&o.pbNativeData.hasOwnProperty("requestAllAssets")&&o.pbNativeData.requestAllAssets?(c=t,r=function(e){return s({message:"Prebid Native",action:"allAssetRequest",adId:e},h)}(e)):0<n.length&&(c=t,r=function(e,t){return s({message:"Prebid Native",action:"assetRequest",adId:e,assets:t},h)}(e,n))},loadMobileAssets:function(e,t){0<a().length&&(c=t,n(e))}}};var m=n(6),g=n(0),y=n(1),_=n(7),k={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"},w={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",A="/pbc/v1/cache"},function(e,t,n){"use strict";t.b=function(e,t){t({message:"Prebid Native",action:"fireNativeImpressionTrackers",adId:e})},t.a=function(e,t,r){for(var a={message:"Prebid Native",action:"click",adId:e},n=document.getElementsByClassName(o)||[],i=0;i<n.length;i++)n[i].addEventListener("click",function(e){var t=e.target,n=t&&t.getAttribute(c);a.assetId=n,r(a)},!0)};n(0);var o="pb-click",c="hb_native_asset_id"},function(e,t,n){"use strict";t.a=function(e){return!(!e.$sf||!e.$sf.ext)}}]);
|
1
|
+
/* prebid-universal-creative v1.16.0
|
2
|
+
Updated : 2023-10-12 */
|
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=2)}([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(4);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}();return function(e,t){if(null==o)throw new Error("Missing pubUrl");var n;if(e=JSON.stringify(e),null==t)i.parent.postMessage(e,o);else{var r=new MessageChannel;(n=r.port1).onmessage=t,i.addEventListener("message",a),i.parent.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)}}};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3);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[p]&&e.attributes[p].value||""}function s(e,t){u(t,"click")}function l(n){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:s;n=n||o(h);for(var e=function(e){var t=c(n[e]);n[e].addEventListener("click",function(e){r(e,t)},!0)},t=0;t<n.length;t++)e(t)}function u(e,t){if(""===e)console.warn("Prebid tracking event was missing 'adId'. Was adId macro set in the HTML attribute "+p+"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;l(!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(h);n.loadAssets(function(e){return 0<e.length&&e[0].attributes&&e[0].attributes[p]&&e[0].attributes[p].value||""}(r),l),l(r,s),0<r.length&&function(e){for(var t=0;t<e.length;t++){u(c(e[t]),"impression")}}(r)}}}};var d=n(0),f=n(5),v=n(1),h="pb-click",p="pbAdId"},function(e,t,n){"use strict";t.a=function(e,t){var n=document.createElement("iframe");return n.setAttribute("frameborder",0),n.setAttribute("scrolling","no"),n.setAttribute("marginheight",0),n.setAttribute("marginwidth",0),n.setAttribute("TOPMARGIN",0),n.setAttribute("LEFTMARGIN",0),n.setAttribute("allowtransparency","true"),n.setAttribute("width",t),n.setAttribute("height",e),n}},function(e,t,n){"use strict";t.a=function(c,e){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:k.a;e.clickUrlUnesc&&e.clickUrlUnesc!==N&&(I=e.clickUrlUnesc);var s,l,a,n=e.pubUrl,u=t(n,c),d=0;function f(){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?O:t;return"https://".concat(void 0===e||""===e?T: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?A.image[e.img.type]?n.push({key:A.image[e.img.type],value:e.img.url}):console.log("ERROR: Invalid image type for image asset"):e.data?A.data[e.data.type]?n.push({key:A.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(c.document.body.innerHTML,r);c.document.body.innerHTML=a,s&&s({clickTrackers:r.clicktrackers,impTrackers:r.imptrackers,eventtrackers:r.eventtrackers})}}})}function v(){return void 0!==c.pbNativeData}function h(e,t){return t&&!v()?"".concat(e,":").concat(t):v()?"##".concat(e,"##"):e}function p(s){for(var e=arguments.length,l=new Array(1<e?e-1:0),t=1;t<e;t++)l[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=l.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 p(e,c.document.body.innerHTML,c.document.head.innerHTML)}function b(e){try{var t={};try{t=JSON.parse(e.data)}catch(e){if(10<d++)throw f(),e;return}if("assetResponse"===t.message){t.clickUrlUnesc=I;var n=c.document.body.innerHTML,r=c.document.head.innerHTML;if(v()&&t.adId!==c.pbNativeData.adId)return;o=s,s=function(){Object(y.b)(t.adId,u),Object(y.a)(t.adId,u),o&&o()},r&&(c.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||v()&&c.pbNativeData.hasOwnProperty("rendererUrl"))if(c.renderAd)m(c.renderAd&&c.renderAd(a)||"",t);else document.getElementById("pb-native-renderer")?document.getElementById("pb-native-renderer").addEventListener("load",function(){m(c.renderAd&&c.renderAd(a)||"",t)}):Object(_.a)(c,v()&&c.pbNativeData.hasOwnProperty("rendererUrl")&&c.pbNativeData.rendererUrl||t.rendererUrl,function(){m(c.renderAd&&c.renderAd(a)||"",t)});else if(t.hasOwnProperty("adTemplate")&&t.adTemplate||v()&&c.pbNativeData.hasOwnProperty("adTemplate")){m(g(v()&&c.pbNativeData.hasOwnProperty("adTemplate")&&c.pbNativeData.adTemplate||t.adTemplate,t),t)}else{var i=g(n,t);c.document.body.innerHTML=i,s&&s(),f()}}}catch(e){l&&l(e)}var o}function m(e,t){if(!Object(w.a)(window)){var n=function(e){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 l=c.value;if(!l.contentWindow)return null;if(l.contentWindow===n)return l.parentElement}}catch(e){i=!0,o=e}finally{try{a||null==s.return||s.return()}finally{if(i)throw o}}}}}(c);if(n&&n.children&&n.children[0]){var r=n.children[0];if("1"===r.width&&"1"===r.height){var a=n.getBoundingClientRect().width;c.document.body.style.width="".concat(a,"px")}}}e=e.replaceAll(N,t.clickUrlUnesc||""),c.document.body.innerHTML+=e,s&&s(),c.removeEventListener("message",b),f();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,document.body.clientWidth)}"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||[],p(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);v()&&c.pbNativeData.hasOwnProperty("assetsToReplace")&&c.pbNativeData.assetsToReplace.forEach(function(e){var t=e.match(/hb_native_/i)?e:E[e];t&&r.push(t)}),v()&&c.pbNativeData.hasOwnProperty("requestAllAssets")&&c.pbNativeData.requestAllAssets?(s=t,a=function(e){return u({message:"Prebid Native",action:"allAssetRequest",adId:e},b)}(e)):0<r.length?(s=t,a=function(e,t){return u({message:"Prebid Native",action:"assetRequest",adId:e,assets:t},b)}(e,r)):n&&n(new Error("No assets to load: no placeholders found in template"))},loadMobileAssets:function(e,t){0<o().length&&(s=t,r(e))}}};var y=n(6),_=n(0),k=n(1),w=n(7),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"},A={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"}},T="prebid.adnxs.com",O="/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("click",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)}}]);
|
package/dist/native.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* prebid-universal-creative v1.
|
2
|
-
Updated : 2023-
|
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=2)}([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(6)},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}();return function(e,t){if(null==o)throw new Error("Missing pubUrl");var n;if(e=JSON.stringify(e),null==t)i.parent.postMessage(e,o);else{var r=new MessageChannel;(n=r.port1).onmessage=t,i.addEventListener("message",a),i.parent.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)}}};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),a=Object(r.a)(window);window.ucTag=window.ucTag||{},window.ucTag.renderAd=a.renderNativeAd},function(e,t,n){"use strict";t.a=function(a){var i;function o(e,t){if(""===e)console.warn("Prebid tracking event was missing 'adId'. Was adId macro set in the HTML attribute "+l+"on the ad's anchor element");else{var n={message:"Prebid Native",adId:e};"click"===t&&(n.action="click"),i(n)}}function c(){for(var e=function(e){return a.document.getElementsByClassName(e)||[]}(r),t=0;t<e.length;t++)e[t].addEventListener("click",function(e){o(window.pbNativeData.adId,"click")},!0)}return{renderNativeAd:function(e,t){window.pbNativeData=t,i=Object(d.a)(t.pubUrl,a);var n=Object(s.a)(window,t.pubUrl);if(t.hasOwnProperty("adId")){if(t.hasOwnProperty("rendererUrl")&&!t.rendererUrl.match(/##.*##/i)){var r=e.createElement("SCRIPT");r.src=t.rendererUrl,r.id="pb-native-renderer",e.body.appendChild(r)}n.loadAssets(t.adId,function(){!function(e){o(e,"impression")}(t.adId),c()})}else console.warn("Prebid Native Tag object was missing 'adId'.")}}};var s=n(4),d=n(1),r="pb-click",l="pbAdId"},function(e,t,n){"use strict";t.a=function(o,e){var c,r,s=Object(y.a)(e,o),d=0;function l(){null!=r&&(r(),r=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 n(e){var t=e.uuid,n="".concat(function(e,t){var n=void 0===t||""===t?N:t;return"https://".concat(void 0===e||""===e?A:e).concat(n)}(e.cacheHost,e.cachePath),"?uuid=").concat(t);Object(g.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?k.image[e.img.type]?n.push({key:k.image[e.img.type],value:e.img.url}):console.log("ERROR: Invalid image type for image asset"):e.data?k.data[e.data.type]?n.push({key:k.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=b(o.document.body.innerHTML,r);o.document.body.innerHTML=a,c&&c({clickTrackers:r.clicktrackers,impTrackers:r.imptrackers,eventtrackers:r.eventtrackers})}}})}function u(){return void 0!==o.pbNativeData}function v(e,t){return t&&!u()?"".concat(e,":").concat(t):u()?"##".concat(e,"##"):e}function f(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(w).reduce(function(e,t){var n=v(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 a(e){return f(e,o.document.body.innerHTML,o.document.head.innerHTML)}function p(e){var t={};try{t=JSON.parse(e.data)}catch(e){return void(10<d++&&l())}if("assetResponse"===t.message){var n=o.document.body.innerHTML,r=o.document.head.innerHTML;if(u()&&t.adId!==o.pbNativeData.adId)return;r&&(o.document.head.innerHTML=b(r,t)),t.assets=t.assets||[];var a=t.assets;if(t.ortb&&(a.ortb=t.ortb,c=function(){Object(m.b)(t.adId,s),Object(m.a)(t.adId,t.ortb,s)}),t.hasOwnProperty("rendererUrl")&&t.rendererUrl||u()&&o.pbNativeData.hasOwnProperty("rendererUrl"))if(o.renderAd)h(o.renderAd&&o.renderAd(a)||"",t);else document.getElementById("pb-native-renderer")?document.getElementById("pb-native-renderer").addEventListener("load",function(){h(o.renderAd&&o.renderAd(a)||"",t)}):Object(g.a)(o,u()&&o.pbNativeData.hasOwnProperty("rendererUrl")&&o.pbNativeData.rendererUrl||t.rendererUrl,function(){h(o.renderAd&&o.renderAd(a)||"",t)});else if(t.hasOwnProperty("adTemplate")&&t.adTemplate||u()&&o.pbNativeData.hasOwnProperty("adTemplate")){h(b(u()&&o.pbNativeData.hasOwnProperty("adTemplate")&&o.pbNativeData.adTemplate||t.adTemplate,t),t)}else{var i=b(n,t);o.document.body.innerHTML=i,c&&c(),l()}}}function h(e,t){if(!Object(_.a)(window)){var n=function(e){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}}}}}(o);if(n&&n.children&&n.children[0]){var r=n.children[0];if("1"===r.width&&"1"===r.height){var a=n.getBoundingClientRect().width;o.document.body.style.width="".concat(a,"px")}}}o.document.body.innerHTML+=e,c&&c(),o.removeEventListener("message",p),l(),function(e,t,n){s({message:"Prebid Native",action:"resizeNativeHeight",adId:e,height:t,width:n})}(t.adId,document.body.clientHeight||document.body.offsetHeight,document.body.clientWidth),"function"==typeof window.postRenderAd&&window.postRenderAd(t)}function b(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.replace("##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.replace("##hb_native_asset_link_id_".concat(e.id,"##"),e.link.url))}),t=t.replaceAll(/##hb_native_asset_id_\d+##/gm,""),e.privacy&&(t=t.replace("##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||[],f(o,a).forEach(function(t){var e=v(t,o),n=new RegExp(e,"g"),r=i.find(function(e){return t===w[e.key]});a=a.replace(n,r?r.value:"")}),a}return{loadAssets:function(e,t){var n=a(e);u()&&o.pbNativeData.hasOwnProperty("assetsToReplace")&&o.pbNativeData.assetsToReplace.forEach(function(e){var t=e.match(/hb_native_/i)?e:w[e];t&&n.push(t)}),u()&&o.pbNativeData.hasOwnProperty("requestAllAssets")&&o.pbNativeData.requestAllAssets?(c=t,r=function(e){return s({message:"Prebid Native",action:"allAssetRequest",adId:e},p)}(e)):0<n.length&&(c=t,r=function(e,t){return s({message:"Prebid Native",action:"assetRequest",adId:e,assets:t},p)}(e,n))},loadMobileAssets:function(e,t){0<a().length&&(c=t,n(e))}}};var m=n(5),g=n(0),y=n(1),_=n(7),w={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"},k={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",N="/pbc/v1/cache"},function(e,t,n){"use strict";t.b=function(e,t){t({message:"Prebid Native",action:"fireNativeImpressionTrackers",adId:e})},t.a=function(e,t,r){for(var a={message:"Prebid Native",action:"click",adId:e},n=document.getElementsByClassName(o)||[],i=0;i<n.length;i++)n[i].addEventListener("click",function(e){var t=e.target,n=t&&t.getAttribute(c);a.assetId=n,r(a)},!0)};n(0);var o="pb-click",c="hb_native_asset_id"},function(e,t,n){"use strict";t.a=function(e,t){var n=document.createElement("iframe");return n.setAttribute("frameborder",0),n.setAttribute("scrolling","no"),n.setAttribute("marginheight",0),n.setAttribute("marginwidth",0),n.setAttribute("TOPMARGIN",0),n.setAttribute("LEFTMARGIN",0),n.setAttribute("allowtransparency","true"),n.setAttribute("width",t),n.setAttribute("height",e),n}},function(e,t,n){"use strict";t.a=function(e){return!(!e.$sf||!e.$sf.ext)}}]);
|
1
|
+
/* prebid-universal-creative v1.16.0
|
2
|
+
Updated : 2023-10-12 */
|
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=2)}([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(6)},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}();return function(e,t){if(null==o)throw new Error("Missing pubUrl");var n;if(e=JSON.stringify(e),null==t)i.parent.postMessage(e,o);else{var r=new MessageChannel;(n=r.port1).onmessage=t,i.addEventListener("message",a),i.parent.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)}}};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),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]:a.a,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:r.a;return{renderNativeAd:function(e,t){function n(e,t,n){o({message:"Prebid Event",adId:e,event:t?"adRenderSucceeded":"adRenderFailed",info:n})}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,!0)},function(e){n(t.adId,!1,{reason:"exception",message:e.message})})}else n(null,!1,{reason:"missingDocOrAdid"}),console.warn("Prebid Native Tag object was missing 'adId'.")}catch(e){n(t&&t.adId,!1,{reason:"exception",message:e.message}),console.error("Error rendering ad",e)}}}};var r=n(4),a=n(1)},function(e,t,n){"use strict";t.a=function(c,e){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:w.a;e.clickUrlUnesc&&e.clickUrlUnesc!==I&&(U=e.clickUrlUnesc);var s,d,a,n=e.pubUrl,l=t(n,c),u=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=g(c.document.body.innerHTML,r);c.document.body.innerHTML=a,s&&s({clickTrackers:r.clicktrackers,impTrackers:r.imptrackers,eventtrackers:r.eventtrackers})}}})}function f(){return void 0!==c.pbNativeData}function p(e,t){return t&&!f()?"".concat(e,":").concat(t):f()?"##".concat(e,"##"):e}function h(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=p(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 h(e,c.document.body.innerHTML,c.document.head.innerHTML)}function b(e){try{var t={};try{t=JSON.parse(e.data)}catch(e){if(10<u++)throw v(),e;return}if("assetResponse"===t.message){t.clickUrlUnesc=U;var n=c.document.body.innerHTML,r=c.document.head.innerHTML;if(f()&&t.adId!==c.pbNativeData.adId)return;o=s,s=function(){Object(y.b)(t.adId,l),Object(y.a)(t.adId,l),o&&o()},r&&(c.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||f()&&c.pbNativeData.hasOwnProperty("rendererUrl"))if(c.renderAd)m(c.renderAd&&c.renderAd(a)||"",t);else document.getElementById("pb-native-renderer")?document.getElementById("pb-native-renderer").addEventListener("load",function(){m(c.renderAd&&c.renderAd(a)||"",t)}):Object(_.a)(c,f()&&c.pbNativeData.hasOwnProperty("rendererUrl")&&c.pbNativeData.rendererUrl||t.rendererUrl,function(){m(c.renderAd&&c.renderAd(a)||"",t)});else if(t.hasOwnProperty("adTemplate")&&t.adTemplate||f()&&c.pbNativeData.hasOwnProperty("adTemplate")){m(g(f()&&c.pbNativeData.hasOwnProperty("adTemplate")&&c.pbNativeData.adTemplate||t.adTemplate,t),t)}else{var i=g(n,t);c.document.body.innerHTML=i,s&&s(),v()}}}catch(e){d&&d(e)}var o}function m(e,t){if(!Object(k.a)(window)){var n=function(e){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}}}}}(c);if(n&&n.children&&n.children[0]){var r=n.children[0];if("1"===r.width&&"1"===r.height){var a=n.getBoundingClientRect().width;c.document.body.style.width="".concat(a,"px")}}}e=e.replaceAll(I,t.clickUrlUnesc||""),c.document.body.innerHTML+=e,s&&s(),c.removeEventListener("message",b),v();function i(){return function(e,t,n){l({message:"Prebid Native",action:"resizeNativeHeight",adId:e,height:t,width:n})}(t.adId,document.body.clientHeight||document.body.offsetHeight,document.body.clientWidth)}"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||[],h(o,a).forEach(function(t){var e=p(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){d=n;var r=o(e);f()&&c.pbNativeData.hasOwnProperty("assetsToReplace")&&c.pbNativeData.assetsToReplace.forEach(function(e){var t=e.match(/hb_native_/i)?e:A[e];t&&r.push(t)}),f()&&c.pbNativeData.hasOwnProperty("requestAllAssets")&&c.pbNativeData.requestAllAssets?(s=t,a=function(e){return l({message:"Prebid Native",action:"allAssetRequest",adId:e},b)}(e)):0<r.length?(s=t,a=function(e,t){return l({message:"Prebid Native",action:"assetRequest",adId:e,assets:t},b)}(e,r)):n&&n(new Error("No assets to load: no placeholders found in template"))},loadMobileAssets:function(e,t){0<o().length&&(s=t,r(e))}}};var y=n(5),_=n(0),w=n(1),k=n(7),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("click",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,t){var n=document.createElement("iframe");return n.setAttribute("frameborder",0),n.setAttribute("scrolling","no"),n.setAttribute("marginheight",0),n.setAttribute("marginwidth",0),n.setAttribute("TOPMARGIN",0),n.setAttribute("LEFTMARGIN",0),n.setAttribute("allowtransparency","true"),n.setAttribute("width",t),n.setAttribute("height",e),n}},function(e,t,n){"use strict";t.a=function(e){return!(!e.$sf||!e.$sf.ext)}}]);
|
package/dist/uid.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
/* v1.
|
2
|
-
Updated : 2023-
|
1
|
+
/* v1.16.0
|
2
|
+
Updated : 2023-10-12 */
|
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.
|
2
|
-
Updated : 2023-
|
3
|
-
!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=2)}([function(e,t,n){"use strict";t.b=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.a=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(1);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";t.a=function(e,t){var n=document.createElement("iframe");return n.setAttribute("frameborder",0),n.setAttribute("scrolling","no"),n.setAttribute("marginheight",0),n.setAttribute("marginwidth",0),n.setAttribute("TOPMARGIN",0),n.setAttribute("LEFTMARGIN",0),n.setAttribute("allowtransparency","true"),n.setAttribute("width",t),n.setAttribute("height",e),n},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(3);window.ucTag=window.ucTag||{},window.ucTag.renderAd=r.a},function(e,t,n){"use strict";t.a=function(e,t){var n=Object(r.b)(t);Object(o.a)(window)?function(e,t){for(var n=window,
|
1
|
+
/* prebid-universal-creative v1.16.0
|
2
|
+
Updated : 2023-10-12 */
|
3
|
+
!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=2)}([function(e,t,n){"use strict";t.b=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.a=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(1);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";t.a=function(e,t){var n=document.createElement("iframe");return n.setAttribute("frameborder",0),n.setAttribute("scrolling","no"),n.setAttribute("marginheight",0),n.setAttribute("marginwidth",0),n.setAttribute("TOPMARGIN",0),n.setAttribute("LEFTMARGIN",0),n.setAttribute("allowtransparency","true"),n.setAttribute("width",t),n.setAttribute("height",e),n},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(3);window.ucTag=window.ucTag||{},window.ucTag.renderAd=r.a},function(e,t,n){"use strict";t.a=function(e,t){var n=Object(r.b)(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{n=!0,r.pbjs.renderAd(e,t);break}catch(e){continue}n||console.error("Unable to locate pbjs.renderAd function!")}(e,n.adId):function(l,f){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"",t=3<arguments.length?arguments[3]:void 0,n=l.location,r=e||l.location.hostname,o=n.protocol+"//"+r,g=Object(i.a)(t,l);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===f)try{var r=l.document.body,o=n.ad,a=n.adUrl,i=n.width,c=n.height;if("video"===n.mediaType)d(!1,{reason:"preventWritingOnMainDocument",message:"Cannot render video ad ".concat(f)}),console.log("Error trying to write ad.");else if(o){var s=Object(h.a)(n.height,n.width);r.appendChild(s),s.contentDocument.open(),s.contentDocument.write(o),s.contentDocument.close(),d(!0)}else if(a){var u=Object(h.a)(c,i);u.style.display="inline",u.style.overflow="hidden",u.src=a,Object(h.b)(u,document,"body"),d(!0)}else d(!1,{reason:"noAd",message:"No ad for ".concat(f)}),console.log("Error trying to write ad. No ad markup or adUrl for ".concat(f))}catch(e){d(!1,{reason:"exception",message:e.message}),console.log("Error in rendering ad",e)}function d(e,t){var n=1<arguments.length&&void 0!==t?t:{},r=n.reason,o=n.message,a={message:"Prebid Event",adId:f,event:e?"adRenderSucceeded":"adRenderFailed"};e||(a.info={reason:r,message:o}),g(a)}}g({message:"Prebid Request",adId:f,adServerDomain:o},a)}(window,n.adId,n.adServerDomain,n.pubUrl)};var r=n(0),o=n(4),h=n(1),i=n(5)},function(e,t,n){"use strict";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}},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.a)(t);return e.protocol+"://"+e.host}();return function(e,t){if(null==i)throw new Error("Missing pubUrl");var n;if(e=JSON.stringify(e),null==t)a.parent.postMessage(e,i);else{var r=new MessageChannel;(n=r.port1).onmessage=t,a.addEventListener("message",o),a.parent.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)}}};var r=n(0)}]);
|
package/gulpfile.js
CHANGED
@@ -32,7 +32,7 @@ function clean() {
|
|
32
32
|
|
33
33
|
/**
|
34
34
|
* This generic function will compile the file specified as inputFile and will
|
35
|
-
* generate an output file in the build directory.
|
35
|
+
* generate an output file in the build directory.
|
36
36
|
*/
|
37
37
|
function buildDev({ inputFile, outputFile }) {
|
38
38
|
var cloned = _.cloneDeep(webpackConfig);
|
@@ -234,7 +234,7 @@ function newKarmaCallback(done) {
|
|
234
234
|
process.exit(exitCode);
|
235
235
|
}
|
236
236
|
}
|
237
|
-
}
|
237
|
+
}
|
238
238
|
}
|
239
239
|
|
240
240
|
function setupE2E(done) {
|
@@ -265,11 +265,7 @@ function watch(done) {
|
|
265
265
|
done();
|
266
266
|
}
|
267
267
|
|
268
|
-
|
269
|
-
return opens(`${(argv.https) ? 'https' : 'http'}://localhost:${port}`);
|
270
|
-
}
|
271
|
-
|
272
|
-
gulp.task('serve', gulp.series(clean, gulp.parallel(...buildDevFunctions, watch, test), openWebPage));
|
268
|
+
gulp.task('serve', gulp.series(clean, gulp.parallel(...buildDevFunctions, watch, test)));
|
273
269
|
|
274
270
|
gulp.task('build-dev', gulp.parallel(...buildDevFunctions));
|
275
271
|
|
package/karma.conf.maker.js
CHANGED
@@ -3,7 +3,7 @@ const webpackConf = require('./webpack.conf');
|
|
3
3
|
const karmaConstants = require('karma').constants;
|
4
4
|
const path = require('path');
|
5
5
|
|
6
|
-
function setBrowsers(karmaConf, browserstack
|
6
|
+
function setBrowsers(karmaConf, browserstack) {
|
7
7
|
if (browserstack) {
|
8
8
|
karmaConf.browserStack = {
|
9
9
|
username: process.env.BROWSERSTACK_USERNAME,
|
@@ -12,8 +12,6 @@ function setBrowsers(karmaConf, browserstack, watchMode) {
|
|
12
12
|
}
|
13
13
|
karmaConf.customLaunchers = require('./browsers.json')
|
14
14
|
karmaConf.browsers = Object.keys(karmaConf.customLaunchers);
|
15
|
-
} else if (watchMode) {
|
16
|
-
karmaConf.browsers = ['Chrome'];
|
17
15
|
}
|
18
16
|
}
|
19
17
|
|
@@ -29,7 +27,7 @@ function setReporters(karmaConf, codeCoverage, browserstack) {
|
|
29
27
|
suppressPassed: true
|
30
28
|
};
|
31
29
|
}
|
32
|
-
|
30
|
+
|
33
31
|
if (codeCoverage) {
|
34
32
|
karmaConf.reporters.push('coverage-istanbul');
|
35
33
|
karmaConf.coverageIstanbulReporter = {
|
@@ -41,7 +39,7 @@ function setReporters(karmaConf, codeCoverage, browserstack) {
|
|
41
39
|
urlFriendlyName: true, // simply replaces spaces with _ for files/dirs
|
42
40
|
}
|
43
41
|
}
|
44
|
-
}
|
42
|
+
}
|
45
43
|
}
|
46
44
|
}
|
47
45
|
|
@@ -149,6 +147,6 @@ module.exports = function(codeCoverage, browserstack, watchMode) {
|
|
149
147
|
captureTimeout: 4 * 60 * 1000, // default 60000
|
150
148
|
}
|
151
149
|
setReporters(config, codeCoverage, browserstack);
|
152
|
-
setBrowsers(config, browserstack
|
150
|
+
setBrowsers(config, browserstack);
|
153
151
|
return config;
|
154
152
|
}
|
package/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "prebid-universal-creative",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.16.0",
|
4
4
|
"description": "Universal creative for Prebid apps",
|
5
5
|
"main": "dist/creative.js",
|
6
6
|
"scripts": {
|
7
|
-
"test": "
|
7
|
+
"test": "gulp test",
|
8
8
|
"prepublish": "gulp build"
|
9
9
|
},
|
10
10
|
"repository": {
|
@@ -58,14 +58,14 @@
|
|
58
58
|
"karma-chrome-launcher": "^2.2.0",
|
59
59
|
"karma-coverage": "^1.1.2",
|
60
60
|
"karma-coverage-istanbul-reporter": "^1.4.3",
|
61
|
-
"karma-mocha": "^
|
61
|
+
"karma-mocha": "^2.0.1",
|
62
62
|
"karma-mocha-reporter": "^2.2.5",
|
63
63
|
"karma-sinon": "^1.0.5",
|
64
64
|
"karma-sourcemap-loader": "^0.3.7",
|
65
65
|
"karma-spec-reporter": "^0.0.31",
|
66
66
|
"karma-webpack": "^3.0.5",
|
67
67
|
"lodash": "^4.17.14",
|
68
|
-
"mocha": "^
|
68
|
+
"mocha": "^10.2.0",
|
69
69
|
"opn": "^6.0.0",
|
70
70
|
"sinon": "^6.3.4",
|
71
71
|
"string-replace-webpack-plugin": "^0.1.3",
|