react-metrics
Advanced tools
Comparing version 2.3.1 to 2.3.2
@@ -0,1 +1,10 @@ | ||
<a name="2.3.2"></a> | ||
## [2.3.2](https://github.com/nfl/react-metrics/compare/v2.3.1...v2.3.2) (2017-06-27) | ||
### Bug Fixes | ||
* Fix for IE console log error with SVG parentNode (#46) ([51ff8a5](https://github.com/nfl/react-metrics/commit/51ff8a55bfa9c6dcdda9ab229d0ecf495961ef7c)) | ||
<a name="2.3.1"></a> | ||
@@ -2,0 +11,0 @@ ## [2.3.1](https://github.com/nfl/react-metrics/compare/v2.3.0...v2.3.1) (2017-05-22) |
@@ -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.ReactMetrics=t(require("react"),require("react-dom")):e.ReactMetrics=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}),t.PropTypes=t.MetricsElement=t.exposeMetrics=t.metrics=t.createMetrics=void 0;var o=n(8),i=r(o),a=n(23),u=r(a),c=n(1),s=r(c),f=n(11),l=r(f),p=n(18),d=r(p);t.createMetrics=i.default,t.metrics=u.default,t.exposeMetrics=l.default,t.MetricsElement=d.default,t.PropTypes=s.default},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.location=t.metrics=void 0;var r=n(5),o=t.metrics=r.object,i=t.location=(0,r.shape)({pathname:r.string.isRequired,search:r.string.isRequired,query:r.object,state:r.object});t.default={metrics:o,location:i}},function(e,t,n){"use strict";function r(e,t,n,r,i,a,u,c){if(o(t),!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,i,a,u,c],l=0;s=new Error(t.replace(/%s/g,function(){return f[l++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}var o=function(e){};e.exports=r},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,n){e.exports=n(29)()},function(t,n){t.exports=e},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n={PAGE_VIEW:"pageView",TRACK:"track"};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)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(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,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e){return e&&"function"==typeof e.listen&&"function"==typeof e.setRouteState&&"function"==typeof e.useTrackBinding&&"function"==typeof e.destroy&&"object"===f(e.api)}function s(e){var t=new I(e);return{listen:t.listen.bind(t),setRouteState:t.setRouteState.bind(t),useTrackBinding:t.useTrackBinding.bind(t),destroy:t.destroy.bind(t),get enabled(){return t.enabled},get api(){return t.api}}}Object.defineProperty(t,"__esModule",{value:!0}),t.Metrics=void 0;var 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},l=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.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")}}(),p=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.isMetrics=c,t.default=s;var d=n(27),h=r(d),y=n(33),v=r(y),m=n(3),b=n(2),g=r(b),_=n(12),O=r(_),k=n(7),w=r(k),P=n(15),j=r(P),T=n(10),x=r(T),E=n(17),M=r(E),S=n(9),R=r(S),C=m.canUseDOM?v.default.decode(window.location.search.substr(1)):{},A={pageViewEvent:"pageLoad",pageDefaults:function(){return{}},requestTimeout:15e3},L=function(){function e(){u(this,e),this.pvTransactions={},this.transactionId=0}return p(e,[{key:"create",value:function(){return++this.transactionId}},{key:"current",value:function(){return this.transactionId}},{key:"get",value:function(e){return this.pvTransactions[e]}},{key:"set",value:function(e,t){this.pvTransactions[e]=t}},{key:"remove",value:function(e){e&&this.pvTransactions[e]&&delete this.pvTransactions[e]}},{key:"keys",value:function(){return Object.keys(this.pvTransactions)}}]),e}(),I=t.Metrics=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(u(this,t),!e.vendors)throw new Error("'vendors' option is required.");var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.enabled=e.enabled!==!1,n.canUseDOM=void 0!==e.canUseDOM?!!e.canUseDOM:m.canUseDOM,n.canUseDOM||(n.enabled=!1),n.debug=!!e.debug||"true"===C.metrics_debug,n.customParams=e.customParams||{},n.pageDefaults=e.pageDefaults||A.pageDefaults,n.pageViewEvent=e.pageViewEvent||A.pageViewEvent,n.requestTimeout=e.requestTimeout||A.requestTimeout,n.cancelOnNext=void 0===e.cancelOnNext||!!e.cancelOnNext,n.vendors=Array.isArray(e.vendors)?e.vendors:[e.vendors],n.services=n.vendors.map(function(e){return(0,j.default)(e)}),n.apiList=(0,x.default)(n.services.map(function(e){return e.apis})),n.transaction=new L,n.routeState={},n.apiImpl=n.apiList.reduce(function(e,t){return e[t]=function(){for(var e=arguments.length,r=Array(e),o=0;o<e;o++)r[o]=arguments[o];return n._prepareTrack.apply(n,[t].concat(r))},e},{}),Object.freeze(n.apiImpl),n}return a(t,e),p(t,[{key:"listen",value:function(e,t){var n=this;return"function"==typeof e&&(t=e,e=null),e?this.on(e,t):this.apiList.forEach(function(e){n.on(e,t)}),function(){e?n.removeListener(e,t):n.apiList.forEach(function(e){n.removeListener(e,t)})}}},{key:"setRouteState",value:function(e){this._cancelPreviousPromiseIfPending(),this.routeState=e}},{key:"useTrackBinding",value:function(e,t){if(this.enabled)return e===!1?void this._removeTrackBindingListener():((0,g.default)("function"==typeof this.api.track,"Metrics 'track' method needs to be defined for declarative tracking."),this._trackBindingListener&&this._removeTrackBindingListener(),this._trackBindingListener=(0,R.default)({callback:this._handleClick.bind(this),rootElement:e,attributePrefix:t}),this._removeTrackBindingListener.bind(this))}},{key:"destroy",value:function(){this._removeListeners(),this._removeTrackBindingListener()}},{key:"_callServices",value:function(e,t){var n=this;return t.then(function(t){function r(){return a.length===u.length}function i(e){e&&(clearTimeout(e),e=null)}var a=[],u=n.services,c=n.requestTimeout;return new Promise(function(n){function s(e){this.isTimeout||(this.isTimeout=!0,i(this.timer),a.push(e),r()&&n(a))}u.map(function(n){var r=n.apis,i=n.name,a=r&&r[e];a&&(0,O.default)("function"==typeof r[e],"'"+e+"'"+(i?"("+i+" Service)":"")+" is not a function");var u=a&&"function"==typeof r[e]?r[e].apply(r,o(t)):void 0;return(0,M.default)(u)||(u=Promise.resolve(u)),u.isTimeout=!1,u.timer=setTimeout(s.bind(u),c,{name:i,params:t,error:new Error("Request time out after "+c+" ms."),status:"failure"}),u.then(function(e){return{name:i,params:t,response:e,status:"success"}}).catch(function(e){return{name:i,params:t,error:e,status:"failure"}}).then(s.bind(u))})})})}},{key:"_cancelPreviousPromiseIfPending",value:function(){var e=this;this.routeState={},this.transaction.keys().forEach(function(t){var n=e.transaction.get(t);n&&n.cancelOnNext&&(n.shouldCancel=!0)})}},{key:"_createTransaction",value:function(e){var t=this.transaction.current(),n=this.cancelOnNext;this.transaction.set(t,{promise:e[0],cancelOnNext:n}),e.push(t)}},{key:"_clearTransaction",value:function(e){this.transaction.remove(e)}},{key:"_doTrack",value:function(e,t,n){t=this._callServices(e,t);var r=function(t,r,o){var i={type:e,status:t};r?i.response=r:o&&(i.error=o),n&&(i.transactionId=n,this._clearTransaction(n)),this.emit(e,i),this.debug&&console.log("track result",i)}.bind(this);t.then(function(e){r(e.every(function(e){return"success"===e.status})?"success":"failure",e)}).catch(function(e){r("failure",null,e)})}},{key:"_getDefaultData",value:function(e){return this.pageDefaults(e)}},{key:"_mergeWith",value:function(e,t){return Object.assign({},this._getDefaultData(t),this.customParams,e)}},{key:"_addCancelHook",value:function(e){var t=this,n=this.transaction.create();return e.then(function(e){return t.transaction.get(n).shouldCancel?Promise.reject(new Error("Page view cancelled")):e})}},{key:"_addEventNameToPromise",value:function(e,t,n){return t.then(function(t,r){return r=[n?this._mergeWith(r,t):r],r.unshift(e),r}.bind(this,this.routeState))}},{key:"_inspectArguments",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=!0;e!==w.default.PAGE_VIEW&&(o=!1,e===w.default.TRACK&&(0,g.default)("string"==typeof n[0],"Metrics 'track' method requires 'eventName' string as the first argument and object or promise as the second argument."),n.length>=3&&"boolean"==typeof n[n.length-1]&&(o=n[n.length-1]));var i=n,a=l(i,2),u=a[0],c=a[1];return c||"string"==typeof u||(c=u,u=e===w.default.PAGE_VIEW?this.pageViewEvent:null),(0,M.default)(c)||(c=Promise.resolve(c)),e===w.default.PAGE_VIEW&&(c=this._addCancelHook(c)),u&&(c=this._addEventNameToPromise(u,c,o)),n=[e,c],e===w.default.PAGE_VIEW&&this._createTransaction(n),n}},{key:"_prepareTrack",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.enabled&&(n=this._inspectArguments.apply(this,[e].concat(o(n))),this._doTrack.apply(this,o(n)))}},{key:"_handleClick",value:function(){var e;(e=this.api).track.apply(e,arguments)}},{key:"_removeListeners",value:function(){this.removeAllListeners()}},{key:"_removeTrackBindingListener",value:function(){this._trackBindingListener&&(this._trackBindingListener.remove(),this._trackBindingListener=null)}},{key:"api",get:function(){return this.apiImpl}}]),t}(h.default)},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return 0===e.button}function a(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function u(e){var t=e.callback,n=e.rootElement,r=e.attributePrefix,o=e.traverseParent,i=new h({attributePrefix:r,traverseParent:o});return i.listen(t,n)}Object.defineProperty(t,"__esModule",{value:!0}),t.TrackBindingPlugin=void 0;var 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},s=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.default=u;var f=n(28),l=r(f),p=n(16),d=r(p),h=t.TrackBindingPlugin=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.attributePrefix,r=void 0===n?"data-metrics":n,i=t.traverseParent,a=void 0!==i&&i;o(this,e),this._attributePrefix=r,this._traverseParent=a}return s(e,[{key:"listen",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.body;if("function"!=typeof e)throw new Error("callback needs to be a function.");if(t&&1!==t.nodeType)throw new Error("rootElement needs to be a valid node element.");return this._clickHandler&&this.remove(),this._rootElement=t,this._clickHandler=l.default.listen(t,"click",this._handleClick.bind(this,e)),{target:this,remove:this.remove.bind(this)}}},{key:"remove",value:function(){this._clickHandler&&(this._clickHandler.remove(),this._clickHandler=null)}},{key:"_handleClick",value:function(e,t){if(!a(t)&&i(t)){var n=t.target||t.srcElement,r=this._getData(n);if(this._traverseParent)for(var o=this._rootElement;n!==o;)n=n.parentElement,r=c({},this._getData(n),r);if(Object.keys(r).length){var u=r&&r.eventName,s=r&&r.mergePagedefaults;delete r.mergePagedefaults,u&&(delete r.eventName,e(u,r,"true"===s))}}}},{key:"_getData",value:function(e){return(0,d.default)(e,this._attributePrefix)}}]),e}()},function(e,t){function n(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 r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"function";return Object.getOwnPropertyNames(e).filter(function(r){return t.indexOf(r)===-1&&u.indexOf(r)===-1&&0!==r.indexOf("_")&&e.hasOwnProperty(r)&&a(e[r])===n})}function o(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=[];null!==e;){var i=r(e,t);o.push.apply(o,n(i)),e=Object.getPrototypeOf(e)}return o}function i(e){e=Array.isArray(e)?e:[e];var t=e.reduce(function(e,t){var r=t.constructor===Object?t:Object.getPrototypeOf(t),i=o(r,e);return e.push.apply(e,n(i)),e},[]);return t}Object.defineProperty(t,"__esModule",{value:!0});var a="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};t.filterKeysByType=r,t.aggregateApisByType=o,t.default=i;var u=["constructor"].concat(Object.getOwnPropertyNames(Object.getPrototypeOf({})))},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(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 a(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(){return O}function c(){O.length=0}function s(e){return e.displayName||e.name||"Component"}function f(e){var t,n,r=(n=t=function(t){function n(){return o(this,n),i(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return a(n,t),d(n,[{key:"componentWillMount",value:function(){v.canUseDOM&&O.push(n)}},{key:"componentWillUnmount",value:function(){var e=O.indexOf(this);O.splice(e,1)}},{key:"render",value:function(){return y.default.createElement(e,p({},this.props,this.context))}}]),n}(h.Component),t.displayName="Metrics("+s(e)+")",t.contextTypes={metrics:_.default.metrics},n);return(0,b.default)(r,e)}function l(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return"function"==typeof t[0]?f.apply(void 0,t):function(e){return f.apply(void 0,[e].concat(t))}}Object.defineProperty(t,"__esModule",{value:!0});var p=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(){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.getMountedInstances=u,t.clearMountedInstances=c,t.default=l;var h=n(6),y=r(h),v=n(3),m=n(13),b=r(m),g=n(1),_=r(g),O=[]},function(e,t,n){"use strict";var r=n(4),o=r;e.exports=o},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 u=0;u<a.length;++u)if(!(n[a[u]]||r[a[u]]||i&&i[a[u]]))try{e[a[u]]=t[a[u]]}catch(e){}}return e}},function(e,n){e.exports=t},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=(0,l.aggregateApisByType)(e);return t.length>0}function a(){function e(){var e=n;return new e(t)}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.api,r=d;if("function"==typeof n){var o=void 0;try{o=n(t)}catch(e){}finally{o&&i(o)||(o=e()),i(o)&&(r=o)}}else n&&"object"===("undefined"==typeof n?"undefined":c(n))&&i(n)&&(r=n);var a=t.name||r.name;return{name:a,apis:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.defaultService=void 0;var u,c="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};t.default=a;var s=n(7),f=r(s),l=n(10),p=function(){},d=t.defaultService=(u={},o(u,f.default.PAGE_VIEW,p),o(u,f.default.TRACK,p),u)},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"data",n=e.attributes,r={},o=/-([\da-z])/gi,i=function(e,t){return t.toUpperCase()},a=function(e){return e.replace(o,i)};if(1===e.nodeType)for(var u=n.length;u--;){var c=n[u].name;if(0===c.indexOf(t+"-")){var s=a(c.slice(t.length+1));r[s]=e.getAttribute(c)}}return r};t.default=n},function(e,t){function n(e){return e&&"function"==typeof e.then}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}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 u(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}),t.default=void 0;var c,s,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}}(),l=n(6),p=n(5),d=r(p),h=n(14),y=r(h),v=n(2),m=r(v),b=n(12),g=r(b),_=n(1),O=r(_),k=n(9),w=r(k),P=(s=c=function(e){function t(){return i(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,e),f(t,[{key:"componentDidMount",value:function(){var e=this.context,t=e.metrics,n=e._metricsConfig;(0,m.default)(t,"MetricsElement requires metrics HOC to exist in the parent tree.");var r=n.useTrackBinding,o=n.attributePrefix,i=n.suppressTrackBindingWarning;i||(0,g.default)(!r,"You are using 'MetricsElement' while default track binding is turned on. It is recommended that you stick with either one to avoid double tracking accidentally. If you intentionally use both and want to suppress this warning, pass 'suppressTrackBindingWarning=true' to the metrics options."),this._trackBindingListener=(0,w.default)({callback:this._handleClick.bind(this),rootElement:y.default.findDOMNode(this),attributePrefix:o,traverseParent:!0})}},{key:"componentWillUnmount",value:function(){this._trackBindingListener&&(this._trackBindingListener.remove(),this._trackBindingListener=null)}},{key:"_handleClick",value:function(){var e;(e=this.context.metrics).track.apply(e,arguments)}},{key:"render",value:function(){var e=this.props,t=e.element,n=e.children,r=o(e,["element","children"]);return t?(0,l.isValidElement)(t)?(0,l.cloneElement)(t,r):(0,l.createElement)(t,r,n):l.Children.only(n)}}]),t}(l.Component),c.contextTypes={metrics:O.default.metrics,_metrics:d.default.object,_metricsConfig:d.default.object},c.propTypes={children:d.default.node,element:d.default.any},s);t.default=P},function(e,t,n){function r(){var e=(0,o.getMountedInstances)(),t=e&&e.length>0&&e[e.length-1];return t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(11)},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return Object.keys(e).reduce(function(t,n){return t[n]=e[n],t},{params:t})}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,s.default)(e.location)&&!(0,u.default)(t.location,e.location)){var n=e.location,r=e.params;if(n.params||!r)return n;var i=o(n,r);return i}return null}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var a=n(22),u=r(a),c=n(21),s=r(c)},function(e,t){function n(e){return!!e&&"object"===("undefined"==typeof e?"undefined":r(e))&&e.hasOwnProperty("pathname")&&e.hasOwnProperty("hash")&&e.hasOwnProperty("search")&&e.hasOwnProperty("state")}Object.defineProperty(t,"__esModule",{value:!0});var r="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};t.default=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return!e&&!t||!(e&&!t||!e&&t)&&(e.pathname===t.pathname&&e.search===t.search&&(0,a.default)(e.state,t.state))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=n(24),a=r(i)},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(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 a(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 e.displayName||e.name||"Component"}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.autoTrackPageView!==!1,r=t.useTrackBinding!==!1,c=t.attributePrefix,d=!!t.suppressTrackBindingWarning,y=t.getRouteState||P.default,m=t.findRouteComponent||T.default,w=(0,O.isMetrics)(e)?e:(0,k.default)(e);return function(e){var t,O,k=(O=t=function(t){function l(){return o(this,l),i(this,(l.__proto__||Object.getPrototypeOf(l)).apply(this,arguments))}return a(l,t),f(l,[{key:"getChildContext",value:function(){return{metrics:this._getMetrics().api,_metricsConfig:{autoTrackPageView:n,useTrackBinding:r,attributePrefix:c,suppressTrackBindingWarning:d,getNewRouteState:y,findNewRouteComponent:m}}}},{key:"componentWillMount",value:function(){if(g.canUseDOM){var t=this.constructor.getMountedMetricsInstances();1===t.length&&(0,b.default)(!1,"`metrics` should only be added once to the root level component. You have added to both %s and %s.",u(t[0]),u(e)),t.push(e),this._newRouteState=y(this.props),this._newRouteState&&this._getMetrics().setRouteState(this._newRouteState)}}},{key:"componentDidMount",value:function(){if(r){var e=v.default.findDOMNode(this);(0,b.default)(e,"`metrics` should be added to the root most component which renders node element for declarative tracking to work."),this._getMetrics().useTrackBinding(e,c)}this._newRouteState&&(this._handleRouteStateChange(this._newRouteState),this._newRouteState=null)}},{key:"componentWillReceiveProps",value:function(e){this._newRouteState=y(e,this.props),this._newRouteState&&this._getMetrics().setRouteState(this._newRouteState)}},{key:"componentDidUpdate",value:function(){this._newRouteState&&(this._handleRouteStateChange(this._newRouteState),this._newRouteState=null)}},{key:"componentWillUnmount",value:function(){var t=this.constructor.getMountedMetricsInstances(),n=t.indexOf(e);t.splice(n,1),this._getMetrics().destroy()}},{key:"_getMetrics",value:function(){return w}},{key:"_handleRouteStateChange",value:function(e){var t=m(),r=this._getMetrics(),o=void 0,i=!1;if(t){var a=t.willTrackPageView&&t.willTrackPageView(e);a===!1?i=!0:a&&(o=a)}r.enabled&&n&&!i&&((0,b.default)("function"==typeof r.api.pageView,"react-metrics: 'pageView' api needs to be defined for automatic page view tracking."),r.api.pageView(o))}},{key:"render",value:function(){return p.default.createElement(e,s({},this.props,this.getChildContext()))}}],[{key:"getMountedMetricsInstances",value:function(){return M||(M=[]),M}}]),l}(l.Component),t.displayName="MetricsContainer",t.childContextTypes={metrics:_.metrics.isRequired,_metricsConfig:h.default.object},t.propTypes={location:_.location,params:h.default.object},O);return(0,E.default)(k,e)}}Object.defineProperty(t,"__esModule",{value:!0});var s=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(){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.default=c;var l=n(6),p=r(l),d=n(5),h=r(d),y=n(14),v=r(y),m=n(2),b=r(m),g=n(3),_=n(1),O=n(8),k=r(O),w=n(20),P=r(w),j=n(19),T=r(j),x=n(13),E=r(x),M=void 0},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,f;if(r(e)||r(t))return!1;if(e.prototype!==t.prototype)return!1;if(c(e))return!!c(t)&&(e=a.call(e),t=a.call(t),s(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 l=u(e),p=u(t)}catch(e){return!1}if(l.length!=p.length)return!1;for(l.sort(),p.sort(),i=l.length-1;i>=0;i--)if(l[i]!=p[i])return!1;for(i=l.length-1;i>=0;i--)if(f=l[i],!s(e[f],t[f],n))return!1;return typeof e==typeof t}var a=Array.prototype.slice,u=n(26),c=n(25),s=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(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(){}var i=Object.prototype.hasOwnProperty,a="function"!=typeof Object.create&&"~";o.prototype._events=void 0,o.prototype.eventNames=function(){var e,t=this._events,n=[];if(!t)return n;for(e in t)i.call(t,e)&&n.push(a?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(e,t){var n=a?a+e:e,r=this._events&&this._events[n];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,u=new Array(i);o<i;o++)u[o]=r[o].fn;return u},o.prototype.emit=function(e,t,n,r,o,i){var u=a?a+e:e;if(!this._events||!this._events[u])return!1;var c,s,f=this._events[u],l=arguments.length;if("function"==typeof f.fn){switch(f.once&&this.removeListener(e,f.fn,void 0,!0),l){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,t),!0;case 3:return f.fn.call(f.context,t,n),!0;case 4:return f.fn.call(f.context,t,n,r),!0;case 5:return f.fn.call(f.context,t,n,r,o),!0;case 6:return f.fn.call(f.context,t,n,r,o,i),!0}for(s=1,c=new Array(l-1);s<l;s++)c[s-1]=arguments[s];f.fn.apply(f.context,c)}else{var p,d=f.length;for(s=0;s<d;s++)switch(f[s].once&&this.removeListener(e,f[s].fn,void 0,!0),l){case 1:f[s].fn.call(f[s].context);break;case 2:f[s].fn.call(f[s].context,t);break;case 3:f[s].fn.call(f[s].context,t,n);break;default:if(!c)for(p=1,c=new Array(l-1);p<l;p++)c[p-1]=arguments[p];f[s].fn.apply(f[s].context,c)}}return!0},o.prototype.on=function(e,t,n){var o=new r(t,n||this),i=a?a+e:e;return this._events||(this._events=a?{}:Object.create(null)),this._events[i]?this._events[i].fn?this._events[i]=[this._events[i],o]:this._events[i].push(o):this._events[i]=o,this},o.prototype.once=function(e,t,n){var o=new r(t,n||this,!0),i=a?a+e:e;return this._events||(this._events=a?{}:Object.create(null)),this._events[i]?this._events[i].fn?this._events[i]=[this._events[i],o]:this._events[i].push(o):this._events[i]=o,this},o.prototype.removeListener=function(e,t,n,r){var o=a?a+e:e;if(!this._events||!this._events[o])return this;var i=this._events[o],u=[];if(t)if(i.fn)(i.fn!==t||r&&!i.once||n&&i.context!==n)&&u.push(i);else for(var c=0,s=i.length;c<s;c++)(i[c].fn!==t||r&&!i[c].once||n&&i[c].context!==n)&&u.push(i[c]);return u.length?this._events[o]=1===u.length?u[0]:u:delete this._events[o],this},o.prototype.removeAllListeners=function(e){return this._events?(e?delete this._events[a?a+e:e]:this._events=a?{}:Object.create(null),this):this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prototype.setMaxListeners=function(){return this},o.prefixed=a,e.exports=o},function(e,t,n){"use strict";var r=n(4),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};e.exports=o},function(e,t,n){"use strict";var r=n(4),o=n(2),i=n(30);e.exports=function(){function e(e,t,n,r,a,u){u!==i&&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){"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,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,o){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys); | ||
!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.ReactMetrics=t(require("react"),require("react-dom")):e.ReactMetrics=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}),t.PropTypes=t.MetricsElement=t.exposeMetrics=t.metrics=t.createMetrics=void 0;var o=n(8),i=r(o),a=n(23),u=r(a),c=n(1),s=r(c),f=n(11),l=r(f),p=n(18),d=r(p);t.createMetrics=i.default,t.metrics=u.default,t.exposeMetrics=l.default,t.MetricsElement=d.default,t.PropTypes=s.default},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.location=t.metrics=void 0;var r=n(5),o=t.metrics=r.object,i=t.location=(0,r.shape)({pathname:r.string.isRequired,search:r.string.isRequired,query:r.object,state:r.object});t.default={metrics:o,location:i}},function(e,t,n){"use strict";function r(e,t,n,r,i,a,u,c){if(o(t),!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,i,a,u,c],l=0;s=new Error(t.replace(/%s/g,function(){return f[l++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}var o=function(e){};e.exports=r},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,n){e.exports=n(29)()},function(t,n){t.exports=e},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n={PAGE_VIEW:"pageView",TRACK:"track"};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)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(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,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e){return e&&"function"==typeof e.listen&&"function"==typeof e.setRouteState&&"function"==typeof e.useTrackBinding&&"function"==typeof e.destroy&&"object"===f(e.api)}function s(e){var t=new I(e);return{listen:t.listen.bind(t),setRouteState:t.setRouteState.bind(t),useTrackBinding:t.useTrackBinding.bind(t),destroy:t.destroy.bind(t),get enabled(){return t.enabled},get api(){return t.api}}}Object.defineProperty(t,"__esModule",{value:!0}),t.Metrics=void 0;var 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},l=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.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")}}(),p=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.isMetrics=c,t.default=s;var d=n(27),h=r(d),y=n(33),v=r(y),m=n(3),b=n(2),g=r(b),_=n(12),O=r(_),k=n(7),w=r(k),P=n(15),j=r(P),T=n(10),x=r(T),E=n(17),M=r(E),S=n(9),R=r(S),C=m.canUseDOM?v.default.decode(window.location.search.substr(1)):{},A={pageViewEvent:"pageLoad",pageDefaults:function(){return{}},requestTimeout:15e3},L=function(){function e(){u(this,e),this.pvTransactions={},this.transactionId=0}return p(e,[{key:"create",value:function(){return++this.transactionId}},{key:"current",value:function(){return this.transactionId}},{key:"get",value:function(e){return this.pvTransactions[e]}},{key:"set",value:function(e,t){this.pvTransactions[e]=t}},{key:"remove",value:function(e){e&&this.pvTransactions[e]&&delete this.pvTransactions[e]}},{key:"keys",value:function(){return Object.keys(this.pvTransactions)}}]),e}(),I=t.Metrics=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(u(this,t),!e.vendors)throw new Error("'vendors' option is required.");var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.enabled=e.enabled!==!1,n.canUseDOM=void 0!==e.canUseDOM?!!e.canUseDOM:m.canUseDOM,n.canUseDOM||(n.enabled=!1),n.debug=!!e.debug||"true"===C.metrics_debug,n.customParams=e.customParams||{},n.pageDefaults=e.pageDefaults||A.pageDefaults,n.pageViewEvent=e.pageViewEvent||A.pageViewEvent,n.requestTimeout=e.requestTimeout||A.requestTimeout,n.cancelOnNext=void 0===e.cancelOnNext||!!e.cancelOnNext,n.vendors=Array.isArray(e.vendors)?e.vendors:[e.vendors],n.services=n.vendors.map(function(e){return(0,j.default)(e)}),n.apiList=(0,x.default)(n.services.map(function(e){return e.apis})),n.transaction=new L,n.routeState={},n.apiImpl=n.apiList.reduce(function(e,t){return e[t]=function(){for(var e=arguments.length,r=Array(e),o=0;o<e;o++)r[o]=arguments[o];return n._prepareTrack.apply(n,[t].concat(r))},e},{}),Object.freeze(n.apiImpl),n}return a(t,e),p(t,[{key:"listen",value:function(e,t){var n=this;return"function"==typeof e&&(t=e,e=null),e?this.on(e,t):this.apiList.forEach(function(e){n.on(e,t)}),function(){e?n.removeListener(e,t):n.apiList.forEach(function(e){n.removeListener(e,t)})}}},{key:"setRouteState",value:function(e){this._cancelPreviousPromiseIfPending(),this.routeState=e}},{key:"useTrackBinding",value:function(e,t){if(this.enabled)return e===!1?void this._removeTrackBindingListener():((0,g.default)("function"==typeof this.api.track,"Metrics 'track' method needs to be defined for declarative tracking."),this._trackBindingListener&&this._removeTrackBindingListener(),this._trackBindingListener=(0,R.default)({callback:this._handleClick.bind(this),rootElement:e,attributePrefix:t}),this._removeTrackBindingListener.bind(this))}},{key:"destroy",value:function(){this._removeListeners(),this._removeTrackBindingListener()}},{key:"_callServices",value:function(e,t){var n=this;return t.then(function(t){function r(){return a.length===u.length}function i(e){e&&(clearTimeout(e),e=null)}var a=[],u=n.services,c=n.requestTimeout;return new Promise(function(n){function s(e){this.isTimeout||(this.isTimeout=!0,i(this.timer),a.push(e),r()&&n(a))}u.map(function(n){var r=n.apis,i=n.name,a=r&&r[e];a&&(0,O.default)("function"==typeof r[e],"'"+e+"'"+(i?"("+i+" Service)":"")+" is not a function");var u=a&&"function"==typeof r[e]?r[e].apply(r,o(t)):void 0;return(0,M.default)(u)||(u=Promise.resolve(u)),u.isTimeout=!1,u.timer=setTimeout(s.bind(u),c,{name:i,params:t,error:new Error("Request time out after "+c+" ms."),status:"failure"}),u.then(function(e){return{name:i,params:t,response:e,status:"success"}}).catch(function(e){return{name:i,params:t,error:e,status:"failure"}}).then(s.bind(u))})})})}},{key:"_cancelPreviousPromiseIfPending",value:function(){var e=this;this.routeState={},this.transaction.keys().forEach(function(t){var n=e.transaction.get(t);n&&n.cancelOnNext&&(n.shouldCancel=!0)})}},{key:"_createTransaction",value:function(e){var t=this.transaction.current(),n=this.cancelOnNext;this.transaction.set(t,{promise:e[0],cancelOnNext:n}),e.push(t)}},{key:"_clearTransaction",value:function(e){this.transaction.remove(e)}},{key:"_doTrack",value:function(e,t,n){t=this._callServices(e,t);var r=function(t,r,o){var i={type:e,status:t};r?i.response=r:o&&(i.error=o),n&&(i.transactionId=n,this._clearTransaction(n)),this.emit(e,i),this.debug&&console.log("track result",i)}.bind(this);t.then(function(e){r(e.every(function(e){return"success"===e.status})?"success":"failure",e)}).catch(function(e){r("failure",null,e)})}},{key:"_getDefaultData",value:function(e){return this.pageDefaults(e)}},{key:"_mergeWith",value:function(e,t){return Object.assign({},this._getDefaultData(t),this.customParams,e)}},{key:"_addCancelHook",value:function(e){var t=this,n=this.transaction.create();return e.then(function(e){return t.transaction.get(n).shouldCancel?Promise.reject(new Error("Page view cancelled")):e})}},{key:"_addEventNameToPromise",value:function(e,t,n){return t.then(function(t,r){return r=[n?this._mergeWith(r,t):r],r.unshift(e),r}.bind(this,this.routeState))}},{key:"_inspectArguments",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=!0;e!==w.default.PAGE_VIEW&&(o=!1,e===w.default.TRACK&&(0,g.default)("string"==typeof n[0],"Metrics 'track' method requires 'eventName' string as the first argument and object or promise as the second argument."),n.length>=3&&"boolean"==typeof n[n.length-1]&&(o=n[n.length-1]));var i=n,a=l(i,2),u=a[0],c=a[1];return c||"string"==typeof u||(c=u,u=e===w.default.PAGE_VIEW?this.pageViewEvent:null),(0,M.default)(c)||(c=Promise.resolve(c)),e===w.default.PAGE_VIEW&&(c=this._addCancelHook(c)),u&&(c=this._addEventNameToPromise(u,c,o)),n=[e,c],e===w.default.PAGE_VIEW&&this._createTransaction(n),n}},{key:"_prepareTrack",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.enabled&&(n=this._inspectArguments.apply(this,[e].concat(o(n))),this._doTrack.apply(this,o(n)))}},{key:"_handleClick",value:function(){var e;(e=this.api).track.apply(e,arguments)}},{key:"_removeListeners",value:function(){this.removeAllListeners()}},{key:"_removeTrackBindingListener",value:function(){this._trackBindingListener&&(this._trackBindingListener.remove(),this._trackBindingListener=null)}},{key:"api",get:function(){return this.apiImpl}}]),t}(h.default)},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return 0===e.button}function a(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function u(e){var t=e.callback,n=e.rootElement,r=e.attributePrefix,o=e.traverseParent,i=new h({attributePrefix:r,traverseParent:o});return i.listen(t,n)}Object.defineProperty(t,"__esModule",{value:!0}),t.TrackBindingPlugin=void 0;var 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},s=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.default=u;var f=n(28),l=r(f),p=n(16),d=r(p),h=t.TrackBindingPlugin=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.attributePrefix,r=void 0===n?"data-metrics":n,i=t.traverseParent,a=void 0!==i&&i;o(this,e),this._attributePrefix=r,this._traverseParent=a}return s(e,[{key:"listen",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.body;if("function"!=typeof e)throw new Error("callback needs to be a function.");if(t&&1!==t.nodeType)throw new Error("rootElement needs to be a valid node element.");return this._clickHandler&&this.remove(),this._rootElement=t,this._clickHandler=l.default.listen(t,"click",this._handleClick.bind(this,e)),{target:this,remove:this.remove.bind(this)}}},{key:"remove",value:function(){this._clickHandler&&(this._clickHandler.remove(),this._clickHandler=null)}},{key:"_handleClick",value:function(e,t){if(!a(t)&&i(t)){var n=t.target||t.srcElement,r=this._getData(n);if(this._traverseParent)for(var o=this._rootElement;n!==o;)n=n.parentElement||n.parentNode,r=c({},this._getData(n),r);if(Object.keys(r).length){var u=r&&r.eventName,s=r&&r.mergePagedefaults;delete r.mergePagedefaults,u&&(delete r.eventName,e(u,r,"true"===s))}}}},{key:"_getData",value:function(e){return(0,d.default)(e,this._attributePrefix)}}]),e}()},function(e,t){function n(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 r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"function";return Object.getOwnPropertyNames(e).filter(function(r){return t.indexOf(r)===-1&&u.indexOf(r)===-1&&0!==r.indexOf("_")&&e.hasOwnProperty(r)&&a(e[r])===n})}function o(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=[];null!==e;){var i=r(e,t);o.push.apply(o,n(i)),e=Object.getPrototypeOf(e)}return o}function i(e){e=Array.isArray(e)?e:[e];var t=e.reduce(function(e,t){var r=t.constructor===Object?t:Object.getPrototypeOf(t),i=o(r,e);return e.push.apply(e,n(i)),e},[]);return t}Object.defineProperty(t,"__esModule",{value:!0});var a="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};t.filterKeysByType=r,t.aggregateApisByType=o,t.default=i;var u=["constructor"].concat(Object.getOwnPropertyNames(Object.getPrototypeOf({})))},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(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 a(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(){return O}function c(){O.length=0}function s(e){return e.displayName||e.name||"Component"}function f(e){var t,n,r=(n=t=function(t){function n(){return o(this,n),i(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return a(n,t),d(n,[{key:"componentWillMount",value:function(){v.canUseDOM&&O.push(n)}},{key:"componentWillUnmount",value:function(){var e=O.indexOf(this);O.splice(e,1)}},{key:"render",value:function(){return y.default.createElement(e,p({},this.props,this.context))}}]),n}(h.Component),t.displayName="Metrics("+s(e)+")",t.contextTypes={metrics:_.default.metrics},n);return(0,b.default)(r,e)}function l(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return"function"==typeof t[0]?f.apply(void 0,t):function(e){return f.apply(void 0,[e].concat(t))}}Object.defineProperty(t,"__esModule",{value:!0});var p=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(){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.getMountedInstances=u,t.clearMountedInstances=c,t.default=l;var h=n(6),y=r(h),v=n(3),m=n(13),b=r(m),g=n(1),_=r(g),O=[]},function(e,t,n){"use strict";var r=n(4),o=r;e.exports=o},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 u=0;u<a.length;++u)if(!(n[a[u]]||r[a[u]]||i&&i[a[u]]))try{e[a[u]]=t[a[u]]}catch(e){}}return e}},function(e,n){e.exports=t},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=(0,l.aggregateApisByType)(e);return t.length>0}function a(){function e(){var e=n;return new e(t)}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.api,r=d;if("function"==typeof n){var o=void 0;try{o=n(t)}catch(e){}finally{o&&i(o)||(o=e()),i(o)&&(r=o)}}else n&&"object"===("undefined"==typeof n?"undefined":c(n))&&i(n)&&(r=n);var a=t.name||r.name;return{name:a,apis:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.defaultService=void 0;var u,c="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};t.default=a;var s=n(7),f=r(s),l=n(10),p=function(){},d=t.defaultService=(u={},o(u,f.default.PAGE_VIEW,p),o(u,f.default.TRACK,p),u)},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"data",n=e.attributes,r={},o=/-([\da-z])/gi,i=function(e,t){return t.toUpperCase()},a=function(e){return e.replace(o,i)};if(1===e.nodeType)for(var u=n.length;u--;){var c=n[u].name;if(0===c.indexOf(t+"-")){var s=a(c.slice(t.length+1));r[s]=e.getAttribute(c)}}return r};t.default=n},function(e,t){function n(e){return e&&"function"==typeof e.then}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}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 u(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}),t.default=void 0;var c,s,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}}(),l=n(6),p=n(5),d=r(p),h=n(14),y=r(h),v=n(2),m=r(v),b=n(12),g=r(b),_=n(1),O=r(_),k=n(9),w=r(k),P=(s=c=function(e){function t(){return i(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,e),f(t,[{key:"componentDidMount",value:function(){var e=this.context,t=e.metrics,n=e._metricsConfig;(0,m.default)(t,"MetricsElement requires metrics HOC to exist in the parent tree.");var r=n.useTrackBinding,o=n.attributePrefix,i=n.suppressTrackBindingWarning;i||(0,g.default)(!r,"You are using 'MetricsElement' while default track binding is turned on. It is recommended that you stick with either one to avoid double tracking accidentally. If you intentionally use both and want to suppress this warning, pass 'suppressTrackBindingWarning=true' to the metrics options."),this._trackBindingListener=(0,w.default)({callback:this._handleClick.bind(this),rootElement:y.default.findDOMNode(this),attributePrefix:o,traverseParent:!0})}},{key:"componentWillUnmount",value:function(){this._trackBindingListener&&(this._trackBindingListener.remove(),this._trackBindingListener=null)}},{key:"_handleClick",value:function(){var e;(e=this.context.metrics).track.apply(e,arguments)}},{key:"render",value:function(){var e=this.props,t=e.element,n=e.children,r=o(e,["element","children"]);return t?(0,l.isValidElement)(t)?(0,l.cloneElement)(t,r):(0,l.createElement)(t,r,n):l.Children.only(n)}}]),t}(l.Component),c.contextTypes={metrics:O.default.metrics,_metrics:d.default.object,_metricsConfig:d.default.object},c.propTypes={children:d.default.node,element:d.default.any},s);t.default=P},function(e,t,n){function r(){var e=(0,o.getMountedInstances)(),t=e&&e.length>0&&e[e.length-1];return t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(11)},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return Object.keys(e).reduce(function(t,n){return t[n]=e[n],t},{params:t})}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,s.default)(e.location)&&!(0,u.default)(t.location,e.location)){var n=e.location,r=e.params;if(n.params||!r)return n;var i=o(n,r);return i}return null}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var a=n(22),u=r(a),c=n(21),s=r(c)},function(e,t){function n(e){return!!e&&"object"===("undefined"==typeof e?"undefined":r(e))&&e.hasOwnProperty("pathname")&&e.hasOwnProperty("hash")&&e.hasOwnProperty("search")&&e.hasOwnProperty("state")}Object.defineProperty(t,"__esModule",{value:!0});var r="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};t.default=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return!e&&!t||!(e&&!t||!e&&t)&&(e.pathname===t.pathname&&e.search===t.search&&(0,a.default)(e.state,t.state))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=n(24),a=r(i)},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function o(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 a(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 e.displayName||e.name||"Component"}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.autoTrackPageView!==!1,r=t.useTrackBinding!==!1,c=t.attributePrefix,d=!!t.suppressTrackBindingWarning,y=t.getRouteState||P.default,m=t.findRouteComponent||T.default,w=(0,O.isMetrics)(e)?e:(0,k.default)(e);return function(e){var t,O,k=(O=t=function(t){function l(){return o(this,l),i(this,(l.__proto__||Object.getPrototypeOf(l)).apply(this,arguments))}return a(l,t),f(l,[{key:"componentWillMount",value:function(){if(g.canUseDOM){var t=this.constructor.getMountedMetricsInstances();1===t.length&&(0,b.default)(!1,"`metrics` should only be added once to the root level component. You have added to both %s and %s.",u(t[0]),u(e)),t.push(e),this._newRouteState=y(this.props),this._newRouteState&&this._getMetrics().setRouteState(this._newRouteState)}}},{key:"componentDidMount",value:function(){if(r){var e=v.default.findDOMNode(this);(0,b.default)(e,"`metrics` should be added to the root most component which renders node element for declarative tracking to work."),this._getMetrics().useTrackBinding(e,c)}this._newRouteState&&(this._handleRouteStateChange(this._newRouteState),this._newRouteState=null)}},{key:"componentWillReceiveProps",value:function(e){this._newRouteState=y(e,this.props),this._newRouteState&&this._getMetrics().setRouteState(this._newRouteState)}},{key:"componentDidUpdate",value:function(){this._newRouteState&&(this._handleRouteStateChange(this._newRouteState),this._newRouteState=null)}},{key:"componentWillUnmount",value:function(){var t=this.constructor.getMountedMetricsInstances(),n=t.indexOf(e);t.splice(n,1),this._getMetrics().destroy()}},{key:"getChildContext",value:function(){return{metrics:this._getMetrics().api,_metricsConfig:{autoTrackPageView:n,useTrackBinding:r,attributePrefix:c,suppressTrackBindingWarning:d,getNewRouteState:y,findNewRouteComponent:m}}}},{key:"_getMetrics",value:function(){return w}},{key:"_handleRouteStateChange",value:function(e){var t=m(),r=this._getMetrics(),o=void 0,i=!1;if(t){var a=t.willTrackPageView&&t.willTrackPageView(e);a===!1?i=!0:a&&(o=a)}r.enabled&&n&&!i&&((0,b.default)("function"==typeof r.api.pageView,"react-metrics: 'pageView' api needs to be defined for automatic page view tracking."),r.api.pageView(o))}},{key:"render",value:function(){return p.default.createElement(e,s({},this.props,this.getChildContext()))}}],[{key:"getMountedMetricsInstances",value:function(){return M||(M=[]),M}}]),l}(l.Component),t.displayName="MetricsContainer",t.childContextTypes={metrics:_.metrics.isRequired,_metricsConfig:h.default.object},t.propTypes={location:_.location,params:h.default.object},O);return(0,E.default)(k,e)}}Object.defineProperty(t,"__esModule",{value:!0});var s=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(){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.default=c;var l=n(6),p=r(l),d=n(5),h=r(d),y=n(14),v=r(y),m=n(2),b=r(m),g=n(3),_=n(1),O=n(8),k=r(O),w=n(20),P=r(w),j=n(19),T=r(j),x=n(13),E=r(x),M=void 0},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,f;if(r(e)||r(t))return!1;if(e.prototype!==t.prototype)return!1;if(c(e))return!!c(t)&&(e=a.call(e),t=a.call(t),s(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 l=u(e),p=u(t)}catch(e){return!1}if(l.length!=p.length)return!1;for(l.sort(),p.sort(),i=l.length-1;i>=0;i--)if(l[i]!=p[i])return!1;for(i=l.length-1;i>=0;i--)if(f=l[i],!s(e[f],t[f],n))return!1;return typeof e==typeof t}var a=Array.prototype.slice,u=n(26),c=n(25),s=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(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(){}var i=Object.prototype.hasOwnProperty,a="function"!=typeof Object.create&&"~";o.prototype._events=void 0,o.prototype.eventNames=function(){var e,t=this._events,n=[];if(!t)return n;for(e in t)i.call(t,e)&&n.push(a?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(e,t){var n=a?a+e:e,r=this._events&&this._events[n];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,u=new Array(i);o<i;o++)u[o]=r[o].fn;return u},o.prototype.emit=function(e,t,n,r,o,i){var u=a?a+e:e;if(!this._events||!this._events[u])return!1;var c,s,f=this._events[u],l=arguments.length;if("function"==typeof f.fn){switch(f.once&&this.removeListener(e,f.fn,void 0,!0),l){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,t),!0;case 3:return f.fn.call(f.context,t,n),!0;case 4:return f.fn.call(f.context,t,n,r),!0;case 5:return f.fn.call(f.context,t,n,r,o),!0;case 6:return f.fn.call(f.context,t,n,r,o,i),!0}for(s=1,c=new Array(l-1);s<l;s++)c[s-1]=arguments[s];f.fn.apply(f.context,c)}else{var p,d=f.length;for(s=0;s<d;s++)switch(f[s].once&&this.removeListener(e,f[s].fn,void 0,!0),l){case 1:f[s].fn.call(f[s].context);break;case 2:f[s].fn.call(f[s].context,t);break;case 3:f[s].fn.call(f[s].context,t,n);break;default:if(!c)for(p=1,c=new Array(l-1);p<l;p++)c[p-1]=arguments[p];f[s].fn.apply(f[s].context,c)}}return!0},o.prototype.on=function(e,t,n){var o=new r(t,n||this),i=a?a+e:e;return this._events||(this._events=a?{}:Object.create(null)),this._events[i]?this._events[i].fn?this._events[i]=[this._events[i],o]:this._events[i].push(o):this._events[i]=o,this},o.prototype.once=function(e,t,n){var o=new r(t,n||this,!0),i=a?a+e:e;return this._events||(this._events=a?{}:Object.create(null)),this._events[i]?this._events[i].fn?this._events[i]=[this._events[i],o]:this._events[i].push(o):this._events[i]=o,this},o.prototype.removeListener=function(e,t,n,r){var o=a?a+e:e;if(!this._events||!this._events[o])return this;var i=this._events[o],u=[];if(t)if(i.fn)(i.fn!==t||r&&!i.once||n&&i.context!==n)&&u.push(i);else for(var c=0,s=i.length;c<s;c++)(i[c].fn!==t||r&&!i[c].once||n&&i[c].context!==n)&&u.push(i[c]);return u.length?this._events[o]=1===u.length?u[0]:u:delete this._events[o],this},o.prototype.removeAllListeners=function(e){return this._events?(e?delete this._events[a?a+e:e]:this._events=a?{}:Object.create(null),this):this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prototype.setMaxListeners=function(){return this},o.prefixed=a,e.exports=o},function(e,t,n){"use strict";var r=n(4),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};e.exports=o},function(e,t,n){"use strict";var r=n(4),o=n(2),i=n(30);e.exports=function(){function e(e,t,n,r,a,u){u!==i&&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){"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,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,o){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys); | ||
var c=e.length;u>0&&c>u&&(c=u);for(var s=0;s<c;++s){var f,l,p,d,h=e[s].replace(a,"%20"),y=h.indexOf(r);y>=0?(f=h.substr(0,y),l=h.substr(y+1)):(f=h,l=""),p=decodeURIComponent(f),d=decodeURIComponent(l),n(i,p)?Array.isArray(i[p])?i[p].push(d):i[p]=[i[p],d]:i[p]=d}return i}},function(e,t){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(o){var i=encodeURIComponent(n(o))+r;return Array.isArray(e[o])?e[o].map(function(e){return i+encodeURIComponent(n(e))}).join(t):i+encodeURIComponent(n(e[o]))}).join(t):o?encodeURIComponent(n(o))+r+encodeURIComponent(n(e)):""}},function(e,t,n){"use strict";t.decode=t.parse=n(31),t.encode=t.stringify=n(32)}])}); |
@@ -201,2 +201,5 @@ Object.defineProperty(exports, "__esModule", { | ||
} | ||
/* eslint-disable consistent-return */ | ||
}, { | ||
@@ -290,7 +293,22 @@ key: "useTrackBinding", | ||
requestPromise.isTimeout = false; | ||
requestPromise.timer = setTimeout(process.bind(requestPromise), requestTimeout, { name: name, params: params, error: new Error("Request time out after " + requestTimeout + " ms."), status: "failure" }); | ||
requestPromise.timer = setTimeout(process.bind(requestPromise), requestTimeout, { | ||
name: name, | ||
params: params, | ||
error: new Error("Request time out after " + requestTimeout + " ms."), | ||
status: "failure" | ||
}); | ||
return requestPromise.then(function (response) { | ||
return { name: name, params: params, response: response, status: "success" }; | ||
return { | ||
name: name, | ||
params: params, | ||
response: response, | ||
status: "success" | ||
}; | ||
}).catch(function (error) { | ||
return { name: name, params: params, error: error, status: "failure" }; | ||
return { | ||
name: name, | ||
params: params, | ||
error: error, | ||
status: "failure" | ||
}; | ||
}).then(process.bind(requestPromise)); | ||
@@ -297,0 +315,0 @@ }); |
@@ -101,3 +101,3 @@ Object.defineProperty(exports, "__esModule", { | ||
while (elem !== rootElement) { | ||
elem = elem.parentElement; | ||
elem = elem.parentElement || elem.parentNode; | ||
dataset = _extends({}, this._getData(elem), dataset); | ||
@@ -136,4 +136,7 @@ } | ||
var trackBindingPlugin = new TrackBindingPlugin({ attributePrefix: attributePrefix, traverseParent: traverseParent }); | ||
var trackBindingPlugin = new TrackBindingPlugin({ | ||
attributePrefix: attributePrefix, | ||
traverseParent: traverseParent | ||
}); | ||
return trackBindingPlugin.listen(callback, rootElement); | ||
} |
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
@@ -4,0 +4,0 @@ exports.PropTypes = exports.MetricsElement = exports.exposeMetrics = exports.metrics = exports.createMetrics = undefined; |
@@ -64,4 +64,4 @@ Object.defineProperty(exports, "__esModule", { | ||
var autoTrackPageView = options.autoTrackPageView === false ? false : true; | ||
var useTrackBinding = options.useTrackBinding === false ? false : true; | ||
var autoTrackPageView = options.autoTrackPageView !== false; | ||
var useTrackBinding = options.useTrackBinding !== false; | ||
var attributePrefix = options.attributePrefix; | ||
@@ -86,17 +86,2 @@ var suppressTrackBindingWarning = !!options.suppressTrackBindingWarning; | ||
_createClass(MetricsContainer, [{ | ||
key: "getChildContext", | ||
value: function getChildContext() { | ||
return { | ||
metrics: this._getMetrics().api, | ||
_metricsConfig: { | ||
autoTrackPageView: autoTrackPageView, | ||
useTrackBinding: useTrackBinding, | ||
attributePrefix: attributePrefix, | ||
suppressTrackBindingWarning: suppressTrackBindingWarning, | ||
getNewRouteState: getNewRouteState, | ||
findNewRouteComponent: findNewRouteComponent | ||
} | ||
}; | ||
} | ||
}, { | ||
key: "componentWillMount", | ||
@@ -161,2 +146,17 @@ value: function componentWillMount() { | ||
}, { | ||
key: "getChildContext", | ||
value: function getChildContext() { | ||
return { | ||
metrics: this._getMetrics().api, | ||
_metricsConfig: { | ||
autoTrackPageView: autoTrackPageView, | ||
useTrackBinding: useTrackBinding, | ||
attributePrefix: attributePrefix, | ||
suppressTrackBindingWarning: suppressTrackBindingWarning, | ||
getNewRouteState: getNewRouteState, | ||
findNewRouteComponent: findNewRouteComponent | ||
} | ||
}; | ||
} | ||
}, { | ||
key: "_getMetrics", | ||
@@ -163,0 +163,0 @@ value: function _getMetrics() { |
{ | ||
"name": "react-metrics", | ||
"description": "An analytics library for React.js", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"main": "lib/index.js", | ||
@@ -46,3 +46,3 @@ "contributors": [ | ||
"babel-core": "^6.5.1", | ||
"babel-eslint": "^6.0.2", | ||
"babel-eslint": "^7.2.3", | ||
"babel-loader": "^6.2.3", | ||
@@ -59,7 +59,10 @@ "babel-plugin-transform-decorators-legacy": "^1.3.4", | ||
"cz-conventional-changelog": "^1.1.5", | ||
"eslint": "2.4.0", | ||
"eslint-config-nfl": "6.1.0", | ||
"eslint-plugin-import": "1.0.4", | ||
"eslint-plugin-mocha": "2.0.0", | ||
"eslint-plugin-react": "4.2.1", | ||
"eslint": "^3.19.0", | ||
"eslint-config-nfl": "^11.1.0", | ||
"eslint-config-prettier": "^2.0.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^3.0.2", | ||
"eslint-plugin-mocha": "^4.8.0", | ||
"eslint-plugin-prettier": "^2.0.1", | ||
"eslint-plugin-react": "^7.1.0", | ||
"estraverse": "4.2.0", | ||
@@ -85,2 +88,3 @@ "estraverse-fb": "1.3.1", | ||
"path-to-regexp": "^1.2.1", | ||
"prettier": "^1.3.1", | ||
"prop-types": "^15.5.10", | ||
@@ -107,3 +111,3 @@ "react": "^15.0.1", | ||
"examples": "webpack-dev-server --config examples/webpack.config.js --content-base examples --inline", | ||
"lint": "eslint src test examples", | ||
"lint": "eslint src test examples --fix", | ||
"pretest": "npm run build", | ||
@@ -110,0 +114,0 @@ "prepublish": "npm run build && npm run build:umd && npm run build:umd:min", |
@@ -29,3 +29,2 @@ <img align="right" height="200" src="http://static.nfl.com/static/content/public/static/img/logos/nfl-engineering-light.svg" /> | ||
## Installation | ||
@@ -32,0 +31,0 @@ |
@@ -12,3 +12,5 @@ import EventEmitter from "eventemitter3"; | ||
const qs = canUseDOM ? querystring.decode(window.location.search.substr(1)) : {}; | ||
const qs = canUseDOM | ||
? querystring.decode(window.location.search.substr(1)) | ||
: {}; | ||
const defaults = { | ||
@@ -61,3 +63,5 @@ pageViewEvent: "pageLoad", | ||
// undocumented option for unit test. | ||
this.canUseDOM = (options.canUseDOM !== undefined) ? !!options.canUseDOM : canUseDOM; | ||
this.canUseDOM = options.canUseDOM !== undefined | ||
? !!options.canUseDOM | ||
: canUseDOM; | ||
if (!this.canUseDOM) { | ||
@@ -71,5 +75,9 @@ this.enabled = false; | ||
this.requestTimeout = options.requestTimeout || defaults.requestTimeout; | ||
this.cancelOnNext = options.cancelOnNext !== undefined ? !!options.cancelOnNext : true; | ||
this.vendors = Array.isArray(options.vendors) ? options.vendors : [options.vendors]; | ||
this.services = (this.vendors).map(vendor => createService(vendor)); | ||
this.cancelOnNext = options.cancelOnNext !== undefined | ||
? !!options.cancelOnNext | ||
: true; | ||
this.vendors = Array.isArray(options.vendors) | ||
? options.vendors | ||
: [options.vendors]; | ||
this.services = this.vendors.map(vendor => createService(vendor)); | ||
this.apiList = extractApis(this.services.map(service => service.apis)); | ||
@@ -116,2 +124,3 @@ this.transaction = new Transaction(); | ||
/* eslint-disable consistent-return */ | ||
useTrackBinding(rootElement, attributePrefix) { | ||
@@ -200,3 +209,6 @@ if (!this.enabled) { | ||
} | ||
let requestPromise = (apiExists && typeof apis[type] === "function") ? apis[type](...params) : undefined; | ||
let requestPromise = apiExists && | ||
typeof apis[type] === "function" | ||
? apis[type](...params) | ||
: undefined; | ||
if (!isPromise(requestPromise)) { | ||
@@ -209,7 +221,24 @@ requestPromise = Promise.resolve(requestPromise); | ||
requestTimeout, | ||
{name, params, error: new Error(`Request time out after ${requestTimeout} ms.`), status: "failure"} | ||
{ | ||
name, | ||
params, | ||
error: new Error( | ||
`Request time out after ${requestTimeout} ms.` | ||
), | ||
status: "failure" | ||
} | ||
); | ||
return requestPromise | ||
.then(response => ({name, params, response, status: "success"})) | ||
.catch(error => ({name, params, error, status: "failure"})) | ||
.then(response => ({ | ||
name, | ||
params, | ||
response, | ||
status: "success" | ||
})) | ||
.catch(error => ({ | ||
name, | ||
params, | ||
error, | ||
status: "failure" | ||
})) | ||
.then(process.bind(requestPromise)); | ||
@@ -267,3 +296,3 @@ }); | ||
promise = this._callServices(type, promise); | ||
const dispatchEvent = function (status, response, error) { | ||
const dispatchEvent = function(status, response, error) { | ||
const eventFacade = { | ||
@@ -290,3 +319,8 @@ type, | ||
.then(response => { | ||
dispatchEvent(response.every(item => item.status === "success") ? "success" : "failure", response); | ||
dispatchEvent( | ||
response.every(item => item.status === "success") | ||
? "success" | ||
: "failure", | ||
response | ||
); | ||
}) | ||
@@ -315,3 +349,8 @@ .catch(error => { | ||
_mergeWith(data, state) { | ||
return Object.assign({}, this._getDefaultData(state), this.customParams, data); | ||
return Object.assign( | ||
{}, | ||
this._getDefaultData(state), | ||
this.customParams, | ||
data | ||
); | ||
} | ||
@@ -329,3 +368,5 @@ /** | ||
return promise.then(data => { | ||
return this.transaction.get(tId).shouldCancel ? Promise.reject(new Error("Page view cancelled")) : data; | ||
return this.transaction.get(tId).shouldCancel | ||
? Promise.reject(new Error("Page view cancelled")) | ||
: data; | ||
}); | ||
@@ -344,7 +385,9 @@ } | ||
_addEventNameToPromise(eventName, promise, shouldMerge) { | ||
return promise.then(function (state, data) { | ||
data = [shouldMerge ? this._mergeWith(data, state) : data]; | ||
data.unshift(eventName); | ||
return data; | ||
}.bind(this, this.routeState)); | ||
return promise.then( | ||
function(state, data) { | ||
data = [shouldMerge ? this._mergeWith(data, state) : data]; | ||
data.unshift(eventName); | ||
return data; | ||
}.bind(this, this.routeState) | ||
); | ||
} | ||
@@ -373,3 +416,6 @@ /** | ||
// this might be confusing but for now, use the last argument as a flag for merge when it's boolean. | ||
if (args.length >= 3 && typeof args[args.length - 1] === "boolean") { | ||
if ( | ||
args.length >= 3 && | ||
typeof args[args.length - 1] === "boolean" | ||
) { | ||
shouldMerge = args[args.length - 1]; | ||
@@ -383,3 +429,5 @@ } | ||
params = eventName; | ||
eventName = (type === ActionTypes.PAGE_VIEW) ? this.pageViewEvent : null; | ||
eventName = type === ActionTypes.PAGE_VIEW | ||
? this.pageViewEvent | ||
: null; | ||
} | ||
@@ -399,3 +447,7 @@ | ||
if (eventName) { | ||
params = this._addEventNameToPromise(eventName, params, shouldMerge); | ||
params = this._addEventNameToPromise( | ||
eventName, | ||
params, | ||
shouldMerge | ||
); | ||
} | ||
@@ -462,6 +514,9 @@ args = [type, params]; | ||
destroy: metrics.destroy.bind(metrics), | ||
get enabled() {return metrics.enabled;}, | ||
get api() {return metrics.api;} | ||
get enabled() { | ||
return metrics.enabled; | ||
}, | ||
get api() { | ||
return metrics.api; | ||
} | ||
}; | ||
} | ||
@@ -5,3 +5,3 @@ /* eslint-disable no-empty */ | ||
const noop = function () {}; | ||
const noop = function() {}; | ||
@@ -8,0 +8,0 @@ function isService(obj) { |
@@ -13,3 +13,5 @@ import EventListener from "fbjs/lib/EventListener"; | ||
export class TrackBindingPlugin { | ||
constructor({attributePrefix = "data-metrics", traverseParent = false} = {}) { | ||
constructor( | ||
{attributePrefix = "data-metrics", traverseParent = false} = {} | ||
) { | ||
this._attributePrefix = attributePrefix; | ||
@@ -33,3 +35,7 @@ this._traverseParent = traverseParent; | ||
this._rootElement = rootElement; | ||
this._clickHandler = EventListener.listen(rootElement, "click", this._handleClick.bind(this, callback)); | ||
this._clickHandler = EventListener.listen( | ||
rootElement, | ||
"click", | ||
this._handleClick.bind(this, callback) | ||
); | ||
@@ -67,3 +73,3 @@ return { | ||
while (elem !== rootElement) { | ||
elem = elem.parentElement; | ||
elem = elem.parentElement || elem.parentNode; | ||
dataset = {...this._getData(elem), ...dataset}; | ||
@@ -92,5 +98,13 @@ } | ||
export default function useTrackBindingPlugin({callback, rootElement, attributePrefix, traverseParent}) { | ||
const trackBindingPlugin = new TrackBindingPlugin({attributePrefix, traverseParent}); | ||
export default function useTrackBindingPlugin({ | ||
callback, | ||
rootElement, | ||
attributePrefix, | ||
traverseParent | ||
}) { | ||
const trackBindingPlugin = new TrackBindingPlugin({ | ||
attributePrefix, | ||
traverseParent | ||
}); | ||
return trackBindingPlugin.listen(callback, rootElement); | ||
} |
@@ -1,2 +0,4 @@ | ||
const EXCLUDES = ["constructor"].concat(Object.getOwnPropertyNames(Object.getPrototypeOf({}))); | ||
const EXCLUDES = ["constructor"].concat( | ||
Object.getOwnPropertyNames(Object.getPrototypeOf({})) | ||
); | ||
@@ -17,3 +19,4 @@ export function filterKeysByType(obj, total = [], type = "function") { | ||
const keys = []; | ||
while (obj !== null) { // eslint-disable-line no-eq-null | ||
while (obj !== null) { | ||
// eslint-disable-line no-eq-null | ||
const arr = filterKeysByType(obj, total); | ||
@@ -30,3 +33,5 @@ keys.push(...arr); | ||
const apis = services.reduce((total, service) => { | ||
const obj = service.constructor === Object ? service : Object.getPrototypeOf(service); | ||
const obj = service.constructor === Object | ||
? service | ||
: Object.getPrototypeOf(service); | ||
const keys = aggregateApisByType(obj, total); | ||
@@ -33,0 +38,0 @@ total.push(...keys); |
@@ -7,8 +7,2 @@ import createMetrics from "./core/createMetrics"; | ||
export { | ||
createMetrics, | ||
metrics, | ||
exposeMetrics, | ||
MetricsElement, | ||
PropTypes | ||
}; | ||
export {createMetrics, metrics, exposeMetrics, MetricsElement, PropTypes}; |
@@ -44,5 +44,3 @@ import React, {Component} from "react"; | ||
render() { | ||
return ( | ||
<ComposedComponent {...this.props} {...this.context}/> | ||
); | ||
return <ComposedComponent {...this.props} {...this.context} />; | ||
} | ||
@@ -49,0 +47,0 @@ } |
@@ -5,11 +5,16 @@ import locationEquals from "./locationEquals"; | ||
function mergeParam(location, params) { | ||
return Object.keys(location).reduce((obj, key) => { | ||
obj[key] = location[key]; | ||
return obj; | ||
}, {params}); | ||
return Object.keys(location).reduce( | ||
(obj, key) => { | ||
obj[key] = location[key]; | ||
return obj; | ||
}, | ||
{params} | ||
); | ||
} | ||
export default function getRouteState(newProps, props = {}) { | ||
if (isLocationValid(newProps.location) && | ||
!locationEquals(props.location, newProps.location)) { | ||
if ( | ||
isLocationValid(newProps.location) && | ||
!locationEquals(props.location, newProps.location) | ||
) { | ||
// additional params for the dynamic segments of the URL if available. | ||
@@ -16,0 +21,0 @@ const {location, params} = newProps; |
@@ -19,9 +19,12 @@ import React, {Component} from "react"; | ||
export default function metrics(metricsOrConfig, options = {}) { | ||
const autoTrackPageView = options.autoTrackPageView === false ? false : true; | ||
const useTrackBinding = options.useTrackBinding === false ? false : true; | ||
const autoTrackPageView = options.autoTrackPageView !== false; | ||
const useTrackBinding = options.useTrackBinding !== false; | ||
const attributePrefix = options.attributePrefix; | ||
const suppressTrackBindingWarning = !!options.suppressTrackBindingWarning; | ||
const getNewRouteState = options.getRouteState || getRouteState; | ||
const findNewRouteComponent = options.findRouteComponent || findRouteComponent; | ||
const metricsInstance = isMetrics(metricsOrConfig) ? metricsOrConfig : createMetrics(metricsOrConfig); | ||
const findNewRouteComponent = | ||
options.findRouteComponent || findRouteComponent; | ||
const metricsInstance = isMetrics(metricsOrConfig) | ||
? metricsOrConfig | ||
: createMetrics(metricsOrConfig); | ||
@@ -32,9 +35,2 @@ return function wrap(ComposedComponent) { | ||
static getMountedMetricsInstances() { // eslint-disable-line react/sort-comp | ||
if (!mountedInstances) { | ||
mountedInstances = []; | ||
} | ||
return mountedInstances; | ||
} | ||
static childContextTypes = { | ||
@@ -50,14 +46,8 @@ metrics: metricsType.isRequired, | ||
getChildContext() { | ||
return { | ||
metrics: this._getMetrics().api, | ||
_metricsConfig: { | ||
autoTrackPageView, | ||
useTrackBinding, | ||
attributePrefix, | ||
suppressTrackBindingWarning, | ||
getNewRouteState, | ||
findNewRouteComponent | ||
} | ||
}; | ||
static getMountedMetricsInstances() { | ||
// eslint-disable-line react/sort-comp | ||
if (!mountedInstances) { | ||
mountedInstances = []; | ||
} | ||
return mountedInstances; | ||
} | ||
@@ -95,3 +85,6 @@ | ||
); | ||
this._getMetrics().useTrackBinding(rootElement, attributePrefix); | ||
this._getMetrics().useTrackBinding( | ||
rootElement, | ||
attributePrefix | ||
); | ||
} | ||
@@ -123,2 +116,17 @@ | ||
} | ||
getChildContext() { | ||
return { | ||
metrics: this._getMetrics().api, | ||
_metricsConfig: { | ||
autoTrackPageView, | ||
useTrackBinding, | ||
attributePrefix, | ||
suppressTrackBindingWarning, | ||
getNewRouteState, | ||
findNewRouteComponent | ||
} | ||
}; | ||
} | ||
_getMetrics() { | ||
@@ -141,3 +149,5 @@ return metricsInstance; | ||
if (component) { | ||
const ret = (component.willTrackPageView && component.willTrackPageView(routeState)); | ||
const ret = | ||
component.willTrackPageView && | ||
component.willTrackPageView(routeState); | ||
if (ret === false) { | ||
@@ -150,3 +160,7 @@ shouldSuppress = true; | ||
if (metricsInst.enabled && autoTrackPageView && !shouldSuppress) { | ||
if ( | ||
metricsInst.enabled && | ||
autoTrackPageView && | ||
!shouldSuppress | ||
) { | ||
invariant( | ||
@@ -167,3 +181,6 @@ typeof metricsInst.api.pageView === "function", | ||
return ( | ||
<ComposedComponent {...this.props} {...this.getChildContext()}/> | ||
<ComposedComponent | ||
{...this.props} | ||
{...this.getChildContext()} | ||
/> | ||
); | ||
@@ -170,0 +187,0 @@ } |
@@ -20,3 +20,3 @@ import { | ||
_metricsConfig: PropTypes.object | ||
} | ||
}; | ||
@@ -26,3 +26,3 @@ static propTypes = { | ||
element: PropTypes.any | ||
} | ||
}; | ||
@@ -37,3 +37,7 @@ componentDidMount() { | ||
const {useTrackBinding, attributePrefix, suppressTrackBindingWarning} = _metricsConfig; | ||
const { | ||
useTrackBinding, | ||
attributePrefix, | ||
suppressTrackBindingWarning | ||
} = _metricsConfig; | ||
@@ -44,4 +48,4 @@ if (!suppressTrackBindingWarning) { | ||
"You are using 'MetricsElement' while default track binding is turned on. " + | ||
"It is recommended that you stick with either one to avoid double tracking accidentally. " + | ||
"If you intentionally use both and want to suppress this warning, pass 'suppressTrackBindingWarning=true' to the metrics options." | ||
"It is recommended that you stick with either one to avoid double tracking accidentally. " + | ||
"If you intentionally use both and want to suppress this warning, pass 'suppressTrackBindingWarning=true' to the metrics options." | ||
); | ||
@@ -76,4 +80,6 @@ } | ||
return isValidElement(element) ? cloneElement(element, rest) : createElement(element, rest, children); | ||
return isValidElement(element) | ||
? cloneElement(element, rest) | ||
: createElement(element, rest, children); | ||
} | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
292098
5082
55
312