Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-gpt

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-gpt - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

lib/utils/createManagerTest.js

11

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="0.2.5"></a>
## [0.2.5](https://github.com/nfl/react-gpt/compare/v0.2.4...v0.2.5) (2017-07-31)
### Bug Fixes
* Add yarn.lock ([b7c7c50](https://github.com/nfl/react-gpt/commit/b7c7c50))
* Import PropTypes from prop-types package ([34b61be](https://github.com/nfl/react-gpt/commit/34b61be))
* Move MockGPT out of distribution files ([775fe26](https://github.com/nfl/react-gpt/commit/775fe26))
* Import ReactTestUtils from test-utils ([75e74f6](https://github.com/nfl/react-gpt/commit/75e74f6))
<a name="0.2.4"></a>

@@ -10,3 +20,2 @@ ## [0.2.4](https://github.com/nfl/react-gpt/compare/v0.2.3...v0.2.4) (2017-03-23)

<a name="0.2.3"></a>

@@ -13,0 +22,0 @@ ## [0.2.3](https://github.com/nfl/react-gpt/compare/v0.2.2...v0.2.3) (2017-02-21)

3

dist/react-gpt.min.js

@@ -1,2 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactGPT=t(require("react"),require("react-dom")):e.ReactGPT=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2);Object.defineProperty(t,"Bling",{enumerable:!0,get:function(){return r(o).default}});var i=n(1);Object.defineProperty(t,"Events",{enumerable:!0,get:function(){return r(i).default}})},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n={READY:"ready",RENDER:"render",SLOT_RENDER_ENDED:"slotRenderEnded",IMPRESSION_VIEWABLE:"impressionViewable",SLOT_VISIBILITY_CHANGED:"slotVisibilityChanged"};t.default=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u,c,l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),p=n(17),g=r(p),h=n(18),y=r(h),v=n(15),b=r(v),_=n(10),m=r(_),S=n(16),k=r(S),P=n(1),w=r(P),E=n(5),M=r(E),O=n(3),C=(c=u=function(e){function t(){var e,n,r,o;i(this,t);for(var s=arguments.length,u=Array(s),c=0;c<s;c++)u[c]=arguments[c];return n=r=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.state={scriptLoaded:!1,inViewport:!1},o=n,a(r,o)}return s(t,e),d(t,[{key:"componentDidMount",value:function(){t._adManager.addInstance(this),t._adManager.load(t._config.seedFileUrl).then(this.onScriptLoaded.bind(this)).catch(this.onScriptError.bind(this))}},{key:"componentWillReceiveProps",value:function(e){var n=t._config.propsEqual,r=this.props.sizeMapping;!e.sizeMapping&&!r||n(e.sizeMapping,r)||t._adManager.removeMQListener(this,e)}},{key:"shouldComponentUpdate",value:function(e,n){var r=n.scriptLoaded,o=n.inViewport,i=this.notInViewport(e,n),a=this.state.inViewport!==o,s=this.state.scriptLoaded!==r;if(i)return!1;if(a)return!0;var u=t._config,c=u.filterProps,l=u.propsEqual,f=c(t.refreshableProps,this.props,e),d=c(t.reRenderProps,this.props,e),p=!l(d.props,d.nextProps),g=!p&&!l(f.props,f.nextProps);if(g&&this.configureSlot(this._adSlot,e),t._adManager._syncCorrelator)g?t._adManager.refresh():(p||s)&&t._adManager.renderAll();else{if(g)return this.refresh(),!1;if(p||s)return!0}return!1}},{key:"componentDidUpdate",value:function(){this.notInViewport(this.props,this.state)||this._divId&&(t._adManager._initialRender?t._adManager.render():this.renderAd())}},{key:"componentWillUnmount",value:function(){t._adManager.removeInstance(this),this._adSlot&&(t._adManager.googletag.destroySlots([this._adSlot]),this._adSlot=null)}},{key:"onScriptLoaded",value:function e(){var e=this.props.onScriptLoaded;this.getRenderWhenViewable()&&this.foldCheck(),this.setState({scriptLoaded:!0},e)}},{key:"onScriptError",value:function(e){console.warn("Ad: Failed to load gpt for "+t._config.seedFileUrl,e)}},{key:"getRenderWhenViewable",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return void 0!==e.renderWhenViewable?e.renderWhenViewable:t._config.renderWhenViewable}},{key:"foldCheck",value:function(){if(!this.state.inViewport){var e=this.getSlotSize();Array.isArray(e)&&Array.isArray(e[0])&&(e=e[0]),"fluid"===e&&(e=[0,0]);var n=t._adManager.isInViewport(y.default.findDOMNode(this),e,this.viewableThreshold);n&&this.setState({inViewport:!0})}}},{key:"defineSizeMapping",value:function(e,n){if(n){t._adManager.addMQListener(this,this.props);var r=n.reduce(function(e,t){return e.addSize(t.viewport,t.slot)},t._adManager.googletag.sizeMapping()).build();e.defineSizeMapping(r)}}},{key:"setAttributes",value:function(e,t){var n=e.getAttributeKeys();n.forEach(function(t){e.set(t,null)}),t&&Object.keys(t).forEach(function(n){e.set(n,t[n])})}},{key:"setTargeting",value:function(e,t){e.clearTargeting(),t&&Object.keys(t).forEach(function(n){e.setTargeting(n,t[n])})}},{key:"addCompanionAdService",value:function(e,n){var r=t._adManager.googletag.companionAds();n.addService(r),"object"===("undefined"==typeof e?"undefined":f(e))&&(e.hasOwnProperty("enableSyncLoading")&&r.enableSyncLoading(),e.hasOwnProperty("refreshUnfilledSlots")&&r.setRefreshUnfilledSlots(e.refreshUnfilledSlots))}},{key:"getSlotSize",value:function(){var e=this.props,t=e.slotSize,n=e.sizeMapping,r=void 0;if(t)r=t;else if(n){var o=n;r=o[0]&&o[0].slot}return r}},{key:"renderAd",value:function(){this.defineSlot(),this.display()}},{key:"notInViewport",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,n=t.inViewport;return this.getRenderWhenViewable(e)&&!n}},{key:"defineSlot",value:function(){var e=this.props,n=e.adUnitPath,r=e.outOfPage,o=this._divId,i=this.getSlotSize();this._adSlot||(r?this._adSlot=t._adManager.googletag.defineOutOfPageSlot(n,o):this._adSlot=t._adManager.googletag.defineSlot(n,i||[],o)),this.configureSlot(this._adSlot)}},{key:"configureSlot",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props,r=n.sizeMapping,i=n.attributes,a=n.targeting,s=n.companionAdService,u=n.categoryExclusion,c=n.collapseEmptyDiv,l=n.safeFrameConfig,f=n.content,d=n.clickUrl,p=n.forceSafeFrame;if(this.defineSizeMapping(e,r),void 0!==c)if(Array.isArray(c)){var g;(g=e.setCollapseEmptyDiv).call.apply(g,[e].concat(o(c)))}else e.setCollapseEmptyDiv(c);if(d&&e.setClickUrl(d),u){var h=u;"string"==typeof h&&(h=[h]),e.clearCategoryExclusions(),h.forEach(function(t){e.setCategoryExclusion(t)})}this.setAttributes(e,i),this.setTargeting(e,a),l&&e.setSafeFrameConfig(l),p&&e.setForceSafeFrame(p),s&&this.addCompanionAdService(s,e),f?e.addService(t._adManager.googletag.content()):e.addService(t._adManager.googletag.pubads())}},{key:"display",value:function(){var e=this.props.content,n=this._divId,r=this._adSlot;e?t._adManager.googletag.content().setContent(r,e):(t._adManager._disableInitialLoad||t._adManager._syncCorrelator||t._adManager.updateCorrelator(),t._adManager.googletag.display(n),t._adManager._disableInitialLoad&&!t._adManager._initialRender&&this.refresh())}},{key:"clear",value:function(){var e=this._adSlot;if(e&&e.hasOwnProperty("getServices")){var n=e.getServices();if(this._divId&&n.some(function(e){return!!e.setContent}))return void(document.getElementById(this._divId).innerHTML="");t._adManager.clear([e])}}},{key:"refresh",value:function(e){var n=this._adSlot;n&&(this.clear(),t._adManager.refresh([n],e))}},{key:"render",value:function(){var e=this.state.scriptLoaded,n=this.props,r=n.id,o=n.outOfPage,i=n.style,a=this.notInViewport(this.props,this.state);if(!e||a){var s=this.getSlotSize();o||(0,b.default)(s,"Either 'slotSize' or 'sizeMapping' prop needs to be set."),Array.isArray(s)&&Array.isArray(s[0])&&(s=s[0]),"fluid"===s&&(s=["auto","auto"]);var u=s&&{width:s[0],height:s[1]};return g.default.createElement("div",{style:u})}return this.clear(),this._adSlot&&(t._adManager.googletag.destroySlots([this._adSlot]),this._adSlot=null),this._divId=r||t._adManager.generateDivId(),g.default.createElement("div",{id:this._divId,style:i})}},{key:"adSlot",get:function(){return this._adSlot}},{key:"viewableThreshold",get:function(){return this.props.viewableThreshold>=0?this.props.viewableThreshold:t._config.viewableThreshold}}],[{key:"on",value:function(e,n){t._on("on",e,n)}},{key:"once",value:function(e,n){t._on("once",e,n)}},{key:"removeListener",value:function(){var e;(e=t._adManager).removeListener.apply(e,arguments)}},{key:"removeAllListeners",value:function(){var e;(e=t._adManager).removeAllListeners.apply(e,arguments)}},{key:"_on",value:function(e,n,r){"function"==typeof r&&(n===w.default.READY&&t._adManager.isReady?r.call(t._adManager,t._adManager.googletag):t._adManager[e](n,r))}},{key:"configure",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t._config=l({},t._config,e)}},{key:"getGPTVersion",value:function(){return t._adManager.getGPTVersion()}},{key:"getPubadsVersion",value:function(){return t._adManager.getPubadsVersion()}},{key:"syncCorrelator",value:function(e){t._adManager.syncCorrelator(e)}},{key:"render",value:function(){t._adManager.renderAll()}},{key:"refresh",value:function(e,n){t._adManager.refresh(e,n)}},{key:"clear",value:function(e){t._adManager.clear(e)}},{key:"updateCorrelator",value:function(){t._adManager.updateCorrelator()}},{key:"createTestManager",value:function(){t._adManager=(0,O.createManager)({test:!0})}}]),t}(p.Component),u.propTypes={id:p.PropTypes.string,adUnitPath:p.PropTypes.string.isRequired,targeting:p.PropTypes.object,slotSize:p.PropTypes.oneOfType([p.PropTypes.array,p.PropTypes.string]),sizeMapping:p.PropTypes.arrayOf(p.PropTypes.shape({viewport:p.PropTypes.array,slot:p.PropTypes.array})),outOfPage:p.PropTypes.bool,companionAdService:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.object]),content:p.PropTypes.string,clickUrl:p.PropTypes.string,categoryExclusion:p.PropTypes.oneOfType([p.PropTypes.string,p.PropTypes.array]),attributes:p.PropTypes.object,collapseEmptyDiv:p.PropTypes.oneOfType([p.PropTypes.bool,p.PropTypes.array]),forceSafeFrame:p.PropTypes.bool,safeFrameConfig:p.PropTypes.object,onSlotRenderEnded:p.PropTypes.func,onImpressionViewable:p.PropTypes.func,onSlotVisibilityChanged:p.PropTypes.func,renderWhenViewable:p.PropTypes.bool,viewableThreshold:p.PropTypes.number,onScriptLoaded:p.PropTypes.func,onMediaQueryChange:p.PropTypes.func,style:p.PropTypes.object},u.refreshableProps=["targeting","sizeMapping","clickUrl","categoryExclusion","attributes","collapseEmptyDiv","companionAdService","forceSafeFrame","safeFrameConfig"],u.reRenderProps=["adUnitPath","slotSize","outOfPage","content"],u._adManager=(0,O.createManager)(),u._config={seedFileUrl:"//www.googletagservices.com/tag/js/gpt.js",renderWhenViewable:!0,viewableThreshold:.5,filterProps:M.default,propsEqual:m.default},c);t.default=(0,k.default)(C,O.pubadsAPI.reduce(function(e,t){return e[t]=function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return C._adManager.pubadsProxy({method:t,args:n})},e},{}))},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return new m(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.AdManager=t.APIToCallBeforeServiceEnabled=t.pubadsAPI=void 0;var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.createManager=u;var l=n(13),f=r(l),d=n(9),p=r(d),g=n(14),h=n(1),y=r(h),v=n(6),b=r(v),_=(n(7),t.pubadsAPI=["enableAsyncRendering","enableSingleRequest","enableSyncRendering","disableInitialLoad","collapseEmptyDivs","enableVideoAds","set","get","getAttributeKeys","setTargeting","clearTargeting","setCategoryExclusion","clearCategoryExclusions","setCentering","setCookieOptions","setLocation","setPublisherProvidedId","setTagForChildDirectedTreatment","clearTagForChildDirectedTreatment","setVideoContent","setForceSafeFrame"],t.APIToCallBeforeServiceEnabled=["enableAsyncRendering","enableSingleRequest","enableSyncRendering","disableInitialLoad","collapseEmptyDivs","setCentering"]),m=t.AdManager=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n._adCnt=0,n._initialRender=!0,n._syncCorrelator=!1,n._testMode=!1,n._foldCheck=(0,p.default)(function(e){var t=n.getMountedInstances();t.forEach(function(t){t.getRenderWhenViewable()&&t.foldCheck(e)})},66),n._handleMediaQueryChange=function(e){if(n._syncCorrelator)return void n.refresh();var t=/min-width:\s?(\d+)px/.exec(e.media),r=t&&t[1];r&&n._mqls[r]&&n._mqls[r].listeners.forEach(function(t){t.refresh(),t.props.onMediaQueryChange&&t.props.onMediaQueryChange(e)})},n.render=(0,p.default)(function(){if(n._initialRender){var e=function e(t){n.pubadsReady?t():setTimeout(e,50,t)},t=n.getMountedInstances(),r=!1,o=void 0;t.forEach(function(e){if(!e.notInViewport()){e.defineSlot();var t=e.adSlot;if(t&&t.hasOwnProperty("getServices")){var n=t.getServices();r||(r=n.filter(function(e){return!!e.enableAsyncRendering}).length>0)}}}),r||(o=n.googletag.defineSlot("/",[]),o.addService(n.googletag.pubads())),n._processPubadsQueue(),n.googletag.enableServices(),e(function(){o&&n.googletag.destroySlots([o]),n._processPubadsQueue(),n._listen(),n._isReady=!0,n.emit(y.default.READY,n.googletag),t.forEach(function(e){e.notInViewport()||e.display()}),n.emit(y.default.RENDER,n.googletag),n._initialRender=!1})}},4),n.renderAll=(0,p.default)(function(){if(!n.apiReady)return!1;var e=n.getMountedInstances();return e.forEach(function(e,t){0===t&&n.updateCorrelator(),e.forceUpdate()}),!0},4),e.test&&(n.testMode=e.test),n}return s(t,e),c(t,[{key:"_processPubadsQueue",value:function(){var e=this;this._pubadsProxyQueue&&(Object.keys(this._pubadsProxyQueue).forEach(function(t){(e.googletag&&!e.googletag.pubadsReady&&_.indexOf(t)>-1||e.pubadsReady)&&(e._pubadsProxyQueue[t].forEach(function(t){return e.pubadsProxy(t)}),delete e._pubadsProxyQueue[t])}),Object.keys(this._pubadsProxyQueue).length||(this._pubadsProxyQueue=null))}},{key:"_callPubads",value:function(e){var t=e.method,n=e.args,r=e.resolve,i=e.reject;if("function"!=typeof this.googletag.pubads()[t])i(new Error("googletag.pubads does not support "+t+", please update pubadsAPI"));else try{var a,s=(a=this.googletag.pubads())[t].apply(a,o(n));r(s)}catch(e){i(e)}}},{key:"_toggleListener",value:function(e){var t=this;["scroll","resize"].forEach(function(n){window[e?"addEventListener":"removeEventListener"](n,t._foldCheck)})}},{key:"_listen",value:function(){var e=this;this._listening||([y.default.SLOT_RENDER_ENDED,y.default.IMPRESSION_VIEWABLE,y.default.SLOT_VISIBILITY_CHANGED].forEach(function(t){["pubads","content","companionAds"].forEach(function(n){e.googletag[n]().addEventListener(t,e._onEvent.bind(e,t))})}),this._listening=!0)}},{key:"_onEvent",value:function(e,t){this.listeners(e,!0)&&this.emit(e,t);var n=this.getMountedInstances(),r=t.slot,o="on"+e.charAt(0).toUpperCase()+e.substr(1),i=n.filter(function(e){return r===e.adSlot})[0];i&&i.props[o]&&i.props[o](t)}},{key:"syncCorrelator",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._syncCorrelator=e}},{key:"generateDivId",value:function(){return"bling-"+ ++this._adCnt}},{key:"getMountedInstances",value:function(){return this.mountedInstances||(this.mountedInstances=[]),this.mountedInstances}},{key:"addInstance",value:function(e){var t=this.getMountedInstances(),n=t.indexOf(e);n===-1&&(0===t.length&&this._toggleListener(!0),this.addMQListener(e,e.props),t.push(e))}},{key:"removeInstance",value:function(e){var t=this.getMountedInstances(),n=t.indexOf(e);n>=0&&(t.splice(n,1),0===t.length&&this._toggleListener(!1),this.removeMQListener(e,e.props))}},{key:"addMQListener",value:function(e,t){var n=this,r=t.sizeMapping;r&&Array.isArray(r)&&r.forEach(function(t){var r=t.viewport&&t.viewport[0];if(void 0!==r){if(n._mqls||(n._mqls={}),!n._mqls[r]){var o=window.matchMedia("(min-width: "+r+"px)");o.addListener(n._handleMediaQueryChange),n._mqls[r]={mql:o,listeners:[]}}n._mqls[r].listeners.indexOf(e)===-1&&n._mqls[r].listeners.push(e)}})}},{key:"removeMQListener",value:function(e){var t=this;this._mqls&&Object.keys(this._mqls).forEach(function(n){var r=t._mqls[n].listeners.indexOf(e);r>-1&&t._mqls[n].listeners.splice(r,1),0===t._mqls[n].listeners.length&&(t._mqls[n].mql.removeListener(t._handleMediaQueryChange),delete t._mqls[n])})}},{key:"isInViewport",value:function(){return b.default.apply(void 0,arguments)}},{key:"refresh",value:function(e,t){return!!this.pubadsReady&&(this.googletag.pubads().refresh(e,t),!0)}},{key:"clear",value:function(e){return!!this.pubadsReady&&(this.googletag.pubads().clear(e),!0)}},{key:"getGPTVersion",value:function(){return!!this.apiReady&&this.googletag.getVersion()}},{key:"getPubadsVersion",value:function(){return!!this.pubadsReady&&this.googletag.pubads().getVersion()}},{key:"updateCorrelator",value:function(){return!!this.pubadsReady&&(this.googletag.pubads().updateCorrelator(),!0)}},{key:"load",value:function(e){var t=this;return this._loadPromise||(this._loadPromise=new Promise(function(n,r){if(t.testMode)return void n(t.googletag);if(!g.canUseDOM)return void r(new Error("DOM not available"));if(!e)return void r(new Error("url is missing"));var o=function(){window.googletag?(t._googletag=window.googletag,t.googletag.cmd.push(function(){t._isLoaded=!0,n(t.googletag)})):r(new Error("window.googletag is not available"))};if(window.googletag)o();else{var i=document.createElement("script");i.async=!0,i.onload=o,i.onerror=function(){r(new Error("failed to load script"))},i.src=e,document.head.appendChild(i)}}))}},{key:"pubadsProxy",value:function(e){var t=this,n=e.method,r=e.args,o=void 0===r?[]:r,i=e.resolve,a=e.reject;return i?(this._callPubads({method:n,args:o,resolve:i,reject:a}),Promise.resolve()):(_.indexOf(n)>-1&&(this["_"+n]=o&&o.length&&o[0]||!0),new Promise(function(e,r){var i={method:n,args:o,resolve:e,reject:r};t.pubadsReady?t._callPubads(i):(t._pubadsProxyQueue||(t._pubadsProxyQueue={}),t._pubadsProxyQueue[n]||(t._pubadsProxyQueue[n]=[]),t._pubadsProxyQueue[n].push(i))}))}},{key:"googletag",get:function(){return this._googletag}},{key:"isLoaded",get:function(){return!!this._isLoaded}},{key:"isReady",get:function(){return!!this._isReady}},{key:"apiReady",get:function(){return this.googletag&&this.googletag.apiReady}},{key:"pubadsReady",get:function(){return this.googletag&&this.googletag.pubadsReady}},{key:"testMode",get:function(){return this._testMode},set:function(e){}}]),t}(f.default)},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});t.gptVersion=110,t.gptAPI=[["getVersion","function"],["cmd","object"],["getEventLog","function"],["enableServices","function"],["setAdIframeTitle","function"],["impl","object"],["pubads","function"],["defineOutOfPageSlot","function"],["defineSlot","function"],["defineUnit","function"],["destroySlots","function"],["display","function"],["companionAds","function"],["content","function"],["debug_log","object"],["service_manager_instance","object"],["disablePublisherConsole","function"],["onPubConsoleJsLoad","function"],["openConsole","function"],["sizeMapping","function"],["evalScripts","function"],["apiReady","boolean"],["slot_manager_instance","object"],["pubadsReady","boolean"]],t.pubadsVersion=110,t.pubadsAPI=[["set","function"],["get","function"],["getAttributeKeys","function"],["display","function"],["getName","function"],["setCookieOptions","function"],["setTagForChildDirectedTreatment","function"],["clearTagForChildDirectedTreatment","function"],["setKidsFriendlyAds","function"],["setTargeting","function"],["clearTargeting","function"],["getTargeting","function"],["getTargetingKeys","function"],["setCategoryExclusion","function"],["clearCategoryExclusions","function"],["disableInitialLoad","function"],["enableSingleRequest","function"],["enableAsyncRendering","function"],["enableSyncRendering","function"],["setCentering","function"],["setPublisherProvidedId","function"],["definePassback","function"],["defineOutOfPagePassback","function"],["refresh","function"],["enableVideoAds","function"],["setVideoContent","function"],["getVideoContent","function"],["getCorrelator","function"],["setCorrelator","function"],["updateCorrelator","function"],["isAdRequestFinished","function"],["collapseEmptyDivs","function"],["clear","function"],["setLocation","function"],["getVersion","function"],["forceExperiment","function"],["markAsAmp","function"],["setSafeFrameConfig","function"],["setForceSafeFrame","function"],["enableChromeInterventionSignals","function"],["markAsGladeControl","function"],["markAsGladeOptOut","function"],["getName","function"],["getVersion","function"],["getSlots","function"],["getSlotIdMap","function"],["enable","function"],["addEventListener","function"]],t.slotAPI=[["getPassbackPageUrl","function"],["set","function"],["get","function"],["getAttributeKeys","function"],["addService","function"],["getName","function"],["getAdUnitPath","function"],["getInstance","function"],["getSlotElementId","function"],["getSlotId","function"],["getServices","function"],["getSizes","function"],["defineSizeMapping","function"],["hasWrapperDiv","function"],["setClickUrl","function"],["getClickUrl","function"],["setForceSafeFrame","function"],["setCategoryExclusion","function"],["clearCategoryExclusions","function"],["getCategoryExclusions","function"],["setTargeting","function"],["clearTargeting","function"],["getTargetingMap","function"],["getTargeting","function"],["getTargetingKeys","function"],["getOutOfPage","function"],["getAudExtId","function"],["gtfcd","function"],["setCollapseEmptyDiv","function"],["getCollapseEmptyDiv","function"],["getDivStartsCollapsed","function"],["fetchStarted","function"],["getContentUrl","function"],["fetchEnded","function"],["renderStarted","function"],["getResponseInformation","function"],["renderEnded","function"],["loaded","function"],["impressionViewable","function"],["visibilityChanged","function"],["setFirstLook","function"],["getFirstLook","function"],["getEscapedQemQueryId","function"],["setSafeFrameConfig","function"],["getCsiId","function"]]},function(e,t){function n(e,t,n){return e.reduce(function(e,r){return e.props[r]=t[r],e.nextProps[r]=n[r],e},{props:{},nextProps:{}})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t){function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0],n=r(t,2),o=n[0],i=n[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!e||1!==e.nodeType)return!1;var s=e.getBoundingClientRect(),u={top:s.top,left:s.left,bottom:s.bottom,right:s.right},c={top:0,left:0,bottom:window.innerHeight,right:window.innerWidth},l=u.bottom>=c.top+i*a&&u.right>=c.left+o*a&&u.top<=c.bottom-i*a&&u.left<=c.right-o*a;return l}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.default=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){return e.reduce(function(e,t){var n=l(t,2),r=n[0],o=n[1];return"undefined"==typeof e[r]&&("function"===o?e[r]=function(){return arguments.length?arguments.length<=0?void 0:arguments[0]:{}}:"boolean"===o?e[r]=!0:e[r]={}),e},t||{})}function u(e){for(var t=e.getSizes(),n=t;Array.isArray(n[0]);)n=n[0];return n}Object.defineProperty(t,"__esModule",{value:!0}),t.ContentServiceMock=t.CompanionAdsServiceMock=t.PubAdsServiceMock=t.SizeMappingBuilderMock=t.SlotMock=t.GPTMock=void 0;var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),f=n(4),d=n(1),p=r(d),g=function(){function e(t,n,r){a(this,e),this.adUnitPath=t,this.size=n,this.divId=r,this.services=[],this.attributes={},this.categoryExclusions=[],this._targeting={}}return c(e,[{key:"defineSizeMapping",value:function(e){return this.size=e,this}},{key:"addService",value:function(e){this.services.push(e)}},{key:"getServices",value:function(){return this.services}},{key:"set",value:function(e,t){return this.attributes[e]=t,this}},{key:"get",value:function(e){return this.attributes[e]}},{key:"getAttributeKeys",value:function(){return Object.keys(this.attributes)}},{key:"setCollapseEmptyDiv",value:function(e,t){return this.collapseEmptyDiv=e,this.collapseBeforeAdFetch=t,this}},{key:"getCollapseEmptyDiv",value:function(){return this.collapseEmptyDiv}},{key:"setClickUrl",value:function(e){return this.clickUrl=e,this}},{key:"getClickUrl",value:function(){return this.clickUrl}},{key:"setCategoryExclusion",value:function(e){return this.categoryExclusions.push(e),this}},{key:"getCategoryExclusions",value:function(){return this.categoryExclusions}},{key:"clearCategoryExclusions",value:function(){return this.categoryExclusions=[],this}},{key:"setTargeting",value:function(e,t){return this._targeting[e]=t,this}},{key:"getAdUnitPath",value:function(){return this.adUnitPath}},{key:"clearTargeting",value:function(){return this._targeting={},this}},{key:"getTargeting",value:function(e){return this._targeting&&this._targeting[e]}},{key:"getTargetingKeys",value:function(){return this._targeting&&Object.keys(this._targeting)}},{key:"getSizes",value:function(){return this.size}},{key:"getSlotElementId",value:function(){return this.divId}}]),e}();s(f.slotAPI,g.prototype);var h=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),this.config=t}return c(e,[{key:"addSize",value:function(e,t){return this.mapping||(this.mapping=[]),this.mapping.push([e,t]),this}},{key:"build",value:function(){return this.mapping}}]),e}(),y=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),this.config=t,this.listeners={},this.slots={}}return c(e,[{key:"addEventListener",value:function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}},{key:"getSlots",value:function(){var e=this;return Object.keys(this.slots).map(function(t){return e.slots[t]})}}]),e}(),v=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.version=f.pubadsVersion,n}return i(t,e),c(t,[{key:"getVersion",value:function(){return this.version}},{key:"refresh",value:function(e){var t=this;e||(e=Object.keys(this.slots).map(function(e){return t.slots[e]})),setTimeout(function(){var n=p.default.SLOT_RENDER_ENDED;e.forEach(function(e){t.listeners[n]&&t.listeners[n].forEach(function(n){var r=!!t.config.emptyAd,o={isEmpty:r,creativeId:r?null:Date.now(),lineItemId:r?null:Date.now(),serviceName:"publisher_ads",size:r?null:u(e),slot:e};n(o)})})},0)}}]),t}(y);s(f.pubadsAPI,v.prototype);var b=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return i(t,e),c(t,[{key:"enableSyncLoading",value:function(){this._enableSyncLoading=!0}},{key:"setRefreshUnfilledSlots",value:function(e){"boolean"==typeof e&&(this._refreshUnfilledSlots=e)}}]),t}(y),_=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return i(t,e),c(t,[{key:"setContent",value:function(e,t){e._content=t}}]),t}(y),m=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),this.pubadsReady=!1,this.config=t,this.version=f.gptVersion,this.cmd={},this.cmd.push=function(e){e()}}return c(e,[{key:"getVersion",value:function(){return this.version}},{key:"enableServices",value:function(){var e=this;setTimeout(function(){e.pubadsReady=!0},0)}},{key:"sizeMapping",value:function(){return this.sizeMappingBuilder||(this.sizeMappingBuilder=new h(this.config)),this.sizeMappingBuilder}},{key:"pubads",value:function(){return this._pubads||(this._pubads=new v(this.config)),this._pubads}},{key:"companionAds",value:function(){return this._companionAds||(this._companionAds=new b(this.config)),this._companionAds}},{key:"content",value:function(){return this._content||(this._content=new _(this.config)),this._content}},{key:"defineSlot",value:function(e,t,n){var r=new g(e,t,n);return this.pubads().slots[n]=r,r}},{key:"defineOutOfPageSlot",value:function(e,t){var n=new g(e,[1,1],t);return this.pubads().slots[t]=n,n}},{key:"display",value:function(e){var t=this,n=this.pubads();setTimeout(function(){Object.keys(n.listeners).forEach(function(r){n.listeners[r]&&n.listeners[r].forEach(function(r){var o=n.slots[e],i=!!t.config.emptyAd,a={isEmpty:i,creativeId:i?null:Date.now(),lineItemId:i?null:Date.now(),serviceName:"publisher_ads",size:i?null:u(o),slot:o};r(a)})})},0)}}]),e}();s(f.gptAPI,m.prototype),t.GPTMock=m,t.SlotMock=g,t.SizeMappingBuilderMock=h,t.PubAdsServiceMock=v,t.CompanionAdsServiceMock=b,t.ContentServiceMock=_},function(e,t){function n(){return(new Date).getTime()}e.exports=Date.now||n},function(e,t,n){var r=n(8);e.exports=function(e,t,n){function o(){var l=r()-u;
l<t&&l>0?i=setTimeout(o,t-l):(i=null,n||(c=e.apply(s,a),i||(s=a=null)))}var i,a,s,u,c;return null==t&&(t=100),function(){s=this,a=arguments,u=r();var l=n&&!i;return i||(i=setTimeout(o,t)),l&&(c=e.apply(s,a),s=a=null),c}}},function(e,t,n){function r(e){return null===e||void 0===e}function o(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&!(e.length>0&&"number"!=typeof e[0]))}function i(e,t,n){var i,l;if(r(e)||r(t))return!1;if(e.prototype!==t.prototype)return!1;if(u(e))return!!u(t)&&(e=a.call(e),t=a.call(t),c(e,t,n));if(o(e)){if(!o(t))return!1;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}try{var f=s(e),d=s(t)}catch(e){return!1}if(f.length!=d.length)return!1;for(f.sort(),d.sort(),i=f.length-1;i>=0;i--)if(f[i]!=d[i])return!1;for(i=f.length-1;i>=0;i--)if(l=f[i],!c(e[l],t[l],n))return!1;return typeof e==typeof t}var a=Array.prototype.slice,s=n(12),u=n(11),c=e.exports=function(e,t,n){return n||(n={}),e===t||(e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():!e||!t||"object"!=typeof e&&"object"!=typeof t?n.strict?e===t:e==t:i(e,t,n))}},function(e,t){function n(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function r(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}var o="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();t=e.exports=o?n:r,t.supported=n,t.unsupported=r},function(e,t){function n(e){var t=[];for(var n in e)t.push(n);return t}t=e.exports="function"==typeof Object.keys?Object.keys:n,t.shim=n},function(e,t,n){"use strict";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(){this._events=new r,this._eventsCount=0}var a=Object.prototype.hasOwnProperty,s="~";Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(s=!1)),i.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)a.call(e,t)&&n.push(s?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},i.prototype.listeners=function(e,t){var n=s?s+e:e,r=this._events[n];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o<i;o++)a[o]=r[o].fn;return a},i.prototype.emit=function(e,t,n,r,o,i){var a=s?s+e:e;if(!this._events[a])return!1;var u,c,l=this._events[a],f=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,r),!0;case 5:return l.fn.call(l.context,t,n,r,o),!0;case 6:return l.fn.call(l.context,t,n,r,o,i),!0}for(c=1,u=new Array(f-1);c<f;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var d,p=l.length;for(c=0;c<p;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),f){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,r);break;default:if(!u)for(d=1,u=new Array(f-1);d<f;d++)u[d-1]=arguments[d];l[c].fn.apply(l[c].context,u)}}return!0},i.prototype.on=function(e,t,n){var r=new o(t,n||this),i=s?s+e:e;return this._events[i]?this._events[i].fn?this._events[i]=[this._events[i],r]:this._events[i].push(r):(this._events[i]=r,this._eventsCount++),this},i.prototype.once=function(e,t,n){var r=new o(t,n||this,!0),i=s?s+e:e;return this._events[i]?this._events[i].fn?this._events[i]=[this._events[i],r]:this._events[i].push(r):(this._events[i]=r,this._eventsCount++),this},i.prototype.removeListener=function(e,t,n,o){var i=s?s+e:e;if(!this._events[i])return this;if(!t)return 0===--this._eventsCount?this._events=new r:delete this._events[i],this;var a=this._events[i];if(a.fn)a.fn!==t||o&&!a.once||n&&a.context!==n||(0===--this._eventsCount?this._events=new r:delete this._events[i]);else{for(var u=0,c=[],l=a.length;u<l;u++)(a[u].fn!==t||o&&!a[u].once||n&&a[u].context!==n)&&c.push(a[u]);c.length?this._events[i]=1===c.length?c[0]:c:0===--this._eventsCount?this._events=new r:delete this._events[i]}return this},i.prototype.removeAllListeners=function(e){var t;return e?(t=s?s+e:e,this._events[t]&&(0===--this._eventsCount?this._events=new r:delete this._events[t])):(this._events=new r,this._eventsCount=0),this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prototype.setMaxListeners=function(){return this},i.prefixed=s,i.EventEmitter=i,e.exports=i},function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,i,a,s,u){if(o(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,i,a,s,u],f=0;c=new Error(t.replace(/%s/g,function(){return l[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var o=function(e){};e.exports=r},function(e,t){"use strict";var n={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},o="function"==typeof Object.getOwnPropertySymbols;e.exports=function(e,t,i){if("string"!=typeof t){var a=Object.getOwnPropertyNames(t);o&&(a=a.concat(Object.getOwnPropertySymbols(t)));for(var s=0;s<a.length;++s)if(!(n[a[s]]||r[a[s]]||i&&i[a[s]]))try{e[a[s]]=t[a[s]]}catch(e){}}return e}},function(t,n){t.exports=e},function(e,n){e.exports=t}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactGPT=t(require("react"),require("react-dom")):e.ReactGPT=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(3);Object.defineProperty(t,"Bling",{enumerable:!0,get:function(){return r(o).default}});var a=n(1);Object.defineProperty(t,"Events",{enumerable:!0,get:function(){return r(a).default}})},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n={READY:"ready",RENDER:"render",SLOT_RENDER_ENDED:"slotRenderEnded",IMPRESSION_VIEWABLE:"impressionViewable",SLOT_VISIBILITY_CHANGED:"slotVisibilityChanged"};t.default=n},function(e,t,n){"use strict";function r(e,t,n,r,a,i,s,u){if(o(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,a,i,s,u],d=0;l=new Error(t.replace(/%s/g,function(){return c[d++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var o=function(e){};e.exports=r},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u,l,c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),p=n(18),g=r(p),h=n(16),y=r(h),v=n(19),_=r(v),b=n(2),m=r(b),w=n(8),S=r(w),M=n(14),P=r(M),E=n(1),O=r(E),k=n(5),x=r(k),C=n(4),R=(l=u=function(e){function t(){var e,n,r,o;a(this,t);for(var s=arguments.length,u=Array(s),l=0;l<s;l++)u[l]=arguments[l];return n=r=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.state={scriptLoaded:!1,inViewport:!1},o=n,i(r,o)}return s(t,e),f(t,[{key:"componentDidMount",value:function(){t._adManager.addInstance(this),t._adManager.load(t._config.seedFileUrl).then(this.onScriptLoaded.bind(this)).catch(this.onScriptError.bind(this))}},{key:"componentWillReceiveProps",value:function(e){var n=t._config.propsEqual,r=this.props.sizeMapping;!e.sizeMapping&&!r||n(e.sizeMapping,r)||t._adManager.removeMQListener(this,e)}},{key:"shouldComponentUpdate",value:function(e,n){var r=n.scriptLoaded,o=n.inViewport,a=this.notInViewport(e,n),i=this.state.inViewport!==o,s=this.state.scriptLoaded!==r;if(a)return!1;if(i)return!0;var u=t._config,l=u.filterProps,c=u.propsEqual,d=l(t.refreshableProps,this.props,e),f=l(t.reRenderProps,this.props,e),p=!c(f.props,f.nextProps),g=!p&&!c(d.props,d.nextProps);if(g&&this.configureSlot(this._adSlot,e),t._adManager._syncCorrelator)g?t._adManager.refresh():(p||s)&&t._adManager.renderAll();else{if(g)return this.refresh(),!1;if(p||s)return!0}return!1}},{key:"componentDidUpdate",value:function(){this.notInViewport(this.props,this.state)||this._divId&&(t._adManager._initialRender?t._adManager.render():this.renderAd())}},{key:"componentWillUnmount",value:function(){t._adManager.removeInstance(this),this._adSlot&&(t._adManager.googletag.destroySlots([this._adSlot]),this._adSlot=null)}},{key:"onScriptLoaded",value:function e(){var e=this.props.onScriptLoaded;this.getRenderWhenViewable()&&this.foldCheck(),this.setState({scriptLoaded:!0},e)}},{key:"onScriptError",value:function(e){console.warn("Ad: Failed to load gpt for "+t._config.seedFileUrl,e)}},{key:"getRenderWhenViewable",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return void 0!==e.renderWhenViewable?e.renderWhenViewable:t._config.renderWhenViewable}},{key:"foldCheck",value:function(){if(!this.state.inViewport){var e=this.getSlotSize();Array.isArray(e)&&Array.isArray(e[0])&&(e=e[0]),"fluid"===e&&(e=[0,0]);var n=t._adManager.isInViewport(_.default.findDOMNode(this),e,this.viewableThreshold);n&&this.setState({inViewport:!0})}}},{key:"defineSizeMapping",value:function(e,n){if(n){t._adManager.addMQListener(this,this.props);var r=n.reduce(function(e,t){return e.addSize(t.viewport,t.slot)},t._adManager.googletag.sizeMapping()).build();e.defineSizeMapping(r)}}},{key:"setAttributes",value:function(e,t){var n=e.getAttributeKeys();n.forEach(function(t){e.set(t,null)}),t&&Object.keys(t).forEach(function(n){e.set(n,t[n])})}},{key:"setTargeting",value:function(e,t){e.clearTargeting(),t&&Object.keys(t).forEach(function(n){e.setTargeting(n,t[n])})}},{key:"addCompanionAdService",value:function(e,n){var r=t._adManager.googletag.companionAds();n.addService(r),"object"===("undefined"==typeof e?"undefined":d(e))&&(e.hasOwnProperty("enableSyncLoading")&&r.enableSyncLoading(),e.hasOwnProperty("refreshUnfilledSlots")&&r.setRefreshUnfilledSlots(e.refreshUnfilledSlots))}},{key:"getSlotSize",value:function(){var e=this.props,t=e.slotSize,n=e.sizeMapping,r=void 0;if(t)r=t;else if(n){var o=n;r=o[0]&&o[0].slot}return r}},{key:"renderAd",value:function(){this.defineSlot(),this.display()}},{key:"notInViewport",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,n=t.inViewport;return this.getRenderWhenViewable(e)&&!n}},{key:"defineSlot",value:function(){var e=this.props,n=e.adUnitPath,r=e.outOfPage,o=this._divId,a=this.getSlotSize();this._adSlot||(r?this._adSlot=t._adManager.googletag.defineOutOfPageSlot(n,o):this._adSlot=t._adManager.googletag.defineSlot(n,a||[],o)),this.configureSlot(this._adSlot)}},{key:"configureSlot",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props,r=n.sizeMapping,a=n.attributes,i=n.targeting,s=n.companionAdService,u=n.categoryExclusion,l=n.collapseEmptyDiv,c=n.safeFrameConfig,d=n.content,f=n.clickUrl,p=n.forceSafeFrame;if(this.defineSizeMapping(e,r),void 0!==l)if(Array.isArray(l)){var g;(g=e.setCollapseEmptyDiv).call.apply(g,[e].concat(o(l)))}else e.setCollapseEmptyDiv(l);if(f&&e.setClickUrl(f),u){var h=u;"string"==typeof h&&(h=[h]),e.clearCategoryExclusions(),h.forEach(function(t){e.setCategoryExclusion(t)})}this.setAttributes(e,a),this.setTargeting(e,i),c&&e.setSafeFrameConfig(c),p&&e.setForceSafeFrame(p),s&&this.addCompanionAdService(s,e),d?e.addService(t._adManager.googletag.content()):e.addService(t._adManager.googletag.pubads())}},{key:"display",value:function(){var e=this.props.content,n=this._divId,r=this._adSlot;e?t._adManager.googletag.content().setContent(r,e):(t._adManager._disableInitialLoad||t._adManager._syncCorrelator||t._adManager.updateCorrelator(),t._adManager.googletag.display(n),t._adManager._disableInitialLoad&&!t._adManager._initialRender&&this.refresh())}},{key:"clear",value:function(){var e=this._adSlot;if(e&&e.hasOwnProperty("getServices")){var n=e.getServices();if(this._divId&&n.some(function(e){return!!e.setContent}))return void(document.getElementById(this._divId).innerHTML="");t._adManager.clear([e])}}},{key:"refresh",value:function(e){var n=this._adSlot;n&&(this.clear(),t._adManager.refresh([n],e))}},{key:"render",value:function(){var e=this.state.scriptLoaded,n=this.props,r=n.id,o=n.outOfPage,a=n.style,i=this.notInViewport(this.props,this.state);if(!e||i){var s=this.getSlotSize();o||(0,m.default)(s,"Either 'slotSize' or 'sizeMapping' prop needs to be set."),Array.isArray(s)&&Array.isArray(s[0])&&(s=s[0]),"fluid"===s&&(s=["auto","auto"]);var u=s&&{width:s[0],height:s[1]};return g.default.createElement("div",{style:u})}return this.clear(),this._adSlot&&(t._adManager.googletag.destroySlots([this._adSlot]),this._adSlot=null),this._divId=r||t._adManager.generateDivId(),g.default.createElement("div",{id:this._divId,style:a})}},{key:"adSlot",get:function(){return this._adSlot}},{key:"viewableThreshold",get:function(){return this.props.viewableThreshold>=0?this.props.viewableThreshold:t._config.viewableThreshold}}],[{key:"on",value:function(e,n){t._on("on",e,n)}},{key:"once",value:function(e,n){t._on("once",e,n)}},{key:"removeListener",value:function(){var e;(e=t._adManager).removeListener.apply(e,arguments)}},{key:"removeAllListeners",value:function(){var e;(e=t._adManager).removeAllListeners.apply(e,arguments)}},{key:"_on",value:function(e,n,r){"function"==typeof r&&(n===O.default.READY&&t._adManager.isReady?r.call(t._adManager,t._adManager.googletag):t._adManager[e](n,r))}},{key:"configure",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t._config=c({},t._config,e)}},{key:"getGPTVersion",value:function(){return t._adManager.getGPTVersion()}},{key:"getPubadsVersion",value:function(){return t._adManager.getPubadsVersion()}},{key:"syncCorrelator",value:function(e){t._adManager.syncCorrelator(e)}},{key:"render",value:function(){t._adManager.renderAll()}},{key:"refresh",value:function(e,n){t._adManager.refresh(e,n)}},{key:"clear",value:function(e){t._adManager.clear(e)}},{key:"updateCorrelator",value:function(){t._adManager.updateCorrelator()}},{key:"testManager",set:function(e){(0,m.default)(e,"Pass in createManagerTest to mock GPT"),t._adManager=e}}]),t}(p.Component),u.propTypes={id:y.default.string,adUnitPath:y.default.string.isRequired,targeting:y.default.object,slotSize:y.default.oneOfType([y.default.array,y.default.string]),sizeMapping:y.default.arrayOf(y.default.shape({viewport:y.default.array,slot:y.default.array})),outOfPage:y.default.bool,companionAdService:y.default.oneOfType([y.default.bool,y.default.object]),content:y.default.string,clickUrl:y.default.string,categoryExclusion:y.default.oneOfType([y.default.string,y.default.array]),attributes:y.default.object,collapseEmptyDiv:y.default.oneOfType([y.default.bool,y.default.array]),forceSafeFrame:y.default.bool,safeFrameConfig:y.default.object,onSlotRenderEnded:y.default.func,onImpressionViewable:y.default.func,onSlotVisibilityChanged:y.default.func,renderWhenViewable:y.default.bool,viewableThreshold:y.default.number,onScriptLoaded:y.default.func,onMediaQueryChange:y.default.func,style:y.default.object},u.refreshableProps=["targeting","sizeMapping","clickUrl","categoryExclusion","attributes","collapseEmptyDiv","companionAdService","forceSafeFrame","safeFrameConfig"],u.reRenderProps=["adUnitPath","slotSize","outOfPage","content"],u._adManager=(0,C.createManager)(),u._config={seedFileUrl:"//www.googletagservices.com/tag/js/gpt.js",renderWhenViewable:!0,viewableThreshold:.5,filterProps:x.default,propsEqual:S.default},l);t.default=(0,P.default)(R,C.pubadsAPI.reduce(function(e,t){return e[t]=function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return R._adManager.pubadsProxy({method:t,args:n})},e},{}))},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return new w(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.AdManager=t.APIToCallBeforeServiceEnabled=t.pubadsAPI=void 0;var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.createManager=u;var c=n(11),d=r(c),f=n(7),p=r(f),g=n(2),h=(r(g),n(12)),y=n(1),v=r(y),_=n(6),b=r(_),m=(t.pubadsAPI=["enableAsyncRendering","enableSingleRequest","enableSyncRendering","disableInitialLoad","collapseEmptyDivs","enableVideoAds","set","get","getAttributeKeys","setTargeting","clearTargeting","setCategoryExclusion","clearCategoryExclusions","setCentering","setCookieOptions","setLocation","setPublisherProvidedId","setTagForChildDirectedTreatment","clearTagForChildDirectedTreatment","setVideoContent","setForceSafeFrame"],t.APIToCallBeforeServiceEnabled=["enableAsyncRendering","enableSingleRequest","enableSyncRendering","disableInitialLoad","collapseEmptyDivs","setCentering"]),w=t.AdManager=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n._adCnt=0,n._initialRender=!0,n._syncCorrelator=!1,n._testMode=!1,n._foldCheck=(0,p.default)(function(e){var t=n.getMountedInstances();t.forEach(function(t){t.getRenderWhenViewable()&&t.foldCheck(e)})},66),n._handleMediaQueryChange=function(e){if(n._syncCorrelator)return void n.refresh();var t=/min-width:\s?(\d+)px/.exec(e.media),r=t&&t[1];r&&n._mqls[r]&&n._mqls[r].listeners.forEach(function(t){t.refresh(),t.props.onMediaQueryChange&&t.props.onMediaQueryChange(e)})},n.render=(0,p.default)(function(){if(n._initialRender){var e=function e(t){n.pubadsReady?t():setTimeout(e,50,t)},t=n.getMountedInstances(),r=!1,o=void 0;t.forEach(function(e){if(!e.notInViewport()){e.defineSlot();var t=e.adSlot;if(t&&t.hasOwnProperty("getServices")){var n=t.getServices();r||(r=n.filter(function(e){return!!e.enableAsyncRendering}).length>0)}}}),r||(o=n.googletag.defineSlot("/",[]),o.addService(n.googletag.pubads())),n._processPubadsQueue(),n.googletag.enableServices(),e(function(){o&&n.googletag.destroySlots([o]),n._processPubadsQueue(),n._listen(),n._isReady=!0,n.emit(v.default.READY,n.googletag),t.forEach(function(e){e.notInViewport()||e.display()}),n.emit(v.default.RENDER,n.googletag),n._initialRender=!1})}},4),n.renderAll=(0,p.default)(function(){if(!n.apiReady)return!1;var e=n.getMountedInstances();return e.forEach(function(e,t){0===t&&n.updateCorrelator(),e.forceUpdate()}),!0},4),e.test&&(n.testMode=e),n}return s(t,e),l(t,[{key:"_processPubadsQueue",value:function(){var e=this;this._pubadsProxyQueue&&(Object.keys(this._pubadsProxyQueue).forEach(function(t){(e.googletag&&!e.googletag.pubadsReady&&m.indexOf(t)>-1||e.pubadsReady)&&(e._pubadsProxyQueue[t].forEach(function(t){return e.pubadsProxy(t)}),delete e._pubadsProxyQueue[t])}),Object.keys(this._pubadsProxyQueue).length||(this._pubadsProxyQueue=null))}},{key:"_callPubads",value:function(e){var t=e.method,n=e.args,r=e.resolve,a=e.reject;if("function"!=typeof this.googletag.pubads()[t])a(new Error("googletag.pubads does not support "+t+", please update pubadsAPI"));else try{var i,s=(i=this.googletag.pubads())[t].apply(i,o(n));r(s)}catch(e){a(e)}}},{key:"_toggleListener",value:function(e){var t=this;["scroll","resize"].forEach(function(n){window[e?"addEventListener":"removeEventListener"](n,t._foldCheck)})}},{key:"_listen",value:function(){var e=this;this._listening||([v.default.SLOT_RENDER_ENDED,v.default.IMPRESSION_VIEWABLE,v.default.SLOT_VISIBILITY_CHANGED].forEach(function(t){["pubads","content","companionAds"].forEach(function(n){e.googletag[n]().addEventListener(t,e._onEvent.bind(e,t))})}),this._listening=!0)}},{key:"_onEvent",value:function(e,t){this.listeners(e,!0)&&this.emit(e,t);var n=this.getMountedInstances(),r=t.slot,o="on"+e.charAt(0).toUpperCase()+e.substr(1),a=n.filter(function(e){return r===e.adSlot})[0];a&&a.props[o]&&a.props[o](t)}},{key:"syncCorrelator",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._syncCorrelator=e}},{key:"generateDivId",value:function(){return"bling-"+ ++this._adCnt}},{key:"getMountedInstances",value:function(){return this.mountedInstances||(this.mountedInstances=[]),this.mountedInstances}},{key:"addInstance",value:function(e){var t=this.getMountedInstances(),n=t.indexOf(e);n===-1&&(0===t.length&&this._toggleListener(!0),this.addMQListener(e,e.props),t.push(e))}},{key:"removeInstance",value:function(e){var t=this.getMountedInstances(),n=t.indexOf(e);n>=0&&(t.splice(n,1),0===t.length&&this._toggleListener(!1),this.removeMQListener(e,e.props))}},{key:"addMQListener",value:function(e,t){var n=this,r=t.sizeMapping;r&&Array.isArray(r)&&r.forEach(function(t){var r=t.viewport&&t.viewport[0];if(void 0!==r){if(n._mqls||(n._mqls={}),!n._mqls[r]){var o=window.matchMedia("(min-width: "+r+"px)");o.addListener(n._handleMediaQueryChange),n._mqls[r]={mql:o,listeners:[]}}n._mqls[r].listeners.indexOf(e)===-1&&n._mqls[r].listeners.push(e)}})}},{key:"removeMQListener",value:function(e){var t=this;this._mqls&&Object.keys(this._mqls).forEach(function(n){var r=t._mqls[n].listeners.indexOf(e);r>-1&&t._mqls[n].listeners.splice(r,1),0===t._mqls[n].listeners.length&&(t._mqls[n].mql.removeListener(t._handleMediaQueryChange),delete t._mqls[n])})}},{key:"isInViewport",value:function(){return b.default.apply(void 0,arguments)}},{key:"refresh",value:function(e,t){return!!this.pubadsReady&&(this.googletag.pubads().refresh(e,t),!0)}},{key:"clear",value:function(e){return!!this.pubadsReady&&(this.googletag.pubads().clear(e),!0)}},{key:"getGPTVersion",value:function(){return!!this.apiReady&&this.googletag.getVersion()}},{key:"getPubadsVersion",value:function(){return!!this.pubadsReady&&this.googletag.pubads().getVersion()}},{key:"updateCorrelator",value:function(){return!!this.pubadsReady&&(this.googletag.pubads().updateCorrelator(),!0)}},{key:"load",value:function(e){var t=this;return this._loadPromise||(this._loadPromise=new Promise(function(n,r){if(t.testMode)return void n(t.googletag);if(!h.canUseDOM)return void r(new Error("DOM not available"));if(!e)return void r(new Error("url is missing"));var o=function(){window.googletag?(t._googletag=window.googletag,t.googletag.cmd.push(function(){t._isLoaded=!0,n(t.googletag)})):r(new Error("window.googletag is not available"))};if(window.googletag&&window.googletag.apiReady)o();else{var a=document.createElement("script");a.async=!0,a.onload=o,a.onerror=function(){r(new Error("failed to load script"))},a.src=e,document.head.appendChild(a)}}))}},{key:"pubadsProxy",value:function(e){var t=this,n=e.method,r=e.args,o=void 0===r?[]:r,a=e.resolve,i=e.reject;return a?(this._callPubads({method:n,args:o,resolve:a,reject:i}),Promise.resolve()):(m.indexOf(n)>-1&&(this["_"+n]=o&&o.length&&o[0]||!0),new Promise(function(e,r){var a={method:n,args:o,resolve:e,reject:r};t.pubadsReady?t._callPubads(a):(t._pubadsProxyQueue||(t._pubadsProxyQueue={}),t._pubadsProxyQueue[n]||(t._pubadsProxyQueue[n]=[]),t._pubadsProxyQueue[n].push(a))}))}},{key:"googletag",get:function(){return this._googletag}},{key:"isLoaded",get:function(){return!!this._isLoaded}},{key:"isReady",get:function(){return!!this._isReady}},{key:"apiReady",get:function(){return this.googletag&&this.googletag.apiReady}},{key:"pubadsReady",get:function(){return this.googletag&&this.googletag.pubadsReady}},{key:"testMode",get:function(){return this._testMode},set:function(e){return}}]),t}(d.default)},function(e,t){function n(e,t,n){return e.reduce(function(e,r){return e.props[r]=t[r],e.nextProps[r]=n[r],e},{props:{},nextProps:{}})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t){function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0],n=r(t,2),o=n[0],a=n[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!e||1!==e.nodeType)return!1;var s=e.getBoundingClientRect(),u={top:s.top,left:s.left,bottom:s.bottom,right:s.right},l={top:0,left:0,bottom:window.innerHeight,right:window.innerWidth},c=u.bottom>=l.top+a*i&&u.right>=l.left+o*i&&u.top<=l.bottom-a*i&&u.left<=l.right-o*i;return c}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){var n=[],r=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(r=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.default=n},function(e,t){e.exports=function(e,t,n){function r(){var l=Date.now()-s;l<t&&l>=0?o=setTimeout(r,t-l):(o=null,n||(u=e.apply(i,a),i=a=null))}var o,a,i,s,u;null==t&&(t=100);var l=function(){i=this,a=arguments,s=Date.now();var l=n&&!o;return o||(o=setTimeout(r,t)),l&&(u=e.apply(i,a),i=a=null),u};return l.clear=function(){o&&(clearTimeout(o),o=null)},l}},function(e,t,n){function r(e){return null===e||void 0===e}function o(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&!(e.length>0&&"number"!=typeof e[0]))}function a(e,t,n){var a,c;if(r(e)||r(t))return!1;if(e.prototype!==t.prototype)return!1;if(u(e))return!!u(t)&&(e=i.call(e),t=i.call(t),l(e,t,n));if(o(e)){if(!o(t))return!1;if(e.length!==t.length)return!1;for(a=0;a<e.length;a++)if(e[a]!==t[a])return!1;return!0}try{var d=s(e),f=s(t)}catch(e){return!1}if(d.length!=f.length)return!1;for(d.sort(),f.sort(),a=d.length-1;a>=0;a--)if(d[a]!=f[a])return!1;for(a=d.length-1;a>=0;a--)if(c=d[a],!l(e[c],t[c],n))return!1;return typeof e==typeof t}var i=Array.prototype.slice,s=n(10),u=n(9),l=e.exports=function(e,t,n){return n||(n={}),e===t||(e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():!e||!t||"object"!=typeof e&&"object"!=typeof t?n.strict?e===t:e==t:a(e,t,n))}},function(e,t){function n(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function r(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}var o="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();t=e.exports=o?n:r,t.supported=n,t.unsupported=r},function(e,t){function n(e){var t=[];for(var n in e)t.push(n);return t}t=e.exports="function"==typeof Object.keys?Object.keys:n,t.shim=n},function(e,t,n){"use strict";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(){this._events=new r,this._eventsCount=0}var i=Object.prototype.hasOwnProperty,s="~";Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(s=!1)),a.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)i.call(e,t)&&n.push(s?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},a.prototype.listeners=function(e,t){var n=s?s+e:e,r=this._events[n];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var o=0,a=r.length,i=new Array(a);o<a;o++)i[o]=r[o].fn;return i},a.prototype.emit=function(e,t,n,r,o,a){var i=s?s+e:e;if(!this._events[i])return!1;var u,l,c=this._events[i],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,o),!0;case 6:return c.fn.call(c.context,t,n,r,o,a),!0}for(l=1,u=new Array(d-1);l<d;l++)u[l-1]=arguments[l];c.fn.apply(c.context,u)}else{var f,p=c.length;for(l=0;l<p;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),d){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,n);break;case 4:c[l].fn.call(c[l].context,t,n,r);break;default:if(!u)for(f=1,u=new Array(d-1);f<d;f++)u[f-1]=arguments[f];c[l].fn.apply(c[l].context,u)}}return!0},a.prototype.on=function(e,t,n){var r=new o(t,n||this),a=s?s+e:e;return this._events[a]?this._events[a].fn?this._events[a]=[this._events[a],r]:this._events[a].push(r):(this._events[a]=r,this._eventsCount++),this},a.prototype.once=function(e,t,n){var r=new o(t,n||this,!0),a=s?s+e:e;return this._events[a]?this._events[a].fn?this._events[a]=[this._events[a],r]:this._events[a].push(r):(this._events[a]=r,this._eventsCount++),this},a.prototype.removeListener=function(e,t,n,o){var a=s?s+e:e;if(!this._events[a])return this;if(!t)return 0===--this._eventsCount?this._events=new r:delete this._events[a],this;var i=this._events[a];if(i.fn)i.fn!==t||o&&!i.once||n&&i.context!==n||(0===--this._eventsCount?this._events=new r:delete this._events[a]);else{for(var u=0,l=[],c=i.length;u<c;u++)(i[u].fn!==t||o&&!i[u].once||n&&i[u].context!==n)&&l.push(i[u]);l.length?this._events[a]=1===l.length?l[0]:l:0===--this._eventsCount?this._events=new r:delete this._events[a]}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=s?s+e:e,this._events[t]&&(0===--this._eventsCount?this._events=new r:delete this._events[t])):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prototype.setMaxListeners=function(){return this},a.prefixed=s,a.EventEmitter=a,e.exports=a},function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=r},function(e,t){"use strict";function n(e){return function(){return e}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t){"use strict";var n={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},o="function"==typeof Object.getOwnPropertySymbols;e.exports=function(e,t,a){if("string"!=typeof t){var i=Object.getOwnPropertyNames(t);o&&(i=i.concat(Object.getOwnPropertySymbols(t)));for(var s=0;s<i.length;++s)if(!(n[i[s]]||r[i[s]]||a&&a[i[s]]))try{e[i[s]]=t[i[s]]}catch(e){}}return e}},function(e,t,n){"use strict";var r=n(13),o=n(2),a=n(17);e.exports=function(){function e(e,t,n,r,i,s){s!==a&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){e.exports=n(15)()},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(t,n){t.exports=e},function(e,n){e.exports=t}])});

@@ -18,2 +18,6 @@ Object.defineProperty(exports, "__esModule", {

var _propTypes = require("prop-types");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactDom = require("react-dom");

@@ -652,5 +656,6 @@

}, {
key: "createTestManager",
value: function createTestManager() {
Bling._adManager = (0, _createManager.createManager)({ test: true });
key: "testManager",
set: function set(testManager) {
(0, _invariant2.default)(testManager, "Pass in createManagerTest to mock GPT");
Bling._adManager = testManager;
}

@@ -666,3 +671,3 @@ }]);

*/
id: _react.PropTypes.string,
id: _propTypes2.default.string,
/**

@@ -674,3 +679,3 @@ * An optional string indicating ad unit path which will be used

*/
adUnitPath: _react.PropTypes.string.isRequired,
adUnitPath: _propTypes2.default.string.isRequired,
/**

@@ -681,3 +686,3 @@ * An optional object which includes ad targeting key-value pairs.

*/
targeting: _react.PropTypes.object,
targeting: _propTypes2.default.object,
/**

@@ -689,3 +694,3 @@ * An optional prop to specify the ad slot size which accepts [googletag.GeneralSize](https://developers.google.com/doubleclick-gpt/reference#googletag.GeneralSize) as a type.

*/
slotSize: _react.PropTypes.oneOfType([_react.PropTypes.array, _react.PropTypes.string]),
slotSize: _propTypes2.default.oneOfType([_propTypes2.default.array, _propTypes2.default.string]),
/**

@@ -708,5 +713,5 @@ * An optional array of object which contains an array of viewport size and slot size.

*/
sizeMapping: _react.PropTypes.arrayOf(_react.PropTypes.shape({
viewport: _react.PropTypes.array,
slot: _react.PropTypes.array
sizeMapping: _propTypes2.default.arrayOf(_propTypes2.default.shape({
viewport: _propTypes2.default.array,
slot: _propTypes2.default.array
})),

@@ -718,3 +723,3 @@ /**

*/
outOfPage: _react.PropTypes.bool,
outOfPage: _propTypes2.default.bool,
/**

@@ -726,3 +731,3 @@ * An optional flag to indicate whether companion ad service should be enabled for the ad.

*/
companionAdService: _react.PropTypes.oneOfType([_react.PropTypes.bool, _react.PropTypes.object]),
companionAdService: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.object]),
/**

@@ -733,3 +738,3 @@ * An optional HTML content for the slot. If specified, the ad will render with the HTML content using content service.

*/
content: _react.PropTypes.string,
content: _propTypes2.default.string,
/**

@@ -740,3 +745,3 @@ * An optional click through URL. If specified, any landing page URL associated with the creative that is served is overridden.

*/
clickUrl: _react.PropTypes.string,
clickUrl: _propTypes2.default.string,
/**

@@ -747,3 +752,3 @@ * An optional string or an array of string which specifies a page-level ad category exclusion for the given label name.

*/
categoryExclusion: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.array]),
categoryExclusion: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.array]),
/**

@@ -755,3 +760,3 @@ * An optional map of key-value pairs for an AdSense attribute on a particular ad slot.

*/
attributes: _react.PropTypes.object,
attributes: _propTypes2.default.object,
/**

@@ -762,3 +767,3 @@ * An optional flag to indicate whether an empty ad should be collapsed or not.

*/
collapseEmptyDiv: _react.PropTypes.oneOfType([_react.PropTypes.bool, _react.PropTypes.array]),
collapseEmptyDiv: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.array]),
/**

@@ -769,3 +774,3 @@ * An optional flag to indicate whether ads in this slot should be forced to be rendered using a SafeFrame container.

*/
forceSafeFrame: _react.PropTypes.bool,
forceSafeFrame: _propTypes2.default.bool,
/**

@@ -776,3 +781,3 @@ * An optional object to set the slot-level preferences for SafeFrame configuration.

*/
safeFrameConfig: _react.PropTypes.object,
safeFrameConfig: _propTypes2.default.object,
/**

@@ -783,3 +788,3 @@ * An optional event handler function for `googletag.events.SlotRenderEndedEvent`.

*/
onSlotRenderEnded: _react.PropTypes.func,
onSlotRenderEnded: _propTypes2.default.func,
/**

@@ -790,3 +795,3 @@ * An optional event handler function for `googletag.events.ImpressionViewableEvent`.

*/
onImpressionViewable: _react.PropTypes.func,
onImpressionViewable: _propTypes2.default.func,
/**

@@ -797,3 +802,3 @@ * An optional event handler function for `googletag.events.slotVisibilityChangedEvent`.

*/
onSlotVisibilityChanged: _react.PropTypes.func,
onSlotVisibilityChanged: _propTypes2.default.func,
/**

@@ -804,3 +809,3 @@ * An optional flag to indicate whether an ad should only render when it's fully in the viewport area.

*/
renderWhenViewable: _react.PropTypes.bool,
renderWhenViewable: _propTypes2.default.bool,
/**

@@ -812,3 +817,3 @@ * An optional number to indicate how much percentage of an ad area needs to be in a viewable area before rendering.

*/
viewableThreshold: _react.PropTypes.number,
viewableThreshold: _propTypes2.default.number,
/**

@@ -819,3 +824,3 @@ * An optional call back function to notify when the script is loaded.

*/
onScriptLoaded: _react.PropTypes.func,
onScriptLoaded: _propTypes2.default.func,
/**

@@ -826,3 +831,3 @@ * An optional call back function to notify when the media queries on the document change.

*/
onMediaQueryChange: _react.PropTypes.func,
onMediaQueryChange: _propTypes2.default.func,
/**

@@ -833,4 +838,3 @@ * An optional object to be applied as `style` props to the container div.

*/
style: _react.PropTypes.object
}, _class.refreshableProps = ["targeting", "sizeMapping", "clickUrl", "categoryExclusion", "attributes", "collapseEmptyDiv", "companionAdService", "forceSafeFrame", "safeFrameConfig"], _class.reRenderProps = ["adUnitPath", "slotSize", "outOfPage", "content"], _class._adManager = (0, _createManager.createManager)(), _class._config = {
style: _propTypes2.default.object }, _class.refreshableProps = ["targeting", "sizeMapping", "clickUrl", "categoryExclusion", "attributes", "collapseEmptyDiv", "companionAdService", "forceSafeFrame", "safeFrameConfig"], _class.reRenderProps = ["adUnitPath", "slotSize", "outOfPage", "content"], _class._adManager = (0, _createManager.createManager)(), _class._config = {
/**

@@ -837,0 +841,0 @@ * An optional string for GPT seed file url to override.

@@ -18,2 +18,6 @@ Object.defineProperty(exports, "__esModule", {

var _invariant = require("fbjs/lib/invariant");
var _invariant2 = _interopRequireDefault(_invariant);
var _ExecutionEnvironment = require("fbjs/lib/ExecutionEnvironment");

@@ -29,4 +33,2 @@

var _mockGPT = require("./utils/mockGPT");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -179,3 +181,3 @@

if (config.test) {
_this.testMode = config.test;
_this.testMode = config;
}

@@ -470,3 +472,3 @@ return _this;

};
if (window.googletag) {
if (window.googletag && window.googletag.apiReady) {
onLoad();

@@ -556,5 +558,12 @@ } else {

}
this._googletag = new _mockGPT.GPTMock(config);
var test = config.test,
GPTMock = config.GPTMock;
this._isLoaded = true;
this._testMode = !!config;
this._testMode = !!test;
if (test) {
(0, _invariant2.default)(test && GPTMock, "Must provide GPTMock to enable testMode. config{GPTMock}");
this._googletag = new GPTMock(config);
}
}

@@ -561,0 +570,0 @@ }]);

{
"name": "react-gpt",
"version": "0.2.4",
"version": "0.2.5",
"description": "A react display ad component using Google Publisher Tag",

@@ -78,2 +78,3 @@ "main": "lib/index.js",

"phantom": "^2.0.4",
"prop-types": "^15.5.10",
"querystring": "^0.2.0",

@@ -80,0 +81,0 @@ "radium": "^0.18.1",

@@ -33,3 +33,3 @@ <img align="right" height="200" src="http://static.nfl.com/static/content/public/static/img/logos/nfl-engineering-light.svg" />

```
$ npm install --save react-gpt
$ yarn react-gpt
```

@@ -124,3 +124,3 @@

1. Clone this repo
2. Run `npm install`
2. Run `yarn`
3. Run `npm run examples` for client side rendering, `npm start` for server side rendering.

@@ -127,0 +127,0 @@ 4. Point your browser to http://localhost:8080

/* eslint-disable react/sort-comp */
import React, {Component, PropTypes} from "react";
import React, {Component} from "react";
import PropTypes from "prop-types";
import ReactDOM from "react-dom";

@@ -359,4 +360,5 @@ import invariant from "fbjs/lib/invariant";

static createTestManager() {
Bling._adManager = createManager({test: true});
static set testManager(testManager) {
invariant(testManager, "Pass in createManagerTest to mock GPT");
Bling._adManager = testManager;
}

@@ -363,0 +365,0 @@

import EventEmitter from "eventemitter3";
import debounce from "debounce";
import invariant from "fbjs/lib/invariant";
import {canUseDOM} from "fbjs/lib/ExecutionEnvironment";
import Events from "./Events";
import isInViewport from "./utils/isInViewport";
import {GPTMock} from "./utils/mockGPT";

@@ -47,3 +47,3 @@ // based on https://developers.google.com/doubleclick-gpt/reference?hl=en

if (config.test) {
this.testMode = config.test;
this.testMode = config;
}

@@ -88,5 +88,13 @@ }

}
this._googletag = new GPTMock(config);
const {test, GPTMock} = config;
this._isLoaded = true;
this._testMode = !!config;
this._testMode = !!test;
if (test) {
invariant(
test && GPTMock,
"Must provide GPTMock to enable testMode. config{GPTMock}"
);
this._googletag = new GPTMock(config);
}
}

@@ -448,3 +456,3 @@

};
if (window.googletag) {
if (window.googletag && window.googletag.apiReady) {
onLoad();

@@ -451,0 +459,0 @@ } else {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc