Socket
Socket
Sign inDemoInstall

@algolia/algolia-browser-telemetry

Package Overview
Dependencies
2
Maintainers
63
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

34

dist/algolia-browser-telemetry.cjs.development.js

@@ -7,6 +7,15 @@ 'use strict';

// We are doing our own minification as minifiers do not hoist global variables.
var W = window;
var D = document;
function isBrowserEnvironment() {
return typeof window !== 'undefined';
}
var isBrowser = /*#__PURE__*/isBrowserEnvironment(); // We are doing our own minification as minifiers do not hoist global variables.
// Cast as Window, but check if we are in browser env first. If we type it as Window|undefined
// then it makes our life harder in all other occurences where we use W.
// @ts-ignore
var W = isBrowser ? window : undefined; // @ts-ignore
var D = isBrowser ? document : undefined;
/**

@@ -60,3 +69,3 @@ * PromiseMicroTask executes microtask via Promise interface

return (_ref = ((_W$Promise = W.Promise) === null || _W$Promise === void 0 ? void 0 : (_W$Promise$toString = _W$Promise.toString()) === null || _W$Promise$toString === void 0 ? void 0 : _W$Promise$toString.indexOf('[native code]')) !== -1) !== null && _ref !== void 0 ? _ref : false;
return (_ref = (W === null || W === void 0 ? void 0 : (_W$Promise = W.Promise) === null || _W$Promise === void 0 ? void 0 : (_W$Promise$toString = _W$Promise.toString()) === null || _W$Promise$toString === void 0 ? void 0 : _W$Promise$toString.indexOf('[native code]')) !== -1) !== null && _ref !== void 0 ? _ref : false;
}

@@ -66,3 +75,3 @@ function supportsMutationObserver() {

return (_ref2 = ((_W$MutationObserver = W.MutationObserver) === null || _W$MutationObserver === void 0 ? void 0 : (_W$MutationObserver$t = _W$MutationObserver.toString()) === null || _W$MutationObserver$t === void 0 ? void 0 : _W$MutationObserver$t.indexOf('[native code]')) !== -1) !== null && _ref2 !== void 0 ? _ref2 : false;
return (_ref2 = (W === null || W === void 0 ? void 0 : (_W$MutationObserver = W.MutationObserver) === null || _W$MutationObserver === void 0 ? void 0 : (_W$MutationObserver$t = _W$MutationObserver.toString()) === null || _W$MutationObserver$t === void 0 ? void 0 : _W$MutationObserver$t.indexOf('[native code]')) !== -1) !== null && _ref2 !== void 0 ? _ref2 : false;
}

@@ -85,3 +94,3 @@ function CreateMicroTaskEnqueueFn() {

function requestIdleCallbackPolyfill(callback) {
return W.setTimeout(callback, 0);
return W === null || W === void 0 ? void 0 : W.setTimeout(callback, 0);
}

@@ -94,9 +103,9 @@ /**

function supportsNativeIdleCallback(idleCallback) {
var _idleCallback$toStrin;
function supportsNativeIdleCallback(callback) {
var _callback$toString;
return ((_idleCallback$toStrin = idleCallback === null || idleCallback === void 0 ? void 0 : idleCallback.toString()) !== null && _idleCallback$toStrin !== void 0 ? _idleCallback$toStrin : '').indexOf('[native code]') !== -1;
return ((_callback$toString = callback === null || callback === void 0 ? void 0 : callback.toString()) !== null && _callback$toString !== void 0 ? _callback$toString : '').indexOf('[native code]') !== -1;
}
var requestIdleCallback = /*#__PURE__*/supportsNativeIdleCallback(W.requestIdleCallback) ? W.requestIdleCallback : requestIdleCallbackPolyfill;
var requestIdleCallback = /*#__PURE__*/supportsNativeIdleCallback(W === null || W === void 0 ? void 0 : W.requestIdleCallback) ? W.requestIdleCallback : requestIdleCallbackPolyfill;

