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

search-insights

Package Overview
Dependencies
Maintainers
8
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.2.3 to 2.3.0

9

CHANGELOG.md

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

# [2.3.0](https://github.com/algolia/search-insights.js/compare/v2.2.3...v2.3.0) (2023-02-16)
### Features
* **api:** expose window.AlgoliaAnalyticsObject if not yet set ([#390](https://github.com/algolia/search-insights.js/issues/390)) ([493eefd](https://github.com/algolia/search-insights.js/commit/493eefdb843629039e92e94fb14a67dd83b61bcc))
## [2.2.3](https://github.com/algolia/search-insights.js/compare/v2.2.1...v2.2.3) (2022-11-16)

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

2

dist/_createInsightsClient.d.ts

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

import { RequestFnType } from "./utils/request";
import { RequestFnType } from './utils/request';
export declare function createInsightsClient(requestFn: RequestFnType): import("./types").InsightsClient;

@@ -16,6 +16,6 @@ import { makeSendEvents } from "./_sendEvent";

};
declare type AlgoliaAnalyticsObject = Queue | AnalyticsFunction;
export declare type AlgoliaAnalyticsObject = Queue | AnalyticsFunction;
declare global {
interface Window {
AlgoliaAnalyticsObject: AlgoliaAnalyticsObject;
AlgoliaAnalyticsObject?: string;
}

@@ -22,0 +22,0 @@ }

@@ -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 r=n[o];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])}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 r,s,a=[];for(r in o)e.call(o,r)&&a.push(r);if(t)for(s=0;s<i;s++)e.call(o,n[s])&&a.push(n[s]);return a}))}function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}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};function makeSendEvents(e){return function(t){var n=this;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 i=t.map(function(e){var t,i,o=e.filters,r=__rest(e,["filters"]),s=Object.assign(Object.assign({},r),{userToken:(i=null===(t=e)||void 0===t?void 0:t.userToken,null!==i&&void 0!==i?i:n._userToken)});return isUndefined(o)||(s.filters=o.map(encodeURIComponent)),s});return sendRequest(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,i)}}}function sendRequest(e,t,n,i,o,r){return e(o+"/1/events?X-Algolia-Application-Id="+t+"&X-Algolia-API-Key="+n+"&X-Algolia-Agent="+encodeURIComponent(i.join("; ")),{events:r})}var version="2.2.3",DEFAULT_ALGOLIA_AGENTS=["insights-js ("+version+")","insights-js-browser-cjs ("+version+")"];function addAlgoliaAgent(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}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=[].concat(DEFAULT_ALGOLIA_AGENTS),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function getVersion(e){isFunction(e)&&e(this.version)}function addEventType(e,t){return t.map(function(t){return Object.assign({eventType:e},t)})}function clickedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("click",e))}function clickedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("click",e))}function clickedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("click",e))}function convertedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("conversion",e))}function convertedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("conversion",e))}function convertedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("conversion",e))}function viewedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("view",e))}function viewedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("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.version=version,this._hasCredentials=!1,this.sendEvents=makeSendEvents(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);if(!navigator.sendBeacon(e,n))return requestWithXMLHttpRequest(e,t)},requestWithXMLHttpRequest=function(e,t){var n=JSON.stringify(t),i=new XMLHttpRequest;i.open("POST",e),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+n.length),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;
"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 r=n[o];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])}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 r,s,a=[];for(r in o)e.call(o,r)&&a.push(r);if(t)for(s=0;s<i;s++)e.call(o,n[s])&&a.push(n[s]);return a}))}function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}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};function makeSendEvents(e){return function(t){var n=this;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 i=t.map(function(e){var t,i,o=e.filters,r=__rest(e,["filters"]),s=Object.assign(Object.assign({},r),{userToken:(i=null===(t=e)||void 0===t?void 0:t.userToken,null!==i&&void 0!==i?i:n._userToken)});return isUndefined(o)||(s.filters=o.map(encodeURIComponent)),s});return sendRequest(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,i)}}}function sendRequest(e,t,n,i,o,r){return e(o+"/1/events?X-Algolia-Application-Id="+t+"&X-Algolia-API-Key="+n+"&X-Algolia-Agent="+encodeURIComponent(i.join("; ")),{events:r})}var version="2.3.0",DEFAULT_ALGOLIA_AGENTS=["insights-js ("+version+")","insights-js-browser-cjs ("+version+")"];function addAlgoliaAgent(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}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=[].concat(DEFAULT_ALGOLIA_AGENTS),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function getVersion(e){isFunction(e)&&e(this.version)}function addEventType(e,t){return t.map(function(t){return Object.assign({eventType:e},t)})}function clickedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("click",e))}function clickedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("click",e))}function clickedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("click",e))}function convertedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("conversion",e))}function convertedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("conversion",e))}function convertedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("conversion",e))}function viewedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("view",e))}function viewedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("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.version=version,this._hasCredentials=!1,this.sendEvents=makeSendEvents(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);if(!navigator.sendBeacon(e,n))return requestWithXMLHttpRequest(e,t)},requestWithXMLHttpRequest=function(e,t){var n=JSON.stringify(t),i=new XMLHttpRequest;i.open("POST",e),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+n.length),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){var t=getFunctionalInterface(new AlgoliaAnalytics({requestFn:e}));if("object"==typeof window&&!window.AlgoliaAnalyticsObject){var n;do{n=createUUID()}while(void 0!==window[n]);window.AlgoliaAnalyticsObject=n,window[window.AlgoliaAnalyticsObject]=t}return t}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 r=n[o];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])}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 r,s,a=[];for(r in o)e.call(o,r)&&a.push(r);if(t)for(s=0;s<i;s++)e.call(o,n[s])&&a.push(n[s]);return a}))}function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}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};function makeSendEvents(e){return function(t){var n=this;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 i=t.map(function(e){var t,i,o=e.filters,r=__rest(e,["filters"]),s=Object.assign(Object.assign({},r),{userToken:(i=null===(t=e)||void 0===t?void 0:t.userToken,null!==i&&void 0!==i?i:n._userToken)});return isUndefined(o)||(s.filters=o.map(encodeURIComponent)),s});return sendRequest(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,i)}}}function sendRequest(e,t,n,i,o,r){return e(o+"/1/events?X-Algolia-Application-Id="+t+"&X-Algolia-API-Key="+n+"&X-Algolia-Agent="+encodeURIComponent(i.join("; ")),{events:r})}var version="2.2.3",DEFAULT_ALGOLIA_AGENTS=["insights-js ("+version+")","insights-js-node-cjs ("+version+")"];function addAlgoliaAgent(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}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=[].concat(DEFAULT_ALGOLIA_AGENTS),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function getVersion(e){isFunction(e)&&e(this.version)}function addEventType(e,t){return t.map(function(t){return Object.assign({eventType:e},t)})}function clickedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("click",e))}function clickedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("click",e))}function clickedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("click",e))}function convertedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("conversion",e))}function convertedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("conversion",e))}function convertedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("conversion",e))}function viewedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("view",e))}function viewedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("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.version=version,this._hasCredentials=!1,this.sendEvents=makeSendEvents(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}},r=(0,(0===e.indexOf("https://")?require("https"):require("http")).request)(o);r.on("error",function(e){console.error(e)}),r.write(n),r.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;
"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 r=n[o];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])}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 r,s,a=[];for(r in o)e.call(o,r)&&a.push(r);if(t)for(s=0;s<i;s++)e.call(o,n[s])&&a.push(n[s]);return a}))}function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}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};function makeSendEvents(e){return function(t){var n=this;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 i=t.map(function(e){var t,i,o=e.filters,r=__rest(e,["filters"]),s=Object.assign(Object.assign({},r),{userToken:(i=null===(t=e)||void 0===t?void 0:t.userToken,null!==i&&void 0!==i?i:n._userToken)});return isUndefined(o)||(s.filters=o.map(encodeURIComponent)),s});return sendRequest(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,i)}}}function sendRequest(e,t,n,i,o,r){return e(o+"/1/events?X-Algolia-Application-Id="+t+"&X-Algolia-API-Key="+n+"&X-Algolia-Agent="+encodeURIComponent(i.join("; ")),{events:r})}var version="2.3.0",DEFAULT_ALGOLIA_AGENTS=["insights-js ("+version+")","insights-js-node-cjs ("+version+")"];function addAlgoliaAgent(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}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=[].concat(DEFAULT_ALGOLIA_AGENTS),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function getVersion(e){isFunction(e)&&e(this.version)}function addEventType(e,t){return t.map(function(t){return Object.assign({eventType:e},t)})}function clickedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("click",e))}function clickedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("click",e))}function clickedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("click",e))}function convertedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("conversion",e))}function convertedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("conversion",e))}function convertedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("conversion",e))}function viewedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("view",e))}function viewedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(addEventType("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.version=version,this._hasCredentials=!1,this.sendEvents=makeSendEvents(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}},r=(0,(0===e.indexOf("https://")?require("https"):require("http")).request)(o);r.on("error",function(e){console.error(e)}),r.write(n),r.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){var t=getFunctionalInterface(new AlgoliaAnalytics({requestFn:e}));if("object"==typeof window&&!window.AlgoliaAnalyticsObject){var n;do{n=createUUID()}while(void 0!==window[n]);window.AlgoliaAnalyticsObject=n,window[window.AlgoliaAnalyticsObject]=t}return t}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(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}},r=function(e){return void 0===e},o=function(e){return"string"==typeof e},s=function(e){return"number"==typeof e},a=function(e){return"function"==typeof e};function u(e){return function(n){var t=this;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 i=n.map(function(e){var n,i,o=e.filters,s=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)n.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(t[i[r]]=e[i[r]])}return t}(e,["filters"]),a=Object.assign(Object.assign({},s),{userToken:(i=null===(n=e)||void 0===n?void 0:n.userToken,null!==i&&void 0!==i?i:t._userToken)});return r(o)||(a.filters=o.map(encodeURIComponent)),a});return function(e,n,t,i,r,o){var s=encodeURIComponent(i.join("; "));return e(r+"/1/events?X-Algolia-Application-Id="+n+"&X-Algolia-API-Key="+t+"&X-Algolia-Agent="+s,{events:o})}(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,i)}}}var c=["insights-js (2.2.3)","insights-js-browser-iife (2.2.3)"];var h=["de","us"],l=2592e6;function f(e,n){return n.map(function(n){return Object.assign({eventType:e},n)})}var p,d,v,g,y=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)})},b="_ALGOLIA",k=function(e,n,t){var i=new Date;i.setTime(i.getTime()+t);var r="expires="+i.toUTCString();document.cookie=e+"="+n+";"+r+";path=/"},O=function(e){for(var n=e+"=",t=document.cookie.split(";"),i=0;i<t.length;i++){for(var r=t[i];" "===r.charAt(0);)r=r.substring(1);if(0===r.indexOf(n))return r.substring(n.length,r.length)}return""};Object.keys||(Object.keys=(p=Object.prototype.hasOwnProperty,d=!{toString:null}.propertyIsEnumerable("toString"),g=(v=["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)p.call(e,n)&&i.push(n);if(d)for(t=0;t<g;t++)p.call(e,v[t])&&i.push(v[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),r=1;r<arguments.length;r++){var o=t[r];if(null!=o)for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(i[s]=o[s])}return i});var w=function(e){var t=e.requestFn;this._ua=[],this.version="2.2.3",this._hasCredentials=!1,this.sendEvents=u(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(r(e.apiKey)||!o(e.apiKey))throw new Error("apiKey is missing, please provide it so we can authenticate the application");if(r(e.appId)||!o(e.appId))throw new Error("appId is missing, please provide it, so we can properly attribute data to your application");if(!r(e.region)&&-1===h.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+h.join(", ")+".");if(!(r(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*l,this._hasCredentials=!0,this._ua=[].concat(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.push(e)}.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=O(b);e&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(this.setUserToken("anonymous-"+y()),k(b,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(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return this.sendEvents(f("click",e))}.bind(this),this.clickedObjectIDs=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return this.sendEvents(f("click",e))}.bind(this),this.clickedFilters=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return this.sendEvents(f("click",e))}.bind(this),this.convertedObjectIDsAfterSearch=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return this.sendEvents(f("conversion",e))}.bind(this),this.convertedObjectIDs=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return this.sendEvents(f("conversion",e))}.bind(this),this.convertedFilters=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return this.sendEvents(f("conversion",e))}.bind(this),this.viewedObjectIDs=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return this.sendEvents(f("view",e))}.bind(this),this.viewedFilters=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return this.sendEvents(f("view",e))}.bind(this),this.getVersion=function(e){a(e)&&e(this.version)}.bind(this)},x=function(e,n){var t=JSON.stringify(n);if(!navigator.sendBeacon(e,t))return T(e,n)},T=function(e,n){var t=JSON.stringify(n),i=new XMLHttpRequest;i.open("POST",e),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+t.length),i.send(t)};function _(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.")}),r=e[t];r.queue=r.queue||[];var o=r.queue;o.forEach(function(e){var n=[].slice.call(e),t=n[0],r=n.slice(1);i.apply(void 0,[t].concat(r))}),o.push=function(e){var n=[].slice.call(e),t=n[0],r=n.slice(1);i.apply(void 0,[t].concat(r))}}}function j(e){var n=new w({requestFn:e});return"undefined"!=typeof window&&_.call(n,window),n}var m=j(function(){if(t())return x;if(i())return T;throw new Error("Could not find a supported HTTP request client in this environment.")}());return e.createInsightsClient=j,e.default=m,e}({});
var AlgoliaAnalytics=function(e){"use strict";var t=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},n=function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}},i=function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}},r=function(e){return void 0===e},o=function(e){return"string"==typeof e},s=function(e){return"number"==typeof e},a=function(e){return"function"==typeof e};function u(e){return function(t){var n=this;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 i=t.map(function(e){var t,i,o=e.filters,s=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(e,["filters"]),a=Object.assign(Object.assign({},s),{userToken:(i=null===(t=e)||void 0===t?void 0:t.userToken,null!==i&&void 0!==i?i:n._userToken)});return r(o)||(a.filters=o.map(encodeURIComponent)),a});return function(e,t,n,i,r,o){var s=encodeURIComponent(i.join("; "));return e(r+"/1/events?X-Algolia-Application-Id="+t+"&X-Algolia-API-Key="+n+"&X-Algolia-Agent="+s,{events:o})}(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,i)}}}var c=["insights-js (2.3.0)","insights-js-browser-iife (2.3.0)"];var h=["de","us"],l=2592e6;function f(e,t){return t.map(function(t){return Object.assign({eventType:e},t)})}var p,d,v,g,y=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)})},b="_ALGOLIA",k=function(e,t,n){var i=new Date;i.setTime(i.getTime()+n);var r="expires="+i.toUTCString();document.cookie=e+"="+t+";"+r+";path=/"},O=function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var r=n[i];" "===r.charAt(0);)r=r.substring(1);if(0===r.indexOf(t))return r.substring(t.length,r.length)}return""};Object.keys||(Object.keys=(p=Object.prototype.hasOwnProperty,d=!{toString:null}.propertyIsEnumerable("toString"),g=(v=["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 t,n,i=[];for(t in e)p.call(e,t)&&i.push(t);if(d)for(n=0;n<g;n++)p.call(e,v[n])&&i.push(v[n]);return i})),"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),r=1;r<arguments.length;r++){var o=n[r];if(null!=o)for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(i[s]=o[s])}return i});var w=function(e){var n=e.requestFn;this._ua=[],this.version="2.3.0",this._hasCredentials=!1,this.sendEvents=u(n).bind(this),this.init=function(e){var t;if(!e)throw new Error("Init function should be called with an object argument containing your apiKey and appId");if(r(e.apiKey)||!o(e.apiKey))throw new Error("apiKey is missing, please provide it so we can authenticate the application");if(r(e.appId)||!o(e.appId))throw new Error("appId is missing, please provide it, so we can properly attribute data to your application");if(!r(e.region)&&-1===h.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+h.join(", ")+".");if(!(r(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!==(t=e.useCookie)&&void 0!==t&&t,this._cookieDuration=e.cookieDuration?e.cookieDuration:6*l,this._hasCredentials=!0,this._ua=[].concat(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.push(e)}.bind(this),this.setUserToken=function(e){this._userToken=e,a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAnonymousUserToken=function(){if(t()){var e=O(b);e&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(this.setUserToken("anonymous-"+y()),k(b,this._userToken,this._cookieDuration))}}.bind(this),this.getUserToken=function(e,t){return a(t)&&t(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(e,t){this._onUserTokenChangeCallback=e,t&&t.immediate&&a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("click",e))}.bind(this),this.clickedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("click",e))}.bind(this),this.clickedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("click",e))}.bind(this),this.convertedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("conversion",e))}.bind(this),this.convertedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("conversion",e))}.bind(this),this.convertedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("conversion",e))}.bind(this),this.viewedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("view",e))}.bind(this),this.viewedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("view",e))}.bind(this),this.getVersion=function(e){a(e)&&e(this.version)}.bind(this)},x=function(e,t){var n=JSON.stringify(t);if(!navigator.sendBeacon(e,n))return T(e,t)},T=function(e,t){var n=JSON.stringify(t),i=new XMLHttpRequest;i.open("POST",e),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+n.length),i.send(n)};function _(e){var t,n=e.AlgoliaAnalyticsObject;if(n){var i=(t=this,function(e){for(var n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];e&&a(t[e])?t[e].apply(t,n):console.warn("The method `"+e+"` doesn't exist.")}),r=e[n];r.queue=r.queue||[];var o=r.queue;o.forEach(function(e){var t=[].slice.call(e),n=t[0],r=t.slice(1);i.apply(void 0,[n].concat(r))}),o.push=function(e){var t=[].slice.call(e),n=t[0],r=t.slice(1);i.apply(void 0,[n].concat(r))}}}function j(e){var t=new w({requestFn:e});return"object"==typeof window&&_.call(t,window),t}var m=j(function(){if(n())return x;if(i())return T;throw new Error("Could not find a supported HTTP request client in this environment.")}());return e.createInsightsClient=j,e.default=m,e}({});

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).AlgoliaAnalytics={})}(this,function(e){"use strict";var t=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},n=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};function u(e){return function(t){var n=this;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 i=t.map(function(e){var t,i,r=e.filters,s=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}(e,["filters"]),a=Object.assign(Object.assign({},s),{userToken:(i=null===(t=e)||void 0===t?void 0:t.userToken,null!==i&&void 0!==i?i:n._userToken)});return o(r)||(a.filters=r.map(encodeURIComponent)),a});return function(e,t,n,i,o,r){var s=encodeURIComponent(i.join("; "));return e(o+"/1/events?X-Algolia-Application-Id="+t+"&X-Algolia-API-Key="+n+"&X-Algolia-Agent="+s,{events:r})}(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,i)}}}var c=["insights-js (2.2.3)","insights-js-browser-umd (2.2.3)"];var h=["de","us"],l=2592e6;function f(e,t){return t.map(function(t){return Object.assign({eventType:e},t)})}var p,d,v,g,y=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)})},b="_ALGOLIA",k=function(e,t,n){var i=new Date;i.setTime(i.getTime()+n);var o="expires="+i.toUTCString();document.cookie=e+"="+t+";"+o+";path=/"},O=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""};Object.keys||(Object.keys=(p=Object.prototype.hasOwnProperty,d=!{toString:null}.propertyIsEnumerable("toString"),g=(v=["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 t,n,i=[];for(t in e)p.call(e,t)&&i.push(t);if(d)for(n=0;n<g;n++)p.call(e,v[n])&&i.push(v[n]);return i})),"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 r=n[o];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])}return i});var x=function(e){var n=e.requestFn;this._ua=[],this.version="2.2.3",this._hasCredentials=!1,this.sendEvents=u(n).bind(this),this.init=function(e){var t;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===h.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+h.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!==(t=e.useCookie)&&void 0!==t&&t,this._cookieDuration=e.cookieDuration?e.cookieDuration:6*l,this._hasCredentials=!0,this._ua=[].concat(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.push(e)}.bind(this),this.setUserToken=function(e){this._userToken=e,a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAnonymousUserToken=function(){if(t()){var e=O(b);e&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(this.setUserToken("anonymous-"+y()),k(b,this._userToken,this._cookieDuration))}}.bind(this),this.getUserToken=function(e,t){return a(t)&&t(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(e,t){this._onUserTokenChangeCallback=e,t&&t.immediate&&a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("click",e))}.bind(this),this.clickedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("click",e))}.bind(this),this.clickedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("click",e))}.bind(this),this.convertedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("conversion",e))}.bind(this),this.convertedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("conversion",e))}.bind(this),this.convertedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("conversion",e))}.bind(this),this.viewedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("view",e))}.bind(this),this.viewedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("view",e))}.bind(this),this.getVersion=function(e){a(e)&&e(this.version)}.bind(this)},w=function(e,t){var n=JSON.stringify(t);if(!navigator.sendBeacon(e,n))return _(e,t)},_=function(e,t){var n=JSON.stringify(t),i=new XMLHttpRequest;i.open("POST",e),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+n.length),i.send(n)};function T(e){var t,n=e.AlgoliaAnalyticsObject;if(n){var i=(t=this,function(e){for(var n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];e&&a(t[e])?t[e].apply(t,n):console.warn("The method `"+e+"` doesn't exist.")}),o=e[n];o.queue=o.queue||[];var r=o.queue;r.forEach(function(e){var t=[].slice.call(e),n=t[0],o=t.slice(1);i.apply(void 0,[n].concat(o))}),r.push=function(e){var t=[].slice.call(e),n=t[0],o=t.slice(1);i.apply(void 0,[n].concat(o))}}}function j(e){var t=new x({requestFn:e});return"undefined"!=typeof window&&T.call(t,window),t}var m=j(function(){if(n())return w;if(i())return _;throw new Error("Could not find a supported HTTP request client in this environment.")}());e.createInsightsClient=j,e.default=m,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).AlgoliaAnalytics={})}(this,function(e){"use strict";var t=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},n=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};function u(e){return function(t){var n=this;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 i=t.map(function(e){var t,i,r=e.filters,s=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}(e,["filters"]),a=Object.assign(Object.assign({},s),{userToken:(i=null===(t=e)||void 0===t?void 0:t.userToken,null!==i&&void 0!==i?i:n._userToken)});return o(r)||(a.filters=r.map(encodeURIComponent)),a});return function(e,t,n,i,o,r){var s=encodeURIComponent(i.join("; "));return e(o+"/1/events?X-Algolia-Application-Id="+t+"&X-Algolia-API-Key="+n+"&X-Algolia-Agent="+s,{events:r})}(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,i)}}}var c=["insights-js (2.3.0)","insights-js-browser-umd (2.3.0)"];var h=["de","us"],l=2592e6;function f(e,t){return t.map(function(t){return Object.assign({eventType:e},t)})}var p,d,v,g,y=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)})},b="_ALGOLIA",k=function(e,t,n){var i=new Date;i.setTime(i.getTime()+n);var o="expires="+i.toUTCString();document.cookie=e+"="+t+";"+o+";path=/"},O=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""};Object.keys||(Object.keys=(p=Object.prototype.hasOwnProperty,d=!{toString:null}.propertyIsEnumerable("toString"),g=(v=["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 t,n,i=[];for(t in e)p.call(e,t)&&i.push(t);if(d)for(n=0;n<g;n++)p.call(e,v[n])&&i.push(v[n]);return i})),"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 r=n[o];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])}return i});var x=function(e){var n=e.requestFn;this._ua=[],this.version="2.3.0",this._hasCredentials=!1,this.sendEvents=u(n).bind(this),this.init=function(e){var t;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===h.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+h.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!==(t=e.useCookie)&&void 0!==t&&t,this._cookieDuration=e.cookieDuration?e.cookieDuration:6*l,this._hasCredentials=!0,this._ua=[].concat(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.push(e)}.bind(this),this.setUserToken=function(e){this._userToken=e,a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAnonymousUserToken=function(){if(t()){var e=O(b);e&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(this.setUserToken("anonymous-"+y()),k(b,this._userToken,this._cookieDuration))}}.bind(this),this.getUserToken=function(e,t){return a(t)&&t(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(e,t){this._onUserTokenChangeCallback=e,t&&t.immediate&&a(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("click",e))}.bind(this),this.clickedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("click",e))}.bind(this),this.clickedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("click",e))}.bind(this),this.convertedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("conversion",e))}.bind(this),this.convertedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("conversion",e))}.bind(this),this.convertedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("conversion",e))}.bind(this),this.viewedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("view",e))}.bind(this),this.viewedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return this.sendEvents(f("view",e))}.bind(this),this.getVersion=function(e){a(e)&&e(this.version)}.bind(this)},w=function(e,t){var n=JSON.stringify(t);if(!navigator.sendBeacon(e,n))return _(e,t)},_=function(e,t){var n=JSON.stringify(t),i=new XMLHttpRequest;i.open("POST",e),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+n.length),i.send(n)};function T(e){var t,n=e.AlgoliaAnalyticsObject;if(n){var i=(t=this,function(e){for(var n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];e&&a(t[e])?t[e].apply(t,n):console.warn("The method `"+e+"` doesn't exist.")}),o=e[n];o.queue=o.queue||[];var r=o.queue;r.forEach(function(e){var t=[].slice.call(e),n=t[0],o=t.slice(1);i.apply(void 0,[n].concat(o))}),r.push=function(e){var t=[].slice.call(e),n=t[0],o=t.slice(1);i.apply(void 0,[n].concat(o))}}}function j(e){var t=new x({requestFn:e});return"object"==typeof window&&T.call(t,window),t}var m=j(function(){if(n())return w;if(i())return _;throw new Error("Could not find a supported HTTP request client in this environment.")}());e.createInsightsClient=j,e.default=m,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -1,7 +0,21 @@

