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

react-metrics

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-metrics - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

10

CHANGELOG.md

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

<a name="2.2.3"></a>
## [2.2.3](https://github.com/nfl/react-metrics/compare/v2.2.2...v2.2.3) (2016-10-31)
### Bug Fixes
* Don't throw invariant error for missing pageView api when `enabled` is set to `false` in the co ([e820662](https://github.com/nfl/react-metrics/commit/e820662))
<a name="2.2.2"></a>

@@ -2,0 +12,0 @@ ## [2.2.2](https://github.com/nfl/react-metrics/compare/v2.2.1...v2.2.2) (2016-10-22)

4

dist/react-metrics.min.js

@@ -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(6),i=r(o),a=n(22),u=r(a),c=n(1),s=r(c),f=n(9),l=r(f),p=n(17),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(2),o=r.PropTypes.shape,i=r.PropTypes.object,a=r.PropTypes.string,u=t.metrics=i,c=t.location=o({pathname:a.isRequired,search:a.isRequired,query:i,state:i});t["default"]={metrics:u,location:c}},function(t,n){t.exports=e},function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,o,i,a,u){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,o,i,a,u],f=0;c=new Error(t.replace(/%s/g,function(){return s[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}e.exports=r},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 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?"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(c){o=!0,i=c}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(26),h=r(d),y=n(30),v=r(y),m=n(3),b=n(4),g=r(b),_=n(11),O=r(_),k=n(5),w=r(k),P=n(14),j=r(P),T=n(8),x=r(T),M=n(16),E=r(M),S=n(7),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,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,E["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,E["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 d({attributePrefix:r,traverseParent:o});return i.listen(t,n)}Object.defineProperty(t,"__esModule",{value:!0}),t.TrackBindingPlugin=void 0;var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t["default"]=u;var s=n(27),f=r(s),l=n(15),p=r(l),d=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 c(e,[{key:"listen",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?document.body:arguments[1];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=f["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,r=this._getData(n);if(!Object.keys(r).length){if(!this._traverseParent)return;for(var o=this._rootElement;n!==o&&!Object.keys(r).length;)n=n.parentElement,r=this._getData(n);if(!Object.keys(r).length)return}var u=r&&r.eventName,c=r&&r.mergePagedefaults;delete r.mergePagedefaults,u?(delete r.eventName,e(u,r,"true"===c)):e(r,"true"===c)}}},{key:"_getData",value:function(e){return(0,p["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]?"function":arguments[2];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?"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,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(2),y=r(h),v=n(3),m=n(12),b=r(m),g=n(1),_=r(g),O=[]},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";var r=n(10),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(c){}}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(a){}finally{o&&i(o)||(o=e()),i(o)&&(r=o)}}else n&&"object"===("undefined"==typeof n?"undefined":c(n))&&i(n)&&(r=n);var u=t.name||r.name;return{name:u,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?"symbol":typeof e};t["default"]=a;var s=n(5),f=r(s),l=n(8),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]?"data":arguments[1],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(2),p=n(13),d=r(p),h=n(4),y=r(h),v=n(11),m=r(v),b=n(1),g=r(b),_=n(7),O=r(_),k=(s=c=function(e){function t(){return i(this,t),a(this,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,y["default"])(t,"MetricsElement requires metrics HOC to exist in the parent tree.");var r=n.useTrackBinding,o=n.attributePrefix,i=n.suppressTrackBindingWarning;i||(0,m["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,O["default"])({callback:this._handleClick.bind(this),rootElement:d["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:g["default"].metrics,_metrics:l.PropTypes.object,_metricsConfig:l.PropTypes.object},c.propTypes={children:l.PropTypes.node,element:l.PropTypes.any},s);t["default"]=k},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(9)},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(21),u=r(a),c=n(20),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?"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(23),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||k["default"],O=t.findRouteComponent||P["default"],w=(0,g.isMetrics)(e)?e:(0,_["default"])(e);return function(e){var t,g,_=(g=t=function(t){function l(){return o(this,l),i(this,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:O}}}},{key:"componentWillMount",value:function(){if(m.canUseDOM){var t=this.constructor.getMountedMetricsInstances();1===t.length&&(0,v["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&&w.setRouteState(this._newRouteState)}}},{key:"componentDidMount",value:function(){if(r){var e=h["default"].findDOMNode(this);(0,v["default"])(e,"`metrics` should be added to the root most component which renders node element for declarative tracking to work."),w.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&&w.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),w.destroy()}},{key:"_getMetrics",value:function(){return w}},{key:"_handleRouteStateChange",value:function(e){var t=O(),r=void 0,o=!1;if(t){var i=t.willTrackPageView&&t.willTrackPageView(e);i===!1?o=!0:i&&(r=i)}n&&!o&&((0,v["default"])("function"==typeof this._getMetrics().api.pageView,"react-metrics: 'pageView' api needs to be defined for automatic page view tracking."),this._getMetrics().api.pageView(r))}},{key:"render",value:function(){return p["default"].createElement(e,s({},this.props,this.getChildContext()))}}],[{key:"getMountedMetricsInstances",value:function(){return x||(x=[]),x}}]),l}(l.Component),t.displayName="MetricsContainer",t.childContextTypes={metrics:b.metrics.isRequired,_metricsConfig:l.PropTypes.object},t.propTypes={location:b.location,params:l.PropTypes.object},g);return(0,T["default"])(_,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(2),p=r(l),d=n(13),h=r(d),y=n(4),v=r(y),m=n(3),b=n(1),g=n(6),_=r(g),O=n(19),k=r(O),w=n(18),P=r(w),j=n(12),T=r(j),x=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(d){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(25),c=n(24),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(10),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){"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(28),t.encode=t.stringify=n(29)}])});
!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(6),i=r(o),a=n(22),u=r(a),c=n(1),s=r(c),f=n(9),l=r(f),p=n(17),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(2),o=r.PropTypes.shape,i=r.PropTypes.object,a=r.PropTypes.string,u=t.metrics=i,c=t.location=o({pathname:a.isRequired,search:a.isRequired,query:i,state:i});t["default"]={metrics:u,location:c}},function(t,n){t.exports=e},function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,o,i,a,u){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,o,i,a,u],f=0;c=new Error(t.replace(/%s/g,function(){return s[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}e.exports=r},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?"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(c){o=!0,i=c}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(26),h=r(d),y=n(30),v=r(y),m=n(3),b=n(4),g=r(b),_=n(11),O=r(_),k=n(5),w=r(k),P=n(14),j=r(P),T=n(8),x=r(T),M=n(16),E=r(M),S=n(7),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,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,E["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,E["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 d({attributePrefix:r,traverseParent:o});return i.listen(t,n)}Object.defineProperty(t,"__esModule",{value:!0}),t.TrackBindingPlugin=void 0;var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t["default"]=u;var s=n(27),f=r(s),l=n(15),p=r(l),d=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 c(e,[{key:"listen",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?document.body:arguments[1];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=f["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,r=this._getData(n);if(!Object.keys(r).length){if(!this._traverseParent)return;for(var o=this._rootElement;n!==o&&!Object.keys(r).length;)n=n.parentElement,r=this._getData(n);if(!Object.keys(r).length)return}var u=r&&r.eventName,c=r&&r.mergePagedefaults;delete r.mergePagedefaults,u?(delete r.eventName,e(u,r,"true"===c)):e(r,"true"===c)}}},{key:"_getData",value:function(e){return(0,p["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]?"function":arguments[2];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?"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,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(2),y=r(h),v=n(3),m=n(12),b=r(m),g=n(1),_=r(g),O=[]},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";var r=n(10),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(c){}}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(a){}finally{o&&i(o)||(o=e()),i(o)&&(r=o)}}else n&&"object"===("undefined"==typeof n?"undefined":c(n))&&i(n)&&(r=n);var u=t.name||r.name;return{name:u,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?"symbol":typeof e};t["default"]=a;var s=n(5),f=r(s),l=n(8),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]?"data":arguments[1],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(2),p=n(13),d=r(p),h=n(4),y=r(h),v=n(11),m=r(v),b=n(1),g=r(b),_=n(7),O=r(_),k=(s=c=function(e){function t(){return i(this,t),a(this,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,y["default"])(t,"MetricsElement requires metrics HOC to exist in the parent tree.");var r=n.useTrackBinding,o=n.attributePrefix,i=n.suppressTrackBindingWarning;i||(0,m["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,O["default"])({callback:this._handleClick.bind(this),rootElement:d["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:g["default"].metrics,_metrics:l.PropTypes.object,_metricsConfig:l.PropTypes.object},c.propTypes={children:l.PropTypes.node,element:l.PropTypes.any},s);t["default"]=k},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(9)},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(21),u=r(a),c=n(20),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?"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(23),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||k["default"],O=t.findRouteComponent||P["default"],w=(0,g.isMetrics)(e)?e:(0,_["default"])(e);return function(e){var t,g,_=(g=t=function(t){function l(){return o(this,l),i(this,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:O}}}},{key:"componentWillMount",value:function(){if(m.canUseDOM){var t=this.constructor.getMountedMetricsInstances();1===t.length&&(0,v["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=h["default"].findDOMNode(this);(0,v["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=O(),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,v["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 x||(x=[]),x}}]),l}(l.Component),t.displayName="MetricsContainer",t.childContextTypes={metrics:b.metrics.isRequired,_metricsConfig:l.PropTypes.object},t.propTypes={location:b.location,params:l.PropTypes.object},g);return(0,T["default"])(_,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(2),p=r(l),d=n(13),h=r(d),y=n(4),v=r(y),m=n(3),b=n(1),g=n(6),_=r(g),O=n(19),k=r(O),w=n(18),P=r(w),j=n(12),T=r(j),x=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(d){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(25),c=n(24),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(10),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){"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(28),t.encode=t.stringify=n(29)}])});

@@ -588,2 +588,5 @@ Object.defineProperty(exports, "__esModule", {

destroy: metrics.destroy.bind(metrics),
get enabled() {
return metrics.enabled;
},
get api() {

@@ -590,0 +593,0 @@ return metrics.api;

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

if (this._newRouteState) {
metricsInstance.setRouteState(this._newRouteState);
this._getMetrics().setRouteState(this._newRouteState);
}

@@ -122,3 +122,3 @@ }

(0, _invariant2.default)(rootElement, "`metrics` should be added to the root most component which renders node element for declarative tracking to work.");
metricsInstance.useTrackBinding(rootElement, attributePrefix);
this._getMetrics().useTrackBinding(rootElement, attributePrefix);
}

@@ -136,3 +136,3 @@

if (this._newRouteState) {
metricsInstance.setRouteState(this._newRouteState);
this._getMetrics().setRouteState(this._newRouteState);
}

@@ -155,3 +155,3 @@ }

metricsInstance.destroy();
this._getMetrics().destroy();
}

@@ -175,2 +175,3 @@ }, {

var component = findNewRouteComponent();
var metrics = this._getMetrics();
var pageViewParams = void 0;

@@ -188,5 +189,5 @@ var shouldSuppress = false;

if (autoTrackPageView && !shouldSuppress) {
(0, _invariant2.default)(typeof this._getMetrics().api.pageView === "function", "react-metrics: 'pageView' api needs to be defined for automatic page view tracking.");
this._getMetrics().api.pageView(pageViewParams);
if (metrics.enabled && autoTrackPageView && !shouldSuppress) {
(0, _invariant2.default)(typeof metrics.api.pageView === "function", "react-metrics: 'pageView' api needs to be defined for automatic page view tracking.");
metrics.api.pageView(pageViewParams);
}

@@ -193,0 +194,0 @@ }

{
"name": "react-metrics",
"description": "An analytics library for React.js",
"version": "2.2.2",
"version": "2.2.3",
"main": "lib/index.js",

@@ -6,0 +6,0 @@ "contributors": [

@@ -448,2 +448,3 @@ import EventEmitter from "eventemitter3";

destroy: metrics.destroy.bind(metrics),
get enabled() {return metrics.enabled;},
get api() {return metrics.api;}

@@ -450,0 +451,0 @@ };

@@ -80,3 +80,3 @@ import React, {PropTypes, Component} from "react";

if (this._newRouteState) {
metricsInstance.setRouteState(this._newRouteState);
this._getMetrics().setRouteState(this._newRouteState);
}

@@ -92,3 +92,3 @@ }

);
metricsInstance.useTrackBinding(rootElement, attributePrefix);
this._getMetrics().useTrackBinding(rootElement, attributePrefix);
}

@@ -104,3 +104,3 @@

if (this._newRouteState) {
metricsInstance.setRouteState(this._newRouteState);
this._getMetrics().setRouteState(this._newRouteState);
}

@@ -119,3 +119,3 @@ }

metricsInstance.destroy();
this._getMetrics().destroy();
}

@@ -134,2 +134,3 @@ _getMetrics() {

const component = findNewRouteComponent();
const metrics = this._getMetrics();
let pageViewParams;

@@ -147,8 +148,8 @@ let shouldSuppress = false;

if (autoTrackPageView && !shouldSuppress) {
if (metrics.enabled && autoTrackPageView && !shouldSuppress) {
invariant(
typeof this._getMetrics().api.pageView === "function",
typeof metrics.api.pageView === "function",
"react-metrics: 'pageView' api needs to be defined for automatic page view tracking."
);
this._getMetrics().api.pageView(pageViewParams);
metrics.api.pageView(pageViewParams);
}

@@ -155,0 +156,0 @@ }

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