@@ -307,3 +316,3 @@ function isSafari() {

// There is also no need to check for XMLHttpRequest support as we can assume that in order
// for search to work, it will have to be defined anyways or else nothing works.
// for search to work, it will have to be defined anyways or

@@ -650,3 +659,4 @@

if (!W && !options.requester) {
// Check if we are running in browser env, else show the warning
if (!isBrowserEnvironment()) {
console.warn("\n \uD83D\uDEA8Telemetry is not supported in non browser environments.\uD83D\uDEA8\n\n Please use a requester that is compliant with the environment you are running your application in.\n\n The value of window object was: " + W + "\n\n "); // @ts-ignore

@@ -653,0 +663,0 @@

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@algolia/requester-browser-xhr"),n=window,t=document;function r(e){var t;null===(t=n.Promise)||void 0===t||t.resolve().then(e)}function o(){return null!==(e=-1!==(null===(t=n.Promise)||void 0===t||null===(o=t.toString())||void 0===o?void 0:o.indexOf("[native code]")))&&void 0!==e&&e?r:null!==(i=-1!==(null===(u=n.MutationObserver)||void 0===u||null===(a=u.toString())||void 0===a?void 0:a.indexOf("[native code]")))&&void 0!==i&&i?function(){if(!n.MutationObserver)return function(e){return e()};var e=[],t=new n.MutationObserver((function(){e.forEach((function(e){return e()})),e=[]})),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(n){e.push(n),r.data=String(1)}}():function(e){return e()};var e,t,o,i,u,a}var i=o();function u(e){var n;return-1!==(null!==(n=null==e?void 0:e.toString())&&void 0!==n?n:"").indexOf("[native code]")}var a=u(n.requestIdleCallback)?n.requestIdleCallback:function(e){return n.setTimeout(e,0)};function c(){return!("object"!=typeof n.safari||!n.safari.pushNotification)}function s(e){if(!e.capacity||"number"!=typeof e.capacity)throw new Error("IdleQueue requires capacity number initializer");if(!e.onFlush||"function"!=typeof e.onFlush)throw new Error("IdleQueue requires onFlush function initializer");var r=[],o=[];function u(){var n=r.shift();n&&(o.push(n()),o.length>=e.capacity&&s())}function s(){if(o.length){for(var n=[];o.length>0;){var t=o.shift();t&&n.push(t)}i((function(){return e.onFlush(n)}))}}function l(){for(;r.length;){var e=r.shift();e&&o.push(e())}s()}function f(){"hidden"===t.visibilityState&&l()}return t.addEventListener("visibilitychange",f,!0),c()&&n.addEventListener("beforeunload",l,!0),{size:function(){return r.length},enqueue:function(e){r.push(e),"hidden"===t.visibilityState?i(u):a(u)},destroy:function(){t.removeEventListener("visibilitychange",f),c()&&n.removeEventListener("beforeunload",l),l()},results:o}}var l="https://telemetry.algolia.com/1/collector";function f(e){return null!==(t="function"==typeof(null==n||null===(r=n.navigator)||void 0===r?void 0:r.sendBeacon))&&void 0!==t&&t?n.navigator.sendBeacon(l,JSON.stringify(e)):-1!==(null!==(o=null===(i=n.fetch)||void 0===i?void 0:i.toString())&&void 0!==o?o:"").indexOf("[native code]")?(function(e){n.fetch(l,{method:"POST",body:JSON.stringify(e),keepalive:!0})}(e),!0):(function(e){var t=new n.XMLHttpRequest;t.open("POST",l),t.setRequestHeader("Content-Type","application/json;charset=UTF-8"),t.send(JSON.stringify(e))}(e),!1);var t,r,o,i}function d(e){return f({o:n.location.hostname||null,e:e})}function v(e){return f({o:n.location.hostname||null,d:e})}function p(e){return!(!function(e){return"xmlhttprequest"===e.initiatorType&&-1!==e.name.indexOf("algolia")}(e)||!/\/\/\w+-(dsn|[1-3]).algolia\.?net/.test(e.name)&&!function(e){return/\/\/([d|t|s|c][0-9]+)-\w+(-[0-9])?.algolia\.?net/.test(e)}(e.name))}function y(e){return e.split("?")[0]}function h(e,n){void 0===n&&(n=2);var t=Math.pow(10,n);return Math.round(e*t)/t}function m(e){return"number"==typeof e&&e>0}exports.default=function(t){if(void 0===t&&(t={}),!n&&!t.requester)return console.warn("\n 🚨Telemetry is not supported in non browser environments.🚨\n\n Please use a requester that is compliant with the environment you are running your application in.\n\n The value of window object was: "+n+"\n\n "),{send:function(){return Promise.resolve()},destroy:function(){return null}};var r=function(e){if(void 0===e&&(e={}),void 0!==e.errorQueueCapacity&&!m(e.errorQueueCapacity))throw new Error('Invalid error queue capacity "'+e.errorQueueCapacity+'", queue capacity needs to be of type number.');if(void 0!==e.telemetryQueueCapacity&&!m(e.telemetryQueueCapacity))throw new Error('Invalid telemetry queue capacity "'+e.telemetryQueueCapacity+'", queue capacity needs to be of type number.');var t,r,o,i,u,a=e.reporter||{error:d,telemetry:v},c=s({capacity:e.errorQueueCapacity||4,onFlush:a.error}),l=s({capacity:e.telemetryQueueCapacity||10,onFlush:a.telemetry}),f=(t=function(e){l.enqueue((function(){return function(e){return{r:y(e.name),d:e.domainLookupEnd&&e.domainLookupStart?h(e.domainLookupEnd-e.domainLookupStart,0):0,t:e.requestStart&&e.responseEnd?h(e.responseEnd-e.requestStart,0):0,sz:e.transferSize?h((n=e.transferSize,n/1024),2):0,ts:(new Date).toISOString()};var n}(e)}))},-1!==(null===(o=null!==(i=null==(r=n.PerformanceObserver)?void 0:r.toString())&&void 0!==i?i:"")||void 0===o?void 0:o.indexOf("[native code]"))&&-1!==(null!==(u=null==r?void 0:r.supportedEntryTypes)&&void 0!==u?u:[]).indexOf("resource")?function(e){return new n.PerformanceObserver((function(n){n.getEntries().filter((function(e){return p(e)})).forEach((function(n){e(n)}))}))}(t):function(e){var t=0,r=[];function o(){return function(){return null!==(e="function"==typeof(null===(t=n.performance)||void 0===t?void 0:t.getEntriesByType))&&void 0!==e&&e?n.performance.getEntriesByType("resource").filter((function(e){return p(e)})):[];var e,t}().filter((function(e){return-1===r.indexOf(e)})).forEach((function(n){r.push(n),e(n)}))}return{observe:function(){o(),t=setInterval(o,2e3)},takeRecords:function(){var e=[].concat(r);return r=[],e},disconnect:function(){t&&(r=[],n.clearInterval(t))}}}(t));return f.observe({entryTypes:["resource"]}),{error:function(e,n){return c.enqueue((function(){return function(e,n){return{r:y(e.url),sc:n.status,m:n.content,to:n.isTimedOut?1:0,ts:(new Date).toISOString()}}(e,n)}))},destroy:function(){c.destroy(),l.destroy(),f.disconnect()}}}({reporter:t.reporter,telemetryQueueCapacity:t.telemetryQueueCapacity,errorQueueCapacity:t.errorQueueCapacity}),o=t.requester?t.requester:e.createBrowserXhrRequester();return{send:function(e){return o.send(e).then((function(n){return(n.status>=400||0===n.status||n.isTimedOut)&&r.error(e,n),n}))},destroy:r.destroy}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@algolia/requester-browser-xhr");function n(){return"undefined"!=typeof window}var t=n(),r=t?window:void 0,o=t?document:void 0;function i(e){var n;null===(n=r.Promise)||void 0===n||n.resolve().then(e)}function u(){return null!==(e=-1!==(null==r||null===(n=r.Promise)||void 0===n||null===(t=n.toString())||void 0===t?void 0:t.indexOf("[native code]")))&&void 0!==e&&e?i:null!==(o=-1!==(null==r||null===(u=r.MutationObserver)||void 0===u||null===(a=u.toString())||void 0===a?void 0:a.indexOf("[native code]")))&&void 0!==o&&o?function(){if(!r.MutationObserver)return function(e){return e()};var e=[],n=new r.MutationObserver((function(){e.forEach((function(e){return e()})),e=[]})),t=document.createTextNode("");return n.observe(t,{characterData:!0}),function(n){e.push(n),t.data=String(1)}}():function(e){return e()};var e,n,t,o,u,a}var a=u();function c(e){var n;return-1!==(null!==(n=null==e?void 0:e.toString())&&void 0!==n?n:"").indexOf("[native code]")}var s=c(null==r?void 0:r.requestIdleCallback)?r.requestIdleCallback:function(e){return null==r?void 0:r.setTimeout(e,0)};function l(){return!("object"!=typeof r.safari||!r.safari.pushNotification)}function f(e){if(!e.capacity||"number"!=typeof e.capacity)throw new Error("IdleQueue requires capacity number initializer");if(!e.onFlush||"function"!=typeof e.onFlush)throw new Error("IdleQueue requires onFlush function initializer");var n=[],t=[];function i(){var r=n.shift();r&&(t.push(r()),t.length>=e.capacity&&u())}function u(){if(t.length){for(var n=[];t.length>0;){var r=t.shift();r&&n.push(r)}a((function(){return e.onFlush(n)}))}}function c(){for(;n.length;){var e=n.shift();e&&t.push(e())}u()}function f(){"hidden"===o.visibilityState&&c()}return o.addEventListener("visibilitychange",f,!0),l()&&r.addEventListener("beforeunload",c,!0),{size:function(){return n.length},enqueue:function(e){n.push(e),"hidden"===o.visibilityState?a(i):s(i)},destroy:function(){o.removeEventListener("visibilitychange",f),l()&&r.removeEventListener("beforeunload",c),c()},results:t}}var d="https://telemetry.algolia.com/1/collector";function v(e){return null!==(n="function"==typeof(null==r||null===(t=r.navigator)||void 0===t?void 0:t.sendBeacon))&&void 0!==n&&n?r.navigator.sendBeacon(d,JSON.stringify(e)):-1!==(null!==(o=null===(i=r.fetch)||void 0===i?void 0:i.toString())&&void 0!==o?o:"").indexOf("[native code]")?(function(e){r.fetch(d,{method:"POST",body:JSON.stringify(e),keepalive:!0})}(e),!0):(function(e){var n=new r.XMLHttpRequest;n.open("POST",d),n.setRequestHeader("Content-Type","application/json;charset=UTF-8"),n.send(JSON.stringify(e))}(e),!1);var n,t,o,i}function p(e){return v({o:r.location.hostname||null,e:e})}function y(e){return v({o:r.location.hostname||null,d:e})}function h(e){return!(!function(e){return"xmlhttprequest"===e.initiatorType&&-1!==e.name.indexOf("algolia")}(e)||!/\/\/\w+-(dsn|[1-3]).algolia\.?net/.test(e.name)&&!function(e){return/\/\/([d|t|s|c][0-9]+)-\w+(-[0-9])?.algolia\.?net/.test(e)}(e.name))}function m(e){return e.split("?")[0]}function b(e,n){void 0===n&&(n=2);var t=Math.pow(10,n);return Math.round(e*t)/t}function g(e){return"number"==typeof e&&e>0}exports.default=function(t){if(void 0===t&&(t={}),!n())return console.warn("\n 🚨Telemetry is not supported in non browser environments.🚨\n\n Please use a requester that is compliant with the environment you are running your application in.\n\n The value of window object was: "+r+"\n\n "),{send:function(){return Promise.resolve()},destroy:function(){return null}};var o=function(e){if(void 0===e&&(e={}),void 0!==e.errorQueueCapacity&&!g(e.errorQueueCapacity))throw new Error('Invalid error queue capacity "'+e.errorQueueCapacity+'", queue capacity needs to be of type number.');if(void 0!==e.telemetryQueueCapacity&&!g(e.telemetryQueueCapacity))throw new Error('Invalid telemetry queue capacity "'+e.telemetryQueueCapacity+'", queue capacity needs to be of type number.');var n,t,o,i,u,a=e.reporter||{error:p,telemetry:y},c=f({capacity:e.errorQueueCapacity||4,onFlush:a.error}),s=f({capacity:e.telemetryQueueCapacity||10,onFlush:a.telemetry}),l=(n=function(e){s.enqueue((function(){return function(e){return{r:m(e.name),d:e.domainLookupEnd&&e.domainLookupStart?b(e.domainLookupEnd-e.domainLookupStart,0):0,t:e.requestStart&&e.responseEnd?b(e.responseEnd-e.requestStart,0):0,sz:e.transferSize?b((n=e.transferSize,n/1024),2):0,ts:(new Date).toISOString()};var n}(e)}))},-1!==(null===(o=null!==(i=null==(t=r.PerformanceObserver)?void 0:t.toString())&&void 0!==i?i:"")||void 0===o?void 0:o.indexOf("[native code]"))&&-1!==(null!==(u=null==t?void 0:t.supportedEntryTypes)&&void 0!==u?u:[]).indexOf("resource")?function(e){return new r.PerformanceObserver((function(n){n.getEntries().filter((function(e){return h(e)})).forEach((function(n){e(n)}))}))}(n):function(e){var n=0,t=[];function o(){return function(){return null!==(e="function"==typeof(null===(n=r.performance)||void 0===n?void 0:n.getEntriesByType))&&void 0!==e&&e?r.performance.getEntriesByType("resource").filter((function(e){return h(e)})):[];var e,n}().filter((function(e){return-1===t.indexOf(e)})).forEach((function(n){t.push(n),e(n)}))}return{observe:function(){o(),n=setInterval(o,2e3)},takeRecords:function(){var e=[].concat(t);return t=[],e},disconnect:function(){n&&(t=[],r.clearInterval(n))}}}(n));return l.observe({entryTypes:["resource"]}),{error:function(e,n){return c.enqueue((function(){return function(e,n){return{r:m(e.url),sc:n.status,m:n.content,to:n.isTimedOut?1:0,ts:(new Date).toISOString()}}(e,n)}))},destroy:function(){c.destroy(),s.destroy(),l.disconnect()}}}({reporter:t.reporter,telemetryQueueCapacity:t.telemetryQueueCapacity,errorQueueCapacity:t.errorQueueCapacity}),i=t.requester?t.requester:e.createBrowserXhrRequester();return{send:function(e){return i.send(e).then((function(n){return(n.status>=400||0===n.status||n.isTimedOut)&&o.error(e,n),n}))},destroy:o.destroy}};
//# sourceMappingURL=algolia-browser-telemetry.cjs.production.min.js.map
import { createBrowserXhrRequester } from '@algolia/requester-browser-xhr';
// We are doing our own minification as minifiers do not hoist global variables.
var W = window;
var D = document;
function isBrowserEnvironment() {
return typeof window !== 'undefined';
}
var isBrowser = /*#__PURE__*/isBrowserEnvironment(); // We are doing our own minification as minifiers do not hoist global variables.
// Cast as Window, but check if we are in browser env first. If we type it as Window|undefined
// then it makes our life harder in all other occurences where we use W.
// @ts-ignore
var W = isBrowser ? window : undefined; // @ts-ignore
var D = isBrowser ? document : undefined;
/**

@@ -55,3 +64,3 @@ * PromiseMicroTask executes microtask via Promise interface

return (_ref = ((_W$Promise = W.Promise) === null || _W$Promise === void 0 ? void 0 : (_W$Promise$toString = _W$Promise.toString()) === null || _W$Promise$toString === void 0 ? void 0 : _W$Promise$toString.indexOf('[native code]')) !== -1) !== null && _ref !== void 0 ? _ref : false;
return (_ref = (W === null || W === void 0 ? void 0 : (_W$Promise = W.Promise) === null || _W$Promise === void 0 ? void 0 : (_W$Promise$toString = _W$Promise.toString()) === null || _W$Promise$toString === void 0 ? void 0 : _W$Promise$toString.indexOf('[native code]')) !== -1) !== null && _ref !== void 0 ? _ref : false;
}

@@ -61,3 +70,3 @@ function supportsMutationObserver() {

return (_ref2 = ((_W$MutationObserver = W.MutationObserver) === null || _W$MutationObserver === void 0 ? void 0 : (_W$MutationObserver$t = _W$MutationObserver.toString()) === null || _W$MutationObserver$t === void 0 ? void 0 : _W$MutationObserver$t.indexOf('[native code]')) !== -1) !== null && _ref2 !== void 0 ? _ref2 : false;
return (_ref2 = (W === null || W === void 0 ? void 0 : (_W$MutationObserver = W.MutationObserver) === null || _W$MutationObserver === void 0 ? void 0 : (_W$MutationObserver$t = _W$MutationObserver.toString()) === null || _W$MutationObserver$t === void 0 ? void 0 : _W$MutationObserver$t.indexOf('[native code]')) !== -1) !== null && _ref2 !== void 0 ? _ref2 : false;
}

@@ -80,3 +89,3 @@ function CreateMicroTaskEnqueueFn() {

function requestIdleCallbackPolyfill(callback) {
return W.setTimeout(callback, 0);
return W === null || W === void 0 ? void 0 : W.setTimeout(callback, 0);
}

@@ -89,9 +98,9 @@ /**

function supportsNativeIdleCallback(idleCallback) {
var _idleCallback$toStrin;
function supportsNativeIdleCallback(callback) {
var _callback$toString;
return ((_idleCallback$toStrin = idleCallback === null || idleCallback === void 0 ? void 0 : idleCallback.toString()) !== null && _idleCallback$toStrin !== void 0 ? _idleCallback$toStrin : '').indexOf('[native code]') !== -1;
return ((_callback$toString = callback === null || callback === void 0 ? void 0 : callback.toString()) !== null && _callback$toString !== void 0 ? _callback$toString : '').indexOf('[native code]') !== -1;
}
var requestIdleCallback = /*#__PURE__*/supportsNativeIdleCallback(W.requestIdleCallback) ? W.requestIdleCallback : requestIdleCallbackPolyfill;
var requestIdleCallback = /*#__PURE__*/supportsNativeIdleCallback(W === null || W === void 0 ? void 0 : W.requestIdleCallback) ? W.requestIdleCallback : requestIdleCallbackPolyfill;

@@ -302,3 +311,3 @@ function isSafari() {

// There is also no need to check for XMLHttpRequest support as we can assume that in order
// for search to work, it will have to be defined anyways or else nothing works.
// for search to work, it will have to be defined anyways or

@@ -645,3 +654,4 @@

if (!W && !options.requester) {
// Check if we are running in browser env, else show the warning
if (!isBrowserEnvironment()) {
console.warn("\n \uD83D\uDEA8Telemetry is not supported in non browser environments.\uD83D\uDEA8\n\n Please use a requester that is compliant with the environment you are running your application in.\n\n The value of window object was: " + W + "\n\n "); // @ts-ignore

@@ -648,0 +658,0 @@

@@ -7,6 +7,15 @@ (function (global, factory) {

// We are doing our own minification as minifiers do not hoist global variables.
var W = window;
var D = document;
function isBrowserEnvironment() {
return typeof window !== 'undefined';
}
var isBrowser = /*#__PURE__*/isBrowserEnvironment(); // We are doing our own minification as minifiers do not hoist global variables.
// Cast as Window, but check if we are in browser env first. If we type it as Window|undefined
// then it makes our life harder in all other occurences where we use W.
// @ts-ignore
var W = isBrowser ? window : undefined; // @ts-ignore
var D = isBrowser ? document : undefined;
/**

@@ -60,3 +69,3 @@ * PromiseMicroTask executes microtask via Promise interface

return (_ref = ((_W$Promise = W.Promise) === null || _W$Promise === void 0 ? void 0 : (_W$Promise$toString = _W$Promise.toString()) === null || _W$Promise$toString === void 0 ? void 0 : _W$Promise$toString.indexOf('[native code]')) !== -1) !== null && _ref !== void 0 ? _ref : false;
return (_ref = (W === null || W === void 0 ? void 0 : (_W$Promise = W.Promise) === null || _W$Promise === void 0 ? void 0 : (_W$Promise$toString = _W$Promise.toString()) === null || _W$Promise$toString === void 0 ? void 0 : _W$Promise$toString.indexOf('[native code]')) !== -1) !== null && _ref !== void 0 ? _ref : false;
}

@@ -66,3 +75,3 @@ function supportsMutationObserver() {

return (_ref2 = ((_W$MutationObserver = W.MutationObserver) === null || _W$MutationObserver === void 0 ? void 0 : (_W$MutationObserver$t = _W$MutationObserver.toString()) === null || _W$MutationObserver$t === void 0 ? void 0 : _W$MutationObserver$t.indexOf('[native code]')) !== -1) !== null && _ref2 !== void 0 ? _ref2 : false;
return (_ref2 = (W === null || W === void 0 ? void 0 : (_W$MutationObserver = W.MutationObserver) === null || _W$MutationObserver === void 0 ? void 0 : (_W$MutationObserver$t = _W$MutationObserver.toString()) === null || _W$MutationObserver$t === void 0 ? void 0 : _W$MutationObserver$t.indexOf('[native code]')) !== -1) !== null && _ref2 !== void 0 ? _ref2 : false;
}

@@ -85,3 +94,3 @@ function CreateMicroTaskEnqueueFn() {

function requestIdleCallbackPolyfill(callback) {
return W.setTimeout(callback, 0);
return W === null || W === void 0 ? void 0 : W.setTimeout(callback, 0);
}

@@ -94,9 +103,9 @@ /**

function supportsNativeIdleCallback(idleCallback) {
var _idleCallback$toStrin;
function supportsNativeIdleCallback(callback) {
var _callback$toString;
return ((_idleCallback$toStrin = idleCallback === null || idleCallback === void 0 ? void 0 : idleCallback.toString()) !== null && _idleCallback$toStrin !== void 0 ? _idleCallback$toStrin : '').indexOf('[native code]') !== -1;
return ((_callback$toString = callback === null || callback === void 0 ? void 0 : callback.toString()) !== null && _callback$toString !== void 0 ? _callback$toString : '').indexOf('[native code]') !== -1;
}
var requestIdleCallback = /*#__PURE__*/supportsNativeIdleCallback(W.requestIdleCallback) ? W.requestIdleCallback : requestIdleCallbackPolyfill;
var requestIdleCallback = /*#__PURE__*/supportsNativeIdleCallback(W === null || W === void 0 ? void 0 : W.requestIdleCallback) ? W.requestIdleCallback : requestIdleCallbackPolyfill;

@@ -307,3 +316,3 @@ function isSafari() {

// There is also no need to check for XMLHttpRequest support as we can assume that in order
// for search to work, it will have to be defined anyways or else nothing works.
// for search to work, it will have to be defined anyways or

@@ -650,3 +659,4 @@

if (!W && !options.requester) {
// Check if we are running in browser env, else show the warning
if (!isBrowserEnvironment()) {
console.warn("\n \uD83D\uDEA8Telemetry is not supported in non browser environments.\uD83D\uDEA8\n\n Please use a requester that is compliant with the environment you are running your application in.\n\n The value of window object was: " + W + "\n\n "); // @ts-ignore

@@ -653,0 +663,0 @@

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@algolia/requester-browser-xhr")):"function"==typeof define&&define.amd?define(["exports","@algolia/requester-browser-xhr"],n):n((e=e||self)["@algolia/algolia-browser-telemetry"]={},e.requesterBrowserXhr)}(this,(function(e,n){"use strict";var t=window,r=document;function o(e){var n;null===(n=t.Promise)||void 0===n||n.resolve().then(e)}function i(){return null!==(e=-1!==(null===(n=t.Promise)||void 0===n||null===(r=n.toString())||void 0===r?void 0:r.indexOf("[native code]")))&&void 0!==e&&e?o:null!==(i=-1!==(null===(u=t.MutationObserver)||void 0===u||null===(a=u.toString())||void 0===a?void 0:a.indexOf("[native code]")))&&void 0!==i&&i?function(){if(!t.MutationObserver)return function(e){return e()};var e=[],n=new t.MutationObserver((function(){e.forEach((function(e){return e()})),e=[]})),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(n){e.push(n),r.data=String(1)}}():function(e){return e()};var e,n,r,i,u,a}var u=i();function a(e){var n;return-1!==(null!==(n=null==e?void 0:e.toString())&&void 0!==n?n:"").indexOf("[native code]")}var c=a(t.requestIdleCallback)?t.requestIdleCallback:function(e){return t.setTimeout(e,0)};function s(){return!("object"!=typeof t.safari||!t.safari.pushNotification)}function l(e){if(!e.capacity||"number"!=typeof e.capacity)throw new Error("IdleQueue requires capacity number initializer");if(!e.onFlush||"function"!=typeof e.onFlush)throw new Error("IdleQueue requires onFlush function initializer");var n=[],o=[];function i(){var t=n.shift();t&&(o.push(t()),o.length>=e.capacity&&a())}function a(){if(o.length){for(var n=[];o.length>0;){var t=o.shift();t&&n.push(t)}u((function(){return e.onFlush(n)}))}}function l(){for(;n.length;){var e=n.shift();e&&o.push(e())}a()}function f(){"hidden"===r.visibilityState&&l()}return r.addEventListener("visibilitychange",f,!0),s()&&t.addEventListener("beforeunload",l,!0),{size:function(){return n.length},enqueue:function(e){n.push(e),"hidden"===r.visibilityState?u(i):c(i)},destroy:function(){r.removeEventListener("visibilitychange",f),s()&&t.removeEventListener("beforeunload",l),l()},results:o}}var f="https://telemetry.algolia.com/1/collector";function d(e){return null!==(n="function"==typeof(null==t||null===(r=t.navigator)||void 0===r?void 0:r.sendBeacon))&&void 0!==n&&n?t.navigator.sendBeacon(f,JSON.stringify(e)):-1!==(null!==(o=null===(i=t.fetch)||void 0===i?void 0:i.toString())&&void 0!==o?o:"").indexOf("[native code]")?(function(e){t.fetch(f,{method:"POST",body:JSON.stringify(e),keepalive:!0})}(e),!0):(function(e){var n=new t.XMLHttpRequest;n.open("POST",f),n.setRequestHeader("Content-Type","application/json;charset=UTF-8"),n.send(JSON.stringify(e))}(e),!1);var n,r,o,i}function v(e){return d({o:t.location.hostname||null,e:e})}function p(e){return d({o:t.location.hostname||null,d:e})}function y(e){return!(!function(e){return"xmlhttprequest"===e.initiatorType&&-1!==e.name.indexOf("algolia")}(e)||!/\/\/\w+-(dsn|[1-3]).algolia\.?net/.test(e.name)&&!function(e){return/\/\/([d|t|s|c][0-9]+)-\w+(-[0-9])?.algolia\.?net/.test(e)}(e.name))}function h(e){return e.split("?")[0]}function m(e,n){void 0===n&&(n=2);var t=Math.pow(10,n);return Math.round(e*t)/t}function b(e){return"number"==typeof e&&e>0}e.default=function(e){if(void 0===e&&(e={}),!t&&!e.requester)return console.warn("\n 🚨Telemetry is not supported in non browser environments.🚨\n\n Please use a requester that is compliant with the environment you are running your application in.\n\n The value of window object was: "+t+"\n\n "),{send:function(){return Promise.resolve()},destroy:function(){return null}};var r=function(e){if(void 0===e&&(e={}),void 0!==e.errorQueueCapacity&&!b(e.errorQueueCapacity))throw new Error('Invalid error queue capacity "'+e.errorQueueCapacity+'", queue capacity needs to be of type number.');if(void 0!==e.telemetryQueueCapacity&&!b(e.telemetryQueueCapacity))throw new Error('Invalid telemetry queue capacity "'+e.telemetryQueueCapacity+'", queue capacity needs to be of type number.');var n,r,o,i,u,a=e.reporter||{error:v,telemetry:p},c=l({capacity:e.errorQueueCapacity||4,onFlush:a.error}),s=l({capacity:e.telemetryQueueCapacity||10,onFlush:a.telemetry}),f=(n=function(e){s.enqueue((function(){return function(e){return{r:h(e.name),d:e.domainLookupEnd&&e.domainLookupStart?m(e.domainLookupEnd-e.domainLookupStart,0):0,t:e.requestStart&&e.responseEnd?m(e.responseEnd-e.requestStart,0):0,sz:e.transferSize?m((n=e.transferSize,n/1024),2):0,ts:(new Date).toISOString()};var n}(e)}))},-1!==(null===(o=null!==(i=null==(r=t.PerformanceObserver)?void 0:r.toString())&&void 0!==i?i:"")||void 0===o?void 0:o.indexOf("[native code]"))&&-1!==(null!==(u=null==r?void 0:r.supportedEntryTypes)&&void 0!==u?u:[]).indexOf("resource")?function(e){return new t.PerformanceObserver((function(n){n.getEntries().filter((function(e){return y(e)})).forEach((function(n){e(n)}))}))}(n):function(e){var n=0,r=[];function o(){return function(){return null!==(e="function"==typeof(null===(n=t.performance)||void 0===n?void 0:n.getEntriesByType))&&void 0!==e&&e?t.performance.getEntriesByType("resource").filter((function(e){return y(e)})):[];var e,n}().filter((function(e){return-1===r.indexOf(e)})).forEach((function(n){r.push(n),e(n)}))}return{observe:function(){o(),n=setInterval(o,2e3)},takeRecords:function(){var e=[].concat(r);return r=[],e},disconnect:function(){n&&(r=[],t.clearInterval(n))}}}(n));return f.observe({entryTypes:["resource"]}),{error:function(e,n){return c.enqueue((function(){return function(e,n){return{r:h(e.url),sc:n.status,m:n.content,to:n.isTimedOut?1:0,ts:(new Date).toISOString()}}(e,n)}))},destroy:function(){c.destroy(),s.destroy(),f.disconnect()}}}({reporter:e.reporter,telemetryQueueCapacity:e.telemetryQueueCapacity,errorQueueCapacity:e.errorQueueCapacity}),o=e.requester?e.requester:n.createBrowserXhrRequester();return{send:function(e){return o.send(e).then((function(n){return(n.status>=400||0===n.status||n.isTimedOut)&&r.error(e,n),n}))},destroy:r.destroy}},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@algolia/requester-browser-xhr")):"function"==typeof define&&define.amd?define(["exports","@algolia/requester-browser-xhr"],n):n((e=e||self)["@algolia/algolia-browser-telemetry"]={},e.requesterBrowserXhr)}(this,(function(e,n){"use strict";function t(){return"undefined"!=typeof window}var r=t(),o=r?window:void 0,i=r?document:void 0;function u(e){var n;null===(n=o.Promise)||void 0===n||n.resolve().then(e)}function a(){return null!==(e=-1!==(null==o||null===(n=o.Promise)||void 0===n||null===(t=n.toString())||void 0===t?void 0:t.indexOf("[native code]")))&&void 0!==e&&e?u:null!==(r=-1!==(null==o||null===(i=o.MutationObserver)||void 0===i||null===(a=i.toString())||void 0===a?void 0:a.indexOf("[native code]")))&&void 0!==r&&r?function(){if(!o.MutationObserver)return function(e){return e()};var e=[],n=new o.MutationObserver((function(){e.forEach((function(e){return e()})),e=[]})),t=document.createTextNode("");return n.observe(t,{characterData:!0}),function(n){e.push(n),t.data=String(1)}}():function(e){return e()};var e,n,t,r,i,a}var c=a();function l(e){var n;return-1!==(null!==(n=null==e?void 0:e.toString())&&void 0!==n?n:"").indexOf("[native code]")}var s=l(null==o?void 0:o.requestIdleCallback)?o.requestIdleCallback:function(e){return null==o?void 0:o.setTimeout(e,0)};function f(){return!("object"!=typeof o.safari||!o.safari.pushNotification)}function d(e){if(!e.capacity||"number"!=typeof e.capacity)throw new Error("IdleQueue requires capacity number initializer");if(!e.onFlush||"function"!=typeof e.onFlush)throw new Error("IdleQueue requires onFlush function initializer");var n=[],t=[];function r(){var r=n.shift();r&&(t.push(r()),t.length>=e.capacity&&u())}function u(){if(t.length){for(var n=[];t.length>0;){var r=t.shift();r&&n.push(r)}c((function(){return e.onFlush(n)}))}}function a(){for(;n.length;){var e=n.shift();e&&t.push(e())}u()}function l(){"hidden"===i.visibilityState&&a()}return i.addEventListener("visibilitychange",l,!0),f()&&o.addEventListener("beforeunload",a,!0),{size:function(){return n.length},enqueue:function(e){n.push(e),"hidden"===i.visibilityState?c(r):s(r)},destroy:function(){i.removeEventListener("visibilitychange",l),f()&&o.removeEventListener("beforeunload",a),a()},results:t}}var v="https://telemetry.algolia.com/1/collector";function p(e){return null!==(n="function"==typeof(null==o||null===(t=o.navigator)||void 0===t?void 0:t.sendBeacon))&&void 0!==n&&n?o.navigator.sendBeacon(v,JSON.stringify(e)):-1!==(null!==(r=null===(i=o.fetch)||void 0===i?void 0:i.toString())&&void 0!==r?r:"").indexOf("[native code]")?(function(e){o.fetch(v,{method:"POST",body:JSON.stringify(e),keepalive:!0})}(e),!0):(function(e){var n=new o.XMLHttpRequest;n.open("POST",v),n.setRequestHeader("Content-Type","application/json;charset=UTF-8"),n.send(JSON.stringify(e))}(e),!1);var n,t,r,i}function y(e){return p({o:o.location.hostname||null,e:e})}function h(e){return p({o:o.location.hostname||null,d:e})}function m(e){return!(!function(e){return"xmlhttprequest"===e.initiatorType&&-1!==e.name.indexOf("algolia")}(e)||!/\/\/\w+-(dsn|[1-3]).algolia\.?net/.test(e.name)&&!function(e){return/\/\/([d|t|s|c][0-9]+)-\w+(-[0-9])?.algolia\.?net/.test(e)}(e.name))}function b(e){return e.split("?")[0]}function g(e,n){void 0===n&&(n=2);var t=Math.pow(10,n);return Math.round(e*t)/t}function w(e){return"number"==typeof e&&e>0}e.default=function(e){if(void 0===e&&(e={}),!t())return console.warn("\n 🚨Telemetry is not supported in non browser environments.🚨\n\n Please use a requester that is compliant with the environment you are running your application in.\n\n The value of window object was: "+o+"\n\n "),{send:function(){return Promise.resolve()},destroy:function(){return null}};var r=function(e){if(void 0===e&&(e={}),void 0!==e.errorQueueCapacity&&!w(e.errorQueueCapacity))throw new Error('Invalid error queue capacity "'+e.errorQueueCapacity+'", queue capacity needs to be of type number.');if(void 0!==e.telemetryQueueCapacity&&!w(e.telemetryQueueCapacity))throw new Error('Invalid telemetry queue capacity "'+e.telemetryQueueCapacity+'", queue capacity needs to be of type number.');var n,t,r,i,u,a=e.reporter||{error:y,telemetry:h},c=d({capacity:e.errorQueueCapacity||4,onFlush:a.error}),l=d({capacity:e.telemetryQueueCapacity||10,onFlush:a.telemetry}),s=(n=function(e){l.enqueue((function(){return function(e){return{r:b(e.name),d:e.domainLookupEnd&&e.domainLookupStart?g(e.domainLookupEnd-e.domainLookupStart,0):0,t:e.requestStart&&e.responseEnd?g(e.responseEnd-e.requestStart,0):0,sz:e.transferSize?g((n=e.transferSize,n/1024),2):0,ts:(new Date).toISOString()};var n}(e)}))},-1!==(null===(r=null!==(i=null==(t=o.PerformanceObserver)?void 0:t.toString())&&void 0!==i?i:"")||void 0===r?void 0:r.indexOf("[native code]"))&&-1!==(null!==(u=null==t?void 0:t.supportedEntryTypes)&&void 0!==u?u:[]).indexOf("resource")?function(e){return new o.PerformanceObserver((function(n){n.getEntries().filter((function(e){return m(e)})).forEach((function(n){e(n)}))}))}(n):function(e){var n=0,t=[];function r(){return function(){return null!==(e="function"==typeof(null===(n=o.performance)||void 0===n?void 0:n.getEntriesByType))&&void 0!==e&&e?o.performance.getEntriesByType("resource").filter((function(e){return m(e)})):[];var e,n}().filter((function(e){return-1===t.indexOf(e)})).forEach((function(n){t.push(n),e(n)}))}return{observe:function(){r(),n=setInterval(r,2e3)},takeRecords:function(){var e=[].concat(t);return t=[],e},disconnect:function(){n&&(t=[],o.clearInterval(n))}}}(n));return s.observe({entryTypes:["resource"]}),{error:function(e,n){return c.enqueue((function(){return function(e,n){return{r:b(e.url),sc:n.status,m:n.content,to:n.isTimedOut?1:0,ts:(new Date).toISOString()}}(e,n)}))},destroy:function(){c.destroy(),l.destroy(),s.disconnect()}}}({reporter:e.reporter,telemetryQueueCapacity:e.telemetryQueueCapacity,errorQueueCapacity:e.errorQueueCapacity}),i=e.requester?e.requester:n.createBrowserXhrRequester();return{send:function(e){return i.send(e).then((function(n){return(n.status>=400||0===n.status||n.isTimedOut)&&r.error(e,n),n}))},destroy:r.destroy}},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=algolia-browser-telemetry.umd.production.min.js.map
{
"name": "@algolia/algolia-browser-telemetry",
"version": "0.1.1",
"version": "0.1.2",
"license": "MIT",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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