From 62fa515ec84a6a4148371737d24eedd643481916 Mon Sep 17 00:00:00 2001 From: Eiman Eltigani Date: Tue, 30 Dec 2025 11:00:58 -0700 Subject: [PATCH] remove deprecated sample sites from static/examples folder --- static/examples/cstg-prebid-example/README.md | 17 - static/examples/cstg-prebid-example/app.css | 102 -- .../examples/cstg-prebid-example/index.html | 166 -- static/examples/cstg-prebid-example/prebid.js | 31 - static/examples/hashing-tool/app.css | 110 -- static/examples/hashing-tool/index.html | 155 -- .../examples/hashing-tool/uid2-sdk-3.3.0.js | 1520 ----------------- 7 files changed, 2101 deletions(-) delete mode 100644 static/examples/cstg-prebid-example/README.md delete mode 100644 static/examples/cstg-prebid-example/app.css delete mode 100644 static/examples/cstg-prebid-example/index.html delete mode 100644 static/examples/cstg-prebid-example/prebid.js delete mode 100644 static/examples/hashing-tool/app.css delete mode 100644 static/examples/hashing-tool/index.html delete mode 100644 static/examples/hashing-tool/uid2-sdk-3.3.0.js diff --git a/static/examples/cstg-prebid-example/README.md b/static/examples/cstg-prebid-example/README.md deleted file mode 100644 index 017220d78..000000000 --- a/static/examples/cstg-prebid-example/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Example Prebid.js UID2 Integration - -## Viewing live site - -This example demonstrates the [UID2 Client-Side Integration Guide for Prebid.js](https://unifiedid.com/docs/guides/integration-prebid-client-side). - -To view the site running, navigate to [https://unifiedid.com/examples/cstg-prebid-example/](https://unifiedid.com/examples/cstg-prebid-example/). - -## Running locally - -To run this example, run `npm start` and navigate to [http://localhost:3006/examples/cstg-prebid-example/](http://localhost:3006/examples/cstg-prebid-example/). - -When running locally, the configuration values in `index.html` will not work, as it's set up for the integration environment which won't accept calls running on `localhost`. To run it locally, you will need the Operator running locally using `local-config.json` (usually done via IntelliJ) and update `window.uid2_example_settings` to point to your local operator and use a valid client-side key. - -## Prebid.js - -This file is a build of Prebid.js with the userId, uid2IdSystem and appnexusBidAdapter modules included. \ No newline at end of file diff --git a/static/examples/cstg-prebid-example/app.css b/static/examples/cstg-prebid-example/app.css deleted file mode 100644 index 507d0cc69..000000000 --- a/static/examples/cstg-prebid-example/app.css +++ /dev/null @@ -1,102 +0,0 @@ -body { - padding: 50px; - font: - 14px 'Lucida Grande', - Helvetica, - Arial, - sans-serif; -} - -a { - color: #00b7ff; -} - -.button { - border-style: none; - cursor: pointer; - align-items: center; - height: 40px; - width: 401px; - text-align: center; - position: absolute; - letter-spacing: 0.28px; - box-sizing: border-box; - color: white; - font-family: 'Raleway', Helvetica, Arial, serif; - font-size: 14px; - font-style: normal; - font-weight: 700; - text-transform: none; - text-indent: 0; - text-shadow: none; - margin: 0; - padding: 1px 6px; - background-color: rgba(2, 10, 64); - border-image: initial; -} - -.form { - margin-top: 40px; -} - -.email_prompt { - align-items: center; - align-self: center; - background-color: white; - border: 1px solid rgba(2, 10, 64); - border-radius: 2px; - box-sizing: border-box; - display: inline-flex; - flex-direction: row; - flex-shrink: 0; - height: 40px; - justify-content: flex-start; - margin-right: 1px; - margin-bottom: 20px; - min-width: 399px; - padding: 0 16px; - position: relative; - width: auto; -} - -#email { - background-color: white; - flex-shrink: 0; - height: auto; - letter-spacing: 0.12px; - line-height: 16px; - min-height: 16px; - position: relative; - text-align: left; - white-space: nowrap; - width: 351px; - color: rgba(2, 10, 64, 1); - font-family: 'Raleway', Helvetica, Arial, serif; - font-size: 12px; - font-style: normal; - font-weight: 500; - padding: 1px 2px; - outline: none; -} - -h1 { - padding-bottom: 20px; -} - -#uid2_state .label { - white-space: nowrap; - padding-right: 20px; -} -#uid2_state tr { - margin-top: 10px; -} - -.message { - color: green; - padding: 20px; - margin-left: -22px; - font-size: 16px; - font-weight: 500; - border: 2px solid green; - border-radius: 5px; -} diff --git a/static/examples/cstg-prebid-example/index.html b/static/examples/cstg-prebid-example/index.html deleted file mode 100644 index 00d5a9d5a..000000000 --- a/static/examples/cstg-prebid-example/index.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - UID2 Prebid.js Client-Side Integration Example - - - - - - - -

UID2 Prebid.js Client-Side Integration Example

-

- This example demonstrates how a content publisher can integrate with UID2 and Prebid.js using the UID2 Client-Side Integration Guide for Prebid.js, which includes generating UID2 tokens within the browser. - Note: This is a test-only integration environment—not for production use. - It does not perform real user authentication or generate production-level tokens. - Do not use real user data on this page. -

