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

search-insights

Package Overview
Dependencies
Maintainers
7
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.5.0 to 2.6.0

14

CHANGELOG.md

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

# [2.6.0](https://github.com/algolia/search-insights.js/compare/v2.5.0...v2.6.0) (2023-04-20)
### Bug Fixes
* **readme:** update code snippet to reflect version ([#445](https://github.com/algolia/search-insights.js/issues/445)) ([edd2b3a](https://github.com/algolia/search-insights.js/commit/edd2b3a5f388201c0acee06a85f8f316f5ef7416))
### Features
* **userToken:** generate in-memory anonymous user tokens by default ([#441](https://github.com/algolia/search-insights.js/issues/441)) ([161c933](https://github.com/algolia/search-insights.js/commit/161c933253a4a1cb88d61fe9d907cb93005db2e4))
# [2.5.0](https://github.com/algolia/search-insights.js/compare/v2.4.0...v2.5.0) (2023-04-19)

@@ -2,0 +16,0 @@

2

dist/_tokenUtils.d.ts
export declare const MONTH: number;
export declare const getCookie: (name: string) => string;
export declare function setAnonymousUserToken(): void;
export declare function setAnonymousUserToken(inMemory?: boolean): void;
export declare function setUserToken(userToken: string | number): void;

@@ -5,0 +5,0 @@ export declare function getUserToken(options?: any, callback?: (err: any, userToken: string) => void): string;

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

userHasOptedOut?: boolean;
anonymousUserToken?: boolean;
useCookie?: boolean;

@@ -9,0 +10,0 @@ cookieDuration?: number;

@@ -31,2 +31,3 @@ import { makeSendEvents } from "./_sendEvent";

_endpointOrigin: string;
_anonymousUserToken: boolean;
_userToken: string;

@@ -33,0 +34,0 @@ _userHasOptedOut: boolean;

@@ -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}function extractAdditionalParams(e){return e.reduce(function(e,t){var n=e.events,i=e.additionalParams;return"index"in t?{additionalParams:i,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void 0})}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},isNumber=function(e){return"number"==typeof e},isFunction=function(e){return"function"==typeof e};function makeSendEvents(e){return function(t,n){var i,o,r,s=this;if(!this._userHasOptedOut){if(!(!isUndefined(this._apiKey)&&!isUndefined(this._appId)||(null===(i=n)||void 0===i?void 0:i.headers["X-Algolia-Application-Id"])&&(null===(o=n)||void 0===o?void 0:o.headers["X-Algolia-API-Key"])))throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters or provide custom credentials in additional parameters.");var a=t.map(function(e){var t,n,i=e.filters,o=__rest(e,["filters"]),r=Object.assign(Object.assign({},o),{userToken:(n=null===(t=e)||void 0===t?void 0:t.userToken,null!==n&&void 0!==n?n:s._userToken)});return isUndefined(i)||(r.filters=i.map(encodeURIComponent)),r});return sendRequest(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,a,null===(r=n)||void 0===r?void 0:r.headers)}}}function sendRequest(e,t,n,i,o,r,s){void 0===s&&(s={});var a=Object.assign({"X-Algolia-Application-Id":t,"X-Algolia-API-Key":n,"X-Algolia-Agent":encodeURIComponent(i.join("; "))},s);return e(o+"/1/events?"+Object.keys(a).map(function(e){return e+"="+a[e]}).join("&"),{events:r})}var version="2.5.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 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",MONTH=2592e6,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)}objectAssignPolyfill();var SUPPORTED_REGIONS=["de","us"];function init(e){var t;if(void 0===e&&(e={}),!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."),setOptions(this,e,{_userHasOptedOut:!!e.userHasOptedOut,_region:e.region,_host:e.host,_useCookie:(t=e.useCookie,null!==t&&void 0!==t&&t),_cookieDuration:e.cookieDuration||6*MONTH}),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(DEFAULT_ALGOLIA_AGENTS),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function setOptions(e,t,n){var i=t.partial,o=__rest(t,["partial"]);i||Object.assign(e,n),Object.assign(e,Object.keys(o).reduce(function(e,t){var n;return Object.assign(Object.assign({},e),((n={})["_"+t]=o[t],n))},{}))}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];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("click",i),o)}function clickedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("click",i),o)}function clickedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("click",i),o)}function convertedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("conversion",i),o)}function convertedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("conversion",i),o)}function convertedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("conversion",i),o)}function viewedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("view",i),o)}function viewedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("view",i),o)}objectKeysPolyfill(),objectAssignPolyfill();var AlgoliaAnalytics=function(e){var t=e.requestFn;this._endpointOrigin="https://insights.algolia.io",this._userHasOptedOut=!1,this._useCookie=!1,this._cookieDuration=6*MONTH,this._ua=[],this.version=version,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.version=version,t}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 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 __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}function extractAdditionalParams(e){return e.reduce(function(e,t){var n=e.events,i=e.additionalParams;return"index"in t?{additionalParams:i,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void 0})}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},isNumber=function(e){return"number"==typeof e},isFunction=function(e){return"function"==typeof e};function makeSendEvents(e){return function(t,n){var i,o,s,r=this;if(!this._userHasOptedOut){if(!(!isUndefined(this._apiKey)&&!isUndefined(this._appId)||(null===(i=n)||void 0===i?void 0:i.headers["X-Algolia-Application-Id"])&&(null===(o=n)||void 0===o?void 0:o.headers["X-Algolia-API-Key"])))throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters or provide custom credentials in additional parameters.");!this._userToken&&this._anonymousUserToken&&this.setAnonymousUserToken(!0);var a=t.map(function(e){var t,n,i=e.filters,o=__rest(e,["filters"]),s=Object.assign(Object.assign({},o),{userToken:(n=null===(t=e)||void 0===t?void 0:t.userToken,null!==n&&void 0!==n?n:r._userToken)});return isUndefined(i)||(s.filters=i.map(encodeURIComponent)),s});return sendRequest(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,a,null===(s=n)||void 0===s?void 0:s.headers)}}}function sendRequest(e,t,n,i,o,s,r){void 0===r&&(r={});var a=Object.assign({"X-Algolia-Application-Id":t,"X-Algolia-API-Key":n,"X-Algolia-Agent":encodeURIComponent(i.join("; "))},r);return e(o+"/1/events?"+Object.keys(a).map(function(e){return e+"="+a[e]}).join("&"),{events:s})}var version="2.6.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 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",MONTH=2592e6,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(e){if(void 0===e&&(e=!1),e)this.setUserToken("anonymous-"+createUUID());else if(supportsCookies()){var t=getCookie(COOKIE_KEY);t&&""!==t&&0===t.indexOf("anonymous-")?this.setUserToken(t):(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)}objectAssignPolyfill();var SUPPORTED_REGIONS=["de","us"];function init(e){var t,n;if(void 0===e&&(e={}),!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."),setOptions(this,e,{_userHasOptedOut:!!e.userHasOptedOut,_region:e.region,_host:e.host,_anonymousUserToken:(t=e.anonymousUserToken,null===t||void 0===t||t),_useCookie:(n=e.useCookie,null!==n&&void 0!==n&&n),_cookieDuration:e.cookieDuration||6*MONTH}),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(DEFAULT_ALGOLIA_AGENTS),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function setOptions(e,t,n){var i=t.partial,o=__rest(t,["partial"]);i||Object.assign(e,n),Object.assign(e,Object.keys(o).reduce(function(e,t){var n;return Object.assign(Object.assign({},e),((n={})["_"+t]=o[t],n))},{}))}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];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("click",i),o)}function clickedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("click",i),o)}function clickedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("click",i),o)}function convertedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("conversion",i),o)}function convertedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("conversion",i),o)}function convertedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("conversion",i),o)}function viewedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("view",i),o)}function viewedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("view",i),o)}objectKeysPolyfill(),objectAssignPolyfill();var AlgoliaAnalytics=function(e){var t=e.requestFn;this._endpointOrigin="https://insights.algolia.io",this._anonymousUserToken=!0,this._userHasOptedOut=!1,this._useCookie=!1,this._cookieDuration=6*MONTH,this._ua=[],this.version=version,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.version=version,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}function extractAdditionalParams(e){return e.reduce(function(e,t){var n=e.events,i=e.additionalParams;return"index"in t?{additionalParams:i,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void 0})}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},isNumber=function(e){return"number"==typeof e},isFunction=function(e){return"function"==typeof e};function makeSendEvents(e){return function(t,n){var i,o,r,s=this;if(!this._userHasOptedOut){if(!(!isUndefined(this._apiKey)&&!isUndefined(this._appId)||(null===(i=n)||void 0===i?void 0:i.headers["X-Algolia-Application-Id"])&&(null===(o=n)||void 0===o?void 0:o.headers["X-Algolia-API-Key"])))throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters or provide custom credentials in additional parameters.");var a=t.map(function(e){var t,n,i=e.filters,o=__rest(e,["filters"]),r=Object.assign(Object.assign({},o),{userToken:(n=null===(t=e)||void 0===t?void 0:t.userToken,null!==n&&void 0!==n?n:s._userToken)});return isUndefined(i)||(r.filters=i.map(encodeURIComponent)),r});return sendRequest(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,a,null===(r=n)||void 0===r?void 0:r.headers)}}}function sendRequest(e,t,n,i,o,r,s){void 0===s&&(s={});var a=Object.assign({"X-Algolia-Application-Id":t,"X-Algolia-API-Key":n,"X-Algolia-Agent":encodeURIComponent(i.join("; "))},s);return e(o+"/1/events?"+Object.keys(a).map(function(e){return e+"="+a[e]}).join("&"),{events:r})}var version="2.5.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 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",MONTH=2592e6,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)}objectAssignPolyfill();var SUPPORTED_REGIONS=["de","us"];function init(e){var t;if(void 0===e&&(e={}),!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."),setOptions(this,e,{_userHasOptedOut:!!e.userHasOptedOut,_region:e.region,_host:e.host,_useCookie:(t=e.useCookie,null!==t&&void 0!==t&&t),_cookieDuration:e.cookieDuration||6*MONTH}),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(DEFAULT_ALGOLIA_AGENTS),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function setOptions(e,t,n){var i=t.partial,o=__rest(t,["partial"]);i||Object.assign(e,n),Object.assign(e,Object.keys(o).reduce(function(e,t){var n;return Object.assign(Object.assign({},e),((n={})["_"+t]=o[t],n))},{}))}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];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("click",i),o)}function clickedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("click",i),o)}function clickedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("click",i),o)}function convertedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("conversion",i),o)}function convertedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("conversion",i),o)}function convertedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("conversion",i),o)}function viewedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("view",i),o)}function viewedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("view",i),o)}objectKeysPolyfill(),objectAssignPolyfill();var AlgoliaAnalytics=function(e){var t=e.requestFn;this._endpointOrigin="https://insights.algolia.io",this._userHasOptedOut=!1,this._useCookie=!1,this._cookieDuration=6*MONTH,this._ua=[],this.version=version,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.version=version,t}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}function extractAdditionalParams(e){return e.reduce(function(e,t){var n=e.events,i=e.additionalParams;return"index"in t?{additionalParams:i,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void 0})}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},isNumber=function(e){return"number"==typeof e},isFunction=function(e){return"function"==typeof e};function makeSendEvents(e){return function(t,n){var i,o,r,s=this;if(!this._userHasOptedOut){if(!(!isUndefined(this._apiKey)&&!isUndefined(this._appId)||(null===(i=n)||void 0===i?void 0:i.headers["X-Algolia-Application-Id"])&&(null===(o=n)||void 0===o?void 0:o.headers["X-Algolia-API-Key"])))throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters or provide custom credentials in additional parameters.");!this._userToken&&this._anonymousUserToken&&this.setAnonymousUserToken(!0);var a=t.map(function(e){var t,n,i=e.filters,o=__rest(e,["filters"]),r=Object.assign(Object.assign({},o),{userToken:(n=null===(t=e)||void 0===t?void 0:t.userToken,null!==n&&void 0!==n?n:s._userToken)});return isUndefined(i)||(r.filters=i.map(encodeURIComponent)),r});return sendRequest(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,a,null===(r=n)||void 0===r?void 0:r.headers)}}}function sendRequest(e,t,n,i,o,r,s){void 0===s&&(s={});var a=Object.assign({"X-Algolia-Application-Id":t,"X-Algolia-API-Key":n,"X-Algolia-Agent":encodeURIComponent(i.join("; "))},s);return e(o+"/1/events?"+Object.keys(a).map(function(e){return e+"="+a[e]}).join("&"),{events:r})}var version="2.6.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 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",MONTH=2592e6,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(e){if(void 0===e&&(e=!1),e)this.setUserToken("anonymous-"+createUUID());else if(supportsCookies()){var t=getCookie(COOKIE_KEY);t&&""!==t&&0===t.indexOf("anonymous-")?this.setUserToken(t):(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)}objectAssignPolyfill();var SUPPORTED_REGIONS=["de","us"];function init(e){var t,n;if(void 0===e&&(e={}),!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."),setOptions(this,e,{_userHasOptedOut:!!e.userHasOptedOut,_region:e.region,_host:e.host,_anonymousUserToken:(t=e.anonymousUserToken,null===t||void 0===t||t),_useCookie:(n=e.useCookie,null!==n&&void 0!==n&&n),_cookieDuration:e.cookieDuration||6*MONTH}),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(DEFAULT_ALGOLIA_AGENTS),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function setOptions(e,t,n){var i=t.partial,o=__rest(t,["partial"]);i||Object.assign(e,n),Object.assign(e,Object.keys(o).reduce(function(e,t){var n;return Object.assign(Object.assign({},e),((n={})["_"+t]=o[t],n))},{}))}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];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("click",i),o)}function clickedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("click",i),o)}function clickedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("click",i),o)}function convertedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("conversion",i),o)}function convertedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("conversion",i),o)}function convertedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("conversion",i),o)}function viewedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("view",i),o)}function viewedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,o=n.additionalParams;return this.sendEvents(addEventType("view",i),o)}objectKeysPolyfill(),objectAssignPolyfill();var AlgoliaAnalytics=function(e){var t=e.requestFn;this._endpointOrigin="https://insights.algolia.io",this._anonymousUserToken=!0,this._userHasOptedOut=!1,this._useCookie=!1,this._cookieDuration=6*MONTH,this._ua=[],this.version=version,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.version=version,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(n){"use strict";function t(){"function"!=typeof Object.assign&&(Object.assign=function(n,t){var e=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=e[o];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])}return i})}function e(n,t){var e={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&t.indexOf(i)<0&&(e[i]=n[i]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(n);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(n,i[o])&&(e[i[o]]=n[i[o]])}return e}function i(n){return n.reduce(function(n,t){var e=n.events,i=n.additionalParams;return"index"in t?{additionalParams:i,events:e.concat([t])}:{events:e,additionalParams:t}},{events:[],additionalParams:void 0})}var o=function(){try{return Boolean(navigator.cookieEnabled)}catch(n){return!1}},r=function(){try{return Boolean(navigator.sendBeacon)}catch(n){return!1}},s=function(){try{return Boolean(XMLHttpRequest)}catch(n){return!1}},a=function(n){return void 0===n},u=function(n){return"number"==typeof n},c=function(n){return"function"==typeof n};function l(n){return function(t,i){var o,r,s,u=this;if(!this._userHasOptedOut){if(!(!a(this._apiKey)&&!a(this._appId)||(null===(o=i)||void 0===o?void 0:o.headers["X-Algolia-Application-Id"])&&(null===(r=i)||void 0===r?void 0:r.headers["X-Algolia-API-Key"])))throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters or provide custom credentials in additional parameters.");var c=t.map(function(n){var t,i,o=n.filters,r=e(n,["filters"]),s=Object.assign(Object.assign({},r),{userToken:(i=null===(t=n)||void 0===t?void 0:t.userToken,null!==i&&void 0!==i?i:u._userToken)});return a(o)||(s.filters=o.map(encodeURIComponent)),s});return function(n,t,e,i,o,r,s){void 0===s&&(s={});var a=Object.assign({"X-Algolia-Application-Id":t,"X-Algolia-API-Key":e,"X-Algolia-Agent":encodeURIComponent(i.join("; "))},s),u=Object.keys(a).map(function(n){return n+"="+a[n]}).join("&");return n(o+"/1/events?"+u,{events:r})}(n,this._appId,this._apiKey,this._ua,this._endpointOrigin,c,null===(s=i)||void 0===s?void 0:s.headers)}}}var h="2.5.0",d=["insights-js ("+h+")","insights-js-browser-iife ("+h+")"];var f=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=16*Math.random()|0;return("x"===n?t:3&t|8).toString(16)})},v="_ALGOLIA",p=2592e6,g=function(n,t,e){var i=new Date;i.setTime(i.getTime()+e);var o="expires="+i.toUTCString();document.cookie=n+"="+t+";"+o+";path=/"},b=function(n){for(var t=n+"=",e=document.cookie.split(";"),i=0;i<e.length;i++){for(var o=e[i];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""};t();var O,k,y,x,_=["de","us"];function m(n){var t;if(void 0===n&&(n={}),!a(n.region)&&-1===_.indexOf(n.region))throw new Error("optional region is incorrect, please provide either one of: "+_.join(", ")+".");if(!(a(n.cookieDuration)||u(n.cookieDuration)&&isFinite(n.cookieDuration)&&Math.floor(n.cookieDuration)===n.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");!function(n,t,i){var o=t.partial,r=e(t,["partial"]);o||Object.assign(n,i);Object.assign(n,Object.keys(r).reduce(function(n,t){var e;return Object.assign(Object.assign({},n),((e={})["_"+t]=r[t],e))},{}))}(this,n,{_userHasOptedOut:!!n.userHasOptedOut,_region:n.region,_host:n.host,_useCookie:(t=n.useCookie,null!==t&&void 0!==t&&t),_cookieDuration:n.cookieDuration||6*p}),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(d),n.userToken?this.setUserToken(n.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function j(n,t){return t.map(function(t){return Object.assign({eventType:n},t)})}Object.keys||(Object.keys=(O=Object.prototype.hasOwnProperty,k=!{toString:null}.propertyIsEnumerable("toString"),x=(y=["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 t,e,i=[];for(t in n)O.call(n,t)&&i.push(t);if(k)for(e=0;e<x;e++)O.call(n,y[e])&&i.push(y[e]);return i})),t();var T=function(n){var t=n.requestFn;this._endpointOrigin="https://insights.algolia.io",this._userHasOptedOut=!1,this._useCookie=!1,this._cookieDuration=6*p,this._ua=[],this.version=h,this.sendEvents=l(t).bind(this),this.init=m.bind(this),this.addAlgoliaAgent=function(n){-1===this._ua.indexOf(n)&&this._ua.push(n)}.bind(this),this.setUserToken=function(n){this._userToken=n,c(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAnonymousUserToken=function(){if(o()){var n=b(v);n&&""!==n&&0===n.indexOf("anonymous-")?this.setUserToken(n):(this.setUserToken("anonymous-"+f()),g(v,this._userToken,this._cookieDuration))}}.bind(this),this.getUserToken=function(n,t){return c(t)&&t(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(n,t){this._onUserTokenChangeCallback=n,t&&t.immediate&&c(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];var e=i(n),o=e.events,r=e.additionalParams;return this.sendEvents(j("click",o),r)}.bind(this),this.clickedObjectIDs=function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];var e=i(n),o=e.events,r=e.additionalParams;return this.sendEvents(j("click",o),r)}.bind(this),this.clickedFilters=function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];var e=i(n),o=e.events,r=e.additionalParams;return this.sendEvents(j("click",o),r)}.bind(this),this.convertedObjectIDsAfterSearch=function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];var e=i(n),o=e.events,r=e.additionalParams;return this.sendEvents(j("conversion",o),r)}.bind(this),this.convertedObjectIDs=function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];var e=i(n),o=e.events,r=e.additionalParams;return this.sendEvents(j("conversion",o),r)}.bind(this),this.convertedFilters=function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];var e=i(n),o=e.events,r=e.additionalParams;return this.sendEvents(j("conversion",o),r)}.bind(this),this.viewedObjectIDs=function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];var e=i(n),o=e.events,r=e.additionalParams;return this.sendEvents(j("view",o),r)}.bind(this),this.viewedFilters=function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];var e=i(n),o=e.events,r=e.additionalParams;return this.sendEvents(j("view",o),r)}.bind(this),this.getVersion=function(n){c(n)&&n(this.version)}.bind(this)},w=function(n,t){var e=JSON.stringify(t);if(!navigator.sendBeacon(n,e))return A(n,t)},A=function(n,t){var e=JSON.stringify(t),i=new XMLHttpRequest;i.open("POST",n),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+e.length),i.send(e)};function C(n){var t,e=n.AlgoliaAnalyticsObject;if(e){var i=(t=this,function(n){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];n&&c(t[n])?t[n].apply(t,e):console.warn("The method `"+n+"` doesn't exist.")}),o=n[e];o.queue=o.queue||[];var r=o.queue;r.forEach(function(n){var t=[].slice.call(n),e=t[0],o=t.slice(1);i.apply(void 0,[e].concat(o))}),r.push=function(n){var t=[].slice.call(n),e=t[0],o=t.slice(1);i.apply(void 0,[e].concat(o))}}}function P(n){var t=new T({requestFn:n});return"object"==typeof window&&C.call(t,window),t.version=h,t}var E=P(function(){if(r())return w;if(s())return A;throw new Error("Could not find a supported HTTP request client in this environment.")}());return n.createInsightsClient=P,n.default=E,n}({});
var AlgoliaAnalytics=function(n){"use strict";function e(){"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})}function t(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(n);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(n,i[o])&&(t[i[o]]=n[i[o]])}return t}function i(n){return n.reduce(function(n,e){var t=n.events,i=n.additionalParams;return"index"in e?{additionalParams:i,events:t.concat([e])}:{events:t,additionalParams:e}},{events:[],additionalParams:void 0})}var o=function(){try{return Boolean(navigator.cookieEnabled)}catch(n){return!1}},r=function(){try{return Boolean(navigator.sendBeacon)}catch(n){return!1}},s=function(){try{return Boolean(XMLHttpRequest)}catch(n){return!1}},a=function(n){return void 0===n},u=function(n){return"number"==typeof n},c=function(n){return"function"==typeof n};function l(n){return function(e,i){var o,r,s,u=this;if(!this._userHasOptedOut){if(!(!a(this._apiKey)&&!a(this._appId)||(null===(o=i)||void 0===o?void 0:o.headers["X-Algolia-Application-Id"])&&(null===(r=i)||void 0===r?void 0:r.headers["X-Algolia-API-Key"])))throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters or provide custom credentials in additional parameters.");!this._userToken&&this._anonymousUserToken&&this.setAnonymousUserToken(!0);var c=e.map(function(n){var e,i,o=n.filters,r=t(n,["filters"]),s=Object.assign(Object.assign({},r),{userToken:(i=null===(e=n)||void 0===e?void 0:e.userToken,null!==i&&void 0!==i?i:u._userToken)});return a(o)||(s.filters=o.map(encodeURIComponent)),s});return function(n,e,t,i,o,r,s){void 0===s&&(s={});var a=Object.assign({"X-Algolia-Application-Id":e,"X-Algolia-API-Key":t,"X-Algolia-Agent":encodeURIComponent(i.join("; "))},s),u=Object.keys(a).map(function(n){return n+"="+a[n]}).join("&");return n(o+"/1/events?"+u,{events:r})}(n,this._appId,this._apiKey,this._ua,this._endpointOrigin,c,null===(s=i)||void 0===s?void 0:s.headers)}}}var h="2.6.0",d=["insights-js ("+h+")","insights-js-browser-iife ("+h+")"];var f=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)})},v="_ALGOLIA",p=2592e6,g=function(n,e,t){var i=new Date;i.setTime(i.getTime()+t);var o="expires="+i.toUTCString();document.cookie=n+"="+e+";"+o+";path=/"},k=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""};e();var b,y,O,m,_=["de","us"];function T(n){var e,i;if(void 0===n&&(n={}),!a(n.region)&&-1===_.indexOf(n.region))throw new Error("optional region is incorrect, please provide either one of: "+_.join(", ")+".");if(!(a(n.cookieDuration)||u(n.cookieDuration)&&isFinite(n.cookieDuration)&&Math.floor(n.cookieDuration)===n.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");!function(n,e,i){var o=e.partial,r=t(e,["partial"]);o||Object.assign(n,i);Object.assign(n,Object.keys(r).reduce(function(n,e){var t;return Object.assign(Object.assign({},n),((t={})["_"+e]=r[e],t))},{}))}(this,n,{_userHasOptedOut:!!n.userHasOptedOut,_region:n.region,_host:n.host,_anonymousUserToken:(e=n.anonymousUserToken,null===e||void 0===e||e),_useCookie:(i=n.useCookie,null!==i&&void 0!==i&&i),_cookieDuration:n.cookieDuration||6*p}),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(d),n.userToken?this.setUserToken(n.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function x(n,e){return e.map(function(e){return Object.assign({eventType:n},e)})}Object.keys||(Object.keys=(b=Object.prototype.hasOwnProperty,y=!{toString:null}.propertyIsEnumerable("toString"),m=(O=["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)b.call(n,e)&&i.push(e);if(y)for(t=0;t<m;t++)b.call(n,O[t])&&i.push(O[t]);return i})),e();var j=function(n){var e=n.requestFn;this._endpointOrigin="https://insights.algolia.io",this._anonymousUserToken=!0,this._userHasOptedOut=!1,this._useCookie=!1,this._cookieDuration=6*p,this._ua=[],this.version=h,this.sendEvents=l(e).bind(this),this.init=T.bind(this),this.addAlgoliaAgent=function(n){-1===this._ua.indexOf(n)&&this._ua.push(n)}.bind(this),this.setUserToken=function(n){this._userToken=n,c(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAnonymousUserToken=function(n){if(void 0===n&&(n=!1),n)this.setUserToken("anonymous-"+f());else if(o()){var e=k(v);e&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(this.setUserToken("anonymous-"+f()),g(v,this._userToken,this._cookieDuration))}}.bind(this),this.getUserToken=function(n,e){return c(e)&&e(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(n,e){this._onUserTokenChangeCallback=n,e&&e.immediate&&c(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];var t=i(n),o=t.events,r=t.additionalParams;return this.sendEvents(x("click",o),r)}.bind(this),this.clickedObjectIDs=function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];var t=i(n),o=t.events,r=t.additionalParams;return this.sendEvents(x("click",o),r)}.bind(this),this.clickedFilters=function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];var t=i(n),o=t.events,r=t.additionalParams;return this.sendEvents(x("click",o),r)}.bind(this),this.convertedObjectIDsAfterSearch=function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];var t=i(n),o=t.events,r=t.additionalParams;return this.sendEvents(x("conversion",o),r)}.bind(this),this.convertedObjectIDs=function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];var t=i(n),o=t.events,r=t.additionalParams;return this.sendEvents(x("conversion",o),r)}.bind(this),this.convertedFilters=function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];var t=i(n),o=t.events,r=t.additionalParams;return this.sendEvents(x("conversion",o),r)}.bind(this),this.viewedObjectIDs=function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];var t=i(n),o=t.events,r=t.additionalParams;return this.sendEvents(x("view",o),r)}.bind(this),this.viewedFilters=function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];var t=i(n),o=t.events,r=t.additionalParams;return this.sendEvents(x("view",o),r)}.bind(this),this.getVersion=function(n){c(n)&&n(this.version)}.bind(this)},w=function(n,e){var t=JSON.stringify(e);if(!navigator.sendBeacon(n,t))return A(n,e)},A=function(n,e){var t=JSON.stringify(e),i=new XMLHttpRequest;i.open("POST",n),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+t.length),i.send(t)};function C(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&&c(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 P(n){var e=new j({requestFn:n});return"object"==typeof window&&C.call(e,window),e.version=h,e}var U=P(function(){if(r())return w;if(s())return A;throw new Error("Could not find a supported HTTP request client in this environment.")}());return n.createInsightsClient=P,n.default=U,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";function n(){"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})}function t(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 o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)n.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(t[i[o]]=e[i[o]])}return t}function i(e){return e.reduce(function(e,n){var t=e.events,i=e.additionalParams;return"index"in n?{additionalParams:i,events:t.concat([n])}:{events:t,additionalParams:n}},{events:[],additionalParams:void 0})}var o=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},r=function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}},s=function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}},a=function(e){return void 0===e},u=function(e){return"number"==typeof e},c=function(e){return"function"==typeof e};function l(e){return function(n,i){var o,r,s,u=this;if(!this._userHasOptedOut){if(!(!a(this._apiKey)&&!a(this._appId)||(null===(o=i)||void 0===o?void 0:o.headers["X-Algolia-Application-Id"])&&(null===(r=i)||void 0===r?void 0:r.headers["X-Algolia-API-Key"])))throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters or provide custom credentials in additional parameters.");var c=n.map(function(e){var n,i,o=e.filters,r=t(e,["filters"]),s=Object.assign(Object.assign({},r),{userToken:(i=null===(n=e)||void 0===n?void 0:n.userToken,null!==i&&void 0!==i?i:u._userToken)});return a(o)||(s.filters=o.map(encodeURIComponent)),s});return function(e,n,t,i,o,r,s){void 0===s&&(s={});var a=Object.assign({"X-Algolia-Application-Id":n,"X-Algolia-API-Key":t,"X-Algolia-Agent":encodeURIComponent(i.join("; "))},s),u=Object.keys(a).map(function(e){return e+"="+a[e]}).join("&");return e(o+"/1/events?"+u,{events:r})}(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,c,null===(s=i)||void 0===s?void 0:s.headers)}}}var h="2.5.0",d=["insights-js ("+h+")","insights-js-browser-umd ("+h+")"];var f=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)})},v="_ALGOLIA",p=2592e6,g=function(e,n,t){var i=new Date;i.setTime(i.getTime()+t);var o="expires="+i.toUTCString();document.cookie=e+"="+n+";"+o+";path=/"},b=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""};n();var y,O,k,x,m=["de","us"];function _(e){var n;if(void 0===e&&(e={}),!a(e.region)&&-1===m.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+m.join(", ")+".");if(!(a(e.cookieDuration)||u(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");!function(e,n,i){var o=n.partial,r=t(n,["partial"]);o||Object.assign(e,i);Object.assign(e,Object.keys(r).reduce(function(e,n){var t;return Object.assign(Object.assign({},e),((t={})["_"+n]=r[n],t))},{}))}(this,e,{_userHasOptedOut:!!e.userHasOptedOut,_region:e.region,_host:e.host,_useCookie:(n=e.useCookie,null!==n&&void 0!==n&&n),_cookieDuration:e.cookieDuration||6*p}),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(d),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function j(e,n){return n.map(function(n){return Object.assign({eventType:e},n)})}Object.keys||(Object.keys=(y=Object.prototype.hasOwnProperty,O=!{toString:null}.propertyIsEnumerable("toString"),x=(k=["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)y.call(e,n)&&i.push(n);if(O)for(t=0;t<x;t++)y.call(e,k[t])&&i.push(k[t]);return i})),n();var T=function(e){var n=e.requestFn;this._endpointOrigin="https://insights.algolia.io",this._userHasOptedOut=!1,this._useCookie=!1,this._cookieDuration=6*p,this._ua=[],this.version=h,this.sendEvents=l(n).bind(this),this.init=_.bind(this),this.addAlgoliaAgent=function(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}.bind(this),this.setUserToken=function(e){this._userToken=e,c(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAnonymousUserToken=function(){if(o()){var e=b(v);e&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(this.setUserToken("anonymous-"+f()),g(v,this._userToken,this._cookieDuration))}}.bind(this),this.getUserToken=function(e,n){return c(n)&&n(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(e,n){this._onUserTokenChangeCallback=e,n&&n.immediate&&c(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(j("click",o),r)}.bind(this),this.clickedObjectIDs=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(j("click",o),r)}.bind(this),this.clickedFilters=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(j("click",o),r)}.bind(this),this.convertedObjectIDsAfterSearch=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(j("conversion",o),r)}.bind(this),this.convertedObjectIDs=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(j("conversion",o),r)}.bind(this),this.convertedFilters=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(j("conversion",o),r)}.bind(this),this.viewedObjectIDs=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(j("view",o),r)}.bind(this),this.viewedFilters=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(j("view",o),r)}.bind(this),this.getVersion=function(e){c(e)&&e(this.version)}.bind(this)},w=function(e,n){var t=JSON.stringify(n);if(!navigator.sendBeacon(e,t))return P(e,n)},P=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 A(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&&c(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 C(e){var n=new T({requestFn:e});return"object"==typeof window&&A.call(n,window),n.version=h,n}var E=C(function(){if(r())return w;if(s())return P;throw new Error("Could not find a supported HTTP request client in this environment.")}());e.createInsightsClient=C,e.default=E,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";function n(){"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})}function t(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 o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)n.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(t[i[o]]=e[i[o]])}return t}function i(e){return e.reduce(function(e,n){var t=e.events,i=e.additionalParams;return"index"in n?{additionalParams:i,events:t.concat([n])}:{events:t,additionalParams:n}},{events:[],additionalParams:void 0})}var o=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},r=function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}},s=function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}},a=function(e){return void 0===e},u=function(e){return"number"==typeof e},c=function(e){return"function"==typeof e};function l(e){return function(n,i){var o,r,s,u=this;if(!this._userHasOptedOut){if(!(!a(this._apiKey)&&!a(this._appId)||(null===(o=i)||void 0===o?void 0:o.headers["X-Algolia-Application-Id"])&&(null===(r=i)||void 0===r?void 0:r.headers["X-Algolia-API-Key"])))throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters or provide custom credentials in additional parameters.");!this._userToken&&this._anonymousUserToken&&this.setAnonymousUserToken(!0);var c=n.map(function(e){var n,i,o=e.filters,r=t(e,["filters"]),s=Object.assign(Object.assign({},r),{userToken:(i=null===(n=e)||void 0===n?void 0:n.userToken,null!==i&&void 0!==i?i:u._userToken)});return a(o)||(s.filters=o.map(encodeURIComponent)),s});return function(e,n,t,i,o,r,s){void 0===s&&(s={});var a=Object.assign({"X-Algolia-Application-Id":n,"X-Algolia-API-Key":t,"X-Algolia-Agent":encodeURIComponent(i.join("; "))},s),u=Object.keys(a).map(function(e){return e+"="+a[e]}).join("&");return e(o+"/1/events?"+u,{events:r})}(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,c,null===(s=i)||void 0===s?void 0:s.headers)}}}var h="2.6.0",d=["insights-js ("+h+")","insights-js-browser-umd ("+h+")"];var f=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)})},v="_ALGOLIA",p=2592e6,g=function(e,n,t){var i=new Date;i.setTime(i.getTime()+t);var o="expires="+i.toUTCString();document.cookie=e+"="+n+";"+o+";path=/"},y=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""};n();var b,k,O,m,_=["de","us"];function x(e){var n,i;if(void 0===e&&(e={}),!a(e.region)&&-1===_.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+_.join(", ")+".");if(!(a(e.cookieDuration)||u(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");!function(e,n,i){var o=n.partial,r=t(n,["partial"]);o||Object.assign(e,i);Object.assign(e,Object.keys(r).reduce(function(e,n){var t;return Object.assign(Object.assign({},e),((t={})["_"+n]=r[n],t))},{}))}(this,e,{_userHasOptedOut:!!e.userHasOptedOut,_region:e.region,_host:e.host,_anonymousUserToken:(n=e.anonymousUserToken,null===n||void 0===n||n),_useCookie:(i=e.useCookie,null!==i&&void 0!==i&&i),_cookieDuration:e.cookieDuration||6*p}),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(d),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function T(e,n){return n.map(function(n){return Object.assign({eventType:e},n)})}Object.keys||(Object.keys=(b=Object.prototype.hasOwnProperty,k=!{toString:null}.propertyIsEnumerable("toString"),m=(O=["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)b.call(e,n)&&i.push(n);if(k)for(t=0;t<m;t++)b.call(e,O[t])&&i.push(O[t]);return i})),n();var j=function(e){var n=e.requestFn;this._endpointOrigin="https://insights.algolia.io",this._anonymousUserToken=!0,this._userHasOptedOut=!1,this._useCookie=!1,this._cookieDuration=6*p,this._ua=[],this.version=h,this.sendEvents=l(n).bind(this),this.init=x.bind(this),this.addAlgoliaAgent=function(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}.bind(this),this.setUserToken=function(e){this._userToken=e,c(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAnonymousUserToken=function(e){if(void 0===e&&(e=!1),e)this.setUserToken("anonymous-"+f());else if(o()){var n=y(v);n&&""!==n&&0===n.indexOf("anonymous-")?this.setUserToken(n):(this.setUserToken("anonymous-"+f()),g(v,this._userToken,this._cookieDuration))}}.bind(this),this.getUserToken=function(e,n){return c(n)&&n(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(e,n){this._onUserTokenChangeCallback=e,n&&n.immediate&&c(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(T("click",o),r)}.bind(this),this.clickedObjectIDs=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(T("click",o),r)}.bind(this),this.clickedFilters=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(T("click",o),r)}.bind(this),this.convertedObjectIDsAfterSearch=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(T("conversion",o),r)}.bind(this),this.convertedObjectIDs=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(T("conversion",o),r)}.bind(this),this.convertedFilters=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(T("conversion",o),r)}.bind(this),this.viewedObjectIDs=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(T("view",o),r)}.bind(this),this.viewedFilters=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=i(e),o=t.events,r=t.additionalParams;return this.sendEvents(T("view",o),r)}.bind(this),this.getVersion=function(e){c(e)&&e(this.version)}.bind(this)},w=function(e,n){var t=JSON.stringify(n);if(!navigator.sendBeacon(e,t))return A(e,n)},A=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 P(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&&c(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 C(e){var n=new j({requestFn:e});return"object"==typeof window&&P.call(n,window),n.version=h,n}var U=C(function(){if(r())return w;if(s())return A;throw new Error("Could not find a supported HTTP request client in this environment.")}());e.createInsightsClient=C,e.default=U,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -23,2 +23,6 @@ import { RequestFnType } from "./utils/request";

if (!this._userToken && this._anonymousUserToken) {
this.setAnonymousUserToken(true);
}
const events: InsightsEvent[] = eventData.map((data) => {

@@ -25,0 +29,0 @@ const { filters, ...rest } = data;

@@ -29,6 +29,12 @@ import { createUUID } from "./utils/uuid";

export function setAnonymousUserToken(): void {
export function setAnonymousUserToken(inMemory = false): void {
if (inMemory) {
this.setUserToken(`anonymous-${createUUID()}`);
return;
}
if (!supportsCookies()) {
return;
}
const foundToken = getCookie(COOKIE_KEY);

@@ -35,0 +41,0 @@ if (

@@ -16,2 +16,3 @@ import { isUndefined, isNumber } from "./utils";

userHasOptedOut?: boolean;
anonymousUserToken?: boolean;
useCookie?: boolean;

@@ -60,2 +61,3 @@ cookieDuration?: number;

_host: options.host,
_anonymousUserToken: options.anonymousUserToken ?? true,
_useCookie: options.useCookie ?? false,

@@ -83,3 +85,8 @@ _cookieDuration: options.cookieDuration || 6 * MONTH

AlgoliaAnalytics,
"_userHasOptedOut" | "_useCookie" | "_cookieDuration" | "_region" | "_host"
| "_userHasOptedOut"
| "_anonymousUserToken"
| "_useCookie"
| "_cookieDuration"
| "_region"
| "_host"
>;

@@ -86,0 +93,0 @@

@@ -60,2 +60,3 @@ import objectAssignPolyfill from "./polyfills/objectAssign";

_endpointOrigin = "https://insights.algolia.io";
_anonymousUserToken = true;
_userToken: string;

@@ -62,0 +63,0 @@ _userHasOptedOut = false;

{
"name": "search-insights",
"description": "Library for reporting click, conversion and view metrics using the Algolia Insights API",
"version": "2.5.0",
"version": "2.6.0",
"jsdelivr": "dist/search-insights.min.js",

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

@@ -49,6 +49,6 @@ # Search Insights

<script>
var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@2.5.0";
var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@2.6.0";
!function(e,a,t,n,s,i,c){e.AlgoliaAnalyticsObject=s,e[s]=e[s]||function(){
(e[s].queue=e[s].queue||[]).push(arguments)},i=a.createElement(t),c=a.getElementsByTagName(t)[0],
(e[s].queue=e[s].queue||[]).push(arguments)},e[s].version=(n.match(/@([^\/]+)\/?/) || [])[1],i=a.createElement(t),c=a.getElementsByTagName(t)[0],
i.async=1,i.src=n,c.parentNode.insertBefore(i,c)

@@ -55,0 +55,0 @@ }(window,document,"script",ALGOLIA_INSIGHTS_SRC,"aa");

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