Socket
Socket
Sign inDemoInstall

beaver-logger

Package Overview
Dependencies
4
Maintainers
3
Versions
76
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.29 to 4.0.30

9

dist/beaver-logger.js

@@ -77,2 +77,5 @@ !function(root, factory) {

}));
__webpack_require__.d(__webpack_exports__, "extendIfDefined", (function() {
return extendIfDefined;
}));
__webpack_require__.d(__webpack_exports__, "isAmplitude", (function() {

@@ -892,2 +895,5 @@ return util_isAmplitude;

};
var extendIfDefined = function(target, source) {
for (var key in source) source.hasOwnProperty(key) && source[key] && (target[key] = source[key]);
};
function httpTransport(_ref) {

@@ -975,5 +981,2 @@ var url = _ref.url, method = _ref.method, headers = _ref.headers, json = _ref.json, _ref$enableSendBeacon = _ref.enableSendBeacon, enableSendBeacon = void 0 !== _ref$enableSendBeacon && _ref$enableSendBeacon;

}
function extendIfDefined(target, source) {
for (var key in source) source.hasOwnProperty(key) && source[key] && !target[key] && (target[key] = source[key]);
}
function Logger(_ref2) {

@@ -980,0 +983,0 @@ var url = _ref2.url, prefix = _ref2.prefix, _ref2$logLevel = _ref2.logLevel, logLevel = void 0 === _ref2$logLevel ? DEFAULT_LOG_LEVEL : _ref2$logLevel, _ref2$transport = _ref2.transport, transport = void 0 === _ref2$transport ? httpTransport : _ref2$transport, amplitudeApiKey = _ref2.amplitudeApiKey, _ref2$flushInterval = _ref2.flushInterval, flushInterval = void 0 === _ref2$flushInterval ? 6e4 : _ref2$flushInterval, _ref2$enableSendBeaco = _ref2.enableSendBeacon, enableSendBeacon = void 0 !== _ref2$enableSendBeaco && _ref2$enableSendBeaco;

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("beaver",[],t):"object"==typeof exports?exports.beaver=t():e.beaver=t()}("undefined"!=typeof self?self:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return{}.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&"function"==typeof window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&"function"==typeof window.constructor&&e instanceof window.constructor)return!1;var t={}.toString;if(t){var n=t.call(e);if("[object Window]"===n||"[object global]"===n||"[object DOMWindow]"===n)return!1}if("function"==typeof e.then)return!0}catch(e){return!1}return!1}n.r(t),n.d(t,"Logger",(function(){return Q})),n.d(t,"LOG_LEVEL",(function(){return z})),n.d(t,"PROTOCOL",(function(){return F})),n.d(t,"canUseSendBeacon",(function(){return K})),n.d(t,"isAmplitude",(function(){return V})),n.d(t,"sendBeacon",(function(){return X}));var i,a=[],u=[],c=0;function s(){if(!c&&i){var e=i;i=null,e.resolve()}}function f(){c+=1}function d(){c-=1,s()}var l=function(){function e(e){var t=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],e){var n,r,o=!1,i=!1,a=!1;f();try{e((function(e){a?t.resolve(e):(o=!0,n=e)}),(function(e){a?t.reject(e):(i=!0,r=e)}))}catch(e){return d(),void this.reject(e)}d(),a=!0,o?this.resolve(n):i&&this.reject(r)}}var t=e.prototype;return t.resolve=function(e){if(this.resolved||this.rejected)return this;if(o(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},t.reject=function(e){var t=this;if(this.resolved||this.rejected)return this;if(o(e))throw new Error("Can not reject promise with another promise");if(!e){var n=e&&"function"==typeof e.toString?e.toString():{}.toString.call(e);e=new Error("Expected reject to be called with Error, got "+n)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout((function(){t.errorHandled||function(e,t){if(-1===a.indexOf(e)){a.push(e),setTimeout((function(){throw e}),1);for(var n=0;n<u.length;n++)u[n](e,t)}}(e,t)}),1),this.dispatch(),this},t.asyncReject=function(e){return this.errorHandled=!0,this.reject(e),this},t.dispatch=function(){var t=this.resolved,n=this.rejected,r=this.handlers;if(!this.dispatching&&(t||n)){this.dispatching=!0,f();for(var i=function(e,t){return e.then((function(e){t.resolve(e)}),(function(e){t.reject(e)}))},a=0;a<r.length;a++){var u=r[a],c=u.onSuccess,s=u.onError,l=u.promise,h=void 0;if(t)try{h=c?c(this.value):this.value}catch(e){l.reject(e);continue}else if(n){if(!s){l.reject(this.error);continue}try{h=s(this.error)}catch(e){l.reject(e);continue}}if(h instanceof e&&(h.resolved||h.rejected)){var v=h;v.resolved?l.resolve(v.value):l.reject(v.error),v.errorHandled=!0}else o(h)?h instanceof e&&(h.resolved||h.rejected)?h.resolved?l.resolve(h.value):l.reject(h.error):i(h,l):l.resolve(h)}r.length=0,this.dispatching=!1,d()}},t.then=function(t,n){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for success handler");if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.then expected a function for error handler");var r=new e;return this.handlers.push({promise:r,onSuccess:t,onError:n}),this.errorHandled=!0,this.dispatch(),r},t.catch=function(e){return this.then(void 0,e)},t.finally=function(t){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.finally expected a function");return this.then((function(n){return e.try(t).then((function(){return n}))}),(function(n){return e.try(t).then((function(){throw n}))}))},t.timeout=function(e,t){var n=this;if(this.resolved||this.rejected)return this;var r=setTimeout((function(){n.resolved||n.rejected||n.reject(t||new Error("Promise timed out after "+e+"ms"))}),e);return this.then((function(e){return clearTimeout(r),e}))},t.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.resolve=function(t){return t instanceof e?t:o(t)?new e((function(e,n){return t.then(e,n)})):(new e).resolve(t)},e.reject=function(t){return(new e).reject(t)},e.asyncReject=function(t){return(new e).asyncReject(t)},e.all=function(t){var n=new e,r=t.length,i=[].slice();if(!r)return n.resolve(i),n;for(var a=function(e,t,o){return t.then((function(t){i[e]=t,0==(r-=1)&&n.resolve(i)}),(function(e){o.reject(e)}))},u=0;u<t.length;u++){var c=t[u];if(c instanceof e){if(c.resolved){i[u]=c.value,r-=1;continue}}else if(!o(c)){i[u]=c,r-=1;continue}a(u,e.resolve(c),n)}return 0===r&&n.resolve(i),n},e.hash=function(t){var n={},r=[],i=function(e){if(t.hasOwnProperty(e)){var i=t[e];o(i)?r.push(i.then((function(t){n[e]=t}))):n[e]=i}};for(var a in t)i(a);return e.all(r).then((function(){return n}))},e.map=function(t,n){return e.all(t.map(n))},e.onPossiblyUnhandledException=function(e){return function(e){return u.push(e),{cancel:function(){u.splice(u.indexOf(e),1)}}}(e)},e.try=function(t,n,r){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.try expected a function");var o;f();try{o=t.apply(n,r||[])}catch(t){return d(),e.reject(t)}return d(),e.resolve(o)},e.delay=function(t){return new e((function(e){setTimeout(e,t)}))},e.isPromise=function(t){return!!(t&&t instanceof e)||o(t)},e.flush=function(){return t=i=i||new e,s(),t;var t},e}(),h="Call was rejected by callee.\r\n";function v(e){return void 0===e&&(e=window),"about:"===e.location.protocol}function p(e){try{return!0}catch(e){}return!1}function w(e){void 0===e&&(e=window);var t=e.location;if(!t)throw new Error("Can not read window location");var n=t.protocol;if(!n)throw new Error("Can not read window protocol");if("file:"===n)return"file://";if("about:"===n){var r=function(e){if(void 0===e&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch(e){}}(e);return r&&p()?w(r):"about://"}var o=t.host;if(!o)throw new Error("Can not read window host");return n+"//"+o}function y(e){void 0===e&&(e=window);var t=w(e);return t&&e.mockDomain&&0===e.mockDomain.indexOf("mock:")?e.mockDomain:t}var m=[],g=[];function b(e,t){void 0===t&&(t=!0);try{if(e===window)return!1}catch(e){return!0}try{if(!e)return!0}catch(e){return!0}try{if(e.closed)return!0}catch(e){return!e||e.message!==h}if(t&&function(e){if(!function(e){try{if(e===window)return!0}catch(e){}try{var t=Object.getOwnPropertyDescriptor(e,"location");if(t&&!1===t.enumerable)return!1}catch(e){}try{if(v(e)&&p())return!0}catch(e){}try{if(w(e)===w(window))return!0}catch(e){}return!1}(e))return!1;try{if(e===window)return!0;if(v(e)&&p())return!0;if(y(window)===y(e))return!0}catch(e){}return!1}(e))try{if(e.mockclosed)return!0}catch(e){}try{if(!e.parent||!e.top)return!0}catch(e){}var n=function(e,t){for(var n=0;n<e.length;n++)try{if(e[n]===t)return n}catch(e){}return-1}(m,e);if(-1!==n){var r=g[n];if(r&&function(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var t=e.ownerDocument;if(t&&t.documentElement&&!t.documentElement.contains(e)){for(var n=e;n.parentNode&&n.parentNode!==n;)n=n.parentNode;if(!n.host||!t.documentElement.contains(n.host))return!0}return!1}(r))return!0}return!1}function j(e){try{if(e===window)return!0}catch(e){if(e&&e.message===h)return!0}try{if("[object Window]"==={}.toString.call(e))return!0}catch(e){if(e&&e.message===h)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(e){if(e&&e.message===h)return!0}try{if(e&&e.self===e)return!0}catch(e){if(e&&e.message===h)return!0}try{if(e&&e.parent===e)return!0}catch(e){if(e&&e.message===h)return!0}try{if(e&&e.top===e)return!0}catch(e){if(e&&e.message===h)return!0}try{if(e&&"__unlikely_value__"===e.__cross_domain_utils_window_check__)return!1}catch(e){return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch(e){}return!1}function O(e,t){for(var n=0;n<e.length;n++)try{if(e[n]===t)return n}catch(e){}return-1}var _,E=function(){function e(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var e=new WeakMap,t={};return Object.freeze(t),e.set(t,"__testvalue__"),"__testvalue__"===e.get(t)}catch(e){return!1}}())try{this.weakmap=new WeakMap}catch(e){}this.keys=[],this.values=[]}var t=e.prototype;return t._cleanupClosedWindows=function(){for(var e=this.weakmap,t=this.keys,n=0;n<t.length;n++){var r=t[n];if(j(r)&&b(r)){if(e)try{e.delete(r)}catch(e){}t.splice(n,1),this.values.splice(n,1),n-=1}}},t.isSafeToReadWrite=function(e){return!j(e)},t.set=function(e,t){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{n.set(e,t)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=this.name,o=e[r];return void(o&&o[0]===e?o[1]=t:Object.defineProperty(e,r,{value:[e,t],writable:!0}))}catch(e){}this._cleanupClosedWindows();var i=this.keys,a=this.values,u=O(i,e);-1===u?(i.push(e),a.push(t)):a[u]=t},t.get=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return t.get(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=e[this.name];return n&&n[0]===e?n[1]:void 0}catch(e){}this._cleanupClosedWindows();var r=O(this.keys,e);if(-1!==r)return this.values[r]},t.delete=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.delete(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=e[this.name];n&&n[0]===e&&(n[0]=n[1]=void 0)}catch(e){}this._cleanupClosedWindows();var r=this.keys,o=O(r,e);-1!==o&&(r.splice(o,1),this.values.splice(o,1))},t.has=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return!0}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=e[this.name];return!(!n||n[0]!==e)}catch(e){}return this._cleanupClosedWindows(),-1!==O(this.keys,e)},t.getOrSet=function(e,t){if(this.has(e))return this.get(e);var n=t();return this.set(e,n),n},e}();function k(e){return e.name||e.__name__||e.displayName||"anonymous"}function x(e,t){try{delete e.name,e.name=t}catch(e){}return e.__name__=e.displayName=t,e}function S(){var e="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,(function(){return e.charAt(Math.floor(Math.random()*e.length))}))+"_"+function(e){if("function"==typeof btoa)return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))}))).replace(/[=]/g,"");if("undefined"!=typeof Buffer)return Buffer.from(e,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function R(e){try{return JSON.stringify([].slice.call(e),(function(e,t){return"function"==typeof t?"memoize["+function(e){if(_=_||new E,null==e||"object"!=typeof e&&"function"!=typeof e)throw new Error("Invalid object");var t=_.get(e);return t||(t=typeof e+":"+S(),_.set(e,t)),t}(t)+"]":t}))}catch(e){throw new Error("Arguments not serializable -- can not be used to memoize")}}function B(){return{}}var C=0,P=0;function W(e,t){void 0===t&&(t={});var n,r,o=t.thisNamespace,i=void 0!==o&&o,a=t.time,u=C;C+=1;var c=function(){for(var t=arguments.length,o=new Array(t),c=0;c<t;c++)o[c]=arguments[c];var s;u<P&&(n=null,r=null,u=C,C+=1),s=i?(r=r||new E).getOrSet(this,B):n=n||{};var f=R(o),d=s[f];if(d&&a&&Date.now()-d.time<a&&(delete s[f],d=null),d)return d.value;var l=Date.now(),h=e.apply(this,arguments);return s[f]={time:l,value:h},h};return c.reset=function(){n=null,r=null},x(c,(t.name||k(e))+"::memoized")}function T(){}function L(e,t){void 0===t&&(t=Boolean);var n={};for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)&&(n[r]=e[r]);return n}function N(){return Boolean(document.body)&&"complete"===document.readyState}function A(){return Boolean(document.body)&&"interactive"===document.readyState}function M(){return"undefined"!=typeof window&&void 0!==window.location}W.clear=function(){P=C},W((function(e){if(Object.values)return Object.values(e);var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t})),Error,W((function(){return new l((function(e){if(N()||A())return e();var t=setInterval((function(){if(N()||A())return clearInterval(t),e()}),10)}))}));var I="undefined"!=typeof document?document.currentScript:null,D=W((function(){if(I)return I;if(I=function(){try{var e=function(){try{throw new Error("_")}catch(e){return e.stack||""}}(),t=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(e),n=t&&t[1];if(!n)return;for(var r=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();r<o.length;r++){var i=o[r];if(i.src&&i.src===n)return i}}catch(e){}}())return I;throw new Error("Can not determine current script")})),H=S();W((function(){var e;try{e=D()}catch(e){return H}var t=e.getAttribute("data-uid");if(t&&"string"==typeof t)return t;if((t=e.getAttribute("data-uid-auto"))&&"string"==typeof t)return t;if(e.src){var n=function(e){for(var t="",n=0;n<e.length;n++){var r=e[n].charCodeAt(0)*n;e[n+1]&&(r+=e[n+1].charCodeAt(0)*(n-1)),t+=String.fromCharCode(97+Math.abs(r)%26)}return t}(JSON.stringify({src:e.src,dataset:e.dataset}));t="uid_"+n.slice(n.length-30)}else t=S();return e.setAttribute("data-uid-auto",t),t}));var U=[],z={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error"},F={FILE:"file:"},q=[z.WARN,z.ERROR],G=[z.ERROR,z.WARN,z.INFO,z.DEBUG],J=z.WARN,K=function(e){var t=e.headers,n=e.enableSendBeacon,r=t&&Object.keys(t).length;return!!(window&&window.navigator.sendBeacon&&!r&&n&&window.Blob)},V=function(e){return"https://api2.amplitude.com/2/httpapi"===e},X=function(e){var t=e.url,n=e.data,r=e.useBlob,o=void 0===r||r;try{var i=JSON.stringify(n);if(o){var a=new Blob([i],{type:"application/json"});return window.navigator.sendBeacon(t,a)}return window.navigator.sendBeacon(t,i)}catch(e){return!1}};function Z(e){var t=e.url,n=e.method,r=e.headers,o=e.json,i=e.enableSendBeacon,a=void 0!==i&&i;return l.try((function(){var e=!1;return K({headers:r,enableSendBeacon:a})&&(e=V(t)?X({url:t,data:o,useBlob:!1}):X({url:t,data:o,useBlob:!0})),e||function(e){var t=e.url,n=e.method,r=void 0===n?"get":n,o=e.headers,i=void 0===o?{}:o,a=e.json,u=e.data,c=e.body,s=e.win,f=void 0===s?window:s,d=e.timeout,h=void 0===d?0:d;return new l((function(e,n){if(a&&u||a&&c||u&&a)throw new Error("Only options.json or options.data or options.body should be passed");for(var o={},s=0,d=Object.keys(i);s<d.length;s++){var l=d[s];o[l.toLowerCase()]=i[l]}a?o["content-type"]=o["content-type"]||"application/json":(u||c)&&(o["content-type"]=o["content-type"]||"application/x-www-form-urlencoded; charset=utf-8"),o.accept=o.accept||"application/json";for(var v=0;v<U.length;v++)for(var p=(0,U[v])(),w=0,y=Object.keys(p);w<y.length;w++){var m=y[w];o[m.toLowerCase()]=p[m]}var g=new f.XMLHttpRequest;for(var b in g.addEventListener("load",(function(){var o=function(e){void 0===e&&(e="");for(var t={},n=0,r=e.trim().split("\n");n<r.length;n++){var o=r[n].split(":"),i=o[0],a=o.slice(1);t[i.toLowerCase()]=a.join(":").trim()}return t}(this.getAllResponseHeaders());if(!this.status)return n(new Error("Request to "+r.toLowerCase()+" "+t+" failed: no response status code."));var i=o["content-type"],a=i&&(0===i.indexOf("application/json")||0===i.indexOf("text/json")),u=this.responseText;try{u=JSON.parse(u)}catch(e){if(a)return n(new Error("Invalid json: "+this.responseText+"."))}return e({status:this.status,headers:o,body:u})}),!1),g.addEventListener("error",(function(e){n(new Error("Request to "+r.toLowerCase()+" "+t+" failed: "+e.toString()+"."))}),!1),g.open(r,t,!0),o)o.hasOwnProperty(b)&&g.setRequestHeader(b,o[b]);a?c=JSON.stringify(a):u&&(c=Object.keys(u).map((function(e){return encodeURIComponent(e)+"="+(u?encodeURIComponent(u[e]):"")})).join("&")),g.timeout=h,g.ontimeout=function(){n(new Error("Request to "+r.toLowerCase()+" "+t+" has timed out"))},g.send(c)}))}({url:t,method:n,headers:r,json:o})})).then(T)}function $(e,t){for(var n in t)t.hasOwnProperty(n)&&t[n]&&!e[n]&&(e[n]=t[n])}function Q(e){var t=e.url,n=e.prefix,o=e.logLevel,i=void 0===o?J:o,a=e.transport,u=void 0===a?Z:a,c=e.amplitudeApiKey,s=e.flushInterval,f=void 0===s?6e4:s,d=e.enableSendBeacon,h=void 0!==d&&d,v=[],p=[],w=[],y=[],m=[],g=[];function b(e,t,n){if(M()&&window.console&&window.console.log&&!(G.indexOf(e)>G.indexOf(i))){var r=[t];r.push(n),(n.error||n.warning)&&r.push("\n\n",n.error||n.warning);try{window.console[e]&&window.console[e].apply?window.console[e].apply(window.console,r):window.console.log&&window.console.log.apply&&window.console.log.apply(window.console,r)}catch(e){}}}function j(){return l.try((function(){if(M()&&window.location.protocol!==F.FILE&&(v.length||p.length)){for(var e={},n=0;n<y.length;n++)$(e,(0,y[n])(e));for(var o,i={},a=0;a<g.length;a++)$(i,(0,g[a])(i));return t&&(o=u({method:"POST",url:t,headers:i,json:{events:v,meta:e,tracking:p},enableSendBeacon:h}).catch(T)),c&&u({method:"POST",url:"https://api2.amplitude.com/2/httpapi",headers:{},json:{api_key:c,events:p.map((function(e){return r({event_type:e.transition_name||"event",event_properties:e},e)}))},enableSendBeacon:h}).catch(T),v=[],p=[],l.resolve(o).then(T)}}))}var O,_,E,S,R=(void 0===_&&(_=50),x((function(){S&&clearTimeout(S);var e=E=E||new l;return S=setTimeout((function(){E=null,S=null,l.try(O).then((function(t){e.resolve(t)}),(function(t){e.reject(t)}))}),_),e}),k(O=j)+"::promiseDebounced"));function B(e,t,o){if(void 0===o&&(o={}),!M())return P;n&&(t=n+"_"+t);for(var i=r({},L(o),{timestamp:Date.now().toString()}),a=0;a<w.length;a++)$(i,(0,w[a])(i));return function(e,t,n){v.push({level:e,event:t,payload:n}),-1!==q.indexOf(e)&&R()}(e,t,i),b(e,t,i),P}function C(e,t){return e.push(t),P}M()&&function(e,t){!function n(){setTimeout((function(){e(),n()}),t)}()}(R,f),"object"==typeof window&&(window.addEventListener("beforeunload",(function(){j()})),window.addEventListener("unload",(function(){j()})),window.addEventListener("pagehide",(function(){j()})));var P={debug:function(e,t){return B(z.DEBUG,e,t)},info:function(e,t){return B(z.INFO,e,t)},warn:function(e,t){return B(z.WARN,e,t)},error:function(e,t){return B(z.ERROR,e,t)},track:function(e){if(void 0===e&&(e={}),!M())return P;for(var t=L(e),n=0;n<m.length;n++)$(t,(0,m[n])(t));return b(z.DEBUG,"track",t),p.push(t),P},flush:R,immediateFlush:j,addPayloadBuilder:function(e){return C(w,e)},addMetaBuilder:function(e){return C(y,e)},addTrackingBuilder:function(e){return C(m,e)},addHeaderBuilder:function(e){return C(g,e)},setTransport:function(e){return u=e,P},configure:function(e){return e.url&&(t=e.url),e.prefix&&(n=e.prefix),e.logLevel&&(i=e.logLevel),e.transport&&(u=e.transport),e.amplitudeApiKey&&(c=e.amplitudeApiKey),e.flushInterval&&(f=e.flushInterval),e.enableSendBeacon&&(h=e.enableSendBeacon),P}};return P}}])}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("beaver",[],t):"object"==typeof exports?exports.beaver=t():e.beaver=t()}("undefined"!=typeof self?self:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return{}.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&"function"==typeof window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&"function"==typeof window.constructor&&e instanceof window.constructor)return!1;var t={}.toString;if(t){var n=t.call(e);if("[object Window]"===n||"[object global]"===n||"[object DOMWindow]"===n)return!1}if("function"==typeof e.then)return!0}catch(e){return!1}return!1}n.r(t),n.d(t,"Logger",(function(){return Q})),n.d(t,"LOG_LEVEL",(function(){return z})),n.d(t,"PROTOCOL",(function(){return F})),n.d(t,"canUseSendBeacon",(function(){return K})),n.d(t,"extendIfDefined",(function(){return Z})),n.d(t,"isAmplitude",(function(){return V})),n.d(t,"sendBeacon",(function(){return X}));var i,a=[],u=[],c=0;function s(){if(!c&&i){var e=i;i=null,e.resolve()}}function f(){c+=1}function d(){c-=1,s()}var l=function(){function e(e){var t=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],e){var n,r,o=!1,i=!1,a=!1;f();try{e((function(e){a?t.resolve(e):(o=!0,n=e)}),(function(e){a?t.reject(e):(i=!0,r=e)}))}catch(e){return d(),void this.reject(e)}d(),a=!0,o?this.resolve(n):i&&this.reject(r)}}var t=e.prototype;return t.resolve=function(e){if(this.resolved||this.rejected)return this;if(o(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},t.reject=function(e){var t=this;if(this.resolved||this.rejected)return this;if(o(e))throw new Error("Can not reject promise with another promise");if(!e){var n=e&&"function"==typeof e.toString?e.toString():{}.toString.call(e);e=new Error("Expected reject to be called with Error, got "+n)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout((function(){t.errorHandled||function(e,t){if(-1===a.indexOf(e)){a.push(e),setTimeout((function(){throw e}),1);for(var n=0;n<u.length;n++)u[n](e,t)}}(e,t)}),1),this.dispatch(),this},t.asyncReject=function(e){return this.errorHandled=!0,this.reject(e),this},t.dispatch=function(){var t=this.resolved,n=this.rejected,r=this.handlers;if(!this.dispatching&&(t||n)){this.dispatching=!0,f();for(var i=function(e,t){return e.then((function(e){t.resolve(e)}),(function(e){t.reject(e)}))},a=0;a<r.length;a++){var u=r[a],c=u.onSuccess,s=u.onError,l=u.promise,h=void 0;if(t)try{h=c?c(this.value):this.value}catch(e){l.reject(e);continue}else if(n){if(!s){l.reject(this.error);continue}try{h=s(this.error)}catch(e){l.reject(e);continue}}if(h instanceof e&&(h.resolved||h.rejected)){var v=h;v.resolved?l.resolve(v.value):l.reject(v.error),v.errorHandled=!0}else o(h)?h instanceof e&&(h.resolved||h.rejected)?h.resolved?l.resolve(h.value):l.reject(h.error):i(h,l):l.resolve(h)}r.length=0,this.dispatching=!1,d()}},t.then=function(t,n){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for success handler");if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.then expected a function for error handler");var r=new e;return this.handlers.push({promise:r,onSuccess:t,onError:n}),this.errorHandled=!0,this.dispatch(),r},t.catch=function(e){return this.then(void 0,e)},t.finally=function(t){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.finally expected a function");return this.then((function(n){return e.try(t).then((function(){return n}))}),(function(n){return e.try(t).then((function(){throw n}))}))},t.timeout=function(e,t){var n=this;if(this.resolved||this.rejected)return this;var r=setTimeout((function(){n.resolved||n.rejected||n.reject(t||new Error("Promise timed out after "+e+"ms"))}),e);return this.then((function(e){return clearTimeout(r),e}))},t.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.resolve=function(t){return t instanceof e?t:o(t)?new e((function(e,n){return t.then(e,n)})):(new e).resolve(t)},e.reject=function(t){return(new e).reject(t)},e.asyncReject=function(t){return(new e).asyncReject(t)},e.all=function(t){var n=new e,r=t.length,i=[].slice();if(!r)return n.resolve(i),n;for(var a=function(e,t,o){return t.then((function(t){i[e]=t,0==(r-=1)&&n.resolve(i)}),(function(e){o.reject(e)}))},u=0;u<t.length;u++){var c=t[u];if(c instanceof e){if(c.resolved){i[u]=c.value,r-=1;continue}}else if(!o(c)){i[u]=c,r-=1;continue}a(u,e.resolve(c),n)}return 0===r&&n.resolve(i),n},e.hash=function(t){var n={},r=[],i=function(e){if(t.hasOwnProperty(e)){var i=t[e];o(i)?r.push(i.then((function(t){n[e]=t}))):n[e]=i}};for(var a in t)i(a);return e.all(r).then((function(){return n}))},e.map=function(t,n){return e.all(t.map(n))},e.onPossiblyUnhandledException=function(e){return function(e){return u.push(e),{cancel:function(){u.splice(u.indexOf(e),1)}}}(e)},e.try=function(t,n,r){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.try expected a function");var o;f();try{o=t.apply(n,r||[])}catch(t){return d(),e.reject(t)}return d(),e.resolve(o)},e.delay=function(t){return new e((function(e){setTimeout(e,t)}))},e.isPromise=function(t){return!!(t&&t instanceof e)||o(t)},e.flush=function(){return t=i=i||new e,s(),t;var t},e}(),h="Call was rejected by callee.\r\n";function v(e){return void 0===e&&(e=window),"about:"===e.location.protocol}function p(e){try{return!0}catch(e){}return!1}function w(e){void 0===e&&(e=window);var t=e.location;if(!t)throw new Error("Can not read window location");var n=t.protocol;if(!n)throw new Error("Can not read window protocol");if("file:"===n)return"file://";if("about:"===n){var r=function(e){if(void 0===e&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch(e){}}(e);return r&&p()?w(r):"about://"}var o=t.host;if(!o)throw new Error("Can not read window host");return n+"//"+o}function y(e){void 0===e&&(e=window);var t=w(e);return t&&e.mockDomain&&0===e.mockDomain.indexOf("mock:")?e.mockDomain:t}var m=[],g=[];function b(e,t){void 0===t&&(t=!0);try{if(e===window)return!1}catch(e){return!0}try{if(!e)return!0}catch(e){return!0}try{if(e.closed)return!0}catch(e){return!e||e.message!==h}if(t&&function(e){if(!function(e){try{if(e===window)return!0}catch(e){}try{var t=Object.getOwnPropertyDescriptor(e,"location");if(t&&!1===t.enumerable)return!1}catch(e){}try{if(v(e)&&p())return!0}catch(e){}try{if(w(e)===w(window))return!0}catch(e){}return!1}(e))return!1;try{if(e===window)return!0;if(v(e)&&p())return!0;if(y(window)===y(e))return!0}catch(e){}return!1}(e))try{if(e.mockclosed)return!0}catch(e){}try{if(!e.parent||!e.top)return!0}catch(e){}var n=function(e,t){for(var n=0;n<e.length;n++)try{if(e[n]===t)return n}catch(e){}return-1}(m,e);if(-1!==n){var r=g[n];if(r&&function(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var t=e.ownerDocument;if(t&&t.documentElement&&!t.documentElement.contains(e)){for(var n=e;n.parentNode&&n.parentNode!==n;)n=n.parentNode;if(!n.host||!t.documentElement.contains(n.host))return!0}return!1}(r))return!0}return!1}function j(e){try{if(e===window)return!0}catch(e){if(e&&e.message===h)return!0}try{if("[object Window]"==={}.toString.call(e))return!0}catch(e){if(e&&e.message===h)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(e){if(e&&e.message===h)return!0}try{if(e&&e.self===e)return!0}catch(e){if(e&&e.message===h)return!0}try{if(e&&e.parent===e)return!0}catch(e){if(e&&e.message===h)return!0}try{if(e&&e.top===e)return!0}catch(e){if(e&&e.message===h)return!0}try{if(e&&"__unlikely_value__"===e.__cross_domain_utils_window_check__)return!1}catch(e){return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch(e){}return!1}function O(e,t){for(var n=0;n<e.length;n++)try{if(e[n]===t)return n}catch(e){}return-1}var _,E=function(){function e(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var e=new WeakMap,t={};return Object.freeze(t),e.set(t,"__testvalue__"),"__testvalue__"===e.get(t)}catch(e){return!1}}())try{this.weakmap=new WeakMap}catch(e){}this.keys=[],this.values=[]}var t=e.prototype;return t._cleanupClosedWindows=function(){for(var e=this.weakmap,t=this.keys,n=0;n<t.length;n++){var r=t[n];if(j(r)&&b(r)){if(e)try{e.delete(r)}catch(e){}t.splice(n,1),this.values.splice(n,1),n-=1}}},t.isSafeToReadWrite=function(e){return!j(e)},t.set=function(e,t){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{n.set(e,t)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=this.name,o=e[r];return void(o&&o[0]===e?o[1]=t:Object.defineProperty(e,r,{value:[e,t],writable:!0}))}catch(e){}this._cleanupClosedWindows();var i=this.keys,a=this.values,u=O(i,e);-1===u?(i.push(e),a.push(t)):a[u]=t},t.get=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return t.get(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=e[this.name];return n&&n[0]===e?n[1]:void 0}catch(e){}this._cleanupClosedWindows();var r=O(this.keys,e);if(-1!==r)return this.values[r]},t.delete=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.delete(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=e[this.name];n&&n[0]===e&&(n[0]=n[1]=void 0)}catch(e){}this._cleanupClosedWindows();var r=this.keys,o=O(r,e);-1!==o&&(r.splice(o,1),this.values.splice(o,1))},t.has=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return!0}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=e[this.name];return!(!n||n[0]!==e)}catch(e){}return this._cleanupClosedWindows(),-1!==O(this.keys,e)},t.getOrSet=function(e,t){if(this.has(e))return this.get(e);var n=t();return this.set(e,n),n},e}();function k(e){return e.name||e.__name__||e.displayName||"anonymous"}function x(e,t){try{delete e.name,e.name=t}catch(e){}return e.__name__=e.displayName=t,e}function S(){var e="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,(function(){return e.charAt(Math.floor(Math.random()*e.length))}))+"_"+function(e){if("function"==typeof btoa)return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))}))).replace(/[=]/g,"");if("undefined"!=typeof Buffer)return Buffer.from(e,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function R(e){try{return JSON.stringify([].slice.call(e),(function(e,t){return"function"==typeof t?"memoize["+function(e){if(_=_||new E,null==e||"object"!=typeof e&&"function"!=typeof e)throw new Error("Invalid object");var t=_.get(e);return t||(t=typeof e+":"+S(),_.set(e,t)),t}(t)+"]":t}))}catch(e){throw new Error("Arguments not serializable -- can not be used to memoize")}}function B(){return{}}var C=0,P=0;function W(e,t){void 0===t&&(t={});var n,r,o=t.thisNamespace,i=void 0!==o&&o,a=t.time,u=C;C+=1;var c=function(){for(var t=arguments.length,o=new Array(t),c=0;c<t;c++)o[c]=arguments[c];var s;u<P&&(n=null,r=null,u=C,C+=1),s=i?(r=r||new E).getOrSet(this,B):n=n||{};var f=R(o),d=s[f];if(d&&a&&Date.now()-d.time<a&&(delete s[f],d=null),d)return d.value;var l=Date.now(),h=e.apply(this,arguments);return s[f]={time:l,value:h},h};return c.reset=function(){n=null,r=null},x(c,(t.name||k(e))+"::memoized")}function T(){}function L(e,t){void 0===t&&(t=Boolean);var n={};for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)&&(n[r]=e[r]);return n}function N(){return Boolean(document.body)&&"complete"===document.readyState}function A(){return Boolean(document.body)&&"interactive"===document.readyState}function M(){return"undefined"!=typeof window&&void 0!==window.location}W.clear=function(){P=C},W((function(e){if(Object.values)return Object.values(e);var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t})),Error,W((function(){return new l((function(e){if(N()||A())return e();var t=setInterval((function(){if(N()||A())return clearInterval(t),e()}),10)}))}));var I="undefined"!=typeof document?document.currentScript:null,D=W((function(){if(I)return I;if(I=function(){try{var e=function(){try{throw new Error("_")}catch(e){return e.stack||""}}(),t=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(e),n=t&&t[1];if(!n)return;for(var r=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();r<o.length;r++){var i=o[r];if(i.src&&i.src===n)return i}}catch(e){}}())return I;throw new Error("Can not determine current script")})),H=S();W((function(){var e;try{e=D()}catch(e){return H}var t=e.getAttribute("data-uid");if(t&&"string"==typeof t)return t;if((t=e.getAttribute("data-uid-auto"))&&"string"==typeof t)return t;if(e.src){var n=function(e){for(var t="",n=0;n<e.length;n++){var r=e[n].charCodeAt(0)*n;e[n+1]&&(r+=e[n+1].charCodeAt(0)*(n-1)),t+=String.fromCharCode(97+Math.abs(r)%26)}return t}(JSON.stringify({src:e.src,dataset:e.dataset}));t="uid_"+n.slice(n.length-30)}else t=S();return e.setAttribute("data-uid-auto",t),t}));var U=[],z={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error"},F={FILE:"file:"},q=[z.WARN,z.ERROR],G=[z.ERROR,z.WARN,z.INFO,z.DEBUG],J=z.WARN,K=function(e){var t=e.headers,n=e.enableSendBeacon,r=t&&Object.keys(t).length;return!!(window&&window.navigator.sendBeacon&&!r&&n&&window.Blob)},V=function(e){return"https://api2.amplitude.com/2/httpapi"===e},X=function(e){var t=e.url,n=e.data,r=e.useBlob,o=void 0===r||r;try{var i=JSON.stringify(n);if(o){var a=new Blob([i],{type:"application/json"});return window.navigator.sendBeacon(t,a)}return window.navigator.sendBeacon(t,i)}catch(e){return!1}},Z=function(e,t){for(var n in t)t.hasOwnProperty(n)&&t[n]&&(e[n]=t[n])};function $(e){var t=e.url,n=e.method,r=e.headers,o=e.json,i=e.enableSendBeacon,a=void 0!==i&&i;return l.try((function(){var e=!1;return K({headers:r,enableSendBeacon:a})&&(e=V(t)?X({url:t,data:o,useBlob:!1}):X({url:t,data:o,useBlob:!0})),e||function(e){var t=e.url,n=e.method,r=void 0===n?"get":n,o=e.headers,i=void 0===o?{}:o,a=e.json,u=e.data,c=e.body,s=e.win,f=void 0===s?window:s,d=e.timeout,h=void 0===d?0:d;return new l((function(e,n){if(a&&u||a&&c||u&&a)throw new Error("Only options.json or options.data or options.body should be passed");for(var o={},s=0,d=Object.keys(i);s<d.length;s++){var l=d[s];o[l.toLowerCase()]=i[l]}a?o["content-type"]=o["content-type"]||"application/json":(u||c)&&(o["content-type"]=o["content-type"]||"application/x-www-form-urlencoded; charset=utf-8"),o.accept=o.accept||"application/json";for(var v=0;v<U.length;v++)for(var p=(0,U[v])(),w=0,y=Object.keys(p);w<y.length;w++){var m=y[w];o[m.toLowerCase()]=p[m]}var g=new f.XMLHttpRequest;for(var b in g.addEventListener("load",(function(){var o=function(e){void 0===e&&(e="");for(var t={},n=0,r=e.trim().split("\n");n<r.length;n++){var o=r[n].split(":"),i=o[0],a=o.slice(1);t[i.toLowerCase()]=a.join(":").trim()}return t}(this.getAllResponseHeaders());if(!this.status)return n(new Error("Request to "+r.toLowerCase()+" "+t+" failed: no response status code."));var i=o["content-type"],a=i&&(0===i.indexOf("application/json")||0===i.indexOf("text/json")),u=this.responseText;try{u=JSON.parse(u)}catch(e){if(a)return n(new Error("Invalid json: "+this.responseText+"."))}return e({status:this.status,headers:o,body:u})}),!1),g.addEventListener("error",(function(e){n(new Error("Request to "+r.toLowerCase()+" "+t+" failed: "+e.toString()+"."))}),!1),g.open(r,t,!0),o)o.hasOwnProperty(b)&&g.setRequestHeader(b,o[b]);a?c=JSON.stringify(a):u&&(c=Object.keys(u).map((function(e){return encodeURIComponent(e)+"="+(u?encodeURIComponent(u[e]):"")})).join("&")),g.timeout=h,g.ontimeout=function(){n(new Error("Request to "+r.toLowerCase()+" "+t+" has timed out"))},g.send(c)}))}({url:t,method:n,headers:r,json:o})})).then(T)}function Q(e){var t=e.url,n=e.prefix,o=e.logLevel,i=void 0===o?J:o,a=e.transport,u=void 0===a?$:a,c=e.amplitudeApiKey,s=e.flushInterval,f=void 0===s?6e4:s,d=e.enableSendBeacon,h=void 0!==d&&d,v=[],p=[],w=[],y=[],m=[],g=[];function b(e,t,n){if(M()&&window.console&&window.console.log&&!(G.indexOf(e)>G.indexOf(i))){var r=[t];r.push(n),(n.error||n.warning)&&r.push("\n\n",n.error||n.warning);try{window.console[e]&&window.console[e].apply?window.console[e].apply(window.console,r):window.console.log&&window.console.log.apply&&window.console.log.apply(window.console,r)}catch(e){}}}function j(){return l.try((function(){if(M()&&window.location.protocol!==F.FILE&&(v.length||p.length)){for(var e={},n=0;n<y.length;n++)Z(e,(0,y[n])(e));for(var o,i={},a=0;a<g.length;a++)Z(i,(0,g[a])(i));return t&&(o=u({method:"POST",url:t,headers:i,json:{events:v,meta:e,tracking:p},enableSendBeacon:h}).catch(T)),c&&u({method:"POST",url:"https://api2.amplitude.com/2/httpapi",headers:{},json:{api_key:c,events:p.map((function(e){return r({event_type:e.transition_name||"event",event_properties:e},e)}))},enableSendBeacon:h}).catch(T),v=[],p=[],l.resolve(o).then(T)}}))}var O,_,E,S,R=(void 0===_&&(_=50),x((function(){S&&clearTimeout(S);var e=E=E||new l;return S=setTimeout((function(){E=null,S=null,l.try(O).then((function(t){e.resolve(t)}),(function(t){e.reject(t)}))}),_),e}),k(O=j)+"::promiseDebounced"));function B(e,t,o){if(void 0===o&&(o={}),!M())return P;n&&(t=n+"_"+t);for(var i=r({},L(o),{timestamp:Date.now().toString()}),a=0;a<w.length;a++)Z(i,(0,w[a])(i));return function(e,t,n){v.push({level:e,event:t,payload:n}),-1!==q.indexOf(e)&&R()}(e,t,i),b(e,t,i),P}function C(e,t){return e.push(t),P}M()&&function(e,t){!function n(){setTimeout((function(){e(),n()}),t)}()}(R,f),"object"==typeof window&&(window.addEventListener("beforeunload",(function(){j()})),window.addEventListener("unload",(function(){j()})),window.addEventListener("pagehide",(function(){j()})));var P={debug:function(e,t){return B(z.DEBUG,e,t)},info:function(e,t){return B(z.INFO,e,t)},warn:function(e,t){return B(z.WARN,e,t)},error:function(e,t){return B(z.ERROR,e,t)},track:function(e){if(void 0===e&&(e={}),!M())return P;for(var t=L(e),n=0;n<m.length;n++)Z(t,(0,m[n])(t));return b(z.DEBUG,"track",t),p.push(t),P},flush:R,immediateFlush:j,addPayloadBuilder:function(e){return C(w,e)},addMetaBuilder:function(e){return C(y,e)},addTrackingBuilder:function(e){return C(m,e)},addHeaderBuilder:function(e){return C(g,e)},setTransport:function(e){return u=e,P},configure:function(e){return e.url&&(t=e.url),e.prefix&&(n=e.prefix),e.logLevel&&(i=e.logLevel),e.transport&&(u=e.transport),e.amplitudeApiKey&&(c=e.amplitudeApiKey),e.flushInterval&&(f=e.flushInterval),e.enableSendBeacon&&(h=e.enableSendBeacon),P}};return P}}])}));
//# sourceMappingURL=beaver-logger.min.js.map

