Comparing version 0.0.3 to 0.0.4
@@ -1,1 +0,1 @@ | ||
"use strict";var $jscomp=$jscomp||{};$jscomp.scope={},$jscomp.ASSUME_ES5=!1,$jscomp.ASSUME_NO_NATIVE_MAP=!1,$jscomp.ASSUME_NO_NATIVE_SET=!1,$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){t!=Array.prototype&&t!=Object.prototype&&(t[e]=n.value)},$jscomp.getGlobal=function(t){return"undefined"!=typeof window&&window===t?t:"undefined"!=typeof global&&null!=global?global:t},$jscomp.global=$jscomp.getGlobal(this),$jscomp.SYMBOL_PREFIX="jscomp_symbol_",$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){},$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)},$jscomp.Symbol=function(){var t=0;return function(e){return $jscomp.SYMBOL_PREFIX+(e||"")+t++}}(),$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var t=$jscomp.global.Symbol.iterator;t||(t=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator")),"function"!=typeof Array.prototype[t]&&$jscomp.defineProperty(Array.prototype,t,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}}),$jscomp.initSymbolIterator=function(){}},$jscomp.arrayIterator=function(t){var e=0;return $jscomp.iteratorPrototype(function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}})},$jscomp.iteratorPrototype=function(t){return $jscomp.initSymbolIterator(),(t={next:t})[$jscomp.global.Symbol.iterator]=function(){return this},t},$jscomp.iteratorFromArray=function(t,e){$jscomp.initSymbolIterator(),t instanceof String&&(t+="");var n=0,r={next:function(){if(n<t.length){var o=n++;return{value:e(o,t[o]),done:!1}}return r.next=function(){return{done:!0,value:void 0}},r.next()}};return r[Symbol.iterator]=function(){return r},r},$jscomp.polyfill=function(t,e,n,r){if(e){for(n=$jscomp.global,t=t.split("."),r=0;r<t.length-1;r++){var o=t[r];o in n||(n[o]={}),n=n[o]}(e=e(r=n[t=t[t.length-1]]))!=r&&null!=e&&$jscomp.defineProperty(n,t,{configurable:!0,writable:!0,value:e})}},$jscomp.polyfill("Array.prototype.keys",function(t){return t||function(){return $jscomp.iteratorFromArray(this,function(t){return t})}},"es6","es3"),$jscomp.owns=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},$jscomp.polyfill("Object.assign",function(t){return t||function(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r)for(var o in r)$jscomp.owns(r,o)&&(t[o]=r[o])}return t}},"es6","es3"),$jscomp.polyfill("Array.from",function(t){return t||function(t,e,n){$jscomp.initSymbolIterator(),e=null!=e?e:function(t){return t};var r=[],o=t[Symbol.iterator];if("function"==typeof o)for(t=o.call(t);!(o=t.next()).done;)r.push(e.call(n,o.value));else{o=t.length;for(var i=0;i<o;i++)r.push(e.call(n,t[i]))}return r}},"es6","es3"),$jscomp.findInternal=function(t,e,n){t instanceof String&&(t=String(t));for(var r=t.length,o=0;o<r;o++){var i=t[o];if(e.call(n,i,o,t))return{i:o,v:i}}return{i:-1,v:void 0}},$jscomp.polyfill("Array.prototype.findIndex",function(t){return t||function(t,e){return $jscomp.findInternal(this,t,e).i}},"es6","es3"),$jscomp.makeIterator=function(t){$jscomp.initSymbolIterator();var e=t[Symbol.iterator];return e?e.call(t):$jscomp.arrayIterator(t)},$jscomp.FORCE_POLYFILL_PROMISE=!1,$jscomp.polyfill("Promise",function(t){function e(){this.batch_=null}function n(t){return t instanceof o?t:new o(function(e,n){e(t)})}if(t&&!$jscomp.FORCE_POLYFILL_PROMISE)return t;e.prototype.asyncExecute=function(t){return null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_()),this.batch_.push(t),this},e.prototype.asyncExecuteBatch_=function(){var t=this;this.asyncExecuteFunction(function(){t.executeBatch_()})};var r=$jscomp.global.setTimeout;e.prototype.asyncExecuteFunction=function(t){r(t,0)},e.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var t=this.batch_;this.batch_=[];for(var e=0;e<t.length;++e){var n=t[e];delete t[e];try{n()}catch(t){this.asyncThrow_(t)}}}this.batch_=null},e.prototype.asyncThrow_=function(t){this.asyncExecuteFunction(function(){throw t})};var o=function(t){this.state_=0,this.result_=void 0,this.onSettledCallbacks_=[];var e=this.createResolveAndReject_();try{t(e.resolve,e.reject)}catch(t){e.reject(t)}};o.prototype.createResolveAndReject_=function(){function t(t){return function(r){n||(n=!0,t.call(e,r))}}var e=this,n=!1;return{resolve:t(this.resolveTo_),reject:t(this.reject_)}},o.prototype.resolveTo_=function(t){if(t===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(t instanceof o)this.settleSameAsPromise_(t);else{t:switch(typeof t){case"object":var e=null!=t;break t;case"function":e=!0;break t;default:e=!1}e?this.resolveToNonPromiseObj_(t):this.fulfill_(t)}},o.prototype.resolveToNonPromiseObj_=function(t){var e=void 0;try{e=t.then}catch(t){return void this.reject_(t)}"function"==typeof e?this.settleSameAsThenable_(e,t):this.fulfill_(t)},o.prototype.reject_=function(t){this.settle_(2,t)},o.prototype.fulfill_=function(t){this.settle_(1,t)},o.prototype.settle_=function(t,e){if(0!=this.state_)throw Error("Cannot settle("+t+", "+e|"): Promise already settled in state"+this.state_);this.state_=t,this.result_=e,this.executeOnSettledCallbacks_()},o.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var t=this.onSettledCallbacks_,e=0;e<t.length;++e)t[e].call(),t[e]=null;this.onSettledCallbacks_=null}};var i=new e;return o.prototype.settleSameAsPromise_=function(t){var e=this.createResolveAndReject_();t.callWhenSettled_(e.resolve,e.reject)},o.prototype.settleSameAsThenable_=function(t,e){var n=this.createResolveAndReject_();try{t.call(e,n.resolve,n.reject)}catch(t){n.reject(t)}},o.prototype.then=function(t,e){function n(t,e){return"function"==typeof t?function(e){try{r(t(e))}catch(t){i(t)}}:e}var r,i,a=new o(function(t,e){r=t,i=e});return this.callWhenSettled_(n(t,r),n(e,i)),a},o.prototype.catch=function(t){return this.then(void 0,t)},o.prototype.callWhenSettled_=function(t,e){function n(){switch(r.state_){case 1:t(r.result_);break;case 2:e(r.result_);break;default:throw Error("Unexpected state: "+r.state_)}}var r=this;null==this.onSettledCallbacks_?i.asyncExecute(n):this.onSettledCallbacks_.push(function(){i.asyncExecute(n)})},o.resolve=n,o.reject=function(t){return new o(function(e,n){n(t)})},o.race=function(t){return new o(function(e,r){for(var o=$jscomp.makeIterator(t),i=o.next();!i.done;i=o.next())n(i.value).callWhenSettled_(e,r)})},o.all=function(t){var e=$jscomp.makeIterator(t),r=e.next();return r.done?n([]):new o(function(t,o){function i(e){return function(n){a[e]=n,0==--c&&t(a)}}var a=[],c=0;do{a.push(void 0),c++,n(r.value).callWhenSettled_(i(a.length-1),o),r=e.next()}while(!r.done)})},o},"es6","es3"),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.analytics=e()}(this,function(){function t(e,n,r){function o(t){if("function"!=typeof t)throw Error("Expected listener to be a function.");var e=!0;return l===s&&(l=s.slice()),l.push(t),function(){if(e){e=!1,l===s&&(l=s.slice());var n=l.indexOf(t);l.splice(n,1)}}}function i(t){var e;if(e=null!=t&&"object"==typeof t){if(null==t)var n=void 0===t?"[object Undefined]":"[object Null]";else if(A&&A in Object(t)){e=m.call(t,g);var r=t[g];try{t[g]=void 0,n=!0}catch(t){}var o=b.call(t);n&&(e?t[g]=r:delete t[g]),n=o}else n=E.call(t);e="[object Object]"==n}if(e?null===(n=_(t))?n=!0:n="function"==typeof(n=j.call(n,"constructor")&&n.constructor)&&n instanceof n&&S.call(n)==I:n=!1,!n)throw Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(f)throw Error("Reducers may not dispatch actions.");try{f=!0,u=c(u,t)}finally{f=!1}for(n=s=l,e=0;e<n.length;e++)(0,n[e])();return t}var a;if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw Error("Expected the enhancer to be a function.");return r(t)(e,n)}if("function"!=typeof e)throw Error("Expected the reducer to be a function.");var c=e,u=n,s=[],l=s,f=!1;return i({type:O.INIT}),(a={dispatch:i,subscribe:o,getState:function(){return u},replaceReducer:function(t){if("function"!=typeof t)throw Error("Expected the nextReducer to be a function.");c=t,i({type:O.INIT})}})[T]=function(){var t;return(t={subscribe:function(t){function e(){t.next&&t.next(u)}if("object"!=typeof t)throw new TypeError("Expected the observer to be an object.");return e(),{unsubscribe:o(e)}}})[T]=function(){return this},t},a}function e(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++){var o=e[r];"function"==typeof t[o]&&(n[o]=t[o])}var i=Object.keys(n),a=void 0;try{c=n,Object.keys(c).forEach(function(t){var e=c[t];if(void 0===e(void 0,{type:O.INIT}))throw Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===e(void 0,{type:"@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".")}))throw Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+O.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')})}catch(t){a=t}var c;return function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1];if(a)throw a;for(var r=!1,o={},c=0;c<i.length;c++){var u=i[c],s=t[u],l=(0,n[u])(s,e);if(void 0===l)throw t=e&&e.type,Error("Given action "+(t&&'"'+t.toString()+'"'||"an action")+', reducer "'+u+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.');o[u]=l,r=r||l!==s}return r?o:t}}function n(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return 0===e.length?function(t){return t}:1===e.length?e[0]:e.reduce(function(t,e){return function(){return t(e.apply(void 0,arguments))}})}function r(t){return decodeURIComponent(t).replace(/\+/g," ")}function o(t,e){return Object.keys(t).reduce(function(n,r){return(r=t[r])[e]?n.concat(r):n},[])}function i(){for(var t=0;t<arguments.length;++t)if("function"==typeof arguments[t])return arguments[t];return!1}function a(t){return function(e){return function(n){return function(r){var a=r.type,c=r.eventName,u=r.data,s=r.options,l=r.callback;if(a===k.TRACK_START){var f=function(t,e){var n={};return"object"===(void 0===t?"undefined":N(t))?n=t:"object"===(void 0===e?"undefined":N(e))&&(n=e),n}(c,u),p={eventName:c,payload:f,options:s};if(r.abort)return e.dispatch(R({type:k.TRACK_ABORT},p)),n(r);var d=o(t(),"track"),y=0,h=!1;d.filter(function(t){var e=s&&s.integrations;return(e=e&&!1===e[t.NAMESPACE])&&console.log("ABORT TRACK>>>>>",t.NAMESPACE,a),!e}).forEach(function(t){var n=t.NAMESPACE,r=0;!function o(){var a=e.getState(),v=R({},a,{options:s});if(!a.integrations[n].loaded)return 1e4<r?(e.dispatch(R({},p,{type:"trackingTimeout"})),!1):(r+=10,setTimeout(o,10),!1);t.track(c,f,v),h||(e.dispatch(R({type:k.TRACK},p)),h=!0),e.dispatch(R({type:"track:"+n,integration:n},p)),(y+=1)===d.length&&((v=i(u,s,l))&&v(a),e.dispatch(R({type:k.TRACK_COMPLETE},p)))}()})}return n(r)}}}}function c(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:F,e=arguments[1];switch(e.type){case k.PAGE:return Object.assign({},t,e.data);default:return t}}function u(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:B,e=arguments[1],n=t.initialized,r=e.campaign;switch(e.type){case k.SET_CAMPAIGN:return R({},t,{campaign:r});default:return n?t:R({},B,t,{initialized:!0})}}function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Y,e=arguments[1],n={};switch(e.type){case k.REGISTER_INTEGRATION:return n[e.name]={enabled:!0,loaded:!1,config:e.integration.config},R({},t,n);case k.INTEGRATION_LOADED:return(n={})[e.name]=R({},t[e.name],{loaded:!0}),R({},t,n);case k.INTEGRATION_FAILED:return n[e.name]=R({},t[e.name],{loaded:!1}),R({},t,n);case k.DISABLE_INTEGRATION:return n[e.name]=R({},t[e.name],{enabled:!1}),R({},t,n);default:return t}}function l(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:K,e=arguments[1],n=e.data;switch(e.type){case k.TRACK:return e=t.lastEvent?t.event:n,console.log(">>>>>>>>>>>> state.lastEvent",t.lastEvent),R({},t,{event:n,lastEvent:e});default:return t}}function f(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:U,e=arguments[1];switch(e.type){case k.IDENTIFY:return Object.assign({},t,{userId:e.userId,traits:R({},t.traits,e.traits)});default:return t}}function p(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},p=r.plugins||[],d=r.reducers||{},y=p.reduce(function(t,e){return"function"!=typeof e&&e.NAMESPACE&&(t[e.NAMESPACE]=e),t},{}),h=function(){return y};p=p.reduce(function(t,e){return"function"==typeof e?t.concat(e):t},[]).concat([G,(m=h,function(t){return function(e){return function(n){var r=n.type,a=n.userId,c=n.traits,u=n.options,s=n.callback;if(r===k.IDENTIFY_START){var l=o(m(),"identify"),f=0,p=!1;l.filter(function(t){var e=u&&u.integrations;return(e=e&&!1===e[t.NAMESPACE])&&console.log("ABORT Identify >>>>>",t.NAMESPACE,r),!e}).forEach(function(e){var n=e.NAMESPACE,r=0;!function o(){var d=t.getState();if(!d.integrations[n].loaded)return 1e4<r?(t.dispatch({type:"identifyTimeout",name:n}),!1):(r+=10,setTimeout(o,10),!1);if(p||(p=!0,t.dispatch({type:k.IDENTIFY,userId:a,traits:c,options:u})),e.identify(a,c,u),t.dispatch({type:"identify:"+n}),(f+=1)===l.length){var y=i(c,u,s);y&&y(d),t.dispatch({type:k.IDENTIFY_COMPLETE})}}()})}return e(n)}}}),a(h),(v=h,function(t){return function(e){return function(n){var r=n.type,a=n.data,c=n.options,u=n.callback;if(r===k.PAGE_START){var s=o(v(),"page"),l=0,f=!1;s.filter(function(t){var e=c&&c.integrations;return(e=e&&!1===e[t.NAMESPACE])&&console.log("ABORT PageView>>>>>",t.NAMESPACE,r),!e}).forEach(function(e){var n=e.NAMESPACE,r=0;!function o(){var p=t.getState(),d=D(),y=R({},p,{options:c});if(!p.integrations[n].loaded)return console.log("try again",n),1e4<r?(t.dispatch({type:"pageTimeout",name:n}),!1):(r+=10,setTimeout(o,10),!1);f||(t.dispatch({type:k.PAGE,data:d,options:c}),f=!0),e.page(d,y),t.dispatch({type:"page:"+n,data:d}),(l+=1)===s.length&&((p=i(a,c,u))&&p(t),t.dispatch({type:k.PAGE_COMPLETE}))}()})}return e(n)}}}),x]);var v,m,b,g=t(e(R({},{context:u,user:f,page:c,track:l,integrations:s},d)),{context:(b=r,Object.keys(b).reduce(function(t,e){return"plugins"===e||"reducers"===e?t:(t[e]=b[e],t)},{}))},n(function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t){return function(r,o,i){var a=(r=t(r,o,i)).dispatch;o=[];var c={getState:r.getState,dispatch:function(t){return a(t)}};return o=e.map(function(t){return t(c)}),a=n.apply(void 0,o)(r.dispatch),w({},r,{dispatch:a})}}}.apply(void 0,P(p))));g.dispatch({type:k.INITIALIZE});var E=Object.keys(y),A=0;return E.forEach(function(t,e){var n=y[t];if(g.dispatch({type:k.REGISTER_INTEGRATION,name:n.NAMESPACE,integration:n}),n&&n.initialize&&(n.initialize(n.config),n.loaded&&"function"==typeof n.loaded)){var r=0;!function t(){return 1e3<r?(g.dispatch({type:k.INTEGRATION_FAILED,name:n.NAMESPACE}),g.dispatch({type:"integration_failed:"+n.NAMESPACE}),!1):n.loaded()?(g.dispatch({type:k.INTEGRATION_LOADED,name:n.NAMESPACE}),g.dispatch({type:"integration_ready:"+n.NAMESPACE}),void((A+=1)===E.length&&g.dispatch({type:k.READY}))):(r++,setTimeout(t,10),!1)}()}}),{getState:function(t){var e=g.getState();return t?e[t]:e},dispatch:g.dispatch,subscribe:g.subscribe,replaceReducer:g.replaceReducer,emit:function(t){var e=R({type:t},1<arguments.length&&void 0!==arguments[1]?arguments[1]:{});g.dispatch(e)},track:function(t,e,n,r){return g.dispatch({type:k.TRACK_START,eventName:t,data:e,options:n,callback:r}),Promise.resolve()},page:function(t,e,n){return g.dispatch({type:k.PAGE_START,data:t,options:e,callback:n}),Promise.resolve()},identify:function(t,e,n,r){return g.dispatch(W(t,e,n,r)),Promise.resolve()},user:function(){return g.getState().user},ready:function(t){var e="function"==typeof t&&t;if(!e)return!1;var n=function(t){return function(n){return function(r){return r.type===k.READY&&e(r,t),n(r)}}};return C(n),function(){return M(n)}},on:function(t,e){var n="function"==typeof e&&e;if(!n)return!1;if("*"===t){var r=function(t){return function(e){return function(r){return n(r,t),e(r)}}};return C(r),function(){M(r)}}var o=function(e){return function(r){return function(o){return o.type===t&&n(o,e),r(o)}}};return C(o),function(){M(o)}},addIntegration:function(t){if("object"===(void 0===t?"undefined":N(t))){var e={};e[t.NAMESPACE]=t,y=R({},y,e),console.log("add new integration dynamically",y)}g.dispatch({type:k.REGISTER_INTEGRATION,name:t.NAMESPACE,integration:t})}}}var d="object"==typeof self&&self&&self.Object===Object&&self;d=("object"==typeof global&&global&&global.Object===Object&&global||d||Function("return this")()).Symbol;var y,h,v=Object.prototype,m=v.hasOwnProperty,b=v.toString,g=d?d.toStringTag:void 0,E=Object.prototype.toString,A=d?d.toStringTag:void 0,_=(y=Object.getPrototypeOf,h=Object,function(t){return y(h(t))}),S=Function.prototype.toString,j=Object.prototype.hasOwnProperty,I=S.call(Object),T=function(t){var e=t.Symbol;return"function"==typeof e?e.observable?t=e.observable:(t=e("observable"),e.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),O={INIT:"@@redux/INIT"},w=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},P=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)},$=[],x=function(t){return function(e){return function(r){var o={getState:t.getState,dispatch:function(e){return t.dispatch(e)}},i=$.map(function(t){return t(o)});return n.apply(void 0,P(i))(e)(r)}}},C=function(){var t;$=(t=$).concat.apply(t,arguments)},M=function(t){var e=$.findIndex(function(e){return e===t});-1!==e&&($=[].concat(P($.slice(0,e)),P($.slice(e+1))))},k={INITIALIZE:"analytics_init",READY:"ready",REGISTER_INTEGRATION:"integration_init",INTEGRATION_LOADED:"integration_ready",INTEGRATION_FAILED:"integration_failed",ENABLE_INTEGRATION:"enable_integration",DISABLE_INTEGRATION:"disable_integration",HANDLE_PARAMS:"params",SET_CAMPAIGN:"campaign",PAGE_START:"page_init",PAGE:"page",PAGE_COMPLETE:"page_complete",TRACK_START:"track_init",TRACK:"track",TRACK_COMPLETE:"track_complete",TRACK_ABORT:"track_abort",IDENTIFY_START:"identify_init",IDENTIFY:"identify",IDENTIFY_COMPLETE:"identify_complete"},G=function(t){return function(e){return function(n){if("INITIALIZE"===n.type){var o=function(t){if("undefined"==typeof window)return{};var e,n={},o=/([^&=]+)=?([^&]*)/g;if(!(t=t?(t=t.match(/\?(.*)/))&&t[1]?t[1].split("#")[0]:"":window.location.search.substring(1)))return!1;for(;e=o.exec(t);)if("-1"==e[1].indexOf("["))n[r(e[1])]=r(e[2]);else{var i=e[1].indexOf("["),a=e[1].slice(i+1,e[1].indexOf("]",i));i=r(e[1].slice(0,i)),"object"!==N(n[i])&&(n[r(i)]={},n[r(i)].length=0),a?n[r(i)][r(a)]=r(e[2]):Array.prototype.push.call(n[r(i)],r(e[2]))}return n}();if(o){t.dispatch({type:k.HANDLE_PARAMS,params:o});var i=Object.keys(o).reduce(function(t,e){return e.match(/utm_/)&&(t[e]=o[e]),t},{});Object.keys(i).length&&t.dispatch({type:k.SET_CAMPAIGN,campaign:i})}}return e(n)}}},L="undefined"!=typeof window,D=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return L?(t=R({title:document.title,url:window.location.href,path:window.location.pathname,hash:window.location.hash,search:window.location.search,width:window.innerWidth,height:window.innerHeight},t),document.referrer&&""!==document.referrer&&(t.referrer=document.referrer),t):t};window.getPageData=D;var F=D();d=void 0;var B={initialized:!1,app:null,version:null,os:{name:d=function(){if("undefined"==typeof navigator)return!1;var t=navigator.appVersion;return-1!==t.indexOf("Win")?"Windows":-1!==t.indexOf("Mac")?"MacOS":-1!==t.indexOf("X11")?"UNIX":-1!==t.indexOf("Linux")?"Linux":"Unknown OS"}()},userAgent:"undefined"!=typeof navigator?navigator.userAgent:"node",library:{name:"analytics",version:"0.0.2"},campaign:{}},Y={},K={event:{},lastEvent:null,history:[]},U={userId:null,anonymousId:function(){var t=localStorage.getItem("analytics_id");if(!t){t=[];for(var e=0;256>e;e++)t[e]=(16>e?"0":"")+e.toString(16);e=4294967295*Math.random()|0;var n=4294967295*Math.random()|0,r=4294967295*Math.random()|0,o=4294967295*Math.random()|0;t=t[255&e]+t[e>>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&n]+t[n>>8&255]+"-"+t[n>>16&15|64]+t[n>>24&255]+"-"+t[63&r|128]+t[r>>8&255]+"-"+t[r>>16&255]+t[r>>24&255]+t[255&o]+t[o>>8&255]+t[o>>16&255]+t[o>>24&255],localStorage.setItem("analytics_id",t)}return t}(),traits:{address:{city:"",country:"",postalCode:"",state:"",street:""},age:20,avatar:"http://url.com/thumbnail.jpg",birthday:122321212,createdAt:1111111,description:"Description of the user",email:"email@email.com",firstName:"david",lastName:"wells",name:"david wells",gender:"male",id:"String\tUnique ID in your database for a user",phone:"727-777-8888",title:"boss ceo",username:"davidwells"}},W=function(t,e,n,r){return console.log("identify",t,e,n),{type:k.IDENTIFY_START,userId:t,traits:e,options:n,callback:r}};return function(t){return console.log("GOGOGOGOGGOGOGOGO"),p(t)}}); | ||
"use strict";var $jscomp=$jscomp||{};$jscomp.scope={},$jscomp.ASSUME_ES5=!1,$jscomp.ASSUME_NO_NATIVE_MAP=!1,$jscomp.ASSUME_NO_NATIVE_SET=!1,$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){t!=Array.prototype&&t!=Object.prototype&&(t[e]=n.value)},$jscomp.getGlobal=function(t){return"undefined"!=typeof window&&window===t?t:"undefined"!=typeof global&&null!=global?global:t},$jscomp.global=$jscomp.getGlobal(this),$jscomp.SYMBOL_PREFIX="jscomp_symbol_",$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){},$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)},$jscomp.Symbol=function(){var t=0;return function(e){return $jscomp.SYMBOL_PREFIX+(e||"")+t++}}(),$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var t=$jscomp.global.Symbol.iterator;t||(t=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator")),"function"!=typeof Array.prototype[t]&&$jscomp.defineProperty(Array.prototype,t,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}}),$jscomp.initSymbolIterator=function(){}},$jscomp.arrayIterator=function(t){var e=0;return $jscomp.iteratorPrototype(function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}})},$jscomp.iteratorPrototype=function(t){return $jscomp.initSymbolIterator(),(t={next:t})[$jscomp.global.Symbol.iterator]=function(){return this},t},$jscomp.iteratorFromArray=function(t,e){$jscomp.initSymbolIterator(),t instanceof String&&(t+="");var n=0,r={next:function(){if(n<t.length){var o=n++;return{value:e(o,t[o]),done:!1}}return r.next=function(){return{done:!0,value:void 0}},r.next()}};return r[Symbol.iterator]=function(){return r},r},$jscomp.polyfill=function(t,e,n,r){if(e){for(n=$jscomp.global,t=t.split("."),r=0;r<t.length-1;r++){var o=t[r];o in n||(n[o]={}),n=n[o]}(e=e(r=n[t=t[t.length-1]]))!=r&&null!=e&&$jscomp.defineProperty(n,t,{configurable:!0,writable:!0,value:e})}},$jscomp.polyfill("Array.prototype.keys",function(t){return t||function(){return $jscomp.iteratorFromArray(this,function(t){return t})}},"es6","es3"),$jscomp.owns=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},$jscomp.polyfill("Object.assign",function(t){return t||function(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r)for(var o in r)$jscomp.owns(r,o)&&(t[o]=r[o])}return t}},"es6","es3"),$jscomp.polyfill("Array.from",function(t){return t||function(t,e,n){$jscomp.initSymbolIterator(),e=null!=e?e:function(t){return t};var r=[],o=t[Symbol.iterator];if("function"==typeof o)for(t=o.call(t);!(o=t.next()).done;)r.push(e.call(n,o.value));else{o=t.length;for(var i=0;i<o;i++)r.push(e.call(n,t[i]))}return r}},"es6","es3"),$jscomp.findInternal=function(t,e,n){t instanceof String&&(t=String(t));for(var r=t.length,o=0;o<r;o++){var i=t[o];if(e.call(n,i,o,t))return{i:o,v:i}}return{i:-1,v:void 0}},$jscomp.polyfill("Array.prototype.findIndex",function(t){return t||function(t,e){return $jscomp.findInternal(this,t,e).i}},"es6","es3"),$jscomp.makeIterator=function(t){$jscomp.initSymbolIterator();var e=t[Symbol.iterator];return e?e.call(t):$jscomp.arrayIterator(t)},$jscomp.FORCE_POLYFILL_PROMISE=!1,$jscomp.polyfill("Promise",function(t){function e(){this.batch_=null}function n(t){return t instanceof o?t:new o(function(e,n){e(t)})}if(t&&!$jscomp.FORCE_POLYFILL_PROMISE)return t;e.prototype.asyncExecute=function(t){return null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_()),this.batch_.push(t),this},e.prototype.asyncExecuteBatch_=function(){var t=this;this.asyncExecuteFunction(function(){t.executeBatch_()})};var r=$jscomp.global.setTimeout;e.prototype.asyncExecuteFunction=function(t){r(t,0)},e.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var t=this.batch_;this.batch_=[];for(var e=0;e<t.length;++e){var n=t[e];delete t[e];try{n()}catch(t){this.asyncThrow_(t)}}}this.batch_=null},e.prototype.asyncThrow_=function(t){this.asyncExecuteFunction(function(){throw t})};var o=function(t){this.state_=0,this.result_=void 0,this.onSettledCallbacks_=[];var e=this.createResolveAndReject_();try{t(e.resolve,e.reject)}catch(t){e.reject(t)}};o.prototype.createResolveAndReject_=function(){function t(t){return function(r){n||(n=!0,t.call(e,r))}}var e=this,n=!1;return{resolve:t(this.resolveTo_),reject:t(this.reject_)}},o.prototype.resolveTo_=function(t){if(t===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(t instanceof o)this.settleSameAsPromise_(t);else{t:switch(typeof t){case"object":var e=null!=t;break t;case"function":e=!0;break t;default:e=!1}e?this.resolveToNonPromiseObj_(t):this.fulfill_(t)}},o.prototype.resolveToNonPromiseObj_=function(t){var e=void 0;try{e=t.then}catch(t){return void this.reject_(t)}"function"==typeof e?this.settleSameAsThenable_(e,t):this.fulfill_(t)},o.prototype.reject_=function(t){this.settle_(2,t)},o.prototype.fulfill_=function(t){this.settle_(1,t)},o.prototype.settle_=function(t,e){if(0!=this.state_)throw Error("Cannot settle("+t+", "+e|"): Promise already settled in state"+this.state_);this.state_=t,this.result_=e,this.executeOnSettledCallbacks_()},o.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var t=this.onSettledCallbacks_,e=0;e<t.length;++e)t[e].call(),t[e]=null;this.onSettledCallbacks_=null}};var i=new e;return o.prototype.settleSameAsPromise_=function(t){var e=this.createResolveAndReject_();t.callWhenSettled_(e.resolve,e.reject)},o.prototype.settleSameAsThenable_=function(t,e){var n=this.createResolveAndReject_();try{t.call(e,n.resolve,n.reject)}catch(t){n.reject(t)}},o.prototype.then=function(t,e){function n(t,e){return"function"==typeof t?function(e){try{r(t(e))}catch(t){i(t)}}:e}var r,i,a=new o(function(t,e){r=t,i=e});return this.callWhenSettled_(n(t,r),n(e,i)),a},o.prototype.catch=function(t){return this.then(void 0,t)},o.prototype.callWhenSettled_=function(t,e){function n(){switch(r.state_){case 1:t(r.result_);break;case 2:e(r.result_);break;default:throw Error("Unexpected state: "+r.state_)}}var r=this;null==this.onSettledCallbacks_?i.asyncExecute(n):this.onSettledCallbacks_.push(function(){i.asyncExecute(n)})},o.resolve=n,o.reject=function(t){return new o(function(e,n){n(t)})},o.race=function(t){return new o(function(e,r){for(var o=$jscomp.makeIterator(t),i=o.next();!i.done;i=o.next())n(i.value).callWhenSettled_(e,r)})},o.all=function(t){var e=$jscomp.makeIterator(t),r=e.next();return r.done?n([]):new o(function(t,o){function i(e){return function(n){a[e]=n,0==--c&&t(a)}}var a=[],c=0;do{a.push(void 0),c++,n(r.value).callWhenSettled_(i(a.length-1),o),r=e.next()}while(!r.done)})},o},"es6","es3"),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.analytics=e()}(this,function(){function t(e,n,r){function o(t){if("function"!=typeof t)throw Error("Expected listener to be a function.");var e=!0;return l===s&&(l=s.slice()),l.push(t),function(){if(e){e=!1,l===s&&(l=s.slice());var n=l.indexOf(t);l.splice(n,1)}}}function i(t){var e;if(e=null!=t&&"object"==typeof t){if(null==t)var n=void 0===t?"[object Undefined]":"[object Null]";else if(A&&A in Object(t)){e=m.call(t,g);var r=t[g];try{t[g]=void 0,n=!0}catch(t){}var o=b.call(t);n&&(e?t[g]=r:delete t[g]),n=o}else n=E.call(t);e="[object Object]"==n}if(e?null===(n=_(t))?n=!0:n="function"==typeof(n=j.call(n,"constructor")&&n.constructor)&&n instanceof n&&S.call(n)==I:n=!1,!n)throw Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(f)throw Error("Reducers may not dispatch actions.");try{f=!0,u=c(u,t)}finally{f=!1}for(n=s=l,e=0;e<n.length;e++)(0,n[e])();return t}var a;if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw Error("Expected the enhancer to be a function.");return r(t)(e,n)}if("function"!=typeof e)throw Error("Expected the reducer to be a function.");var c=e,u=n,s=[],l=s,f=!1;return i({type:O.INIT}),(a={dispatch:i,subscribe:o,getState:function(){return u},replaceReducer:function(t){if("function"!=typeof t)throw Error("Expected the nextReducer to be a function.");c=t,i({type:O.INIT})}})[T]=function(){var t;return(t={subscribe:function(t){function e(){t.next&&t.next(u)}if("object"!=typeof t)throw new TypeError("Expected the observer to be an object.");return e(),{unsubscribe:o(e)}}})[T]=function(){return this},t},a}function e(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++){var o=e[r];"function"==typeof t[o]&&(n[o]=t[o])}var i=Object.keys(n),a=void 0;try{c=n,Object.keys(c).forEach(function(t){var e=c[t];if(void 0===e(void 0,{type:O.INIT}))throw Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===e(void 0,{type:"@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".")}))throw Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+O.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')})}catch(t){a=t}var c;return function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1];if(a)throw a;for(var r=!1,o={},c=0;c<i.length;c++){var u=i[c],s=t[u],l=(0,n[u])(s,e);if(void 0===l)throw t=e&&e.type,Error("Given action "+(t&&'"'+t.toString()+'"'||"an action")+', reducer "'+u+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.');o[u]=l,r=r||l!==s}return r?o:t}}function n(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return 0===e.length?function(t){return t}:1===e.length?e[0]:e.reduce(function(t,e){return function(){return t(e.apply(void 0,arguments))}})}function r(t){return decodeURIComponent(t).replace(/\+/g," ")}function o(t,e){return Object.keys(t).reduce(function(n,r){return(r=t[r])[e]?n.concat(r):n},[])}function i(){for(var t=0;t<arguments.length;++t)if("function"==typeof arguments[t])return arguments[t];return!1}function a(t){return function(e){return function(n){return function(r){var a=r.type,c=r.eventName,u=r.data,s=r.options,l=r.callback;if(a===k.TRACK_START){var f=function(t,e){var n={};return"object"===(void 0===t?"undefined":N(t))?n=t:"object"===(void 0===e?"undefined":N(e))&&(n=e),n}(c,u),p={eventName:c,payload:f,options:s};if(r.abort)return e.dispatch(R({type:k.TRACK_ABORT},p)),n(r);var d=o(t(),"track"),y=0,h=!1;d.filter(function(t){var e=s&&s.integrations;return(e=e&&!1===e[t.NAMESPACE])&&console.log("ABORT TRACK>>>>>",t.NAMESPACE,a),!e}).forEach(function(t){var n=t.NAMESPACE,r=0;!function o(){var a=e.getState(),v=R({},a,{options:s});if(!a.integrations[n].loaded)return 1e4<r?(e.dispatch(R({},p,{type:"trackingTimeout"})),!1):(r+=10,setTimeout(o,10),!1);t.track(c,f,v),h||(e.dispatch(R({type:k.TRACK},p)),h=!0),e.dispatch(R({type:"track:"+n,integration:n},p)),(y+=1)===d.length&&((v=i(u,s,l))&&v(a),e.dispatch(R({type:k.TRACK_COMPLETE},p)))}()})}return n(r)}}}}function c(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:F,e=arguments[1];switch(e.type){case k.PAGE:return Object.assign({},t,e.data);default:return t}}function u(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:B,e=arguments[1],n=t.initialized,r=e.campaign;switch(e.type){case k.SET_CAMPAIGN:return R({},t,{campaign:r});default:return n?t:R({},B,t,{initialized:!0})}}function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Y,e=arguments[1],n={};switch(e.type){case k.REGISTER_INTEGRATION:return n[e.name]={enabled:!0,loaded:!1,config:e.integration.config},R({},t,n);case k.INTEGRATION_LOADED:return(n={})[e.name]=R({},t[e.name],{loaded:!0}),R({},t,n);case k.INTEGRATION_FAILED:return n[e.name]=R({},t[e.name],{loaded:!1}),R({},t,n);case k.DISABLE_INTEGRATION:return n[e.name]=R({},t[e.name],{enabled:!1}),R({},t,n);default:return t}}function l(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:K,e=arguments[1],n=e.data;switch(e.type){case k.TRACK:return e=t.lastEvent?t.event:n,console.log(">>>>>>>>>>>> state.lastEvent",t.lastEvent),R({},t,{event:n,lastEvent:e});default:return t}}function f(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:U,e=arguments[1];switch(e.type){case k.IDENTIFY:return Object.assign({},t,{userId:e.userId,traits:R({},t.traits,e.traits)});default:return t}}function p(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},p=r.plugins||[],d=r.reducers||{},y=p.reduce(function(t,e){return"function"!=typeof e&&e.NAMESPACE&&(t[e.NAMESPACE]=e),t},{}),h=function(){return y};p=p.reduce(function(t,e){return"function"==typeof e?t.concat(e):t},[]).concat([G,(m=h,function(t){return function(e){return function(n){var r=n.type,a=n.userId,c=n.traits,u=n.options,s=n.callback;if(r===k.IDENTIFY_START){var l=o(m(),"identify"),f=0,p=!1;l.filter(function(t){var e=u&&u.integrations;return(e=e&&!1===e[t.NAMESPACE])&&console.log("ABORT Identify >>>>>",t.NAMESPACE,r),!e}).forEach(function(e){var n=e.NAMESPACE,r=0;!function o(){var d=t.getState();if(!d.integrations[n].loaded)return 1e4<r?(t.dispatch({type:"identifyTimeout",name:n}),!1):(r+=10,setTimeout(o,10),!1);if(p||(p=!0,t.dispatch({type:k.IDENTIFY,userId:a,traits:c,options:u})),e.identify(a,c,u),t.dispatch({type:"identify:"+n}),(f+=1)===l.length){var y=i(c,u,s);y&&y(d),t.dispatch({type:k.IDENTIFY_COMPLETE})}}()})}return e(n)}}}),a(h),(v=h,function(t){return function(e){return function(n){var r=n.type,a=n.data,c=n.options,u=n.callback;if(r===k.PAGE_START){var s=o(v(),"page"),l=0,f=!1;s.filter(function(t){var e=c&&c.integrations;return(e=e&&!1===e[t.NAMESPACE])&&console.log("ABORT PageView>>>>>",t.NAMESPACE,r),!e}).forEach(function(e){var n=e.NAMESPACE,r=0;!function o(){var p=t.getState(),d=D(),y=R({},p,{options:c});if(!p.integrations[n].loaded)return console.log("try again",n),1e4<r?(t.dispatch({type:"pageTimeout",name:n}),!1):(r+=10,setTimeout(o,10),!1);f||(t.dispatch({type:k.PAGE,data:d,options:c}),f=!0),e.page(d,y),t.dispatch({type:"page:"+n,data:d}),(l+=1)===s.length&&((p=i(a,c,u))&&p(t),t.dispatch({type:k.PAGE_COMPLETE}))}()})}return e(n)}}}),x]);var v,m,b,g=t(e(R({},{context:u,user:f,page:c,track:l,integrations:s},d)),{context:(b=r,Object.keys(b).reduce(function(t,e){return"plugins"===e||"reducers"===e?t:(t[e]=b[e],t)},{}))},n(function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t){return function(r,o,i){var a=(r=t(r,o,i)).dispatch;o=[];var c={getState:r.getState,dispatch:function(t){return a(t)}};return o=e.map(function(t){return t(c)}),a=n.apply(void 0,o)(r.dispatch),w({},r,{dispatch:a})}}}.apply(void 0,P(p))));g.dispatch({type:k.INITIALIZE});var E=Object.keys(y),A=0;return E.forEach(function(t,e){var n=y[t];if(g.dispatch({type:k.REGISTER_INTEGRATION,name:n.NAMESPACE,integration:n}),n&&n.initialize&&(n.initialize(n.config),n.loaded&&"function"==typeof n.loaded)){var r=0;!function t(){return 1e3<r?(g.dispatch({type:k.INTEGRATION_FAILED,name:n.NAMESPACE}),g.dispatch({type:"integration_failed:"+n.NAMESPACE}),!1):n.loaded()?(g.dispatch({type:k.INTEGRATION_LOADED,name:n.NAMESPACE}),g.dispatch({type:"integration_ready:"+n.NAMESPACE}),void((A+=1)===E.length&&g.dispatch({type:k.READY}))):(r++,setTimeout(t,10),!1)}()}}),{getState:function(t){var e=g.getState();return t?e[t]:e},dispatch:g.dispatch,subscribe:g.subscribe,replaceReducer:g.replaceReducer,track:function(t,e,n,r){return g.dispatch({type:k.TRACK_START,eventName:t,data:e,options:n,callback:r}),Promise.resolve()},page:function(t,e,n){return g.dispatch({type:k.PAGE_START,data:t,options:e,callback:n}),Promise.resolve()},identify:function(t,e,n,r){return g.dispatch(W(t,e,n,r)),Promise.resolve()},user:function(){return g.getState().user},ready:function(t){var e="function"==typeof t&&t;if(!e)return!1;var n=function(t){return function(n){return function(r){return r.type===k.READY&&e(r,t),n(r)}}};return C(n),function(){return M(n)}},on:function(t,e){var n="function"==typeof e&&e;if(!n)return!1;if("*"===t){var r=function(t){return function(e){return function(r){return n(r,t),e(r)}}};return C(r),function(){M(r)}}var o=function(e){return function(r){return function(o){return o.type===t&&n(o,e),r(o)}}};return C(o),function(){M(o)}},addIntegration:function(t){if("object"===(void 0===t?"undefined":N(t))){var e={};e[t.NAMESPACE]=t,y=R({},y,e),console.log("add new integration dynamically",y)}g.dispatch({type:k.REGISTER_INTEGRATION,name:t.NAMESPACE,integration:t})}}}var d="object"==typeof self&&self&&self.Object===Object&&self;d=("object"==typeof global&&global&&global.Object===Object&&global||d||Function("return this")()).Symbol;var y,h,v=Object.prototype,m=v.hasOwnProperty,b=v.toString,g=d?d.toStringTag:void 0,E=Object.prototype.toString,A=d?d.toStringTag:void 0,_=(y=Object.getPrototypeOf,h=Object,function(t){return y(h(t))}),S=Function.prototype.toString,j=Object.prototype.hasOwnProperty,I=S.call(Object),T=function(t){var e=t.Symbol;return"function"==typeof e?e.observable?t=e.observable:(t=e("observable"),e.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),O={INIT:"@@redux/INIT"},w=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},P=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)},$=[],x=function(t){return function(e){return function(r){var o={getState:t.getState,dispatch:function(e){return t.dispatch(e)}},i=$.map(function(t){return t(o)});return n.apply(void 0,P(i))(e)(r)}}},C=function(){var t;$=(t=$).concat.apply(t,arguments)},M=function(t){var e=$.findIndex(function(e){return e===t});-1!==e&&($=[].concat(P($.slice(0,e)),P($.slice(e+1))))},k={INITIALIZE:"analytics_init",READY:"ready",REGISTER_INTEGRATION:"integration_init",INTEGRATION_LOADED:"integration_ready",INTEGRATION_FAILED:"integration_failed",ENABLE_INTEGRATION:"enable_integration",DISABLE_INTEGRATION:"disable_integration",HANDLE_PARAMS:"params",SET_CAMPAIGN:"campaign",PAGE_START:"page_init",PAGE:"page",PAGE_COMPLETE:"page_complete",TRACK_START:"track_init",TRACK:"track",TRACK_COMPLETE:"track_complete",TRACK_ABORT:"track_abort",IDENTIFY_START:"identify_init",IDENTIFY:"identify",IDENTIFY_COMPLETE:"identify_complete"},G=function(t){return function(e){return function(n){if("INITIALIZE"===n.type){var o=function(t){if("undefined"==typeof window)return{};var e,n={},o=/([^&=]+)=?([^&]*)/g;if(!(t=t?(t=t.match(/\?(.*)/))&&t[1]?t[1].split("#")[0]:"":window.location.search.substring(1)))return!1;for(;e=o.exec(t);)if("-1"==e[1].indexOf("["))n[r(e[1])]=r(e[2]);else{var i=e[1].indexOf("["),a=e[1].slice(i+1,e[1].indexOf("]",i));i=r(e[1].slice(0,i)),"object"!==N(n[i])&&(n[r(i)]={},n[r(i)].length=0),a?n[r(i)][r(a)]=r(e[2]):Array.prototype.push.call(n[r(i)],r(e[2]))}return n}();if(o){t.dispatch({type:k.HANDLE_PARAMS,params:o});var i=Object.keys(o).reduce(function(t,e){return e.match(/utm_/)&&(t[e]=o[e]),t},{});Object.keys(i).length&&t.dispatch({type:k.SET_CAMPAIGN,campaign:i})}}return e(n)}}},L="undefined"!=typeof window,D=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return L?(t=R({title:document.title,url:window.location.href,path:window.location.pathname,hash:window.location.hash,search:window.location.search,width:window.innerWidth,height:window.innerHeight},t),document.referrer&&""!==document.referrer&&(t.referrer=document.referrer),t):t};window.getPageData=D;var F=D();d=void 0;var B={initialized:!1,app:null,version:null,os:{name:d=function(){if("undefined"==typeof navigator)return!1;var t=navigator.appVersion;return-1!==t.indexOf("Win")?"Windows":-1!==t.indexOf("Mac")?"MacOS":-1!==t.indexOf("X11")?"UNIX":-1!==t.indexOf("Linux")?"Linux":"Unknown OS"}()},userAgent:"undefined"!=typeof navigator?navigator.userAgent:"node",library:{name:"analytics",version:"0.0.3"},campaign:{}},Y={},K={event:{},lastEvent:null,history:[]},U={userId:null,anonymousId:function(){var t=localStorage.getItem("analytics_id");if(!t){t=[];for(var e=0;256>e;e++)t[e]=(16>e?"0":"")+e.toString(16);e=4294967295*Math.random()|0;var n=4294967295*Math.random()|0,r=4294967295*Math.random()|0,o=4294967295*Math.random()|0;t=t[255&e]+t[e>>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&n]+t[n>>8&255]+"-"+t[n>>16&15|64]+t[n>>24&255]+"-"+t[63&r|128]+t[r>>8&255]+"-"+t[r>>16&255]+t[r>>24&255]+t[255&o]+t[o>>8&255]+t[o>>16&255]+t[o>>24&255],localStorage.setItem("analytics_id",t)}return t}(),traits:{address:{city:"",country:"",postalCode:"",state:"",street:""},age:20,avatar:"http://url.com/thumbnail.jpg",birthday:122321212,createdAt:1111111,description:"Description of the user",email:"email@email.com",firstName:"david",lastName:"wells",name:"david wells",gender:"male",id:"String\tUnique ID in your database for a user",phone:"727-777-8888",title:"boss ceo",username:"davidwells"}},W=function(t,e,n,r){return console.log("identify",t,e,n),{type:k.IDENTIFY_START,userId:t,traits:e,options:n,callback:r}};return function(t){return p(t)}}); |
@@ -172,7 +172,2 @@ import { createStore, combineReducers, applyMiddleware, compose } from 'redux' | ||
replaceReducer: store.replaceReducer, | ||
// main analytics API | ||
emit: (type, data = {}) => { | ||
const dispatchObj = {...{type: type}, ...data} | ||
store.dispatch(dispatchObj) | ||
}, | ||
// track custom event | ||
@@ -179,0 +174,0 @@ track: (eventName, payload, options, callback) => { |
{ | ||
"name": "analytics", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "pluggable analytics library", | ||
@@ -9,3 +9,3 @@ "author": "David Wells", | ||
"scripts": { | ||
"build": "rollup -c -f umd -n analytics", | ||
"build": "rollup -c", | ||
"go": "babel-node example/index.js", | ||
@@ -12,0 +12,0 @@ "buildweb": "webpack -p --target web", |
439036
48
10116