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 2.0.0 to 2.0.1

31

CHANGELOG.md

@@ -0,1 +1,10 @@

<a name="2.0.1"></a>
## [2.0.1](https://github.com/nfl/react-gpt/compare/v2.0.0...v2.0.1) (2018-03-13)
### Code Refactoring
* Adds `onSlotOnload` event
* Allows `["fluid"]` slotSize as an array
<a name="2.0.0"></a>

@@ -12,6 +21,9 @@

**< 2.0.0** you may have imported `createManagerTest` like this:
```
import {createManagerTest} from "react-gpt";
```
**>= 2.0.0** you now need to import `createManagerTest` like this:
```

@@ -37,3 +49,2 @@ import {createManagerTest} from "react-gpt/es/utils/createManagerTest";

### Bug Fixes

@@ -44,2 +55,3 @@

<a name="1.0.0"></a>
## [1.0.0](https://github.com/nfl/react-gpt/compare/v0.3.0...v1.0.0) (2017-09-18)

@@ -53,4 +65,4 @@

<a name="0.3.0"></a>
<a name="0.3.0"></a>
## [0.3.0](https://github.com/nfl/react-gpt/compare/v0.2.5...v0.3.0) (2017-09-18)

@@ -69,2 +81,3 @@

<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)

@@ -75,3 +88,3 @@

* 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))
* 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))

@@ -81,14 +94,13 @@ * Import ReactTestUtils from test-utils ([75e74f6](https://github.com/nfl/react-gpt/commit/75e74f6))

<a name="0.2.4"></a>
## [0.2.4](https://github.com/nfl/react-gpt/compare/v0.2.3...v0.2.4) (2017-03-23)
### Bug Fixes
* more gracefully handle adSlot becoming empty object due to AdBlocker ([7f9a989](https://github.com/nfl/react-gpt/commit/7f9a989))
* more gracefully handle adSlot becoming empty object due to AdBlocker ([7f9a989](https://github.com/nfl/react-gpt/commit/7f9a989))
<a name="0.2.3"></a>
<a name="0.2.3"></a>
## [0.2.3](https://github.com/nfl/react-gpt/compare/v0.2.2...v0.2.3) (2017-02-21)
### Bug Fixes

@@ -98,5 +110,4 @@

<a name="0.2.2"></a>
<a name="0.2.2"></a>
## [0.2.2](https://github.com/nfl/react-gpt/compare/v0.2.1...v0.2.2) (2016-10-13)

@@ -112,2 +123,2 @@

- Initial release
* Initial release

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

!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(4);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";var r=function(e,t,n,r,o,a,i,s){if(!e){var u;if(void 0===t)u=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,o,a,i,s],c=0;u=new Error(t.replace(/%s/g,function(){return l[c++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};e.exports=r},function(e,t){e.exports=function(e,t,n,r){function o(){function o(){i=Number(new Date),n.apply(u,c)}function s(){a=void 0}var u=this,l=Number(new Date)-i,c=arguments;r&&!a&&o(),a&&clearTimeout(a),void 0===r&&l>e?o():t!==!0&&(a=setTimeout(r?s:o,void 0===r?e-l:e))}var a,i=0;return"boolean"!=typeof t&&(r=n,n=t,t=void 0),o}},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(21),g=r(p),h=n(17),y=r(h),v=n(22),_=r(v),b=n(2),m=r(b),w=n(8),S=r(w),M=n(15),P=r(M),E=n(1),O=r(E),k=n(6),x=r(k),C=n(5),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 m(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(20),p=n(2),g=(r(p),n(12)),h=n(1),y=r(h),v=n(7),_=r(v),b=(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]:{};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,f.throttle)(20,function(e){var t=n.getMountedInstances();t.forEach(function(t){t.getRenderWhenViewable()&&t.foldCheck(e)}),n.testMode&&n._getTimer()}),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,f.debounce)(4,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})}}),n.renderAll=(0,f.debounce)(4,function(){if(!n.apiReady)return!1;var e=n.getMountedInstances();return e.forEach(function(e,t){0===t&&n.updateCorrelator(),e.forceUpdate()}),!0}),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&&b.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:"_getTimer",value:function(){return Date.now()}},{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),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 _.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&&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()):(b.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,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,n){var r;/*!
!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(4);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",SLOT_LOADED:"slotOnload"};t.default=n},function(e,t,n){"use strict";var r=function(e,t,n,r,o,a,i,s){if(!e){var u;if(void 0===t)u=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,o,a,i,s],c=0;u=new Error(t.replace(/%s/g,function(){return l[c++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};e.exports=r},function(e,t){e.exports=function(e,t,n,r){function o(){function o(){i=Number(new Date),n.apply(u,c)}function s(){a=void 0}var u=this,l=Number(new Date)-i,c=arguments;r&&!a&&o(),a&&clearTimeout(a),void 0===r&&l>e?o():t!==!0&&(a=setTimeout(r?s:o,void 0===r?e-l:e))}var a,i=0;return"boolean"!=typeof t&&(r=n,n=t,t=void 0),o}},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(21),g=r(p),h=n(15),y=r(h),v=n(22),_=r(v),b=n(2),m=r(b),w=n(8),S=r(w),M=n(13),E=r(M),O=n(1),P=r(O),k=n(6),x=r(k),A=n(5),C=(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||Array.isArray(e)&&"fluid"===e[0])&&(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||Array.isArray(s)&&"fluid"===s[0])&&(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===P.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,onSlotOnload: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,A.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,E.default)(C,A.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 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 m(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(20),p=n(2),g=(r(p),n(12)),h=n(1),y=r(h),v=n(7),_=r(v),b=(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]:{};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,f.throttle)(20,function(e){var t=n.getMountedInstances();t.forEach(function(t){t.getRenderWhenViewable()&&t.foldCheck(e)}),n.testMode&&n._getTimer()}),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,f.debounce)(4,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})}}),n.renderAll=(0,f.debounce)(4,function(){if(!n.apiReady)return!1;var e=n.getMountedInstances();return e.forEach(function(e,t){0===t&&n.updateCorrelator(),e.forceUpdate()}),!0}),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&&b.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:"_getTimer",value:function(){return Date.now()}},{key:"_listen",value:function(){var e=this;this._listening||([y.default.SLOT_RENDER_ENDED,y.default.IMPRESSION_VIEWABLE,y.default.SLOT_VISIBILITY_CHANGED,y.default.SLOT_LOADED].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 _.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&&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()):(b.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,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,n){var r;/*!
Copyright (c) 2015 Jed Watson.

@@ -6,2 +6,2 @@ Based on code that is Copyright 2013-2015, Facebook, Inc.

*/
!function(){"use strict";var o=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:o,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:o&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:o&&!!window.screen};r=function(){return a}.call(t,n,t,e),!(void 0!==r&&(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,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){"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(14),a=n(18);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(16)()},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(e,t,n){var r=n(3);e.exports=function(e,t,n){return void 0===n?r(e,t,!1):r(e,n,t!==!1)}},function(e,t,n){var r=n(3),o=n(19);e.exports={throttle:r,debounce:o}},function(t,n){t.exports=e},function(e,n){e.exports=t}])});
!function(){"use strict";var o=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:o,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:o&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:o&&!!window.screen};r=function(){return a}.call(t,n,t,e),!(void 0!==r&&(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(17),o=n(18),a=n(16);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(14)()},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},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,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){var r=n(3);e.exports=function(e,t,n){return void 0===n?r(e,t,!1):r(e,n,t!==!1)}},function(e,t,n){var r=n(3),o=n(19);e.exports={throttle:r,debounce:o}},function(t,n){t.exports=e},function(e,n){e.exports=t}])});

@@ -28,2 +28,3 @@ ## React GPT API References

- `onSlotVisibilityChanged`(optional) - An optional event handler function for `googletag.events.slotVisibilityChangedEvent`.
- `onSlotOnload`(optional) - An optional event handler function for `googletag.events.SlotOnloadEvent`.
- `renderWhenViewable`(optional) - An optional flag to indicate whether an ad should only render when it's fully in the viewport area.

@@ -30,0 +31,0 @@ - `viewableThreshold`(optional) - An optional number to indicate how much percentage of an ad area needs to be in a viewable area before rendering. Acceptable range is between `0` and `1`.

@@ -69,2 +69,3 @@ Object.defineProperty(exports, "__esModule", {

* @fires Bling#Events.SLOT_VISIBILITY_CHANGED
* @fires Bling#Events.SLOT_LOADED
*/

@@ -164,3 +165,2 @@ var Bling = (_temp2 = _class = function (_Component) {

var shouldRefresh = !shouldRender && !propsEqual(refreshableProps.props, refreshableProps.nextProps);
// console.log(`shouldRefresh: ${shouldRefresh}, shouldRender: ${shouldRender}, isScriptLoaded: ${isScriptLoaded}, syncCorrelator: ${Bling._adManager._syncCorrelator}`);

@@ -248,3 +248,3 @@ if (shouldRefresh) {

}
if (slotSize === "fluid") {
if (slotSize === "fluid" || Array.isArray(slotSize) && slotSize[0] === "fluid") {
slotSize = [0, 0];

@@ -497,3 +497,3 @@ }

// https://developers.google.com/doubleclick-gpt/reference?hl=en#googletag.NamedSize
if (slotSize === "fluid") {
if (slotSize === "fluid" || Array.isArray(slotSize) && slotSize[0] === "fluid") {
slotSize = ["auto", "auto"];

@@ -793,2 +793,8 @@ }

/**
* An optional event handler function for `googletag.events.SlotOnloadEvent`.
*
* @property onSlotOnload
*/
onSlotOnload: _propTypes2.default.func,
/**
* An optional flag to indicate whether an ad should only render when it's fully in the viewport area.

@@ -795,0 +801,0 @@ *

@@ -247,3 +247,3 @@ Object.defineProperty(exports, "__esModule", {

if (!this._listening) {
[_Events2.default.SLOT_RENDER_ENDED, _Events2.default.IMPRESSION_VIEWABLE, _Events2.default.SLOT_VISIBILITY_CHANGED].forEach(function (eventType) {
[_Events2.default.SLOT_RENDER_ENDED, _Events2.default.IMPRESSION_VIEWABLE, _Events2.default.SLOT_VISIBILITY_CHANGED, _Events2.default.SLOT_LOADED].forEach(function (eventType) {
["pubads", "content", "companionAds"].forEach(function (service) {

@@ -250,0 +250,0 @@ // there is no API to remove listeners.

@@ -9,5 +9,6 @@ Object.defineProperty(exports, "__esModule", {

IMPRESSION_VIEWABLE: "impressionViewable",
SLOT_VISIBILITY_CHANGED: "slotVisibilityChanged"
SLOT_VISIBILITY_CHANGED: "slotVisibilityChanged",
SLOT_LOADED: "slotOnload"
};
exports.default = Events;

@@ -69,2 +69,3 @@ Object.defineProperty(exports, "__esModule", {

* @fires Bling#Events.SLOT_VISIBILITY_CHANGED
* @fires Bling#Events.SLOT_LOADED
*/

@@ -164,3 +165,2 @@ var Bling = (_temp2 = _class = function (_Component) {

var shouldRefresh = !shouldRender && !propsEqual(refreshableProps.props, refreshableProps.nextProps);
// console.log(`shouldRefresh: ${shouldRefresh}, shouldRender: ${shouldRender}, isScriptLoaded: ${isScriptLoaded}, syncCorrelator: ${Bling._adManager._syncCorrelator}`);

@@ -248,3 +248,3 @@ if (shouldRefresh) {

}
if (slotSize === "fluid") {
if (slotSize === "fluid" || Array.isArray(slotSize) && slotSize[0] === "fluid") {
slotSize = [0, 0];

@@ -497,3 +497,3 @@ }

// https://developers.google.com/doubleclick-gpt/reference?hl=en#googletag.NamedSize
if (slotSize === "fluid") {
if (slotSize === "fluid" || Array.isArray(slotSize) && slotSize[0] === "fluid") {
slotSize = ["auto", "auto"];

@@ -793,2 +793,8 @@ }

/**
* An optional event handler function for `googletag.events.SlotOnloadEvent`.
*
* @property onSlotOnload
*/
onSlotOnload: _propTypes2.default.func,
/**
* An optional flag to indicate whether an ad should only render when it's fully in the viewport area.

@@ -795,0 +801,0 @@ *

@@ -247,3 +247,3 @@ Object.defineProperty(exports, "__esModule", {

if (!this._listening) {
[_Events2.default.SLOT_RENDER_ENDED, _Events2.default.IMPRESSION_VIEWABLE, _Events2.default.SLOT_VISIBILITY_CHANGED].forEach(function (eventType) {
[_Events2.default.SLOT_RENDER_ENDED, _Events2.default.IMPRESSION_VIEWABLE, _Events2.default.SLOT_VISIBILITY_CHANGED, _Events2.default.SLOT_LOADED].forEach(function (eventType) {
["pubads", "content", "companionAds"].forEach(function (service) {

@@ -250,0 +250,0 @@ // there is no API to remove listeners.

@@ -9,5 +9,6 @@ Object.defineProperty(exports, "__esModule", {

IMPRESSION_VIEWABLE: "impressionViewable",
SLOT_VISIBILITY_CHANGED: "slotVisibilityChanged"
SLOT_VISIBILITY_CHANGED: "slotVisibilityChanged",
SLOT_LOADED: "slotOnload"
};
exports.default = Events;
{
"name": "react-gpt",
"version": "2.0.0",
"version": "2.0.1",
"description": "A react display ad component using Google Publisher Tag",

@@ -28,10 +28,3 @@ "main": "lib/index.js",

},
"files": [
"*.md",
"docs",
"es",
"src",
"dist",
"lib"
],
"files": ["*.md", "docs", "es", "src", "dist", "lib"],
"dependencies": {

@@ -111,12 +104,17 @@ "deep-equal": "^1.0.1",

"build:es": "BABEL_ENV=es babel --copy-files ./src -d es",
"build:umd": "NODE_ENV=development webpack src/index.js dist/react-gpt.js",
"build:umd:min": "NODE_ENV=production webpack -p src/index.js dist/react-gpt.min.js",
"build:umd":
"NODE_ENV=development webpack src/index.js dist/react-gpt.js",
"build:umd:min":
"NODE_ENV=production webpack -p src/index.js dist/react-gpt.min.js",
"bundlesize": "npm run build:umd:min && bundlesize",
"clean": "rimraf lib coverage dist lib es",
"compile": "babel src --out-dir lib",
"examples": "webpack-dev-server --config examples/webpack.config.js --content-base examples/apps --inline",
"examples":
"webpack-dev-server --config examples/webpack.config.js --content-base examples/apps --inline",
"lint": "eslint --fix src test examples",
"start": "npm run build && env BABEL_ENV=examples node examples/server/index.js",
"start":
"npm run build && env BABEL_ENV=examples node examples/server/index.js",
"pretest": "npm run build",
"prepublish": "npm run build && npm run build:es && npm run build:umd && npm run build:umd:min",
"prepublish":
"npm run build && npm run build:es && npm run build:umd && npm run build:umd:min",
"test": "npm run lint && karma start",

@@ -123,0 +121,0 @@ "update-apilist": "node ./scripts/updateAPIList.js"

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

@@ -10,3 +10,3 @@ import ReactDOM from "react-dom";

import filterPropsSimple from "./utils/filterProps";
import {createManager, pubadsAPI} from "./createManager";
import { createManager, pubadsAPI } from "./createManager";
/**

@@ -23,2 +23,3 @@ * An Ad Component using Google Publisher Tags.

* @fires Bling#Events.SLOT_VISIBILITY_CHANGED
* @fires Bling#Events.SLOT_LOADED
*/

@@ -160,2 +161,8 @@ class Bling extends Component {

/**
* An optional event handler function for `googletag.events.SlotOnloadEvent`.
*
* @property onSlotOnload
*/
onSlotOnload: PropTypes.func,
/**
* An optional flag to indicate whether an ad should only render when it's fully in the viewport area.

@@ -386,4 +393,4 @@ *

componentWillReceiveProps(nextProps) {
const {propsEqual} = Bling._config;
const {sizeMapping} = this.props;
const { propsEqual } = Bling._config;
const { sizeMapping } = this.props;
if (

@@ -400,3 +407,3 @@ (nextProps.sizeMapping || sizeMapping) &&

// otherwise, just refresh
const {scriptLoaded, inViewport} = nextState;
const { scriptLoaded, inViewport } = nextState;
const notInViewport = this.notInViewport(nextProps, nextState);

@@ -413,3 +420,3 @@ const inViewportChanged = this.state.inViewport !== inViewport;

const {filterProps, propsEqual} = Bling._config;
const { filterProps, propsEqual } = Bling._config;
const refreshableProps = filterProps(

@@ -432,3 +439,2 @@ Bling.refreshableProps,

!propsEqual(refreshableProps.props, refreshableProps.nextProps);
// console.log(`shouldRefresh: ${shouldRefresh}, shouldRender: ${shouldRender}, isScriptLoaded: ${isScriptLoaded}, syncCorrelator: ${Bling._adManager._syncCorrelator}`);

@@ -482,3 +488,3 @@ if (shouldRefresh) {

onScriptLoaded() {
const {onScriptLoaded} = this.props;
const { onScriptLoaded } = this.props;

@@ -488,3 +494,3 @@ if (this.getRenderWhenViewable()) {

}
this.setState({scriptLoaded: true}, onScriptLoaded); // eslint-disable-line react/no-did-mount-set-state
this.setState({ scriptLoaded: true }, onScriptLoaded); // eslint-disable-line react/no-did-mount-set-state
}

@@ -514,3 +520,6 @@

}
if (slotSize === "fluid") {
if (
slotSize === "fluid" ||
(Array.isArray(slotSize) && slotSize[0] === "fluid")
) {
slotSize = [0, 0];

@@ -525,3 +534,3 @@ }

if (inViewport) {
this.setState({inViewport: true});
this.setState({ inViewport: true });
}

@@ -601,3 +610,3 @@ }

notInViewport(props = this.props, state = this.state) {
const {inViewport} = state;
const { inViewport } = state;
return this.getRenderWhenViewable(props) && !inViewport;

@@ -607,3 +616,3 @@ }

defineSlot() {
const {adUnitPath, outOfPage} = this.props;
const { adUnitPath, outOfPage } = this.props;
const divId = this._divId;

@@ -699,3 +708,3 @@ const slotSize = this.getSlotSize();

display() {
const {content} = this.props;
const { content } = this.props;
const divId = this._divId;

@@ -745,4 +754,4 @@ const adSlot = this._adSlot;

render() {
const {scriptLoaded} = this.state;
const {id, outOfPage, style} = this.props;
const { scriptLoaded } = this.state;
const { id, outOfPage, style } = this.props;
const shouldNotRender = this.notInViewport(this.props, this.state);

@@ -764,3 +773,6 @@

// https://developers.google.com/doubleclick-gpt/reference?hl=en#googletag.NamedSize
if (slotSize === "fluid") {
if (
slotSize === "fluid" ||
(Array.isArray(slotSize) && slotSize[0] === "fluid")
) {
slotSize = ["auto", "auto"];

@@ -792,5 +804,6 @@ }

pubadsAPI.reduce((api, method) => {
api[method] = (...args) => Bling._adManager.pubadsProxy({method, args});
api[method] = (...args) =>
Bling._adManager.pubadsProxy({ method, args });
return api;
}, {})
);

@@ -189,3 +189,4 @@ import EventEmitter from "eventemitter3";

Events.IMPRESSION_VIEWABLE,
Events.SLOT_VISIBILITY_CHANGED
Events.SLOT_VISIBILITY_CHANGED,
Events.SLOT_LOADED
].forEach(eventType => {

@@ -192,0 +193,0 @@ ["pubads", "content", "companionAds"].forEach(service => {

@@ -6,5 +6,6 @@ const Events = {

IMPRESSION_VIEWABLE: "impressionViewable",
SLOT_VISIBILITY_CHANGED: "slotVisibilityChanged"
SLOT_VISIBILITY_CHANGED: "slotVisibilityChanged",
SLOT_LOADED: "slotOnload"
};
export default Events;

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