import AlgoliaAnalytics from "./insights";
import { getFunctionalInterface } from "./_getFunctionalInterface";
import { RequestFnType } from "./utils/request";
import AlgoliaAnalytics from './insights';
import { getFunctionalInterface } from './_getFunctionalInterface';
import { RequestFnType } from './utils/request';
import { createUUID } from './utils/uuid';
export function createInsightsClient(requestFn: RequestFnType) {
return getFunctionalInterface(new AlgoliaAnalytics({ requestFn }));
const aa = getFunctionalInterface(new AlgoliaAnalytics({ requestFn }));
if (typeof window === 'object') {
if (!window.AlgoliaAnalyticsObject) {
let pointer: string;
do {
pointer = createUUID();
} while (window[pointer] !== undefined);
window.AlgoliaAnalyticsObject = pointer;
window[window.AlgoliaAnalyticsObject] = aa;
}
}
return aa;
}

@@ -8,3 +8,3 @@ import AlgoliaAnalytics from "./insights";

const instance = new AlgoliaAnalytics({ requestFn });
if (typeof window !== "undefined") {
if (typeof window === 'object') {
// Process queue upon script execution

@@ -11,0 +11,0 @@ processQueue.call(instance, window);

@@ -42,7 +42,7 @@ import objectAssignPolyfill from "./polyfills/objectAssign";

type AlgoliaAnalyticsObject = Queue | AnalyticsFunction;
export type AlgoliaAnalyticsObject = Queue | AnalyticsFunction;
declare global {
interface Window {
AlgoliaAnalyticsObject: AlgoliaAnalyticsObject;
AlgoliaAnalyticsObject?: string;
}

@@ -49,0 +49,0 @@ }

{
"name": "search-insights",
"description": "Library for reporting click, conversion and view metrics using the Algolia Insights API",
"version": "2.2.3",
"version": "2.3.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.2.3";
var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@2.3.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