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.9.0 to 2.10.0

2

dist/search-insights-browser.cjs.min.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version="2.9.0";function extractAdditionalParams(e){return e.reduce(function(e,t){var n=e.events,e=e.additionalParams;return"index"in t?{additionalParams:e,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void 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 getFunctionalInterface(i){return function(e){for(var t=[],n=arguments.length-1;0<n--;)t[n]=arguments[n+1];e&&isFunction(i[e])?i[e].apply(i,t):console.warn("The method `"+e+"` doesn't exist.")}}var DEFAULT_ALGOLIA_AGENTS=["insights-js ("+version+")","insights-js-browser-cjs ("+version+")"];function addAlgoliaAgent(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}function getVersion(e){isFunction(e)&&e(this.version)}function __rest(e,t){var n={};for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]]);return n}function makeSendEvents(s){return function(e,t){var i=this;if(!this._userHasOptedOut){if(!(!isUndefined(this._apiKey)&&!isUndefined(this._appId)||(null==(n=null==t?void 0:t.headers)?void 0:n["X-Algolia-Application-Id"])&&(null==(n=null==t?void 0:t.headers)?void 0:n["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 n=e.map(function(e){var t=e.filters,n=__rest(e,["filters"]),e=Object.assign(Object.assign({},n),{userToken:null!=(n=null==e?void 0:e.userToken)?n:i._userToken,authenticatedUserToken:null!=(n=null==e?void 0:e.authenticatedUserToken)?n:i._authenticatedUserToken});return isUndefined(t)||(e.filters=t.map(encodeURIComponent)),e});return sendRequest(s,this._ua,this._endpointOrigin,n,this._appId,this._apiKey,null==t?void 0:t.headers)}}}function sendRequest(e,t,n,i,s,r,o){var a=(o=void 0===o?{}:o)["X-Algolia-Application-Id"],c=o["X-Algolia-API-Key"],o=__rest(o,["X-Algolia-Application-Id","X-Algolia-API-Key"]),d=Object.assign({"X-Algolia-Application-Id":null!=a?a:s,"X-Algolia-API-Key":null!=c?c:r,"X-Algolia-Agent":encodeURIComponent(t.join("; "))},o);return e(n+"/1/events?"+Object.keys(d).map(function(e){return e+"="+d[e]}).join("&"),{events:i})}function createUUID(){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)})}var COOKIE_KEY="_ALGOLIA",MONTH=2592e6,setCookie=function(e,t,n){var i=new Date,n=(i.setTime(i.getTime()+n),"expires="+i.toUTCString());document.cookie=e+"="+t+";"+n+";path=/"},getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "===s.charAt(0);)s=s.substring(1);if(0===s.indexOf(t))return s.substring(t.length,s.length)}return""};function setAnonymousUserToken(e){(e=void 0!==e&&e)?this.setUserToken("anonymous-"+createUUID()):supportsCookies()&&((e=getCookie(COOKIE_KEY))&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(e=this.setUserToken("anonymous-"+createUUID()),setCookie(COOKIE_KEY,e,this._cookieDuration)))}function setUserToken(e){return this._userToken=e,isFunction(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken),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)}function setAuthenticatedUserToken(e){return this._authenticatedUserToken=e,isFunction(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken),this._authenticatedUserToken}function getAuthenticatedUserToken(e,t){return isFunction(t)&&t(null,this._authenticatedUserToken),this._authenticatedUserToken}function onAuthenticatedUserTokenChange(e,t){this._onAuthenticatedUserTokenChangeCallback=e,t&&t.immediate&&isFunction(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken)}function addEventType(t,e){return e.map(function(e){return Object.assign({eventType:t},e)})}function addEventTypeAndSubtype(t,n,e){return e.map(function(e){return Object.assign({eventType:t,eventSubtype:n},e)})}function clickedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("click",i),n)}function clickedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("click",i),n)}function clickedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("click",i),n)}function convertedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("conversion",i),n)}function addedToCartObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","addToCart",i),n)}function purchasedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","purchase",i),n)}function convertedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("conversion",i),n)}function addedToCartObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","addToCart",i),n)}function purchasedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","purchase",i),n)}function convertedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("conversion",i),n)}var SUPPORTED_REGIONS=["de","us"];function init(e){var t;if(!isUndefined((e=void 0===e?{}: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:Boolean(e.userHasOptedOut),_region:e.region,_host:e.host,_anonymousUserToken:null==(t=e.anonymousUserToken)||t,_useCookie:null!=(t=e.useCookie)&&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.authenticatedUserToken&&this.setAuthenticatedUserToken(e.authenticatedUserToken),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function setOptions(e,t,n){var i=t.partial,s=__rest(t,["partial"]);i||Object.assign(e,n),Object.assign(e,Object.keys(s).reduce(function(e,t){return Object.assign(Object.assign({},e),((e={})["_"+t]=s[t],e))},{}))}function viewedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("view",i),n)}function viewedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("view",i),n)}var AlgoliaAnalytics=function(e){e=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(e).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.setAuthenticatedUserToken=setAuthenticatedUserToken.bind(this),this.getAuthenticatedUserToken=getAuthenticatedUserToken.bind(this),this.onAuthenticatedUserTokenChange=onAuthenticatedUserTokenChange.bind(this),this.clickedObjectIDsAfterSearch=clickedObjectIDsAfterSearch.bind(this),this.clickedObjectIDs=clickedObjectIDs.bind(this),this.clickedFilters=clickedFilters.bind(this),this.convertedObjectIDsAfterSearch=convertedObjectIDsAfterSearch.bind(this),this.purchasedObjectIDsAfterSearch=purchasedObjectIDsAfterSearch.bind(this),this.addedToCartObjectIDsAfterSearch=addedToCartObjectIDsAfterSearch.bind(this),this.convertedObjectIDs=convertedObjectIDs.bind(this),this.addedToCartObjectIDs=addedToCartObjectIDs.bind(this),this.purchasedObjectIDs=purchasedObjectIDs.bind(this),this.convertedFilters=convertedFilters.bind(this),this.viewedObjectIDs=viewedObjectIDs.bind(this),this.viewedFilters=viewedFilters.bind(this),this.getVersion=getVersion.bind(this)};function createInsightsClient(e){var t,e=getFunctionalInterface(new AlgoliaAnalytics({requestFn:e}));if("object"==typeof window&&!window.AlgoliaAnalyticsObject){for(;t=createUUID(),void 0!==window[t];);window.AlgoliaAnalyticsObject=t,window[window.AlgoliaAnalyticsObject]=e}return e.version=version,e}function processQueue(e){var n,t=e.AlgoliaAnalyticsObject;t&&(n=getFunctionalInterface(this),(e=e[t]).queue=e.queue||[],(t=e.queue).forEach(function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))}),t.push=function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))})}var requestWithXMLHttpRequest=function(s,r){return new Promise(function(e,t){var n=JSON.stringify(r),i=new XMLHttpRequest;i.addEventListener("readystatechange",function(){4===i.readyState&&200===i.status?e(!0):4===i.readyState&&e(!1)}),i.addEventListener("error",function(){return t()}),i.addEventListener("timeout",function(){return e(!1)}),i.open("POST",s),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+n.length),i.send(n)})},requestWithSendBeacon=function(e,t){var n=JSON.stringify(t),n=navigator.sendBeacon(e,n);return Promise.resolve(!!n||requestWithXMLHttpRequest(e,t))};function getRequesterForBrowser(){if(supportsSendBeacon())return requestWithSendBeacon;if(supportsXMLHttpRequest())return requestWithXMLHttpRequest;throw new Error("Could not find a supported HTTP request client in this environment.")}var entryBrowserCjs=createInsightsClient(getRequesterForBrowser());exports.AlgoliaAnalytics=AlgoliaAnalytics,exports.default=entryBrowserCjs,exports.getFunctionalInterface=getFunctionalInterface,exports.getRequesterForBrowser=getRequesterForBrowser,exports.processQueue=processQueue;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version="2.10.0";function extractAdditionalParams(e){return e.reduce(function(e,t){var n=e.events,e=e.additionalParams;return"index"in t?{additionalParams:e,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void 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}},supportsNativeFetch=function(){try{return void 0!==fetch}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 getFunctionalInterface(i){return function(e){for(var t=[],n=arguments.length-1;0<n--;)t[n]=arguments[n+1];e&&isFunction(i[e])?i[e].apply(i,t):console.warn("The method `"+e+"` doesn't exist.")}}var DEFAULT_ALGOLIA_AGENTS=["insights-js ("+version+")","insights-js-browser-cjs ("+version+")"];function addAlgoliaAgent(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}function getVersion(e){isFunction(e)&&e(this.version)}function __rest(e,t){var n={};for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]]);return n}function makeSendEvents(s){return function(e,t){var i=this;if(!this._userHasOptedOut){if(!(!isUndefined(this._apiKey)&&!isUndefined(this._appId)||(null==(n=null==t?void 0:t.headers)?void 0:n["X-Algolia-Application-Id"])&&(null==(n=null==t?void 0:t.headers)?void 0:n["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 n=e.map(function(e){var t=e.filters,n=__rest(e,["filters"]),e=Object.assign(Object.assign({},n),{userToken:null!=(n=null==e?void 0:e.userToken)?n:i._userToken,authenticatedUserToken:null!=(n=null==e?void 0:e.authenticatedUserToken)?n:i._authenticatedUserToken});return isUndefined(t)||(e.filters=t.map(encodeURIComponent)),e});return sendRequest(s,this._ua,this._endpointOrigin,n,this._appId,this._apiKey,null==t?void 0:t.headers)}}}function sendRequest(e,t,n,i,s,r,o){var a=(o=void 0===o?{}:o)["X-Algolia-Application-Id"],c=o["X-Algolia-API-Key"],o=__rest(o,["X-Algolia-Application-Id","X-Algolia-API-Key"]),d=Object.assign({"X-Algolia-Application-Id":null!=a?a:s,"X-Algolia-API-Key":null!=c?c:r,"X-Algolia-Agent":encodeURIComponent(t.join("; "))},o);return e(n+"/1/events?"+Object.keys(d).map(function(e){return e+"="+d[e]}).join("&"),{events:i})}function createUUID(){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)})}var COOKIE_KEY="_ALGOLIA",MONTH=2592e6,setCookie=function(e,t,n){var i=new Date,n=(i.setTime(i.getTime()+n),"expires="+i.toUTCString());document.cookie=e+"="+t+";"+n+";path=/"},getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "===s.charAt(0);)s=s.substring(1);if(0===s.indexOf(t))return s.substring(t.length,s.length)}return""};function setAnonymousUserToken(e){(e=void 0!==e&&e)?this.setUserToken("anonymous-"+createUUID()):supportsCookies()&&((e=getCookie(COOKIE_KEY))&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(e=this.setUserToken("anonymous-"+createUUID()),setCookie(COOKIE_KEY,e,this._cookieDuration)))}function setUserToken(e){return this._userToken=e,isFunction(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken),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)}function setAuthenticatedUserToken(e){return this._authenticatedUserToken=e,isFunction(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken),this._authenticatedUserToken}function getAuthenticatedUserToken(e,t){return isFunction(t)&&t(null,this._authenticatedUserToken),this._authenticatedUserToken}function onAuthenticatedUserTokenChange(e,t){this._onAuthenticatedUserTokenChangeCallback=e,t&&t.immediate&&isFunction(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken)}function addEventType(t,e){return e.map(function(e){return Object.assign({eventType:t},e)})}function addEventTypeAndSubtype(t,n,e){return e.map(function(e){return Object.assign({eventType:t,eventSubtype:n},e)})}function clickedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("click",i),n)}function clickedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("click",i),n)}function clickedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("click",i),n)}function convertedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("conversion",i),n)}function addedToCartObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","addToCart",i),n)}function purchasedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","purchase",i),n)}function convertedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("conversion",i),n)}function addedToCartObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","addToCart",i),n)}function purchasedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","purchase",i),n)}function convertedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("conversion",i),n)}var SUPPORTED_REGIONS=["de","us"];function init(e){var t;if(!isUndefined((e=void 0===e?{}: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:Boolean(e.userHasOptedOut),_region:e.region,_host:e.host,_anonymousUserToken:null==(t=e.anonymousUserToken)||t,_useCookie:null!=(t=e.useCookie)&&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.authenticatedUserToken&&this.setAuthenticatedUserToken(e.authenticatedUserToken),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function setOptions(e,t,n){var i=t.partial,s=__rest(t,["partial"]);i||Object.assign(e,n),Object.assign(e,Object.keys(s).reduce(function(e,t){return Object.assign(Object.assign({},e),((e={})["_"+t]=s[t],e))},{}))}function viewedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("view",i),n)}function viewedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("view",i),n)}var AlgoliaAnalytics=function(e){e=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(e).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.setAuthenticatedUserToken=setAuthenticatedUserToken.bind(this),this.getAuthenticatedUserToken=getAuthenticatedUserToken.bind(this),this.onAuthenticatedUserTokenChange=onAuthenticatedUserTokenChange.bind(this),this.clickedObjectIDsAfterSearch=clickedObjectIDsAfterSearch.bind(this),this.clickedObjectIDs=clickedObjectIDs.bind(this),this.clickedFilters=clickedFilters.bind(this),this.convertedObjectIDsAfterSearch=convertedObjectIDsAfterSearch.bind(this),this.purchasedObjectIDsAfterSearch=purchasedObjectIDsAfterSearch.bind(this),this.addedToCartObjectIDsAfterSearch=addedToCartObjectIDsAfterSearch.bind(this),this.convertedObjectIDs=convertedObjectIDs.bind(this),this.addedToCartObjectIDs=addedToCartObjectIDs.bind(this),this.purchasedObjectIDs=purchasedObjectIDs.bind(this),this.convertedFilters=convertedFilters.bind(this),this.viewedObjectIDs=viewedObjectIDs.bind(this),this.viewedFilters=viewedFilters.bind(this),this.getVersion=getVersion.bind(this)};function createInsightsClient(e){var t,e=getFunctionalInterface(new AlgoliaAnalytics({requestFn:e}));if("object"==typeof window&&!window.AlgoliaAnalyticsObject){for(;t=createUUID(),void 0!==window[t];);window.AlgoliaAnalyticsObject=t,window[window.AlgoliaAnalyticsObject]=e}return e.version=version,e}function processQueue(e){var n,t=e.AlgoliaAnalyticsObject;t&&(n=getFunctionalInterface(this),(e=e[t]).queue=e.queue||[],(t=e.queue).forEach(function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))}),t.push=function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))})}var requestWithXMLHttpRequest=function(s,r){return new Promise(function(e,t){var n=JSON.stringify(r),i=new XMLHttpRequest;i.addEventListener("readystatechange",function(){4===i.readyState&&200===i.status?e(!0):4===i.readyState&&e(!1)}),i.addEventListener("error",function(){return t()}),i.addEventListener("timeout",function(){return e(!1)}),i.open("POST",s),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+n.length),i.send(n)})},requestWithSendBeacon=function(e,t){var n=JSON.stringify(t),n=navigator.sendBeacon(e,n);return Promise.resolve(!!n||requestWithXMLHttpRequest(e,t))},requestWithNativeFetch=function(e,i){return new Promise(function(t,n){fetch(e,{method:"POST",body:JSON.stringify(i),headers:{"Content-Type":"application/json"}}).then(function(e){t(200===e.status)}).catch(function(e){n(e)})})};function getRequesterForBrowser(){if(supportsSendBeacon())return requestWithSendBeacon;if(supportsXMLHttpRequest())return requestWithXMLHttpRequest;if(supportsNativeFetch())return requestWithNativeFetch;throw new Error("Could not find a supported HTTP request client in this environment.")}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";Object.defineProperty(exports,"__esModule",{value:!0});var version="2.9.0";function extractAdditionalParams(e){return e.reduce(function(e,t){var n=e.events,e=e.additionalParams;return"index"in t?{additionalParams:e,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void 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 getFunctionalInterface(i){return function(e){for(var t=[],n=arguments.length-1;0<n--;)t[n]=arguments[n+1];e&&isFunction(i[e])?i[e].apply(i,t):console.warn("The method `"+e+"` doesn't exist.")}}var DEFAULT_ALGOLIA_AGENTS=["insights-js ("+version+")","insights-js-node-cjs ("+version+")"];function addAlgoliaAgent(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}function getVersion(e){isFunction(e)&&e(this.version)}function __rest(e,t){var n={};for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]]);return n}function makeSendEvents(s){return function(e,t){var i=this;if(!this._userHasOptedOut){if(!(!isUndefined(this._apiKey)&&!isUndefined(this._appId)||(null==(n=null==t?void 0:t.headers)?void 0:n["X-Algolia-Application-Id"])&&(null==(n=null==t?void 0:t.headers)?void 0:n["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 n=e.map(function(e){var t=e.filters,n=__rest(e,["filters"]),e=Object.assign(Object.assign({},n),{userToken:null!=(n=null==e?void 0:e.userToken)?n:i._userToken,authenticatedUserToken:null!=(n=null==e?void 0:e.authenticatedUserToken)?n:i._authenticatedUserToken});return isUndefined(t)||(e.filters=t.map(encodeURIComponent)),e});return sendRequest(s,this._ua,this._endpointOrigin,n,this._appId,this._apiKey,null==t?void 0:t.headers)}}}function sendRequest(e,t,n,i,s,o,r){var a=(r=void 0===r?{}:r)["X-Algolia-Application-Id"],d=r["X-Algolia-API-Key"],r=__rest(r,["X-Algolia-Application-Id","X-Algolia-API-Key"]),c=Object.assign({"X-Algolia-Application-Id":null!=a?a:s,"X-Algolia-API-Key":null!=d?d:o,"X-Algolia-Agent":encodeURIComponent(t.join("; "))},r);return e(n+"/1/events?"+Object.keys(c).map(function(e){return e+"="+c[e]}).join("&"),{events:i})}function createUUID(){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)})}var COOKIE_KEY="_ALGOLIA",MONTH=2592e6,setCookie=function(e,t,n){var i=new Date,n=(i.setTime(i.getTime()+n),"expires="+i.toUTCString());document.cookie=e+"="+t+";"+n+";path=/"},getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "===s.charAt(0);)s=s.substring(1);if(0===s.indexOf(t))return s.substring(t.length,s.length)}return""};function setAnonymousUserToken(e){(e=void 0!==e&&e)?this.setUserToken("anonymous-"+createUUID()):supportsCookies()&&((e=getCookie(COOKIE_KEY))&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(e=this.setUserToken("anonymous-"+createUUID()),setCookie(COOKIE_KEY,e,this._cookieDuration)))}function setUserToken(e){return this._userToken=e,isFunction(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken),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)}function setAuthenticatedUserToken(e){return this._authenticatedUserToken=e,isFunction(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken),this._authenticatedUserToken}function getAuthenticatedUserToken(e,t){return isFunction(t)&&t(null,this._authenticatedUserToken),this._authenticatedUserToken}function onAuthenticatedUserTokenChange(e,t){this._onAuthenticatedUserTokenChangeCallback=e,t&&t.immediate&&isFunction(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken)}function addEventType(t,e){return e.map(function(e){return Object.assign({eventType:t},e)})}function addEventTypeAndSubtype(t,n,e){return e.map(function(e){return Object.assign({eventType:t,eventSubtype:n},e)})}function clickedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("click",i),n)}function clickedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("click",i),n)}function clickedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("click",i),n)}function convertedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("conversion",i),n)}function addedToCartObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","addToCart",i),n)}function purchasedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","purchase",i),n)}function convertedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("conversion",i),n)}function addedToCartObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","addToCart",i),n)}function purchasedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","purchase",i),n)}function convertedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("conversion",i),n)}var SUPPORTED_REGIONS=["de","us"];function init(e){var t;if(!isUndefined((e=void 0===e?{}: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:Boolean(e.userHasOptedOut),_region:e.region,_host:e.host,_anonymousUserToken:null==(t=e.anonymousUserToken)||t,_useCookie:null!=(t=e.useCookie)&&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.authenticatedUserToken&&this.setAuthenticatedUserToken(e.authenticatedUserToken),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function setOptions(e,t,n){var i=t.partial,s=__rest(t,["partial"]);i||Object.assign(e,n),Object.assign(e,Object.keys(s).reduce(function(e,t){return Object.assign(Object.assign({},e),((e={})["_"+t]=s[t],e))},{}))}function viewedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("view",i),n)}function viewedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("view",i),n)}var AlgoliaAnalytics=function(e){e=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(e).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.setAuthenticatedUserToken=setAuthenticatedUserToken.bind(this),this.getAuthenticatedUserToken=getAuthenticatedUserToken.bind(this),this.onAuthenticatedUserTokenChange=onAuthenticatedUserTokenChange.bind(this),this.clickedObjectIDsAfterSearch=clickedObjectIDsAfterSearch.bind(this),this.clickedObjectIDs=clickedObjectIDs.bind(this),this.clickedFilters=clickedFilters.bind(this),this.convertedObjectIDsAfterSearch=convertedObjectIDsAfterSearch.bind(this),this.purchasedObjectIDsAfterSearch=purchasedObjectIDsAfterSearch.bind(this),this.addedToCartObjectIDsAfterSearch=addedToCartObjectIDsAfterSearch.bind(this),this.convertedObjectIDs=convertedObjectIDs.bind(this),this.addedToCartObjectIDs=addedToCartObjectIDs.bind(this),this.purchasedObjectIDs=purchasedObjectIDs.bind(this),this.convertedFilters=convertedFilters.bind(this),this.viewedObjectIDs=viewedObjectIDs.bind(this),this.viewedFilters=viewedFilters.bind(this),this.getVersion=getVersion.bind(this)};function createInsightsClient(e){var t,e=getFunctionalInterface(new AlgoliaAnalytics({requestFn:e}));if("object"==typeof window&&!window.AlgoliaAnalyticsObject){for(;t=createUUID(),void 0!==window[t];);window.AlgoliaAnalyticsObject=t,window[window.AlgoliaAnalyticsObject]=e}return e.version=version,e}function processQueue(e){var n,t=e.AlgoliaAnalyticsObject;t&&(n=getFunctionalInterface(this),(e=e[t]).queue=e.queue||[],(t=e.queue).forEach(function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))}),t.push=function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))})}var requestWithNodeHttpModule=function(s,o){return new Promise(function(t,n){var e=JSON.stringify(o),i=require("url").parse(s),i={protocol:i.protocol,host:i.host,path:i.path,method:"POST",headers:{"Content-Type":"application/json","Content-Length":e.length}},i=(0,(s.startsWith("https://")?require("https"):require("http")).request)(i,function(e){e=e.statusCode;t(200===e)});i.on("error",function(e){console.error(e),n(e)}),i.on("timeout",function(){return t(!1)}),i.write(e),i.end()})};function getRequesterForNode(){if(supportsNodeHttpModule())return requestWithNodeHttpModule;throw new Error("Could not find a supported HTTP request client in this environment.")}var entryNodeCjs=createInsightsClient(getRequesterForNode());exports.AlgoliaAnalytics=AlgoliaAnalytics,exports.default=entryNodeCjs,exports.getFunctionalInterface=getFunctionalInterface,exports.getRequesterForNode=getRequesterForNode,exports.processQueue=processQueue;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version="2.10.0";function extractAdditionalParams(e){return e.reduce(function(e,t){var n=e.events,e=e.additionalParams;return"index"in t?{additionalParams:e,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void 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}},supportsNativeFetch=function(){try{return void 0!==fetch}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 getFunctionalInterface(i){return function(e){for(var t=[],n=arguments.length-1;0<n--;)t[n]=arguments[n+1];e&&isFunction(i[e])?i[e].apply(i,t):console.warn("The method `"+e+"` doesn't exist.")}}var DEFAULT_ALGOLIA_AGENTS=["insights-js ("+version+")","insights-js-node-cjs ("+version+")"];function addAlgoliaAgent(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}function getVersion(e){isFunction(e)&&e(this.version)}function __rest(e,t){var n={};for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]]);return n}function makeSendEvents(s){return function(e,t){var i=this;if(!this._userHasOptedOut){if(!(!isUndefined(this._apiKey)&&!isUndefined(this._appId)||(null==(n=null==t?void 0:t.headers)?void 0:n["X-Algolia-Application-Id"])&&(null==(n=null==t?void 0:t.headers)?void 0:n["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 n=e.map(function(e){var t=e.filters,n=__rest(e,["filters"]),e=Object.assign(Object.assign({},n),{userToken:null!=(n=null==e?void 0:e.userToken)?n:i._userToken,authenticatedUserToken:null!=(n=null==e?void 0:e.authenticatedUserToken)?n:i._authenticatedUserToken});return isUndefined(t)||(e.filters=t.map(encodeURIComponent)),e});return sendRequest(s,this._ua,this._endpointOrigin,n,this._appId,this._apiKey,null==t?void 0:t.headers)}}}function sendRequest(e,t,n,i,s,o,r){var a=(r=void 0===r?{}:r)["X-Algolia-Application-Id"],c=r["X-Algolia-API-Key"],r=__rest(r,["X-Algolia-Application-Id","X-Algolia-API-Key"]),d=Object.assign({"X-Algolia-Application-Id":null!=a?a:s,"X-Algolia-API-Key":null!=c?c:o,"X-Algolia-Agent":encodeURIComponent(t.join("; "))},r);return e(n+"/1/events?"+Object.keys(d).map(function(e){return e+"="+d[e]}).join("&"),{events:i})}function createUUID(){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)})}var COOKIE_KEY="_ALGOLIA",MONTH=2592e6,setCookie=function(e,t,n){var i=new Date,n=(i.setTime(i.getTime()+n),"expires="+i.toUTCString());document.cookie=e+"="+t+";"+n+";path=/"},getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "===s.charAt(0);)s=s.substring(1);if(0===s.indexOf(t))return s.substring(t.length,s.length)}return""};function setAnonymousUserToken(e){(e=void 0!==e&&e)?this.setUserToken("anonymous-"+createUUID()):supportsCookies()&&((e=getCookie(COOKIE_KEY))&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(e=this.setUserToken("anonymous-"+createUUID()),setCookie(COOKIE_KEY,e,this._cookieDuration)))}function setUserToken(e){return this._userToken=e,isFunction(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken),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)}function setAuthenticatedUserToken(e){return this._authenticatedUserToken=e,isFunction(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken),this._authenticatedUserToken}function getAuthenticatedUserToken(e,t){return isFunction(t)&&t(null,this._authenticatedUserToken),this._authenticatedUserToken}function onAuthenticatedUserTokenChange(e,t){this._onAuthenticatedUserTokenChangeCallback=e,t&&t.immediate&&isFunction(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken)}function addEventType(t,e){return e.map(function(e){return Object.assign({eventType:t},e)})}function addEventTypeAndSubtype(t,n,e){return e.map(function(e){return Object.assign({eventType:t,eventSubtype:n},e)})}function clickedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("click",i),n)}function clickedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("click",i),n)}function clickedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("click",i),n)}function convertedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("conversion",i),n)}function addedToCartObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","addToCart",i),n)}function purchasedObjectIDsAfterSearch(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","purchase",i),n)}function convertedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("conversion",i),n)}function addedToCartObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","addToCart",i),n)}function purchasedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventTypeAndSubtype("conversion","purchase",i),n)}function convertedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("conversion",i),n)}var SUPPORTED_REGIONS=["de","us"];function init(e){var t;if(!isUndefined((e=void 0===e?{}: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:Boolean(e.userHasOptedOut),_region:e.region,_host:e.host,_anonymousUserToken:null==(t=e.anonymousUserToken)||t,_useCookie:null!=(t=e.useCookie)&&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.authenticatedUserToken&&this.setAuthenticatedUserToken(e.authenticatedUserToken),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function setOptions(e,t,n){var i=t.partial,s=__rest(t,["partial"]);i||Object.assign(e,n),Object.assign(e,Object.keys(s).reduce(function(e,t){return Object.assign(Object.assign({},e),((e={})["_"+t]=s[t],e))},{}))}function viewedObjectIDs(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("view",i),n)}function viewedFilters(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=extractAdditionalParams(e),i=n.events,n=n.additionalParams;return this.sendEvents(addEventType("view",i),n)}var AlgoliaAnalytics=function(e){e=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(e).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.setAuthenticatedUserToken=setAuthenticatedUserToken.bind(this),this.getAuthenticatedUserToken=getAuthenticatedUserToken.bind(this),this.onAuthenticatedUserTokenChange=onAuthenticatedUserTokenChange.bind(this),this.clickedObjectIDsAfterSearch=clickedObjectIDsAfterSearch.bind(this),this.clickedObjectIDs=clickedObjectIDs.bind(this),this.clickedFilters=clickedFilters.bind(this),this.convertedObjectIDsAfterSearch=convertedObjectIDsAfterSearch.bind(this),this.purchasedObjectIDsAfterSearch=purchasedObjectIDsAfterSearch.bind(this),this.addedToCartObjectIDsAfterSearch=addedToCartObjectIDsAfterSearch.bind(this),this.convertedObjectIDs=convertedObjectIDs.bind(this),this.addedToCartObjectIDs=addedToCartObjectIDs.bind(this),this.purchasedObjectIDs=purchasedObjectIDs.bind(this),this.convertedFilters=convertedFilters.bind(this),this.viewedObjectIDs=viewedObjectIDs.bind(this),this.viewedFilters=viewedFilters.bind(this),this.getVersion=getVersion.bind(this)};function createInsightsClient(e){var t,e=getFunctionalInterface(new AlgoliaAnalytics({requestFn:e}));if("object"==typeof window&&!window.AlgoliaAnalyticsObject){for(;t=createUUID(),void 0!==window[t];);window.AlgoliaAnalyticsObject=t,window[window.AlgoliaAnalyticsObject]=e}return e.version=version,e}function processQueue(e){var n,t=e.AlgoliaAnalyticsObject;t&&(n=getFunctionalInterface(this),(e=e[t]).queue=e.queue||[],(t=e.queue).forEach(function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))}),t.push=function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))})}var requestWithNodeHttpModule=function(s,o){return new Promise(function(t,n){var e=JSON.stringify(o),i=require("url").parse(s),i={protocol:i.protocol,host:i.host,path:i.path,method:"POST",headers:{"Content-Type":"application/json","Content-Length":e.length}},i=(0,(s.startsWith("https://")?require("https"):require("http")).request)(i,function(e){e=e.statusCode;t(200===e)});i.on("error",function(e){console.error(e),n(e)}),i.on("timeout",function(){return t(!1)}),i.write(e),i.end()})},requestWithNativeFetch=function(e,i){return new Promise(function(t,n){fetch(e,{method:"POST",body:JSON.stringify(i),headers:{"Content-Type":"application/json"}}).then(function(e){t(200===e.status)}).catch(function(e){n(e)})})};function getRequesterForNode(){if(supportsNodeHttpModule())return requestWithNodeHttpModule;if(supportsNativeFetch())return requestWithNativeFetch;throw new Error("Could not find a supported HTTP request client in this environment.")}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 t="2.9.0";function s(e){return e.reduce(function(e,t){var n=e.events,e=e.additionalParams;return"index"in t?{additionalParams:e,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void 0})}function n(){try{return Boolean(navigator.cookieEnabled)}catch(e){return}}function l(e){return void 0===e}function r(e){return"number"==typeof e}function o(e){return"function"==typeof e}function i(e){var n,i,t=e.AlgoliaAnalyticsObject;t&&(i=this,n=function(e){for(var t=[],n=arguments.length-1;0<n--;)t[n]=arguments[n+1];e&&o(i[e])?i[e].apply(i,t):console.warn("The method `"+e+"` doesn't exist.")},(e=e[t]).queue=e.queue||[],(t=e.queue).forEach(function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))}),t.push=function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))})}var a=["insights-js ("+t+")","insights-js-browser-iife ("+t+")"];function v(e,t){var n={};for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]]);return n}function u(d){return function(e,t){var i=this;if(!this._userHasOptedOut){if(!(!l(this._apiKey)&&!l(this._appId)||(null==(h=null==t?void 0:t.headers)?void 0:h["X-Algolia-Application-Id"])&&(null==(h=null==t?void 0:t.headers)?void 0:h["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 n,s,o,r,a,u,c,h=e.map(function(e){var t=e.filters,n=v(e,["filters"]),e=Object.assign(Object.assign({},n),{userToken:null!=(n=null==e?void 0:e.userToken)?n:i._userToken,authenticatedUserToken:null!=(n=null==e?void 0:e.authenticatedUserToken)?n:i._authenticatedUserToken});return l(t)||(e.filters=t.map(encodeURIComponent)),e});return e=d,n=this._ua,s=this._endpointOrigin,h=h,o=this._appId,r=this._apiKey,t=null==t?void 0:t.headers,a=(t=void 0===t?{}:t)["X-Algolia-Application-Id"],u=t["X-Algolia-API-Key"],t=v(t,["X-Algolia-Application-Id","X-Algolia-API-Key"]),c=Object.assign({"X-Algolia-Application-Id":null!=a?a:o,"X-Algolia-API-Key":null!=u?u:r,"X-Algolia-Agent":encodeURIComponent(n.join("; "))},t),a=Object.keys(c).map(function(e){return e+"="+c[e]}).join("&"),e(s+"/1/events?"+a,{events:h})}}}function c(){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)})}function h(e,t,n){var i=new Date,n=(i.setTime(i.getTime()+n),"expires="+i.toUTCString());document.cookie=e+"="+t+";"+n+";path=/"}function d(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "===s.charAt(0);)s=s.substring(1);if(0===s.indexOf(t))return s.substring(t.length,s.length)}return""}var f="_ALGOLIA",g=2592e6;function k(t,e){return e.map(function(e){return Object.assign({eventType:t},e)})}function p(t,n,e){return e.map(function(e){return Object.assign({eventType:t,eventSubtype:n},e)})}var b=["de","us"];function T(e){if(!l((e=void 0===e?{}:e).region)&&-1===b.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+b.join(", ")+".");if(!(l(e.cookieDuration)||r(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");var t=this,n=e,i={_userHasOptedOut:Boolean(e.userHasOptedOut),_region:e.region,_host:e.host,_anonymousUserToken:null==(i=e.anonymousUserToken)||i,_useCookie:null!=(i=e.useCookie)&&i,_cookieDuration:e.cookieDuration||6*g},s=n.partial,o=v(n,["partial"]);s||Object.assign(t,i),Object.assign(t,Object.keys(o).reduce(function(e,t){return Object.assign(Object.assign({},e),((e={})["_"+t]=o[t],e))},{})),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(a),e.authenticatedUserToken&&this.setAuthenticatedUserToken(e.authenticatedUserToken),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function _(e){e=e.requestFn,this._endpointOrigin="https://insights.algolia.io",this._anonymousUserToken=!0,this._userHasOptedOut=!1,this._useCookie=!1,this._cookieDuration=6*g,this._ua=[],this.version=t,this.sendEvents=u(e).bind(this),this.init=T.bind(this),this.addAlgoliaAgent=function(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}.bind(this),this.setUserToken=function(e){return this._userToken=e,o(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken),this._userToken}.bind(this),this.setAnonymousUserToken=function(e){(e=void 0!==e&&e)?this.setUserToken("anonymous-"+c()):n()&&((e=d(f))&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(e=this.setUserToken("anonymous-"+c()),h(f,e,this._cookieDuration)))}.bind(this),this.getUserToken=function(e,t){return o(t)&&t(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(e,t){this._onUserTokenChangeCallback=e,t&&t.immediate&&o(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAuthenticatedUserToken=function(e){return this._authenticatedUserToken=e,o(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken),this._authenticatedUserToken}.bind(this),this.getAuthenticatedUserToken=function(e,t){return o(t)&&t(null,this._authenticatedUserToken),this._authenticatedUserToken}.bind(this),this.onAuthenticatedUserTokenChange=function(e,t){this._onAuthenticatedUserTokenChangeCallback=e,t&&t.immediate&&o(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("click",n),i)}.bind(this),this.clickedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("click",n),i)}.bind(this),this.clickedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("click",n),i)}.bind(this),this.convertedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion",n),i)}.bind(this),this.purchasedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("conversion","purchase",n),i)}.bind(this),this.addedToCartObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("conversion","addToCart",n),i)}.bind(this),this.convertedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion",n),i)}.bind(this),this.addedToCartObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("conversion","addToCart",n),i)}.bind(this),this.purchasedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("conversion","purchase",n),i)}.bind(this),this.convertedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion",n),i)}.bind(this),this.viewedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("view",n),i)}.bind(this),this.viewedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("view",n),i)}.bind(this),this.getVersion=function(e){o(e)&&e(this.version)}.bind(this)}function m(e,t){var n=JSON.stringify(t),n=navigator.sendBeacon(e,n);return Promise.resolve(!!n||y(e,t))}var y=function(s,o){return new Promise(function(e,t){var n=JSON.stringify(o),i=new XMLHttpRequest;i.addEventListener("readystatechange",function(){4===i.readyState&&200===i.status?e(!0):4===i.readyState&&e(!1)}),i.addEventListener("error",function(){return t()}),i.addEventListener("timeout",function(){return e(!1)}),i.open("POST",s),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+n.length),i.send(n)})};function O(e){e=new _({requestFn:e});return"object"==typeof window&&i.call(e,window),e.version=t,e}var A=O(function(){if(function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}}())return m;if(function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}}())return y;throw new Error("Could not find a supported HTTP request client in this environment.")}());return e.createInsightsClient=O,e.default=A,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var AlgoliaAnalytics=function(e){"use strict";var t="2.10.0";function s(e){return e.reduce(function(e,t){var n=e.events,e=e.additionalParams;return"index"in t?{additionalParams:e,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void 0})}function n(){try{return Boolean(navigator.cookieEnabled)}catch(e){return}}function l(e){return void 0===e}function r(e){return"number"==typeof e}function o(e){return"function"==typeof e}function i(e){var n,i,t=e.AlgoliaAnalyticsObject;t&&(i=this,n=function(e){for(var t=[],n=arguments.length-1;0<n--;)t[n]=arguments[n+1];e&&o(i[e])?i[e].apply(i,t):console.warn("The method `"+e+"` doesn't exist.")},(e=e[t]).queue=e.queue||[],(t=e.queue).forEach(function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))}),t.push=function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))})}var a=["insights-js ("+t+")","insights-js-browser-iife ("+t+")"];function v(e,t){var n={};for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]]);return n}function u(d){return function(e,t){var i=this;if(!this._userHasOptedOut){if(!(!l(this._apiKey)&&!l(this._appId)||(null==(h=null==t?void 0:t.headers)?void 0:h["X-Algolia-Application-Id"])&&(null==(h=null==t?void 0:t.headers)?void 0:h["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 n,s,o,r,a,u,c,h=e.map(function(e){var t=e.filters,n=v(e,["filters"]),e=Object.assign(Object.assign({},n),{userToken:null!=(n=null==e?void 0:e.userToken)?n:i._userToken,authenticatedUserToken:null!=(n=null==e?void 0:e.authenticatedUserToken)?n:i._authenticatedUserToken});return l(t)||(e.filters=t.map(encodeURIComponent)),e});return e=d,n=this._ua,s=this._endpointOrigin,h=h,o=this._appId,r=this._apiKey,t=null==t?void 0:t.headers,a=(t=void 0===t?{}:t)["X-Algolia-Application-Id"],u=t["X-Algolia-API-Key"],t=v(t,["X-Algolia-Application-Id","X-Algolia-API-Key"]),c=Object.assign({"X-Algolia-Application-Id":null!=a?a:o,"X-Algolia-API-Key":null!=u?u:r,"X-Algolia-Agent":encodeURIComponent(n.join("; "))},t),a=Object.keys(c).map(function(e){return e+"="+c[e]}).join("&"),e(s+"/1/events?"+a,{events:h})}}}function c(){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)})}function h(e,t,n){var i=new Date,n=(i.setTime(i.getTime()+n),"expires="+i.toUTCString());document.cookie=e+"="+t+";"+n+";path=/"}function d(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "===s.charAt(0);)s=s.substring(1);if(0===s.indexOf(t))return s.substring(t.length,s.length)}return""}var f="_ALGOLIA",g=2592e6;function p(t,e){return e.map(function(e){return Object.assign({eventType:t},e)})}function k(t,n,e){return e.map(function(e){return Object.assign({eventType:t,eventSubtype:n},e)})}var b=["de","us"];function T(e){if(!l((e=void 0===e?{}:e).region)&&-1===b.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+b.join(", ")+".");if(!(l(e.cookieDuration)||r(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");var t=this,n=e,i={_userHasOptedOut:Boolean(e.userHasOptedOut),_region:e.region,_host:e.host,_anonymousUserToken:null==(i=e.anonymousUserToken)||i,_useCookie:null!=(i=e.useCookie)&&i,_cookieDuration:e.cookieDuration||6*g},s=n.partial,o=v(n,["partial"]);s||Object.assign(t,i),Object.assign(t,Object.keys(o).reduce(function(e,t){return Object.assign(Object.assign({},e),((e={})["_"+t]=o[t],e))},{})),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(a),e.authenticatedUserToken&&this.setAuthenticatedUserToken(e.authenticatedUserToken),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function _(e){e=e.requestFn,this._endpointOrigin="https://insights.algolia.io",this._anonymousUserToken=!0,this._userHasOptedOut=!1,this._useCookie=!1,this._cookieDuration=6*g,this._ua=[],this.version=t,this.sendEvents=u(e).bind(this),this.init=T.bind(this),this.addAlgoliaAgent=function(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}.bind(this),this.setUserToken=function(e){return this._userToken=e,o(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken),this._userToken}.bind(this),this.setAnonymousUserToken=function(e){(e=void 0!==e&&e)?this.setUserToken("anonymous-"+c()):n()&&((e=d(f))&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(e=this.setUserToken("anonymous-"+c()),h(f,e,this._cookieDuration)))}.bind(this),this.getUserToken=function(e,t){return o(t)&&t(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(e,t){this._onUserTokenChangeCallback=e,t&&t.immediate&&o(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAuthenticatedUserToken=function(e){return this._authenticatedUserToken=e,o(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken),this._authenticatedUserToken}.bind(this),this.getAuthenticatedUserToken=function(e,t){return o(t)&&t(null,this._authenticatedUserToken),this._authenticatedUserToken}.bind(this),this.onAuthenticatedUserTokenChange=function(e,t){this._onAuthenticatedUserTokenChangeCallback=e,t&&t.immediate&&o(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("click",n),i)}.bind(this),this.clickedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("click",n),i)}.bind(this),this.clickedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("click",n),i)}.bind(this),this.convertedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("conversion",n),i)}.bind(this),this.purchasedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion","purchase",n),i)}.bind(this),this.addedToCartObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion","addToCart",n),i)}.bind(this),this.convertedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("conversion",n),i)}.bind(this),this.addedToCartObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion","addToCart",n),i)}.bind(this),this.purchasedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion","purchase",n),i)}.bind(this),this.convertedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("conversion",n),i)}.bind(this),this.viewedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("view",n),i)}.bind(this),this.viewedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("view",n),i)}.bind(this),this.getVersion=function(e){o(e)&&e(this.version)}.bind(this)}function y(e,t){var n=JSON.stringify(t),n=navigator.sendBeacon(e,n);return Promise.resolve(!!n||O(e,t))}function m(e,i){return new Promise(function(t,n){fetch(e,{method:"POST",body:JSON.stringify(i),headers:{"Content-Type":"application/json"}}).then(function(e){t(200===e.status)}).catch(function(e){n(e)})})}var O=function(s,o){return new Promise(function(e,t){var n=JSON.stringify(o),i=new XMLHttpRequest;i.addEventListener("readystatechange",function(){4===i.readyState&&200===i.status?e(!0):4===i.readyState&&e(!1)}),i.addEventListener("error",function(){return t()}),i.addEventListener("timeout",function(){return e(!1)}),i.open("POST",s),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+n.length),i.send(n)})};function A(e){e=new _({requestFn:e});return"object"==typeof window&&i.call(e,window),e.version=t,e}var x=A(function(){if(function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}}())return y;if(function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}}())return O;if(function(){try{return void 0!==fetch}catch(e){return!1}}())return m;throw new Error("Could not find a supported HTTP request client in this environment.")}());return e.createInsightsClient=A,e.default=x,Object.defineProperty(e,"__esModule",{value:!0}),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="undefined"!=typeof globalThis?globalThis:e||self).AlgoliaAnalytics={})}(this,function(e){"use strict";var t="2.9.0";function s(e){return e.reduce(function(e,t){var n=e.events,e=e.additionalParams;return"index"in t?{additionalParams:e,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void 0})}function n(){try{return Boolean(navigator.cookieEnabled)}catch(e){return}}function l(e){return void 0===e}function r(e){return"number"==typeof e}function o(e){return"function"==typeof e}function i(e){var n,i,t=e.AlgoliaAnalyticsObject;t&&(i=this,n=function(e){for(var t=[],n=arguments.length-1;0<n--;)t[n]=arguments[n+1];e&&o(i[e])?i[e].apply(i,t):console.warn("The method `"+e+"` doesn't exist.")},(e=e[t]).queue=e.queue||[],(t=e.queue).forEach(function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))}),t.push=function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))})}var a=["insights-js ("+t+")","insights-js-browser-umd ("+t+")"];function f(e,t){var n={};for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]]);return n}function u(d){return function(e,t){var i=this;if(!this._userHasOptedOut){if(!(!l(this._apiKey)&&!l(this._appId)||(null==(h=null==t?void 0:t.headers)?void 0:h["X-Algolia-Application-Id"])&&(null==(h=null==t?void 0:t.headers)?void 0:h["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 n,s,o,r,a,u,c,h=e.map(function(e){var t=e.filters,n=f(e,["filters"]),e=Object.assign(Object.assign({},n),{userToken:null!=(n=null==e?void 0:e.userToken)?n:i._userToken,authenticatedUserToken:null!=(n=null==e?void 0:e.authenticatedUserToken)?n:i._authenticatedUserToken});return l(t)||(e.filters=t.map(encodeURIComponent)),e});return e=d,n=this._ua,s=this._endpointOrigin,h=h,o=this._appId,r=this._apiKey,t=null==t?void 0:t.headers,a=(t=void 0===t?{}:t)["X-Algolia-Application-Id"],u=t["X-Algolia-API-Key"],t=f(t,["X-Algolia-Application-Id","X-Algolia-API-Key"]),c=Object.assign({"X-Algolia-Application-Id":null!=a?a:o,"X-Algolia-API-Key":null!=u?u:r,"X-Algolia-Agent":encodeURIComponent(n.join("; "))},t),a=Object.keys(c).map(function(e){return e+"="+c[e]}).join("&"),e(s+"/1/events?"+a,{events:h})}}}function c(){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)})}function h(e,t,n){var i=new Date,n=(i.setTime(i.getTime()+n),"expires="+i.toUTCString());document.cookie=e+"="+t+";"+n+";path=/"}function d(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "===s.charAt(0);)s=s.substring(1);if(0===s.indexOf(t))return s.substring(t.length,s.length)}return""}var v="_ALGOLIA",g=2592e6;function p(t,e){return e.map(function(e){return Object.assign({eventType:t},e)})}function k(t,n,e){return e.map(function(e){return Object.assign({eventType:t,eventSubtype:n},e)})}var b=["de","us"];function T(e){if(!l((e=void 0===e?{}:e).region)&&-1===b.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+b.join(", ")+".");if(!(l(e.cookieDuration)||r(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");var t=this,n=e,i={_userHasOptedOut:Boolean(e.userHasOptedOut),_region:e.region,_host:e.host,_anonymousUserToken:null==(i=e.anonymousUserToken)||i,_useCookie:null!=(i=e.useCookie)&&i,_cookieDuration:e.cookieDuration||6*g},s=n.partial,o=f(n,["partial"]);s||Object.assign(t,i),Object.assign(t,Object.keys(o).reduce(function(e,t){return Object.assign(Object.assign({},e),((e={})["_"+t]=o[t],e))},{})),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(a),e.authenticatedUserToken&&this.setAuthenticatedUserToken(e.authenticatedUserToken),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function _(e){e=e.requestFn,this._endpointOrigin="https://insights.algolia.io",this._anonymousUserToken=!0,this._userHasOptedOut=!1,this._useCookie=!1,this._cookieDuration=6*g,this._ua=[],this.version=t,this.sendEvents=u(e).bind(this),this.init=T.bind(this),this.addAlgoliaAgent=function(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}.bind(this),this.setUserToken=function(e){return this._userToken=e,o(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken),this._userToken}.bind(this),this.setAnonymousUserToken=function(e){(e=void 0!==e&&e)?this.setUserToken("anonymous-"+c()):n()&&((e=d(v))&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(e=this.setUserToken("anonymous-"+c()),h(v,e,this._cookieDuration)))}.bind(this),this.getUserToken=function(e,t){return o(t)&&t(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(e,t){this._onUserTokenChangeCallback=e,t&&t.immediate&&o(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAuthenticatedUserToken=function(e){return this._authenticatedUserToken=e,o(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken),this._authenticatedUserToken}.bind(this),this.getAuthenticatedUserToken=function(e,t){return o(t)&&t(null,this._authenticatedUserToken),this._authenticatedUserToken}.bind(this),this.onAuthenticatedUserTokenChange=function(e,t){this._onAuthenticatedUserTokenChangeCallback=e,t&&t.immediate&&o(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("click",n),i)}.bind(this),this.clickedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("click",n),i)}.bind(this),this.clickedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("click",n),i)}.bind(this),this.convertedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("conversion",n),i)}.bind(this),this.purchasedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion","purchase",n),i)}.bind(this),this.addedToCartObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion","addToCart",n),i)}.bind(this),this.convertedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("conversion",n),i)}.bind(this),this.addedToCartObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion","addToCart",n),i)}.bind(this),this.purchasedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion","purchase",n),i)}.bind(this),this.convertedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("conversion",n),i)}.bind(this),this.viewedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("view",n),i)}.bind(this),this.viewedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=s(e)).events,i=i.additionalParams;return this.sendEvents(p("view",n),i)}.bind(this),this.getVersion=function(e){o(e)&&e(this.version)}.bind(this)}function m(e,t){var n=JSON.stringify(t),n=navigator.sendBeacon(e,n);return Promise.resolve(!!n||y(e,t))}var y=function(s,o){return new Promise(function(e,t){var n=JSON.stringify(o),i=new XMLHttpRequest;i.addEventListener("readystatechange",function(){4===i.readyState&&200===i.status?e(!0):4===i.readyState&&e(!1)}),i.addEventListener("error",function(){return t()}),i.addEventListener("timeout",function(){return e(!1)}),i.open("POST",s),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+n.length),i.send(n)})};function O(e){e=new _({requestFn:e});return"object"==typeof window&&i.call(e,window),e.version=t,e}var x=O(function(){if(function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}}())return m;if(function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}}())return y;throw new Error("Could not find a supported HTTP request client in this environment.")}());e.createInsightsClient=O,e.default=x,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="undefined"!=typeof globalThis?globalThis:e||self).AlgoliaAnalytics={})}(this,function(e){"use strict";var t="2.10.0";function o(e){return e.reduce(function(e,t){var n=e.events,e=e.additionalParams;return"index"in t?{additionalParams:e,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void 0})}function n(){try{return Boolean(navigator.cookieEnabled)}catch(e){return}}function l(e){return void 0===e}function r(e){return"number"==typeof e}function s(e){return"function"==typeof e}function i(e){var n,i,t=e.AlgoliaAnalyticsObject;t&&(i=this,n=function(e){for(var t=[],n=arguments.length-1;0<n--;)t[n]=arguments[n+1];e&&s(i[e])?i[e].apply(i,t):console.warn("The method `"+e+"` doesn't exist.")},(e=e[t]).queue=e.queue||[],(t=e.queue).forEach(function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))}),t.push=function(e){var e=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void 0,[t].concat(e))})}var a=["insights-js ("+t+")","insights-js-browser-umd ("+t+")"];function f(e,t){var n={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,o=Object.getOwnPropertySymbols(e);i<o.length;i++)t.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(n[o[i]]=e[o[i]]);return n}function u(d){return function(e,t){var i=this;if(!this._userHasOptedOut){if(!(!l(this._apiKey)&&!l(this._appId)||(null==(h=null==t?void 0:t.headers)?void 0:h["X-Algolia-Application-Id"])&&(null==(h=null==t?void 0:t.headers)?void 0:h["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 n,o,s,r,a,u,c,h=e.map(function(e){var t=e.filters,n=f(e,["filters"]),e=Object.assign(Object.assign({},n),{userToken:null!=(n=null==e?void 0:e.userToken)?n:i._userToken,authenticatedUserToken:null!=(n=null==e?void 0:e.authenticatedUserToken)?n:i._authenticatedUserToken});return l(t)||(e.filters=t.map(encodeURIComponent)),e});return e=d,n=this._ua,o=this._endpointOrigin,h=h,s=this._appId,r=this._apiKey,t=null==t?void 0:t.headers,a=(t=void 0===t?{}:t)["X-Algolia-Application-Id"],u=t["X-Algolia-API-Key"],t=f(t,["X-Algolia-Application-Id","X-Algolia-API-Key"]),c=Object.assign({"X-Algolia-Application-Id":null!=a?a:s,"X-Algolia-API-Key":null!=u?u:r,"X-Algolia-Agent":encodeURIComponent(n.join("; "))},t),a=Object.keys(c).map(function(e){return e+"="+c[e]}).join("&"),e(o+"/1/events?"+a,{events:h})}}}function c(){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)})}function h(e,t,n){var i=new Date,n=(i.setTime(i.getTime()+n),"expires="+i.toUTCString());document.cookie=e+"="+t+";"+n+";path=/"}function d(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""}var v="_ALGOLIA",p=2592e6;function g(t,e){return e.map(function(e){return Object.assign({eventType:t},e)})}function k(t,n,e){return e.map(function(e){return Object.assign({eventType:t,eventSubtype:n},e)})}var b=["de","us"];function T(e){if(!l((e=void 0===e?{}:e).region)&&-1===b.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+b.join(", ")+".");if(!(l(e.cookieDuration)||r(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");var t=this,n=e,i={_userHasOptedOut:Boolean(e.userHasOptedOut),_region:e.region,_host:e.host,_anonymousUserToken:null==(i=e.anonymousUserToken)||i,_useCookie:null!=(i=e.useCookie)&&i,_cookieDuration:e.cookieDuration||6*p},o=n.partial,s=f(n,["partial"]);o||Object.assign(t,i),Object.assign(t,Object.keys(s).reduce(function(e,t){return Object.assign(Object.assign({},e),((e={})["_"+t]=s[t],e))},{})),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(a),e.authenticatedUserToken&&this.setAuthenticatedUserToken(e.authenticatedUserToken),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie||this.setAnonymousUserToken()}function y(e){e=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=t,this.sendEvents=u(e).bind(this),this.init=T.bind(this),this.addAlgoliaAgent=function(e){-1===this._ua.indexOf(e)&&this._ua.push(e)}.bind(this),this.setUserToken=function(e){return this._userToken=e,s(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken),this._userToken}.bind(this),this.setAnonymousUserToken=function(e){(e=void 0!==e&&e)?this.setUserToken("anonymous-"+c()):n()&&((e=d(v))&&""!==e&&0===e.indexOf("anonymous-")?this.setUserToken(e):(e=this.setUserToken("anonymous-"+c()),h(v,e,this._cookieDuration)))}.bind(this),this.getUserToken=function(e,t){return s(t)&&t(null,this._userToken),this._userToken}.bind(this),this.onUserTokenChange=function(e,t){this._onUserTokenChangeCallback=e,t&&t.immediate&&s(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}.bind(this),this.setAuthenticatedUserToken=function(e){return this._authenticatedUserToken=e,s(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken),this._authenticatedUserToken}.bind(this),this.getAuthenticatedUserToken=function(e,t){return s(t)&&t(null,this._authenticatedUserToken),this._authenticatedUserToken}.bind(this),this.onAuthenticatedUserTokenChange=function(e,t){this._onAuthenticatedUserTokenChangeCallback=e,t&&t.immediate&&s(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken)}.bind(this),this.clickedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=o(e)).events,i=i.additionalParams;return this.sendEvents(g("click",n),i)}.bind(this),this.clickedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=o(e)).events,i=i.additionalParams;return this.sendEvents(g("click",n),i)}.bind(this),this.clickedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=o(e)).events,i=i.additionalParams;return this.sendEvents(g("click",n),i)}.bind(this),this.convertedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=o(e)).events,i=i.additionalParams;return this.sendEvents(g("conversion",n),i)}.bind(this),this.purchasedObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=o(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion","purchase",n),i)}.bind(this),this.addedToCartObjectIDsAfterSearch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=o(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion","addToCart",n),i)}.bind(this),this.convertedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=o(e)).events,i=i.additionalParams;return this.sendEvents(g("conversion",n),i)}.bind(this),this.addedToCartObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=o(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion","addToCart",n),i)}.bind(this),this.purchasedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=o(e)).events,i=i.additionalParams;return this.sendEvents(k("conversion","purchase",n),i)}.bind(this),this.convertedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=o(e)).events,i=i.additionalParams;return this.sendEvents(g("conversion",n),i)}.bind(this),this.viewedObjectIDs=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=o(e)).events,i=i.additionalParams;return this.sendEvents(g("view",n),i)}.bind(this),this.viewedFilters=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=(i=o(e)).events,i=i.additionalParams;return this.sendEvents(g("view",n),i)}.bind(this),this.getVersion=function(e){s(e)&&e(this.version)}.bind(this)}function m(e,t){var n=JSON.stringify(t),n=navigator.sendBeacon(e,n);return Promise.resolve(!!n||O(e,t))}function _(e,i){return new Promise(function(t,n){fetch(e,{method:"POST",body:JSON.stringify(i),headers:{"Content-Type":"application/json"}}).then(function(e){t(200===e.status)}).catch(function(e){n(e)})})}var O=function(o,s){return new Promise(function(e,t){var n=JSON.stringify(s),i=new XMLHttpRequest;i.addEventListener("readystatechange",function(){4===i.readyState&&200===i.status?e(!0):4===i.readyState&&e(!1)}),i.addEventListener("error",function(){return t()}),i.addEventListener("timeout",function(){return e(!1)}),i.open("POST",o),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Content-Length",""+n.length),i.send(n)})};function x(e){e=new y({requestFn:e});return"object"==typeof window&&i.call(e,window),e.version=t,e}var A=x(function(){if(function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}}())return m;if(function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}}())return O;if(function(){try{return void 0!==fetch}catch(e){return!1}}())return _;throw new Error("Could not find a supported HTTP request client in this environment.")}());e.createInsightsClient=x,e.default=A,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -5,1 +5,2 @@ export declare const supportsCookies: () => boolean;

export declare const supportsNodeHttpModule: () => boolean;
export declare const supportsNativeFetch: () => boolean;

@@ -5,1 +5,2 @@ export type RequestFnType = (url: string, data: Record<string, unknown>) => Promise<boolean>;

export declare const requestWithNodeHttpModule: RequestFnType;
export declare const requestWithNativeFetch: RequestFnType;

@@ -36,1 +36,9 @@ export const supportsCookies = (): boolean => {

};
export const supportsNativeFetch = (): boolean => {
try {
return fetch !== undefined;
} catch (e) {
return false;
}
};

@@ -1,4 +0,12 @@

import { supportsSendBeacon, supportsXMLHttpRequest } from "./featureDetection";
import {
supportsNativeFetch,
supportsSendBeacon,
supportsXMLHttpRequest
} from "./featureDetection";
import type { RequestFnType } from "./request";
import { requestWithSendBeacon, requestWithXMLHttpRequest } from "./request";
import {
requestWithNativeFetch,
requestWithSendBeacon,
requestWithXMLHttpRequest
} from "./request";

@@ -14,2 +22,6 @@ export function getRequesterForBrowser(): RequestFnType {

if (supportsNativeFetch()) {
return requestWithNativeFetch;
}
throw new Error(

@@ -16,0 +28,0 @@ "Could not find a supported HTTP request client in this environment."

@@ -1,4 +0,7 @@

import { supportsNodeHttpModule } from "./featureDetection";
import {
supportsNodeHttpModule,
supportsNativeFetch
} from "./featureDetection";
import type { RequestFnType } from "./request";
import { requestWithNodeHttpModule } from "./request";
import { requestWithNodeHttpModule, requestWithNativeFetch } from "./request";

@@ -10,2 +13,6 @@ export function getRequesterForNode(): RequestFnType {

if (supportsNativeFetch()) {
return requestWithNativeFetch;
}
throw new Error(

@@ -12,0 +19,0 @@ "Could not find a supported HTTP request client in this environment."

@@ -81,1 +81,19 @@ import type { request as nodeRequest } from "http";

};
export const requestWithNativeFetch: RequestFnType = (url, data) => {
return new Promise((resolve, reject) => {
fetch(url, {
method: "POST",
body: JSON.stringify(data),
headers: {
"Content-Type": "application/json"
}
})
.then((response) => {
resolve(response.status === 200);
})
.catch((e) => {
reject(e);
});
});
};
{
"name": "search-insights",
"description": "Library for reporting click, conversion and view metrics using the Algolia Insights API",
"version": "2.9.0",
"version": "2.10.0",
"jsdelivr": "dist/search-insights.min.js",

@@ -70,2 +70,3 @@ "main": "index-node.cjs.js",

"jest-environment-jsdom": "^29.6.4",
"jest-fetch-mock": "^3.0.3",
"jest-localstorage-mock": "^2.4.26",

@@ -72,0 +73,0 @@ "jest-watch-typeahead": "^2.2.2",

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