- - - - - - - - - -
Ready for Targeted Advertising:
UID2 Advertising Token:
-
-
- - - - - diff --git a/static/examples/cstg-prebid-example/prebid.js b/static/examples/cstg-prebid-example/prebid.js deleted file mode 100644 index f889fca5b..000000000 --- a/static/examples/cstg-prebid-example/prebid.js +++ /dev/null @@ -1,31 +0,0 @@ -/* prebid.js v8.39.0 -Updated: 2024-03-05 -Modules: userId, ttdBidAdapter, consentManagement, consentManagementGpp, consentManagementUsp, enrichmentFpdModule, gdprEnforcement, gppControl_usnat, gppControl_usstates, gptPreAuction, euidIdSystem, unifiedIdSystem, uid2IdSystem */ -if(window.pbjs&&window.pbjs.libLoaded)try{window.pbjs.getConfig("debug")&&console.warn("Attempted to load a copy of Prebid.js that clashes with the existing 'pbjs' instance. Load aborted.")}catch(e){}else (function(){ -!function(){var e,n={35706:function(e,n,t){t.d(n,{Pd:function(){return d},Th:function(){return s},_U:function(){return f}});var r=t(55730),i=t(64358),o=t(20265),a=t(34614),u=(0,t(78640).R)(),c="outstream";function s(e){var n=this,t=e.url,o=e.config,a=e.id,u=e.callback,s=e.loaded,d=e.adUnitCode,f=e.renderNow;this.url=t,this.config=o,this.handlers={},this.id=a,this.renderNow=f,this.loaded=s,this.cmd=[],this.push=function(e){"function"==typeof e?n.loaded?e.call():n.cmd.push(e):(0,i.logError)("Commands given to Renderer.push must be wrapped in a function")},this.callback=u||function(){n.loaded=!0,n.process()},this.render=function(){var e=this,n=arguments,o=function(){e._render?e._render.apply(e,n):(0,i.logWarn)("No render function was provided, please use .setRender on the renderer")};l(d)?((0,i.logWarn)("External Js not loaded by Renderer since renderer url and callback is already defined on adUnit ".concat(d)),o()):f?o():(this.cmd.unshift(o),(0,r.B)(t,c,this.callback,this.documentContext))}.bind(this)}function d(e){return!(!e||!e.url&&!e.renderNow)}function f(e,n,t){var r=null;e.config&&e.config.documentResolver&&(r=e.config.documentResolver(n,document,t)),r||(r=document),e.documentContext=r,e.render(n,e.documentContext)}function l(e){var n=u.adUnits,t=(0,a.sE)(n,(function(n){return n.code===e}));if(!t)return!1;var r=(0,o.Z)(t,"renderer"),i=!!(r&&r.url&&r.render),c=(0,o.Z)(t,"mediaTypes.video.renderer"),s=!!(c&&c.url&&c.render);return!!(i&&!0!==r.backupOnly||s&&!0!==c.backupOnly)}s.install=function(e){return new s({url:e.url,config:e.config,id:e.id,callback:e.callback,loaded:e.loaded,adUnitCode:e.adUnitCode,renderNow:e.renderNow})},s.prototype.getConfig=function(){return this.config},s.prototype.setRender=function(e){this._render=e},s.prototype.setEventHandlers=function(e){this.handlers=e},s.prototype.handleVideoEvent=function(e){var n=e.id,t=e.eventName;"function"==typeof this.handlers[t]&&this.handlers[t](),(0,i.logMessage)("Prebid Renderer event for id ".concat(n," type ").concat(t))},s.prototype.process=function(){for(;this.cmd.length>0;)try{this.cmd.shift().call()}catch(e){(0,i.logError)("Error processing Renderer command: ",e)}}},74947:function(e,n,t){t.d(n,{EL:function(){return a},Jt:function(){return l},K$:function(){return i},S1:function(){return r},S5:function(){return o},UE:function(){return u},e:function(){return s},g0:function(){return f},oK:function(){return d},x$:function(){return c}});var r="accessDevice",i="syncUser",o="enrichUfpd",a="enrichEids",u="fetchBids",c="reportAnalytics",s="transmitEids",d="transmitUfpd",f="transmitPreciseGeo",l="transmitTid"},10286:function(e,n,t){t.d(n,{T:function(){return i}});var r=t(86104),i=(0,t(16310).Oj)((function(e){return r.ZP.resolveAlias(e)}))},9633:function(e,n,t){t.d(n,{UL:function(){return i},XG:function(){return a},_U:function(){return u},wu:function(){return r},y2:function(){return o}});var r="prebid",i="bidder",o="userId",a="rtd",u="analytics"},16310:function(e,n,t){t.d(n,{$k:function(){return u},Hw:function(){return p},IV:function(){return g},JR:function(){return a},Ki:function(){return s},Oj:function(){return v},Qf:function(){return f},Ww:function(){return h},bL:function(){return d},bp:function(){return c},cx:function(){return l}});var r=t(4942),i=t(9633),o=t(92797),a="component",u=a+"Type",c=a+"Name",s="adapterCode",d="storageType",f="configName",l="syncType",g="syncUrl",p="_config";function v(e){return function(n,t,o){var d,f=(d={},(0,r.Z)(d,u,n),(0,r.Z)(d,c,t),(0,r.Z)(d,a,"".concat(n,".").concat(t)),d);return n===i.UL&&(f[s]=e(t)),h(Object.assign(f,o))}}var h=(0,o.z3)("sync",(function(e){return e}))},41087:function(e,n,t){t.d(n,{$8:function(){return f},Db:function(){return v},Mp:function(){return w},RD:function(){return h},ZZ:function(){return l},a:function(){return m},hb:function(){return E},js:function(){return b}});var r=t(71002),i=t(93324),o=t(20265),a=t(3193),u=t(50571),c=t(74947);function s(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(!e)return;if("string"==typeof e)return d(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return d(e,n)}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}function d(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t0?n.join("."):null,t]}))})),function(n,t){for(var r=[],a=arguments.length,u=new Array(a>2?a-2:0),c=2;c1?n-1:0),r=1;r0)}function b(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.xD;return function(t){return!n(e,t)}}function y(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.xD;return[{name:c.e,paths:["userId","userIdAsEids"],applies:b(c.e,e)},{name:c.Jt,paths:["ortb2Imp.ext.tid"],applies:b(c.Jt,e)}].map(p)}function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.xD;return[{name:c.oK,paths:f,applies:b(c.oK,e)},{name:c.e,paths:l,applies:b(c.e,e)},{name:c.g0,paths:g,applies:b(c.g0,e),get:function(e){return Math.round(100*(e+Number.EPSILON))/100}},{name:c.Jt,paths:["source.tid"],applies:b(c.Jt,e)}].map(p)}var E=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.xD,n=v(w(e)),t=v(y(e));return function(e){var r={};return{ortb2:function(t){return n(r,t,e),t},bidRequest:function(n){return t(r,n,e),n}}}}();(0,u.oB)(c.Jt,"enableTIDs config",(function(){if(!a.vc.getConfig("enableTIDs"))return{allow:!1,reason:"TIDs are disabled"}}))},50571:function(e,n,t){t.d(n,{oB:function(){return d},xD:function(){return f}});var r=t(93324),i=t(64358),o=t(16310);function a(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(!e)return;if("string"==typeof e)return u(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return u(e,n)}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,c=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){c=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(c)throw o}}}}function u(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t0&&void 0!==arguments[0]?arguments[0]:(0,i.prefixLog)("Activity control:"),n={};function t(e){return n[e]=n[e]||[]}function u(n,t,r,i){var a;try{a=r(i)}catch(r){e.logError("Exception in rule ".concat(t," for '").concat(n,"'"),r),a={allow:!1,reason:r}}return a&&Object.assign({activity:n,name:t,component:i[o.JR]},a)}var c={},s=1e3;function d(n){var t=n.activity,r=n.name,i=n.allow,o=n.reason,a=n.component,u="".concat(r," ").concat(i?"allowed":"denied"," '").concat(t,"' for '").concat(a,"'").concat(o?":":""),d=c.hasOwnProperty(u);if(d&&clearTimeout(c[u]),c[u]=setTimeout((function(){return delete c[u]}),s),!d){var f=[u];o&&f.push(o),(i?e.logInfo:e.logWarn).apply(e,f)}}return[function(e,n,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,a=t(e),u=a.findIndex((function(e){var n=(0,r.Z)(e,1)[0];return o=0&&a.splice(e,1)}},function(e,n){var i,o,c,s=a(t(e));try{for(s.s();!(c=s.n()).done;){var f=(0,r.Z)(c.value,3),l=f[0],g=f[1],p=f[2];if(i!==l&&o)break;i=l;var v=u(e,g,p,n);if(v){if(!v.allow)return d(v),!1;o=v}}}catch(e){s.e(e)}finally{s.f()}return o&&d(o),!0}]}(),s=(0,r.Z)(c,2),d=s[0],f=s[1]},13667:function(e,n,t){t.d(n,{E$:function(){return I},Lj:function(){return O},XD:function(){return k},XF:function(){return S},oc:function(){return C},tV:function(){return B}});var r=t(4942),i=t(64358),o=t(20265),a=t(52021),u=t(5644),c=t(3193),s=t(35706),d=t(24679),f=t(78653),l=t(88099),g=t(92797),p=t(70059),v=u.FP,h=v.AD_RENDER_FAILED,m=v.AD_RENDER_SUCCEEDED,b=v.STALE_RENDER,y=v.BID_WON,w=u.q_.XW;function E(e){var n=e.reason,t=e.message,r=e.bid,o=e.id,u={reason:n,message:t};r&&(u.bid=r,u.adId=r.adId),o&&(u.adId=o),(0,i.logError)("Error rendering ad (id: ".concat(o,"): ").concat(t)),a.emit(h,u)}function A(e){var n=e.doc,t=e.bid,r=e.id,i={doc:n};t&&(i.bid=t),r&&(i.adId=r),a.emit(m,i)}function C(e,n){switch(e.event){case u.FP.AD_RENDER_FAILED:E({bid:n,id:n.adId,reason:e.info.reason,message:e.info.message});break;case u.FP.AD_RENDER_SUCCEEDED:A({doc:null,bid:n,id:n.adId});break;default:(0,i.logError)("Received event request for unsupported event: '".concat(e.event,"' (adId: '").concat(n.adId,"')"))}}function I(e,n,t){var r=t.resizeFn,i=t.fireTrackers,o=void 0===i?p.e6:i;if("resizeNativeHeight"===e.action)r(e.width,e.height);else o(e,n)}var T=(0,r.Z)({},u.X3.EVENT,C);T[u.X3.NATIVE]=I;var O=(0,g.z3)("sync",(function(e,n){var t=e.ad,r=e.adUrl,o=e.cpm,a=e.originalCpm,u=e.width,c=e.height,s={AUCTION_PRICE:a||o,CLICKTHROUGH:(null==n?void 0:n.clickUrl)||""};return{ad:(0,i.replaceMacros)(t,s),adUrl:(0,i.replaceMacros)(r,s),width:u,height:c}})),S=(0,g.z3)("sync",(function(e){var n=e.renderFn,t=e.resizeFn,r=e.bidResponse,i=e.options;if(r.mediaType!==d.pX){var o=O(r,i);n(Object.assign({adId:r.adId},o));var a=o.width,c=o.height;null!=(null!=a?a:c)&&t(a,c)}else E({reason:u.q_.Sn,message:"Cannot render video ad",bid:r,id:r.adId})}));function k(e){var n=e.renderFn,t=e.resizeFn,r=e.adId,s=e.options,d=e.bidResponse,l=e.doc;if(null!=d){if(d.status!==u.UE.fe||((0,i.logWarn)("Ad id ".concat(r," has been rendered before")),a.emit(b,d),!(0,o.Z)(c.vc.getConfig("auctionOptions"),"suppressStaleRender"))){try{S({renderFn:n,resizeFn:t,bidResponse:d,options:s,doc:l})}catch(e){E({reason:u.q_.XW,message:e.message,id:r,bid:d})}f.K.addWinningBid(d),a.emit(y,d)}}else E({reason:u.q_.WT,message:"Cannot find ad '".concat(r,"'"),id:r})}function B(e,n,t){var r;function o(e,t){E(Object.assign({id:n,bid:r},{reason:e,message:t}))}function a(n,t){e.defaultView&&e.defaultView.frameElement&&(n&&(e.defaultView.frameElement.width=n),t&&(e.defaultView.frameElement.height=t))}var c,s=(c={resizeFn:a},function(e,n,t){T.hasOwnProperty(e)&&T[e](n,t,c)});try{n&&e?(r=f.K.findBidByAdId(n),e!==document||(0,i.inIframe)()?k({renderFn:function(n){n.ad?(e.write(n.ad),e.close(),A({doc:e,bid:r,adId:r.adId})):(0,l.W)(r).then((function(t){return t(n,{sendMessage:function(e,n){return s(e,n,r)},mkFrame:i.createIframe},e.defaultView)})).then((function(){return A({doc:e,bid:r,adId:r.adId})}),(function(e){o((null==e?void 0:e.reason)||u.q_.XW,null==e?void 0:e.message),(null==e?void 0:e.stack)&&(0,i.logError)(e)}));var t=document.createComment("Creative ".concat(r.creativeId," served by ").concat(r.bidder," Prebid.js Header Bidding"));(0,i.insertElement)(t,e,"html")},resizeFn:a,adId:n,options:{clickUrl:null==t?void 0:t.clickThrough},bidResponse:r,doc:e}):o(u.q_.Sn,"renderAd was prevented from writing to the main document.")):o(u.q_.mb,"missing ".concat(n?"doc":"adId"))}catch(e){o(w,e.message)}}S.before((function(e,n){var t=n.bidResponse,r=n.doc;(0,s.Pd)(t.renderer)?((0,s._U)(t.renderer,t,r),A({doc:r,bid:t,id:t.adId}),e.bail()):e(n)}),100)},875:function(e,n,t){t.d(n,{f:function(){return a}});var r=t(20265),i={};function o(e,n,t){var r=function(e,n){var t=i[e]=i[e]||{bidders:{}};return n?t.bidders[n]=t.bidders[n]||{}:t}(e,t);return r[n]=(r[n]||0)+1,r[n]}var a={incrementRequestsCounter:function(e){return o(e,"requestsCounter")},incrementBidderRequestsCounter:function(e,n){return o(e,"requestsCounter",n)},incrementBidderWinsCounter:function(e,n){return o(e,"winsCounter",n)},getRequestsCounter:function(e){return(0,r.Z)(i,"".concat(e,".requestsCounter"))||0},getBidderRequestsCounter:function(e,n){return(0,r.Z)(i,"".concat(e,".bidders.").concat(n,".requestsCounter"))||0},getBidderWinsCounter:function(e,n){return(0,r.Z)(i,"".concat(e,".bidders.").concat(n,".winsCounter"))||0}}},48525:function(e,n,t){function r(e){var n=e;return{callBids:function(){},setBidderCode:function(e){n=e},getBidderCode:function(){return n}}}t.d(n,{Z:function(){return r}})},86104:function(e,n,t){t.d(n,{Ct:function(){return L},JO:function(){return N},O6:function(){return x},_x:function(){return F},qJ:function(){return B},uV:function(){return z}});var r=t(89062),i=t(93324),o=t(4942),a=t(64358),u=t(20265),c=t(70059),s=t(14699),d=t(48928),f=t(3193),l=t(92797),g=t(34614),p=t(875),v=t(25102),h=t(34516),m=t(52021),b=t(5644),y=t(99128),w=t(78653),E=t(9633),A=t(50571),C=t(74947),I=t(16310),T=t(41087);function O(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function S(e){for(var n=1;n2&&void 0!==arguments[2]?arguments[2]:{},r=t.getS2SBidders,i=void 0===r?z:r;if(null==n)return e;var o=i(n);return e.filter((function(e){return o.has(e.bidder)}))}),"filterBidsForAdUnit");function M(e,n){var t=(0,a.deepClone)(e),r=!1;return t.forEach((function(e){var t=e.bids.filter((function(e){var t;return e.module===k&&(null===(t=e.params)||void 0===t?void 0:t.configName)===n.configName}));1===t.length?(e.s2sBid=t[0],r=!0,e.ortb2Imp=(0,a.mergeDeep)({},e.s2sBid.ortb2Imp,e.ortb2Imp)):t.length>1&&(0,a.logWarn)('Multiple "module" bids for the same s2s configuration; all will be ignored',t),e.bids=N(e.bids,n).map((function(e){return e.bid_id=(0,a.getUniqueIdentifierStr)(),e}))})),{adUnits:t=t.filter((function(e){return 0!==e.bids.length||null!=e.s2sBid})),hasModuleBids:r}}function W(e){var n=(0,a.deepClone)(e);return n.forEach((function(e){e.bids=N(e.bids,null)})),n=n.filter((function(e){return 0!==e.bids.length}))}var F=(0,l.z3)("sync",(function(e,n){return e}),"setupAdUnitMediaTypes");function z(e){(0,a.isArray)(e)||(e=[e]);var n=new Set([null]);return e.filter((function(e){return e&&e.enabled})).flatMap((function(e){return e.bidders})).forEach((function(e){return n.add(e)})),n}var L=(0,l.z3)("sync",(function(e,n){var t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.getS2SBidders,u=void 0===i?z:i,c=u(n);return(0,a.getBidderCodes)(e).reduce((function(e,n){return e[c.has(n)?B.SERVER:B.CLIENT].push(n),e}),(t={},(0,o.Z)(t,B.CLIENT,[]),(0,o.Z)(t,B.SERVER,[]),t))}),"partitionBidders");function K(e,n){var t=R[e],r=(null==t?void 0:t.getSpec)&&t.getSpec();if(r&&r[n]&&"function"==typeof r[n])return[r,r[n]]}function H(e,n,t,r){try{(0,a.logInfo)("Invoking ".concat(e,".").concat(n));for(var i=arguments.length,o=new Array(i>4?i-4:0),u=4;u5&&void 0!==arguments[5]?arguments[5]:{},u=arguments.length>6?arguments[6]:void 0;u=(0,y.Bf)(u),m.emit(b.FP.BEFORE_REQUEST_BIDS,e),(0,c.Fb)(e),e.forEach((function(e){(0,a.isPlainObject)(e.mediaTypes)||(e.mediaTypes={}),e.bids=e.bids.filter((function(e){return!e.bidder||j.isAllowed(C.UE,q(E.UL,e.bidder))}))})),e=F(e,i);var s=L(e,D),d=s[B.CLIENT],l=s[B.SERVER];f.vc.getConfig("bidderSequence")===f.FD&&(d=(0,a.shuffle)(d));var p=(0,v.nH)(),w=[],A=o.global||{},I=o.bidder||{};function T(e,n){var r=j.redact(null!=n?n:q(E.UL,e.bidderCode)),i=Object.freeze(r.ortb2((0,a.mergeDeep)({source:{tid:t}},A,I[e.bidderCode])));return e.ortb2=i,e.bids=e.bids.map((function(e){return e.ortb2=i,r.bidRequest(e)})),e}D.forEach((function(r){var i=x(r);if(r&&r.enabled&&j.isAllowed(C.UE,i)){var o=M(e,r),c=o.adUnits,s=o.hasModuleBids,d=(0,a.generateUUID)();(0===l.length&&s?[null]:l).forEach((function(e){var o=(0,a.getUniqueIdentifierStr)(),s=u.fork(),f=T({bidderCode:e,auctionId:t,bidderRequestId:o,uniquePbsTid:d,bids:_({bidderCode:e,auctionId:t,bidderRequestId:o,adUnits:(0,a.deepClone)(c),src:b.os.YZ,metrics:s}),auctionStart:n,timeout:r.timeout,src:b.os.YZ,refererInfo:p,metrics:s},i);0!==f.bids.length&&w.push(f)})),c.forEach((function(e){var n=e.bids.filter((function(e){return(0,g.sE)(w,(function(n){return(0,g.sE)(n.bids,(function(n){return n.bidId===e.bid_id}))}))}));e.bids=n})),w.forEach((function(e){void 0===e.adUnitsS2SCopy&&(e.adUnitsS2SCopy=c.filter((function(e){return e.bids.length>0||null!=e.s2sBid})))}))}}));var O=W(e);return d.forEach((function(e){var o=(0,a.getUniqueIdentifierStr)(),c=u.fork(),s=T({bidderCode:e,auctionId:t,bidderRequestId:o,bids:_({bidderCode:e,auctionId:t,bidderRequestId:o,adUnits:(0,a.deepClone)(O),labels:i,src:"client",metrics:c}),auctionStart:n,timeout:r,refererInfo:p,metrics:c}),d=R[e];d||(0,a.logError)("Trying to make a request for bidder that does not exist: ".concat(e)),d&&s.bids&&0!==s.bids.length&&w.push(s)})),w.forEach((function(e){h.rp.getConsentData()&&(e.gdprConsent=h.rp.getConsentData()),h.nX.getConsentData()&&(e.uspConsent=h.nX.getConsentData()),h.TJ.getConsentData()&&(e.gppConsent=h.TJ.getConsentData())})),w}),"makeBidRequests"),U.callBids=function(e,n,t,r,o,u,c){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{};if(n.length){var l=n.reduce((function(e,n){return e[Number(void 0!==n.src&&n.src===b.os.YZ)].push(n),e}),[[],[]]),g=(0,i.Z)(l,2),p=g[0],v=g[1],h=[];v.forEach((function(e){for(var n=-1,t=0;t0?A.join(", "):'No bidder specified, using "ortb2Imp" definition(s) only')),p.forEach((function(e){m.emit(b.FP.BID_REQUESTED,S(S({},e),{},{tid:e.auctionId}))})),f.callBids(w,v,t,(function(e){return E.forEach((function(n){return n(e)}))}),n)}}else(0,a.logError)("missing "+e.adapter);y++}})),p.forEach((function(e){e.start=(0,a.timestamp)();var n=R[e.bidderCode];f.vc.runWithBidder(e.bidderCode,(function(){(0,a.logMessage)("CALLING BIDDER"),m.emit(b.FP.BID_REQUESTED,e)}));var i=(0,d.OI)(u,o?{request:o.request.bind(null,e.bidderCode),done:o.done}:void 0),s=r.bind(e);try{f.vc.runWithBidder(e.bidderCode,n.callBids.bind(n,e,t,s,i,(function(){return c(e.bidderRequestId)}),f.vc.callbackWithBidder(e.bidderCode)))}catch(n){(0,a.logError)("".concat(e.bidderCode," Bid Adapter emitted an uncaught error when parsing their bidRequest"),{e:n,bidRequest:e}),s()}}))}else(0,a.logWarn)("callBids executed with no bidRequests. Were they filtered by labels or sizing?")},U.videoAdapters=[],U.registerBidAdapter=function(e,n){var t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.supportedMediaTypes,o=void 0===i?[]:i;e&&n?"function"==typeof e.callBids?(R[n]=e,h.qh.register(E.UL,n,null===(t=e.getSpec)||void 0===t?void 0:t.call(e).gvlid),(0,g.q9)(o,"video")&&U.videoAdapters.push(n),(0,g.q9)(o,"native")&&c.Sg.push(n)):(0,a.logError)("Bidder adaptor error for bidder code: "+n+"bidder must implement a callBids() function"):(0,a.logError)("bidAdapter or bidderCode not specified")},U.aliasBidAdapter=function(e,n,t){if(void 0===R[n]){var r=R[e];if(void 0===r){var i=[];D.forEach((function(t){if(t.bidders&&t.bidders.length){var r=t&&t.bidders;t&&(0,g.q9)(r,n)?P[n]=e:i.push(e)}})),i.forEach((function(e){(0,a.logError)('bidderCode "'+e+'" is not an existing bidder.',"adapterManager.aliasBidAdapter")}))}else try{var o,u=function(e){var n=[];return(0,g.q9)(U.videoAdapters,e)&&n.push("video"),(0,g.q9)(c.Sg,e)&&n.push("native"),n}(e);if(r.constructor.prototype!=Object.prototype)(o=new r.constructor).setBidderCode(n);else{var d=r.getSpec(),f=t&&t.gvlid;null!=d.gvlid&&null==f&&(0,a.logWarn)("Alias '".concat(n,"' will NOT re-use the GVL ID of the original adapter ('").concat(d.code,"', gvlid: ").concat(d.gvlid,"). Functionality that requires TCF consent may not work as expected."));var l=t&&t.skipPbsAliasing;o=(0,s.PZ)(Object.assign({},d,{code:n,gvlid:f,skipPbsAliasing:l})),P[n]=e}U.registerBidAdapter(o,n,{supportedMediaTypes:u})}catch(n){(0,a.logError)(e+" bidder does not currently support aliasing.","adapterManager.aliasBidAdapter")}}else(0,a.logMessage)('alias name "'+n+'" has been already specified.')},U.resolveAlias=function(e){for(var n,t=e;P[t]&&(!n||!n.has(t));)t=P[t],(n=n||new Set).add(t);return t},U.registerAnalyticsAdapter=function(e){var n=e.adapter,t=e.code,r=e.gvlid;n&&t?"function"==typeof n.enableAnalytics?(n.code=t,Z[t]={adapter:n,gvlid:r},h.qh.register(E._U,t,r)):(0,a.logError)('Prebid Error: Analytics adaptor error for analytics "'.concat(t,'"\n analytics adapter must implement an enableAnalytics() function')):(0,a.logError)("Prebid Error: analyticsAdapter or analyticsCode not specified")},U.enableAnalytics=function(e){(0,a.isArray)(e)||(e=[e]),e.forEach((function(e){var n=Z[e.provider];n&&n.adapter?j.isAllowed(C.x$,q(E._U,e.provider,(0,o.Z)({},I.Hw,e)))&&n.adapter.enableAnalytics(e):(0,a.logError)("Prebid Error: no analytics adapter found in registry for '".concat(e.provider,"'."))}))},U.getBidAdapter=function(e){return R[e]},U.getAnalyticsAdapter=function(e){return Z[e]},U.callTimedOutBidders=function(e,n,t){n=n.map((function(n){return n.params=(0,a.getUserConfiguredParams)(e,n.adUnitCode,n.bidder),n.timeout=t,n})),n=(0,a.groupBy)(n,"bidder"),Object.keys(n).forEach((function(e){G(e,"onTimeout",n[e])}))},U.callBidWonBidder=function(e,n,t){n.params=(0,a.getUserConfiguredParams)(t,n.adUnitCode,n.bidder),p.f.incrementBidderWinsCounter(n.adUnitCode,n.bidder),G(e,"onBidWon",n)},U.callBidBillableBidder=function(e){G(e.bidder,"onBidBillable",e)},U.callSetTargetingBidder=function(e,n){G(e,"onSetTargeting",n)},U.callBidViewableBidder=function(e,n){G(e,"onBidViewable",n)},U.callBidderError=function(e,n,t){G(e,"onBidderError",{error:n,bidderRequest:t})},U.callDataDeletionRequest=(0,l.z3)("sync",(function(){for(var e=arguments.length,n=new Array(e),t=0;t2&&void 0!==arguments[2]?arguments[2]:{},r=t.index,o=void 0===r?m.K.index:r;if((n.width||0===parseInt(n.width,10))&&(n.height||0===parseInt(n.height,10)))return n.width=parseInt(n.width,10),n.height=parseInt(n.height,10),!0;var a=o.getBidRequest(n),u=o.getMediaTypes(n),c=a&&a.sizes||u&&u.banner&&u.banner.sizes,s=(0,v.parseSizesInput)(c);if(1===s.length){var d=s[0].split("x"),f=(0,i.Z)(d,2),l=f[0],g=f[1];return n.width=parseInt(l,10),n.height=parseInt(g,10),!0}return!1}function R(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.index,i=void 0===r?m.K.index:r;function o(){var e=Object.keys(n);return I.every((function(t){return(0,p.q9)(e,t)&&!(0,p.q9)([void 0,null],n[t])}))}function a(e){return"Invalid bid from ".concat(n.bidderCode,". Ignoring bid: ").concat(e)}return e?n?o()?"native"!==n.mediaType||(0,d.r4)(n,{index:i})?"video"!==n.mediaType||(0,f.Dn)(n,{index:i})?!("banner"===n.mediaType&&!U(e,n,{index:i}))||((0,v.logError)(a("Banner bids require a width and height")),!1):((0,v.logError)(a("Video bid does not have required vastUrl or renderer property")),!1):((0,v.logError)(a("Native bid missing some required properties.")),!1):((0,v.logError)(a("Bidder ".concat(n.bidderCode," is missing required params. Check http://prebid.org/dev-docs/bidder-adapter-1.html for list of params."))),!1):((0,v.logWarn)("Some adapter tried to add an undefined bid for ".concat(e,".")),!1):((0,v.logWarn)("No adUnitCode was supplied to addBidResponse."),!1)}function P(e){return(0,y.Bf)(e.metrics).renameWith((function(n){return["adapter.client.".concat(n),"adapters.client.".concat(e.bidderCode,".").concat(n)]}))}},55730:function(e,n,t){t.d(n,{B:function(){return u}});var r=t(34614),i=t(64358),o=new WeakMap,a=["debugging","adloox","criteo","outstream","adagio","spotx","browsi","brandmetrics","justtag","tncId","akamaidap","ftrackId","inskin","hadron","medianet","improvedigital","aaxBlockmeter","confiant","arcspan","airgrid","clean.io","a1Media","geoedge","mediafilter","qortex","dynamicAdBoost","contxtful","id5","lucead"];function u(e,n,t,u,c){if(n&&e){if((0,r.q9)(a,n)){u||(u=document);var s=l(u,e);if(s)return t&&"function"==typeof t&&(s.loaded?t():s.callbacks.push(t)),s.tag;var d=o.get(u)||{},f={loaded:!1,tag:null,callbacks:[]};return d[e]=f,o.set(u,d),t&&"function"==typeof t&&f.callbacks.push(t),(0,i.logWarn)("module ".concat(n," is loading external JavaScript")),function(n,t,r,o){r||(r=document);var a=r.createElement("script");a.type="text/javascript",a.async=!0;var u=l(r,e);u&&(u.tag=a);a.readyState?a.onreadystatechange=function(){"loaded"!==a.readyState&&"complete"!==a.readyState||(a.onreadystatechange=null,t())}:a.onload=function(){t()};a.src=n,o&&(0,i.setScriptAttributes)(a,o);return(0,i.insertElement)(a,r),a}(e,(function(){f.loaded=!0;try{for(var e=0;e2&&void 0!==arguments[2]?arguments[2]:{},r=t.method||(n?s:c);if(r===c&&n){var i=(0,a.parseUrl)(e,t);Object.assign(i.search,n),e=(0,a.buildUrl)(i)}var o=new Headers(t.customHeaders);o.set(d,t.contentType||"text/plain");var f={method:r,headers:o};return r!==c&&n&&(f.body=n),t.withCredentials&&(f.credentials="include"),t.browsingTopics&&isSecureContext&&(f.browsingTopics=!0),u.makeRequest(e,f)}function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.request,r=n.done,i=function(n,t){var r,i,a;null==e||null!=(null===(r=t)||void 0===r?void 0:r.signal)||o.vc.getConfig("disableAjaxTimeout")||(a=u.timeout(e,n),t=Object.assign({signal:a.signal},t));var c=u.fetch(n,t);return null!=(null===(i=a)||void 0===i?void 0:i.done)&&(c=c.finally(a.done)),c};return null==t&&null==r||(i=function(e){return function(n,i){var o=new URL(null==(null==n?void 0:n.url)?n:n.url,document.location).origin,a=e(n,i);return t&&t(o),r&&(a=a.finally((function(){return r(o)}))),a}}(i)),i}function g(e,n){var t=e.status,r=e.statusText,i=void 0===r?"":r,o=e.headers,u=e.url,c=0;function s(e){if(0===c)try{var t,r;c=(new DOMParser).parseFromString(n,null==o||null===(t=o.get(d))||void 0===t||null===(r=t.split(";"))||void 0===r?void 0:r[0])}catch(n){c=null,e&&e(n)}return c}return{readyState:XMLHttpRequest.DONE,status:t,statusText:i,responseText:n,response:n,responseType:"",responseURL:u,get responseXML(){return s(a.logError)},getResponseHeader:function(e){return null!=o&&o.has(e)?o.get(e):null},toJSON:function(){return Object.assign({responseXML:s()},this)},timedOut:!1}}function p(e,n){var t="object"===(0,i.Z)(n)&&null!=n?n:{success:"function"==typeof n?n:function(){return null},error:function(e,n){return(0,a.logError)("Network error",e,n)}},o=t.success,u=t.error;e.then((function(e){return e.text().then((function(n){return[e,n]}))})).then((function(e){var n=(0,r.Z)(e,2),t=n[0],i=n[1],a=g(t,i);t.ok||304===t.status?o(i,a):u(t.statusText,a)}),(function(e){return u("",Object.assign(g({status:0},""),{reason:e,timedOut:"AbortError"===(null==e?void 0:e.name)}))}))}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.request,r=n.done,i=l(e,{request:t,done:r});return function(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};p(i(f(e,t,r)),n)}}var h=v(),m=l()},25686:function(e,n,t){t.d(n,{LX:function(){return Q},RH:function(){return G},Yt:function(){return P},Yw:function(){return O},dg:function(){return V},e0:function(){return Z},lU:function(){return x},mv:function(){return S},vO:function(){return R}});var r=t(71002),i=t(64358),o=t(20265),a=t(56463),u=t(70059),c=t(79885),s=t(35706),d=t(3193),f=t(11974),l=t(92797),g=t(34614),p=t(90154),v=t(24679),h=t(78653),m=t(55975),b=t(52021),y=t(86104),w=t(5644),E=t(68792),A=t(99128),C=t(36066),I=t(78640),T=f.k_.syncUsers,O="inProgress",S="completed";b.on(w.FP.BID_ADJUSTMENT,(function(e){!function(e){var n=(0,C.O)(e.cpm,e);n>=0&&(e.cpm=n)}(e)}));var k={},B={},j=[],U=(0,I.R)();function R(e){var n=e.adUnits,t=e.adUnitCodes,r=e.callback,o=e.cbTimeout,a=e.labels,c=e.auctionId,s=e.ortb2Fragments,f=e.metrics;f=(0,A.Bf)(f);var l,p,m,C,I=n,R=a,N=t,M=c||(0,i.generateUUID)(),W=o,F=new Set,z=(0,E.P)(),H=[],G=r,V=[],J=[],Q=[],X=[],Y=[];function ee(){return{auctionId:M,timestamp:l,auctionEnd:p,auctionStatus:C,adUnits:I,adUnitCodes:N,labels:R,bidderRequests:V,noBids:Q,bidsReceived:J,bidsRejected:H,winningBids:X,timeout:W,metrics:f,seatNonBids:Y}}function ne(e){if(e?b.emit(w.FP.AUCTION_TIMEOUT,ee()):clearTimeout(m),void 0===p){var t=[];e&&((0,i.logMessage)("Auction ".concat(M," timedOut")),(t=V.filter((function(e){return!F.has(e.bidderRequestId)})).flatMap((function(e){return e.bids}))).length&&b.emit(w.FP.BID_TIMEOUT,t)),C=S,p=Date.now(),f.checkpoint("auctionEnd"),f.timeBetween("requestBids","auctionEnd","requestBids.total"),f.timeBetween("callBids","auctionEnd","requestBids.callBids"),z.resolve(),b.emit(w.FP.AUCTION_END,ee()),q(I,(function(){try{if(null!=G){var r=J.filter((function(e){return N.includes(e.adUnitCode)})).reduce($,{});G.apply(U,[r,e,M]),G=null}}catch(e){(0,i.logError)("Error executing bidsBackHandler",null,e)}finally{t.length&&y.ZP.callTimedOutBidders(n,t,W);var o=d.vc.getConfig("userSync")||{};o.enableOverride||T(o.syncDelay)}}))}}function te(){d.vc.resetBidder(),(0,i.logInfo)("Bids Received for Auction with id: ".concat(M),J),C=S,ne(!1)}function re(e){F.add(e)}function ie(e){var n=this;e.forEach((function(e){var n;n=e,V=V.concat(n)}));var t={},r={bidRequests:e,run:function(){m=setTimeout((function(){return ne(!0)}),W),C=O,b.emit(w.FP.AUCTION_INIT,ee());var r=function(e,n){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).index,r=void 0===t?h.K.index:t,o=0,a=!1,c=new Set,s={};function f(){o--,a&&0===o&&e()}function l(e,n,t){return s[n.requestId]=!0,L(n,e),o++,t(f)}function p(e,t){l(e,t,(function(e){var i=K(t);b.emit(w.FP.BID_ACCEPTED,i),i.mediaType===v.pX?_(n,i,e):((0,u.ub)(i)&&(0,u.kH)(i,r.getAdUnit(i)),x(n,i),e())}))}function m(e,t,r){return l(e,t,(function(e){t.rejectionReason=r,(0,i.logWarn)("Bid from ".concat(t.bidder||"unknown bidder"," was rejected: ").concat(r),t),b.emit(w.FP.BID_REJECTED,t),n.addBidRejected(t),e()}))}function y(){var t=this,r=n.getBidRequests(),u=d.vc.getConfig("auctionOptions");if(c.add(t),u&&!(0,i.isEmpty)(u)){var f=u.secondaryBidders;f&&!r.every((function(e){return(0,g.q9)(f,e.bidderCode)}))&&(r=r.filter((function(e){return!(0,g.q9)(f,e.bidderCode)})))}a=r.every((function(e){return c.has(e)})),t.bids.forEach((function(e){s[e.bidId]||(n.addNoBid(e),b.emit(w.FP.NO_BID,e))})),a&&0===o&&e()}return{addBidResponse:function(){function e(e,n){var t;P.call({dispatch:p},e,n,(t=!1,function(r){t||(m(e,n,r),t=!0)}))}return e.reject=m,e}(),adapterDone:function(){var e=this;D(E.Z.resolve()).finally((function(){return y.call(e)}))}}}(te,n);y.ZP.callBids(I,e,r.addBidResponse,r.adapterDone,{request:function(e,n){a(k,n),a(t,e),B[e]||(B[e]={SRA:!0,origin:n}),t[e]>1&&(B[e].SRA=!1)},done:function(e){k[e]--,j[0]&&o(j[0])&&j.shift()}},W,re,s)}};function o(e){var n=!0,t=d.vc.getConfig("maxRequestsPerOrigin")||4;return e.bidRequests.some((function(e){var r=1,i=void 0!==e.src&&e.src===w.os.YZ?"s2s":e.bidderCode;return B[i]&&(!1===B[i].SRA&&(r=Math.min(e.bids.length,t)),k[B[i].origin]+r>t&&(n=!1)),!n})),n&&e.run(),n}function a(e,n){void 0===e[n]?e[n]=1:e[n]++}o(r)||((0,i.logWarn)("queueing auction due to limited endpoint capacity"),j.push(r))}return b.on(w.FP.SEAT_NON_BID,(function(e){var n;e.auctionId===M&&(n=e.seatnonbid,Y=Y.concat(n))})),{addBidReceived:function(e){J=J.concat(e)},addBidRejected:function(e){H=H.concat(e)},addNoBid:function(e){Q=Q.concat(e)},callBids:function(){C="started",l=Date.now();var e=f.measureTime("requestBids.makeRequests",(function(){return y.ZP.makeBidRequests(I,l,M,W,R,s,f)}));(0,i.logInfo)("Bids Requested for Auction with id: ".concat(M),e),f.checkpoint("callBids"),e.length<1?((0,i.logWarn)("No valid bid requests returned for auction"),te()):Z.call({dispatch:ie,context:this},e)},addWinningBid:function(e){var t=n.find((function(n){return n.adUnitId===e.adUnitId}));X=X.concat(e),(0,i.callBurl)(e),y.ZP.callBidWonBidder(e.adapterCode||e.bidder,e,n),t&&!t.deferBilling&&y.ZP.callBidBillableBidder(e)},setBidTargeting:function(e){y.ZP.callSetTargetingBidder(e.adapterCode||e.bidder,e)},getWinningBids:function(){return X},getAuctionStart:function(){return l},getAuctionEnd:function(){return p},getTimeout:function(){return W},getAuctionId:function(){return M},getAuctionStatus:function(){return C},getAdUnits:function(){return I},getAdUnitCodes:function(){return N},getBidRequests:function(){return V},getBidsReceived:function(){return J},getNoBids:function(){return Q},getNonBids:function(){return Y},getFPD:function(){return s},getMetrics:function(){return f},end:z.promise}}var P=(0,l.z3)("sync",(function(e,n,t){this.dispatch.call(null,e,n)}),"addBidResponse"),D=(0,l.z3)("sync",(function(e){return e}),"responsesReady"),Z=(0,l.z3)("sync",(function(e){this.dispatch.call(this.context,e)}),"addBidderRequests"),q=(0,l.z3)("async",(function(e,n){n&&n()}),"bidsBackCallback");function x(e,n){!function(e){var n,t=!0===m.S.get(e.bidderCode,"allowZeroCpmBids")?e.cpm>=0:e.cpm>0;e.bidderCode&&(t||e.dealId)&&(n=function(e,n){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).index,r=void 0===t?h.K.index:t;if(!n)return{};var i=r.getBidRequest(n),o={},a=Q(n.mediaType,e);X(o,a,n,i),e&&m.S.getOwn(e,w.k2.xn)&&(X(o,m.S.ownSettingsFor(e),n,i),n.sendStandardTargeting=m.S.get(e,"sendStandardTargeting"));n.native&&(o=Object.assign({},o,(0,u.Ur)(n)));return o}(e.bidderCode,e));e.adserverTargeting=Object.assign(e.adserverTargeting||{},n)}(n),(0,A.Bf)(n.metrics).timeSince("addBidResponse","addBidResponse.total"),e.addBidReceived(n),b.emit(w.FP.BID_RESPONSE,n)}function _(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=r.index,u=void 0===a?h.K.index:a,c=!0,s=(0,o.Z)(u.getMediaTypes({requestId:n.originalRequestId||n.requestId,adUnitId:n.adUnitId}),"video"),f=s&&(0,o.Z)(s,"context"),l=s&&(0,o.Z)(s,"useCacheKey");d.vc.getConfig("cache.url")&&(l||f!==p.gZ)&&(!n.videoCacheKey||d.vc.getConfig("cache.ignoreBidderCacheKey")?(c=!1,z(e,n,t,s)):n.vastUrl||((0,i.logError)("videoCacheKey specified but not required vastUrl for video bid"),c=!1)),c&&(x(e,n),t())}var N,M,W=function(e){(0,c.h)(e.map((function(e){return e.bidResponse})),(function(n,t){t.forEach((function(t,r){var o=e[r],a=o.auctionInstance,u=o.bidResponse,s=o.afterBidAdded;n?(0,i.logWarn)("Failed to save to the video cache: ".concat(n,". Video bid must be discarded.")):""===t.uuid?(0,i.logWarn)("Supplied video cache key was already in use by Prebid Cache; caching attempt was rejected. Video bid must be discarded."):(u.videoCacheKey=t.uuid,u.vastUrl||(u.vastUrl=(0,c.z)(u.videoCacheKey)),x(a,u),s())}))}))};d.vc.getConfig("cache",(function(e){N="number"==typeof e.cache.batchSize&&e.cache.batchSize>0?e.cache.batchSize:1,M="number"==typeof e.cache.batchTimeout&&e.cache.batchTimeout>0?e.cache.batchTimeout:0}));var F=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:setTimeout,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:W,t=[[]],r=!1,i=function(e){return e()};return function(o,a,u){var c=M>0?e:i;t[t.length-1].length>=N&&t.push([]),t[t.length-1].push({auctionInstance:o,bidResponse:a,afterBidAdded:u}),r||(r=!0,c((function(){t.forEach(n),t=[[]],r=!1}),M))}}(),z=(0,l.z3)("async",(function(e,n,t,r){F(e,n,t)}),"callPrebidCache");function L(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.index,o=void 0===r?h.K.index:r,a=o.getBidderRequest(e),u=o.getAdUnit(e),c=a&&a.start||e.requestTimestamp;Object.assign(e,{responseTimestamp:e.responseTimestamp||(0,i.timestamp)(),requestTimestamp:e.requestTimestamp||c,cpm:parseFloat(e.cpm)||0,bidder:e.bidder||e.bidderCode,adUnitCode:n}),null!=(null==u?void 0:u.ttlBuffer)&&(e.ttlBuffer=u.ttlBuffer),e.timeToRespond=e.responseTimestamp-e.requestTimestamp}function K(e){var n,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.index,o=void 0===i?h.K.index:i;b.emit(w.FP.BID_ADJUSTMENT,e);var u=(null===(n=o.getBidRequest(e))||void 0===n?void 0:n.renderer)||o.getAdUnit(e).renderer,c=e.mediaType,f=o.getMediaTypes(e),l=f&&f[c],g=l&&l.renderer,p=null;g&&g.url&&g.render&&(!0!==g.backupOnly||!e.renderer)?p=g:u&&u.url&&u.render&&(!0!==u.backupOnly||!e.renderer)&&(p=u),p&&(e.renderer=s.Th.install({url:p.url,config:p.options}),e.renderer.setRender(p.render));var v=H(e.mediaType,f,d.vc.getConfig("mediaTypePriceGranularity")),m=(0,a.D)(e.cpm,"object"===(0,r.Z)(v)?v:d.vc.getConfig("customPriceBucket"),d.vc.getConfig("currency.granularityMultiplier"));return e.pbLg=m.low,e.pbMg=m.med,e.pbHg=m.high,e.pbAg=m.auto,e.pbDg=m.dense,e.pbCg=m.custom,e}function H(e,n,t){if(e&&t){if(e===v.pX){var r=(0,o.Z)(n,"".concat(v.pX,".context"),"instream");if(t["".concat(v.pX,"-").concat(r)])return t["".concat(v.pX,"-").concat(r)]}return t[e]}}var G=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.index,r=void 0===t?h.K.index:t,i=H(e.mediaType,r.getMediaTypes(e),d.vc.getConfig("mediaTypePriceGranularity")),o="string"==typeof e.mediaType&&i?"string"==typeof i?i:"custom":d.vc.getConfig("priceGranularity");return o},V=function(e){return function(n){var t=e||G(n);return t===w.Ql.B7?n.pbAg:t===w.Ql.uN?n.pbDg:t===w.Ql.yE?n.pbLg:t===w.Ql.M2?n.pbMg:t===w.Ql.lj?n.pbHg:t===w.Ql.qN?n.pbCg:void 0}};function J(e,n){return{key:e,val:"function"==typeof n?function(e,t){return n(e,t)}:function(e){return(0,i.getValue)(e,n)}}}function Q(e,n){var t=w.TD,r=Object.assign({},m.S.settingsFor(null));if(r[w.k2.xn]||(r[w.k2.xn]=function(){var e=w.TD;return[J(e.BIDDER,"bidderCode"),J(e.AD_ID,"adId"),J(e.PRICE_BUCKET,V()),J(e.SIZE,"size"),J(e.DEAL,"dealId"),J(e.SOURCE,"source"),J(e.FORMAT,"mediaType"),J(e.ADOMAIN,(function(e){return e.meta&&e.meta.advertiserDomains&&e.meta.advertiserDomains.length>0?[e.meta.advertiserDomains].flat()[0]:""})),J(e.ACAT,(function(e){return e.meta&&e.meta.primaryCatId?e.meta.primaryCatId:""})),J(e.DSP,(function(e){return e.meta&&(e.meta.networkId||e.meta.networkName)?(0,o.Z)(e,"meta.networkName")||(0,o.Z)(e,"meta.networkId"):""})),J(e.CRID,(function(e){return e.creativeId?e.creativeId:""}))]}()),"video"===e){var a=r[w.k2.xn].slice();if(r[w.k2.xn]=a,[t.UUID,t.CACHE_ID].forEach((function(e){void 0===(0,g.sE)(a,(function(n){return n.key===e}))&&a.push(J(e,"videoCacheKey"))})),d.vc.getConfig("cache.url")&&(!n||!1!==m.S.get(n,"sendStandardTargeting"))){var u=(0,i.parseUrl)(d.vc.getConfig("cache.url"));void 0===(0,g.sE)(a,(function(e){return e.key===t.CACHE_HOST}))&&a.push(J(t.CACHE_HOST,(function(e){return(0,o.Z)(e,"adserverTargeting.".concat(t.CACHE_HOST))?e.adserverTargeting[t.CACHE_HOST]:u.hostname})))}}return r}function X(e,n,t,r){var o=n[w.k2.xn];return t.size=t.getSize(),(o||[]).forEach((function(o){var a=o.key,u=o.val;if(e[a]&&(0,i.logWarn)("The key: "+a+" is being overwritten"),(0,i.isFn)(u))try{u=u(t,r)}catch(e){(0,i.logError)("bidmanager","ERROR",e)}(void 0===n.suppressEmptyKeys||!0!==n.suppressEmptyKeys)&&a!==w.TD.DEAL&&a!==w.TD.ACAT&&a!==w.TD.DSP&&a!==w.TD.CRID||!(0,i.isEmptyStr)(u)&&null!=u?e[a]=u:(0,i.logInfo)("suppressing empty key '"+a+"' from adserver targeting")})),e}function $(e,n){return e[n.adUnitCode]||(e[n.adUnitCode]={bids:[]}),e[n.adUnitCode].bids.push(n),e}},78653:function(e,n,t){t.d(n,{K:function(){return h}});var r=t(93324),i=t(89062),o=t(64358),a=t(25686);function u(e){Object.assign(this,{getAuction:function(n){var t=n.auctionId;if(null!=t)return e().find((function(e){return e.getAuctionId()===t}))},getAdUnit:function(n){var t=n.adUnitId;if(null!=t)return e().flatMap((function(e){return e.getAdUnits()})).find((function(e){return e.adUnitId===t}))},getMediaTypes:function(e){var n=e.adUnitId,t=e.requestId;if(null!=t){var r=this.getBidRequest({requestId:t});if(null!=r&&(null==n||r.adUnitId===n))return r.mediaTypes}else if(null!=n){var i=this.getAdUnit({adUnitId:n});if(null!=i)return i.mediaTypes}},getBidderRequest:function(n){var t=n.requestId,r=n.bidderRequestId;if(null!=t||null!=r){var i=e().flatMap((function(e){return e.getBidRequests()}));return null!=r&&(i=i.filter((function(e){return e.bidderRequestId===r}))),null==t?i[0]:i.find((function(e){return e.bids&&null!=e.bids.find((function(e){return e.bidId===t}))}))}},getBidRequest:function(n){var t=n.requestId;if(null!=t)return e().flatMap((function(e){return e.getBidRequests()})).flatMap((function(e){return e.bids})).find((function(e){return e&&e.bidId===t}))}})}var c=t(5644),s=t(99128),d=t(10613),f=t(8833),l=t(3193);function g(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(!e)return;if("string"==typeof e)return p(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p(e,n)}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}function p(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t1&&void 0!==arguments[1]?arguments[1]:{},t=n.src,i=void 0===t?"client":t,o=n.bidder,a=void 0===o?"":o,u=n.bidId,c=n.transactionId,s=n.adUnitId,d=n.auctionId,f=i,l=e||0;function g(){switch(l){case 0:return"Pending";case 1:return"Bid available";case 2:return"Bid returned empty or error response";case 3:return"Bid timed out"}}Object.assign(this,{bidderCode:a,width:0,height:0,statusMessage:g(),adId:(0,r.getUniqueIdentifierStr)(),requestId:u,transactionId:c,adUnitId:s,auctionId:d,mediaType:"banner",source:f}),this.getStatusCode=function(){return l},this.getSize=function(){return this.width+"x"+this.height},this.getIdentifiers=function(){return{src:this.source,bidder:this.bidderCode,bidId:this.requestId,transactionId:this.transactionId,adUnitId:this.adUnitId,auctionId:this.auctionId}}}function o(e,n){return new i(e,n)}},3193:function(e,n,t){t.d(n,{FD:function(){return g},vc:function(){return b}});var r=t(4942),i=t(71002),o=t(93324),a=t(56463),u=t(34614),c=t(64358),s=t(20265),d=t(5644);function f(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}var l="TRUE"===(0,c.getParameterByName)(d.f).toUpperCase(),g="random",p={};p[g]=!0,p.fixed=!0;var v=g,h={LOW:"low",MEDIUM:"medium",HIGH:"high",AUTO:"auto",DENSE:"dense",CUSTOM:"custom"},m="*";var b=function(){var e,n,t,d=[],g=null;function b(){function r(e){return s[e].val}function i(e,n){s[e].val=n}e={};var s={publisherDomain:{set:function(e){null!=e&&(0,c.logWarn)("publisherDomain is deprecated and has no effect since v7 - use pageUrl instead"),i("publisherDomain",e)}},priceGranularity:{val:h.MEDIUM,set:function(e){g(e)&&("string"==typeof e?i("priceGranularity",f(e)?e:h.MEDIUM):(0,c.isPlainObject)(e)&&(i("customPriceBucket",e),i("priceGranularity",h.CUSTOM),(0,c.logMessage)("Using custom price granularity")))}},customPriceBucket:{val:{},set:function(){}},mediaTypePriceGranularity:{val:{},set:function(e){null!=e&&i("mediaTypePriceGranularity",Object.keys(e).reduce((function(n,t){return g(e[t])?"string"==typeof e?n[t]=f(e[t])?e[t]:r("priceGranularity"):(0,c.isPlainObject)(e)&&(n[t]=e[t],(0,c.logMessage)("Using custom price granularity for ".concat(t))):(0,c.logWarn)("Invalid price granularity for media type: ".concat(t)),n}),{}))}},bidderSequence:{val:v,set:function(e){p[e]?i("bidderSequence",e):(0,c.logWarn)("Invalid order: ".concat(e,". Bidder Sequence was not set."))}},auctionOptions:{val:{},set:function(e){(function(e){if(!(0,c.isPlainObject)(e))return(0,c.logWarn)("Auction Options must be an object"),!1;for(var n=0,t=Object.keys(e);n2&&void 0!==arguments[2]?arguments[2]:{},i=n;if("string"!=typeof e&&(i=e,e=m,t=n||{}),"function"==typeof i){var o={topic:e,callback:i};return d.push(o),t.init&&i(e===m?C():(0,r.Z)({},e,C(e))),function(){d.splice(d.indexOf(o),1)}}(0,c.logError)("listener must be a function")}function j(e){var n=Object.keys(e);d.filter((function(e){return(0,u.q9)(n,e.topic)})).forEach((function(n){n.callback((0,r.Z)({},n.topic,e[n.topic]))})),d.filter((function(e){return e.topic===m})).forEach((function(n){return n.callback(e)}))}function U(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{r(e),e.bidders.forEach((function(r){t[r]||(t[r]={}),Object.keys(e.config).forEach((function(i){var o=e.config[i];if((0,c.isPlainObject)(o)){var a=n?c.mergeDeep:Object.assign;t[r][i]=a({},t[r][i]||{},o)}else t[r][i]=o}))}))}catch(e){(0,c.logError)(e)}function r(e){if(!(0,c.isPlainObject)(e))throw"setBidderConfig bidder options must be an object";if(!Array.isArray(e.bidders)||!e.bidders.length)throw"setBidderConfig bidder options must contain a bidders list with at least 1 bidder";if(!(0,c.isPlainObject)(e.config))throw"setBidderConfig bidder options must contain a config object"}}function R(e,n){g=e;try{return n()}finally{P()}}function P(){g=null}return b(),{getCurrentBidder:function(){return g},resetBidder:P,getConfig:C,getAnyConfig:A,readConfig:O,readAnyConfig:S,setConfig:k,mergeConfig:function(e){if((0,c.isPlainObject)(e)){var n=(0,c.mergeDeep)(y(),e);return k(function(e){for(var n=1;n1&&void 0!==arguments[1]?arguments[1]:(0,g.timestamp)();this.generatedTime=n,(0,l.Z)(this,O,!0),y(this,k,j).call(this,e)}},{key:"getConsentData",value:function(){return(0,f.Z)(this,C)}},{key:"hash",get:function(){var e=this;return(0,f.Z)(this,O)&&((0,l.Z)(this,S,(0,g.cyrb53Hash)(JSON.stringify((0,f.Z)(this,C)&&this.hashFields?this.hashFields.map((function(n){return(0,f.Z)(e,C)[n]})):(0,f.Z)(this,C)))),(0,l.Z)(this,O,!1)),(0,f.Z)(this,S)}}]),e}();function j(e){(0,l.Z)(this,T,!0),(0,l.Z)(this,C,e),(0,f.Z)(this,I).resolve(e)}var U=function(e){(0,o.Z)(t,e);var n=h(t);function t(){return(0,c.Z)(this,t),n.apply(this,arguments)}return(0,s.Z)(t,[{key:"getConsentMeta",value:function(){var e=this.getConsentData();if(e&&this.generatedTime)return{usp:e,generatedAt:this.generatedTime}}}]),t}(B),R=function(e){(0,o.Z)(t,e);var n=h(t);function t(){var e;(0,c.Z)(this,t);for(var r=arguments.length,o=new Array(r),a=0;a0&&void 0!==arguments[0]?arguments[0]:F;function n(n){return function(){return Object.fromEntries(e.map((function(e){var t=(0,r.Z)(e,2);return[t[0],t[1][n]()]})))}}return e=Object.entries(e),Object.assign({get promise(){return p.Z.all(e.map((function(e){var n=(0,r.Z)(e,2),t=n[0];return n[1].promise.then((function(e){return[t,e]}))}))).then((function(e){return Object.fromEntries(e)}))},get hash(){return(0,g.cyrb53Hash)(e.map((function(e){var n=(0,r.Z)(e,2);n[0];return n[1].hash})).join(":"))}},Object.fromEntries(["getConsentData","getConsentMeta","reset"].map((function(e){return[e,n(e)]}))))}()},56463:function(e,n,t){t.d(n,{D:function(){return f},t:function(){return g}});var r=t(34614),i=t(64358),o=t(3193),a={buckets:[{max:5,increment:.5}]},u={buckets:[{max:20,increment:.1}]},c={buckets:[{max:20,increment:.01}]},s={buckets:[{max:3,increment:.01},{max:8,increment:.05},{max:20,increment:.5}]},d={buckets:[{max:5,increment:.05},{max:10,increment:.1},{max:20,increment:.5}]};function f(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=parseFloat(e);return isNaN(r)&&(r=""),{low:""===r?"":l(e,a,t),med:""===r?"":l(e,u,t),high:""===r?"":l(e,c,t),auto:""===r?"":l(e,d,t),dense:""===r?"":l(e,s,t),custom:""===r?"":l(e,n,t)}}function l(e,n,t){var a="";if(!g(n))return a;var u=n.buckets.reduce((function(e,n){return e.max>n.max?e:n}),{max:0}),c=0,s=(0,r.sE)(n.buckets,(function(n){if(e>u.max*t){var r=n.precision;void 0===r&&(r=2),a=(n.max*t).toFixed(r)}else{if(e<=n.max*t&&e>=c*t)return n.min=c,n;c=n.max}}));return s&&(a=function(e,n,t){var r=void 0!==n.precision?n.precision:2,a=n.increment*t,u=n.min*t,c=Math.floor,s=o.vc.getConfig("cpmRoundingFunction");"function"==typeof s&&(c=s);var d,f,l=Math.pow(10,r+2),g=(e*l-u*l)/(a*l);try{d=c(g)*a+u}catch(e){f=!0}(f||"number"!=typeof d)&&((0,i.logWarn)("Invalid rounding function passed in config"),d=Math.floor(g)*a+u);return(d=Number(d.toFixed(10))).toFixed(r)}(e,s,t)),a}function g(e){if((0,i.isEmpty)(e)||!e.buckets||!Array.isArray(e.buckets))return!1;var n=!0;return e.buckets.forEach((function(e){e.max&&e.increment||(n=!1)})),n}},88099:function(e,n,t){t.d(n,{W:function(){return c},m:function(){return u}});var r,i=t(68792),o=t(64358),a=t(68304),u=(0,t(92797).z3)("sync",(function(e){return a._})),c=(r={},function(e){var n=u(e);return r.hasOwnProperty(n)||(r[n]=new i.Z((function(e){var t=(0,o.createInvisibleIframe)();t.srcdoc=" - - - - -

UID2 Hashing Tool

-

- Use this tool to verify that your own implementation is normalizing and - encoding correctly. Choose Email or Phone Number, then type or paste the - value and click Enter.

- NOTE: Normalize phone numbers before using the tool. - For details and examples, see Normalization and Encoding. -

- - - - -
- -
-
- -
- -
- × - Email format is invalid. -
-
- × - Phone number format is invalid or is not normalized. -
-
-
-
-


-
-
-

Normalized Value:

-

-
- -

Hashed Value:

-

- -

Base64-encoded Value:

-

- -
- - - - - - - - diff --git a/static/examples/hashing-tool/uid2-sdk-3.3.0.js b/static/examples/hashing-tool/uid2-sdk-3.3.0.js deleted file mode 100644 index cd7726917..000000000 --- a/static/examples/hashing-tool/uid2-sdk-3.3.0.js +++ /dev/null @@ -1,1520 +0,0 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ 531: -/***/ ((__unused_webpack_module, exports) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isOptoutIdentity = exports.isValidIdentity = void 0; -function isValidIdentity(identity) { - return (typeof identity === 'object' && - identity !== null && - 'advertising_token' in identity && - 'identity_expires' in identity && - 'refresh_from' in identity && - 'refresh_token' in identity && - 'refresh_expires' in identity); -} -exports.isValidIdentity = isValidIdentity; -function isOptoutIdentity(identity) { - if (identity === null || typeof identity !== 'object') - return false; - const maybeIdentity = identity; - return maybeIdentity.status === 'optout'; -} -exports.isOptoutIdentity = isOptoutIdentity; - - -/***/ }), - -/***/ 367: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ApiClient = void 0; -const sdkBase_1 = __webpack_require__(533); -const Identity_1 = __webpack_require__(531); -const cstgBox_1 = __webpack_require__(828); -const cstgCrypto_1 = __webpack_require__(135); -const clientSideIdentityOptions_1 = __webpack_require__(522); -const base64_1 = __webpack_require__(819); -function isValidRefreshResponse(response) { - if (isUnvalidatedRefreshResponse(response)) { - return (response.status === 'optout' || - response.status === 'expired_token' || - (response.status === 'success' && 'body' in response && (0, Identity_1.isValidIdentity)(response.body))); - } - return false; -} -function isUnvalidatedRefreshResponse(response) { - return typeof response === 'object' && response !== null && 'status' in response; -} -function isCstgApiSuccessResponse(response) { - if (response === null || typeof response !== 'object') { - return false; - } - const successResponse = response; - return successResponse.status === 'success' && (0, Identity_1.isValidIdentity)(successResponse.body); -} -function isCstgApiOptoutResponse(response) { - if (response === null || typeof response !== 'object') { - return false; - } - const optoutResponse = response; - return optoutResponse.status === 'optout'; -} -function isCstgApiClientErrorResponse(response) { - if (response === null || typeof response !== 'object') { - return false; - } - const errorResponse = response; - return errorResponse.status === 'client_error' && typeof errorResponse.message === 'string'; -} -function isCstgApiForbiddenResponse(response) { - if (response === null || typeof response !== 'object') { - return false; - } - const forbiddenResponse = response; - return (forbiddenResponse.status === 'invalid_http_origin' && - typeof forbiddenResponse.message === 'string'); -} -class ApiClient { - constructor(opts, defaultBaseUrl, productName) { - var _a; - this._requestsInFlight = []; - this._baseUrl = (_a = opts.baseUrl) !== null && _a !== void 0 ? _a : defaultBaseUrl; - this._productName = productName; - this._clientVersion = productName.toLowerCase() + '-sdk-' + sdkBase_1.SdkBase.VERSION; - } - hasActiveRequests() { - return this._requestsInFlight.length > 0; - } - ResponseToRefreshResult(response) { - if (isValidRefreshResponse(response)) { - if (response.status === 'success') - return { status: response.status, identity: response.body }; - return response; - } - else - return "Response didn't contain a valid status"; - } - abortActiveRequests() { - this._requestsInFlight.forEach((req) => { - req.abort(); - }); - this._requestsInFlight = []; - } - callRefreshApi(refreshDetails) { - const url = this._baseUrl + '/v2/token/refresh'; - const req = new XMLHttpRequest(); - this._requestsInFlight.push(req); - req.overrideMimeType('text/plain'); - req.open('POST', url, true); - req.setRequestHeader('X-UID2-Client-Version', this._clientVersion); // N.B. EUID and UID2 currently both use the same header - let resolvePromise; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let rejectPromise; - const promise = new Promise((resolve, reject) => { - resolvePromise = resolve; - rejectPromise = reject; - }); - req.onreadystatechange = () => { - if (req.readyState !== req.DONE) - return; - this._requestsInFlight = this._requestsInFlight.filter((r) => r !== req); - try { - if (!refreshDetails.refresh_response_key || req.status !== 200) { - const response = JSON.parse(req.responseText); - const result = this.ResponseToRefreshResult(response); - if (typeof result === 'string') - rejectPromise(result); - else - resolvePromise(result); - } - else { - const encodeResp = (0, base64_1.base64ToBytes)(req.responseText); - window.crypto.subtle - .importKey('raw', (0, base64_1.base64ToBytes)(refreshDetails.refresh_response_key), { name: 'AES-GCM' }, false, ['decrypt']) - .then((key) => { - //returns the symmetric key - window.crypto.subtle - .decrypt({ - name: 'AES-GCM', - iv: encodeResp.slice(0, 12), - tagLength: 128, //The tagLength you used to encrypt (if any) - }, key, encodeResp.slice(12)) - .then((decrypted) => { - const decryptedResponse = String.fromCharCode(...new Uint8Array(decrypted)); - const response = JSON.parse(decryptedResponse); - const result = this.ResponseToRefreshResult(response); - if (typeof result === 'string') - rejectPromise(result); - else - resolvePromise(result); - }, (reason) => rejectPromise(`Call to ${this._productName} API failed: ` + reason)); - }, (reason) => rejectPromise(`Call to ${this._productName} API failed: ` + reason)); - } - } - catch (err) { - rejectPromise(err); - } - }; - req.send(refreshDetails.refresh_token); - return promise; - } - callCstgApi(data, opts) { - return __awaiter(this, void 0, void 0, function* () { - const optoutPayload = this._productName == 'EUID' ? { optout_check: 1 } : {}; - const request = 'emailHash' in data - ? Object.assign({ email_hash: data.emailHash }, optoutPayload) : Object.assign({ phone_hash: data.phoneHash }, optoutPayload); - const box = yield cstgBox_1.CstgBox.build((0, clientSideIdentityOptions_1.stripPublicKeyPrefix)(opts.serverPublicKey)); - const encoder = new TextEncoder(); - const now = Date.now(); - const { iv, ciphertext } = yield box.encrypt(encoder.encode(JSON.stringify(request)), encoder.encode(JSON.stringify([now]))); - const exportedPublicKey = yield (0, cstgCrypto_1.exportPublicKey)(box.clientPublicKey); - const requestBody = { - payload: (0, base64_1.bytesToBase64)(new Uint8Array(ciphertext)), - iv: (0, base64_1.bytesToBase64)(new Uint8Array(iv)), - public_key: (0, base64_1.bytesToBase64)(new Uint8Array(exportedPublicKey)), - timestamp: now, - subscription_id: opts.subscriptionId, - }; - const url = this._baseUrl + '/v2/token/client-generate'; - const req = new XMLHttpRequest(); - this._requestsInFlight.push(req); - req.overrideMimeType('text/plain'); - req.open('POST', url, true); - let resolvePromise; - let rejectPromise; - const promise = new Promise((resolve, reject) => { - resolvePromise = resolve; - rejectPromise = reject; - }); - req.onreadystatechange = () => __awaiter(this, void 0, void 0, function* () { - if (req.readyState !== req.DONE) - return; - this._requestsInFlight = this._requestsInFlight.filter((r) => r !== req); - try { - if (req.status === 200) { - const encodedResp = (0, base64_1.base64ToBytes)(req.responseText); - const decrypted = yield box.decrypt(encodedResp.slice(0, 12), encodedResp.slice(12)); - const decryptedResponse = new TextDecoder().decode(decrypted); - const response = JSON.parse(decryptedResponse); - if (isCstgApiSuccessResponse(response)) { - resolvePromise({ - status: 'success', - identity: response.body, - }); - } - else if (isCstgApiOptoutResponse(response)) { - resolvePromise({ - status: 'optout', - }); - } - else { - // A 200 should always be a success response. - // Something has gone wrong. - rejectPromise(`API error: Response body was invalid for HTTP status 200: ${decryptedResponse}`); - } - } - else if (req.status === 400) { - const response = JSON.parse(req.responseText); - if (isCstgApiClientErrorResponse(response)) { - rejectPromise(`Client error: ${response.message}`); - } - else { - // A 400 should always be a client error. - // Something has gone wrong. - rejectPromise(`API error: Response body was invalid for HTTP status 400: ${req.responseText}`); - } - } - else if (req.status === 403) { - const response = JSON.parse(req.responseText); - if (isCstgApiForbiddenResponse(response)) { - rejectPromise(`Forbidden: ${response.message}`); - } - else { - // A 403 should always be a forbidden response. - // Something has gone wrong. - rejectPromise(`API error: Response body was invalid for HTTP status 403: ${req.responseText}`); - } - } - else { - rejectPromise(`API error: Unexpected HTTP status ${req.status}`); - } - } - catch (err) { - rejectPromise(err); - } - }); - req.send(JSON.stringify(requestBody)); - return yield promise; - }); - } -} -exports.ApiClient = ApiClient; - - -/***/ }), - -/***/ 230: -/***/ ((__unused_webpack_module, exports) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.CallbackManager = exports.EventType = void 0; -var EventType; -(function (EventType) { - EventType["InitCompleted"] = "InitCompleted"; - EventType["IdentityUpdated"] = "IdentityUpdated"; - EventType["SdkLoaded"] = "SdkLoaded"; - EventType["OptoutReceived"] = "OptoutReceived"; -})(EventType = exports.EventType || (exports.EventType = {})); -class CallbackManager { - constructor(sdk, productName, getIdentity, logger) { - this._sentInit = false; - this._productName = productName; - this._logger = logger; - this._getIdentity = getIdentity; - this._sdk = sdk; - this._sdk.callbacks.push = this.callbackPushInterceptor.bind(this); - } - callbackPushInterceptor(...args) { - var _a; - for (const c of args) { - if (CallbackManager._sentSdkLoaded[this._productName]) - this.safeRunCallback(c, EventType.SdkLoaded, {}); - if (this._sentInit) - this.safeRunCallback(c, EventType.InitCompleted, { - identity: (_a = this._getIdentity()) !== null && _a !== void 0 ? _a : null, - }); - } - return Array.prototype.push.apply(this._sdk.callbacks, args); - } - runCallbacks(event, payload) { - var _a; - if (event === EventType.InitCompleted) - this._sentInit = true; - if (event === EventType.SdkLoaded) - CallbackManager._sentSdkLoaded[this._productName] = true; - if (!this._sentInit && event !== EventType.SdkLoaded) - return; - const enrichedPayload = Object.assign(Object.assign({}, payload), { identity: (_a = this._getIdentity()) !== null && _a !== void 0 ? _a : null }); - for (const callback of this._sdk.callbacks) { - this.safeRunCallback(callback, event, enrichedPayload); - } - } - safeRunCallback(callback, event, payload) { - if (typeof callback === 'function') { - try { - callback(event, payload); - } - catch (exception) { - this._logger.warn('SDK callback threw an exception', exception); - } - } - else { - this._logger.warn("An SDK callback was supplied which isn't a function."); - } - } -} -exports.CallbackManager = CallbackManager; -CallbackManager._sentSdkLoaded = {}; - - -/***/ }), - -/***/ 522: -/***/ ((__unused_webpack_module, exports) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isClientSideIdentityOptionsOrThrow = exports.stripPublicKeyPrefix = void 0; -const SERVER_PUBLIC_KEY_PREFIX_LENGTH = 9; -function stripPublicKeyPrefix(serverPublicKey) { - return serverPublicKey.substring(SERVER_PUBLIC_KEY_PREFIX_LENGTH); -} -exports.stripPublicKeyPrefix = stripPublicKeyPrefix; -function isClientSideIdentityOptionsOrThrow(maybeOpts) { - if (typeof maybeOpts !== 'object' || maybeOpts === null) { - throw new TypeError('opts must be an object'); - } - const opts = maybeOpts; - if (typeof opts.serverPublicKey !== 'string') { - throw new TypeError('opts.serverPublicKey must be a string'); - } - const serverPublicKeyPrefix = /^UID2-X-[A-Z]-.+/; - if (!serverPublicKeyPrefix.test(opts.serverPublicKey)) { - throw new TypeError(`opts.serverPublicKey must match the regular expression ${serverPublicKeyPrefix}`); - } - // We don't do any further validation of the public key, as we will find out - // later if it's valid by using importKey. - if (typeof opts.subscriptionId !== 'string') { - throw new TypeError('opts.subscriptionId must be a string'); - } - if (opts.subscriptionId.length === 0) { - throw new TypeError('opts.subscriptionId is empty'); - } - return true; -} -exports.isClientSideIdentityOptionsOrThrow = isClientSideIdentityOptionsOrThrow; - - -/***/ }), - -/***/ 852: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.CookieManager = exports.isLegacyCookie = void 0; -const Identity_1 = __webpack_require__(531); -function isLegacyCookie(cookie) { - if (typeof cookie !== 'object' || !cookie) - return false; - const partialCookie = cookie; - if ('advertising_token' in partialCookie && - 'refresh_token' in partialCookie && - partialCookie.advertising_token && - partialCookie.refresh_token) - return true; - return false; -} -exports.isLegacyCookie = isLegacyCookie; -function enrichIdentity(identity, now) { - return Object.assign({ refresh_from: now, refresh_expires: now + 7 * 86400 * 1000, identity_expires: now + 4 * 3600 * 1000 }, identity); -} -class CookieManager { - constructor(opts, cookieName) { - this._cookieName = cookieName; - this._opts = opts; - } - setCookie(identity) { - var _a; - const value = JSON.stringify(identity); - const expires = new Date(identity.refresh_expires); - const path = (_a = this._opts.cookiePath) !== null && _a !== void 0 ? _a : '/'; - let cookie = this._cookieName + - '=' + - encodeURIComponent(value) + - ' ;path=' + - path + - ';expires=' + - expires.toUTCString(); - if (typeof this._opts.cookieDomain !== 'undefined') { - cookie += ';domain=' + this._opts.cookieDomain; - } - document.cookie = cookie; - } - removeCookie() { - document.cookie = this._cookieName + '=;expires=Tue, 1 Jan 1980 23:59:59 GMT'; - } - getCookie() { - const docCookie = document.cookie; - if (docCookie) { - const payload = docCookie.split('; ').find((row) => row.startsWith(this._cookieName + '=')); - if (payload) { - return decodeURIComponent(payload.split('=')[1]); - } - } - } - migrateLegacyCookie(identity, now) { - const newCookie = enrichIdentity(identity, now); - this.setCookie(newCookie); - return newCookie; - } - loadIdentityFromCookie() { - const payload = this.getCookie(); - if (payload) { - const result = JSON.parse(payload); - if ((0, Identity_1.isValidIdentity)(result)) - return result; - if ((0, Identity_1.isOptoutIdentity)(result)) - return result; - if (isLegacyCookie(result)) { - return this.migrateLegacyCookie(result, Date.now()); - } - } - return null; - } -} -exports.CookieManager = CookieManager; - - -/***/ }), - -/***/ 828: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.CstgBox = void 0; -const cstgCrypto_1 = __webpack_require__(135); -class CstgBox { - constructor(clientPublicKey, sharedKey) { - this._clientPublicKey = clientPublicKey; - this._sharedKey = sharedKey; - } - static build(serverPublicKey) { - return __awaiter(this, void 0, void 0, function* () { - const clientKeyPair = yield (0, cstgCrypto_1.generateKeyPair)(CstgBox._namedCurve); - const importedServerPublicKey = yield (0, cstgCrypto_1.importPublicKey)(serverPublicKey, this._namedCurve); - const sharedKey = yield (0, cstgCrypto_1.deriveKey)(importedServerPublicKey, clientKeyPair.privateKey); - return new CstgBox(clientKeyPair.publicKey, sharedKey); - }); - } - encrypt(plaintext, additionalData) { - return __awaiter(this, void 0, void 0, function* () { - const iv = window.crypto.getRandomValues(new Uint8Array(12)); - const ciphertext = yield (0, cstgCrypto_1.encrypt)(plaintext, this._sharedKey, iv, additionalData); - return { - iv: iv, - ciphertext: ciphertext, - }; - }); - } - decrypt(iv, ciphertext) { - return __awaiter(this, void 0, void 0, function* () { - return yield (0, cstgCrypto_1.decrypt)(ciphertext, this._sharedKey, iv); - }); - } - get clientPublicKey() { - return this._clientPublicKey; - } -} -exports.CstgBox = CstgBox; -CstgBox._namedCurve = 'P-256'; - - -/***/ }), - -/***/ 135: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.decrypt = exports.encrypt = exports.deriveKey = exports.exportPublicKey = exports.importPublicKey = exports.generateKeyPair = void 0; -const base64_1 = __webpack_require__(819); -function generateKeyPair(namedCurve) { - const params = { - name: 'ECDH', - namedCurve: namedCurve, - }; - return window.crypto.subtle.generateKey(params, false, ['deriveKey']); -} -exports.generateKeyPair = generateKeyPair; -function importPublicKey(publicKey, namedCurve) { - const params = { - name: 'ECDH', - namedCurve: namedCurve, - }; - return window.crypto.subtle.importKey('spki', (0, base64_1.base64ToBytes)(publicKey), params, false, []); -} -exports.importPublicKey = importPublicKey; -function exportPublicKey(publicKey) { - return window.crypto.subtle.exportKey('spki', publicKey); -} -exports.exportPublicKey = exportPublicKey; -function deriveKey(serverPublicKey, clientPrivateKey) { - return window.crypto.subtle.deriveKey({ - name: 'ECDH', - public: serverPublicKey, - }, clientPrivateKey, { - name: 'AES-GCM', - length: 256, - }, false, ['encrypt', 'decrypt']); -} -exports.deriveKey = deriveKey; -function encrypt(data, key, iv, additionalData) { - return window.crypto.subtle.encrypt({ - name: 'AES-GCM', - iv: iv, - additionalData: additionalData, - }, key, data); -} -exports.encrypt = encrypt; -function decrypt(data, key, iv) { - return window.crypto.subtle.decrypt({ - name: 'AES-GCM', - iv: iv, - }, key, data); -} -exports.decrypt = decrypt; - - -/***/ }), - -/***/ 838: -/***/ ((__unused_webpack_module, exports) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.normalizeEmail = exports.isNormalizedPhone = void 0; -function isNormalizedPhone(phone) { - return /^\+[0-9]{10,15}$/.test(phone); -} -exports.isNormalizedPhone = isNormalizedPhone; -const EMAIL_EXTENSION_SYMBOL = '+'; -const EMAIL_DOT = '.'; -const GMAIL_DOMAIN = 'gmail.com'; -function splitEmailIntoAddressAndDomain(email) { - const parts = email.split('@'); - if (!parts.length || parts.length !== 2 || parts.some((part) => part === '')) - return; - return { - address: parts[0], - domain: parts[1], - }; -} -function isGmail(domain) { - return domain === GMAIL_DOMAIN; -} -function dropExtension(address, extensionSymbol = EMAIL_EXTENSION_SYMBOL) { - return address.split(extensionSymbol)[0]; -} -function normalizeAddressPart(address, shouldRemoveDot, shouldDropExtension) { - let parsedAddress = address; - if (shouldRemoveDot) - parsedAddress = parsedAddress.replaceAll(EMAIL_DOT, ''); - if (shouldDropExtension) - parsedAddress = dropExtension(parsedAddress); - return parsedAddress; -} -function normalizeEmail(email) { - if (!email || !email.length) - return; - const parsedEmail = email.trim().toLowerCase(); - if (parsedEmail.indexOf(' ') > 0) - return; - const emailParts = splitEmailIntoAddressAndDomain(parsedEmail); - if (!emailParts) - return; - const { address, domain } = emailParts; - const emailIsGmail = isGmail(domain); - const parsedAddress = normalizeAddressPart(address, emailIsGmail, emailIsGmail); - return parsedAddress ? `${parsedAddress}@${domain}` : undefined; -} -exports.normalizeEmail = normalizeEmail; - - -/***/ }), - -/***/ 819: -/***/ ((__unused_webpack_module, exports) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.bytesToBase64 = exports.base64ToBytes = void 0; -function base64ToBytes(base64) { - const binString = atob(base64); - return Uint8Array.from(binString, (m) => m.codePointAt(0)); -} -exports.base64ToBytes = base64ToBytes; -function bytesToBase64(bytes) { - const binString = Array.from(bytes, (x) => String.fromCodePoint(x)).join(''); - return btoa(binString); -} -exports.bytesToBase64 = bytesToBase64; - - -/***/ }), - -/***/ 699: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.hashIdentifier = exports.hashAndEncodeIdentifier = void 0; -const base64_1 = __webpack_require__(819); -function hashAndEncodeIdentifier(value) { - return __awaiter(this, void 0, void 0, function* () { - const hash = yield window.crypto.subtle.digest('SHA-256', new TextEncoder().encode(value)); - return (0, base64_1.bytesToBase64)(new Uint8Array(hash)); - }); -} -exports.hashAndEncodeIdentifier = hashAndEncodeIdentifier; -function hashIdentifier(value) { - return __awaiter(this, void 0, void 0, function* () { - const hash = yield window.crypto.subtle.digest('SHA-256', new TextEncoder().encode(value)); - // converting 32-byte SHA-256 to hex-encoded representation - return [...new Uint8Array(hash)].map((x) => x.toString(16).padStart(2, '0')).join(''); - }); -} -exports.hashIdentifier = hashIdentifier; - - -/***/ }), - -/***/ 479: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.SdkBase = exports.hashAndEncodeIdentifier = exports.isBase64Hash = exports.isNormalizedPhone = exports.isClientSideIdentityOptionsOrThrow = exports.EventType = void 0; -var callbackManager_1 = __webpack_require__(230); -Object.defineProperty(exports, "EventType", ({ enumerable: true, get: function () { return callbackManager_1.EventType; } })); -var clientSideIdentityOptions_1 = __webpack_require__(522); -Object.defineProperty(exports, "isClientSideIdentityOptionsOrThrow", ({ enumerable: true, get: function () { return clientSideIdentityOptions_1.isClientSideIdentityOptionsOrThrow; } })); -var diiNormalization_1 = __webpack_require__(838); -Object.defineProperty(exports, "isNormalizedPhone", ({ enumerable: true, get: function () { return diiNormalization_1.isNormalizedPhone; } })); -var hashedDii_1 = __webpack_require__(254); -Object.defineProperty(exports, "isBase64Hash", ({ enumerable: true, get: function () { return hashedDii_1.isBase64Hash; } })); -var hash_1 = __webpack_require__(699); -Object.defineProperty(exports, "hashAndEncodeIdentifier", ({ enumerable: true, get: function () { return hash_1.hashAndEncodeIdentifier; } })); -var sdkBase_1 = __webpack_require__(533); -Object.defineProperty(exports, "SdkBase", ({ enumerable: true, get: function () { return sdkBase_1.SdkBase; } })); - - -/***/ }), - -/***/ 254: -/***/ ((__unused_webpack_module, exports) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isBase64Hash = void 0; -function isBase64Hash(value) { - if (!(value && value.length === 44)) { - return false; - } - try { - return btoa(atob(value)) === value; - } - catch (err) { - return false; - } -} -exports.isBase64Hash = isBase64Hash; - - -/***/ }), - -/***/ 755: -/***/ ((__unused_webpack_module, exports) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.notifyInitCallback = exports.IdentityStatus = void 0; -var IdentityStatus; -(function (IdentityStatus) { - IdentityStatus[IdentityStatus["ESTABLISHED"] = 0] = "ESTABLISHED"; - IdentityStatus[IdentityStatus["REFRESHED"] = 1] = "REFRESHED"; - IdentityStatus[IdentityStatus["EXPIRED"] = 100] = "EXPIRED"; - IdentityStatus[IdentityStatus["NO_IDENTITY"] = -1] = "NO_IDENTITY"; - IdentityStatus[IdentityStatus["INVALID"] = -2] = "INVALID"; - IdentityStatus[IdentityStatus["REFRESH_EXPIRED"] = -3] = "REFRESH_EXPIRED"; - IdentityStatus[IdentityStatus["OPTOUT"] = -4] = "OPTOUT"; -})(IdentityStatus = exports.IdentityStatus || (exports.IdentityStatus = {})); -function notifyInitCallback(options, status, statusText, advertisingToken, logger) { - if (options.callback) { - const payload = { - advertisingToken: advertisingToken, - advertising_token: advertisingToken, - status: status, - statusText: statusText, - }; - try { - options.callback(payload); - } - catch (exception) { - logger.warn('SDK init callback threw an exception', exception); - } - } -} -exports.notifyInitCallback = notifyInitCallback; - - -/***/ }), - -/***/ 669: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.LocalStorageManager = void 0; -const Identity_1 = __webpack_require__(531); -class LocalStorageManager { - constructor(storageKey) { - this._storageKey = storageKey; - } - setValue(identity) { - const value = JSON.stringify(identity); - localStorage.setItem(this._storageKey, value); - } - removeValue() { - localStorage.removeItem(this._storageKey); - } - getValue() { - return localStorage.getItem(this._storageKey); - } - loadIdentityFromLocalStorage() { - const payload = this.getValue(); - if (payload) { - const result = JSON.parse(payload); - if ((0, Identity_1.isValidIdentity)(result)) - return result; - if ((0, Identity_1.isOptoutIdentity)(result)) - return result; - } - return null; - } -} -exports.LocalStorageManager = LocalStorageManager; - - -/***/ }), - -/***/ 317: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.PromiseHandler = void 0; -const callbackManager_1 = __webpack_require__(230); -class PromiseHandler { - constructor(sdk) { - this._promises = []; - this._seenInitOrRejectAll = false; - sdk.callbacks.push(this._handleEvent.bind(this)); - } - _handleEvent(eventType, payload) { - if (eventType !== callbackManager_1.EventType.InitCompleted && eventType !== callbackManager_1.EventType.IdentityUpdated) - return; - if (eventType === callbackManager_1.EventType.InitCompleted) { - this._seenInitOrRejectAll = true; - } - if (!this._apiClient || !this._apiClient.hasActiveRequests()) { - this._promises.forEach((p) => { - if ('identity' in payload && payload.identity) { - p.resolve(payload.identity.advertising_token); - } - else { - p.reject(new Error(`No identity available.`)); - } - }); - this._promises = []; - } - } - rejectAllPromises(reason) { - this._seenInitOrRejectAll = true; - this._promises.forEach((p) => { - p.reject(reason); - }); - this._promises = []; - } - // n.b. If this has seen an SDK init and there is no active request or a reject-all call, it'll reply immediately with the provided token or rejection. - // Otherwise, it will ignore the provided token and resolve with the identity available when the init event arrives - createMaybeDeferredPromise(token) { - if (!this._seenInitOrRejectAll || (this._apiClient && this._apiClient.hasActiveRequests())) { - return new Promise((resolve, reject) => { - this._promises.push({ - resolve, - reject, - }); - }); - } - else { - if (token) - return Promise.resolve(token); - else - return Promise.reject(new Error('Identity not available')); - } - } - registerApiClient(apiClient) { - this._apiClient = apiClient; - } -} -exports.PromiseHandler = PromiseHandler; - - -/***/ }), - -/***/ 533: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.SdkBase = void 0; -const package_json_1 = __webpack_require__(147); -const Identity_1 = __webpack_require__(531); -const initCallbacks_1 = __webpack_require__(755); -const sdkOptions_1 = __webpack_require__(512); -const logger_1 = __webpack_require__(980); -const apiClient_1 = __webpack_require__(367); -const callbackManager_1 = __webpack_require__(230); -const clientSideIdentityOptions_1 = __webpack_require__(522); -const diiNormalization_1 = __webpack_require__(838); -const hashedDii_1 = __webpack_require__(254); -const promiseHandler_1 = __webpack_require__(317); -const storageManager_1 = __webpack_require__(505); -const hash_1 = __webpack_require__(699); -function hasExpired(expiry, now = Date.now()) { - return expiry <= now; -} -class SdkBase { - // Sets up nearly everything, but does not run SdkLoaded callbacks - derived classes must run them. - constructor(existingCallbacks = undefined, product) { - // Push functions to this array to receive event notifications - this.callbacks = []; - this._opts = {}; - this._initComplete = false; - this._refreshTimerId = null; - this._product = product; - this._logger = (0, logger_1.MakeLogger)(console, product.name); - const exception = new Error(); - this._logger.log(`Constructing an SDK!`, exception.stack); - if (existingCallbacks) - this.callbacks = existingCallbacks; - this._tokenPromiseHandler = new promiseHandler_1.PromiseHandler(this); - this._callbackManager = new callbackManager_1.CallbackManager(this, this._product.name, () => this.getIdentity(), this._logger); - } - static get VERSION() { - return package_json_1.version; - } - static get DEFAULT_REFRESH_RETRY_PERIOD_MS() { - return 5000; - } - init(opts) { - this.initInternal(opts); - } - getAdvertisingToken() { - var _a, _b; - return (_b = (_a = this.getIdentity()) === null || _a === void 0 ? void 0 : _a.advertising_token) !== null && _b !== void 0 ? _b : undefined; - } - setIdentityFromEmail(email, opts) { - return __awaiter(this, void 0, void 0, function* () { - this._logger.log('Sending request', email); - this.throwIfInitNotComplete('Cannot set identity before calling init.'); - (0, clientSideIdentityOptions_1.isClientSideIdentityOptionsOrThrow)(opts); - const normalizedEmail = (0, diiNormalization_1.normalizeEmail)(email); - if (normalizedEmail === undefined) { - throw new Error('Invalid email address'); - } - const emailHash = yield (0, hash_1.hashAndEncodeIdentifier)(email); - yield this.callCstgAndSetIdentity({ emailHash: emailHash }, opts); - }); - } - setIdentityFromEmailHash(emailHash, opts) { - return __awaiter(this, void 0, void 0, function* () { - this.throwIfInitNotComplete('Cannot set identity before calling init.'); - (0, clientSideIdentityOptions_1.isClientSideIdentityOptionsOrThrow)(opts); - if (!(0, hashedDii_1.isBase64Hash)(emailHash)) { - throw new Error('Invalid hash'); - } - yield this.callCstgAndSetIdentity({ emailHash: emailHash }, opts); - }); - } - setIdentity(identity) { - if (this._apiClient) - this._apiClient.abortActiveRequests(); - const validatedIdentity = this.validateAndSetIdentity(identity); - if (validatedIdentity) { - if ((0, Identity_1.isOptoutIdentity)(validatedIdentity)) { - this._callbackManager.runCallbacks(callbackManager_1.EventType.OptoutReceived, {}); - } - else { - this.triggerRefreshOrSetTimer(validatedIdentity); - } - this._callbackManager.runCallbacks(callbackManager_1.EventType.IdentityUpdated, {}); - } - } - getIdentity() { - return this._identity && !this.temporarilyUnavailable() && !(0, Identity_1.isOptoutIdentity)(this._identity) - ? this._identity - : null; - } - // When the SDK has been initialized, this function should return the token - // from the most recent refresh request, if there is a request, wait for the - // new token. Otherwise, returns a promise which will be resolved after init. - getAdvertisingTokenAsync() { - const token = this.getAdvertisingToken(); - return this._tokenPromiseHandler.createMaybeDeferredPromise(token !== null && token !== void 0 ? token : null); - } - /** - * Deprecated - */ - isLoginRequired() { - return this.hasIdentity(); - } - hasIdentity() { - var _a; - if (!this._initComplete) - return undefined; - return !(this.isLoggedIn() || ((_a = this._apiClient) === null || _a === void 0 ? void 0 : _a.hasActiveRequests())); - } - hasOptedOut() { - if (!this._initComplete) - return undefined; - return (0, Identity_1.isOptoutIdentity)(this._identity); - } - disconnect() { - this.abort(`${this._product.name} SDK disconnected.`); - // Note: This silently fails to clear the cookie if init hasn't been called and a cookieDomain is used! - if (this._storageManager) - this._storageManager.removeValues(); - else - new storageManager_1.StorageManager({}, this._product.cookieName, this._product.localStorageKey).removeValues(); - this._identity = undefined; - this._callbackManager.runCallbacks(callbackManager_1.EventType.IdentityUpdated, { - identity: null, - }); - } - // Note: This doesn't invoke callbacks. It's a hard, silent reset. - abort(reason) { - this._initComplete = true; - this._tokenPromiseHandler.rejectAllPromises(reason !== null && reason !== void 0 ? reason : new Error(`${this._product.name} SDK aborted.`)); - if (this._refreshTimerId) { - clearTimeout(this._refreshTimerId); - this._refreshTimerId = null; - } - if (this._apiClient) - this._apiClient.abortActiveRequests(); - } - initInternal(opts) { - var _a; - if (this._initComplete) { - throw new TypeError('Calling init() more than once is not allowed'); - } - if (!(0, sdkOptions_1.isSDKOptionsOrThrow)(opts)) - throw new TypeError(`Options provided to ${this._product.name} init couldn't be validated.`); - this._opts = opts; - this._storageManager = new storageManager_1.StorageManager(Object.assign({}, opts), this._product.cookieName, this._product.localStorageKey); - this._apiClient = new apiClient_1.ApiClient(opts, this._product.defaultBaseUrl, this._product.name); - this._tokenPromiseHandler.registerApiClient(this._apiClient); - let identity; - if (this._opts.identity) { - identity = this._opts.identity; - } - else { - identity = this._storageManager.loadIdentityWithFallback(); - } - const validatedIdentity = this.validateAndSetIdentity(identity); - if (validatedIdentity && !(0, Identity_1.isOptoutIdentity)(validatedIdentity)) - this.triggerRefreshOrSetTimer(validatedIdentity); - this._initComplete = true; - (_a = this._callbackManager) === null || _a === void 0 ? void 0 : _a.runCallbacks(callbackManager_1.EventType.InitCompleted, {}); - if (this.hasOptedOut()) - this._callbackManager.runCallbacks(callbackManager_1.EventType.OptoutReceived, {}); - } - isLoggedIn() { - return this._identity && !hasExpired(this._identity.refresh_expires); - } - temporarilyUnavailable() { - var _a; - if (!this._identity && ((_a = this._apiClient) === null || _a === void 0 ? void 0 : _a.hasActiveRequests())) - return true; - if (this._identity && - hasExpired(this._identity.identity_expires) && - !hasExpired(this._identity.refresh_expires)) - return true; - return false; - } - getIdentityStatus(identity) { - if (!identity) { - return { - valid: false, - errorMessage: 'Identity not available', - status: initCallbacks_1.IdentityStatus.NO_IDENTITY, - identity: null, - }; - } - if ((0, Identity_1.isOptoutIdentity)(identity)) { - return { - valid: false, - errorMessage: 'User has opted out', - status: initCallbacks_1.IdentityStatus.OPTOUT, - identity: identity, - }; - } - if (!identity.advertising_token) { - return { - valid: false, - errorMessage: 'advertising_token is not available or is not valid', - status: initCallbacks_1.IdentityStatus.INVALID, - identity: null, - }; - } - if (!identity.refresh_token) { - return { - valid: false, - errorMessage: 'refresh_token is not available or is not valid', - status: initCallbacks_1.IdentityStatus.INVALID, - identity: null, - }; - } - if (hasExpired(identity.refresh_expires, Date.now())) { - return { - valid: false, - errorMessage: 'Identity expired, refresh expired', - status: initCallbacks_1.IdentityStatus.REFRESH_EXPIRED, - identity: null, - }; - } - if (hasExpired(identity.identity_expires, Date.now())) { - return { - valid: true, - errorMessage: 'Identity expired, refresh still valid', - status: initCallbacks_1.IdentityStatus.EXPIRED, - identity, - }; - } - if (typeof this._identity === 'undefined') - return { - valid: true, - identity, - status: initCallbacks_1.IdentityStatus.ESTABLISHED, - errorMessage: 'Identity established', - }; - return { - valid: true, - identity, - status: initCallbacks_1.IdentityStatus.REFRESHED, - errorMessage: 'Identity refreshed', - }; - } - validateAndSetIdentity(identity, status, statusText) { - var _a, _b; - if (!this._storageManager) - throw new Error('Cannot set identity before calling init.'); - const validity = this.getIdentityStatus(identity); - if (validity.valid && - validity.identity && - !(0, Identity_1.isOptoutIdentity)(this._identity) && - ((_a = validity.identity) === null || _a === void 0 ? void 0 : _a.advertising_token) === ((_b = this._identity) === null || _b === void 0 ? void 0 : _b.advertising_token)) - return validity.identity; - this._identity = validity.identity; - if (validity.valid && validity.identity) { - this._storageManager.setIdentity(validity.identity); - } - else if (validity.status === initCallbacks_1.IdentityStatus.OPTOUT || status === initCallbacks_1.IdentityStatus.OPTOUT) { - this._storageManager.setOptout(); - } - else { - this.abort(); - this._storageManager.removeValues(); - } - (0, initCallbacks_1.notifyInitCallback)(this._opts, status !== null && status !== void 0 ? status : validity.status, statusText !== null && statusText !== void 0 ? statusText : validity.errorMessage, this.getAdvertisingToken(), this._logger); - return validity.identity; - } - triggerRefreshOrSetTimer(validIdentity) { - if (hasExpired(validIdentity.refresh_from, Date.now())) { - this.refreshToken(validIdentity); - } - else { - this.setRefreshTimer(); - } - } - setRefreshTimer() { - var _a, _b; - const timeout = (_b = (_a = this._opts) === null || _a === void 0 ? void 0 : _a.refreshRetryPeriod) !== null && _b !== void 0 ? _b : SdkBase.DEFAULT_REFRESH_RETRY_PERIOD_MS; - if (this._refreshTimerId) { - clearTimeout(this._refreshTimerId); - } - this._refreshTimerId = setTimeout(() => { - var _a, _b; - if (this.isLoginRequired()) - return; - const validatedIdentity = this.validateAndSetIdentity((_b = (_a = this._storageManager) === null || _a === void 0 ? void 0 : _a.loadIdentity()) !== null && _b !== void 0 ? _b : null); - if (validatedIdentity && !(0, Identity_1.isOptoutIdentity)(validatedIdentity)) - this.triggerRefreshOrSetTimer(validatedIdentity); - this._refreshTimerId = null; - }, timeout); - } - refreshToken(identity) { - const apiClient = this._apiClient; - if (!apiClient) - throw new Error('Cannot refresh the token before calling init.'); - apiClient - .callRefreshApi(identity) - .then((response) => { - switch (response.status) { - case 'success': - this.validateAndSetIdentity(response.identity, initCallbacks_1.IdentityStatus.REFRESHED, 'Identity refreshed'); - this.setRefreshTimer(); - break; - case 'optout': - this.validateAndSetIdentity(null, initCallbacks_1.IdentityStatus.OPTOUT, 'User opted out'); - this._callbackManager.runCallbacks(callbackManager_1.EventType.OptoutReceived, {}); - break; - case 'expired_token': - this.validateAndSetIdentity(null, initCallbacks_1.IdentityStatus.REFRESH_EXPIRED, 'Refresh token expired'); - break; - } - }, (reason) => { - this._logger.warn(`Encountered an error refreshing the token`, reason); - this.validateAndSetIdentity(identity); - if (!hasExpired(identity.refresh_expires, Date.now())) - this.setRefreshTimer(); - }) - .then(() => { - this._callbackManager.runCallbacks(callbackManager_1.EventType.IdentityUpdated, {}); - }, (reason) => this._logger.warn(`Callbacks on identity event failed.`, reason)); - } - callCstgAndSetIdentity(request, opts) { - return __awaiter(this, void 0, void 0, function* () { - const cstgResult = yield this._apiClient.callCstgApi(request, opts); - if (cstgResult.status == 'success') { - this.setIdentity(cstgResult.identity); - } - else if (cstgResult.status === 'optout') { - this.validateAndSetIdentity(null, initCallbacks_1.IdentityStatus.OPTOUT); - this._callbackManager.runCallbacks(callbackManager_1.EventType.OptoutReceived, {}); - this._callbackManager.runCallbacks(callbackManager_1.EventType.IdentityUpdated, {}); - } - else { - const errorText = 'Unexpected status received from CSTG endpoint.'; - this._logger.warn(errorText); - throw new Error(errorText); - } - }); - } - throwIfInitNotComplete(message) { - if (!this._initComplete) { - throw new Error(message); - } - } -} -exports.SdkBase = SdkBase; -SdkBase.IdentityStatus = initCallbacks_1.IdentityStatus; -SdkBase.EventType = callbackManager_1.EventType; - - -/***/ }), - -/***/ 512: -/***/ ((__unused_webpack_module, exports) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isSDKOptionsOrThrow = void 0; -function isSDKOptionsOrThrow(maybeOpts) { - if (typeof maybeOpts !== 'object' || maybeOpts === null) { - throw new TypeError('opts must be an object'); - } - const opts = maybeOpts; - if (opts.callback !== undefined && typeof opts.callback !== 'function') { - throw new TypeError('opts.callback, if provided, must be a function'); - } - if (typeof opts.refreshRetryPeriod !== 'undefined') { - if (typeof opts.refreshRetryPeriod !== 'number') - throw new TypeError('opts.refreshRetryPeriod must be a number'); - else if (opts.refreshRetryPeriod < 1000) - throw new RangeError('opts.refreshRetryPeriod must be >= 1000'); - } - return true; -} -exports.isSDKOptionsOrThrow = isSDKOptionsOrThrow; - - -/***/ }), - -/***/ 980: -/***/ ((__unused_webpack_module, exports) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.MakeLogger = void 0; -function nop(...data) { } -function MakeSafeLoggerFunction(fn) { - if (typeof fn === 'function') - return fn; - return nop; -} -function MakeAnnotatedLoggerFunction(fn, annotation) { - return (...data) => { - if (typeof data[0] === 'string') - fn(`[${annotation}] ${data[0]}`, ...data.slice(1)); - else - fn(`[${annotation}]`, ...data); - }; -} -function MakeLoggerFunction(fn, annotation) { - const safeFunction = MakeSafeLoggerFunction(fn); - if (annotation) - return MakeAnnotatedLoggerFunction(safeFunction, annotation); - else - return safeFunction; -} -function MakeLogger(logger, annotation) { - return { - debug: MakeLoggerFunction(logger.debug, annotation), - error: MakeLoggerFunction(logger.error, annotation), - info: MakeLoggerFunction(logger.info, annotation), - log: MakeLoggerFunction(logger.log, annotation), - trace: MakeLoggerFunction(logger.trace, annotation), - warn: MakeLoggerFunction(logger.warn, annotation), - }; -} -exports.MakeLogger = MakeLogger; - - -/***/ }), - -/***/ 505: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageManager = void 0; -const cookieManager_1 = __webpack_require__(852); -const localStorageManager_1 = __webpack_require__(669); -class StorageManager { - constructor(opts, cookieName, localStorageKey) { - this._opts = opts; - this._cookieManager = new cookieManager_1.CookieManager(Object.assign({}, opts), cookieName); - this._localStorageManager = new localStorageManager_1.LocalStorageManager(localStorageKey); - } - loadIdentityWithFallback() { - const localStorageIdentity = this._localStorageManager.loadIdentityFromLocalStorage(); - const cookieIdentity = this._cookieManager.loadIdentityFromCookie(); - const shouldUseCookie = cookieIdentity && - (!localStorageIdentity || - cookieIdentity.identity_expires > localStorageIdentity.identity_expires); - return shouldUseCookie ? cookieIdentity : localStorageIdentity; - } - loadIdentity() { - return this._opts.useCookie - ? this._cookieManager.loadIdentityFromCookie() - : this._localStorageManager.loadIdentityFromLocalStorage(); - } - setIdentity(identity) { - this.setValue(identity); - } - setOptout() { - const expiry = Date.now() + 72 * 60 * 60 * 1000; // 3 days - need to pick something - const optout = { - refresh_expires: expiry, - identity_expires: expiry, - status: 'optout', - }; - this.setValue(optout); - } - setValue(value) { - if (this._opts.useCookie) { - this._cookieManager.setCookie(value); - return; - } - this._localStorageManager.setValue(value); - if (this._opts.useCookie === false && - this._localStorageManager.loadIdentityFromLocalStorage()) { - this._cookieManager.removeCookie(); - } - } - removeValues() { - this._cookieManager.removeCookie(); - this._localStorageManager.removeValue(); - } -} -exports.StorageManager = StorageManager; - - -/***/ }), - -/***/ 890: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.sdkWindow = exports.__uid2InternalHandleScriptLoad = exports.UID2 = exports.UID2Helper = void 0; -const callbackManager_1 = __webpack_require__(230); -const clientSideIdentityOptions_1 = __webpack_require__(522); -const diiNormalization_1 = __webpack_require__(838); -const hashedDii_1 = __webpack_require__(254); -const hash_1 = __webpack_require__(699); -const sdkBase_1 = __webpack_require__(533); -__exportStar(__webpack_require__(479), exports); -class UID2Helper { - normalizeEmail(email) { - return (0, diiNormalization_1.normalizeEmail)(email); - } - hashIdentifier(normalizedEmail) { - return (0, hash_1.hashIdentifier)(normalizedEmail); - } - hashAndEncodeIdentifier(normalizedEmail) { - return __awaiter(this, void 0, void 0, function* () { - return yield (0, hash_1.hashAndEncodeIdentifier)(normalizedEmail); - }); - } - isNormalizedPhone(phone) { - return (0, diiNormalization_1.isNormalizedPhone)(phone); - } -} -exports.UID2Helper = UID2Helper; -class UID2 extends sdkBase_1.SdkBase { - constructor(existingCallbacks = undefined, callbackContainer = {}) { - super(existingCallbacks, UID2.Uid2Details); - const runCallbacks = () => { - this._callbackManager.runCallbacks(callbackManager_1.EventType.SdkLoaded, {}); - }; - if (window.__uid2 instanceof UID2) { - runCallbacks(); - } - else { - // Need to defer running callbacks until this is assigned to the window global - callbackContainer.callback = runCallbacks; - } - } - // Deprecated. Integrators should never access the cookie directly! - static get COOKIE_NAME() { - console.warn('Detected access to UID2.COOKIE_NAME. This is deprecated and will be removed in the future. Integrators should not access the cookie directly.'); - return UID2.cookieName; - } - static get Uid2Details() { - return { - name: 'UID2', - defaultBaseUrl: 'https://prod.uidapi.com', - localStorageKey: 'UID2-sdk-identity', - cookieName: UID2.cookieName, - }; - } - static setupGoogleTag() { - UID2.setupGoogleSecureSignals(); - } - static setupGoogleSecureSignals() { - if (window.__uid2SecureSignalProvider) - window.__uid2SecureSignalProvider.registerSecureSignalProvider(); - } - setIdentityFromPhone(phone, opts) { - return __awaiter(this, void 0, void 0, function* () { - this.throwIfInitNotComplete('Cannot set identity before calling init.'); - (0, clientSideIdentityOptions_1.isClientSideIdentityOptionsOrThrow)(opts); - if (!(0, diiNormalization_1.isNormalizedPhone)(phone)) { - throw new Error('Invalid phone number'); - } - const phoneHash = yield (0, hash_1.hashAndEncodeIdentifier)(phone); - yield this.callCstgAndSetIdentity({ phoneHash: phoneHash }, opts); - }); - } - setIdentityFromPhoneHash(phoneHash, opts) { - return __awaiter(this, void 0, void 0, function* () { - this.throwIfInitNotComplete('Cannot set identity before calling init.'); - (0, clientSideIdentityOptions_1.isClientSideIdentityOptionsOrThrow)(opts); - if (!(0, hashedDii_1.isBase64Hash)(phoneHash)) { - throw new Error('Invalid hash'); - } - yield this.callCstgAndSetIdentity({ phoneHash: phoneHash }, opts); - }); - } -} -exports.UID2 = UID2; -UID2.cookieName = '__uid_2'; -function __uid2InternalHandleScriptLoad() { - var _a; - const callbacks_uid2 = ((_a = window === null || window === void 0 ? void 0 : window.__uid2) === null || _a === void 0 ? void 0 : _a.callbacks) || []; - const callbackContainer = {}; - window.__uid2 = new UID2(callbacks_uid2, callbackContainer); - window.__uid2Helper = new UID2Helper(); - if (callbackContainer.callback) - callbackContainer.callback(); -} -exports.__uid2InternalHandleScriptLoad = __uid2InternalHandleScriptLoad; -__uid2InternalHandleScriptLoad(); -exports.sdkWindow = globalThis.window; - - -/***/ }), - -/***/ 147: -/***/ ((module) => { - -module.exports = JSON.parse('{"name":"@uid2/uid2-sdk","version":"3.3.0","description":"UID2 Client SDK","main":"lib/src/uid2Sdk.js","types":"lib/src/uid2Sdk.d.ts","files":["/lib"],"author":"The Trade Desk","license":"Apache 2.0","wallaby":{"delays":{"run":1000}},"scripts":{"lint":"eslint -c .eslintrc.js . ../static/js/uid2-sdk-2.0.0.js ../static/js/uid2-sdk-1.0.0.js","test":"jest","build":"webpack","build-with-sourcemaps":"webpack --mode=production --env prodSourceMaps=true","build-package":"tsc","watch":"webpack watch --mode=development","webpack-dev-server":"webpack-dev-server --config webpack-dev-server.config.js --hot --port 9091","uid2-examples":"webpack --mode=development --env outputToExamples=true","build:esp":"webpack --env espOnly=true"},"engines":{"node":">=18"},"jest":{"preset":"ts-jest","testEnvironment":"jsdom","setupFilesAfterEnv":["./setupJest.js"],"testPathIgnorePatterns":["/node_modules/","/dist/"]},"devDependencies":{"@jest/globals":"^29.2.2","@types/jest":"^29.2.0","@types/node":"^18.11.3","@typescript-eslint/eslint-plugin":"^5.40.1","@typescript-eslint/parser":"^5.40.1","eslint":"^8.25.0","eslint-config-airbnb-typescript":"^17.0.0","eslint-plugin-import":"^2.26.0","eslint-plugin-promise":"^6.1.1","eslint-plugin-simple-import-sort":"^8.0.0","eslint-plugin-testing-library":"^5.9.0","jest":"^29.2.1","jest-environment-jsdom":"^29.2.1","jsdom":"^20.0.1","ts-jest":"^29.0.3","ts-loader":"^9.4.1","typescript":"^4.8.4","webpack":"^5.74.0","webpack-cli":"^4.10.0","webpack-dev-server":"^4.15.1"}}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module is referenced by other modules so it can't be inlined -/******/ var __webpack_exports__ = __webpack_require__(890); -/******/ -/******/ })() -; \ No newline at end of file