Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

search-insights

Package Overview
Dependencies
Maintainers
5
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

search-insights - npm Package Compare versions

Comparing version 2.0.5 to 2.1.0

dist/_createInsightsClient.d.ts

9

CHANGELOG.md

@@ -0,1 +1,10 @@

# [2.1.0](https://github.com/algolia/search-insights.js/compare/v2.0.5...v2.1.0) (2021-10-26)
### Features
* export AlgoliaAnalytics, getFunctionalInterface and processQueue ([#333](https://github.com/algolia/search-insights.js/issues/333)) ([a95520b](https://github.com/algolia/search-insights.js/commit/a95520b7a17c07aa05ae735ac2c1d3c05a12b110))
## [2.0.5](https://github.com/algolia/search-insights.js/compare/v2.0.4...v2.0.5) (2021-10-18)

@@ -2,0 +11,0 @@

7

dist/entry-browser-cjs.d.ts

@@ -0,7 +1,8 @@

import AlgoliaAnalytics from "./insights";
import { getFunctionalInterface } from "./_getFunctionalInterface";
import { getRequesterForBrowser } from "./utils/getRequesterForBrowser";
import { RequestFnType } from "./utils/request";
export { getRequesterForBrowser };
import { processQueue } from "./_processQueue";
export { getRequesterForBrowser, AlgoliaAnalytics, getFunctionalInterface, processQueue };
export * from "./types";
export declare function createInsightsClient(requestFn: RequestFnType): import("./types").InsightsClient;
declare const _default: import("./types").InsightsClient;
export default _default;

@@ -0,7 +1,8 @@

import AlgoliaAnalytics from "./insights";
import { getFunctionalInterface } from "./_getFunctionalInterface";
import { getRequesterForNode } from "./utils/getRequesterForNode";
import { RequestFnType } from "./utils/request";
export { getRequesterForNode };
import { processQueue } from "./_processQueue";
export { getRequesterForNode, AlgoliaAnalytics, getFunctionalInterface, processQueue };
export * from "./types";
export declare function createInsightsClient(requestFn: RequestFnType): import("./types").InsightsClient;
declare const _default: import("./types").InsightsClient;
export default _default;

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

"use strict";function objectAssignPolyfill(){"function"!=typeof Object.assign&&(Object.assign=function(e,t){var n=arguments;if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(e),o=1;o<arguments.length;o++){var s=n[o];if(null!=s)for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(i[r]=s[r])}return i})}function objectKeysPolyfill(){var e,t,n,i;Object.keys||(Object.keys=(e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),i=(n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(o){if("function"!=typeof o&&("object"!=typeof o||null===o))throw new TypeError("Object.keys called on non-object");var s,r,a=[];for(s in o)e.call(o,s)&&a.push(s);if(t)for(r=0;r<i;r++)e.call(o,n[r])&&a.push(n[r]);return a}))}function makeSendEvent(e){return function(t,n){var i,o;if(!this._userHasOptedOut){if(!this._hasCredentials)throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters");var s=Object.assign(Object.assign({},n),{eventType:t,userToken:(o=null===(i=n)||void 0===i?void 0:i.userToken,null!==o&&void 0!==o?o:this._userToken)});return bulkSendEvent(e,this._appId,this._apiKey,this._uaURIEncoded,this._endpointOrigin,[s])}}}function bulkSendEvent(e,t,n,i,o,s){return e(o+"/1/events?X-Algolia-Application-Id="+t+"&X-Algolia-API-Key="+n+"&X-Algolia-Agent="+i,{events:s})}Object.defineProperty(exports,"__esModule",{value:!0});var supportsCookies=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},supportsSendBeacon=function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}},supportsXMLHttpRequest=function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}},isUndefined=function(e){return void 0===e},isString=function(e){return"string"==typeof e},isNumber=function(e){return"number"==typeof e},isFunction=function(e){return"function"==typeof e},version="2.0.5",DEFAULT_ALGOLIA_AGENT="insights-js ("+version+")";function addAlgoliaAgent(e){-1===this._ua.indexOf("; "+e)&&(this._ua+="; "+e,this._uaURIEncoded=encodeURIComponent(this._ua))}var SUPPORTED_REGIONS=["de","us"],MONTH=2592e6;function init(e){var t;if(!e)throw new Error("Init function should be called with an object argument containing your apiKey and appId");if(isUndefined(e.apiKey)||!isString(e.apiKey))throw new Error("apiKey is missing, please provide it so we can authenticate the application");if(isUndefined(e.appId)||!isString(e.appId))throw new Error("appId is missing, please provide it, so we can properly attribute data to your application");if(!isUndefined(e.region)&&-1===SUPPORTED_REGIONS.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+SUPPORTED_REGIONS.join(", ")+".");if(!(isUndefined(e.cookieDuration)||isNumber(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");"development"===process.env.NODE_ENV&&console.info("Since v2.0.4, search-insights no longer validates event payloads.\nYou can visit https://algolia.com/events/debugger instead."),this._apiKey=e.apiKey,this._appId=e.appId,this._userHasOptedOut=!!e.userHasOptedOut,this._region=e.region,this._endpointOrigin=e.region?"https://insights."+e.region+".algolia.io":"https://insights.algolia.io",this._useCookie=null!==(t=e.useCookie)&&void 0!==t&&t,this._cookieDuration=e.cookieDuration?e.cookieDuration:6*MONTH,this._hasCredentials=!0,this._ua=DEFAULT_ALGOLIA_AGENT,this._uaURIEncoded=encodeURIComponent(DEFAULT_ALGOLIA_AGENT),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function getVersion(e){isFunction(e)&&e(this.version)}function clickedObjectIDsAfterSearch(e){this.sendEvent("click",e)}function clickedObjectIDs(e){this.sendEvent("click",e)}function clickedFilters(e){this.sendEvent("click",e)}function convertedObjectIDsAfterSearch(e){this.sendEvent("conversion",e)}function convertedObjectIDs(e){this.sendEvent("conversion",e)}function convertedFilters(e){this.sendEvent("conversion",e)}function viewedObjectIDs(e){this.sendEvent("view",e)}function viewedFilters(e){this.sendEvent("view",e)}var createUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},COOKIE_KEY="_ALGOLIA",setCookie=function(e,t,n){var i=new Date;i.setTime(i.getTime()+n);var o="expires="+i.toUTCString();document.cookie=e+"="+t+";"+o+";path=/"},getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var o=n[i];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""};function setAnonymousUserToken(){if(supportsCookies()){var e=getCookie(COOKIE_KEY);e&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(this.setUserToken("anonymous-"+createUUID()),setCookie(COOKIE_KEY,this._userToken,this._cookieDuration))}}function setUserToken(e){this._userToken=e,isFunction(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}function getUserToken(e,t){return isFunction(t)&&t(null,this._userToken),this._userToken}function onUserTokenChange(e,t){this._onUserTokenChangeCallback=e,t&&t.immediate&&isFunction(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}objectKeysPolyfill(),objectAssignPolyfill();var AlgoliaAnalytics=function(e){var t=e.requestFn;this._ua="",this._uaURIEncoded="",this.version=version,this._hasCredentials=!1,this.sendEvent=makeSendEvent(t).bind(this),this.init=init.bind(this),this.addAlgoliaAgent=addAlgoliaAgent.bind(this),this.setUserToken=setUserToken.bind(this),this.setAnonymousUserToken=setAnonymousUserToken.bind(this),this.getUserToken=getUserToken.bind(this),this.onUserTokenChange=onUserTokenChange.bind(this),this.clickedObjectIDsAfterSearch=clickedObjectIDsAfterSearch.bind(this),this.clickedObjectIDs=clickedObjectIDs.bind(this),this.clickedFilters=clickedFilters.bind(this),this.convertedObjectIDsAfterSearch=convertedObjectIDsAfterSearch.bind(this),this.convertedObjectIDs=convertedObjectIDs.bind(this),this.convertedFilters=convertedFilters.bind(this),this.viewedObjectIDs=viewedObjectIDs.bind(this),this.viewedFilters=viewedFilters.bind(this),this.getVersion=getVersion.bind(this)};function getFunctionalInterface(e){return function(t){for(var n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];t&&isFunction(e[t])?e[t].apply(e,n):console.warn("The method `"+t+"` doesn't exist.")}}var requestWithSendBeacon=function(e,t){var n=JSON.stringify(t);navigator.sendBeacon(e,n)},requestWithXMLHttpRequest=function(e,t){var n=JSON.stringify(t),i=new XMLHttpRequest;i.open("POST",e),i.send(n)};function getRequesterForBrowser(){if(supportsSendBeacon())return requestWithSendBeacon;if(supportsXMLHttpRequest())return requestWithXMLHttpRequest;throw new Error("Could not find a supported HTTP request client in this environment.")}function createInsightsClient(e){return getFunctionalInterface(new AlgoliaAnalytics({requestFn:e}))}var entryBrowserCjs=createInsightsClient(getRequesterForBrowser());exports.createInsightsClient=createInsightsClient,exports.default=entryBrowserCjs,exports.getRequesterForBrowser=getRequesterForBrowser;
"use strict";function objectAssignPolyfill(){"function"!=typeof Object.assign&&(Object.assign=function(e,t){var n=arguments;if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(e),o=1;o<arguments.length;o++){var s=n[o];if(null!=s)for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(i[r]=s[r])}return i})}function objectKeysPolyfill(){var e,t,n,i;Object.keys||(Object.keys=(e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),i=(n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(o){if("function"!=typeof o&&("object"!=typeof o||null===o))throw new TypeError("Object.keys called on non-object");var s,r,c=[];for(s in o)e.call(o,s)&&c.push(s);if(t)for(r=0;r<i;r++)e.call(o,n[r])&&c.push(n[r]);return c}))}function makeSendEvent(e){return function(t,n){var i,o;if(!this._userHasOptedOut){if(!this._hasCredentials)throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters");var s=Object.assign(Object.assign({},n),{eventType:t,userToken:(o=null===(i=n)||void 0===i?void 0:i.userToken,null!==o&&void 0!==o?o:this._userToken)});return bulkSendEvent(e,this._appId,this._apiKey,this._uaURIEncoded,this._endpointOrigin,[s])}}}function bulkSendEvent(e,t,n,i,o,s){return e(o+"/1/events?X-Algolia-Application-Id="+t+"&X-Algolia-API-Key="+n+"&X-Algolia-Agent="+i,{events:s})}Object.defineProperty(exports,"__esModule",{value:!0});var supportsCookies=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},supportsSendBeacon=function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}},supportsXMLHttpRequest=function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}},isUndefined=function(e){return void 0===e},isString=function(e){return"string"==typeof e},isNumber=function(e){return"number"==typeof e},isFunction=function(e){return"function"==typeof e},version="2.1.0",DEFAULT_ALGOLIA_AGENT="insights-js ("+version+")";function addAlgoliaAgent(e){-1===this._ua.indexOf("; "+e)&&(this._ua+="; "+e,this._uaURIEncoded=encodeURIComponent(this._ua))}var SUPPORTED_REGIONS=["de","us"],MONTH=2592e6;function init(e){var t;if(!e)throw new Error("Init function should be called with an object argument containing your apiKey and appId");if(isUndefined(e.apiKey)||!isString(e.apiKey))throw new Error("apiKey is missing, please provide it so we can authenticate the application");if(isUndefined(e.appId)||!isString(e.appId))throw new Error("appId is missing, please provide it, so we can properly attribute data to your application");if(!isUndefined(e.region)&&-1===SUPPORTED_REGIONS.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+SUPPORTED_REGIONS.join(", ")+".");if(!(isUndefined(e.cookieDuration)||isNumber(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");"development"===process.env.NODE_ENV&&console.info("Since v2.0.4, search-insights no longer validates event payloads.\nYou can visit https://algolia.com/events/debugger instead."),this._apiKey=e.apiKey,this._appId=e.appId,this._userHasOptedOut=!!e.userHasOptedOut,this._region=e.region,this._endpointOrigin=e.region?"https://insights."+e.region+".algolia.io":"https://insights.algolia.io",this._useCookie=null!==(t=e.useCookie)&&void 0!==t&&t,this._cookieDuration=e.cookieDuration?e.cookieDuration:6*MONTH,this._hasCredentials=!0,this._ua=DEFAULT_ALGOLIA_AGENT,this._uaURIEncoded=encodeURIComponent(DEFAULT_ALGOLIA_AGENT),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function getVersion(e){isFunction(e)&&e(this.version)}function clickedObjectIDsAfterSearch(e){this.sendEvent("click",e)}function clickedObjectIDs(e){this.sendEvent("click",e)}function clickedFilters(e){this.sendEvent("click",e)}function convertedObjectIDsAfterSearch(e){this.sendEvent("conversion",e)}function convertedObjectIDs(e){this.sendEvent("conversion",e)}function convertedFilters(e){this.sendEvent("conversion",e)}function viewedObjectIDs(e){this.sendEvent("view",e)}function viewedFilters(e){this.sendEvent("view",e)}var createUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},COOKIE_KEY="_ALGOLIA",setCookie=function(e,t,n){var i=new Date;i.setTime(i.getTime()+n);var o="expires="+i.toUTCString();document.cookie=e+"="+t+";"+o+";path=/"},getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var o=n[i];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""};function setAnonymousUserToken(){if(supportsCookies()){var e=getCookie(COOKIE_KEY);e&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(this.setUserToken("anonymous-"+createUUID()),setCookie(COOKIE_KEY,this._userToken,this._cookieDuration))}}function setUserToken(e){this._userToken=e,isFunction(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}function getUserToken(e,t){return isFunction(t)&&t(null,this._userToken),this._userToken}function onUserTokenChange(e,t){this._onUserTokenChangeCallback=e,t&&t.immediate&&isFunction(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}objectKeysPolyfill(),objectAssignPolyfill();var AlgoliaAnalytics=function(e){var t=e.requestFn;this._ua="",this._uaURIEncoded="",this.version=version,this._hasCredentials=!1,this.sendEvent=makeSendEvent(t).bind(this),this.init=init.bind(this),this.addAlgoliaAgent=addAlgoliaAgent.bind(this),this.setUserToken=setUserToken.bind(this),this.setAnonymousUserToken=setAnonymousUserToken.bind(this),this.getUserToken=getUserToken.bind(this),this.onUserTokenChange=onUserTokenChange.bind(this),this.clickedObjectIDsAfterSearch=clickedObjectIDsAfterSearch.bind(this),this.clickedObjectIDs=clickedObjectIDs.bind(this),this.clickedFilters=clickedFilters.bind(this),this.convertedObjectIDsAfterSearch=convertedObjectIDsAfterSearch.bind(this),this.convertedObjectIDs=convertedObjectIDs.bind(this),this.convertedFilters=convertedFilters.bind(this),this.viewedObjectIDs=viewedObjectIDs.bind(this),this.viewedFilters=viewedFilters.bind(this),this.getVersion=getVersion.bind(this)};function getFunctionalInterface(e){return function(t){for(var n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];t&&isFunction(e[t])?e[t].apply(e,n):console.warn("The method `"+t+"` doesn't exist.")}}var requestWithSendBeacon=function(e,t){var n=JSON.stringify(t);navigator.sendBeacon(e,n)},requestWithXMLHttpRequest=function(e,t){var n=JSON.stringify(t),i=new XMLHttpRequest;i.open("POST",e),i.send(n)};function getRequesterForBrowser(){if(supportsSendBeacon())return requestWithSendBeacon;if(supportsXMLHttpRequest())return requestWithXMLHttpRequest;throw new Error("Could not find a supported HTTP request client in this environment.")}function processQueue(e){var t=e.AlgoliaAnalyticsObject;if(t){var n=getFunctionalInterface(this),i=e[t];i.queue=i.queue||[];var o=i.queue;o.forEach(function(e){var t=[].slice.call(e),i=t[0],o=t.slice(1);n.apply(void 0,[i].concat(o))}),o.push=function(e){var t=[].slice.call(e),i=t[0],o=t.slice(1);n.apply(void 0,[i].concat(o))}}}function createInsightsClient(e){return getFunctionalInterface(new AlgoliaAnalytics({requestFn:e}))}var entryBrowserCjs=createInsightsClient(getRequesterForBrowser());exports.AlgoliaAnalytics=AlgoliaAnalytics,exports.default=entryBrowserCjs,exports.getFunctionalInterface=getFunctionalInterface,exports.getRequesterForBrowser=getRequesterForBrowser,exports.processQueue=processQueue;

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

"use strict";function objectAssignPolyfill(){"function"!=typeof Object.assign&&(Object.assign=function(e,t){var n=arguments;if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(e),o=1;o<arguments.length;o++){var s=n[o];if(null!=s)for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(i[r]=s[r])}return i})}function objectKeysPolyfill(){var e,t,n,i;Object.keys||(Object.keys=(e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),i=(n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(o){if("function"!=typeof o&&("object"!=typeof o||null===o))throw new TypeError("Object.keys called on non-object");var s,r,a=[];for(s in o)e.call(o,s)&&a.push(s);if(t)for(r=0;r<i;r++)e.call(o,n[r])&&a.push(n[r]);return a}))}function makeSendEvent(e){return function(t,n){var i,o;if(!this._userHasOptedOut){if(!this._hasCredentials)throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters");var s=Object.assign(Object.assign({},n),{eventType:t,userToken:(o=null===(i=n)||void 0===i?void 0:i.userToken,null!==o&&void 0!==o?o:this._userToken)});return bulkSendEvent(e,this._appId,this._apiKey,this._uaURIEncoded,this._endpointOrigin,[s])}}}function bulkSendEvent(e,t,n,i,o,s){return e(o+"/1/events?X-Algolia-Application-Id="+t+"&X-Algolia-API-Key="+n+"&X-Algolia-Agent="+i,{events:s})}Object.defineProperty(exports,"__esModule",{value:!0});var supportsCookies=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},supportsNodeHttpModule=function(){try{var e=require("http").request,t=require("https").request;return Boolean(e)&&Boolean(t)}catch(e){return!1}},isUndefined=function(e){return void 0===e},isString=function(e){return"string"==typeof e},isNumber=function(e){return"number"==typeof e},isFunction=function(e){return"function"==typeof e},version="2.0.5",DEFAULT_ALGOLIA_AGENT="insights-js ("+version+")";function addAlgoliaAgent(e){-1===this._ua.indexOf("; "+e)&&(this._ua+="; "+e,this._uaURIEncoded=encodeURIComponent(this._ua))}var SUPPORTED_REGIONS=["de","us"],MONTH=2592e6;function init(e){var t;if(!e)throw new Error("Init function should be called with an object argument containing your apiKey and appId");if(isUndefined(e.apiKey)||!isString(e.apiKey))throw new Error("apiKey is missing, please provide it so we can authenticate the application");if(isUndefined(e.appId)||!isString(e.appId))throw new Error("appId is missing, please provide it, so we can properly attribute data to your application");if(!isUndefined(e.region)&&-1===SUPPORTED_REGIONS.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+SUPPORTED_REGIONS.join(", ")+".");if(!(isUndefined(e.cookieDuration)||isNumber(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");"development"===process.env.NODE_ENV&&console.info("Since v2.0.4, search-insights no longer validates event payloads.\nYou can visit https://algolia.com/events/debugger instead."),this._apiKey=e.apiKey,this._appId=e.appId,this._userHasOptedOut=!!e.userHasOptedOut,this._region=e.region,this._endpointOrigin=e.region?"https://insights."+e.region+".algolia.io":"https://insights.algolia.io",this._useCookie=null!==(t=e.useCookie)&&void 0!==t&&t,this._cookieDuration=e.cookieDuration?e.cookieDuration:6*MONTH,this._hasCredentials=!0,this._ua=DEFAULT_ALGOLIA_AGENT,this._uaURIEncoded=encodeURIComponent(DEFAULT_ALGOLIA_AGENT),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function getVersion(e){isFunction(e)&&e(this.version)}function clickedObjectIDsAfterSearch(e){this.sendEvent("click",e)}function clickedObjectIDs(e){this.sendEvent("click",e)}function clickedFilters(e){this.sendEvent("click",e)}function convertedObjectIDsAfterSearch(e){this.sendEvent("conversion",e)}function convertedObjectIDs(e){this.sendEvent("conversion",e)}function convertedFilters(e){this.sendEvent("conversion",e)}function viewedObjectIDs(e){this.sendEvent("view",e)}function viewedFilters(e){this.sendEvent("view",e)}var createUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},COOKIE_KEY="_ALGOLIA",setCookie=function(e,t,n){var i=new Date;i.setTime(i.getTime()+n);var o="expires="+i.toUTCString();document.cookie=e+"="+t+";"+o+";path=/"},getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var o=n[i];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""};function setAnonymousUserToken(){if(supportsCookies()){var e=getCookie(COOKIE_KEY);e&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(this.setUserToken("anonymous-"+createUUID()),setCookie(COOKIE_KEY,this._userToken,this._cookieDuration))}}function setUserToken(e){this._userToken=e,isFunction(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}function getUserToken(e,t){return isFunction(t)&&t(null,this._userToken),this._userToken}function onUserTokenChange(e,t){this._onUserTokenChangeCallback=e,t&&t.immediate&&isFunction(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}objectKeysPolyfill(),objectAssignPolyfill();var AlgoliaAnalytics=function(e){var t=e.requestFn;this._ua="",this._uaURIEncoded="",this.version=version,this._hasCredentials=!1,this.sendEvent=makeSendEvent(t).bind(this),this.init=init.bind(this),this.addAlgoliaAgent=addAlgoliaAgent.bind(this),this.setUserToken=setUserToken.bind(this),this.setAnonymousUserToken=setAnonymousUserToken.bind(this),this.getUserToken=getUserToken.bind(this),this.onUserTokenChange=onUserTokenChange.bind(this),this.clickedObjectIDsAfterSearch=clickedObjectIDsAfterSearch.bind(this),this.clickedObjectIDs=clickedObjectIDs.bind(this),this.clickedFilters=clickedFilters.bind(this),this.convertedObjectIDsAfterSearch=convertedObjectIDsAfterSearch.bind(this),this.convertedObjectIDs=convertedObjectIDs.bind(this),this.convertedFilters=convertedFilters.bind(this),this.viewedObjectIDs=viewedObjectIDs.bind(this),this.viewedFilters=viewedFilters.bind(this),this.getVersion=getVersion.bind(this)};function getFunctionalInterface(e){return function(t){for(var n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];t&&isFunction(e[t])?e[t].apply(e,n):console.warn("The method `"+t+"` doesn't exist.")}}var requestWithNodeHttpModule=function(e,t){var n=JSON.stringify(t),i=require("url").parse(e),o={protocol:i.protocol,host:i.host,path:i.path,method:"POST",headers:{"Content-Type":"application/json","Content-Length":n.length}},s=(0,(0===e.indexOf("https://")?require("https"):require("http")).request)(o);s.on("error",function(e){console.error(e)}),s.write(n),s.end()};function getRequesterForNode(){if(supportsNodeHttpModule())return requestWithNodeHttpModule;throw new Error("Could not find a supported HTTP request client in this environment.")}function createInsightsClient(e){return getFunctionalInterface(new AlgoliaAnalytics({requestFn:e}))}var entryNodeCjs=createInsightsClient(getRequesterForNode());exports.createInsightsClient=createInsightsClient,exports.default=entryNodeCjs,exports.getRequesterForNode=getRequesterForNode;
"use strict";function objectAssignPolyfill(){"function"!=typeof Object.assign&&(Object.assign=function(e,t){var n=arguments;if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(e),o=1;o<arguments.length;o++){var s=n[o];if(null!=s)for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(i[r]=s[r])}return i})}function objectKeysPolyfill(){var e,t,n,i;Object.keys||(Object.keys=(e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),i=(n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(o){if("function"!=typeof o&&("object"!=typeof o||null===o))throw new TypeError("Object.keys called on non-object");var s,r,c=[];for(s in o)e.call(o,s)&&c.push(s);if(t)for(r=0;r<i;r++)e.call(o,n[r])&&c.push(n[r]);return c}))}function makeSendEvent(e){return function(t,n){var i,o;if(!this._userHasOptedOut){if(!this._hasCredentials)throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters");var s=Object.assign(Object.assign({},n),{eventType:t,userToken:(o=null===(i=n)||void 0===i?void 0:i.userToken,null!==o&&void 0!==o?o:this._userToken)});return bulkSendEvent(e,this._appId,this._apiKey,this._uaURIEncoded,this._endpointOrigin,[s])}}}function bulkSendEvent(e,t,n,i,o,s){return e(o+"/1/events?X-Algolia-Application-Id="+t+"&X-Algolia-API-Key="+n+"&X-Algolia-Agent="+i,{events:s})}Object.defineProperty(exports,"__esModule",{value:!0});var supportsCookies=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},supportsNodeHttpModule=function(){try{var e=require("http").request,t=require("https").request;return Boolean(e)&&Boolean(t)}catch(e){return!1}},isUndefined=function(e){return void 0===e},isString=function(e){return"string"==typeof e},isNumber=function(e){return"number"==typeof e},isFunction=function(e){return"function"==typeof e},version="2.1.0",DEFAULT_ALGOLIA_AGENT="insights-js ("+version+")";function addAlgoliaAgent(e){-1===this._ua.indexOf("; "+e)&&(this._ua+="; "+e,this._uaURIEncoded=encodeURIComponent(this._ua))}var SUPPORTED_REGIONS=["de","us"],MONTH=2592e6;function init(e){var t;if(!e)throw new Error("Init function should be called with an object argument containing your apiKey and appId");if(isUndefined(e.apiKey)||!isString(e.apiKey))throw new Error("apiKey is missing, please provide it so we can authenticate the application");if(isUndefined(e.appId)||!isString(e.appId))throw new Error("appId is missing, please provide it, so we can properly attribute data to your application");if(!isUndefined(e.region)&&-1===SUPPORTED_REGIONS.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+SUPPORTED_REGIONS.join(", ")+".");if(!(isUndefined(e.cookieDuration)||isNumber(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");"development"===process.env.NODE_ENV&&console.info("Since v2.0.4, search-insights no longer validates event payloads.\nYou can visit https://algolia.com/events/debugger instead."),this._apiKey=e.apiKey,this._appId=e.appId,this._userHasOptedOut=!!e.userHasOptedOut,this._region=e.region,this._endpointOrigin=e.region?"https://insights."+e.region+".algolia.io":"https://insights.algolia.io",this._useCookie=null!==(t=e.useCookie)&&void 0!==t&&t,this._cookieDuration=e.cookieDuration?e.cookieDuration:6*MONTH,this._hasCredentials=!0,this._ua=DEFAULT_ALGOLIA_AGENT,this._uaURIEncoded=encodeURIComponent(DEFAULT_ALGOLIA_AGENT),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function getVersion(e){isFunction(e)&&e(this.version)}function clickedObjectIDsAfterSearch(e){this.sendEvent("click",e)}function clickedObjectIDs(e){this.sendEvent("click",e)}function clickedFilters(e){this.sendEvent("click",e)}function convertedObjectIDsAfterSearch(e){this.sendEvent("conversion",e)}function convertedObjectIDs(e){this.sendEvent("conversion",e)}function convertedFilters(e){this.sendEvent("conversion",e)}function viewedObjectIDs(e){this.sendEvent("view",e)}function viewedFilters(e){this.sendEvent("view",e)}var createUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},COOKIE_KEY="_ALGOLIA",setCookie=function(e,t,n){var i=new Date;i.setTime(i.getTime()+n);var o="expires="+i.toUTCString();document.cookie=e+"="+t+";"+o+";path=/"},getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var o=n[i];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""};function setAnonymousUserToken(){if(supportsCookies()){var e=getCookie(COOKIE_KEY);e&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(this.setUserToken("anonymous-"+createUUID()),setCookie(COOKIE_KEY,this._userToken,this._cookieDuration))}}function setUserToken(e){this._userToken=e,isFunction(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}function getUserToken(e,t){return isFunction(t)&&t(null,this._userToken),this._userToken}function onUserTokenChange(e,t){this._onUserTokenChangeCallback=e,t&&t.immediate&&isFunction(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}objectKeysPolyfill(),objectAssignPolyfill();var AlgoliaAnalytics=function(e){var t=e.requestFn;this._ua="",this._uaURIEncoded="",this.version=version,this._hasCredentials=!1,this.sendEvent=makeSendEvent(t).bind(this),this.init=init.bind(this),this.addAlgoliaAgent=addAlgoliaAgent.bind(this),this.setUserToken=setUserToken.bind(this),this.setAnonymousUserToken=setAnonymousUserToken.bind(this),this.getUserToken=getUserToken.bind(this),this.onUserTokenChange=onUserTokenChange.bind(this),this.clickedObjectIDsAfterSearch=clickedObjectIDsAfterSearch.bind(this),this.clickedObjectIDs=clickedObjectIDs.bind(this),this.clickedFilters=clickedFilters.bind(this),this.convertedObjectIDsAfterSearch=convertedObjectIDsAfterSearch.bind(this),this.convertedObjectIDs=convertedObjectIDs.bind(this),this.convertedFilters=convertedFilters.bind(this),this.viewedObjectIDs=viewedObjectIDs.bind(this),this.viewedFilters=viewedFilters.bind(this),this.getVersion=getVersion.bind(this)};function getFunctionalInterface(e){return function(t){for(var n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];t&&isFunction(e[t])?e[t].apply(e,n):console.warn("The method `"+t+"` doesn't exist.")}}var requestWithNodeHttpModule=function(e,t){var n=JSON.stringify(t),i=require("url").parse(e),o={protocol:i.protocol,host:i.host,path:i.path,method:"POST",headers:{"Content-Type":"application/json","Content-Length":n.length}},s=(0,(0===e.indexOf("https://")?require("https"):require("http")).request)(o);s.on("error",function(e){console.error(e)}),s.write(n),s.end()};function getRequesterForNode(){if(supportsNodeHttpModule())return requestWithNodeHttpModule;throw new Error("Could not find a supported HTTP request client in this environment.")}function processQueue(e){var t=e.AlgoliaAnalyticsObject;if(t){var n=getFunctionalInterface(this),i=e[t];i.queue=i.queue||[];var o=i.queue;o.forEach(function(e){var t=[].slice.call(e),i=t[0],o=t.slice(1);n.apply(void 0,[i].concat(o))}),o.push=function(e){var t=[].slice.call(e),i=t[0],o=t.slice(1);n.apply(void 0,[i].concat(o))}}}function createInsightsClient(e){return getFunctionalInterface(new AlgoliaAnalytics({requestFn:e}))}var entryNodeCjs=createInsightsClient(getRequesterForNode());exports.AlgoliaAnalytics=AlgoliaAnalytics,exports.default=entryNodeCjs,exports.getFunctionalInterface=getFunctionalInterface,exports.getRequesterForNode=getRequesterForNode,exports.processQueue=processQueue;

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

var AlgoliaAnalytics=function(n){"use strict";var e=function(){try{return Boolean(navigator.cookieEnabled)}catch(n){return!1}},t=function(){try{return Boolean(navigator.sendBeacon)}catch(n){return!1}},i=function(){try{return Boolean(XMLHttpRequest)}catch(n){return!1}},o=function(n){return void 0===n},r=function(n){return"string"==typeof n},s=function(n){return"number"==typeof n},a=function(n){return"function"==typeof n},c="insights-js (2.0.5)";var u=["de","us"],h=2592e6;var l,d,f,p,v=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var e=16*Math.random()|0;return("x"===n?e:3&e|8).toString(16)})},g="_ALGOLIA",k=function(n,e,t){var i=new Date;i.setTime(i.getTime()+t);var o="expires="+i.toUTCString();document.cookie=n+"="+e+";"+o+";path=/"},y=function(n){for(var e=n+"=",t=document.cookie.split(";"),i=0;i<t.length;i++){for(var o=t[i];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(e))return o.substring(e.length,o.length)}return""};Object.keys||(Object.keys=(l=Object.prototype.hasOwnProperty,d=!{toString:null}.propertyIsEnumerable("toString"),p=(f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(n){if("function"!=typeof n&&("object"!=typeof n||null===n))throw new TypeError("Object.keys called on non-object");var e,t,i=[];for(e in n)l.call(n,e)&&i.push(e);if(d)for(t=0;t<p;t++)l.call(n,f[t])&&i.push(f[t]);return i})),"function"!=typeof Object.assign&&(Object.assign=function(n,e){var t=arguments;if(null==n)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(n),o=1;o<arguments.length;o++){var r=t[o];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])}return i});var b=function(n){var t=n.requestFn;this._ua="",this._uaURIEncoded="",this.version="2.0.5",this._hasCredentials=!1,this.sendEvent=function(n){return function(e,t){var i,o;if(!this._userHasOptedOut){if(!this._hasCredentials)throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters");var r=Object.assign(Object.assign({},t),{eventType:e,userToken:(o=null===(i=t)||void 0===i?void 0:i.userToken,null!==o&&void 0!==o?o:this._userToken)});return function(n,e,t,i,o,r){return n(o+"/1/events?X-Algolia-Application-Id="+e+"&X-Algolia-API-Key="+t+"&X-Algolia-Agent="+i,{events:r})}(n,this._appId,this._apiKey,this._uaURIEncoded,this._endpointOrigin,[r])}}}(t).bind(this),this.init=function(n){var e;if(!n)throw new Error("Init function should be called with an object argument containing your apiKey and appId");if(o(n.apiKey)||!r(n.apiKey))throw new Error("apiKey is missing, please provide it so we can authenticate the application");if(o(n.appId)||!r(n.appId))throw new Error("appId is missing, please provide it, so we can properly attribute data to your application");if(!o(n.region)&&-1===u.indexOf(n.region))throw new Error("optional region is incorrect, please provide either one of: "+u.join(", ")+".");if(!(o(n.cookieDuration)||s(n.cookieDuration)&&isFinite(n.cookieDuration)&&Math.floor(n.cookieDuration)===n.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");this._apiKey=n.apiKey,this._appId=n.appId,this._userHasOptedOut=!!n.userHasOptedOut,this._region=n.region,this._endpointOrigin=n.region?"https://insights."+n.region+".algolia.io":"https://insights.algolia.io",this._useCookie=null!==(e=n.useCookie)&&void 0!==e&&e,this._cookieDuration=n.cookieDuration?n.cookieDuration:6*h,this._hasCredentials=!0,this._ua=c,this._uaURIEncoded=encodeURIComponent(c),n.userToken?this.setUserToken(n.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}.bind(this),this.addAlgoliaAgent=function(n){-1===this._ua.indexOf("; "+n)&&(this._ua+="; "+n,this._uaURIEncoded=encodeURIComponent(this._ua))}.bind(this),this.setUserToken=function(n){this._userToken=n,a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAnonymousUserToken=function(){if(e()){var n=y(g);n&&""!==n&&0===n.indexOf("anonymous-")?this.setUserToken(n):(this.setUserToken("anonymous-"+v()),k(g,this._userToken,this._cookieDuration))}}.bind(this),this.getUserToken=function(n,e){return a(e)&&e(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(n,e){this._onUserTokenChangeCallback=n,e&&e.immediate&&a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(n){this.sendEvent("click",n)}.bind(this),this.clickedObjectIDs=function(n){this.sendEvent("click",n)}.bind(this),this.clickedFilters=function(n){this.sendEvent("click",n)}.bind(this),this.convertedObjectIDsAfterSearch=function(n){this.sendEvent("conversion",n)}.bind(this),this.convertedObjectIDs=function(n){this.sendEvent("conversion",n)}.bind(this),this.convertedFilters=function(n){this.sendEvent("conversion",n)}.bind(this),this.viewedObjectIDs=function(n){this.sendEvent("view",n)}.bind(this),this.viewedFilters=function(n){this.sendEvent("view",n)}.bind(this),this.getVersion=function(n){a(n)&&n(this.version)}.bind(this)},_=function(n,e){var t=JSON.stringify(e);navigator.sendBeacon(n,t)},x=function(n,e){var t=JSON.stringify(e),i=new XMLHttpRequest;i.open("POST",n),i.send(t)};function O(n){var e,t=n.AlgoliaAnalyticsObject;if(t){var i=(e=this,function(n){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];n&&a(e[n])?e[n].apply(e,t):console.warn("The method `"+n+"` doesn't exist.")}),o=n[t];o.queue=o.queue||[];var r=o.queue;r.forEach(function(n){var e=[].slice.call(n),t=e[0],o=e.slice(1);i.apply(void 0,[t].concat(o))}),r.push=function(n){var e=[].slice.call(n),t=e[0],o=e.slice(1);i.apply(void 0,[t].concat(o))}}}function w(n){var e=new b({requestFn:n});return"undefined"!=typeof window&&O.call(e,window),e}var T=w(function(){if(t())return _;if(i())return x;throw new Error("Could not find a supported HTTP request client in this environment.")}());return n.createInsightsClient=w,n.default=T,n}({});
var AlgoliaAnalytics=function(n){"use strict";var e=function(){try{return Boolean(navigator.cookieEnabled)}catch(n){return!1}},t=function(){try{return Boolean(navigator.sendBeacon)}catch(n){return!1}},i=function(){try{return Boolean(XMLHttpRequest)}catch(n){return!1}},o=function(n){return void 0===n},r=function(n){return"string"==typeof n},s=function(n){return"number"==typeof n},a=function(n){return"function"==typeof n},c="insights-js (2.1.0)";var u=["de","us"],h=2592e6;var l,d,f,p,v=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var e=16*Math.random()|0;return("x"===n?e:3&e|8).toString(16)})},g="_ALGOLIA",k=function(n,e,t){var i=new Date;i.setTime(i.getTime()+t);var o="expires="+i.toUTCString();document.cookie=n+"="+e+";"+o+";path=/"},y=function(n){for(var e=n+"=",t=document.cookie.split(";"),i=0;i<t.length;i++){for(var o=t[i];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(e))return o.substring(e.length,o.length)}return""};Object.keys||(Object.keys=(l=Object.prototype.hasOwnProperty,d=!{toString:null}.propertyIsEnumerable("toString"),p=(f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(n){if("function"!=typeof n&&("object"!=typeof n||null===n))throw new TypeError("Object.keys called on non-object");var e,t,i=[];for(e in n)l.call(n,e)&&i.push(e);if(d)for(t=0;t<p;t++)l.call(n,f[t])&&i.push(f[t]);return i})),"function"!=typeof Object.assign&&(Object.assign=function(n,e){var t=arguments;if(null==n)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(n),o=1;o<arguments.length;o++){var r=t[o];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])}return i});var b=function(n){var t=n.requestFn;this._ua="",this._uaURIEncoded="",this.version="2.1.0",this._hasCredentials=!1,this.sendEvent=function(n){return function(e,t){var i,o;if(!this._userHasOptedOut){if(!this._hasCredentials)throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters");var r=Object.assign(Object.assign({},t),{eventType:e,userToken:(o=null===(i=t)||void 0===i?void 0:i.userToken,null!==o&&void 0!==o?o:this._userToken)});return function(n,e,t,i,o,r){return n(o+"/1/events?X-Algolia-Application-Id="+e+"&X-Algolia-API-Key="+t+"&X-Algolia-Agent="+i,{events:r})}(n,this._appId,this._apiKey,this._uaURIEncoded,this._endpointOrigin,[r])}}}(t).bind(this),this.init=function(n){var e;if(!n)throw new Error("Init function should be called with an object argument containing your apiKey and appId");if(o(n.apiKey)||!r(n.apiKey))throw new Error("apiKey is missing, please provide it so we can authenticate the application");if(o(n.appId)||!r(n.appId))throw new Error("appId is missing, please provide it, so we can properly attribute data to your application");if(!o(n.region)&&-1===u.indexOf(n.region))throw new Error("optional region is incorrect, please provide either one of: "+u.join(", ")+".");if(!(o(n.cookieDuration)||s(n.cookieDuration)&&isFinite(n.cookieDuration)&&Math.floor(n.cookieDuration)===n.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");this._apiKey=n.apiKey,this._appId=n.appId,this._userHasOptedOut=!!n.userHasOptedOut,this._region=n.region,this._endpointOrigin=n.region?"https://insights."+n.region+".algolia.io":"https://insights.algolia.io",this._useCookie=null!==(e=n.useCookie)&&void 0!==e&&e,this._cookieDuration=n.cookieDuration?n.cookieDuration:6*h,this._hasCredentials=!0,this._ua=c,this._uaURIEncoded=encodeURIComponent(c),n.userToken?this.setUserToken(n.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}.bind(this),this.addAlgoliaAgent=function(n){-1===this._ua.indexOf("; "+n)&&(this._ua+="; "+n,this._uaURIEncoded=encodeURIComponent(this._ua))}.bind(this),this.setUserToken=function(n){this._userToken=n,a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAnonymousUserToken=function(){if(e()){var n=y(g);n&&""!==n&&0===n.indexOf("anonymous-")?this.setUserToken(n):(this.setUserToken("anonymous-"+v()),k(g,this._userToken,this._cookieDuration))}}.bind(this),this.getUserToken=function(n,e){return a(e)&&e(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(n,e){this._onUserTokenChangeCallback=n,e&&e.immediate&&a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(n){this.sendEvent("click",n)}.bind(this),this.clickedObjectIDs=function(n){this.sendEvent("click",n)}.bind(this),this.clickedFilters=function(n){this.sendEvent("click",n)}.bind(this),this.convertedObjectIDsAfterSearch=function(n){this.sendEvent("conversion",n)}.bind(this),this.convertedObjectIDs=function(n){this.sendEvent("conversion",n)}.bind(this),this.convertedFilters=function(n){this.sendEvent("conversion",n)}.bind(this),this.viewedObjectIDs=function(n){this.sendEvent("view",n)}.bind(this),this.viewedFilters=function(n){this.sendEvent("view",n)}.bind(this),this.getVersion=function(n){a(n)&&n(this.version)}.bind(this)},_=function(n,e){var t=JSON.stringify(e);navigator.sendBeacon(n,t)},x=function(n,e){var t=JSON.stringify(e),i=new XMLHttpRequest;i.open("POST",n),i.send(t)};function O(n){var e,t=n.AlgoliaAnalyticsObject;if(t){var i=(e=this,function(n){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];n&&a(e[n])?e[n].apply(e,t):console.warn("The method `"+n+"` doesn't exist.")}),o=n[t];o.queue=o.queue||[];var r=o.queue;r.forEach(function(n){var e=[].slice.call(n),t=e[0],o=e.slice(1);i.apply(void 0,[t].concat(o))}),r.push=function(n){var e=[].slice.call(n),t=e[0],o=e.slice(1);i.apply(void 0,[t].concat(o))}}}function w(n){var e=new b({requestFn:n});return"undefined"!=typeof window&&O.call(e,window),e}var T=w(function(){if(t())return _;if(i())return x;throw new Error("Could not find a supported HTTP request client in this environment.")}());return n.createInsightsClient=w,n.default=T,n}({});

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).AlgoliaAnalytics={})}(this,function(e){"use strict";var n=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},t=function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}},i=function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}},o=function(e){return void 0===e},r=function(e){return"string"==typeof e},s=function(e){return"number"==typeof e},a=function(e){return"function"==typeof e},c="insights-js (2.0.5)";var u=["de","us"],h=2592e6;var l,d,f,p,v=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})},g="_ALGOLIA",y=function(e,n,t){var i=new Date;i.setTime(i.getTime()+t);var o="expires="+i.toUTCString();document.cookie=e+"="+n+";"+o+";path=/"},k=function(e){for(var n=e+"=",t=document.cookie.split(";"),i=0;i<t.length;i++){for(var o=t[i];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(n))return o.substring(n.length,o.length)}return""};Object.keys||(Object.keys=(l=Object.prototype.hasOwnProperty,d=!{toString:null}.propertyIsEnumerable("toString"),p=(f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(e){if("function"!=typeof e&&("object"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var n,t,i=[];for(n in e)l.call(e,n)&&i.push(n);if(d)for(t=0;t<p;t++)l.call(e,f[t])&&i.push(f[t]);return i})),"function"!=typeof Object.assign&&(Object.assign=function(e,n){var t=arguments;if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(e),o=1;o<arguments.length;o++){var r=t[o];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])}return i});var b=function(e){var t=e.requestFn;this._ua="",this._uaURIEncoded="",this.version="2.0.5",this._hasCredentials=!1,this.sendEvent=function(e){return function(n,t){var i,o;if(!this._userHasOptedOut){if(!this._hasCredentials)throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters");var r=Object.assign(Object.assign({},t),{eventType:n,userToken:(o=null===(i=t)||void 0===i?void 0:i.userToken,null!==o&&void 0!==o?o:this._userToken)});return function(e,n,t,i,o,r){return e(o+"/1/events?X-Algolia-Application-Id="+n+"&X-Algolia-API-Key="+t+"&X-Algolia-Agent="+i,{events:r})}(e,this._appId,this._apiKey,this._uaURIEncoded,this._endpointOrigin,[r])}}}(t).bind(this),this.init=function(e){var n;if(!e)throw new Error("Init function should be called with an object argument containing your apiKey and appId");if(o(e.apiKey)||!r(e.apiKey))throw new Error("apiKey is missing, please provide it so we can authenticate the application");if(o(e.appId)||!r(e.appId))throw new Error("appId is missing, please provide it, so we can properly attribute data to your application");if(!o(e.region)&&-1===u.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+u.join(", ")+".");if(!(o(e.cookieDuration)||s(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");this._apiKey=e.apiKey,this._appId=e.appId,this._userHasOptedOut=!!e.userHasOptedOut,this._region=e.region,this._endpointOrigin=e.region?"https://insights."+e.region+".algolia.io":"https://insights.algolia.io",this._useCookie=null!==(n=e.useCookie)&&void 0!==n&&n,this._cookieDuration=e.cookieDuration?e.cookieDuration:6*h,this._hasCredentials=!0,this._ua=c,this._uaURIEncoded=encodeURIComponent(c),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}.bind(this),this.addAlgoliaAgent=function(e){-1===this._ua.indexOf("; "+e)&&(this._ua+="; "+e,this._uaURIEncoded=encodeURIComponent(this._ua))}.bind(this),this.setUserToken=function(e){this._userToken=e,a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAnonymousUserToken=function(){if(n()){var e=k(g);e&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(this.setUserToken("anonymous-"+v()),y(g,this._userToken,this._cookieDuration))}}.bind(this),this.getUserToken=function(e,n){return a(n)&&n(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(e,n){this._onUserTokenChangeCallback=e,n&&n.immediate&&a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(e){this.sendEvent("click",e)}.bind(this),this.clickedObjectIDs=function(e){this.sendEvent("click",e)}.bind(this),this.clickedFilters=function(e){this.sendEvent("click",e)}.bind(this),this.convertedObjectIDsAfterSearch=function(e){this.sendEvent("conversion",e)}.bind(this),this.convertedObjectIDs=function(e){this.sendEvent("conversion",e)}.bind(this),this.convertedFilters=function(e){this.sendEvent("conversion",e)}.bind(this),this.viewedObjectIDs=function(e){this.sendEvent("view",e)}.bind(this),this.viewedFilters=function(e){this.sendEvent("view",e)}.bind(this),this.getVersion=function(e){a(e)&&e(this.version)}.bind(this)},x=function(e,n){var t=JSON.stringify(n);navigator.sendBeacon(e,t)},_=function(e,n){var t=JSON.stringify(n),i=new XMLHttpRequest;i.open("POST",e),i.send(t)};function O(e){var n,t=e.AlgoliaAnalyticsObject;if(t){var i=(n=this,function(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];e&&a(n[e])?n[e].apply(n,t):console.warn("The method `"+e+"` doesn't exist.")}),o=e[t];o.queue=o.queue||[];var r=o.queue;r.forEach(function(e){var n=[].slice.call(e),t=n[0],o=n.slice(1);i.apply(void 0,[t].concat(o))}),r.push=function(e){var n=[].slice.call(e),t=n[0],o=n.slice(1);i.apply(void 0,[t].concat(o))}}}function w(e){var n=new b({requestFn:e});return"undefined"!=typeof window&&O.call(n,window),n}var T=w(function(){if(t())return x;if(i())return _;throw new Error("Could not find a supported HTTP request client in this environment.")}());e.createInsightsClient=w,e.default=T,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).AlgoliaAnalytics={})}(this,function(e){"use strict";var n=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},t=function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}},i=function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}},o=function(e){return void 0===e},r=function(e){return"string"==typeof e},s=function(e){return"number"==typeof e},a=function(e){return"function"==typeof e},c="insights-js (2.1.0)";var u=["de","us"],h=2592e6;var l,d,f,p,v=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})},g="_ALGOLIA",y=function(e,n,t){var i=new Date;i.setTime(i.getTime()+t);var o="expires="+i.toUTCString();document.cookie=e+"="+n+";"+o+";path=/"},k=function(e){for(var n=e+"=",t=document.cookie.split(";"),i=0;i<t.length;i++){for(var o=t[i];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(n))return o.substring(n.length,o.length)}return""};Object.keys||(Object.keys=(l=Object.prototype.hasOwnProperty,d=!{toString:null}.propertyIsEnumerable("toString"),p=(f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(e){if("function"!=typeof e&&("object"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var n,t,i=[];for(n in e)l.call(e,n)&&i.push(n);if(d)for(t=0;t<p;t++)l.call(e,f[t])&&i.push(f[t]);return i})),"function"!=typeof Object.assign&&(Object.assign=function(e,n){var t=arguments;if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(e),o=1;o<arguments.length;o++){var r=t[o];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])}return i});var b=function(e){var t=e.requestFn;this._ua="",this._uaURIEncoded="",this.version="2.1.0",this._hasCredentials=!1,this.sendEvent=function(e){return function(n,t){var i,o;if(!this._userHasOptedOut){if(!this._hasCredentials)throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters");var r=Object.assign(Object.assign({},t),{eventType:n,userToken:(o=null===(i=t)||void 0===i?void 0:i.userToken,null!==o&&void 0!==o?o:this._userToken)});return function(e,n,t,i,o,r){return e(o+"/1/events?X-Algolia-Application-Id="+n+"&X-Algolia-API-Key="+t+"&X-Algolia-Agent="+i,{events:r})}(e,this._appId,this._apiKey,this._uaURIEncoded,this._endpointOrigin,[r])}}}(t).bind(this),this.init=function(e){var n;if(!e)throw new Error("Init function should be called with an object argument containing your apiKey and appId");if(o(e.apiKey)||!r(e.apiKey))throw new Error("apiKey is missing, please provide it so we can authenticate the application");if(o(e.appId)||!r(e.appId))throw new Error("appId is missing, please provide it, so we can properly attribute data to your application");if(!o(e.region)&&-1===u.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+u.join(", ")+".");if(!(o(e.cookieDuration)||s(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");this._apiKey=e.apiKey,this._appId=e.appId,this._userHasOptedOut=!!e.userHasOptedOut,this._region=e.region,this._endpointOrigin=e.region?"https://insights."+e.region+".algolia.io":"https://insights.algolia.io",this._useCookie=null!==(n=e.useCookie)&&void 0!==n&&n,this._cookieDuration=e.cookieDuration?e.cookieDuration:6*h,this._hasCredentials=!0,this._ua=c,this._uaURIEncoded=encodeURIComponent(c),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}.bind(this),this.addAlgoliaAgent=function(e){-1===this._ua.indexOf("; "+e)&&(this._ua+="; "+e,this._uaURIEncoded=encodeURIComponent(this._ua))}.bind(this),this.setUserToken=function(e){this._userToken=e,a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAnonymousUserToken=function(){if(n()){var e=k(g);e&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(this.setUserToken("anonymous-"+v()),y(g,this._userToken,this._cookieDuration))}}.bind(this),this.getUserToken=function(e,n){return a(n)&&n(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(e,n){this._onUserTokenChangeCallback=e,n&&n.immediate&&a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(e){this.sendEvent("click",e)}.bind(this),this.clickedObjectIDs=function(e){this.sendEvent("click",e)}.bind(this),this.clickedFilters=function(e){this.sendEvent("click",e)}.bind(this),this.convertedObjectIDsAfterSearch=function(e){this.sendEvent("conversion",e)}.bind(this),this.convertedObjectIDs=function(e){this.sendEvent("conversion",e)}.bind(this),this.convertedFilters=function(e){this.sendEvent("conversion",e)}.bind(this),this.viewedObjectIDs=function(e){this.sendEvent("view",e)}.bind(this),this.viewedFilters=function(e){this.sendEvent("view",e)}.bind(this),this.getVersion=function(e){a(e)&&e(this.version)}.bind(this)},x=function(e,n){var t=JSON.stringify(n);navigator.sendBeacon(e,t)},_=function(e,n){var t=JSON.stringify(n),i=new XMLHttpRequest;i.open("POST",e),i.send(t)};function O(e){var n,t=e.AlgoliaAnalyticsObject;if(t){var i=(n=this,function(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];e&&a(n[e])?n[e].apply(n,t):console.warn("The method `"+e+"` doesn't exist.")}),o=e[t];o.queue=o.queue||[];var r=o.queue;r.forEach(function(e){var n=[].slice.call(e),t=n[0],o=n.slice(1);i.apply(void 0,[t].concat(o))}),r.push=function(e){var n=[].slice.call(e),t=n[0],o=n.slice(1);i.apply(void 0,[t].concat(o))}}}function w(e){var n=new b({requestFn:e});return"undefined"!=typeof window&&O.call(n,window),n}var T=w(function(){if(t())return x;if(i())return _;throw new Error("Could not find a supported HTTP request client in this environment.")}());e.createInsightsClient=w,e.default=T,Object.defineProperty(e,"__esModule",{value:!0})});
import AlgoliaAnalytics from "./insights";
import { getFunctionalInterface } from "./_getFunctionalInterface";
import { getRequesterForBrowser } from "./utils/getRequesterForBrowser";
import { RequestFnType } from "./utils/request";
import { processQueue } from "./_processQueue";
import { createInsightsClient } from "./_createInsightsClient";
export { getRequesterForBrowser };
export {
getRequesterForBrowser,
AlgoliaAnalytics,
getFunctionalInterface,
processQueue
};
export * from "./types";
export function createInsightsClient(requestFn: RequestFnType) {
return getFunctionalInterface(new AlgoliaAnalytics({ requestFn }));
}
export default createInsightsClient(getRequesterForBrowser());
import AlgoliaAnalytics from "./insights";
import { getFunctionalInterface } from "./_getFunctionalInterface";
import { getRequesterForNode } from "./utils/getRequesterForNode";
import { RequestFnType } from "./utils/request";
import { processQueue } from "./_processQueue";
import { createInsightsClient } from "./_createInsightsClient";
export { getRequesterForNode };
export {
getRequesterForNode,
AlgoliaAnalytics,
getFunctionalInterface,
processQueue
};
export * from "./types";
export function createInsightsClient(requestFn: RequestFnType) {
return getFunctionalInterface(new AlgoliaAnalytics({ requestFn }));
}
export default createInsightsClient(getRequesterForNode());
{
"name": "search-insights",
"description": "Library for reporting click, conversion and view metrics using the Algolia Insights API",
"version": "2.0.5",
"version": "2.1.0",
"jsdelivr": "dist/search-insights.min.js",

@@ -6,0 +6,0 @@ "main": "index-node.cjs.js",

@@ -51,3 +51,3 @@ # Search Insights

<script>
var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@2.0.5";
var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@2.1.0";

@@ -54,0 +54,0 @@ !function(e,a,t,n,s,i,c){e.AlgoliaAnalyticsObject=s,e[s]=e[s]||function(){

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc