Comparing version 0.1.3 to 0.1.4
@@ -1,1 +0,1 @@ | ||
!function(t){"use strict";var e=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}};var n=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var r=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var M=function(t){return e(t)||n(t)||r()};var o=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var L=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(t){o(e,t,n[t])})}return e};function a(t,e){return t(e={exports:{}},e.exports),e.exports}var R=a(function(e){function n(t){return(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})(t)}function r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(t){return n(t)}:e.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},r(t)}e.exports=r}),i="object"==typeof global&&global&&global.Object===Object&&global,c="object"==typeof self&&self&&self.Object===Object&&self,u=(i||c||Function("return this")()).Symbol,s=Object.prototype,l=s.hasOwnProperty,f=s.toString,d=u?u.toStringTag:void 0;var p=Object.prototype.toString;var h="[object Null]",m="[object Undefined]",g=u?u.toStringTag:void 0;function y(t){return null==t?void 0===t?m:h:g&&g in Object(t)?function(t){var e=l.call(t,d),n=t[d];try{var r=!(t[d]=void 0)}catch(t){}var o=f.call(t);return r&&(e?t[d]=n:delete t[d]),o}(t):(e=t,p.call(e));var e}var v,b,w=(v=Object.getPrototypeOf,b=Object,function(t){return v(b(t))});var S,E="[object Object]",x=Function.prototype,I=Object.prototype,O=x.toString,j=I.hasOwnProperty,A=O.call(Object);S="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")();var N,k,_=("function"==typeof(k=S.Symbol)?k.observable?N=k.observable:(N=k("observable"),k.observable=N):N="@@observable",N),P={INIT:"@@redux/INIT"};function C(t,e,n){var r;if("function"==typeof e&&void 0===n&&(n=e,e=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(C)(t,e)}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var o=t,a=e,i=[],c=i,u=!1;function s(){c===i&&(c=i.slice())}function l(){return a}function f(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var n=!0;return s(),c.push(e),function(){if(n){n=!1,s();var t=c.indexOf(e);c.splice(t,1)}}}function d(t){if(!function(t){if(null==(e=t)||"object"!=typeof e||y(t)!=E)return!1;var e,n=w(t);if(null===n)return!0;var r=j.call(n,"constructor")&&n.constructor;return"function"==typeof r&&r instanceof r&&O.call(r)==A}(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(u)throw new Error("Reducers may not dispatch actions.");try{u=!0,a=o(a,t)}finally{u=!1}for(var e=i=c,n=0;n<e.length;n++){(0,e[n])()}return t}return d({type:P.INIT}),(r={dispatch:d,subscribe:f,getState:l,replaceReducer:function(t){if("function"!=typeof t)throw new Error("Expected the nextReducer to be a function.");o=t,d({type:P.INIT})}})[_]=function(){var t,n=f;return(t={subscribe:function(t){if("object"!=typeof t)throw new TypeError("Expected the observer to be an object.");function e(){t.next&&t.next(l())}return e(),{unsubscribe:n(e)}}})[_]=function(){return this},t},r}function q(t){for(var e=Object.keys(t),p={},n=0;n<e.length;n++){var r=e[n];"function"==typeof t[r]&&(p[r]=t[r])}var o,h=Object.keys(p),m=void 0;try{o=p,Object.keys(o).forEach(function(t){var e=o[t];if(void 0===e(void 0,{type:P.INIT}))throw new 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 new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+P.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){m=t}return function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1];if(m)throw m;for(var n,r,o,a=!1,i={},c=0;c<h.length;c++){var u=h[c],s=p[u],l=t[u],f=s(l,e);if(void 0===f){var d=(n=u,o=void 0,"Given action "+((o=(r=e)&&r.type)&&'"'+o.toString()+'"'||"an action")+', reducer "'+n+'" 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.');throw new Error(d)}i[u]=f,a=a||f!==l}return a?i:t}}function z(){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))}})}var F=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};var V="undefined"!=typeof window;var T=function(){try{if(!V)return!1;document.cookie="cookietest=1";var t=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch(t){return!1}}();function D(t,e,n){if(!T)return!1;var r="";if(n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3),r="; expires=".concat(o.toGMTString())}document.cookie="".concat(t,"=").concat(e).concat(r,"; path=/")}function $(t){if(!T)return!1;for(var e="".concat(t,"="),n=document.cookie.split(";"),r=0;r<n.length;r++){for(var o=n[r];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(e))return o.substring(e.length,o.length)}return null}function G(t){return decodeURIComponent(t).replace(/\+/g," ")}function U(t){if(!V)return!1;var e=t||document.referrer;if(e){var n=window.document.location.port,r=e.split("/")[2];return n&&(r=r.replace(":".concat(n),"")),r!==window.location.hostname}return!1}function Y(t){var e=function(t){if(t){var e=t.match(/\?(.*)/);return e&&e[1]?e[1].split("#")[0]:""}return V&&window.location.search.substring(1)}(t);return e?function(t){var e,n=/([^&=]+)=?([^&]*)/g,r={};for(;e=n.exec(t);){var o=G(e[1]),a=G(e[2]);if("[]"===o.substring(o.length-2))o=o.substring(0,o.length-2),(r[o]||(r[o]=[])).push(a);else{var i=""===a||a;r[o]=i}}for(var c in r){var u=c.split("[");if(1<u.length){var s=[];u.forEach(function(t,e){var n=t.replace(/[?[\]\\ ]/g,"");s.push(n)}),J(r,s,r[c]),delete r[c]}}return r}(e):{}}function J(t,e,n){for(var r=e.length-1,o=0;o<r;++o){var a=e[o];a in t||(t[a]={}),t=t[a]}t[e[r]]=n}function B(o,a){return new Promise(function(t,e){if(V&&window.history&&window.history.replaceState){var n=window.location.href,r=function(t,e){var n=(t.split("?")||[,])[1];if(!n||-1===n.indexOf(e))return t;var r=new RegExp("(\\&|\\?)".concat(e,"([_A-Za-z0-9=.%]+)"),"g"),o="?".concat(n).replace(r,"").replace(/^&/,"?");return t.replace("?".concat(n),o)}(n,o);n!==r&&history.replaceState({},"",r)}return a&&a(),t()})}function H(t){return(function(t){if(!V)return null;var e=document.createElement("a");return e.setAttribute("href",t),e.hostname}(t)||"").split(".").slice(-2).join(".")}var W={"daum.net":"q","eniro.se":"search_word","naver.com":"query","yahoo.com":"p","msn.com":"q","aol.com":"q","lycos.com":"q","ask.com":"q","cnn.com":"query","about.com":"terms","baidu.com":"wd","yandex.com":"text","seznam.cz":"q","search.com":"q","yam.com":"k","kvasir.no":"q","terra.com":"query","mynet.com":"q","rambler.ru":"words",google:"q","bing.com":{p:"q",n:"live"}};function X(t){return(X="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})(t)}function Z(e){var n;try{void 0===(n=JSON.parse(e))&&(n=e),"true"===n&&(n=!0),"false"===n&&(n=!1),parseFloat(n)===n&&"object"!==X(n)&&(n=parseFloat(n))}catch(t){n=e}return n}var K="undefined"!=typeof self&&self?self:"undefined"!=typeof window&&window?window:"undefined"!=typeof global&&global?global:"undefined"!=typeof globalThis&&globalThis?globalThis:void 0,Q=function(){try{if("undefined"==typeof localStorage||"undefined"==typeof JSON)return!1;localStorage.setItem("_test_","1"),localStorage.removeItem("_test_")}catch(t){return!1}return!0}();var tt={getItem:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!t)return null;var n=e.storage;if(Q&&(!n||"localStorage"===n)){var r=localStorage.getItem(t);if(r||"localStorage"===n)return Z(r)}if(T&&(!n||"cookie"===n)){var o=$(t);if(o||"cookie"===n)return Z(o)}return K[t]||null},setItem:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(!t||!e)return!1;var r=n.storage,o=JSON.stringify(e);if(Q&&(!r||"localStorage"===r)){var a=Z(localStorage.getItem(t));return localStorage.setItem(t,o),{value:e,oldValue:a,type:"localStorage"}}if(T&&(!r||"cookie"===r)){var i=Z($(t));return D(t,o),{value:e,oldValue:i,type:"cookie"}}var c=K[t];return{value:K[t]=e,oldValue:c,type:"window"}},removeItem:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!t)return!1;var n=e.storage;return!Q||n&&"localStorage"!==n?!T||n&&"cookie"!==n?K[t]=null:(r=t,T&&D(r,"",-1),null):(localStorage.removeItem(t),null);var r}};function et(){for(var t,e,n,r,o=[],a=0;a<256;a++)o[a]=(a<16?"0":"")+a.toString(16);return t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0,"".concat(o[255&t]+o[t>>8&255]+o[t>>16&255]+o[t>>24&255],"-").concat(o[255&e]).concat(o[e>>8&255],"-").concat(o[e>>16&15|64]).concat(o[e>>24&255],"-").concat(o[63&n|128]).concat(o[n>>8&255],"-").concat(o[n>>16&255]).concat(o[n>>24&255]).concat(o[255&r]).concat(o[r>>8&255]).concat(o[r>>16&255]).concat(o[r>>24&255])}var nt=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","reset","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","pluginRegister","pluginsRegistered","pluginFailed","loadPlugin","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],rt=nt.reduce(function(t,e){return t[e]=e,t},{pluginRegisterType:function(t){return"pluginRegister:".concat(t)},pluginReadyType:function(t){return"pluginReady:".concat(t)}});var ot="__anon_id",at="__user_id",it="__user_traits",ct=Object.freeze({ANON_ID:ot,USER_ID:at,USER_TRAITS:it});var ut=a(function(P){!function(t){var u,e=Object.prototype,s=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",r=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag",i=t.regeneratorRuntime;if(i)P.exports=i;else{(i=t.regeneratorRuntime=P.exports).wrap=v;var f="suspendedStart",d="suspendedYield",p="executing",h="completed",m={},c={};c[o]=function(){return this};var l=Object.getPrototypeOf,g=l&&l(l(k([])));g&&g!==e&&s.call(g,o)&&(c=g);var y=E.prototype=w.prototype=Object.create(c);S.prototype=y.constructor=E,E.constructor=S,E[a]=S.displayName="GeneratorFunction",i.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===S||"GeneratorFunction"===(e.displayName||e.name))},i.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(y),t},i.awrap=function(t){return{__await:t}},x(I.prototype),I.prototype[r]=function(){return this},i.AsyncIterator=I,i.async=function(t,e,n,r){var o=new I(v(t,e,n,r));return i.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},x(y),y[a]="Generator",y[o]=function(){return this},y.toString=function(){return"[object Generator]"},i.keys=function(n){var r=[];for(var t in n)r.push(t);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},i.values=k,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(A),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return a.type="throw",a.arg=n,r.next=t,e&&(r.method="next",r.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(i&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),A(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;A(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=u),m}}}function v(t,e,n,r){var a,i,c,u,o=e&&e.prototype instanceof w?e:w,s=Object.create(o.prototype),l=new N(r||[]);return s._invoke=(a=t,i=n,c=l,u=f,function(t,e){if(u===p)throw new Error("Generator is already running");if(u===h){if("throw"===t)throw e;return _()}for(c.method=t,c.arg=e;;){var n=c.delegate;if(n){var r=O(n,c);if(r){if(r===m)continue;return r}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if(u===f)throw u=h,c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u=p;var o=b(a,i,c);if("normal"===o.type){if(u=c.done?h:d,o.arg===m)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u=h,c.method="throw",c.arg=o.arg)}}),s}function b(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function w(){}function S(){}function E(){}function x(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function I(u){var e;this._invoke=function(n,r){function t(){return new Promise(function(t,e){!function e(t,n,r,o){var a=b(u[t],u,n);if("throw"!==a.type){var i=a.arg,c=i.value;return c&&"object"==typeof c&&s.call(c,"__await")?Promise.resolve(c.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):Promise.resolve(c).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)})}o(a.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}}function O(t,e){var n=t.iterator[e.method];if(n===u){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=u,O(t,e),"throw"===e.method))return m;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var r=b(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,m;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=u),e.delegate=null,m):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function k(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(s.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=u,t.done=!0,t};return r.next=r}}return{next:_}}function _(){return{value:u,done:!0}}}(function(){return this||"object"==typeof self&&self}()||Function("return this")())}),st=function(){return this||"object"==typeof self&&self}()||Function("return this")(),lt=st.regeneratorRuntime&&0<=Object.getOwnPropertyNames(st).indexOf("regeneratorRuntime"),ft=lt&&st.regeneratorRuntime;st.regeneratorRuntime=void 0;var dt=ut;if(lt)st.regeneratorRuntime=ft;else try{delete st.regeneratorRuntime}catch(t){st.regeneratorRuntime=void 0}var pt=dt;function ht(t,e,n,r,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}var mt=function(c){return function(){var t=this,i=arguments;return new Promise(function(e,n){var r=c.apply(t,i);function o(t){ht(r,e,n,o,a,"next",t)}function a(t){ht(r,e,n,o,a,"throw",t)}o(void 0)})}};function gt(o,a,i){return new Promise(function(e,n){return a()?e(o):i<1?n(L({},o,{queue:!0})):(r=10,new Promise(function(t){return setTimeout(t,r)})).then(function(t){return gt(o,a,i-10).then(e,n)});var r})}var yt=function(t){if(Array.isArray(t))return t};var vt=function(t,e){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){o=!0,a=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n};var bt=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var wt=function(t,e){return yt(t)||vt(t,e)||bt()};function St(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(e).filter(function(t){var e=r.plugins||{};return!1!==e[t]&&(!0===e[t]||(!n[t]||!1!==n[t].enabled))}).map(function(t){return e[t]})}function Et(t,e,n,r,o){return xt.apply(this,arguments)}function xt(){return(xt=mt(pt.mark(function t(e,n,r,o,a){var i,c,u,s,l,f,d,p,h,m,g;return pt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=n(),c=e.type,e._&&e._.called)return t.abrupt("return",e);t.next=4;break;case 4:return u=r.getState(),s=St(i,u.plugins,e.options),l=s.map(function(t){return t.NAMESPACE}),f=Tt(c,s,i),t.next=10,Ot({action:e,data:{exact:f.before,namespaced:f.beforeNS},state:u,allPlugins:i,allMatches:f,instance:r,store:o,EVENTS:a});case 10:if(Lt(d=t.sent,l.length))return t.abrupt("return",d);t.next=13;break;case 13:if(s.filter(function(t){return!Mt(d,t.NAMESPACE)}),c.replace(/Start$/,"")!==c){t.next=20;break}t.t0=d,t.next=23;break;case 20:return t.next=22,Ot({action:L({},d,{type:_t(c)}),data:{exact:f.during,namespaced:f.duringNS},state:u,allPlugins:i,allMatches:f,instance:r,store:o,EVENTS:a});case 22:t.t0=t.sent;case 23:return p=t.t0,h="".concat(_t(c),"End"),t.next=27,Ot({action:L({},p,{type:h}),data:{exact:f.after,namespaced:f.afterNS},state:u,allPlugins:i,allMatches:f,instance:r,store:o,EVENTS:a});case 27:return m=t.sent,(g=It(m))&&g({payload:m}),t.abrupt("return",d);case 31:case"end":return t.stop()}},t,this)}))).apply(this,arguments)}function It(r){return!!r.meta&&Object.keys(r.meta).reduce(function(t,e){var n=r.meta[e];return"function"==typeof n?n:t},!1)}function Ot(t){return jt.apply(this,arguments)}function jt(){return(jt=mt(pt.mark(function t(e){var m,i,g,n,y,r,v,o,b,w,a,S,E,x,c;return pt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return m=e.data,i=e.action,g=e.instance,n=e.state,y=e.allPlugins,r=e.allMatches,v=e.store,o=e.EVENTS,b=n.plugins,w=i.type,a=m.exact.map(function(t){return t.pluginName}),w.match(/Start$/)&&(a=r.during.map(function(t){return t.pluginName})),S=qt(g,a),E=m.exact.reduce(function(t,e){var n=e.pluginName,r=!1;return e.methodName.match(/^initialize/)||(r=!b[n].loaded),t["".concat(n)]=r,t},{}),t.next=9,m.exact.reduce(function(){var r=mt(pt.mark(function t(e,n,r){var u,o,a;return pt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return u=n.pluginName,t.next=3,e;case 3:if(o=t.sent,m.namespaced&&m.namespaced[u])return t.next=7,m.namespaced[u].reduce(function(){var r=mt(pt.mark(function t(e,n,r){var o,a,i,c;return pt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=function(n,r,o){return function(t,e){return L({},n,{abort:{reason:t,plugins:e||[r],caller:w,from:o||r}})}},t.next=3,e;case 3:if(o=t.sent,n.method&&"function"==typeof n.method){t.next=6;break}return t.abrupt("return",o);case 6:return zt(n.methodName,n.pluginName),t.next=9,n.method({payload:o,instance:g,abort:a(o,u,n.pluginName),config:Nt(u,b,y),plugins:b});case 9:return i=t.sent,c="object"===R(i)?i:{},t.abrupt("return",Promise.resolve(L({},o,c)));case 12:case"end":return t.stop()}},t,this)}));return function(t,e,n){return r.apply(this,arguments)}}(),Promise.resolve(i));t.next=11;break;case 7:a=t.sent,o[u]=a,t.next=12;break;case 11:o[u]=i;case 12:return t.abrupt("return",Promise.resolve(o));case 13:case"end":return t.stop()}},t,this)}));return function(t,e,n){return r.apply(this,arguments)}}(),Promise.resolve({}));case 9:return x=t.sent,t.next=12,m.exact.reduce(function(){var r=mt(pt.mark(function t(e,n,r){var o,a,i,c,u,s,l,f,d,p,h;return pt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=m.exact.length===r+1,a=n.pluginName,i=y[a],t.next=5,e;case 5:if(c=t.sent,Mt(u=x[a]?x[a]:{},a))return At({data:u,method:w,instance:g,pluginName:a,store:v}),t.abrupt("return",Promise.resolve(c));t.next=10;break;case 10:if(Mt(c,a))return o&&At({data:c,method:w,instance:g,store:v}),t.abrupt("return",Promise.resolve(c));t.next=13;break;case 13:if(E.hasOwnProperty(a)&&!0===E[a])return v.dispatch({type:"queue",plugin:a,payload:u,_:{called:"queue",from:"queueMechanism"}}),t.abrupt("return",Promise.resolve(c));t.next=16;break;case 16:return s=S(x[a],y[a]),t.next=19,i[w]({hello:a,abort:s.abort,payload:x[a],instance:g,config:Nt(a,b,y),plugins:b});case 19:return l=t.sent,f="object"===R(l)?l:{},d=L({},c,f),Mt(p=x[a],a)?At({data:p,method:w,instance:g,pluginName:a,store:v}):(h="".concat(w,":").concat(a),(h.match(/:/g)||[]).length<2&&!w.match(/^bootstrap/)&&!w.match(/^ready/)&&g.dispatch(L({},p,{type:h,_:{called:h,from:"submethod"}}))),t.abrupt("return",Promise.resolve(d));case 25:case"end":return t.stop()}},t,this)}));return function(t,e,n){return r.apply(this,arguments)}}(),Promise.resolve(i));case 12:if(c=t.sent,w.match(/Start$/)||w.match(/^registerPlugin/)||w.match(/^ready/)||w.match(/^bootstrap/)||w.match(/^params/)){t.next=18;break}if(o.plugins.includes(w),c._&&c._.originalAction===w)return t.abrupt("return",c);t.next=17;break;case 17:v.dispatch(L({},c,{_:{originalAction:c.type,called:c.type,from:"engineEnd"}}));case 18:return t.abrupt("return",c);case 19:case"end":return t.stop()}},t,this)}))).apply(this,arguments)}function At(t){var e=t.data,n=t.method,r=(t.instance,t.pluginName),o=t.store,a=r?":".concat(r):"",i="".concat(n,"Aborted").concat(a);o.dispatch(L({},e,{type:i,_:{called:i,from:"abort"}}))}function Nt(t,e,n){return e[t]&&e[t].config?e[t].config:n[t]&&n[t].config?n[t].config:{}}function kt(n,t){return t.reduce(function(t,e){return e[n]?t.concat({methodName:n,pluginName:e.NAMESPACE,method:e[n]}):t},[])}function _t(t){return t.replace(/Start$/,"")}function Pt(t,e){var n=_t(t),r=e?":".concat(e):"";return["".concat(t).concat(r),"".concat(n).concat(r),"".concat(n,"End").concat(r)]}function Tt(u,s,t){var e=Pt(u).map(function(t){return kt(t,s)});return s.reduce(function(t,e){var n=e.NAMESPACE,r=Pt(u,n).map(function(t){return kt(t,s)}),o=wt(r,3),a=o[0],i=o[1],c=o[2];return a.length&&(t.beforeNS[n]=a),i.length&&(t.duringNS[n]=i),c.length&&(t.afterNS[n]=c),t},{before:e[0],beforeNS:{},during:e[1],duringNS:{},after:e[2],afterNS:{}})}function Mt(t,e){var n=t.abort;return!!n&&(!0===n||(Ct(n,e)||n&&Ct(n.plugins,e)))}function Lt(t,e){var n=t.abort;if(!n)return!1;if(!0===n||"string"==typeof n)return!0;var r=n.plugins;return Rt(n)&&n.length===e||Rt(r)&&r.length===e}function Rt(t){return Array.isArray(t)}function Ct(t,e){return!(!t||!Rt(t))&&t.includes(e)}function qt(m,g){return function(t,e,n){var r=e.config,o=e.NAMESPACE,a="".concat(o,".").concat(t.type);n&&(a=n.event);var i,c,u,s,l,f,d,p,h=t.type.match(/Start$/)?(u=o,s=a,l=g,f=n,d=t,function(t,e){var n=f?f.NAMESPACE:u,r=e&&Rt(e)?e:l;if(f&&(!(r=e&&Rt(e)?e:[u]).includes(u)||1!==r.length))throw new Error('Method "'.concat(s,'" can only abort "').concat(u,'" plugin. ').concat(JSON.stringify(r)," input valid"));return L({},d,{abort:{reason:t,plugins:r,caller:s,_:n}})}):(i=t,c=a,function(){throw new Error('Action "'.concat(i.type,'" is not cancellable. Remove abort call from plugin ').concat(c))});return{payload:(p=t,Object.keys(p).reduce(function(t,e){return"type"===e||("object"===R(p[e])?t[e]=Object.assign({},p[e]):t[e]=p[e]),t},{})),instance:m,config:r||{},abort:h}}}function zt(t,e){var n=Ft(t);if(n&&n.name===e){var r=Ft(n.method),o=r?'or "'.concat(r.method,'"'):"";throw new Error(['Plugin "'.concat(e,'" is calling method [').concat(t,"]"),"Plugins should not call their own namespace.",'Use "'.concat(n.method,'" ').concat(o,' in "').concat(e,'" plugin instead of "').concat(t,'"')].join("\n"))}}function Ft(t){var e=t.match(/(.*):(.*)/);return!!e&&{method:e[1],name:e[2]}}function Vt(){return(new Date).getTime()}var Dt=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},$t=function t(){var i=this;Dt(this,t),o(this,"before",[]),o(this,"after",[]),o(this,"addMiddleware",function(t,e){i[e]=i[e].concat(t)}),o(this,"removeMiddleware",function(e,t){var n=i[t].findIndex(function(t){return t===e});-1!==n&&(i[t]=[].concat(M(i[t].slice(0,n)),M(i[t].slice(n+1))))}),o(this,"resetMiddlewares",function(t){t?i[t]=[]:(i.before=[],i.after=[])}),o(this,"dynamicMiddlewares",function(a){return function(o){return function(r){return function(t){var e={getState:o.getState,dispatch:function(t){return o.dispatch(t)}},n=i[a].map(function(t){return t(e)});return z.apply(void 0,M(n))(r)(t)}}}})},Gt={};function Ut(c){return function(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Gt,t=1<arguments.length?arguments[1]:void 0,e={};if("initialize:aborted"===t.type)return n;if(/^registerPlugin:([^:]*)$/.test(t.type)){var r=t.type.split(":")[1],o=c()[r];return o&&r?(e[r]={enabled:!0,initialized:!o.initialize,loaded:Boolean(o.loaded()),config:o.config||{}},L({},n,e)):n}if(/^initialize:([^:]*)$/.test(t.type)){var a=t.type.split(":")[1],i=c()[a];return i&&a?(e[a]=L({},n[a],{initialized:!0,loaded:Boolean(i.loaded())}),L({},n,e)):n}if(/^ready:([^:]*)$/.test(t.type))return e[t.name]=L({},n[t.name],{loaded:!0}),L({},n,e);switch(t.type){case rt.pluginFailed:return e[t.name]=L({},n[t.name],{loaded:!1}),L({},n,e);case rt.disablePlugin:return Array.isArray(t.name)?e=t.name.reduce(function(t,e){return t[e]=L({},n[e],{enabled:!1}),t},n):e[t.name]=L({},n[t.name],{enabled:!1}),L({},n,e);case rt.enablePlugin:return Array.isArray(t.name)?e=t.name.reduce(function(t,e){return t[e]=L({},n[e],{enabled:!0}),t},n):e[t.name]=L({},n[t.name],{enabled:!0}),L({},n,e);default:return n}}}var Yt,Jt,Bt,Ht;Yt=function(){if(!V)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"}(),Jt=function(t,e){if(!V)return!1;var n={source:"(direct)",medium:"(none)",campaign:"(not set)"};t&&U(t)&&(n.referrer=t);var r=function(t){if(!t||!V)return!1;var e,n,r=H(t),o=document.createElement("a");if(o.href=t,-1<o.hostname.indexOf("google")&&(r="google"),W[r]){var a=W[r],i="string"==typeof a?a:a.p,c=new RegExp(i+"=.*?([^&#]*|$)","gi"),u=o.search.match(c);return{source:a.n||(e=r,n=e.split("."),1<n.length?n.slice(0,-1).join("."):e),medium:"organic",term:(u?u[0].split("=")[1]:"")||"(not provided)"}}var s=U(t)?"referral":"internal";return{source:o.hostname,medium:s}}(t);r&&Object.keys(r).length&&(n=Object.assign({},n,r));var o=Y(e),a=Object.keys(o);if(a.length){var i=a.reduce(function(t,e){return e.match(/^utm_/)&&(t["".concat(e.replace(/^utm_/,""))]=o[e]),e.match(/^(d|g)clid/)&&(t.source="google",t.medium=o.gclid?"cpc":"cpm",t[e]=o[e]),t},{});n=Object.assign({},n,i),(o.dclid||o.gclid)&&(n.source="google",n.medium=o.gclid?"cpc":"cpm")}return n}(),Bt=function(){if(!V)return null;var t=navigator,e=t.language,n=t.languages,r=t.userLanguage;return n&&n.length?n[0]:r||e}(),Ht="undefined"==typeof Intl||"function"!=typeof Intl.DateTimeFormat||"function"!=typeof Intl.DateTimeFormat().resolvedOptions?null:Intl.DateTimeFormat().resolvedOptions().timeZone;var Wt={initialized:!1,sessionId:et(),app:null,version:null,debug:!1,offline:!!V&&!navigator.onLine,os:{name:Yt},userAgent:V?navigator.userAgent:"node",library:{name:"analytics",version:"0.1.2"},timezone:Ht,locale:Bt,campaign:{},referrer:Jt};function Xt(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Wt,e=1<arguments.length?arguments[1]:void 0,n=t.initialized,r=e.type,o=e.campaign;switch(r){case rt.campaign:return L({},t,{campaign:o});case rt.offline:return L({},t,{offline:!0});case rt.online:return L({},t,{offline:!1});default:return n?t:L({},Wt,t,{initialized:!0})}}var Zt=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(!V)return t;var e=document,n=e.title,r=e.referrer,o=window,a=o.location,i=o.innerWidth,c=o.innerHeight,u=a.hash,s=a.search,l=a.pathname,f=a.href,d=L({title:n,url:f,path:l,hash:u,search:s,width:i,height:c},t);return r&&""!==r&&(d.referrer=r),d},Kt=L({},Zt());function Qt(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Kt,e=1<arguments.length?arguments[1]:void 0;switch(e.type){case rt.page:return Object.assign({},t,e.data);default:return t}}var te={event:{},lastEvent:null,history:[]};function ee(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:te,e=1<arguments.length?arguments[1]:void 0,n=e.type,r=e.payload,o=e.options,a=e.eventName;switch(n){case rt.track:return L({},t,{event:{eventName:a,payload:r,options:o},lastEvent:e.eventName,history:t.history.concat(e)});default:return t}}var ne={actions:[]};function re(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:ne,e=1<arguments.length?arguments[1]:void 0,n=e.type;e.data,e.timestamp;switch(n){case"queue":return L({},t,{actions:t.actions.concat(e)});case"dequeue":return[];default:return t}}var oe="object"===("undefined"==typeof self?"undefined":R(self))&&self.self===self&&self||"object"===("undefined"==typeof global?"undefined":R(global))&&global.global===global&&global||void 0;function ae(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;if(e&&e.type===rt.setItemEnd&&e.key===ot)return Object.assign({},t,{anonymousId:e.value});switch(e.type){case rt.identify:return Object.assign({},t,{userId:e.userId,traits:L({},t.traits,e.traits)});case rt.reset:return Object.assign({},t,{userId:null,anonymousId:null,traits:null});default:return t}}function ie(){return{userId:tt.getItem(at),anonymousId:tt.getItem(ot),traits:tt.getItem(it)||{}}}var ce=function(t){return"__TEMP__".concat(t)};function ue(t,e,n){var r=e.getState("user")[t];if(r)return r;if(n&&"object"===R(n)&&n[t])return n[t];var o=ie()[t];return o||(oe[ce(t)]?oe[ce(t)]:void 0)}function se(t,e,n,r){for(r=0,e=e.split?e.split("."):e;t&&r<e.length;)t=t[e[r++]];return void 0===t||r<e.length?n:t}function le(e){var n=function(t,e,n){if(!V)return!1;var r=window[(n?"add":"remove")+"EventListener"];t.split(" ").forEach(function(t){r(t,e)})}.bind(null,"online offline",function(t){return Promise.resolve(!navigator.onLine).then(e)});return n(!0),function(t){n(!1)}}function fe(){return Array.prototype.slice.call(arguments).reduce(function(t,e){return t||("function"==typeof e?e:t)},!1)}function de(){return oe.__ANALYTICS_HISTORY__=[],function(a){return function(t,e,n){var r=a(t,e,n),o=r.dispatch;return Object.assign(r,{dispatch:function(t){var e=t.action||t;return oe.__ANALYTICS_HISTORY__.push(e),o(t)}})}}}function pe(t){return function(){return z(z.apply(null,arguments),de())}}var he=function(t,e,n){return{type:rt.setItemStart,timestamp:Vt(),key:t,value:e,options:n}},me=function(t,e){return{type:rt.removeItemStart,timestamp:Vt(),key:t,options:e}},ge=function(t,e){return tt.getItem(t,e)};function ye(){var t,s,i,h,m,g,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=e.reducers||{},r=(e.plugins||[]).reduce(function(t,e){if("function"!=typeof e&&e.NAMESPACE){var n=e.EVENTS?Object.keys(e.EVENTS).map(function(t){return e.EVENTS[t]}):[],r=Object.keys(e).concat(n),o=new Set(t.events.concat(r));if(t.events=Array.from(o),t.pluginsArray=t.pluginsArray.concat(e),t.plugins[e.NAMESPACE])throw new Error('Analytics "'.concat(e.NAMESPACE,'" loaded twice!'));return t.plugins[e.NAMESPACE]=e,t.plugins[e.NAMESPACE].loaded||(t.plugins[e.NAMESPACE].loaded=function(){return!0}),t}return t.middlewares=t.middlewares.concat(e),t},{plugins:{},pluginsArray:[],middlewares:[],events:[]}),c=r.plugins,o=["NAMESPACE","EVENTS","config","loaded"],a=r.events.filter(function(t){return!o.includes(t)}),u=new Set(a.concat(nt).filter(function(t){return!o.includes(t)})),l=Array.from(u).sort(),f=a.sort(),d=function(t){return t?Object.keys(c).map(function(t){return c[t]}):c},p=new $t,y=p.addMiddleware,v=p.removeMiddleware,b=p.dynamicMiddlewares,w={identify:function(t,e,n,r){var o="string"==typeof t?t:null,a="object"===R(t)?t:e,i=n||{},c=fe(e,n,r),u=w.user(),s=(oe[ce("userId")]=o)||a.userId||ue("userId",w,a);P.dispatch(L({type:rt.identifyStart,userId:s,traits:a,options:i,anonymousId:u.anonymousId},u.id&&u.id!==o&&{previousId:u.id},{meta:L({timestamp:Vt()},c&&{callback:c})}))},track:function(t,e,n,r){var o="object"===R(t)?t.event:t;if(!o||"string"!=typeof o)throw new Error("No eventName not supplied");var a="object"===R(t)?t:e||{},i="object"===R(n)?n:{},c=fe(e,n,r),u=ue("userId",w,e),s=ue("anonymousId",w,e);P.dispatch({type:rt.trackStart,event:o,properties:a,options:i,userId:u,anonymousId:s,meta:L({timestamp:Vt()},c&&{callback:c})})},page:function(t,e,n){var r="object"===R(t)?t:{},o="object"===R(e)?e:{},a=fe(t,e,n),i=ue("userId",w,r),c=ue("anonymousId",w,r);P.dispatch({type:rt.pageStart,properties:L({},Zt(),r),options:o,userId:i,anonymousId:c,meta:L({timestamp:Vt()},a&&{callback:a})})},getState:function(t){var e=P.getState();return t?se(e,t):Object.assign({},e)},reset:function(t){var e;P.dispatch((e=t,{type:rt.reset,timestamp:Vt(),callback:e}))},dispatch:function(t){var e,n="string"==typeof t?{type:t}:t;if(e=n.type,nt.includes(e))throw new Error('Trying to dispatch analytics reservedAction "'.concat(n.type,'"'));var r=n.meta||{},o=t._||{},a=L({},n,{meta:L({timestamp:Vt()},r),_:L({originalAction:n.type},o)});P.dispatch(a)},storage:{getItem:ge,setItem:function(t,e,n){P.dispatch(he(t,e,n))},removeItem:function(t,e){P.dispatch(me(t,e))}},setAnonymousId:function(t,e){w.storage.setItem(ot,t,e)},user:function(t){if("userId"===t||"id"===t)return ue("userId",w);var e=w.getState("user");return t?se(e,t):e},ready:function(t){return w.on(rt.ready,t)},on:function(n,r){if(!n||!r||"function"!=typeof r)return!1;if("bootstrap"===n)throw new Error("Not allowed to listen to bootstrap");if("*"===n){var t=function(t){return function(e){return function(t){return t.type.match(/Start$|Start:/)&&r({payload:t,instance:w,plugins:c}),e(t)}}},e=function(t){return function(e){return function(t){return t.type.match(/Start$|Start:/)||r({payload:t,instance:w,plugins:c}),e(t)}}};return y(t,"before"),y(e,"after"),function(){v(t,"before"),v(e,"after")}}var o=n.match(/Start$|Start:/)?"before":"after",a=function(t){return function(e){return function(t){return t.type===n&&r({payload:t,instance:w,plugins:c}),e(t)}}};return y(a,o),function(){return v(a,o)}},once:function(t,e){var n=w.on(t,function(t){e(t,w),n()});return n},enablePlugin:function(t,e){var n,r;P.dispatch((n=t,r=e,{type:rt.enablePlugin,name:n,callback:r}))},disablePlugin:function(t,e){var n,r;P.dispatch((n=t,r=e,{type:rt.disablePlugin,name:n,callback:r}))},loadPlugin:function(t){P.dispatch({type:rt.loadPlugin,plugins:t?[t]:Object.keys(d())})},events:l,pluginEvents:f},S=r.middlewares.concat([b("before"),(h=w,m=d,g={all:l,plugins:f},function(p){return function(d){return e=mt(pt.mark(function t(e){var n,r,o,a,i,c,u,s,l,f;return pt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.type,r=e.name,o=e.callback,(a=e).abort)return t.abrupt("return",d(e));t.next=4;break;case 4:if(n!==rt.disablePlugin&&n!==rt.enablePlugin||o&&o(r),n===rt.initializeEnd&&(i=m(),c=Object.keys(i).map(function(t){return i[t]}),u=[],s=[],l=c.map(function(e){var t=e.loaded,n=e.NAMESPACE;return gt(e,t,1e4).then(function(t){p.dispatch({type:"ready:".concat(n),name:n,events:Object.keys(e).filter(function(t){return!["NAMESPACE","config","loaded"].includes(t)})}),u=u.concat(n)}).catch(function(t){if(t instanceof Error)throw new Error(t);return s=s.concat(t.NAMESPACE),t})}),Promise.all(l).then(function(t){setTimeout(function(){p.dispatch({type:"ready",plugins:u,failed:s})},0)})),"bootstrap"!==n)return t.next=9,Et(e,m,h,p,g);t.next=11;break;case 9:return f=t.sent,t.abrupt("return",d(f));case 11:return t.abrupt("return",d(a));case 12:case"end":return t.stop()}},t,this)})),function(t){return e.apply(this,arguments)};var e}}),function(t){return function(a){return function(t){var e=t.type,n=t.key,r=t.value;if(t.timestamp,e===rt.setItem||e===rt.removeItem){if(t.abort)return a(t);var o=e===rt.setItem?"setItem":"removeItem";tt[o](n,r)}return a(t)}}},(i=w,function(a){return function(o){return function(t){if(t.type===rt.bootstrap){tt.getItem(ot)||i.storage.setItem(ot,et());var n=Y(),e=Object.keys(n);if(e.length){var r=e.reduce(function(t,e){return(e.match(/^utm_/)||e.match(/^(d|g)clid/))&&(t.campaign[e]=n[e]),e.match(/^an_prop_/)&&(t.props["".concat(e.replace(/^an_prop_/,""))]=n[e]),e.match(/^an_trait_/)&&(t.traits["".concat(e.replace(/^an_trait_/,""))]=n[e]),t},{campaign:{},props:{},traits:{}});a.dispatch(L({type:rt.params,raw:n},r)),n.an_uid&&setTimeout(function(){i.identify(n.an_uid,r.traits)},0),n.an_event&&setTimeout(function(){i.track(n.an_event,r.props)},0),Object.keys(r.campaign).length&&a.dispatch({type:rt.campaign,campaign:r.campaign}),n.an_clean&&setTimeout(function(){B("an_")},0)}}return o(t)}}}),(t=w,s=t.storage,function(u){return function(c){return function(t){var e=t.userId,n=t.traits,r=t.options,o=t.callback;if(t.type===rt.reset&&(s.removeItem(at),s.removeItem(it),s.removeItem(ot),o&&"function"==typeof o&&o()),t.type===rt.identify){var a=s.getItem(at),i=s.getItem(it)||{};a&&a!==e&&u.dispatch({type:rt.userIdChanged,old:{userId:a,traits:i},new:{userId:e,traits:n},options:r}),e&&s.setItem(at,e),n&&s.setItem(it,L({},i,n))}return c(t)}}}),b("after")]),E={context:Xt,user:ae,page:Qt,track:ee,plugins:Ut(d),queue:re},x=z,I=z;if(V&&e.debug){var O=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;O&&(x=O({trace:!0,traceLimit:25})),I=function(){return 0===arguments.length?de():"object"===R(arguments[0])?pe(arguments[0]):pe().apply(null,arguments)}}var j,A,N,k=(j=e,Object.keys(j).reduce(function(t,e){return"plugins"===e||"reducers"===e||(t[e]=j[e]),t},{})),_={context:k,user:ie(),plugins:r.pluginsArray.reduce(function(t,e){var n=e.NAMESPACE,r=e.config,o=e.loaded;return t[n]={enabled:!0,initialized:!e.initialize,loaded:Boolean(o()),config:r||{}},t},{})},P=C(q(L({},E,n)),_,I(x(function(){for(var t=arguments.length,u=Array(t),e=0;e<t;e++)u[e]=arguments[e];return function(c){return function(t,e,n){var r,o=c(t,e,n),a=o.dispatch,i={getState:o.getState,dispatch:function(t){return a(t)}};return r=u.map(function(t){return t(i)}),a=z.apply(void 0,r)(o.dispatch),F({},o,{dispatch:a})}}}.apply(void 0,M(S))))),T=Object.keys(c);return P.dispatch({type:rt.bootstrap,plugins:T,config:k}),P.dispatch({type:rt.registerPlugins,plugins:T}),r.pluginsArray.map(function(t,e){var n=t.bootstrap,r=t.config;n&&"function"==typeof n&&n({instance:w,config:r,payload:t});var o=Ut.length===e+1;P.dispatch({type:"registerPlugin:".concat(t.NAMESPACE),name:t.NAMESPACE,plugin:t}),o&&P.dispatch({type:rt.initializeStart,plugins:T})}),le(function(t){P.dispatch({type:t?rt.offline:rt.online})}),A=P,N=d,setInterval(function(){var i=N(),t=A.getState(),c=t.plugins,e=t.context,u=t.queue;if(!e.offline&&u&&u.actions&&u.actions.length){var n=u.actions.reduce(function(t,e,n){return c[e.plugin].loaded?(t.process.push(e),t.processIndex.push(n)):(t.requeue.push(e),t.requeueIndex.push(n)),t},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(n.processIndex&&n.processIndex.length){n.processIndex.forEach(function(t){var e=u.actions[t],n=e.plugin,r=e.payload.type,o=i[n][r];if(o&&"function"==typeof o){o({payload:e.payload,config:c[n].config});var a="".concat(r,":").concat(n);A.dispatch(L({},e.payload,{type:a,meta:{called:!0},_:{called:a,from:"queueDrain"}}))}});var r=u.actions.filter(function(t,e){return-1===n.processIndex.indexOf(e)});u.actions=r}}},3e3),e.exposeRedux?Object.assign({},w,{dispatch:P.dispatch,subscribe:P.subscribe,replaceReducer:P.replaceReducer}):w}t.default=ye,t.analytics=ye,t.EVENTS=rt,t.CONSTANTS=ct}(this.window=this.window||{}); | ||
!function(t){"use strict";var e=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}};var n=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var r=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var M=function(t){return e(t)||n(t)||r()};var o=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var L=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(t){o(e,t,n[t])})}return e};function a(t,e){return t(e={exports:{}},e.exports),e.exports}var R=a(function(e){function n(t){return(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})(t)}function r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(t){return n(t)}:e.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},r(t)}e.exports=r}),i="object"==typeof global&&global&&global.Object===Object&&global,c="object"==typeof self&&self&&self.Object===Object&&self,u=(i||c||Function("return this")()).Symbol,s=Object.prototype,l=s.hasOwnProperty,f=s.toString,p=u?u.toStringTag:void 0;var d=Object.prototype.toString;var h="[object Null]",m="[object Undefined]",y=u?u.toStringTag:void 0;function g(t){return null==t?void 0===t?m:h:y&&y in Object(t)?function(t){var e=l.call(t,p),n=t[p];try{var r=!(t[p]=void 0)}catch(t){}var o=f.call(t);return r&&(e?t[p]=n:delete t[p]),o}(t):(e=t,d.call(e));var e}var v,b,w=(v=Object.getPrototypeOf,b=Object,function(t){return v(b(t))});var S,E="[object Object]",x=Function.prototype,I=Object.prototype,O=x.toString,A=I.hasOwnProperty,j=O.call(Object);S="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")();var N,_,k=("function"==typeof(_=S.Symbol)?_.observable?N=_.observable:(N=_("observable"),_.observable=N):N="@@observable",N),P={INIT:"@@redux/INIT"};function C(t,e,n){var r;if("function"==typeof e&&void 0===n&&(n=e,e=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(C)(t,e)}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var o=t,a=e,i=[],c=i,u=!1;function s(){c===i&&(c=i.slice())}function l(){return a}function f(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var n=!0;return s(),c.push(e),function(){if(n){n=!1,s();var t=c.indexOf(e);c.splice(t,1)}}}function p(t){if(!function(t){if(null==(e=t)||"object"!=typeof e||g(t)!=E)return!1;var e,n=w(t);if(null===n)return!0;var r=A.call(n,"constructor")&&n.constructor;return"function"==typeof r&&r instanceof r&&O.call(r)==j}(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(u)throw new Error("Reducers may not dispatch actions.");try{u=!0,a=o(a,t)}finally{u=!1}for(var e=i=c,n=0;n<e.length;n++){(0,e[n])()}return t}return p({type:P.INIT}),(r={dispatch:p,subscribe:f,getState:l,replaceReducer:function(t){if("function"!=typeof t)throw new Error("Expected the nextReducer to be a function.");o=t,p({type:P.INIT})}})[k]=function(){var t,n=f;return(t={subscribe:function(t){if("object"!=typeof t)throw new TypeError("Expected the observer to be an object.");function e(){t.next&&t.next(l())}return e(),{unsubscribe:n(e)}}})[k]=function(){return this},t},r}function q(t){for(var e=Object.keys(t),d={},n=0;n<e.length;n++){var r=e[n];"function"==typeof t[r]&&(d[r]=t[r])}var o,h=Object.keys(d),m=void 0;try{o=d,Object.keys(o).forEach(function(t){var e=o[t];if(void 0===e(void 0,{type:P.INIT}))throw new 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 new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+P.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){m=t}return function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1];if(m)throw m;for(var n,r,o,a=!1,i={},c=0;c<h.length;c++){var u=h[c],s=d[u],l=t[u],f=s(l,e);if(void 0===f){var p=(n=u,o=void 0,"Given action "+((o=(r=e)&&r.type)&&'"'+o.toString()+'"'||"an action")+', reducer "'+n+'" 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.');throw new Error(p)}i[u]=f,a=a||f!==l}return a?i:t}}function z(){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))}})}var F=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};var V="undefined"!=typeof window;var T=function(){try{if(!V)return!1;var t="cookietest=";document.cookie="".concat(t,"1");var e=-1!==document.cookie.indexOf(t);return document.cookie="".concat(t,"1; expires=Thu, 01-Jan-1970 00:00:01 GMT"),e}catch(t){return!1}}();function $(t,e,n){if(!T)return!1;var r="";if(n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3),r="; expires=".concat(o.toGMTString())}document.cookie="".concat(t,"=").concat(e).concat(r,"; path=/")}function D(t){if(!T)return!1;for(var e="".concat(t,"="),n=document.cookie.split(";"),r=0;r<n.length;r++){for(var o=n[r];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(e))return o.substring(e.length,o.length)}return null}function G(t){return decodeURIComponent(t).replace(/\+/g," ")}function U(t){if(!V)return!1;var e=t||document.referrer;if(e){var n=window.document.location.port,r=e.split("/")[2];return n&&(r=r.replace(":".concat(n),"")),r!==window.location.hostname}return!1}function Y(t){var e=function(t){if(t){var e=t.match(/\?(.*)/);return e&&e[1]?e[1].split("#")[0]:""}return V&&window.location.search.substring(1)}(t);return e?function(t){var e,n=/([^&=]+)=?([^&]*)/g,r={};for(;e=n.exec(t);){var o=G(e[1]),a=G(e[2]);if("[]"===o.substring(o.length-2))o=o.substring(0,o.length-2),(r[o]||(r[o]=[])).push(a);else{var i=""===a||a;r[o]=i}}for(var c in r){var u=c.split("[");if(1<u.length){var s=[];u.forEach(function(t,e){var n=t.replace(/[?[\]\\ ]/g,"");s.push(n)}),B(r,s,r[c]),delete r[c]}}return r}(e):{}}function B(t,e,n){for(var r=e.length-1,o=0;o<r;++o){var a=e[o];a in t||(t[a]={}),t=t[a]}t[e[r]]=n}function J(o,a){return V?new Promise(function(t,e){if(window.history&&window.history.replaceState){var n=window.location.href,r=function(t,e){var n=(t.split("?")||[,])[1];if(!n||-1===n.indexOf(e))return t;var r=new RegExp("(\\&|\\?)".concat(e,'([_A-Za-z0-9"+=.%]+)'),"g"),o="?".concat(n).replace(r,"").replace(/^&/,"?");return t.replace("?".concat(n),o)}(n,o);n!==r&&history.replaceState({},"",r)}return a&&a(),t()}):Promise.resolve()}function H(t){return(function(t){if(!V)return null;var e=document.createElement("a");return e.setAttribute("href",t),e.hostname}(t)||"").split(".").slice(-2).join(".")}var W="google";var X={"daum.net":"q","eniro.se":"search_word","naver.com":"query","yahoo.com":"p","msn.com":"q","aol.com":"q","lycos.com":"q","ask.com":"q","cnn.com":"query","about.com":"terms","baidu.com":"wd","yandex.com":"text","seznam.cz":"q","search.com":"q","yam.com":"k","kvasir.no":"q","terra.com":"query","mynet.com":"q","rambler.ru":"words",google:"q","bing.com":{p:"q",n:"live"}};function Z(t){return(Z="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})(t)}function K(e){var n;try{void 0===(n=JSON.parse(e))&&(n=e),"true"===n&&(n=!0),"false"===n&&(n=!1),parseFloat(n)===n&&"object"!==Z(n)&&(n=parseFloat(n))}catch(t){n=e}return n}var Q="undefined"!=typeof self&&self?self:"undefined"!=typeof window&&window?window:"undefined"!=typeof global&&global?global:"undefined"!=typeof globalThis&&globalThis?globalThis:void 0;var tt=function(){if(!V)return!1;try{if("undefined"==typeof localStorage||"undefined"==typeof JSON)return!1;localStorage.setItem("_test_","1"),localStorage.removeItem("_test_")}catch(t){return!1}return!0}();function et(t){return tt&&(!t||"localStorage"===t)}function nt(t){return T&&(!t||"cookie"===t)}var rt={getItem:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!t)return null;var n=e.storage;if(et(n)){var r=localStorage.getItem(t);if(r||"localStorage"===n)return K(r)}if(nt(n)){var o=D(t);if(o||"cookie"===n)return K(o)}return Q[t]||null},setItem:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(!t||!e)return!1;var r=n.storage,o=JSON.stringify(e);if(et(r)){var a=K(localStorage.getItem(t));return localStorage.setItem(t,o),{value:e,oldValue:a,type:"localStorage"}}if(nt(r)){var i=K(D(t));return $(t,o),{value:e,oldValue:i,type:"cookie"}}var c=Q[t];return{value:Q[t]=e,oldValue:c,type:"window"}},removeItem:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!t)return!1;var n=e.storage;return et(n)?(localStorage.removeItem(t),null):nt(n)?(r=t,T&&$(r,"",-1),null):Q[t]=null;var r}};function ot(){for(var t,e,n,r,o=[],a=0;a<256;a++)o[a]=(a<16?"0":"")+a.toString(16);return t=at(),e=at(),n=at(),r=at(),"".concat(o[255&t]+o[t>>8&255]+o[t>>16&255]+o[t>>24&255],"-").concat(o[255&e]).concat(o[e>>8&255],"-").concat(o[e>>16&15|64]).concat(o[e>>24&255],"-").concat(o[63&n|128]).concat(o[n>>8&255],"-").concat(o[n>>16&255]).concat(o[n>>24&255]).concat(o[255&r]).concat(o[r>>8&255]).concat(o[r>>16&255]).concat(o[r>>24&255])}function at(){return 4294967295*Math.random()|0}var it=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","pluginRegister","pluginsRegistered","pluginFailed","loadPlugin","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],ct=it.reduce(function(t,e){return t[e]=e,t},{pluginRegisterType:function(t){return"pluginRegister:".concat(t)},pluginReadyType:function(t){return"pluginReady:".concat(t)}});var ut="__anon_id",st="__user_id",lt="__user_traits",ft=Object.freeze({ANON_ID:ut,USER_ID:st,USER_TRAITS:lt});var pt=a(function(P){!function(t){var u,e=Object.prototype,s=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",r=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag",i=t.regeneratorRuntime;if(i)P.exports=i;else{(i=t.regeneratorRuntime=P.exports).wrap=v;var f="suspendedStart",p="suspendedYield",d="executing",h="completed",m={},c={};c[o]=function(){return this};var l=Object.getPrototypeOf,y=l&&l(l(_([])));y&&y!==e&&s.call(y,o)&&(c=y);var g=E.prototype=w.prototype=Object.create(c);S.prototype=g.constructor=E,E.constructor=S,E[a]=S.displayName="GeneratorFunction",i.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===S||"GeneratorFunction"===(e.displayName||e.name))},i.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(g),t},i.awrap=function(t){return{__await:t}},x(I.prototype),I.prototype[r]=function(){return this},i.AsyncIterator=I,i.async=function(t,e,n,r){var o=new I(v(t,e,n,r));return i.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},x(g),g[a]="Generator",g[o]=function(){return this},g.toString=function(){return"[object Generator]"},i.keys=function(n){var r=[];for(var t in n)r.push(t);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},i.values=_,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return a.type="throw",a.arg=n,r.next=t,e&&(r.method="next",r.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(i&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:_(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=u),m}}}function v(t,e,n,r){var a,i,c,u,o=e&&e.prototype instanceof w?e:w,s=Object.create(o.prototype),l=new N(r||[]);return s._invoke=(a=t,i=n,c=l,u=f,function(t,e){if(u===d)throw new Error("Generator is already running");if(u===h){if("throw"===t)throw e;return k()}for(c.method=t,c.arg=e;;){var n=c.delegate;if(n){var r=O(n,c);if(r){if(r===m)continue;return r}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if(u===f)throw u=h,c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u=d;var o=b(a,i,c);if("normal"===o.type){if(u=c.done?h:p,o.arg===m)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u=h,c.method="throw",c.arg=o.arg)}}),s}function b(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function w(){}function S(){}function E(){}function x(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function I(u){var e;this._invoke=function(n,r){function t(){return new Promise(function(t,e){!function e(t,n,r,o){var a=b(u[t],u,n);if("throw"!==a.type){var i=a.arg,c=i.value;return c&&"object"==typeof c&&s.call(c,"__await")?Promise.resolve(c.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):Promise.resolve(c).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)})}o(a.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}}function O(t,e){var n=t.iterator[e.method];if(n===u){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=u,O(t,e),"throw"===e.method))return m;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var r=b(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,m;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=u),e.delegate=null,m):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function _(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(s.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=u,t.done=!0,t};return r.next=r}}return{next:k}}function k(){return{value:u,done:!0}}}(function(){return this||"object"==typeof self&&self}()||Function("return this")())}),dt=function(){return this||"object"==typeof self&&self}()||Function("return this")(),ht=dt.regeneratorRuntime&&0<=Object.getOwnPropertyNames(dt).indexOf("regeneratorRuntime"),mt=ht&&dt.regeneratorRuntime;dt.regeneratorRuntime=void 0;var yt=pt;if(ht)dt.regeneratorRuntime=mt;else try{delete dt.regeneratorRuntime}catch(t){dt.regeneratorRuntime=void 0}var gt=yt;function vt(t,e,n,r,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}var bt=function(c){return function(){var t=this,i=arguments;return new Promise(function(e,n){var r=c.apply(t,i);function o(t){vt(r,e,n,o,a,"next",t)}function a(t){vt(r,e,n,o,a,"throw",t)}o(void 0)})}};function wt(o,a,i){return new Promise(function(e,n){return a()?e(o):i<1?n(L({},o,{queue:!0})):(r=10,new Promise(function(t){return setTimeout(t,r)})).then(function(t){return wt(o,a,i-10).then(e,n)});var r})}var St=function(t){if(Array.isArray(t))return t};var Et=function(t,e){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){o=!0,a=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n};var xt=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var It=function(t,e){return St(t)||Et(t,e)||xt()};function Ot(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(e).filter(function(t){var e=r.plugins||{};return!1!==e[t]&&(!0===e[t]||(!n[t]||!1!==n[t].enabled))}).map(function(t){return e[t]})}function At(t,e,n,r,o){return jt.apply(this,arguments)}function jt(){return(jt=bt(gt.mark(function t(e,n,r,o,a){var i,c,u,s,l,f,p,d,h,m,y;return gt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=n(),c=e.type,e._&&e._.called)return t.abrupt("return",e);t.next=4;break;case 4:return u=r.getState(),s=Ot(i,u.plugins,e.options),l=s.map(function(t){return t.NAMESPACE}),f=Ct(c,s,i),t.next=10,_t({action:e,data:{exact:f.before,namespaced:f.beforeNS},state:u,allPlugins:i,allMatches:f,instance:r,store:o,EVENTS:a});case 10:if(zt(p=t.sent,l.length))return t.abrupt("return",p);t.next=13;break;case 13:if(s.filter(function(t){return!qt(p,t.NAMESPACE)}),c.replace(/Start$/,"")!==c){t.next=20;break}t.t0=p,t.next=23;break;case 20:return t.next=22,_t({action:L({},p,{type:Lt(c)}),data:{exact:f.during,namespaced:f.duringNS},state:u,allPlugins:i,allMatches:f,instance:r,store:o,EVENTS:a});case 22:t.t0=t.sent;case 23:return d=t.t0,h="".concat(Lt(c),"End"),t.next=27,_t({action:L({},d,{type:h}),data:{exact:f.after,namespaced:f.afterNS},state:u,allPlugins:i,allMatches:f,instance:r,store:o,EVENTS:a});case 27:return m=t.sent,(y=Nt(m))&&y({payload:m}),t.abrupt("return",p);case 31:case"end":return t.stop()}},t,this)}))).apply(this,arguments)}function Nt(r){return!!r.meta&&Object.keys(r.meta).reduce(function(t,e){var n=r.meta[e];return"function"==typeof n?n:t},!1)}function _t(t){return kt.apply(this,arguments)}function kt(){return(kt=bt(gt.mark(function t(e){var m,i,y,n,g,r,v,o,b,w,a,S,E,x,c;return gt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return m=e.data,i=e.action,y=e.instance,n=e.state,g=e.allPlugins,r=e.allMatches,v=e.store,o=e.EVENTS,b=n.plugins,w=i.type,a=m.exact.map(function(t){return t.pluginName}),w.match(/Start$/)&&(a=r.during.map(function(t){return t.pluginName})),S=$t(y,a),E=m.exact.reduce(function(t,e){var n=e.pluginName,r=!1;return e.methodName.match(/^initialize/)||(r=!b[n].loaded),t["".concat(n)]=r,t},{}),t.next=9,m.exact.reduce(function(){var r=bt(gt.mark(function t(e,n,r){var u,o,a;return gt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return u=n.pluginName,t.next=3,e;case 3:if(o=t.sent,m.namespaced&&m.namespaced[u])return t.next=7,m.namespaced[u].reduce(function(){var r=bt(gt.mark(function t(e,n,r){var o,a,i,c;return gt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=function(n,r,o){return function(t,e){return L({},n,{abort:{reason:t,plugins:e||[r],caller:w,from:o||r}})}},t.next=3,e;case 3:if(o=t.sent,n.method&&"function"==typeof n.method){t.next=6;break}return t.abrupt("return",o);case 6:return Dt(n.methodName,n.pluginName),t.next=9,n.method({payload:o,instance:y,abort:a(o,u,n.pluginName),config:Tt(u,b,g),plugins:b});case 9:return i=t.sent,c="object"===R(i)?i:{},t.abrupt("return",Promise.resolve(L({},o,c)));case 12:case"end":return t.stop()}},t,this)}));return function(t,e,n){return r.apply(this,arguments)}}(),Promise.resolve(i));t.next=11;break;case 7:a=t.sent,o[u]=a,t.next=12;break;case 11:o[u]=i;case 12:return t.abrupt("return",Promise.resolve(o));case 13:case"end":return t.stop()}},t,this)}));return function(t,e,n){return r.apply(this,arguments)}}(),Promise.resolve({}));case 9:return x=t.sent,t.next=12,m.exact.reduce(function(){var r=bt(gt.mark(function t(e,n,r){var o,a,i,c,u,s,l,f,p,d,h;return gt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=m.exact.length===r+1,a=n.pluginName,i=g[a],t.next=5,e;case 5:if(c=t.sent,qt(u=x[a]?x[a]:{},a))return Pt({data:u,method:w,instance:y,pluginName:a,store:v}),t.abrupt("return",Promise.resolve(c));t.next=10;break;case 10:if(qt(c,a))return o&&Pt({data:c,method:w,instance:y,store:v}),t.abrupt("return",Promise.resolve(c));t.next=13;break;case 13:if(E.hasOwnProperty(a)&&!0===E[a])return v.dispatch({type:"queue",plugin:a,payload:u,_:{called:"queue",from:"queueMechanism"}}),t.abrupt("return",Promise.resolve(c));t.next=16;break;case 16:return s=S(x[a],g[a]),t.next=19,i[w]({hello:a,abort:s.abort,payload:x[a],instance:y,config:Tt(a,b,g),plugins:b});case 19:return l=t.sent,f="object"===R(l)?l:{},p=L({},c,f),qt(d=x[a],a)?Pt({data:d,method:w,instance:y,pluginName:a,store:v}):(h="".concat(w,":").concat(a),(h.match(/:/g)||[]).length<2&&!w.match(/^bootstrap/)&&!w.match(/^ready/)&&y.dispatch(L({},d,{type:h,_:{called:h,from:"submethod"}}))),t.abrupt("return",Promise.resolve(p));case 25:case"end":return t.stop()}},t,this)}));return function(t,e,n){return r.apply(this,arguments)}}(),Promise.resolve(i));case 12:if(c=t.sent,w.match(/Start$/)||w.match(/^registerPlugin/)||w.match(/^ready/)||w.match(/^bootstrap/)||w.match(/^params/)){t.next=18;break}if(o.plugins.includes(w),c._&&c._.originalAction===w)return t.abrupt("return",c);t.next=17;break;case 17:v.dispatch(L({},c,{_:{originalAction:c.type,called:c.type,from:"engineEnd"}}));case 18:return t.abrupt("return",c);case 19:case"end":return t.stop()}},t,this)}))).apply(this,arguments)}function Pt(t){var e=t.data,n=t.method,r=(t.instance,t.pluginName),o=t.store,a=r?":".concat(r):"",i="".concat(n,"Aborted").concat(a);o.dispatch(L({},e,{type:i,_:{called:i,from:"abort"}}))}function Tt(t,e,n){return e[t]&&e[t].config?e[t].config:n[t]&&n[t].config?n[t].config:{}}function Mt(n,t){return t.reduce(function(t,e){return e[n]?t.concat({methodName:n,pluginName:e.NAMESPACE,method:e[n]}):t},[])}function Lt(t){return t.replace(/Start$/,"")}function Rt(t,e){var n=Lt(t),r=e?":".concat(e):"";return["".concat(t).concat(r),"".concat(n).concat(r),"".concat(n,"End").concat(r)]}function Ct(u,s,t){var e=Rt(u).map(function(t){return Mt(t,s)});return s.reduce(function(t,e){var n=e.NAMESPACE,r=Rt(u,n).map(function(t){return Mt(t,s)}),o=It(r,3),a=o[0],i=o[1],c=o[2];return a.length&&(t.beforeNS[n]=a),i.length&&(t.duringNS[n]=i),c.length&&(t.afterNS[n]=c),t},{before:e[0],beforeNS:{},during:e[1],duringNS:{},after:e[2],afterNS:{}})}function qt(t,e){var n=t.abort;return!!n&&(!0===n||(Vt(n,e)||n&&Vt(n.plugins,e)))}function zt(t,e){var n=t.abort;if(!n)return!1;if(!0===n||"string"==typeof n)return!0;var r=n.plugins;return Ft(n)&&n.length===e||Ft(r)&&r.length===e}function Ft(t){return Array.isArray(t)}function Vt(t,e){return!(!t||!Ft(t))&&t.includes(e)}function $t(m,y){return function(t,e,n){var r=e.config,o=e.NAMESPACE,a="".concat(o,".").concat(t.type);n&&(a=n.event);var i,c,u,s,l,f,p,d,h=t.type.match(/Start$/)?(u=o,s=a,l=y,f=n,p=t,function(t,e){var n=f?f.NAMESPACE:u,r=e&&Ft(e)?e:l;if(f&&(!(r=e&&Ft(e)?e:[u]).includes(u)||1!==r.length))throw new Error('Method "'.concat(s,'" can only abort "').concat(u,'" plugin. ').concat(JSON.stringify(r)," input valid"));return L({},p,{abort:{reason:t,plugins:r,caller:s,_:n}})}):(i=t,c=a,function(){throw new Error('Action "'.concat(i.type,'" is not cancellable. Remove abort call from plugin ').concat(c))});return{payload:(d=t,Object.keys(d).reduce(function(t,e){return"type"===e||("object"===R(d[e])?t[e]=Object.assign({},d[e]):t[e]=d[e]),t},{})),instance:m,config:r||{},abort:h}}}function Dt(t,e){var n=Gt(t);if(n&&n.name===e){var r=Gt(n.method),o=r?'or "'.concat(r.method,'"'):"";throw new Error(['Plugin "'.concat(e,'" is calling method [').concat(t,"]"),"Plugins should not call their own namespace.",'Use "'.concat(n.method,'" ').concat(o,' in "').concat(e,'" plugin instead of "').concat(t,'"')].join("\n"))}}function Gt(t){var e=t.match(/(.*):(.*)/);return!!e&&{method:e[1],name:e[2]}}function Ut(){return(new Date).getTime()}var Yt=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Bt=function t(){var i=this;Yt(this,t),o(this,"before",[]),o(this,"after",[]),o(this,"addMiddleware",function(t,e){i[e]=i[e].concat(t)}),o(this,"removeMiddleware",function(e,t){var n=i[t].findIndex(function(t){return t===e});-1!==n&&(i[t]=[].concat(M(i[t].slice(0,n)),M(i[t].slice(n+1))))}),o(this,"resetMiddlewares",function(t){t?i[t]=[]:(i.before=[],i.after=[])}),o(this,"dynamicMiddlewares",function(a){return function(o){return function(r){return function(t){var e={getState:o.getState,dispatch:function(t){return o.dispatch(t)}},n=i[a].map(function(t){return t(e)});return z.apply(void 0,M(n))(r)(t)}}}})},Jt={};function Ht(c){return function(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Jt,t=1<arguments.length?arguments[1]:void 0,e={};if("initialize:aborted"===t.type)return n;if(/^registerPlugin:([^:]*)$/.test(t.type)){var r=t.type.split(":")[1],o=c()[r];return o&&r?(e[r]={enabled:!0,initialized:!o.initialize,loaded:Boolean(o.loaded()),config:o.config||{}},L({},n,e)):n}if(/^initialize:([^:]*)$/.test(t.type)){var a=t.type.split(":")[1],i=c()[a];return i&&a?(e[a]=L({},n[a],{initialized:!0,loaded:Boolean(i.loaded())}),L({},n,e)):n}if(/^ready:([^:]*)$/.test(t.type))return e[t.name]=L({},n[t.name],{loaded:!0}),L({},n,e);switch(t.type){case ct.pluginFailed:return e[t.name]=L({},n[t.name],{loaded:!1}),L({},n,e);case ct.disablePlugin:return Array.isArray(t.name)?e=t.name.reduce(function(t,e){return t[e]=L({},n[e],{enabled:!1}),t},n):e[t.name]=L({},n[t.name],{enabled:!1}),L({},n,e);case ct.enablePlugin:return Array.isArray(t.name)?e=t.name.reduce(function(t,e){return t[e]=L({},n[e],{enabled:!0}),t},n):e[t.name]=L({},n[t.name],{enabled:!0}),L({},n,e);default:return n}}}var Wt,Xt,Zt,Kt;Wt=function(){if(!V)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"}(),Xt=function(t,e){if(!V)return!1;var n={source:"(direct)",medium:"(none)",campaign:"(not set)"};t&&U(t)&&(n.referrer=t);var r=function(t){if(!t||!V)return!1;var e,n,r=H(t),o=document.createElement("a");if(o.href=t,-1<o.hostname.indexOf(W)&&(r=W),X[r]){var a=X[r],i="string"==typeof a?a:a.p,c=new RegExp(i+"=.*?([^&#]*|$)","gi"),u=o.search.match(c);return{source:a.n||(e=r,n=e.split("."),1<n.length?n.slice(0,-1).join("."):e),medium:"organic",term:(u?u[0].split("=")[1]:"")||"(not provided)"}}var s=U(t)?"referral":"internal";return{source:o.hostname,medium:s}}(t);r&&Object.keys(r).length&&(n=Object.assign({},n,r));var o=Y(e),a=Object.keys(o);if(a.length){var i=a.reduce(function(t,e){return e.match(/^utm_/)&&(t["".concat(e.replace(/^utm_/,""))]=o[e]),e.match(/^(d|g)clid/)&&(t.source=W,t.medium=o.gclid?"cpc":"cpm",t[e]=o[e]),t},{});n=Object.assign({},n,i),(o.dclid||o.gclid)&&(n.source=W,n.medium=o.gclid?"cpc":"cpm")}return n}(),Zt=function(){if(!V)return null;var t=navigator,e=t.language,n=t.languages,r=t.userLanguage;return n&&n.length?n[0]:r||e}(),Kt="undefined"==typeof Intl||"function"!=typeof Intl.DateTimeFormat||"function"!=typeof Intl.DateTimeFormat().resolvedOptions?null:Intl.DateTimeFormat().resolvedOptions().timeZone;var Qt={initialized:!1,sessionId:ot(),app:null,version:null,debug:!1,offline:!!V&&!navigator.onLine,os:{name:Wt},userAgent:V?navigator.userAgent:"node",library:{name:"analytics",version:"0.1.3"},timezone:Kt,locale:Zt,campaign:{},referrer:Xt};function te(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Qt,e=1<arguments.length?arguments[1]:void 0,n=t.initialized,r=e.type,o=e.campaign;switch(r){case ct.campaign:return L({},t,{campaign:o});case ct.offline:return L({},t,{offline:!0});case ct.online:return L({},t,{offline:!1});default:return n?t:L({},Qt,t,{initialized:!0})}}function ee(t){var e=function(){if(V)for(var t,e=document.getElementsByTagName("link"),n=0;t=e[n];n++)if("canonical"===t.getAttribute("rel"))return t.getAttribute("href")}();return e?e.match(/\?/)?e:"".concat(e).concat(t):window.location.href.replace(/#.*$/,"")}var ne=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(!V)return t;var e,n,r,o=document,a=o.title,i=o.referrer,c=window,u=c.location,s=c.innerWidth,l=c.innerHeight,f=u.hash,p=u.search,d=ee(p),h={title:a,url:d,path:(e=d,n=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e),r=n&&n[3]?n[3].split("?")[0].replace(/#.*$/,""):"","/".concat(r)),hash:f,search:p,width:s,height:l};return i&&""!==i&&(h.referrer=i),L({},h,t)},re=ne();function oe(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:re,e=1<arguments.length?arguments[1]:void 0;switch(e.type){case ct.page:return Object.assign({},t,e.data);default:return t}}var ae={event:{},lastEvent:null,history:[]};function ie(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:ae,e=1<arguments.length?arguments[1]:void 0,n=e.type,r=e.payload,o=e.options,a=e.eventName;switch(n){case ct.track:return L({},t,{event:{eventName:a,payload:r,options:o},lastEvent:e.eventName,history:t.history.concat(e)});default:return t}}var ce={actions:[]};function ue(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:ce,e=1<arguments.length?arguments[1]:void 0,n=e.type;e.data,e.timestamp;switch(n){case"queue":return L({},t,{actions:t.actions.concat(e)});case"dequeue":return[];default:return t}}var se="object"===("undefined"==typeof self?"undefined":R(self))&&self.self===self&&self||"object"===("undefined"==typeof global?"undefined":R(global))&&global.global===global&&global||void 0;function le(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;if(e&&e.type===ct.setItemEnd&&e.key===ut)return Object.assign({},t,{anonymousId:e.value});switch(e.type){case ct.identify:return Object.assign({},t,{userId:e.userId,traits:L({},t.traits,e.traits)});case ct.reset:return Object.assign({},t,{userId:null,anonymousId:null,traits:null});default:return t}}function fe(){return{userId:rt.getItem(st),anonymousId:rt.getItem(ut),traits:rt.getItem(lt)||{}}}var pe=function(t){return"__TEMP__".concat(t)};function de(t,e,n){var r=e.getState("user")[t];if(r)return r;if(n&&"object"===R(n)&&n[t])return n[t];var o=fe()[t];return o||(se[pe(t)]?se[pe(t)]:void 0)}function he(t,e,n,r){for(r=0,e=e.split?e.split("."):e;t&&r<e.length;)t=t[e[r++]];return void 0===t||r<e.length?n:t}function me(e){var n=function(t,e,n){if(!V)return!1;var r=window[(n?"add":"remove")+"EventListener"];t.split(" ").forEach(function(t){r(t,e)})}.bind(null,"online offline",function(t){return Promise.resolve(!navigator.onLine).then(e)});return n(!0),function(t){n(!1)}}function ye(){return Array.prototype.slice.call(arguments).reduce(function(t,e){return t||("function"==typeof e?e:t)},!1)}function ge(){return se.__ANALYTICS_HISTORY__=[],function(a){return function(t,e,n){var r=a(t,e,n),o=r.dispatch;return Object.assign(r,{dispatch:function(t){var e=t.action||t;return se.__ANALYTICS_HISTORY__.push(e),o(t)}})}}}function ve(t){return function(){return z(z.apply(null,arguments),ge())}}var be=function(t,e,n){return{type:ct.setItemStart,timestamp:Ut(),key:t,value:e,options:n}},we=function(t,e){return{type:ct.removeItemStart,timestamp:Ut(),key:t,options:e}},Se=function(t,e){return rt.getItem(t,e)};function Ee(){var t,s,i,h,m,y,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=e.reducers||{},r=(e.plugins||[]).reduce(function(t,e){if("function"!=typeof e&&e.NAMESPACE){var n=e.EVENTS?Object.keys(e.EVENTS).map(function(t){return e.EVENTS[t]}):[],r=Object.keys(e).concat(n),o=new Set(t.events.concat(r));if(t.events=Array.from(o),t.pluginsArray=t.pluginsArray.concat(e),t.plugins[e.NAMESPACE])throw new Error('Analytics "'.concat(e.NAMESPACE,'" loaded twice!'));return t.plugins[e.NAMESPACE]=e,t.plugins[e.NAMESPACE].loaded||(t.plugins[e.NAMESPACE].loaded=function(){return!0}),t}return t.middlewares=t.middlewares.concat(e),t},{plugins:{},pluginsArray:[],middlewares:[],events:[]}),c=r.plugins,o=["NAMESPACE","EVENTS","config","loaded"],a=r.events.filter(function(t){return!o.includes(t)}),u=new Set(a.concat(it).filter(function(t){return!o.includes(t)})),l=Array.from(u).sort(),f=a.sort(),p=function(t){return t?Object.keys(c).map(function(t){return c[t]}):c},d=new Bt,g=d.addMiddleware,v=d.removeMiddleware,b=d.dynamicMiddlewares,w={identify:function(t,e,n,r){var o="string"==typeof t?t:null,a="object"===R(t)?t:e,i=n||{},c=ye(e,n,r),u=w.user(),s=(se[pe("userId")]=o)||a.userId||de("userId",w,a);P.dispatch(L({type:ct.identifyStart,userId:s,traits:a||{},options:i,anonymousId:u.anonymousId},u.id&&u.id!==o&&{previousId:u.id},{meta:L({timestamp:Ut()},c&&{callback:c})}))},track:function(t,e,n,r){var o="object"===R(t)?t.event:t;if(!o||"string"!=typeof o)throw new Error("No eventName not supplied");var a="object"===R(t)?t:e||{},i="object"===R(n)?n:{},c=ye(e,n,r),u=de("userId",w,e),s=de("anonymousId",w,e);P.dispatch({type:ct.trackStart,event:o,properties:a,options:i,userId:u,anonymousId:s,meta:L({timestamp:Ut()},c&&{callback:c})})},page:function(t,e,n){var r="object"===R(t)?t:{},o="object"===R(e)?e:{},a=ye(t,e,n),i=de("userId",w,r),c=de("anonymousId",w,r);P.dispatch({type:ct.pageStart,properties:ne(r),options:o,userId:i,anonymousId:c,meta:L({timestamp:Ut()},a&&{callback:a})})},user:function(t){if("userId"===t||"id"===t)return de("userId",w);var e=w.getState("user");return t?he(e,t):e},reset:function(t){var e;P.dispatch((e=t,{type:ct.resetStart,timestamp:Ut(),callback:e}))},ready:function(t){return w.on(ct.ready,t)},on:function(n,r){if(!n||!r||"function"!=typeof r)return!1;if("bootstrap"===n)throw new Error("Not allowed to listen to bootstrap");if("*"===n){var t=function(t){return function(e){return function(t){return t.type.match(/Start$|Start:/)&&r({payload:t,instance:w,plugins:c}),e(t)}}},e=function(t){return function(e){return function(t){return t.type.match(/Start$|Start:/)||r({payload:t,instance:w,plugins:c}),e(t)}}};return g(t,"before"),g(e,"after"),function(){v(t,"before"),v(e,"after")}}var o=n.match(/Start$|Start:/)?"before":"after",a=function(t){return function(e){return function(t){return t.type===n&&r({payload:t,instance:w,plugins:c}),e(t)}}};return g(a,o),function(){return v(a,o)}},once:function(t,e){var n=w.on(t,function(t){e({payload:t,instance:w,plugins:c}),n()});return n},getState:function(t){var e=P.getState();return t?he(e,t):Object.assign({},e)},dispatch:function(t){var e,n="string"==typeof t?{type:t}:t;if(e=n.type,it.includes(e))throw new Error('Trying to dispatch analytics reservedAction "'.concat(n.type,'"'));var r=n.meta||{},o=t._||{},a=L({},n,{meta:L({timestamp:Ut()},r),_:L({originalAction:n.type},o)});P.dispatch(a)},enablePlugin:function(t,e){var n,r;P.dispatch((n=t,r=e,{type:ct.enablePlugin,name:n,callback:r}))},disablePlugin:function(t,e){var n,r;P.dispatch((n=t,r=e,{type:ct.disablePlugin,name:n,callback:r}))},loadPlugin:function(t){P.dispatch({type:ct.loadPlugin,plugins:t?[t]:Object.keys(p())})},storage:{getItem:Se,setItem:function(t,e,n){P.dispatch(be(t,e,n))},removeItem:function(t,e){P.dispatch(we(t,e))}},setAnonymousId:function(t,e){w.storage.setItem(ut,t,e)},events:l,pluginEvents:f},S=r.middlewares.concat([b("before"),(h=w,m=p,y={all:l,plugins:f},function(d){return function(p){return e=bt(gt.mark(function t(e){var n,r,o,a,i,c,u,s,l,f;return gt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.type,r=e.name,o=e.callback,(a=e).abort)return t.abrupt("return",p(e));t.next=4;break;case 4:if(n!==ct.disablePlugin&&n!==ct.enablePlugin||o&&o(r),n===ct.initializeEnd&&(i=m(),c=Object.keys(i).map(function(t){return i[t]}),u=[],s=[],l=c.map(function(e){var t=e.loaded,n=e.NAMESPACE;return wt(e,t,1e4).then(function(t){d.dispatch({type:"ready:".concat(n),name:n,events:Object.keys(e).filter(function(t){return!["NAMESPACE","config","loaded"].includes(t)})}),u=u.concat(n)}).catch(function(t){if(t instanceof Error)throw new Error(t);return s=s.concat(t.NAMESPACE),t})}),Promise.all(l).then(function(t){setTimeout(function(){d.dispatch({type:"ready",plugins:u,failed:s})},0)})),"bootstrap"!==n)return t.next=9,At(e,m,h,d,y);t.next=11;break;case 9:return f=t.sent,t.abrupt("return",p(f));case 11:return t.abrupt("return",p(a));case 12:case"end":return t.stop()}},t,this)})),function(t){return e.apply(this,arguments)};var e}}),function(t){return function(a){return function(t){var e=t.type,n=t.key,r=t.value,o=t.options;if(e===ct.setItem||e===ct.removeItem){if(t.abort)return a(t);e===ct.setItem?rt.setItem(n,r,o):rt.removeItem(n,o)}return a(t)}}},(i=w,function(a){return function(o){return function(t){if(t.type===ct.bootstrap){rt.getItem(ut)||i.storage.setItem(ut,ot());var n=Y(),e=Object.keys(n);if(e.length){var r=e.reduce(function(t,e){return(e.match(/^utm_/)||e.match(/^(d|g)clid/))&&(t.campaign[e]=n[e]),e.match(/^an_prop_/)&&(t.props["".concat(e.replace(/^an_prop_/,""))]=n[e]),e.match(/^an_trait_/)&&(t.traits["".concat(e.replace(/^an_trait_/,""))]=n[e]),t},{campaign:{},props:{},traits:{}});a.dispatch(L({type:ct.params,raw:n},r)),n.an_uid&&setTimeout(function(){i.identify(n.an_uid,r.traits)},0),n.an_event&&setTimeout(function(){i.track(n.an_event,r.props)},0),Object.keys(r.campaign).length&&a.dispatch({type:ct.campaign,campaign:r.campaign}),n.an_clean&&setTimeout(function(){J("an_")},0)}}return o(t)}}}),(t=w,s=t.storage,function(u){return function(c){return function(t){var e=t.userId,n=t.traits,r=t.options,o=t.callback;if(t.type===ct.reset&&(s.removeItem(st),s.removeItem(lt),s.removeItem(ut),o&&"function"==typeof o&&o()),t.type===ct.identify){var a=s.getItem(st),i=s.getItem(lt)||{};a&&a!==e&&u.dispatch({type:ct.userIdChanged,old:{userId:a,traits:i},new:{userId:e,traits:n},options:r}),e&&s.setItem(st,e),n&&s.setItem(lt,L({},i,n))}return c(t)}}}),b("after")]),E={context:te,user:le,page:oe,track:ie,plugins:Ht(p),queue:ue},x=z,I=z;if(V&&e.debug){var O=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;O&&(x=O({trace:!0,traceLimit:25})),I=function(){return 0===arguments.length?ge():"object"===R(arguments[0])?ve(arguments[0]):ve().apply(null,arguments)}}var A,j,N,_=(A=e,Object.keys(A).reduce(function(t,e){return"plugins"===e||"reducers"===e||(t[e]=A[e]),t},{})),k={context:_,user:fe(),plugins:r.pluginsArray.reduce(function(t,e){var n=e.NAMESPACE,r=e.config,o=e.loaded;return t[n]={enabled:!0,initialized:!e.initialize,loaded:Boolean(o()),config:r||{}},t},{})},P=C(q(L({},E,n)),k,I(x(function(){for(var t=arguments.length,u=Array(t),e=0;e<t;e++)u[e]=arguments[e];return function(c){return function(t,e,n){var r,o=c(t,e,n),a=o.dispatch,i={getState:o.getState,dispatch:function(t){return a(t)}};return r=u.map(function(t){return t(i)}),a=z.apply(void 0,r)(o.dispatch),F({},o,{dispatch:a})}}}.apply(void 0,M(S))))),T=Object.keys(c);return P.dispatch({type:ct.bootstrap,plugins:T,config:_}),P.dispatch({type:ct.registerPlugins,plugins:T}),r.pluginsArray.map(function(t,e){var n=t.bootstrap,r=t.config;n&&"function"==typeof n&&n({instance:w,config:r,payload:t});var o=Ht.length===e+1;P.dispatch({type:"registerPlugin:".concat(t.NAMESPACE),name:t.NAMESPACE,plugin:t}),o&&P.dispatch({type:ct.initializeStart,plugins:T})}),me(function(t){P.dispatch({type:t?ct.offline:ct.online})}),j=P,N=p,setInterval(function(){var i=N(),t=j.getState(),c=t.plugins,e=t.context,u=t.queue;if(!e.offline&&u&&u.actions&&u.actions.length){var n=u.actions.reduce(function(t,e,n){return c[e.plugin].loaded?(t.process.push(e),t.processIndex.push(n)):(t.requeue.push(e),t.requeueIndex.push(n)),t},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(n.processIndex&&n.processIndex.length){n.processIndex.forEach(function(t){var e=u.actions[t],n=e.plugin,r=e.payload.type,o=i[n][r];if(o&&"function"==typeof o){o({payload:e.payload,config:c[n].config});var a="".concat(r,":").concat(n);j.dispatch(L({},e.payload,{type:a,meta:{called:!0},_:{called:a,from:"queueDrain"}}))}});var r=u.actions.filter(function(t,e){return-1===n.processIndex.indexOf(e)});u.actions=r}}},3e3),e.exposeRedux?Object.assign({},w,{dispatch:P.dispatch,subscribe:P.subscribe,replaceReducer:P.replaceReducer}):w}t.default=Ee,t.analytics=Ee,t.EVENTS=ct,t.CONSTANTS=ft}(this.window=this.window||{}); |
{ | ||
"name": "analytics", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Pluggable analytics library", | ||
@@ -53,3 +53,3 @@ "keywords": [ | ||
"dependencies": { | ||
"analytics-utils": "^0.0.18", | ||
"analytics-utils": "^0.0.19", | ||
"redux": "^3.6.0" | ||
@@ -92,3 +92,3 @@ }, | ||
}, | ||
"gitHead": "0ffae15536723604d69310cdf98142184d41da34" | ||
"gitHead": "f224554ce7e0afb287944ed95ef513587df0f7dd" | ||
} |
414
README.md
@@ -1,7 +0,13 @@ | ||
# Analytics | ||
# Analytics 📊 | ||
An extendable analytics library designed to work with any third party analytics tool. | ||
A lightweight, extendable analytics library designed to work with **any** third party analytics provider to track page views, custom events, & identify users. | ||
Connect with your favorite analytic providers, trigger custom logic based on user activity, or easily provide opt out mechanisms for visitors who wish to turn off analytics entirely. | ||
The `analytics` library allows users to: | ||
- Connect with your favorite analytics providers | ||
- Trigger custom logic based on user activity | ||
- Extend with functionality via [plugins](#analytic-plugins) | ||
- Easily allow visitors to opt out of tracking | ||
- [... and lots more](#features) | ||
## Table of Contents | ||
@@ -19,28 +25,25 @@ <!-- AUTO-GENERATED-CONTENT:START (TOC:collapse=true&collapseText=Click to expand) --> | ||
- [API](#api) | ||
* [Configuration](#configuration) | ||
* [analytics.identify](#analyticsidentify) | ||
* [analytics.track](#analyticstrack) | ||
* [analytics.page](#analyticspage) | ||
* [analytics.getState](#analyticsgetstate) | ||
* [analytics.user](#analyticsuser) | ||
* [analytics.reset](#analyticsreset) | ||
* [analytics.dispatch](#analyticsdispatch) | ||
* [analytics.storage](#analyticsstorage) | ||
* [analytics.storage.getItem](#analyticsstoragegetitem) | ||
* [analytics.storage.setItem](#analyticsstoragesetitem) | ||
* [analytics.storage.removeItem](#analyticsstorageremoveitem) | ||
* [analytics.user](#analyticsuser) | ||
* [analytics.ready](#analyticsready) | ||
* [analytics.on](#analyticson) | ||
* [analytics.once](#analyticsonce) | ||
* [analytics.getState](#analyticsgetstate) | ||
* [analytics.enablePlugin](#analyticsenableplugin) | ||
* [analytics.disablePlugin](#analyticsdisableplugin) | ||
* [analytics.loadPlugin](#analyticsloadplugin) | ||
* [analytics.events](#analyticsevents) | ||
* [analytics.pluginEvents](#analyticspluginevents) | ||
* [analytics.storage](#analyticsstorage) | ||
* [analytics.storage.getItem](#analyticsstoragegetitem) | ||
* [analytics.storage.setItem](#analyticsstoragesetitem) | ||
* [analytics.storage.removeItem](#analyticsstorageremoveitem) | ||
- [Analytic plugins](#analytic-plugins) | ||
- [Creating analytics plugins](#creating-analytics-plugins) | ||
* [React to any event](#react-to-any-event) | ||
* [(optionally) Use middleware](#optionally-use-middleware) | ||
* [Optional - Using middleware](#optional---using-middleware) | ||
* [Opt out example plugin](#opt-out-example-plugin) | ||
- [Plugin Naming Conventions](#plugin-naming-conventions) | ||
- [CONTRIBUTING](#contributing) | ||
- [Contributing](#contributing) | ||
@@ -63,7 +66,7 @@ </details> | ||
This library aims to solves that with a simple abstraction layer. | ||
This library aims to solves that with a simple pluggable abstraction layer. | ||
## Philosophy | ||
> You should never be locked into a tool. | ||
> You should never be locked into a tool | ||
@@ -91,2 +94,3 @@ To add or remove an analytics provider adjust the `plugins` you load into `analytics`. | ||
/* Initialize analytics */ | ||
const analytics = Analytics({ | ||
@@ -105,9 +109,12 @@ app: 'my-app-name', | ||
// Fire a page view | ||
/* Track a page view */ | ||
analytics.page() | ||
// Fire event tracking | ||
/* Track a custom event */ | ||
analytics.track('userPurchase', { | ||
price: 20 | ||
item: 'pink socks' | ||
}) | ||
// Identify a visitor | ||
/* Identify a visitor */ | ||
analytics.identify('user-id-xyz', { | ||
@@ -118,3 +125,2 @@ firstName: 'bill', | ||
}) | ||
//... | ||
``` | ||
@@ -176,12 +182,12 @@ | ||
<!-- AUTO-GENERATED-CONTENT:START (API_DOCS) --> | ||
### analytics.identify | ||
### Configuration | ||
Identify a user. This will trigger `identify` calls in any installed plugins and will set user data in localStorage | ||
Analytics library | ||
**Arguments** | ||
- **userId** <code>String</code> - Unique ID of user | ||
- **[traits]** <code>Object</code> - Object of user traits | ||
- **[options]** <code>Object</code> - Options to pass to identify call | ||
- **[callback]** <code>Function</code> - Optional callback function after identify completes | ||
- **config** <code>object</code> - analytics core config | ||
- **[config.app]** (optional) <code>string</code> - Name of site / app | ||
- **[config.version]** (optional) <code>string</code> - Version of your app | ||
- **[config.plugins]** (optional) <code>array</code> - Array of analytics plugins | ||
@@ -191,18 +197,23 @@ **Example** | ||
```js | ||
identify('xyz-123', { | ||
name: 'steve', | ||
company: 'hello-clicky' | ||
import Analytics from 'analytics' | ||
// initialize analytics | ||
const analytics = Analytics({ | ||
app: 'my-awesome-app', | ||
plugins: [ | ||
...importedPlugins | ||
] | ||
}) | ||
``` | ||
### analytics.track | ||
### analytics.identify | ||
Track an analytics event. This will trigger `track` calls in any installed plugins | ||
Identify a user. This will trigger `identify` calls in any installed plugins and will set user data in localStorage | ||
**Arguments** | ||
- **eventName** <code>String</code> - Event name | ||
- **[payload]** <code>Object</code> - Event payload | ||
- **[options]** <code>Object</code> - Event options | ||
- **[callback]** <code>Function</code> - Callback to fire after tracking completes | ||
- **userId** <code>String</code> - Unique ID of user | ||
- **[traits]** (optional) <code>Object</code> - Object of user traits | ||
- **[options]** (optional) <code>Object</code> - Options to pass to identify call | ||
- **[callback]** (optional) <code>Function</code> - Callback function after identify completes | ||
@@ -212,28 +223,35 @@ **Example** | ||
```js | ||
analytics.track('buttonClick') | ||
``` | ||
// Basic user id identify | ||
analytics.identify('xyz-123') | ||
### analytics.page | ||
// Identify with additional traits | ||
analytics.identify('xyz-123', { | ||
name: 'steve', | ||
company: 'hello-clicky' | ||
}) | ||
Trigger page view. This will trigger `page` calls in any installed plugins | ||
// Disable identify for specific plugin | ||
analytics.identify('xyz-123', {}, { | ||
plugins: { | ||
// disable for segment plugin | ||
segment: false | ||
} | ||
}) | ||
**Arguments** | ||
- **[data]** <code>String</code> - (optional) page data | ||
- **[options]** <code>Object</code> - Event options | ||
- **[callback]** <code>Function</code> - Callback to fire after page view call completes | ||
**Example** | ||
```js | ||
analytics.page() | ||
// Fire callback with 2nd or 3rd argument | ||
analytics.identify('xyz-123', () => { | ||
console.log('do this after identify') | ||
}) | ||
``` | ||
### analytics.getState | ||
### analytics.track | ||
Get data about user, activity, or context. You can access sub-keys of state with `dot.prop` syntax. | ||
Track an analytics event. This will trigger `track` calls in any installed plugins | ||
**Arguments** | ||
- **[key]** <code>string</code> - (optional) dotprop sub value of state | ||
- **eventName** <code>String</code> - Event name | ||
- **[payload]** (optional) <code>Object</code> - Event payload | ||
- **[options]** (optional) <code>Object</code> - Event options | ||
- **[callback]** (optional) <code>Function</code> - Callback to fire after tracking completes | ||
@@ -243,56 +261,69 @@ **Example** | ||
```js | ||
// Get the current state of analytics | ||
analytics.getState() | ||
// Basic event tracking | ||
analytics.track('buttonClicked') | ||
// Get a subpath of state | ||
analytics.getState('context.offline') | ||
``` | ||
// Event tracking with payload | ||
analytics.track('itemPurchased', { | ||
price: 11, | ||
sku: '1234' | ||
}) | ||
### analytics.reset | ||
// Disable specific plugin on track | ||
analytics.track('cartAbandoned', { | ||
items: ['xyz', 'abc'] | ||
}, { | ||
plugins: { | ||
// disable track event for segment | ||
segment: false | ||
} | ||
}) | ||
Clear all information about the visitor & reset analytic state. | ||
// Fire callback with 2nd or 3rd argument | ||
analytics.track('newsletterSubscribed', () => { | ||
console.log('do this after track') | ||
}) | ||
``` | ||
**Arguments** | ||
### analytics.page | ||
- **[callback]** <code>Function</code> - Handler to run after reset | ||
Trigger page view. This will trigger `page` calls in any installed plugins | ||
### analytics.dispatch | ||
Emit events for other plugins or middleware to react to. | ||
**Arguments** | ||
- **action** <code>Object</code> - event to dispatch | ||
- **[data]** (optional) <code>String</code> - Page data overrides. | ||
- **[options]** (optional) <code>Object</code> - Page tracking options | ||
- **[callback]** (optional) <code>Function</code> - Callback to fire after page view call completes | ||
**Example** | ||
### analytics.storage | ||
```js | ||
// Basic page tracking | ||
analytics.page() | ||
Storage utilities for persisting data. These methods will allow you to save data in localStorage, cookies, or to the window. | ||
// Page tracking with page data overides | ||
analytics.page({ | ||
url: 'https://google.com' | ||
}) | ||
// Disable specific plugin page tracking | ||
analytics.page({}, { | ||
plugins: { | ||
// disable page tracking event for segment | ||
segment: false | ||
} | ||
}) | ||
### analytics.storage.getItem | ||
Get value from storage | ||
**Arguments** | ||
- **key** <code>String</code> - storage key | ||
- **[options]** <code>Object</code> - storage options | ||
**Example** | ||
```js | ||
analytics.storage.getItem('storage_key') | ||
// Fire callback with 1st, 2nd or 3rd argument | ||
analytics.page(() => { | ||
console.log('do this after page') | ||
}) | ||
``` | ||
### analytics.storage.setItem | ||
### analytics.user | ||
Set storage value | ||
Get user data | ||
**Arguments** | ||
- **key** <code>String</code> - storage key | ||
- **value** <a href="any.html">any</a> - storage value | ||
- **[options]** <code>Object</code> - storage options | ||
- **[key]** (optional) <code>String</code> - dot.prop.path of user data. Example: 'traits.company.name' | ||
@@ -302,27 +333,19 @@ **Example** | ||
```js | ||
analytics.storage.setItem('storage_key', 'value') | ||
``` | ||
// Get all user data | ||
const userData = analytics.user() | ||
### analytics.storage.removeItem | ||
// Get user id | ||
const userId = analytics.user('userId') | ||
Remove storage value | ||
**Arguments** | ||
- **key** <code>String</code> - storage key | ||
- **[options]** <code>Object</code> - storage options | ||
**Example** | ||
```js | ||
analytics.storage.removeItem('storage_key') | ||
// Get user company name | ||
const companyName = analytics.user('traits.company.name') | ||
``` | ||
### analytics.user | ||
### analytics.reset | ||
Get user data | ||
Clear all information about the visitor & reset analytic state. | ||
**Arguments** | ||
- **[key]** <code>String</code> - dot.prop subpath of user data | ||
- **[callback]** (optional) <code>Function</code> - Handler to run after reset | ||
@@ -332,10 +355,4 @@ **Example** | ||
```js | ||
// get all user data | ||
const userData = analytics.user() | ||
// get user id | ||
const userId = analytics.user('userId') | ||
// get user company name | ||
const companyName = analytics.user('traits.company.name') | ||
// Reset current visitor | ||
analytics.reset() | ||
``` | ||
@@ -354,4 +371,4 @@ | ||
```js | ||
analytics.ready((action, instance) => { | ||
console.log('all plugins have loaded') | ||
analytics.ready() => { | ||
console.log('all plugins have loaded or were skipped', payload) | ||
}) | ||
@@ -372,5 +389,12 @@ ``` | ||
```js | ||
analytics.on('track', ({ payload, instance }) => { | ||
// Fire function when 'track' calls happen | ||
analytics.on('track', ({ payload }) => { | ||
console.log('track call just happened. Do stuff') | ||
}) | ||
// Remove listener before it is called | ||
const removeListener = analytics.on('track', ({ payload }) => { | ||
console.log('This will never get called') | ||
}) | ||
removeListener() // cleanup .on listener | ||
``` | ||
@@ -390,7 +414,32 @@ | ||
```js | ||
analytics.once('track', (action, instance) => { | ||
// Fire function only once 'track' | ||
analytics.once('track', ({ payload }) => { | ||
console.log('This will only triggered once') | ||
}) | ||
// Remove listener before it is called | ||
const removeOnce = analytics.once('track', ({ payload }) => { | ||
console.log('This will never get called') | ||
}) | ||
removeOnce() // cleanup once function | ||
``` | ||
### analytics.getState | ||
Get data about user, activity, or context. Access sub-keys of state with `dot.prop` syntax. | ||
**Arguments** | ||
- **[key]** (optional) <code>string</code> - dot.prop.path value of state | ||
**Example** | ||
```js | ||
// Get the current state of analytics | ||
analytics.getState() | ||
// Get a subpath of state | ||
analytics.getState('context.offline') | ||
``` | ||
### analytics.enablePlugin | ||
@@ -403,3 +452,3 @@ | ||
- **plugins** <code>String</code>|<code>Array</code> - name of plugins(s) to disable | ||
- **[callback]** <code>Function</code> - callback after enable runs | ||
- **[callback]** (optional) <code>Function</code> - callback after enable runs | ||
@@ -411,3 +460,3 @@ **Example** | ||
// enable multiple plugins at once | ||
// Enable multiple plugins at once | ||
analytics.enablePlugin(['google', 'segment']) | ||
@@ -433,9 +482,31 @@ ``` | ||
### analytics.loadPlugin | ||
### analytics.storage | ||
Load registered analytic providers. | ||
Storage utilities for persisting data. | ||
These methods will allow you to save data in localStorage, cookies, or to the window. | ||
**Example** | ||
```js | ||
// Pull storage off analytics instance | ||
const { storage } = analytics | ||
// Get value | ||
storage.getItem('storage_key') | ||
// Set value | ||
storage.setItem('storage_key', 'value') | ||
// Remove value | ||
storage.removeItem('storage_key') | ||
``` | ||
### analytics.storage.getItem | ||
Get value from storage | ||
**Arguments** | ||
- **namespace** <code>String</code> - integration namespace | ||
- **key** <code>String</code> - storage key | ||
- **[options]** (optional) <code>Object</code> - storage options | ||
@@ -445,13 +516,35 @@ **Example** | ||
```js | ||
analytics.loadPlugin('segment') | ||
analytics.storage.getItem('storage_key') | ||
``` | ||
### analytics.events | ||
### analytics.storage.setItem | ||
Events exposed by core analytics library and all loaded plugins | ||
Set storage value | ||
**Arguments** | ||
### analytics.pluginEvents | ||
- **key** <code>String</code> - storage key | ||
- **value** <a href="any.html">any</a> - storage value | ||
- **[options]** (optional) <code>Object</code> - storage options | ||
Events exposed by all loaded plugins | ||
**Example** | ||
```js | ||
analytics.storage.setItem('storage_key', 'value') | ||
``` | ||
### analytics.storage.removeItem | ||
Remove storage value | ||
**Arguments** | ||
- **key** <code>String</code> - storage key | ||
- **[options]** (optional) <code>Object</code> - storage options | ||
**Example** | ||
```js | ||
analytics.storage.removeItem('storage_key') | ||
``` | ||
<!-- AUTO-GENERATED-CONTENT:END --> | ||
@@ -483,16 +576,17 @@ | ||
Plugins are just plain javascript objects that expose methods for `analytics` core to register and call. | ||
Plugins are just plain javascript objects that expose methods for `analytics` to register and call. | ||
Here is a quick example of a plugin. This is a 'vanilla' plugin example for connecting a third party analytics tool | ||
Here is a quick example of a plugin: | ||
```js | ||
// vanilla-example.js | ||
export default function googleAnalytics(userConfig) { | ||
// plugin-example.js | ||
export default function pluginExample(userConfig) { | ||
// return object for analytics to use | ||
return { | ||
// All plugins require a namespace | ||
NAMESPACE: 'google-analytics', | ||
/* All plugins require a NAMESPACE */ | ||
NAMESPACE: 'my-example-plugin', | ||
/* Everything else below this is optional depending on your plugin requirements */ | ||
config: { | ||
whatEver: userConfig.fooBar, | ||
googleAnalyticsId: userConfig.id | ||
whatEver: userConfig.whatEver, | ||
elseYouNeed: userConfig.elseYouNeed | ||
}, | ||
@@ -513,3 +607,3 @@ initialize: ({ config }) => { | ||
// return boolean so analytics knows when it can send data to third party | ||
return !!window.gaplugins | ||
return !!window.myPluginLoaded | ||
} | ||
@@ -520,2 +614,6 @@ } | ||
`NAMESPACE` is required for all plugins. All other methods are optional. | ||
If you don't need to hook into `page` tracking, just omit the `page` key from your plugin object. | ||
To use a plugin, import it and pass it into the `plugins` array when you bootstrap `analytics`. | ||
@@ -525,3 +623,3 @@ | ||
import Analytics from 'analytics' | ||
import vanillaExample from './vanilla-example.js' | ||
import pluginExample from './plugin-example.js' | ||
@@ -531,3 +629,6 @@ const analytics = Analytics({ | ||
plugins: [ | ||
vanillaExample({ id: 'xyz-123' }), | ||
pluginExample({ | ||
whatEver: 'hello', | ||
elseYouNeed: 'there' | ||
}), | ||
...otherPlugins | ||
@@ -540,3 +641,3 @@ ] | ||
Plugins can react to any event flowing through `analytics`. | ||
Plugins can react to any event flowing through the `analytics` library. | ||
@@ -548,3 +649,3 @@ For example, if you wanted to trigger custom logic when `analytics` bootstraps you can attach a function handler to the `bootstrap` event. | ||
```js | ||
// plugin.js | ||
// Example Plugin plugin.js | ||
export default function myPlugin(userConfig) { | ||
@@ -554,12 +655,12 @@ return { | ||
bootstrap: ({ payload, config, instance }) => { | ||
// Do whatever on `bootstrap` | ||
// Do whatever on `bootstrap` event | ||
}, | ||
pageStart: ({ payload, config, instance }) => { | ||
// Fire custom logic before .page calls | ||
// Fire custom logic before analytics.page() calls | ||
}, | ||
pageEnd: ({ payload, config, instance }) => { | ||
// Fire custom logic after .page calls | ||
// Fire custom logic after analytics.page() calls | ||
}, | ||
trackStart: ({ payload, config, instance }) => { | ||
// Fire custom logic before .track calls | ||
// Fire custom logic before analytics.track() calls | ||
}, | ||
@@ -571,5 +672,5 @@ 'track:customerio': ({ payload, config, instance }) => { | ||
trackEnd: ({ payload, config, instance }) => { | ||
// Fire custom logic after .track calls | ||
// Fire custom logic after analytics.track() calls | ||
}, | ||
... | ||
// ... hook into other events | ||
} | ||
@@ -589,2 +690,3 @@ } | ||
plugins: [ | ||
// include myPlugin | ||
myPlugin(), | ||
@@ -599,5 +701,5 @@ customerIoPlugin({ | ||
### (optionally) Use middleware | ||
### Optional - Using middleware | ||
Alternatively, you can also add whatever middleware functionality you'd like from the `redux` ecosystem. | ||
Alternatively, you can also attach any middleware functionality you'd like from the `redux` ecosystem. | ||
@@ -608,7 +710,5 @@ ```js | ||
if (action.type) { | ||
console.log(`>> dispatching ${action.type}`, JSON.stringify(action)) | ||
console.log(`>> analytics dispatching ${action.type}`, JSON.stringify(action)) | ||
} | ||
let result = next(action) | ||
return result | ||
return next(action) | ||
} | ||
@@ -666,13 +766,17 @@ | ||
Plugins should follow a naming convention before being published to NPM | ||
Plugins should follow this naming convention before being published to npm | ||
``` | ||
analytics-plugin-{your-plugin-name} | ||
``` | ||
npm install analytics-plugin-awesome-thing | ||
E.g. An analytics plugin that does `awesome-stuff` should be named | ||
``` | ||
npm install analytics-plugin-awesome-stuff | ||
``` | ||
# CONTRIBUTING | ||
# Contributing | ||
Contributions are always welcome, no matter how large or small. Before contributing, | ||
please read the [code of conduct](CODE_OF_CONDUCT.md). |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
697100
17603
752
+ Addedanalytics-utils@0.0.19(transitive)
- Removedanalytics-utils@0.0.18(transitive)
Updatedanalytics-utils@^0.0.19