@@ -6,3 +6,3 @@ import _extends from "@babel/runtime/helpers/esm/extends";

import { LOG_LEVEL, PROTOCOL } from './constants';
import { canUseSendBeacon, isAmplitude, sendBeacon } from './util';
import { canUseSendBeacon, extendIfDefined, isAmplitude, sendBeacon } from './util';

@@ -47,10 +47,2 @@ function httpTransport(_ref) {

function extendIfDefined(target, source) {
for (var key in source) {
if (source.hasOwnProperty(key) && source[key] && !target[key]) {
target[key] = source[key];
}
}
}
export function Logger(_ref2) {

@@ -57,0 +49,0 @@ var url = _ref2.url,

@@ -46,2 +46,10 @@ import { AMPLITUDE_URL } from './config';

export { canUseSendBeacon, isAmplitude, sendBeacon };
var extendIfDefined = function extendIfDefined(target, source) {
for (var key in source) {
if (source.hasOwnProperty(key) && source[key]) {
target[key] = source[key];
}
}
};
export { canUseSendBeacon, extendIfDefined, isAmplitude, sendBeacon };
{
"name": "beaver-logger",
"version": "4.0.29",
"version": "4.0.30",
"description": "Client side logger.",

@@ -5,0 +5,0 @@ "main": "dist/beaver-logger.js",

@@ -8,3 +8,3 @@ /* @flow */

import { LOG_LEVEL, PROTOCOL } from './constants';
import { canUseSendBeacon, isAmplitude, sendBeacon } from './util';
import { canUseSendBeacon, extendIfDefined, isAmplitude, sendBeacon } from './util';

@@ -75,10 +75,2 @@ export type TransportOptions = {|

function extendIfDefined(target : { [string] : string | boolean }, source : { [string] : ?string | ?boolean }) {
for (const key in source) {
if (source.hasOwnProperty(key) && source[key] && !target[key]) {
target[key] = source[key];
}
}
}
export function Logger({ url, prefix, logLevel = DEFAULT_LOG_LEVEL, transport = httpTransport, amplitudeApiKey, flushInterval = FLUSH_INTERVAL, enableSendBeacon = false } : LoggerOptions) : LoggerType {

@@ -85,0 +77,0 @@

@@ -49,2 +49,10 @@ /* @flow */

export { canUseSendBeacon, isAmplitude, sendBeacon };
const extendIfDefined = (target : { [string] : string | boolean }, source : { [string] : ?string | ?boolean }) => {
for (const key in source) {
if (source.hasOwnProperty(key) && source[key]) {
target[key] = source[key];
}
}
};
export { canUseSendBeacon, extendIfDefined, isAmplitude, sendBeacon };

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc