diff --git a/CHANGELOG.md b/CHANGELOG.md index ca2beedb..b5d6c85c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [3.0.3] - 2021-01-24 + +### Added + +- Missing breaking change notice in the changelog of version 3.0.0 for those using a wildcard `Access-Control-Allow-Origin` header + +### Fixed + +- Unknown sizes id when a size is zero (#217) +- Prevent unknown id errors like in #217 for other record properties +- Updated ackee-tracker which re-added `ignoreOwnVisits` for those using a wildcard `Access-Control-Allow-Origin` header + ## [3.0.2] - 2021-01-21 ### Fixed @@ -43,6 +55,14 @@ Oh, and we also reduced the JS file size of the UI by ~60%. ### Breaking changes +#### `Access-Control-Allow-Origin: "*"` not recommended + +> This change is relevant for you when using a wildcard as the Access-Control-Allow-Origin. + +Using a wildcard (`*`) for the `Access-Control-Allow-Origin` header was never recommended as it's neither a secure solution nor does it allow Ackee to ignore your own visits. Please disable the `ignoreOwnVisits` option in ackee-tracker if you're currently using a wildcard. The [SSL and HTTPS](docs/SSL%20and%20HTTPS.md) guide contains better alternatives. + +`ignoreOwnVisits` is now enabled by default and won't work when using a wildcard. + #### New `Access-Control-Allow-Credentials` header > This change is relevant for everyone. @@ -273,7 +293,7 @@ The first major back-end and front-end rewrite of Ackee with new API, dashboard, ### Added - Simply [deploy to Heroku](docs/Get%20started.md#with-heroku) by clicking one button (#72, thanks @aleccool213) -- `ACKEE_ALLOW_ORIGIN` option for [Heroku or other Platforms-As-A-Service](docs/CORS%20headers.md) (#73, thanks @aleccool213) +- `ACKEE_ALLOW_ORIGIN` option for [Platforms-As-A-Service](docs/CORS%20headers.md) (#73, thanks @aleccool213) ## [1.4.2] - 2019-12-19 diff --git a/dist/index.js b/dist/index.js index 0c53f46f..7d140bae 100644 --- a/dist/index.js +++ b/dist/index.js @@ -28,7 +28,7 @@ function f(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant=" * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */function Zs(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case Ds:switch(e=e.type){case qs:case Us:case Is:case Fs:case zs:case Ws:return e;default:switch(e=e&&e.$$typeof){case js:case Vs:case Ks:case Hs:case $s:return e;default:return t}}case As:return t}}}function Js(e){return Zs(e)===Us}var ec={AsyncMode:qs,ConcurrentMode:Us,ContextConsumer:js,ContextProvider:$s,Element:Ds,ForwardRef:Vs,Fragment:Is,Lazy:Ks,Memo:Hs,Portal:As,Profiler:Fs,StrictMode:zs,Suspense:Ws,isAsyncMode:function(e){return Js(e)||Zs(e)===qs},isConcurrentMode:Js,isContextConsumer:function(e){return Zs(e)===js},isContextProvider:function(e){return Zs(e)===$s},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===Ds},isForwardRef:function(e){return Zs(e)===Vs},isFragment:function(e){return Zs(e)===Is},isLazy:function(e){return Zs(e)===Ks},isMemo:function(e){return Zs(e)===Hs},isPortal:function(e){return Zs(e)===As},isProfiler:function(e){return Zs(e)===Fs},isStrictMode:function(e){return Zs(e)===zs},isSuspense:function(e){return Zs(e)===Ws},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===Is||e===Us||e===Fs||e===zs||e===Ws||e===Bs||"object"==typeof e&&null!==e&&(e.$$typeof===Ks||e.$$typeof===Hs||e.$$typeof===$s||e.$$typeof===js||e.$$typeof===Vs||e.$$typeof===Ys||e.$$typeof===Gs||e.$$typeof===Xs||e.$$typeof===Qs)},typeOf:Zs},tc=(n((function(e,t){})),n((function(e){e.exports=ec})));Function.call.bind(Object.prototype.hasOwnProperty);function nc(){}function rc(){}rc.resetWarningCache=nc;var ac=n((function(e){e.exports=function(){function e(e,t,n,r,a,o){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==o){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:rc,resetWarningCache:nc};return n.PropTypes=n,n}()})),oc=s.createContext(null);var ic=function(e){e()},lc=function(){return ic},uc={notify:function(){}};var sc=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=uc,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return Boolean(this.unsubscribe)},t.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=function(){var e=lc(),t=null,n=null;return{clear:function(){t=null,n=null},notify:function(){e((function(){for(var e=t;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],n=t;n;)e.push(n),n=n.next;return e},subscribe:function(e){var r=!0,a=n={callback:e,next:null,prev:n};return a.prev?a.prev.next=a:t=a,function(){r&&null!==t&&(r=!1,a.next?a.next.prev=a.prev:n=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}())},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=uc)},e}();function cc(){return(cc=Object.assign||function(e){for(var t=1;t=0||(a[n]=e[n]);return a}var fc={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},pc={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},mc={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},hc={};function yc(e){return tc.isMemo(e)?mc:hc[e.$$typeof]||fc}hc[tc.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},hc[tc.Memo]=mc;var vc=Object.defineProperty,gc=Object.getOwnPropertyNames,bc=Object.getOwnPropertySymbols,wc=Object.getOwnPropertyDescriptor,Ec=Object.getPrototypeOf,kc=Object.prototype;var Sc=function e(t,n,r){if("string"!=typeof n){if(kc){var a=Ec(n);a&&a!==kc&&e(t,a,r)}var o=gc(n);bc&&(o=o.concat(bc(n)));for(var i=yc(t),l=yc(n),u=0;u=0;r--){var a=t[r](e);if(a)return a}return function(t,r){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function Hc(e,t){return e===t}function Kc(e){var t=void 0===e?{}:e,n=t.connectHOC,r=void 0===n?Mc:n,a=t.mapStateToPropsFactories,o=void 0===a?$c:a,i=t.mapDispatchToPropsFactories,l=void 0===i?Fc:i,u=t.mergePropsFactories,s=void 0===u?qc:u,c=t.selectorFactory,d=void 0===c?Wc:c;return function(e,t,n,a){void 0===a&&(a={});var i=a,u=i.pure,c=void 0===u||u,f=i.areStatesEqual,p=void 0===f?Hc:f,m=i.areOwnPropsEqual,h=void 0===m?Dc:m,y=i.areStatePropsEqual,v=void 0===y?Dc:y,g=i.areMergedPropsEqual,b=void 0===g?Dc:g,w=dc(i,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),E=Bc(e,o,"mapStateToProps"),k=Bc(t,l,"mapDispatchToProps"),S=Bc(n,s,"mergeProps");return r(d,cc({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:E,initMapDispatchToProps:k,initMergeProps:S,pure:c,areStatesEqual:p,areOwnPropsEqual:h,areStatePropsEqual:v,areMergedPropsEqual:b},w))}}var Qc,Yc=Kc();Qc=vs.unstable_batchedUpdates,ic=Qc;var Gc=t(Ms).compose,Xc="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Gc:Gc.apply(null,arguments)};function Zc(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(a){return"function"==typeof a?a(n,r,e):t(a)}}}}var Jc=Zc();Jc.withExtraArgument=Zc;var ed="3.0.2",td="https://github.com/electerious/Ackee";const nd="ackee_state_3.0.2";var rd=(e,t)=>setTimeout((()=>{requestAnimationFrame(e)}),t),ad=1;var od,id,ld,ud={nextValue:function(){return(ad=(9301*ad+49297)%233280)/233280},seed:function(e){ad=e}},sd="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function cd(){ld=!1}function dd(e){if(e){if(e!==od){if(e.length!==sd.length)throw new Error("Custom alphabet for shortid must be "+sd.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,n){return t!==n.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+sd.length+" unique characters. These characters were not unique: "+t.join(", "));od=e,cd()}}else od!==sd&&(od=sd,cd())}function fd(){return ld||(ld=function(){od||dd(sd);for(var e,t=od.split(""),n=[],r=ud.nextValue();t.length>0;)r=ud.nextValue(),e=Math.floor(r*t.length),n.push(t.splice(e,1)[0]);return n.join("")}())}var pd={get:function(){return od||sd},characters:function(e){return dd(e),od},seed:function(e){ud.seed(e),id!==e&&(cd(),id=e)},lookup:function(e){return fd()[e]},shuffled:fd},md="object"==typeof window&&(window.crypto||window.msCrypto),hd=md&&md.getRandomValues?function(e){return md.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],n=0;n0&&(t+=bd(vd)),t+=bd(n)};var Ed=function(e){return!(!e||"string"!=typeof e||e.length<6)&&!new RegExp("[^"+pd.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e)},kd=n((function(e){var t=0;function n(){return wd(t)}e.exports=n,e.exports.generate=n,e.exports.seed=function(t){return pd.seed(t),e.exports},e.exports.worker=function(n){return t=n,e.exports},e.exports.characters=function(e){return void 0!==e&&pd.characters(e),pd.shuffled()},e.exports.isValid=Ed})),Sd=()=>`_${kd.generate()}`;const _d=Symbol(),xd=Symbol(),Td=Symbol(),Cd=(e,t)=>({type:_d,modalId:e,payload:t}),Nd=e=>({type:xd,modalId:e}),Rd=(e,t)=>({type:Td,modalId:e,payload:t});class Pd extends Error{constructor(e){super(e),this.name="HandledError",this.message=e}}var Od=(new Intl.DateTimeFormat).resolvedOptions().timeZone,Md=async({query:e,variables:t,props:n,signal:r})=>{try{const l=new Headers,u=n.token.value;l.append("Content-Type","application/json"),l.append("Time-Zone",Od),u&&l.append("Authorization",`Bearer ${u}`);const s=fetch("/api",{method:"post",headers:l,body:JSON.stringify({query:e,variables:t}),signal:r}),c=await(a=s,o="Request timeout",i=3e4,Promise.race([a,new Promise(((e,t)=>{setTimeout((()=>t(new Error(o))),i)}))]));if(!1===c.ok){const e=await c.text();throw new Error(e)}const d=await c.json();if(null!=d.errors){const e=d.errors[0].message;throw new Error(e)}return d.data}catch(e){if(console.error(e),"Token invalid"===e.message)throw n.resetState(),new Pd(e.message);throw e}var a,o,i},Ld=e=>{const t=Symbol(),n={};return e(((e=t)=>(null!=n[e]&&n[e].abort(),n[e]=new AbortController,n[e].signal)))};const Dd=Symbol(),Ad=Symbol(),Id=Symbol(),zd=Symbol(),Fd=Symbol(),$d=()=>({type:Dd}),jd=()=>({type:Ad}),qd=e=>({type:Id,value:e}),Ud=e=>({type:zd,payload:e}),Vd=e=>({type:Fd,payload:e}),Wd=Ld((e=>(t,n)=>async r=>{r(jd());try{const a=await Md({query:"\n\t\t\t\tmutation createToken($input: CreateTokenInput!) {\n\t\t\t\t\tcreateToken(input: $input) {\n\t\t\t\t\t\tpayload {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{input:{username:n.username,password:n.password}},props:t,signal:e()});r(qd(a.createToken.payload.id))}catch(e){if("AbortError"===e.name)return;if(r(Ud(!1)),"HandledError"===e.name)return;r(Vd(e))}})),Bd=Ld((e=>t=>async n=>{n($d());try{await Md({query:"\n\t\t\t\tmutation deleteToken($id: ID!) {\n\t\t\t\t\tdeleteToken(id: $id) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:t.token.value},props:t,signal:e()})}catch(e){if("AbortError"===e.name)return;if("HandledError"===e.name)return;n(Vd(e))}})),Hd=Symbol(),Kd=Symbol(),Qd=Symbol(),Yd=Symbol(),Gd=()=>({type:Hd}),Xd=e=>({type:Kd,value:e}),Zd=e=>({type:Qd,payload:e}),Jd=e=>({type:Yd,payload:e}),ef=Ld((e=>t=>async n=>{n(Gd());try{const r=await Md({query:"\n\t\t\t\tquery fetchPermanentTokens {\n\t\t\t\t\tpermanentTokens {\n\t\t\t\t\t\tid\n\t\t\t\t\t\ttitle\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",props:t,signal:e()});n(Xd(r.permanentTokens))}catch(e){if("AbortError"===e.name)return;if(n(Zd(!1)),"HandledError"===e.name)return;n(Jd(e))}})),tf=Ld((e=>(t,n,r)=>async a=>{a(Gd());try{await Md({query:"\n\t\t\t\tmutation updatePermanentToken($id: ID!, $input: UpdatePermanentTokenInput!) {\n\t\t\t\t\tupdatePermanentToken(id: $id, input: $input) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:n,input:{title:r.title}},props:t,signal:e(n)}),await a(ef(t))}catch(e){if("AbortError"===e.name)return;if(a(Zd(!1)),"HandledError"===e.name)return;a(Jd(e))}})),nf=Ld((e=>(t,n)=>async r=>{r(Gd());try{await Md({query:"\n\t\t\t\tmutation deletePermanentToken($id: ID!) {\n\t\t\t\t\tdeletePermanentToken(id: $id) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:n},props:t,signal:e(n)}),await r(ef(t))}catch(e){if("AbortError"===e.name)return;if(r(Zd(!1)),"HandledError"===e.name)return;r(Jd(e))}})),rf=Symbol(),af=Symbol(),of=Symbol(),lf=Symbol(),uf=Symbol(),sf=Symbol(),cf=Symbol(),df=Symbol(),ff=Symbol(),pf=Symbol(),mf=Symbol(),hf=Symbol(),yf=Symbol(),vf=()=>({type:pf}),gf=e=>({type:mf,value:e}),bf=e=>({type:hf,payload:e}),wf=e=>({type:yf,payload:e}),Ef=Ld((e=>t=>async n=>{n(vf());try{const r=await Md({query:"\n\t\t\t\tquery fetchDomains {\n\t\t\t\t\tdomains {\n\t\t\t\t\t\tid\n\t\t\t\t\t\ttitle\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",props:t,signal:e()});n(gf(r.domains))}catch(e){if("AbortError"===e.name)return;if(n(bf(!1)),"HandledError"===e.name)return;n(wf(e))}})),kf=Ld((e=>(t,n,r)=>async a=>{a(vf());try{await Md({query:"\n\t\t\t\tmutation updateDomain($id: ID!, $input: UpdateDomainInput!) {\n\t\t\t\t\tupdateDomain(id: $id, input: $input) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:n,input:{title:r.title}},props:t,signal:e(n)}),await a(Ef(t))}catch(e){if("AbortError"===e.name)return;if(a(bf(!1)),"HandledError"===e.name)return;a(wf(e))}})),Sf=Ld((e=>(t,n)=>async r=>{r(vf());try{await Md({query:"\n\t\t\t\tmutation deleteDomain($id: ID!) {\n\t\t\t\t\tdeleteDomain(id: $id) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:n},props:t,signal:e(n)}),await r(Ef(t))}catch(e){if("AbortError"===e.name)return;if(r(bf(!1)),"HandledError"===e.name)return;r(wf(e))}})),_f=Symbol(),xf=Symbol(),Tf=Symbol(),Cf=Symbol(),Nf=()=>({type:_f}),Rf=e=>({type:xf,value:e}),Pf=e=>({type:Tf,payload:e}),Of=e=>({type:Cf,payload:e}),Mf=Ld((e=>t=>async n=>{n(Nf());try{const r=await Md({query:"\n\t\t\t\tquery fetchEvents {\n\t\t\t\t\tevents {\n\t\t\t\t\t\tid\n\t\t\t\t\t\ttitle\n\t\t\t\t\t\ttype\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",props:t,signal:e()});n(Rf(r.events))}catch(e){if("AbortError"===e.name)return;if(n(Pf(!1)),"HandledError"===e.name)return;n(Of(e))}})),Lf=Ld((e=>(t,n,r)=>async a=>{a(Nf());try{await Md({query:"\n\t\t\t\tmutation updateEvent($id: ID!, $input: UpdateEventInput!) {\n\t\t\t\t\tupdateEvent(id: $id, input: $input) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:n,input:{title:r.title,type:r.type}},props:t,signal:e(n)}),await a(Mf(t))}catch(e){if("AbortError"===e.name)return;if(a(Pf(!1)),"HandledError"===e.name)return;a(Of(e))}})),Df=Ld((e=>(t,n)=>async r=>{r(Nf());try{await Md({query:"\n\t\t\t\tmutation deleteEvent($id: ID!) {\n\t\t\t\t\tdeleteEvent(id: $id) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:n},props:t,signal:e(n)}),await r(Mf(t))}catch(e){if("AbortError"===e.name)return;if(r(Pf(!1)),"HandledError"===e.name)return;r(Of(e))}}));var Af=(e,t)=>{vs.unstable_batchedUpdates((()=>{t.forEach((t=>e(t)))}))};const If=Symbol(),zf=Symbol(),Ff=Symbol(),$f=Symbol(),jf=(e,t)=>({type:If,id:e,value:t}),qf=(e,t)=>({type:zf,id:e,value:t}),Uf=(e,t)=>({type:Ff,id:e,payload:t}),Vf=e=>({type:$f,payload:e}),Wf=Ld((e=>(t,n)=>async r=>{if(0===n.length)return;const a=n.map((e=>e.id)).join(""),o=e=>`_${e}`,i=n.map(((e,t)=>{const{query:n}=e;return`${o(t)}: ${n}`})).join("");Af(r,n.map((e=>{const{id:t,enhancer:n}=e;return jf(t,n())})));try{const l=await Md({query:`\n\t\t\t\t{\n\t\t\t\t\t${i}\n\t\t\t\t}\n\t\t\t`,props:t,signal:e(a)});Af(r,n.map(((e,t)=>{const{id:n,selector:r,enhancer:a}=e,i=o(t);return qf(n,a(r(l,i)))})))}catch(e){if("AbortError"===e.name)return;if(Af(r,n.map((e=>Uf(e.id,!1)))),"HandledError"===e.name)return;r(Vf(e))}}));var Bf=Object.freeze({__proto__:null,SET_MODALS_STATE:_d,REMOVE_MODALS_STATE:xd,SET_MODALS_VISIBLE:Td,setModalsState:Cd,removeModalsState:Nd,setModalsVisible:Rd,addModalsModal:e=>async t=>{const n=Sd();t(Cd(n,e)),rd((()=>{t(Rd(n,!0))}),30)},removeModalsModal:e=>async t=>{t(Rd(e,!1)),rd((()=>{t(Nd(e))}),300)},RESET_STATE:Dd,SET_TOKEN_START:Ad,SET_TOKEN_END:Id,SET_TOKEN_FETCHING:zd,SET_TOKEN_ERROR:Fd,resetState:$d,setTokenStart:jd,setTokenEnd:qd,setTokenFetching:Ud,setTokenError:Vd,addToken:Wd,deleteToken:Bd,SET_PERMANENT_TOKENS_START:Hd,SET_PERMANENT_TOKENS_END:Kd,SET_PERMANENT_TOKENS_FETCHING:Qd,SET_PERMANENT_TOKENS_ERROR:Yd,setPermanentTokensStart:Gd,setPermanentTokensEnd:Xd,setPermanentTokensFetching:Zd,setPermanentTokensError:Jd,fetchPermanentTokens:ef,addPermanentToken:(e,t)=>async n=>{n(Gd());try{await Md({query:"\n\t\t\t\tmutation createPermanentToken($input: CreatePermanentTokenInput!) {\n\t\t\t\t\tcreatePermanentToken(input: $input) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t \t}\n\t\t\t",variables:{input:{title:t.title}},props:e}),await n(ef(e))}catch(e){if("AbortError"===e.name)return;if(n(Zd(!1)),"HandledError"===e.name)return;n(Jd(e))}},updatePermanentToken:tf,deletePermanentToken:nf,SET_FILTER_SORTING:rf,SET_FILTER_RANGE:af,SET_FILTER_INTERVAL:of,SET_FILTER_VIEWS_TYPE:lf,SET_FILTER_REFERRERS_TYPE:uf,SET_FILTER_DEVICES_TYPE:sf,SET_FILTER_BROWSERS_TYPE:cf,SET_FILTER_SIZES_TYPE:df,SET_FILTER_SYSTEMS_TYPE:ff,setFilterSorting:e=>({type:rf,payload:e}),setFilterRange:e=>({type:af,payload:e}),setFilterInterval:e=>({type:of,payload:e}),setFilterViewsType:e=>({type:lf,payload:e}),setFilterReferrersType:e=>({type:uf,payload:e}),setFilterDevicesType:e=>({type:sf,payload:e}),setFilterBrowsersType:e=>({type:cf,payload:e}),setFilterSizesType:e=>({type:df,payload:e}),setFilterSystemsType:e=>({type:ff,payload:e}),SET_DOMAINS_START:pf,SET_DOMAINS_END:mf,SET_DOMAINS_FETCHING:hf,SET_DOMAINS_ERROR:yf,setDomainsStart:vf,setDomainsEnd:gf,setDomainsFetching:bf,setDomainsError:wf,fetchDomains:Ef,addDomain:(e,t)=>async n=>{n(vf());try{await Md({query:"\n\t\t\t\tmutation createDomain($input: CreateDomainInput!) {\n\t\t\t\t\tcreateDomain(input: $input) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t \t}\n\t\t\t",variables:{input:{title:t.title}},props:e}),await n(Ef(e))}catch(e){if("AbortError"===e.name)return;if(n(bf(!1)),"HandledError"===e.name)return;n(wf(e))}},updateDomain:kf,deleteDomain:Sf,SET_EVENTS_START:_f,SET_EVENTS_END:xf,SET_EVENTS_FETCHING:Tf,SET_EVENTS_ERROR:Cf,setEventsStart:Nf,setEventsEnd:Rf,setEventsFetching:Pf,setEventsError:Of,fetchEvents:Mf,addEvent:(e,t)=>async n=>{n(Nf());try{await Md({query:"\n\t\t\t\tmutation createEvent($input: CreateEventInput!) {\n\t\t\t\t\tcreateEvent(input: $input) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t \t}\n\t\t\t",variables:{input:{title:t.title,type:t.type}},props:e}),await n(Mf(e))}catch(e){if("AbortError"===e.name)return;if(n(Pf(!1)),"HandledError"===e.name)return;n(Of(e))}},updateEvent:Lf,deleteEvent:Df,SET_WIDGETS_START:If,SET_WIDGETS_END:zf,SET_WIDGETS_FETCHING:Ff,SET_WIDGETS_ERROR:$f,setWidgetsStart:jf,setWidgetsEnd:qf,setWidgetsFetching:Uf,setWidgetsError:Vf,fetchWidgets:Wf});function Hf(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:Jf(e)?2:ep(e)?3:0}function Xf(e,t){return 2===Gf(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Zf(e,t,n){var r=Gf(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function Jf(e){return Cp&&e instanceof Map}function ep(e){return Np&&e instanceof Set}function tp(e){return e.o||e.t}function np(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Dp(e);delete t[Mp];for(var n=Lp(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=ap),Object.freeze(e),t&&Yf(e,(function(e,t){return rp(t,!0)}),!0)),e}function ap(){Hf(2)}function op(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function ip(e){var t=Ap[e];return t||Hf(18,e),t}function lp(){return xp}function up(e,t){t&&(ip("Patches"),e.u=[],e.s=[],e.v=t)}function sp(e){cp(e),e.p.forEach(fp),e.p=null}function cp(e){e===xp&&(xp=e.l)}function dp(e){return xp={p:[],l:xp,h:e,m:!0,_:0}}function fp(e){var t=e[Mp];0===t.i||1===t.i?t.j():t.g=!0}function pp(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.O||ip("ES5").S(t,e,r),r?(n[Mp].P&&(sp(t),Hf(4)),Qf(e)&&(e=mp(t,e),t.l||yp(t,e)),t.u&&ip("Patches").M(n[Mp],e,t.u,t.s)):e=mp(t,n,[]),sp(t),t.u&&t.v(t.u,t.s),e!==Pp?e:void 0}function mp(e,t,n){if(op(t))return t;var r=t[Mp];if(!r)return Yf(t,(function(a,o){return hp(e,r,t,a,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return yp(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var a=4===r.i||5===r.i?r.o=np(r.k):r.o;Yf(3===r.i?new Set(a):a,(function(t,o){return hp(e,r,a,t,o,n)})),yp(e,a,!1),n&&e.u&&ip("Patches").R(r,n,e.u,e.s)}return r.o}function hp(e,t,n,r,a,o){if(Kf(a)){var i=mp(e,a,o&&t&&3!==t.i&&!Xf(t.D,r)?o.concat(r):void 0);if(Zf(n,r,i),!Kf(i))return;e.m=!1}if(Qf(a)&&!op(a)){if(!e.h.N&&e._<1)return;mp(e,a),t&&t.A.l||yp(e,a)}}function yp(e,t,n){void 0===n&&(n=!1),e.h.N&&e.m&&rp(t,n)}function vp(e,t){var n=e[Mp];return(n?tp(n):e)[t]}function gp(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function bp(e){e.P||(e.P=!0,e.l&&bp(e.l))}function wp(e){e.o||(e.o=np(e.t))}function Ep(e,t,n){var r=Jf(t)?ip("MapSet").T(t,n):ep(t)?ip("MapSet").F(t,n):e.O?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:lp(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},a=r,o=Ip;n&&(a=[r],o=zp);var i=Proxy.revocable(a,o),l=i.revoke,u=i.proxy;return r.k=u,r.j=l,u}(t,n):ip("ES5").J(t,n);return(n?n.A:lp()).p.push(r),r}function kp(e){return Kf(e)||Hf(22,e),function e(t){if(!Qf(t))return t;var n,r=t[Mp],a=Gf(t);if(r){if(!r.P&&(r.i<4||!ip("ES5").K(r)))return r.t;r.I=!0,n=Sp(t,a),r.I=!1}else n=Sp(t,a);return Yf(n,(function(t,a){r&&function(e,t){return 2===Gf(e)?e.get(t):e[t]}(r.t,t)===a||Zf(n,t,e(a))})),3===a?new Set(n):n}(e)}function Sp(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return np(e)}var _p,xp,Tp="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Cp="undefined"!=typeof Map,Np="undefined"!=typeof Set,Rp="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Pp=Tp?Symbol.for("immer-nothing"):((_p={})["immer-nothing"]=!0,_p),Op=Tp?Symbol.for("immer-draftable"):"__$immer_draftable",Mp=Tp?Symbol.for("immer-state"):"__$immer_state",Lp="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Dp=Object.getOwnPropertyDescriptors||function(e){var t={};return Lp(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ap={},Ip={get:function(e,t){if(t===Mp)return e;var n=tp(e);if(!Xf(n,t))return function(e,t,n){var r,a=gp(t,n);return a?"value"in a?a.value:null===(r=a.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!Qf(r)?r:r===vp(e.t,t)?(wp(e),e.o[t]=Ep(e.A.h,r,e)):r},has:function(e,t){return t in tp(e)},ownKeys:function(e){return Reflect.ownKeys(tp(e))},set:function(e,t,n){var r=gp(tp(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var a=vp(tp(e),t),o=null==a?void 0:a[Mp];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,a)&&(void 0!==n||Xf(e.t,t)))return!0;wp(e),bp(e)}return e.o[t]=n,e.D[t]=!0,!0},deleteProperty:function(e,t){return void 0!==vp(e.t,t)||t in e.t?(e.D[t]=!1,wp(e),bp(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=tp(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){Hf(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){Hf(12)}},zp={};Yf(Ip,(function(e,t){zp[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),zp.deleteProperty=function(e,t){return Ip.deleteProperty.call(this,e[0],t)},zp.set=function(e,t,n){return Ip.set.call(this,e[0],t,n,e[0])};var Fp=new(function(){function e(e){this.O=Rp,this.N=!0,"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),this.produce=this.produce.bind(this),this.produceWithPatches=this.produceWithPatches.bind(this)}var t=e.prototype;return t.produce=function(e,t,n){if("function"==typeof e&&"function"!=typeof t){var r=t;t=e;var a=this;return function(e){var n=this;void 0===e&&(e=r);for(var o=arguments.length,i=Array(o>1?o-1:0),l=1;l1?n-1:0),o=1;o=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}var a=ip("Patches").$;return Kf(e)?a(e,t):this.produce(e,(function(e){return a(e,t.slice(n+1))}))},e}()),$p=Fp.produce;Fp.produceWithPatches.bind(Fp),Fp.setAutoFreeze.bind(Fp),Fp.setUseProxies.bind(Fp),Fp.applyPatches.bind(Fp),Fp.createDraft.bind(Fp),Fp.finishDraft.bind(Fp);var jp=$p(((e,t)=>{switch(t.type){case _d:e.value[t.modalId]=e.value[t.modalId]||{id:void 0,type:void 0,props:{},visible:!1},e.value[t.modalId].id=t.modalId,e.value[t.modalId].type=t.payload.type,e.value[t.modalId].props=t.payload.props||{},e.value[t.modalId].visible=t.payload.visible||!1;break;case xd:delete e.value[t.modalId];break;case Td:e.value[t.modalId].visible=t.payload||!1}}),{value:{}});var qp=$p(((e,t)=>{switch(t.type){case Ad:e.fetching=!0,e.error=void 0;break;case Id:e.value=t.value||void 0,e.fetching=!1;break;case zd:e.fetching=t.payload||!1;break;case Fd:e.error=t.payload||void 0}}),{value:void 0,fetching:!1,error:void 0});var Up=$p(((e,t)=>{switch(t.type){case Hd:e.fetching=!0,e.error=void 0;break;case Kd:e.value=t.value||[],e.fetching=!1;break;case Qd:e.fetching=t.payload||!1;break;case Yd:e.error=t.payload||void 0}}),{value:[],fetching:!1,error:void 0});var Vp="TOP",Wp="NEW",Bp="RECENT";var Hp="LAST_24_HOURS",Kp="LAST_7_DAYS",Qp="LAST_30_DAYS",Yp="LAST_6_MONTHS";var Gp="DAILY",Xp="MONTHLY",Zp="YEARLY";var Jp="UNIQUE",em="TOTAL";var tm="WITH_SOURCE",nm="NO_SOURCE",rm="ONLY_SOURCE";var am="WITH_MODEL",om="NO_MODEL";var im="WITH_VERSION",lm="NO_VERSION";var um="BROWSER_HEIGHT",sm="BROWSER_RESOLUTION",cm="BROWSER_WIDTH",dm="SCREEN_HEIGHT",fm="SCREEN_RESOLUTION",pm="SCREEN_WIDTH";var mm="WITH_VERSION",hm="NO_VERSION";const ym=()=>({sorting:Vp,range:Kp,interval:Gp,viewsType:Jp,referrersType:tm,devicesType:am,browsersType:im,sizesType:sm,systemsType:mm});var vm=$p(((e,t)=>{switch(t.type){case rf:e.sorting=t.payload;break;case af:e.range=t.payload;break;case of:e.interval=t.payload;break;case lf:e.viewsType=t.payload;break;case uf:e.referrersType=t.payload;break;case sf:e.devicesType=t.payload;break;case cf:e.browsersType=t.payload;break;case df:e.sizesType=t.payload;break;case ff:e.systemsType=t.payload}}),ym());var gm=$p(((e,t)=>{switch(t.type){case pf:e.fetching=!0,e.error=void 0;break;case mf:e.value=t.value||[],e.fetching=!1;break;case hf:e.fetching=t.payload||!1;break;case yf:e.error=t.payload||void 0}}),{value:[],fetching:!1,error:void 0});var bm=$p(((e,t)=>{switch(t.type){case _f:e.fetching=!0,e.error=void 0;break;case xf:e.value=t.value||[],e.fetching=!1;break;case Tf:e.fetching=t.payload||!1;break;case Cf:e.error=t.payload||void 0}}),{value:[],fetching:!1,error:void 0});const wm=_s({modals:jp,token:qp,permanentTokens:Up,filter:vm,domains:gm,events:bm,widgets:$p(((e,t)=>{switch(t.type){case If:e.value[t.id]=e.value[t.id]||{value:void 0,fetching:!1};const n=null==e.value[t.id].value?t.value:e.value[t.id].value;e.value[t.id].value=n,e.value[t.id].fetching=!0;break;case zf:e.value[t.id].value=t.value,e.value[t.id].fetching=!1;break;case Ff:e.value[t.id].fetching=t.payload||!1;break;case $f:e.error=t.payload||void 0}}),{value:{},error:void 0})});var Em=n((function(e,t){!function(e,t){function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var r=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),e.length!==t.length||e.some((function(e,n){return!Object.is(e,t[n])}))},a={error:null},o=function(e){function o(){for(var t,n=arguments.length,r=new Array(n),o=0;o!1===km.includes(e.message),xm=Sm||(Sm={});xm.Pop="POP",xm.Push="PUSH",xm.Replace="REPLACE";function Tm(e){e.preventDefault(),e.returnValue=""}function Cm(){var e=[];return{get length(){return e.length},push:function(t){return e.push(t),function(){e=e.filter((function(e){return e!==t}))}},call:function(t){e.forEach((function(e){return e&&e(t)}))}}}function Nm(e){var t=e.pathname,n=e.search;return(void 0===t?"/":t)+(void 0===n?"":n)+(void 0===(e=e.hash)?"":e)}function Rm(e){var t={};if(e){var n=e.indexOf("#");0<=n&&(t.hash=e.substr(n),e=e.substr(0,n)),0<=(n=e.indexOf("?"))&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}var Pm=n((function(t,n){var r=[].slice;!function(e,r){null!==n?t.exports=r():e.UrlPattern=r()}(e,(function(){var e,t,n,a,o,i,l,u,s,c,d,f,p,m,h;return s=function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},l=function(e,t){var n,r,a;for(a=[],n=-1,r=e.length;++n(Array.isArray(i)?i.length-1:0)))return o=Array.isArray(i)?i[a]:i,r&&(n[t]=a+1),o;if(r)throw new Error("too few values provided for key `"+t+"`")}else if(r)throw new Error("no values provided for key `"+t+"`")},n=function(e,t,r){var a,o;if(Array.isArray(e)){for(a=-1,o=e.length;++a!0===Wm.some((t=>null!=t.pattern.match(e)))?e:Bm.pattern.stringify();var Km=()=>{const e=s.useMemo((()=>function(e){function t(){var e=Rm(l.location.hash.substr(1)),t=e.pathname,n=e.search;e=e.hash;var r=u.state||{};return[r.idx,{pathname:void 0===t?"/":t,search:void 0===n?"":n,hash:void 0===e?"":e,state:r.usr||null,key:r.key||"default"}]}function n(){if(s)m.call(s),s=null;else{var e=Sm.Pop,n=t(),r=n[0];if(n=n[1],m.length){if(null!=r){var a=d-r;a&&(s={action:e,location:n,retry:function(){i(-1*a)}},i(a))}}else o(e)}}function r(e){var t=document.querySelector("base"),n="";return t&&t.getAttribute("href")&&(n=-1===(n=(t=l.location.href).indexOf("#"))?t:t.slice(0,n)),n+"#"+("string"==typeof e?e:Nm(e))}function a(e,t){return void 0===t&&(t=null),cc({},f,{},"string"==typeof e?Rm(e):e,{state:t,key:Math.random().toString(36).substr(2,8)})}function o(e){c=e,e=t(),d=e[0],f=e[1],p.call({action:c,location:f})}function i(e){u.go(e)}void 0===e&&(e={});var l=void 0===(e=e.window)?document.defaultView:e,u=l.history,s=null;l.addEventListener("popstate",n),l.addEventListener("hashchange",(function(){Nm(t()[1])!==Nm(f)&&n()}));var c=Sm.Pop,d=(e=t())[0],f=e[1],p=Cm(),m=Cm();return null==d&&(d=0,u.replaceState(cc({},u.state,{idx:d}),"")),{get action(){return c},get location(){return f},createHref:r,push:function e(t,n){var i=Sm.Push,s=a(t,n);if(!m.length||(m.call({action:i,location:s,retry:function(){e(t,n)}}),0)){var c=[{usr:s.state,key:s.key,idx:d+1},r(s)];s=c[0],c=c[1];try{u.pushState(s,"",c)}catch(e){l.location.assign(c)}o(i)}},replace:function e(t,n){var i=Sm.Replace,l=a(t,n);m.length&&(m.call({action:i,location:l,retry:function(){e(t,n)}}),1)||(l=[{usr:l.state,key:l.key,idx:d},r(l)],u.replaceState(l[0],"",l[1]),o(i))},go:i,back:function(){i(-1)},forward:function(){i(1)},listen:function(e){return p.push(e)},block:function(e){var t=m.push(e);return 1===m.length&&l.addEventListener("beforeunload",Tm),function(){t(),m.length||l.removeEventListener("beforeunload",Tm)}}}}()),[]),[t,n]=s.useState(Hm(e.location));s.useEffect((()=>e.listen((({location:e})=>{n(Hm(e))}))),[e]);return[s.useCallback((t=>{e.push({pathname:t})}),[e]),t]},Qm=e=>[e.message,e.stack].join("\n");const Ym=e=>{e.target.select(),document.execCommand("copy")},Gm=e=>{const t=s.createElement("textarea",{className:"input",id:e.id,required:e.required,disabled:e.disabled,readOnly:e.readOnly,placeholder:e.placeholder,value:e.value,rows:e.rows,onChange:e.onChange,onFocus:!0===e.copyOnFocus?Ym:void 0});return!0===e.copyOnFocus?s.createElement("div",{className:"inputMessage",title:"Copied to clipboard"},t):t};Gm.propTypes={id:ac.string,required:ac.bool,disabled:ac.bool,readOnly:ac.bool,placeholder:ac.string,value:ac.string,rows:ac.number,onChange:ac.func,copyOnFocus:ac.bool};const Xm=e=>s.createElement("div",{className:"spacer",style:{"--size":e.size}});Xm.propTypes={size:ac.number.isRequired}; + */function Zs(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case Ds:switch(e=e.type){case qs:case Us:case Is:case Fs:case zs:case Ws:return e;default:switch(e=e&&e.$$typeof){case js:case Vs:case Ks:case Hs:case $s:return e;default:return t}}case As:return t}}}function Js(e){return Zs(e)===Us}var ec={AsyncMode:qs,ConcurrentMode:Us,ContextConsumer:js,ContextProvider:$s,Element:Ds,ForwardRef:Vs,Fragment:Is,Lazy:Ks,Memo:Hs,Portal:As,Profiler:Fs,StrictMode:zs,Suspense:Ws,isAsyncMode:function(e){return Js(e)||Zs(e)===qs},isConcurrentMode:Js,isContextConsumer:function(e){return Zs(e)===js},isContextProvider:function(e){return Zs(e)===$s},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===Ds},isForwardRef:function(e){return Zs(e)===Vs},isFragment:function(e){return Zs(e)===Is},isLazy:function(e){return Zs(e)===Ks},isMemo:function(e){return Zs(e)===Hs},isPortal:function(e){return Zs(e)===As},isProfiler:function(e){return Zs(e)===Fs},isStrictMode:function(e){return Zs(e)===zs},isSuspense:function(e){return Zs(e)===Ws},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===Is||e===Us||e===Fs||e===zs||e===Ws||e===Bs||"object"==typeof e&&null!==e&&(e.$$typeof===Ks||e.$$typeof===Hs||e.$$typeof===$s||e.$$typeof===js||e.$$typeof===Vs||e.$$typeof===Ys||e.$$typeof===Gs||e.$$typeof===Xs||e.$$typeof===Qs)},typeOf:Zs},tc=(n((function(e,t){})),n((function(e){e.exports=ec})));Function.call.bind(Object.prototype.hasOwnProperty);function nc(){}function rc(){}rc.resetWarningCache=nc;var ac=n((function(e){e.exports=function(){function e(e,t,n,r,a,o){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==o){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:rc,resetWarningCache:nc};return n.PropTypes=n,n}()})),oc=s.createContext(null);var ic=function(e){e()},lc=function(){return ic},uc={notify:function(){}};var sc=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=uc,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return Boolean(this.unsubscribe)},t.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=function(){var e=lc(),t=null,n=null;return{clear:function(){t=null,n=null},notify:function(){e((function(){for(var e=t;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],n=t;n;)e.push(n),n=n.next;return e},subscribe:function(e){var r=!0,a=n={callback:e,next:null,prev:n};return a.prev?a.prev.next=a:t=a,function(){r&&null!==t&&(r=!1,a.next?a.next.prev=a.prev:n=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}())},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=uc)},e}();function cc(){return(cc=Object.assign||function(e){for(var t=1;t=0||(a[n]=e[n]);return a}var fc={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},pc={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},mc={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},hc={};function yc(e){return tc.isMemo(e)?mc:hc[e.$$typeof]||fc}hc[tc.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},hc[tc.Memo]=mc;var vc=Object.defineProperty,gc=Object.getOwnPropertyNames,bc=Object.getOwnPropertySymbols,wc=Object.getOwnPropertyDescriptor,Ec=Object.getPrototypeOf,kc=Object.prototype;var Sc=function e(t,n,r){if("string"!=typeof n){if(kc){var a=Ec(n);a&&a!==kc&&e(t,a,r)}var o=gc(n);bc&&(o=o.concat(bc(n)));for(var i=yc(t),l=yc(n),u=0;u=0;r--){var a=t[r](e);if(a)return a}return function(t,r){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function Hc(e,t){return e===t}function Kc(e){var t=void 0===e?{}:e,n=t.connectHOC,r=void 0===n?Mc:n,a=t.mapStateToPropsFactories,o=void 0===a?$c:a,i=t.mapDispatchToPropsFactories,l=void 0===i?Fc:i,u=t.mergePropsFactories,s=void 0===u?qc:u,c=t.selectorFactory,d=void 0===c?Wc:c;return function(e,t,n,a){void 0===a&&(a={});var i=a,u=i.pure,c=void 0===u||u,f=i.areStatesEqual,p=void 0===f?Hc:f,m=i.areOwnPropsEqual,h=void 0===m?Dc:m,y=i.areStatePropsEqual,v=void 0===y?Dc:y,g=i.areMergedPropsEqual,b=void 0===g?Dc:g,w=dc(i,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),E=Bc(e,o,"mapStateToProps"),k=Bc(t,l,"mapDispatchToProps"),S=Bc(n,s,"mergeProps");return r(d,cc({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:E,initMapDispatchToProps:k,initMergeProps:S,pure:c,areStatesEqual:p,areOwnPropsEqual:h,areStatePropsEqual:v,areMergedPropsEqual:b},w))}}var Qc,Yc=Kc();Qc=vs.unstable_batchedUpdates,ic=Qc;var Gc=t(Ms).compose,Xc="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Gc:Gc.apply(null,arguments)};function Zc(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(a){return"function"==typeof a?a(n,r,e):t(a)}}}}var Jc=Zc();Jc.withExtraArgument=Zc;var ed="3.0.3",td="https://github.com/electerious/Ackee";const nd="ackee_state_3.0.3";var rd=(e,t)=>setTimeout((()=>{requestAnimationFrame(e)}),t),ad=1;var od,id,ld,ud={nextValue:function(){return(ad=(9301*ad+49297)%233280)/233280},seed:function(e){ad=e}},sd="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function cd(){ld=!1}function dd(e){if(e){if(e!==od){if(e.length!==sd.length)throw new Error("Custom alphabet for shortid must be "+sd.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,n){return t!==n.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+sd.length+" unique characters. These characters were not unique: "+t.join(", "));od=e,cd()}}else od!==sd&&(od=sd,cd())}function fd(){return ld||(ld=function(){od||dd(sd);for(var e,t=od.split(""),n=[],r=ud.nextValue();t.length>0;)r=ud.nextValue(),e=Math.floor(r*t.length),n.push(t.splice(e,1)[0]);return n.join("")}())}var pd={get:function(){return od||sd},characters:function(e){return dd(e),od},seed:function(e){ud.seed(e),id!==e&&(cd(),id=e)},lookup:function(e){return fd()[e]},shuffled:fd},md="object"==typeof window&&(window.crypto||window.msCrypto),hd=md&&md.getRandomValues?function(e){return md.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],n=0;n0&&(t+=bd(vd)),t+=bd(n)};var Ed=function(e){return!(!e||"string"!=typeof e||e.length<6)&&!new RegExp("[^"+pd.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e)},kd=n((function(e){var t=0;function n(){return wd(t)}e.exports=n,e.exports.generate=n,e.exports.seed=function(t){return pd.seed(t),e.exports},e.exports.worker=function(n){return t=n,e.exports},e.exports.characters=function(e){return void 0!==e&&pd.characters(e),pd.shuffled()},e.exports.isValid=Ed})),Sd=()=>`_${kd.generate()}`;const _d=Symbol(),xd=Symbol(),Td=Symbol(),Cd=(e,t)=>({type:_d,modalId:e,payload:t}),Nd=e=>({type:xd,modalId:e}),Rd=(e,t)=>({type:Td,modalId:e,payload:t});class Pd extends Error{constructor(e){super(e),this.name="HandledError",this.message=e}}var Od=(new Intl.DateTimeFormat).resolvedOptions().timeZone,Md=async({query:e,variables:t,props:n,signal:r})=>{try{const l=new Headers,u=n.token.value;l.append("Content-Type","application/json"),l.append("Time-Zone",Od),u&&l.append("Authorization",`Bearer ${u}`);const s=fetch("/api",{method:"post",headers:l,body:JSON.stringify({query:e,variables:t}),signal:r}),c=await(a=s,o="Request timeout",i=3e4,Promise.race([a,new Promise(((e,t)=>{setTimeout((()=>t(new Error(o))),i)}))]));if(!1===c.ok){const e=await c.text();throw new Error(e)}const d=await c.json();if(null!=d.errors){const e=d.errors[0].message;throw new Error(e)}return d.data}catch(e){if(console.error(e),"Token invalid"===e.message)throw n.resetState(),new Pd(e.message);throw e}var a,o,i},Ld=e=>{const t=Symbol(),n={};return e(((e=t)=>(null!=n[e]&&n[e].abort(),n[e]=new AbortController,n[e].signal)))};const Dd=Symbol(),Ad=Symbol(),Id=Symbol(),zd=Symbol(),Fd=Symbol(),$d=()=>({type:Dd}),jd=()=>({type:Ad}),qd=e=>({type:Id,value:e}),Ud=e=>({type:zd,payload:e}),Vd=e=>({type:Fd,payload:e}),Wd=Ld((e=>(t,n)=>async r=>{r(jd());try{const a=await Md({query:"\n\t\t\t\tmutation createToken($input: CreateTokenInput!) {\n\t\t\t\t\tcreateToken(input: $input) {\n\t\t\t\t\t\tpayload {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{input:{username:n.username,password:n.password}},props:t,signal:e()});r(qd(a.createToken.payload.id))}catch(e){if("AbortError"===e.name)return;if(r(Ud(!1)),"HandledError"===e.name)return;r(Vd(e))}})),Bd=Ld((e=>t=>async n=>{n($d());try{await Md({query:"\n\t\t\t\tmutation deleteToken($id: ID!) {\n\t\t\t\t\tdeleteToken(id: $id) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:t.token.value},props:t,signal:e()})}catch(e){if("AbortError"===e.name)return;if("HandledError"===e.name)return;n(Vd(e))}})),Hd=Symbol(),Kd=Symbol(),Qd=Symbol(),Yd=Symbol(),Gd=()=>({type:Hd}),Xd=e=>({type:Kd,value:e}),Zd=e=>({type:Qd,payload:e}),Jd=e=>({type:Yd,payload:e}),ef=Ld((e=>t=>async n=>{n(Gd());try{const r=await Md({query:"\n\t\t\t\tquery fetchPermanentTokens {\n\t\t\t\t\tpermanentTokens {\n\t\t\t\t\t\tid\n\t\t\t\t\t\ttitle\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",props:t,signal:e()});n(Xd(r.permanentTokens))}catch(e){if("AbortError"===e.name)return;if(n(Zd(!1)),"HandledError"===e.name)return;n(Jd(e))}})),tf=Ld((e=>(t,n,r)=>async a=>{a(Gd());try{await Md({query:"\n\t\t\t\tmutation updatePermanentToken($id: ID!, $input: UpdatePermanentTokenInput!) {\n\t\t\t\t\tupdatePermanentToken(id: $id, input: $input) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:n,input:{title:r.title}},props:t,signal:e(n)}),await a(ef(t))}catch(e){if("AbortError"===e.name)return;if(a(Zd(!1)),"HandledError"===e.name)return;a(Jd(e))}})),nf=Ld((e=>(t,n)=>async r=>{r(Gd());try{await Md({query:"\n\t\t\t\tmutation deletePermanentToken($id: ID!) {\n\t\t\t\t\tdeletePermanentToken(id: $id) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:n},props:t,signal:e(n)}),await r(ef(t))}catch(e){if("AbortError"===e.name)return;if(r(Zd(!1)),"HandledError"===e.name)return;r(Jd(e))}})),rf=Symbol(),af=Symbol(),of=Symbol(),lf=Symbol(),uf=Symbol(),sf=Symbol(),cf=Symbol(),df=Symbol(),ff=Symbol(),pf=Symbol(),mf=Symbol(),hf=Symbol(),yf=Symbol(),vf=()=>({type:pf}),gf=e=>({type:mf,value:e}),bf=e=>({type:hf,payload:e}),wf=e=>({type:yf,payload:e}),Ef=Ld((e=>t=>async n=>{n(vf());try{const r=await Md({query:"\n\t\t\t\tquery fetchDomains {\n\t\t\t\t\tdomains {\n\t\t\t\t\t\tid\n\t\t\t\t\t\ttitle\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",props:t,signal:e()});n(gf(r.domains))}catch(e){if("AbortError"===e.name)return;if(n(bf(!1)),"HandledError"===e.name)return;n(wf(e))}})),kf=Ld((e=>(t,n,r)=>async a=>{a(vf());try{await Md({query:"\n\t\t\t\tmutation updateDomain($id: ID!, $input: UpdateDomainInput!) {\n\t\t\t\t\tupdateDomain(id: $id, input: $input) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:n,input:{title:r.title}},props:t,signal:e(n)}),await a(Ef(t))}catch(e){if("AbortError"===e.name)return;if(a(bf(!1)),"HandledError"===e.name)return;a(wf(e))}})),Sf=Ld((e=>(t,n)=>async r=>{r(vf());try{await Md({query:"\n\t\t\t\tmutation deleteDomain($id: ID!) {\n\t\t\t\t\tdeleteDomain(id: $id) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:n},props:t,signal:e(n)}),await r(Ef(t))}catch(e){if("AbortError"===e.name)return;if(r(bf(!1)),"HandledError"===e.name)return;r(wf(e))}})),_f=Symbol(),xf=Symbol(),Tf=Symbol(),Cf=Symbol(),Nf=()=>({type:_f}),Rf=e=>({type:xf,value:e}),Pf=e=>({type:Tf,payload:e}),Of=e=>({type:Cf,payload:e}),Mf=Ld((e=>t=>async n=>{n(Nf());try{const r=await Md({query:"\n\t\t\t\tquery fetchEvents {\n\t\t\t\t\tevents {\n\t\t\t\t\t\tid\n\t\t\t\t\t\ttitle\n\t\t\t\t\t\ttype\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",props:t,signal:e()});n(Rf(r.events))}catch(e){if("AbortError"===e.name)return;if(n(Pf(!1)),"HandledError"===e.name)return;n(Of(e))}})),Lf=Ld((e=>(t,n,r)=>async a=>{a(Nf());try{await Md({query:"\n\t\t\t\tmutation updateEvent($id: ID!, $input: UpdateEventInput!) {\n\t\t\t\t\tupdateEvent(id: $id, input: $input) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:n,input:{title:r.title,type:r.type}},props:t,signal:e(n)}),await a(Mf(t))}catch(e){if("AbortError"===e.name)return;if(a(Pf(!1)),"HandledError"===e.name)return;a(Of(e))}})),Df=Ld((e=>(t,n)=>async r=>{r(Nf());try{await Md({query:"\n\t\t\t\tmutation deleteEvent($id: ID!) {\n\t\t\t\t\tdeleteEvent(id: $id) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{id:n},props:t,signal:e(n)}),await r(Mf(t))}catch(e){if("AbortError"===e.name)return;if(r(Pf(!1)),"HandledError"===e.name)return;r(Of(e))}}));var Af=(e,t)=>{vs.unstable_batchedUpdates((()=>{t.forEach((t=>e(t)))}))};const If=Symbol(),zf=Symbol(),Ff=Symbol(),$f=Symbol(),jf=(e,t)=>({type:If,id:e,value:t}),qf=(e,t)=>({type:zf,id:e,value:t}),Uf=(e,t)=>({type:Ff,id:e,payload:t}),Vf=e=>({type:$f,payload:e}),Wf=Ld((e=>(t,n)=>async r=>{if(0===n.length)return;const a=n.map((e=>e.id)).join(""),o=e=>`_${e}`,i=n.map(((e,t)=>{const{query:n}=e;return`${o(t)}: ${n}`})).join("");Af(r,n.map((e=>{const{id:t,enhancer:n}=e;return jf(t,n())})));try{const l=await Md({query:`\n\t\t\t\t{\n\t\t\t\t\t${i}\n\t\t\t\t}\n\t\t\t`,props:t,signal:e(a)});Af(r,n.map(((e,t)=>{const{id:n,selector:r,enhancer:a}=e,i=o(t);return qf(n,a(r(l,i)))})))}catch(e){if("AbortError"===e.name)return;if(Af(r,n.map((e=>Uf(e.id,!1)))),"HandledError"===e.name)return;r(Vf(e))}}));var Bf=Object.freeze({__proto__:null,SET_MODALS_STATE:_d,REMOVE_MODALS_STATE:xd,SET_MODALS_VISIBLE:Td,setModalsState:Cd,removeModalsState:Nd,setModalsVisible:Rd,addModalsModal:e=>async t=>{const n=Sd();t(Cd(n,e)),rd((()=>{t(Rd(n,!0))}),30)},removeModalsModal:e=>async t=>{t(Rd(e,!1)),rd((()=>{t(Nd(e))}),300)},RESET_STATE:Dd,SET_TOKEN_START:Ad,SET_TOKEN_END:Id,SET_TOKEN_FETCHING:zd,SET_TOKEN_ERROR:Fd,resetState:$d,setTokenStart:jd,setTokenEnd:qd,setTokenFetching:Ud,setTokenError:Vd,addToken:Wd,deleteToken:Bd,SET_PERMANENT_TOKENS_START:Hd,SET_PERMANENT_TOKENS_END:Kd,SET_PERMANENT_TOKENS_FETCHING:Qd,SET_PERMANENT_TOKENS_ERROR:Yd,setPermanentTokensStart:Gd,setPermanentTokensEnd:Xd,setPermanentTokensFetching:Zd,setPermanentTokensError:Jd,fetchPermanentTokens:ef,addPermanentToken:(e,t)=>async n=>{n(Gd());try{await Md({query:"\n\t\t\t\tmutation createPermanentToken($input: CreatePermanentTokenInput!) {\n\t\t\t\t\tcreatePermanentToken(input: $input) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t \t}\n\t\t\t",variables:{input:{title:t.title}},props:e}),await n(ef(e))}catch(e){if("AbortError"===e.name)return;if(n(Zd(!1)),"HandledError"===e.name)return;n(Jd(e))}},updatePermanentToken:tf,deletePermanentToken:nf,SET_FILTER_SORTING:rf,SET_FILTER_RANGE:af,SET_FILTER_INTERVAL:of,SET_FILTER_VIEWS_TYPE:lf,SET_FILTER_REFERRERS_TYPE:uf,SET_FILTER_DEVICES_TYPE:sf,SET_FILTER_BROWSERS_TYPE:cf,SET_FILTER_SIZES_TYPE:df,SET_FILTER_SYSTEMS_TYPE:ff,setFilterSorting:e=>({type:rf,payload:e}),setFilterRange:e=>({type:af,payload:e}),setFilterInterval:e=>({type:of,payload:e}),setFilterViewsType:e=>({type:lf,payload:e}),setFilterReferrersType:e=>({type:uf,payload:e}),setFilterDevicesType:e=>({type:sf,payload:e}),setFilterBrowsersType:e=>({type:cf,payload:e}),setFilterSizesType:e=>({type:df,payload:e}),setFilterSystemsType:e=>({type:ff,payload:e}),SET_DOMAINS_START:pf,SET_DOMAINS_END:mf,SET_DOMAINS_FETCHING:hf,SET_DOMAINS_ERROR:yf,setDomainsStart:vf,setDomainsEnd:gf,setDomainsFetching:bf,setDomainsError:wf,fetchDomains:Ef,addDomain:(e,t)=>async n=>{n(vf());try{await Md({query:"\n\t\t\t\tmutation createDomain($input: CreateDomainInput!) {\n\t\t\t\t\tcreateDomain(input: $input) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t \t}\n\t\t\t",variables:{input:{title:t.title}},props:e}),await n(Ef(e))}catch(e){if("AbortError"===e.name)return;if(n(bf(!1)),"HandledError"===e.name)return;n(wf(e))}},updateDomain:kf,deleteDomain:Sf,SET_EVENTS_START:_f,SET_EVENTS_END:xf,SET_EVENTS_FETCHING:Tf,SET_EVENTS_ERROR:Cf,setEventsStart:Nf,setEventsEnd:Rf,setEventsFetching:Pf,setEventsError:Of,fetchEvents:Mf,addEvent:(e,t)=>async n=>{n(Nf());try{await Md({query:"\n\t\t\t\tmutation createEvent($input: CreateEventInput!) {\n\t\t\t\t\tcreateEvent(input: $input) {\n\t\t\t\t\t\tsuccess\n\t\t\t\t\t}\n\t\t\t \t}\n\t\t\t",variables:{input:{title:t.title,type:t.type}},props:e}),await n(Mf(e))}catch(e){if("AbortError"===e.name)return;if(n(Pf(!1)),"HandledError"===e.name)return;n(Of(e))}},updateEvent:Lf,deleteEvent:Df,SET_WIDGETS_START:If,SET_WIDGETS_END:zf,SET_WIDGETS_FETCHING:Ff,SET_WIDGETS_ERROR:$f,setWidgetsStart:jf,setWidgetsEnd:qf,setWidgetsFetching:Uf,setWidgetsError:Vf,fetchWidgets:Wf});function Hf(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:Jf(e)?2:ep(e)?3:0}function Xf(e,t){return 2===Gf(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Zf(e,t,n){var r=Gf(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function Jf(e){return Cp&&e instanceof Map}function ep(e){return Np&&e instanceof Set}function tp(e){return e.o||e.t}function np(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Dp(e);delete t[Mp];for(var n=Lp(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=ap),Object.freeze(e),t&&Yf(e,(function(e,t){return rp(t,!0)}),!0)),e}function ap(){Hf(2)}function op(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function ip(e){var t=Ap[e];return t||Hf(18,e),t}function lp(){return xp}function up(e,t){t&&(ip("Patches"),e.u=[],e.s=[],e.v=t)}function sp(e){cp(e),e.p.forEach(fp),e.p=null}function cp(e){e===xp&&(xp=e.l)}function dp(e){return xp={p:[],l:xp,h:e,m:!0,_:0}}function fp(e){var t=e[Mp];0===t.i||1===t.i?t.j():t.g=!0}function pp(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.O||ip("ES5").S(t,e,r),r?(n[Mp].P&&(sp(t),Hf(4)),Qf(e)&&(e=mp(t,e),t.l||yp(t,e)),t.u&&ip("Patches").M(n[Mp],e,t.u,t.s)):e=mp(t,n,[]),sp(t),t.u&&t.v(t.u,t.s),e!==Pp?e:void 0}function mp(e,t,n){if(op(t))return t;var r=t[Mp];if(!r)return Yf(t,(function(a,o){return hp(e,r,t,a,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return yp(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var a=4===r.i||5===r.i?r.o=np(r.k):r.o;Yf(3===r.i?new Set(a):a,(function(t,o){return hp(e,r,a,t,o,n)})),yp(e,a,!1),n&&e.u&&ip("Patches").R(r,n,e.u,e.s)}return r.o}function hp(e,t,n,r,a,o){if(Kf(a)){var i=mp(e,a,o&&t&&3!==t.i&&!Xf(t.D,r)?o.concat(r):void 0);if(Zf(n,r,i),!Kf(i))return;e.m=!1}if(Qf(a)&&!op(a)){if(!e.h.N&&e._<1)return;mp(e,a),t&&t.A.l||yp(e,a)}}function yp(e,t,n){void 0===n&&(n=!1),e.h.N&&e.m&&rp(t,n)}function vp(e,t){var n=e[Mp];return(n?tp(n):e)[t]}function gp(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function bp(e){e.P||(e.P=!0,e.l&&bp(e.l))}function wp(e){e.o||(e.o=np(e.t))}function Ep(e,t,n){var r=Jf(t)?ip("MapSet").T(t,n):ep(t)?ip("MapSet").F(t,n):e.O?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:lp(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},a=r,o=Ip;n&&(a=[r],o=zp);var i=Proxy.revocable(a,o),l=i.revoke,u=i.proxy;return r.k=u,r.j=l,u}(t,n):ip("ES5").J(t,n);return(n?n.A:lp()).p.push(r),r}function kp(e){return Kf(e)||Hf(22,e),function e(t){if(!Qf(t))return t;var n,r=t[Mp],a=Gf(t);if(r){if(!r.P&&(r.i<4||!ip("ES5").K(r)))return r.t;r.I=!0,n=Sp(t,a),r.I=!1}else n=Sp(t,a);return Yf(n,(function(t,a){r&&function(e,t){return 2===Gf(e)?e.get(t):e[t]}(r.t,t)===a||Zf(n,t,e(a))})),3===a?new Set(n):n}(e)}function Sp(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return np(e)}var _p,xp,Tp="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Cp="undefined"!=typeof Map,Np="undefined"!=typeof Set,Rp="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Pp=Tp?Symbol.for("immer-nothing"):((_p={})["immer-nothing"]=!0,_p),Op=Tp?Symbol.for("immer-draftable"):"__$immer_draftable",Mp=Tp?Symbol.for("immer-state"):"__$immer_state",Lp="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Dp=Object.getOwnPropertyDescriptors||function(e){var t={};return Lp(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ap={},Ip={get:function(e,t){if(t===Mp)return e;var n=tp(e);if(!Xf(n,t))return function(e,t,n){var r,a=gp(t,n);return a?"value"in a?a.value:null===(r=a.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!Qf(r)?r:r===vp(e.t,t)?(wp(e),e.o[t]=Ep(e.A.h,r,e)):r},has:function(e,t){return t in tp(e)},ownKeys:function(e){return Reflect.ownKeys(tp(e))},set:function(e,t,n){var r=gp(tp(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var a=vp(tp(e),t),o=null==a?void 0:a[Mp];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,a)&&(void 0!==n||Xf(e.t,t)))return!0;wp(e),bp(e)}return e.o[t]=n,e.D[t]=!0,!0},deleteProperty:function(e,t){return void 0!==vp(e.t,t)||t in e.t?(e.D[t]=!1,wp(e),bp(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=tp(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){Hf(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){Hf(12)}},zp={};Yf(Ip,(function(e,t){zp[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),zp.deleteProperty=function(e,t){return Ip.deleteProperty.call(this,e[0],t)},zp.set=function(e,t,n){return Ip.set.call(this,e[0],t,n,e[0])};var Fp=new(function(){function e(e){this.O=Rp,this.N=!0,"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),this.produce=this.produce.bind(this),this.produceWithPatches=this.produceWithPatches.bind(this)}var t=e.prototype;return t.produce=function(e,t,n){if("function"==typeof e&&"function"!=typeof t){var r=t;t=e;var a=this;return function(e){var n=this;void 0===e&&(e=r);for(var o=arguments.length,i=Array(o>1?o-1:0),l=1;l1?n-1:0),o=1;o=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}var a=ip("Patches").$;return Kf(e)?a(e,t):this.produce(e,(function(e){return a(e,t.slice(n+1))}))},e}()),$p=Fp.produce;Fp.produceWithPatches.bind(Fp),Fp.setAutoFreeze.bind(Fp),Fp.setUseProxies.bind(Fp),Fp.applyPatches.bind(Fp),Fp.createDraft.bind(Fp),Fp.finishDraft.bind(Fp);var jp=$p(((e,t)=>{switch(t.type){case _d:e.value[t.modalId]=e.value[t.modalId]||{id:void 0,type:void 0,props:{},visible:!1},e.value[t.modalId].id=t.modalId,e.value[t.modalId].type=t.payload.type,e.value[t.modalId].props=t.payload.props||{},e.value[t.modalId].visible=t.payload.visible||!1;break;case xd:delete e.value[t.modalId];break;case Td:e.value[t.modalId].visible=t.payload||!1}}),{value:{}});var qp=$p(((e,t)=>{switch(t.type){case Ad:e.fetching=!0,e.error=void 0;break;case Id:e.value=t.value||void 0,e.fetching=!1;break;case zd:e.fetching=t.payload||!1;break;case Fd:e.error=t.payload||void 0}}),{value:void 0,fetching:!1,error:void 0});var Up=$p(((e,t)=>{switch(t.type){case Hd:e.fetching=!0,e.error=void 0;break;case Kd:e.value=t.value||[],e.fetching=!1;break;case Qd:e.fetching=t.payload||!1;break;case Yd:e.error=t.payload||void 0}}),{value:[],fetching:!1,error:void 0});var Vp="TOP",Wp="NEW",Bp="RECENT";var Hp="LAST_24_HOURS",Kp="LAST_7_DAYS",Qp="LAST_30_DAYS",Yp="LAST_6_MONTHS";var Gp="DAILY",Xp="MONTHLY",Zp="YEARLY";var Jp="UNIQUE",em="TOTAL";var tm="WITH_SOURCE",nm="NO_SOURCE",rm="ONLY_SOURCE";var am="WITH_MODEL",om="NO_MODEL";var im="WITH_VERSION",lm="NO_VERSION";var um="BROWSER_HEIGHT",sm="BROWSER_RESOLUTION",cm="BROWSER_WIDTH",dm="SCREEN_HEIGHT",fm="SCREEN_RESOLUTION",pm="SCREEN_WIDTH";var mm="WITH_VERSION",hm="NO_VERSION";const ym=()=>({sorting:Vp,range:Kp,interval:Gp,viewsType:Jp,referrersType:tm,devicesType:am,browsersType:im,sizesType:sm,systemsType:mm});var vm=$p(((e,t)=>{switch(t.type){case rf:e.sorting=t.payload;break;case af:e.range=t.payload;break;case of:e.interval=t.payload;break;case lf:e.viewsType=t.payload;break;case uf:e.referrersType=t.payload;break;case sf:e.devicesType=t.payload;break;case cf:e.browsersType=t.payload;break;case df:e.sizesType=t.payload;break;case ff:e.systemsType=t.payload}}),ym());var gm=$p(((e,t)=>{switch(t.type){case pf:e.fetching=!0,e.error=void 0;break;case mf:e.value=t.value||[],e.fetching=!1;break;case hf:e.fetching=t.payload||!1;break;case yf:e.error=t.payload||void 0}}),{value:[],fetching:!1,error:void 0});var bm=$p(((e,t)=>{switch(t.type){case _f:e.fetching=!0,e.error=void 0;break;case xf:e.value=t.value||[],e.fetching=!1;break;case Tf:e.fetching=t.payload||!1;break;case Cf:e.error=t.payload||void 0}}),{value:[],fetching:!1,error:void 0});const wm=_s({modals:jp,token:qp,permanentTokens:Up,filter:vm,domains:gm,events:bm,widgets:$p(((e,t)=>{switch(t.type){case If:e.value[t.id]=e.value[t.id]||{value:void 0,fetching:!1};const n=null==e.value[t.id].value?t.value:e.value[t.id].value;e.value[t.id].value=n,e.value[t.id].fetching=!0;break;case zf:e.value[t.id].value=t.value,e.value[t.id].fetching=!1;break;case Ff:e.value[t.id].fetching=t.payload||!1;break;case $f:e.error=t.payload||void 0}}),{value:{},error:void 0})});var Em=n((function(e,t){!function(e,t){function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var r=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),e.length!==t.length||e.some((function(e,n){return!Object.is(e,t[n])}))},a={error:null},o=function(e){function o(){for(var t,n=arguments.length,r=new Array(n),o=0;o!1===km.includes(e.message),xm=Sm||(Sm={});xm.Pop="POP",xm.Push="PUSH",xm.Replace="REPLACE";function Tm(e){e.preventDefault(),e.returnValue=""}function Cm(){var e=[];return{get length(){return e.length},push:function(t){return e.push(t),function(){e=e.filter((function(e){return e!==t}))}},call:function(t){e.forEach((function(e){return e&&e(t)}))}}}function Nm(e){var t=e.pathname,n=e.search;return(void 0===t?"/":t)+(void 0===n?"":n)+(void 0===(e=e.hash)?"":e)}function Rm(e){var t={};if(e){var n=e.indexOf("#");0<=n&&(t.hash=e.substr(n),e=e.substr(0,n)),0<=(n=e.indexOf("?"))&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}var Pm=n((function(t,n){var r=[].slice;!function(e,r){null!==n?t.exports=r():e.UrlPattern=r()}(e,(function(){var e,t,n,a,o,i,l,u,s,c,d,f,p,m,h;return s=function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},l=function(e,t){var n,r,a;for(a=[],n=-1,r=e.length;++n(Array.isArray(i)?i.length-1:0)))return o=Array.isArray(i)?i[a]:i,r&&(n[t]=a+1),o;if(r)throw new Error("too few values provided for key `"+t+"`")}else if(r)throw new Error("no values provided for key `"+t+"`")},n=function(e,t,r){var a,o;if(Array.isArray(e)){for(a=-1,o=e.length;++a!0===Wm.some((t=>null!=t.pattern.match(e)))?e:Bm.pattern.stringify();var Km=()=>{const e=s.useMemo((()=>function(e){function t(){var e=Rm(l.location.hash.substr(1)),t=e.pathname,n=e.search;e=e.hash;var r=u.state||{};return[r.idx,{pathname:void 0===t?"/":t,search:void 0===n?"":n,hash:void 0===e?"":e,state:r.usr||null,key:r.key||"default"}]}function n(){if(s)m.call(s),s=null;else{var e=Sm.Pop,n=t(),r=n[0];if(n=n[1],m.length){if(null!=r){var a=d-r;a&&(s={action:e,location:n,retry:function(){i(-1*a)}},i(a))}}else o(e)}}function r(e){var t=document.querySelector("base"),n="";return t&&t.getAttribute("href")&&(n=-1===(n=(t=l.location.href).indexOf("#"))?t:t.slice(0,n)),n+"#"+("string"==typeof e?e:Nm(e))}function a(e,t){return void 0===t&&(t=null),cc({},f,{},"string"==typeof e?Rm(e):e,{state:t,key:Math.random().toString(36).substr(2,8)})}function o(e){c=e,e=t(),d=e[0],f=e[1],p.call({action:c,location:f})}function i(e){u.go(e)}void 0===e&&(e={});var l=void 0===(e=e.window)?document.defaultView:e,u=l.history,s=null;l.addEventListener("popstate",n),l.addEventListener("hashchange",(function(){Nm(t()[1])!==Nm(f)&&n()}));var c=Sm.Pop,d=(e=t())[0],f=e[1],p=Cm(),m=Cm();return null==d&&(d=0,u.replaceState(cc({},u.state,{idx:d}),"")),{get action(){return c},get location(){return f},createHref:r,push:function e(t,n){var i=Sm.Push,s=a(t,n);if(!m.length||(m.call({action:i,location:s,retry:function(){e(t,n)}}),0)){var c=[{usr:s.state,key:s.key,idx:d+1},r(s)];s=c[0],c=c[1];try{u.pushState(s,"",c)}catch(e){l.location.assign(c)}o(i)}},replace:function e(t,n){var i=Sm.Replace,l=a(t,n);m.length&&(m.call({action:i,location:l,retry:function(){e(t,n)}}),1)||(l=[{usr:l.state,key:l.key,idx:d},r(l)],u.replaceState(l[0],"",l[1]),o(i))},go:i,back:function(){i(-1)},forward:function(){i(1)},listen:function(e){return p.push(e)},block:function(e){var t=m.push(e);return 1===m.length&&l.addEventListener("beforeunload",Tm),function(){t(),m.length||l.removeEventListener("beforeunload",Tm)}}}}()),[]),[t,n]=s.useState(Hm(e.location));s.useEffect((()=>e.listen((({location:e})=>{n(Hm(e))}))),[e]);return[s.useCallback((t=>{e.push({pathname:t})}),[e]),t]},Qm=e=>[e.message,e.stack].join("\n");const Ym=e=>{e.target.select(),document.execCommand("copy")},Gm=e=>{const t=s.createElement("textarea",{className:"input",id:e.id,required:e.required,disabled:e.disabled,readOnly:e.readOnly,placeholder:e.placeholder,value:e.value,rows:e.rows,onChange:e.onChange,onFocus:!0===e.copyOnFocus?Ym:void 0});return!0===e.copyOnFocus?s.createElement("div",{className:"inputMessage",title:"Copied to clipboard"},t):t};Gm.propTypes={id:ac.string,required:ac.bool,disabled:ac.bool,readOnly:ac.bool,placeholder:ac.string,value:ac.string,rows:ac.number,onChange:ac.func,copyOnFocus:ac.bool};const Xm=e=>s.createElement("div",{className:"spacer",style:{"--size":e.size}});Xm.propTypes={size:ac.number.isRequired}; /*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see diff --git a/dist/tracker.js b/dist/tracker.js index 002ac24a..64bd2c2e 100644 --- a/dist/tracker.js +++ b/dist/tracker.js @@ -1 +1 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).ackeeTracker=e()}}((function(){return function e(t,r,n){function i(a,l){if(!r[a]){if(!t[a]){var s="function"==typeof require&&require;if(!l&&s)return s(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};t[a][0].call(c.exports,(function(e){return i(t[a][1][e]||e)}),c,c.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a-1&&n<=s)for(;++r3?"WebKit":/\bOpera\b/.test(N)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(G)&&"WebKit"||!G&&/\bMSIE\b/i.test(t)&&("Mac OS"==K?"Tasman":"Trident")||"WebKit"==G&&/\bPlayStation\b(?! Vita\b)/i.test(N)&&"NetFront")&&(G=[l]),"IE"==N&&(l=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(N+=" Mobile",K="Windows Phone "+(/\+$/.test(l)?l:l+".x"),$.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(N="IE Mobile",K="Windows Phone 8.x",$.unshift("desktop mode"),j||(j=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=N&&"Trident"==G&&(l=/\brv:([\d.]+)/.exec(t))&&(N&&$.push("identifying as "+N+(j?" "+j:"")),N="IE",j=l[1]),F){if(d="global",p=null!=(c=r)?typeof c[d]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!c[d])g(l=r.runtime)==w?(N="Adobe AIR",K=l.flash.system.Capabilities.os):g(l=r.phantom)==M?(N="PhantomJS",j=(l=l.version||null)&&l.major+"."+l.minor+"."+l.patch):"number"==typeof k.documentMode&&(l=/\bTrident\/(\d+)/i.exec(t))?(j=[j,k.documentMode],(l=+l[1]+4)!=j[1]&&($.push("IE "+j[1]+" mode"),G&&(G[1]=""),j[1]=l),j="IE"==N?String(j[1].toFixed(1)):j[0]):"number"==typeof k.documentMode&&/^(?:Chrome|Firefox)\b/.test(N)&&($.push("masking as "+N+" "+j),N="IE",j="11.0",G=["Trident"],K="Windows");else if(P&&(W=(l=P.lang.System).getProperty("os.arch"),K=K||l.getProperty("os.name")+" "+l.getProperty("os.version")),I){try{j=r.require("ringo/engine").version.join("."),N="RingoJS"}catch(e){(l=r.system)&&l.global.system==r.system&&(N="Narwhal",K||(K=l[0].os||null))}N||(N="Rhino")}else"object"==typeof r.process&&!r.process.browser&&(l=r.process)&&("object"==typeof l.versions&&("string"==typeof l.versions.electron?($.push("Node "+l.versions.node),N="Electron",j=l.versions.electron):"string"==typeof l.versions.nw&&($.push("Chromium "+j,"Node "+l.versions.node),N="NW.js",j=l.versions.nw)),N||(N="Node.js",W=l.arch,K=l.platform,j=(j=/[\d.]+/.exec(l.version))?j[0]:null));K=K&&f(K)}if(j&&(l=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(j)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(F&&o.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(T=/b/i.test(l)?"beta":"alpha",j=j.replace(RegExp(l+"\\+?$"),"")+("beta"==T?C:A)+(/\d+\+?/.exec(l)||"")),"Fennec"==N||"Firefox"==N&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(K))N="Firefox Mobile";else if("Maxthon"==N&&j)j=j.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(X))"Xbox 360"==X&&(K=null),"Xbox 360"==X&&/\bIEMobile\b/.test(t)&&$.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(N)&&(!N||X||/Browser|Mobi/.test(N))||"Windows CE"!=K&&!/Mobi/i.test(t))if("IE"==N&&F)try{null===r.external&&$.unshift("platform preview")}catch(e){$.unshift("embedded")}else(/\bBlackBerry\b/.test(X)||/\bBB10\b/.test(t))&&(l=(RegExp(X.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||j)?(K=((l=[l,/BB10/.test(t)])[1]?(X=null,D="BlackBerry"):"Device Software")+" "+l[0],j=null):this!=h&&"Wii"!=X&&(F&&R||/Opera/.test(N)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==N&&/\bOS X (?:\d+\.){2,}/.test(K)||"IE"==N&&(K&&!/^Win/.test(K)&&j>5.5||/\bWindows XP\b/.test(K)&&j>8||8==j&&!/\bTrident\b/.test(t)))&&!u.test(l=e.call(h,t.replace(u,"")+";"))&&l.name&&(l="ing as "+l.name+((l=l.version)?" "+l:""),u.test(N)?(/\bIE\b/.test(l)&&"Mac OS"==K&&(K=null),l="identify"+l):(l="mask"+l,N=B?f(B.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(l)&&(K=null),F||(j=null)),G=["Presto"],$.push(l));else N+=" Mobile";(l=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(l=[parseFloat(l.replace(/\.(\d)$/,".0$1")),l],"Safari"==N&&"+"==l[1].slice(-1)?(N="WebKit Nightly",T="alpha",j=l[1].slice(0,-1)):j!=l[1]&&j!=(l[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(j=null),l[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==l[0]&&537.36==l[2]&&parseFloat(l[1])>=28&&"WebKit"==G&&(G=["Blink"]),F&&(y||l[1])?(G&&(G[1]="like Chrome"),l=l[1]||((l=l[0])<530?1:l<532?2:l<532.05?3:l<533?4:l<534.03?5:l<534.07?6:l<534.1?7:l<534.13?8:l<534.16?9:l<534.24?10:l<534.3?11:l<535.01?12:l<535.02?"13+":l<535.07?15:l<535.11?16:l<535.19?17:l<536.05?18:l<536.1?19:l<537.01?20:l<537.11?"21+":l<537.13?23:l<537.18?24:l<537.24?25:l<537.36?26:"Blink"!=G?"27":"28")):(G&&(G[1]="like Safari"),l=(l=l[0])<400?1:l<500?2:l<526?3:l<533?4:l<534?"4+":l<535?5:l<537?6:l<538?7:l<601?8:l<602?9:l<604?10:l<606?11:l<608?12:"12"),G&&(G[1]+=" "+(l+="number"==typeof l?".x":/[.+]/.test(l)?"":"+")),"Safari"==N&&(!j||parseInt(j)>45)?j=l:"Chrome"==N&&/\bHeadlessChrome/i.test(t)&&$.unshift("headless")),"Opera"==N&&(l=/\bzbov|zvav$/.exec(K))?(N+=" ",$.unshift("desktop mode"),"zvav"==l?(N+="Mini",j=null):N+="Mobile",K=K.replace(RegExp(" *"+l+"$"),"")):"Safari"==N&&/\bChrome\b/.exec(G&&G[1])?($.unshift("desktop mode"),N="Chrome Mobile",j=null,/\bOS X\b/.test(K)?(D="Apple",K="iOS 4.3+"):K=null):/\bSRWare Iron\b/.test(N)&&!j&&(j=_("Chrome")),j&&0==j.indexOf(l=/[\d.]+$/.exec(K))&&t.indexOf("/"+l+"-")>-1&&(K=x(K.replace(l,""))),K&&-1!=K.indexOf(N)&&!RegExp(N+" OS").test(K)&&(K=K.replace(RegExp(" *"+S(N)+" *"),"")),G&&!/\b(?:Avant|Nook)\b/.test(N)&&(/Browser|Lunascape|Maxthon/.test(N)||"Safari"!=N&&/^iOS/.test(K)&&/\bSafari\b/.test(G[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(N)&&G[1])&&(l=G[G.length-1])&&$.push(l),$.length&&($=["("+$.join("; ")+")"]),D&&X&&X.indexOf(D)<0&&$.push("on "+D),X&&$.push((/^on /.test($[$.length-1])?"":"on ")+X),K&&(l=/ ([\d.+]+)$/.exec(K),s=l&&"/"==K.charAt(K.length-l[0].length-1),K={architecture:32,family:l&&!s?K.replace(l[0],""):K,version:l?l[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(l=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(W))&&!/\bi686\b/i.test(W)?(K&&(K.architecture=64,K.family=K.family.replace(RegExp(" *"+l),"")),N&&(/\bWOW64\b/i.test(t)||F&&/\w(?:86|32)$/.test(o.cpuClass||o.platform)&&!/\bWin64; x64\b/i.test(t))&&$.unshift("32-bit")):K&&/^OS X/.test(K.family)&&"Chrome"==N&&parseFloat(j)>=39&&(K.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=G&&G[0],H.manufacturer=D,H.name=N,H.prerelease=T,H.product=X,H.ua=t,H.version=N&&j,H.os=K||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&$.unshift(j),H.name&&$.unshift(N),K&&N&&(K!=String(K).split(" ")[0]||K!=N.split(" ")[0]&&!X)&&$.push(X?"("+K+")":"on "+K),$.length&&(H.description=$.join(" ")),H}();o&&a?h(y,(function(e,t){o[t]=e})):i.platform=y}).call(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.create=r.detect=r.attributes=void 0;var n,i=(n=e("platform"))&&n.__esModule?n:{default:n};function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0],t={siteLocation:window.location.href,siteReferrer:document.referrer,source:c()},r={siteLanguage:(navigator.language||navigator.userLanguage).substr(0,2),screenWidth:screen.width,screenHeight:screen.height,screenColorDepth:screen.colorDepth,deviceName:i.default.product,deviceManufacturer:i.default.manufacturer,osName:i.default.os.family,osVersion:i.default.os.version,browserName:i.default.name,browserVersion:i.default.version,browserWidth:window.outerWidth,browserHeight:window.outerHeight};return a(a({},t),!0===e?r:{})};r.attributes=d;var b=function(e,t){return{query:"\n\t\t\tmutation createRecord($domainId: ID!, $input: CreateRecordInput!) {\n\t\t\t\tcreateRecord(domainId: $domainId, input: $input) {\n\t\t\t\t\tpayload {\n\t\t\t\t\t\tid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t",variables:{domainId:e,input:t}}},p=function(e){return{query:"\n\t\t\tmutation updateRecord($recordId: ID!) {\n\t\t\t\tupdateRecord(id: $recordId) {\n\t\t\t\t\tsuccess\n\t\t\t\t}\n\t\t\t}\n\t\t",variables:{recordId:e}}},f=function(e,t,r){var n=new XMLHttpRequest;n.open("POST",e),n.onload=function(){if(200!==n.status)throw new Error("Server returned with an unhandled status");var e=null;try{e=JSON.parse(n.responseText)}catch(e){throw new Error("Failed to parse response from server")}if(null!=e.errors)throw new Error(e.errors[0].message);if("function"==typeof r)return r(e)},n.setRequestHeader("Content-Type","application/json;charset=UTF-8"),n.withCredentials=!0,n.send(JSON.stringify(t))},h=function(){var e=document.querySelector("[data-ackee-domain-id]");if(null!=e){var t=e.getAttribute("data-ackee-server")||"",r=e.getAttribute("data-ackee-domain-id"),n=e.getAttribute("data-ackee-opts")||"{}";g(t,JSON.parse(n)).record(r)}};r.detect=h;var g=function(e,t){t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};return t.detailed=!0===e.detailed,t.ignoreLocalhost=!1!==e.ignoreLocalhost,t}(t);var r,n,i=function(e){var t="/"===e.substr(-1);return e+(!0===t?"":"/")+"api"}(e),o=function(){},a={record:function(){return{stop:o}},updateRecord:function(){return{stop:o}},action:o,updateAction:o};if(!0===t.ignoreLocalhost&&!0==(""===(r=location.hostname)||"localhost"===r||"127.0.0.1"===r||"::1"===r))return console.warn("Ackee ignores you because you are on localhost"),a;if(!0===(n=navigator.userAgent,/bot|crawler|spider|crawling/i.test(n)))return console.warn("Ackee ignores you because you are a bot"),a;return{record:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d(t.detailed),n=arguments.length>2?arguments[2]:void 0,o=!1,a=function(){o=!0};return f(i,b(e,r),(function(e){var t=e.data.createRecord.payload.id;if(!0===u(t))return console.warn("Ackee ignores you because this is your own site");var r=setInterval((function(){!0!==o?f(i,p(t)):clearInterval(r)}),15e3);return"function"==typeof n?n(t):void 0})),{stop:a}},updateRecord:function(e){var t=!1,r=function(){t=!0};if(!0===u(e))return console.warn("Ackee ignores you because this is your own site"),{stop:r};var n=setInterval((function(){!0!==t?f(i,p(e)):clearInterval(n)}),15e3);return{stop:r}},action:function(e,t,r){f(i,function(e,t){return{query:"\n\t\t\tmutation createAction($eventId: ID!, $input: CreateActionInput!) {\n\t\t\t\tcreateAction(eventId: $eventId, input: $input) {\n\t\t\t\t\tpayload {\n\t\t\t\t\t\tid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t",variables:{eventId:e,input:t}}}(e,t),(function(e){var t=e.data.createAction.payload.id;return!0===u(t)?console.warn("Ackee ignores you because this is your own site"):"function"==typeof r?r(t):void 0}))},updateAction:function(e,t){if(!0===u(e))return console.warn("Ackee ignores you because this is your own site");f(i,function(e,t){return{query:"\n\t\t\tmutation updateAction($actionId: ID!, $input: UpdateActionInput!) {\n\t\t\t\tupdateAction(id: $actionId, input: $input) {\n\t\t\t\t\tsuccess\n\t\t\t\t}\n\t\t\t}\n\t\t",variables:{actionId:e,input:t}}}(e,t))}}};r.create=g,!0===s&&h()},{platform:1}]},{},[2])(2)})); \ No newline at end of file +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).ackeeTracker=e()}}((function(){return function e(t,n,r){function i(a,l){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!l&&s)return s(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[a]={exports:{}};t[a][0].call(c.exports,(function(e){return i(t[a][1][e]||e)}),c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(N)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(G)&&"WebKit"||!G&&/\bMSIE\b/i.test(t)&&("Mac OS"==K?"Tasman":"Trident")||"WebKit"==G&&/\bPlayStation\b(?! Vita\b)/i.test(N)&&"NetFront")&&(G=[l]),"IE"==N&&(l=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(N+=" Mobile",K="Windows Phone "+(/\+$/.test(l)?l:l+".x"),$.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(N="IE Mobile",K="Windows Phone 8.x",$.unshift("desktop mode"),j||(j=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=N&&"Trident"==G&&(l=/\brv:([\d.]+)/.exec(t))&&(N&&$.push("identifying as "+N+(j?" "+j:"")),N="IE",j=l[1]),F){if(d="global",p=null!=(c=n)?typeof c[d]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!c[d])g(l=n.runtime)==w?(N="Adobe AIR",K=l.flash.system.Capabilities.os):g(l=n.phantom)==M?(N="PhantomJS",j=(l=l.version||null)&&l.major+"."+l.minor+"."+l.patch):"number"==typeof k.documentMode&&(l=/\bTrident\/(\d+)/i.exec(t))?(j=[j,k.documentMode],(l=+l[1]+4)!=j[1]&&($.push("IE "+j[1]+" mode"),G&&(G[1]=""),j[1]=l),j="IE"==N?String(j[1].toFixed(1)):j[0]):"number"==typeof k.documentMode&&/^(?:Chrome|Firefox)\b/.test(N)&&($.push("masking as "+N+" "+j),N="IE",j="11.0",G=["Trident"],K="Windows");else if(P&&(W=(l=P.lang.System).getProperty("os.arch"),K=K||l.getProperty("os.name")+" "+l.getProperty("os.version")),I){try{j=n.require("ringo/engine").version.join("."),N="RingoJS"}catch(e){(l=n.system)&&l.global.system==n.system&&(N="Narwhal",K||(K=l[0].os||null))}N||(N="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(l=n.process)&&("object"==typeof l.versions&&("string"==typeof l.versions.electron?($.push("Node "+l.versions.node),N="Electron",j=l.versions.electron):"string"==typeof l.versions.nw&&($.push("Chromium "+j,"Node "+l.versions.node),N="NW.js",j=l.versions.nw)),N||(N="Node.js",W=l.arch,K=l.platform,j=(j=/[\d.]+/.exec(l.version))?j[0]:null));K=K&&f(K)}if(j&&(l=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(j)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(F&&o.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(T=/b/i.test(l)?"beta":"alpha",j=j.replace(RegExp(l+"\\+?$"),"")+("beta"==T?C:A)+(/\d+\+?/.exec(l)||"")),"Fennec"==N||"Firefox"==N&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(K))N="Firefox Mobile";else if("Maxthon"==N&&j)j=j.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(X))"Xbox 360"==X&&(K=null),"Xbox 360"==X&&/\bIEMobile\b/.test(t)&&$.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(N)&&(!N||X||/Browser|Mobi/.test(N))||"Windows CE"!=K&&!/Mobi/i.test(t))if("IE"==N&&F)try{null===n.external&&$.unshift("platform preview")}catch(e){$.unshift("embedded")}else(/\bBlackBerry\b/.test(X)||/\bBB10\b/.test(t))&&(l=(RegExp(X.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||j)?(K=((l=[l,/BB10/.test(t)])[1]?(X=null,D="BlackBerry"):"Device Software")+" "+l[0],j=null):this!=h&&"Wii"!=X&&(F&&R||/Opera/.test(N)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==N&&/\bOS X (?:\d+\.){2,}/.test(K)||"IE"==N&&(K&&!/^Win/.test(K)&&j>5.5||/\bWindows XP\b/.test(K)&&j>8||8==j&&!/\bTrident\b/.test(t)))&&!u.test(l=e.call(h,t.replace(u,"")+";"))&&l.name&&(l="ing as "+l.name+((l=l.version)?" "+l:""),u.test(N)?(/\bIE\b/.test(l)&&"Mac OS"==K&&(K=null),l="identify"+l):(l="mask"+l,N=B?f(B.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(l)&&(K=null),F||(j=null)),G=["Presto"],$.push(l));else N+=" Mobile";(l=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(l=[parseFloat(l.replace(/\.(\d)$/,".0$1")),l],"Safari"==N&&"+"==l[1].slice(-1)?(N="WebKit Nightly",T="alpha",j=l[1].slice(0,-1)):j!=l[1]&&j!=(l[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(j=null),l[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==l[0]&&537.36==l[2]&&parseFloat(l[1])>=28&&"WebKit"==G&&(G=["Blink"]),F&&(y||l[1])?(G&&(G[1]="like Chrome"),l=l[1]||((l=l[0])<530?1:l<532?2:l<532.05?3:l<533?4:l<534.03?5:l<534.07?6:l<534.1?7:l<534.13?8:l<534.16?9:l<534.24?10:l<534.3?11:l<535.01?12:l<535.02?"13+":l<535.07?15:l<535.11?16:l<535.19?17:l<536.05?18:l<536.1?19:l<537.01?20:l<537.11?"21+":l<537.13?23:l<537.18?24:l<537.24?25:l<537.36?26:"Blink"!=G?"27":"28")):(G&&(G[1]="like Safari"),l=(l=l[0])<400?1:l<500?2:l<526?3:l<533?4:l<534?"4+":l<535?5:l<537?6:l<538?7:l<601?8:l<602?9:l<604?10:l<606?11:l<608?12:"12"),G&&(G[1]+=" "+(l+="number"==typeof l?".x":/[.+]/.test(l)?"":"+")),"Safari"==N&&(!j||parseInt(j)>45)?j=l:"Chrome"==N&&/\bHeadlessChrome/i.test(t)&&$.unshift("headless")),"Opera"==N&&(l=/\bzbov|zvav$/.exec(K))?(N+=" ",$.unshift("desktop mode"),"zvav"==l?(N+="Mini",j=null):N+="Mobile",K=K.replace(RegExp(" *"+l+"$"),"")):"Safari"==N&&/\bChrome\b/.exec(G&&G[1])?($.unshift("desktop mode"),N="Chrome Mobile",j=null,/\bOS X\b/.test(K)?(D="Apple",K="iOS 4.3+"):K=null):/\bSRWare Iron\b/.test(N)&&!j&&(j=V("Chrome")),j&&0==j.indexOf(l=/[\d.]+$/.exec(K))&&t.indexOf("/"+l+"-")>-1&&(K=x(K.replace(l,""))),K&&-1!=K.indexOf(N)&&!RegExp(N+" OS").test(K)&&(K=K.replace(RegExp(" *"+S(N)+" *"),"")),G&&!/\b(?:Avant|Nook)\b/.test(N)&&(/Browser|Lunascape|Maxthon/.test(N)||"Safari"!=N&&/^iOS/.test(K)&&/\bSafari\b/.test(G[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(N)&&G[1])&&(l=G[G.length-1])&&$.push(l),$.length&&($=["("+$.join("; ")+")"]),D&&X&&X.indexOf(D)<0&&$.push("on "+D),X&&$.push((/^on /.test($[$.length-1])?"":"on ")+X),K&&(l=/ ([\d.+]+)$/.exec(K),s=l&&"/"==K.charAt(K.length-l[0].length-1),K={architecture:32,family:l&&!s?K.replace(l[0],""):K,version:l?l[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(l=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(W))&&!/\bi686\b/i.test(W)?(K&&(K.architecture=64,K.family=K.family.replace(RegExp(" *"+l),"")),N&&(/\bWOW64\b/i.test(t)||F&&/\w(?:86|32)$/.test(o.cpuClass||o.platform)&&!/\bWin64; x64\b/i.test(t))&&$.unshift("32-bit")):K&&/^OS X/.test(K.family)&&"Chrome"==N&&parseFloat(j)>=39&&(K.architecture=64),t||(t=null);var _={};return _.description=t,_.layout=G&&G[0],_.manufacturer=D,_.name=N,_.prerelease=T,_.product=X,_.ua=t,_.version=N&&j,_.os=K||{architecture:null,family:null,version:null,toString:function(){return"null"}},_.parse=e,_.toString=function(){return this.description||""},_.version&&$.unshift(j),_.name&&$.unshift(N),K&&N&&(K!=String(K).split(" ")[0]||K!=N.split(" ")[0]&&!X)&&$.push(X?"("+K+")":"on "+K),$.length&&(_.description=$.join(" ")),_}();o&&a?h(y,(function(e,t){o[t]=e})):i.platform=y}).call(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.create=n.detect=n.attributes=void 0;var r,i=(r=e("platform"))&&r.__esModule?r:{default:r};function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0],t={siteLocation:window.location.href,siteReferrer:document.referrer,source:c()},n={siteLanguage:(navigator.language||navigator.userLanguage).substr(0,2),screenWidth:screen.width,screenHeight:screen.height,screenColorDepth:screen.colorDepth,deviceName:i.default.product,deviceManufacturer:i.default.manufacturer,osName:i.default.os.family,osVersion:i.default.os.version,browserName:i.default.name,browserVersion:i.default.version,browserWidth:window.outerWidth,browserHeight:window.outerHeight};return a(a({},t),!0===e?n:{})};n.attributes=d;var b=function(e,t){return{query:"\n\t\t\tmutation createRecord($domainId: ID!, $input: CreateRecordInput!) {\n\t\t\t\tcreateRecord(domainId: $domainId, input: $input) {\n\t\t\t\t\tpayload {\n\t\t\t\t\t\tid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t",variables:{domainId:e,input:t}}},p=function(e){return{query:"\n\t\t\tmutation updateRecord($recordId: ID!) {\n\t\t\t\tupdateRecord(id: $recordId) {\n\t\t\t\t\tsuccess\n\t\t\t\t}\n\t\t\t}\n\t\t",variables:{recordId:e}}},f=function(e,t,n,r){var i=new XMLHttpRequest;i.open("POST",e),i.onload=function(){if(200!==i.status)throw new Error("Server returned with an unhandled status");var e=null;try{e=JSON.parse(i.responseText)}catch(e){throw new Error("Failed to parse response from server")}if(null!=e.errors)throw new Error(e.errors[0].message);if("function"==typeof r)return r(e)},i.setRequestHeader("Content-Type","application/json;charset=UTF-8"),i.withCredentials=n.ignoreOwnVisits,i.send(JSON.stringify(t))},h=function(){var e=document.querySelector("[data-ackee-domain-id]");if(null!=e){var t=e.getAttribute("data-ackee-server")||"",n=e.getAttribute("data-ackee-domain-id"),r=e.getAttribute("data-ackee-opts")||"{}";g(t,JSON.parse(r)).record(n)}};n.detect=h;var g=function(e,t){t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};return t.detailed=!0===e.detailed,t.ignoreLocalhost=!1!==e.ignoreLocalhost,t.ignoreOwnVisits=!1!==e.ignoreOwnVisits,t}(t);var n,r,i=function(e){var t="/"===e.substr(-1);return e+(!0===t?"":"/")+"api"}(e),o=function(){},a={record:function(){return{stop:o}},updateRecord:function(){return{stop:o}},action:o,updateAction:o};if(!0===t.ignoreLocalhost&&!0==(""===(n=location.hostname)||"localhost"===n||"127.0.0.1"===n||"::1"===n))return console.warn("Ackee ignores you because you are on localhost"),a;if(!0===(r=navigator.userAgent,/bot|crawler|spider|crawling/i.test(r)))return console.warn("Ackee ignores you because you are a bot"),a;return{record:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d(t.detailed),r=arguments.length>2?arguments[2]:void 0,o=!1,a=function(){o=!0};return f(i,b(e,n),t,(function(e){var n=e.data.createRecord.payload.id;if(!0===u(n))return console.warn("Ackee ignores you because this is your own site");var a=setInterval((function(){!0!==o?f(i,p(n),t):clearInterval(a)}),15e3);return"function"==typeof r?r(n):void 0})),{stop:a}},updateRecord:function(e){var n=!1,r=function(){n=!0};if(!0===u(e))return console.warn("Ackee ignores you because this is your own site"),{stop:r};var o=setInterval((function(){!0!==n?f(i,p(e),t):clearInterval(o)}),15e3);return{stop:r}},action:function(e,n,r){f(i,function(e,t){return{query:"\n\t\t\tmutation createAction($eventId: ID!, $input: CreateActionInput!) {\n\t\t\t\tcreateAction(eventId: $eventId, input: $input) {\n\t\t\t\t\tpayload {\n\t\t\t\t\t\tid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t",variables:{eventId:e,input:t}}}(e,n),t,(function(e){var t=e.data.createAction.payload.id;return!0===u(t)?console.warn("Ackee ignores you because this is your own site"):"function"==typeof r?r(t):void 0}))},updateAction:function(e,n){if(!0===u(e))return console.warn("Ackee ignores you because this is your own site");f(i,function(e,t){return{query:"\n\t\t\tmutation updateAction($actionId: ID!, $input: UpdateActionInput!) {\n\t\t\t\tupdateAction(id: $actionId, input: $input) {\n\t\t\t\t\tsuccess\n\t\t\t\t}\n\t\t\t}\n\t\t",variables:{actionId:e,input:t}}}(e,n),t)}}};n.create=g,!0===s&&h()},{platform:1}]},{},[2])(2)})); \ No newline at end of file diff --git a/docs/CORS headers.md b/docs/CORS headers.md index b5d4acbf..d9adf96f 100644 --- a/docs/CORS headers.md +++ b/docs/CORS headers.md @@ -3,7 +3,7 @@ Ackee requires correct [CORS headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS). [ackee-tracker](https://github.com/electerious/ackee-tracker) (the script that sends data from your sites to Ackee) won't be able to contact your server when the CORS headers aren't available or when they are configured incorrectly. - [Reverse proxy configuration](#reverse-proxy-configuration) -- [Heroku or Platforms-As-A-Service configuration](#heroku-or-platforms-as-a-service-configuration) +- [Platforms-As-A-Service configuration](#platforms-as-a-service-configuration) ## Why? @@ -20,18 +20,12 @@ Access-Control-Allow-Credentials: true ### Origin -Your server needs to allow requests from your sites (recommended) or from all sites (easier to implement, but insecure). +The `Access-Control-Allow-Origin` header only allows one domain. A wildcard (`*`) isn't recommended as it's neither a secure solution nor does it allow Ackee to ignore your own visits. Take a look at our [recommended configuration](SSL%20and%20HTTPS.md#recommended-configuration) if you want to allow requests from multiple domains or disable the `ignoreOwnVisits` option in ackee-tracker if using a wildcard is the only option for you. ``` Access-Control-Allow-Origin: https://example.com ``` -``` -Access-Control-Allow-Origin: * -``` - -The `Access-Control-Allow-Origin` header only allows one domain or a wildcard (`*`). Take a look at our [advanced configuration](SSL%20and%20HTTPS.md#advanced-configuration) if you want to allow requests from multiple domains without using the insecure wildcard. - ### Methods [ackee-tracker](https://github.com/electerious/ackee-tracker) needs the permission to send GET, POST, PATCH and OPTIONS requests to the server. @@ -58,7 +52,7 @@ The `Access-Control-Allow-Credentials` header tells the browser to include the ` Access-Control-Allow-Credentials: true ``` -## Heroku or Platforms-As-A-Service configuration +## Platforms-As-A-Service configuration If you are running Ackee on a platform which handles SSL for you, you may want a quick solution for setting CORS headers instead of using a [reverse proxy](SSL%20and%20HTTPS.md). @@ -68,14 +62,14 @@ As an environment variable, you will need to set: ACKEE_ALLOW_ORIGIN="https://example.com" ``` -The proper header value for `Access-Control-Allow-Origin` will be set with the other headers being the recommended values. - -It's also possible to allow requests from all domains (not recommended) or from multiple domains: +*or* ``` -ACKEE_ALLOW_ORIGIN="*" +ACKEE_ALLOW_ORIGIN="https://example.com,https://one.example.com,https://two.example.com" ``` +Setting a wildcard (`*`) is also supported, but not recommended. It's neither a secure solution nor does it allow Ackee to ignore your own visits. Please disable the `ignoreOwnVisits` option in ackee-tracker if using a wildcard is the only option for you. + ``` -ACKEE_ALLOW_ORIGIN="https://example.com,https://example2.com" +ACKEE_ALLOW_ORIGIN="*" ``` \ No newline at end of file diff --git a/docs/Get started.md b/docs/Get started.md index 3ac73d33..7feebeff 100644 --- a/docs/Get started.md +++ b/docs/Get started.md @@ -179,7 +179,7 @@ Ackee now runs on port `3000` and is only accessible from you local network. It' - You need to have a MongoDB instance running (e.g. [MongoDB Atlas](https://www.mongodb.com/cloud/atlas)) - Set a username and password to protect your interface -- Ensure that you're using the correct CORS headers by setting [`ACKEE_ALLOW_ORIGIN`](CORS%20headers.md#heroku-or-platforms-as-a-service-configuration). +- Ensure that you're using the correct CORS headers by setting [`ACKEE_ALLOW_ORIGIN`](CORS%20headers.md#platforms-as-a-service-configuration). ### 3. Updating Ackee @@ -214,7 +214,7 @@ Deploy to Heroku by clicking this button: ### 2. Configure Ackee - You need to have a MongoDB instance running, either hosting it yourself, using [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) or by using a (paid) add-on like [ObjectRocket MongoDB](https://elements.heroku.com/addons/ormongo). This is as simple as typing `heroku addons:create ormongo:2-wt --app ` using the CLI, or using the web dashboard; more details at the [official documentation](https://devcenter.heroku.com/articles/managing-add-ons). You'll need to provide connection details to Ackee dyno, either from the web dashboard or via command line, e.g. `heroku config:add "ACKEE_MONGODB=mongodb://:/"` -- Ensure that you're using the correct CORS headers by setting [`ACKEE_ALLOW_ORIGIN`](CORS%20headers.md#heroku-or-platforms-as-a-service-configuration). +- Ensure that you're using the correct CORS headers by setting [`ACKEE_ALLOW_ORIGIN`](CORS%20headers.md#platforms-as-a-service-configuration). ### 3. Updating Ackee diff --git a/docs/Options.md b/docs/Options.md index 1331e289..1fc122d6 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -74,20 +74,20 @@ NODE_ENV=development ## CORS headers -Quick solution for setting [CORS headers](CORS%20headers.md) instead of using a [reverse proxy](SSL%20and%20HTTPS.md). This is helpful if you are running Ackee on a platform which handles SSL for you. +Quick solution for setting [CORS headers](CORS%20headers.md) instead of using a [reverse proxy](SSL%20and%20HTTPS.md). This is helpful if you are running Ackee on a platform that handles SSL for you. ``` -ACKEE_ALLOW_ORIGIN="*" +ACKEE_ALLOW_ORIGIN="https://example.com" ``` *or* ``` -ACKEE_ALLOW_ORIGIN="https://example.com" +ACKEE_ALLOW_ORIGIN="https://example.com,https://one.example.com,https://two.example.com" ``` -*or* +Setting a wildcard (`*`) is also supported, but not recommended. It's neither a secure solution nor does it allow Ackee to ignore your own visits. Please disable the `ignoreOwnVisits` option in ackee-tracker if using a wildcard is the only option for you. ``` -ACKEE_ALLOW_ORIGIN="https://example.com,https://example2.com" +ACKEE_ALLOW_ORIGIN="*" ``` \ No newline at end of file diff --git a/docs/SSL and HTTPS.md b/docs/SSL and HTTPS.md index 9d19099d..cbe6f0af 100644 --- a/docs/SSL and HTTPS.md +++ b/docs/SSL and HTTPS.md @@ -14,45 +14,15 @@ I highly recommend [this article](https://medium.com/intrinsic/why-should-i-use- ### nginx -#### Basic configuration +- [Recommended configuration](#recommended-configuration) +- [Single domain configuration](#single-domain-configuration) +- [Insecure wildcard configuration](#insecure-wildcard-configuration) -This configuration secures all connections using TSL/SSL and gives any domain permission to access Ackee. +#### Recommended configuration -> 👉 The CORS headers are required so all your sites can send data to Ackee, even when their domain is different to the one Ackee uses. Take a look at the next example to tighten the CORS headers. +This configuration redirects all requests to the non-www domain `example.com`, secures connections using TSL/SSL and allows CORS requests from a list of known domains. -```conf -server { - listen 443 ssl http2; - - server_name example.com; - - ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; - - access_log /var/log/nginx/log/example.com.access.log main; - error_log /var/log/nginx/log/example.com.error.log; - - location / { - add_header Access-Control-Allow-Origin "*" always; - add_header Access-Control-Allow-Methods "GET, POST, PATCH, OPTIONS" always; - add_header Access-Control-Allow-Headers "Content-Type, Authorization, Time-Zone" always; - add_header Access-Control-Allow-Credentials "true" always; - add_header Strict-Transport-Security "max-age=31536000" always; - add_header X-Frame-Options deny; - proxy_pass http://localhost:3000; - proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; - proxy_redirect off; - proxy_buffering off; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } -} -``` - -#### Advanced configuration - -This configuration redirects all requests to the non-www domain `example.com` and adds the CORS headers only for known domains. It also secures connections using TSL/SSL. +> 👉 The CORS headers are required so your sites can send data to Ackee, even when their domain is different to the one Ackee uses. ```conf # @@ -122,3 +92,72 @@ server { } } ``` + +#### Single domain configuration + +This configuration secures all connections using TSL/SSL and allows `https://example.com` to send data to `https://ackee.example.com`. + +> ℹ️ This configuration only allows requests from a single domain. Take a look at our [recommended configuration](#recommended-configuration) if you want to allow requests from multiple domains or use the [insecure wildcard configuration](#insecure-wildcard-configuration). + +```conf +server { + listen 443 ssl http2; + + server_name ackee.example.com; + + ssl_certificate /etc/letsencrypt/live/ackee.example.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/ackee.example.com/privkey.pem; + + access_log /var/log/nginx/log/ackee.example.com.access.log main; + error_log /var/log/nginx/log/ackee.example.com.error.log; + + location / { + add_header Access-Control-Allow-Origin "https://example.com" always; + add_header Access-Control-Allow-Methods "GET, POST, PATCH, OPTIONS" always; + add_header Access-Control-Allow-Headers "Content-Type, Authorization, Time-Zone" always; + add_header Access-Control-Allow-Credentials "true" always; + add_header Strict-Transport-Security "max-age=31536000" always; + add_header X-Frame-Options deny; + proxy_pass http://localhost:3000; + proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; + proxy_redirect off; + proxy_buffering off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +} +``` + +#### Insecure wildcard configuration + +A wildcard (`*`) isn't recommended as it's neither a secure solution nor does it allow Ackee to ignore your own visits. Please disable the `ignoreOwnVisits` option in ackee-tracker if using a wildcard is the only option for you. + +```conf +server { + listen 443 ssl http2; + + server_name ackee.example.com; + + ssl_certificate /etc/letsencrypt/live/ackee.example.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/ackee.example.com/privkey.pem; + + access_log /var/log/nginx/log/ackee.example.com.access.log main; + error_log /var/log/nginx/log/ackee.example.com.error.log; + + location / { + add_header Access-Control-Allow-Origin "*" always; + add_header Access-Control-Allow-Methods "GET, POST, PATCH, OPTIONS" always; + add_header Access-Control-Allow-Headers "Content-Type, Authorization, Time-Zone" always; + add_header Strict-Transport-Security "max-age=31536000" always; + add_header X-Frame-Options deny; + proxy_pass http://localhost:3000; + proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; + proxy_redirect off; + proxy_buffering off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +} +``` \ No newline at end of file diff --git a/package.json b/package.json index e87a88ab..5ce675f2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ackee", "private": true, - "version": "3.0.2", + "version": "3.0.3", "authors": [ "Tobias Reich " ], @@ -33,7 +33,7 @@ "lint": "eslint '{functions,src,test}/**/*.js'" }, "dependencies": { - "ackee-tracker": "^5.0.0", + "ackee-tracker": "^5.0.1", "apollo-server-lambda": "^2.19.2", "apollo-server-micro": "^2.19.2", "apollo-server-plugin-http-headers": "^0.1.4", @@ -47,7 +47,7 @@ "is-url": "^1.2.4", "micro": "^9.3.4", "microrouter": "^3.1.3", - "mongoose": "^5.11.12", + "mongoose": "^5.11.13", "node-fetch": "^2.6.1", "node-schedule": "^1.3.2", "normalize-url": "^5.0.0", diff --git a/src/database/actions.js b/src/database/actions.js index bb479372..609d5e7d 100644 --- a/src/database/actions.js +++ b/src/database/actions.js @@ -58,6 +58,13 @@ const update = async (id, data) => { const getChart = async (ids, type, interval, limit, dateDetails) => { + const aggregation = (() => { + + if (type === 'TOTAL') return aggregateActions(ids, false, interval, limit, dateDetails) + if (type === 'AVERAGE') return aggregateActions(ids, true, interval, limit, dateDetails) + + })() + const enhance = (entries) => { const matchDay = [ intervals.INTERVALS_DAILY ].includes(interval) @@ -92,13 +99,6 @@ const getChart = async (ids, type, interval, limit, dateDetails) => { } - const aggregation = (() => { - - if (type === 'TOTAL') return aggregateActions(ids, false, interval, limit, dateDetails) - if (type === 'AVERAGE') return aggregateActions(ids, true, interval, limit, dateDetails) - - })() - return enhance( await Action.aggregate(aggregation) ) diff --git a/src/database/browsers.js b/src/database/browsers.js index e4516797..d4146451 100644 --- a/src/database/browsers.js +++ b/src/database/browsers.js @@ -6,23 +6,9 @@ const aggregateNewRecords = require('../aggregations/aggregateNewRecords') const aggregateRecentRecords = require('../aggregations/aggregateRecentRecords') const sortings = require('../constants/sortings') const constants = require('../constants/browsers') -const bestMatch = require('../utils/bestMatch') const get = async (ids, sorting, type, range, limit, dateDetails) => { - const enhance = (entries) => { - - return entries.map((entry) => ({ - id: bestMatch([ - [ `${ entry._id.browserName } ${ entry._id.browserVersion }`, [ entry._id.browserName, entry._id.browserVersion ]], - [ `${ entry._id.browserName }`, [ entry._id.browserName ]] - ]), - count: entry.count, - created: entry.created - })) - - } - const aggregation = (() => { if (type === constants.BROWSERS_TYPE_NO_VERSION) { @@ -38,6 +24,23 @@ const get = async (ids, sorting, type, range, limit, dateDetails) => { })() + const enhanceId = (id) => { + + if (type === constants.BROWSERS_TYPE_NO_VERSION) return `${ id.browserName }` + if (type === constants.BROWSERS_TYPE_WITH_VERSION) return `${ id.browserName } ${ id.browserVersion }` + + } + + const enhance = (entries) => { + + return entries.map((entry) => ({ + id: enhanceId(entry._id), + count: entry.count, + created: entry.created + })) + + } + return enhance( await Record.aggregate(aggregation) ) diff --git a/src/database/devices.js b/src/database/devices.js index 7b467749..a4450b7d 100644 --- a/src/database/devices.js +++ b/src/database/devices.js @@ -6,23 +6,9 @@ const aggregateNewRecords = require('../aggregations/aggregateNewRecords') const aggregateRecentRecords = require('../aggregations/aggregateRecentRecords') const sortings = require('../constants/sortings') const constants = require('../constants/devices') -const bestMatch = require('../utils/bestMatch') const get = async (ids, sorting, type, range, limit, dateDetails) => { - const enhance = (entries) => { - - return entries.map((entry) => ({ - id: bestMatch([ - [ `${ entry._id.deviceManufacturer } ${ entry._id.deviceName }`, [ entry._id.deviceManufacturer, entry._id.deviceName ]], - [ `${ entry._id.deviceManufacturer }`, [ entry._id.deviceManufacturer ]] - ]), - count: entry.count, - created: entry.created - })) - - } - const aggregation = (() => { if (type === constants.DEVICES_TYPE_NO_MODEL) { @@ -38,6 +24,23 @@ const get = async (ids, sorting, type, range, limit, dateDetails) => { })() + const enhanceId = (id) => { + + if (type === constants.DEVICES_TYPE_NO_MODEL) return `${ id.deviceManufacturer }` + if (type === constants.DEVICES_TYPE_WITH_MODEL) return `${ id.deviceManufacturer } ${ id.deviceName }` + + } + + const enhance = (entries) => { + + return entries.map((entry) => ({ + id: enhanceId(entry._id), + count: entry.count, + created: entry.created + })) + + } + return enhance( await Record.aggregate(aggregation) ) diff --git a/src/database/durations.js b/src/database/durations.js index 249ba5f9..cdbaaa00 100644 --- a/src/database/durations.js +++ b/src/database/durations.js @@ -10,6 +10,12 @@ const matchesDate = require('../utils/matchesDate') const get = async (ids, interval, limit, dateDetails) => { + const aggregation = (() => { + + return aggregateDurations(ids, interval, limit, dateDetails) + + })() + const enhance = (entries) => { const matchDay = [ intervals.INTERVALS_DAILY ].includes(interval) @@ -44,12 +50,6 @@ const get = async (ids, interval, limit, dateDetails) => { } - const aggregation = (() => { - - return aggregateDurations(ids, interval, limit, dateDetails) - - })() - return enhance( await Record.aggregate(aggregation) ) diff --git a/src/database/languages.js b/src/database/languages.js index 0a79e6a5..708dd7ca 100644 --- a/src/database/languages.js +++ b/src/database/languages.js @@ -9,6 +9,14 @@ const languageCodes = require('../utils/languageCodes') const get = async (ids, sorting, range, limit, dateDetails) => { + const aggregation = (() => { + + if (sorting === sortings.SORTINGS_TOP) return aggregateTopRecords(ids, [ 'siteLanguage' ], range, limit, dateDetails) + if (sorting === sortings.SORTINGS_NEW) return aggregateNewRecords(ids, [ 'siteLanguage' ], limit) + if (sorting === sortings.SORTINGS_RECENT) return aggregateRecentRecords(ids, [ 'siteLanguage' ], limit) + + })() + const enhance = (entries) => { return entries.map((entry) => ({ @@ -19,14 +27,6 @@ const get = async (ids, sorting, range, limit, dateDetails) => { } - const aggregation = (() => { - - if (sorting === sortings.SORTINGS_TOP) return aggregateTopRecords(ids, [ 'siteLanguage' ], range, limit, dateDetails) - if (sorting === sortings.SORTINGS_NEW) return aggregateNewRecords(ids, [ 'siteLanguage' ], limit) - if (sorting === sortings.SORTINGS_RECENT) return aggregateRecentRecords(ids, [ 'siteLanguage' ], limit) - - })() - return enhance( await Record.aggregate(aggregation) ) diff --git a/src/database/pages.js b/src/database/pages.js index 80abd92d..fd40c21b 100644 --- a/src/database/pages.js +++ b/src/database/pages.js @@ -8,6 +8,14 @@ const sortings = require('../constants/sortings') const get = async (ids, sorting, range, limit, dateDetails) => { + const aggregation = (() => { + + if (sorting === sortings.SORTINGS_TOP) return aggregateTopRecords(ids, [ 'siteLocation' ], range, limit, dateDetails) + if (sorting === sortings.SORTINGS_NEW) return aggregateNewRecords(ids, [ 'siteLocation' ], limit) + if (sorting === sortings.SORTINGS_RECENT) return aggregateRecentRecords(ids, [ 'siteLocation' ], limit) + + })() + const enhance = (entries) => { return entries.map((entry) => ({ @@ -18,14 +26,6 @@ const get = async (ids, sorting, range, limit, dateDetails) => { } - const aggregation = (() => { - - if (sorting === sortings.SORTINGS_TOP) return aggregateTopRecords(ids, [ 'siteLocation' ], range, limit, dateDetails) - if (sorting === sortings.SORTINGS_NEW) return aggregateNewRecords(ids, [ 'siteLocation' ], limit) - if (sorting === sortings.SORTINGS_RECENT) return aggregateRecentRecords(ids, [ 'siteLocation' ], limit) - - })() - return enhance( await Record.aggregate(aggregation) ) diff --git a/src/database/referrers.js b/src/database/referrers.js index d7c2764f..5f3a7354 100644 --- a/src/database/referrers.js +++ b/src/database/referrers.js @@ -9,16 +9,6 @@ const constants = require('../constants/referrers') const get = async (ids, sorting, type, range, limit, dateDetails) => { - const enhance = (entries) => { - - return entries.map((entry) => ({ - id: entry._id.source || entry._id.siteReferrer, - count: entry.count, - created: entry.created - })) - - } - const aggregation = (() => { if (type === constants.REFERRERS_TYPE_WITH_SOURCE) { @@ -39,6 +29,16 @@ const get = async (ids, sorting, type, range, limit, dateDetails) => { })() + const enhance = (entries) => { + + return entries.map((entry) => ({ + id: entry._id.source || entry._id.siteReferrer, + count: entry.count, + created: entry.created + })) + + } + return enhance( await Record.aggregate(aggregation) ) diff --git a/src/database/sizes.js b/src/database/sizes.js index c536a1ef..063b366f 100644 --- a/src/database/sizes.js +++ b/src/database/sizes.js @@ -6,27 +6,9 @@ const aggregateNewRecords = require('../aggregations/aggregateNewRecords') const aggregateRecentRecords = require('../aggregations/aggregateRecentRecords') const sortings = require('../constants/sortings') const constants = require('../constants/sizes') -const bestMatch = require('../utils/bestMatch') const get = async (ids, sorting, type, range, limit, dateDetails) => { - const enhance = (entries) => { - - return entries.map((entry) => ({ - id: bestMatch([ - [ `${ entry._id.screenWidth }px x ${ entry._id.screenHeight }px`, [ entry._id.screenWidth, entry._id.screenHeight ]], - [ `${ entry._id.browserWidth }px x ${ entry._id.browserHeight }px`, [ entry._id.browserWidth, entry._id.browserHeight ]], - [ `${ entry._id.screenWidth }px`, [ entry._id.screenWidth ]], - [ `${ entry._id.screenHeight }px`, [ entry._id.screenHeight ]], - [ `${ entry._id.browserWidth }px`, [ entry._id.browserWidth ]], - [ `${ entry._id.browserHeight }px`, [ entry._id.browserHeight ]] - ], '0px'), - count: entry.count, - created: entry.created - })) - - } - const aggregation = (() => { if (sorting === sortings.SORTINGS_TOP) { @@ -56,6 +38,27 @@ const get = async (ids, sorting, type, range, limit, dateDetails) => { })() + const enhanceId = (id) => { + + if (type === constants.SIZES_TYPE_BROWSER_WIDTH) return `${ id.browserWidth }px` + if (type === constants.SIZES_TYPE_BROWSER_HEIGHT) return `${ id.browserHeight }px` + if (type === constants.SIZES_TYPE_BROWSER_RESOLUTION) return `${ id.browserWidth }px x ${ id.browserHeight }px` + if (type === constants.SIZES_TYPE_SCREEN_WIDTH) return `${ id.screenWidth }px` + if (type === constants.SIZES_TYPE_SCREEN_HEIGHT) return `${ id.screenHeight }px` + if (type === constants.SIZES_TYPE_SCREEN_RESOLUTION) return `${ id.screenWidth }px x ${ id.screenHeight }px` + + } + + const enhance = (entries) => { + + return entries.map((entry) => ({ + id: enhanceId(entry._id), + count: entry.count, + created: entry.created + })) + + } + return enhance( await Record.aggregate(aggregation) ) diff --git a/src/database/systems.js b/src/database/systems.js index e6e8ee4e..9c0e7b33 100644 --- a/src/database/systems.js +++ b/src/database/systems.js @@ -6,23 +6,9 @@ const aggregateNewRecords = require('../aggregations/aggregateNewRecords') const aggregateRecentRecords = require('../aggregations/aggregateRecentRecords') const sortings = require('../constants/sortings') const constants = require('../constants/systems') -const bestMatch = require('../utils/bestMatch') const get = async (ids, sorting, type, range, limit, dateDetails) => { - const enhance = (entries) => { - - return entries.map((entry) => ({ - id: bestMatch([ - [ `${ entry._id.osName } ${ entry._id.osVersion }`, [ entry._id.osName, entry._id.osVersion ]], - [ `${ entry._id.osName }`, [ entry._id.osName ]] - ]), - count: entry.count, - created: entry.created - })) - - } - const aggregation = (() => { if (type === constants.SYSTEMS_TYPE_NO_VERSION) { @@ -38,6 +24,23 @@ const get = async (ids, sorting, type, range, limit, dateDetails) => { })() + const enhanceId = (id) => { + + if (type === constants.SYSTEMS_TYPE_NO_VERSION) return `${ id.osName }` + if (type === constants.SYSTEMS_TYPE_WITH_VERSION) return `${ id.osName } ${ id.osVersion }` + + } + + const enhance = (entries) => { + + return entries.map((entry) => ({ + id: enhanceId(entry._id), + count: entry.count, + created: entry.created + })) + + } + return enhance( await Record.aggregate(aggregation) ) diff --git a/src/database/views.js b/src/database/views.js index 724d2741..2f47bb83 100644 --- a/src/database/views.js +++ b/src/database/views.js @@ -11,6 +11,13 @@ const matchesDate = require('../utils/matchesDate') const get = async (ids, type, interval, limit, dateDetails) => { + const aggregation = (() => { + + if (type === constants.VIEWS_TYPE_UNIQUE) return aggregateViews(ids, true, interval, limit, dateDetails) + if (type === constants.VIEWS_TYPE_TOTAL) return aggregateViews(ids, false, interval, limit, dateDetails) + + })() + const enhance = (entries) => { const matchDay = [ intervals.INTERVALS_DAILY ].includes(interval) @@ -45,13 +52,6 @@ const get = async (ids, type, interval, limit, dateDetails) => { } - const aggregation = (() => { - - if (type === constants.VIEWS_TYPE_UNIQUE) return aggregateViews(ids, true, interval, limit, dateDetails) - if (type === constants.VIEWS_TYPE_TOTAL) return aggregateViews(ids, false, interval, limit, dateDetails) - - })() - return enhance( await Record.aggregate(aggregation) ) diff --git a/src/utils/bestMatch.js b/src/utils/bestMatch.js deleted file mode 100644 index f85ed2f0..00000000 --- a/src/utils/bestMatch.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' - -module.exports = (matches, fallback) => { - - // Find the first item that only consists if defined values - const result = matches.reduce((prev, [ key, values ]) => { - return values.every(Boolean) === true && prev == null ? key : prev - }, undefined) - - if (result != null) { - return result - } - - if (fallback != null) { - return fallback - } - -} \ No newline at end of file diff --git a/test/resolvers/_utils.js b/test/resolvers/_utils.js index 28115677..023cd09f 100644 --- a/test/resolvers/_utils.js +++ b/test/resolvers/_utils.js @@ -37,8 +37,8 @@ const fillDatabase = async (t) => { siteReferrer: 'https://google.com/', siteLanguage: 'en', source: i > 4 ? 'Newsletter' : undefined, - screenWidth: 414, - screenHeight: 896, + screenWidth: i === 1 ? 0 : 414, + screenHeight: i === 1 ? 0 : 896, screenColorDepth: 32, deviceName: 'iPhone', deviceManufacturer: 'Apple', @@ -46,8 +46,8 @@ const fillDatabase = async (t) => { osVersion: i > 7 ? '13.0' : '14.0', browserName: 'Safari', browserVersion: i > 7 ? '13.0' : '14.0', - browserWidth: 414, - browserHeight: 719, + browserWidth: i === 1 ? 0 : 414, + browserHeight: i === 1 ? 0 : 719, // Set fake duration created: now - i * day - minute, updated: now - i * day diff --git a/test/resolvers/domainStatistics/sizes.js b/test/resolvers/domainStatistics/sizes.js index 57f31755..917b4dc3 100644 --- a/test/resolvers/domainStatistics/sizes.js +++ b/test/resolvers/domainStatistics/sizes.js @@ -40,7 +40,7 @@ test(macro, { type: 'BROWSER_WIDTH', range: 'LAST_6_MONTHS' }, (t, sizes) => { - t.is(sizes.length, 1) + t.is(sizes.length, 2) t.is(sizes[0].id, '414px') }) @@ -49,7 +49,7 @@ test(macro, { type: 'BROWSER_HEIGHT', range: 'LAST_6_MONTHS' }, (t, sizes) => { - t.is(sizes.length, 1) + t.is(sizes.length, 2) t.is(sizes[0].id, '719px') }) @@ -58,7 +58,7 @@ test(macro, { type: 'BROWSER_RESOLUTION', range: 'LAST_6_MONTHS' }, (t, sizes) => { - t.is(sizes.length, 1) + t.is(sizes.length, 2) t.is(sizes[0].id, '414px x 719px') }) @@ -104,7 +104,7 @@ test(macro, { type: 'BROWSER_WIDTH', range: 'LAST_6_MONTHS' }, (t, sizes) => { - t.is(sizes.length, 1) + t.is(sizes.length, 2) t.is(sizes[0].id, '414px') }) @@ -113,7 +113,7 @@ test(macro, { type: 'BROWSER_HEIGHT', range: 'LAST_6_MONTHS' }, (t, sizes) => { - t.is(sizes.length, 1) + t.is(sizes.length, 2) t.is(sizes[0].id, '719px') }) @@ -122,7 +122,7 @@ test(macro, { type: 'BROWSER_RESOLUTION', range: 'LAST_6_MONTHS' }, (t, sizes) => { - t.is(sizes.length, 1) + t.is(sizes.length, 2) t.is(sizes[0].id, '414px x 719px') }) @@ -131,7 +131,7 @@ test(macro, { type: 'SCREEN_WIDTH', range: 'LAST_6_MONTHS' }, (t, sizes) => { - t.is(sizes.length, 1) + t.is(sizes.length, 2) t.is(sizes[0].id, '414px') }) @@ -140,7 +140,7 @@ test(macro, { type: 'SCREEN_HEIGHT', range: 'LAST_6_MONTHS' }, (t, sizes) => { - t.is(sizes.length, 1) + t.is(sizes.length, 2) t.is(sizes[0].id, '896px') }) @@ -149,7 +149,7 @@ test(macro, { type: 'SCREEN_RESOLUTION', range: 'LAST_6_MONTHS' }, (t, sizes) => { - t.is(sizes.length, 1) + t.is(sizes.length, 2) t.is(sizes[0].id, '414px x 896px') }) @@ -195,7 +195,7 @@ test(macro, { type: 'SCREEN_WIDTH', range: 'LAST_6_MONTHS' }, (t, sizes) => { - t.is(sizes.length, 1) + t.is(sizes.length, 2) t.is(sizes[0].id, '414px') }) @@ -204,7 +204,7 @@ test(macro, { type: 'SCREEN_HEIGHT', range: 'LAST_6_MONTHS' }, (t, sizes) => { - t.is(sizes.length, 1) + t.is(sizes.length, 2) t.is(sizes[0].id, '896px') }) @@ -213,6 +213,6 @@ test(macro, { type: 'SCREEN_RESOLUTION', range: 'LAST_6_MONTHS' }, (t, sizes) => { - t.is(sizes.length, 1) + t.is(sizes.length, 2) t.is(sizes[0].id, '414px x 896px') }) \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index e8ef6913..e7b56c90 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1834,10 +1834,10 @@ accept@^3.0.2: boom "7.x.x" hoek "6.x.x" -ackee-tracker@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/ackee-tracker/-/ackee-tracker-5.0.0.tgz#d2e2b02e917a0a6f662ce6faf4abd55f85eb9b4c" - integrity sha512-4/HVo305tSI/2LgfnQQ+jXa6vY830AD1hzlHDBzSyfaLBGxJAhkeQ9pCXs3jCIZXdUVKuA1j6w/jZ3Do5J7sBg== +ackee-tracker@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ackee-tracker/-/ackee-tracker-5.0.1.tgz#f32624cf82cb3f26a59e551fecb47e9b18f663ab" + integrity sha512-VN5eZK9XjdZ6QGGCfH019LGzLfwb73aXKDg1eDWKudGlijSandJXjzlgqnG9dvkkOKhK6EQLLBanV3tLqKA34w== dependencies: platform "^1.3.6" @@ -5504,10 +5504,10 @@ mongoose-legacy-pluralize@1.0.2: resolved "https://registry.yarnpkg.com/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz#3ba9f91fa507b5186d399fb40854bff18fb563e4" integrity sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ== -mongoose@^5.11.12: - version "5.11.12" - resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-5.11.12.tgz#452d28ef04b9c6a9601e62a54064851c3b57d4ee" - integrity sha512-70wST9hnVlPbt5nKClPKJo54ULIACOVGYdg8fyj17sWtCJLyURCDahhzUh+oUA7WVykOW2ZMqWm2kujBIWYagg== +mongoose@^5.11.13: + version "5.11.13" + resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-5.11.13.tgz#1a8af3c83152d5e0427509966926ea7f5ead4d66" + integrity sha512-rXbaxSJfLnKKO2RTm8MKt65glrtfKDc4ATEb6vEbbzsVGCiLut753K5axdpyvE7KeTH7GOh4LzmuQLOvaaWOmA== dependencies: "@types/mongodb" "^3.5.27" bson "^1.1.4"