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

@algolia/client-insights

Package Overview
Dependencies
Maintainers
3
Versions
168
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/client-insights - npm Package Compare versions

Comparing version 5.17.1 to 5.18.0

dist/builds/worker.js

2

dist/browser.d.ts

@@ -577,3 +577,3 @@ import * as _algolia_client_common from '@algolia/client-common';

declare const apiClientVersion = "5.17.1";
declare const apiClientVersion = "5.18.0";
declare const REGIONS: readonly ["de", "us"];

@@ -580,0 +580,0 @@ type Region = (typeof REGIONS)[number];

@@ -12,3 +12,3 @@ // builds/browser.ts

import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.17.1";
var apiClientVersion = "5.18.0";
var REGIONS = ["de", "us"];

@@ -15,0 +15,0 @@ function getDefaultHosts(region) {

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

function H(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>t.setRequestHeader(a,e.headers[a]));let n=(a,s)=>setTimeout(()=>{t.abort(),o({status:0,content:s,isTimedOut:!0})},a),l=n(e.connectTimeout,"Connection timeout"),h;t.onreadystatechange=()=>{t.readyState>t.OPENED&&h===void 0&&(clearTimeout(l),h=n(e.responseTimeout,"Socket timeout"))},t.onerror=()=>{t.status===0&&(clearTimeout(l),clearTimeout(h),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}))},t.onload=()=>{clearTimeout(l),clearTimeout(h),o({content:t.responseText,status:t.status,isTimedOut:!1})},t.send(e.data)})}return{send:r}}function W(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function n(){return JSON.parse(t().getItem(o)||"{}")}function l(a){t().setItem(o,JSON.stringify(a))}function h(){let a=r.timeToLive?r.timeToLive*1e3:null,s=n(),i=Object.fromEntries(Object.entries(s).filter(([,d])=>d.timestamp!==void 0));if(l(i),!a)return;let m=Object.fromEntries(Object.entries(i).filter(([,d])=>{let y=new Date().getTime();return!(d.timestamp+a<y)}));l(m)}return{get(a,s,i={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),n()[JSON.stringify(a)])).then(m=>Promise.all([m?m.value:s(),m!==void 0])).then(([m,d])=>Promise.all([m,d||i.miss(m)])).then(([m])=>m)},set(a,s){return Promise.resolve().then(()=>{let i=n();return i[JSON.stringify(a)]={timestamp:new Date().getTime(),value:s},t().setItem(o,JSON.stringify(i)),s})},delete(a){return Promise.resolve().then(()=>{let s=n();delete s[JSON.stringify(a)],t().setItem(o,JSON.stringify(s))})},clear(){return Promise.resolve().then(()=>{t().removeItem(o)})}}}function V(){return{get(r,e,o={miss:()=>Promise.resolve()}){return e().then(n=>Promise.all([n,o.miss(n)])).then(([n])=>n)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function w(r){let e=[...r.caches],o=e.shift();return o===void 0?V():{get(t,n,l={miss:()=>Promise.resolve()}){return o.get(t,n,l).catch(()=>w({caches:e}).get(t,n,l))},set(t,n){return o.set(t,n).catch(()=>w({caches:e}).set(t,n))},delete(t){return o.delete(t).catch(()=>w({caches:e}).delete(t))},clear(){return o.clear().catch(()=>w({caches:e}).clear())}}}function q(r={serializable:!0}){let e={};return{get(o,t,n={miss:()=>Promise.resolve()}){let l=JSON.stringify(o);if(l in e)return Promise.resolve(r.serializable?JSON.parse(e[l]):e[l]);let h=t();return h.then(a=>n.miss(a)).then(()=>h)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function Y(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function J(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return{headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function z({algoliaAgents:r,client:e,version:o}){let t=Y(o).add({segment:e,version:o});return r.forEach(n=>t.add(n)),t}function M(){return{debug(r,e){return Promise.resolve()},info(r,e){return Promise.resolve()},error(r,e){return Promise.resolve()}}}var $=2*60*1e3;function j(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>$}function n(){return e==="timed out"&&Date.now()-o<=$}return{...r,status:e,lastUpdate:o,isUp:t,isTimedOut:n}}var Q=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e)}},G=class extends Q{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e}},Z=class extends G{constructor(r){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",r,"RetryError")}},N=class extends G{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e}},ee=class extends Q{response;constructor(r,e){super(r,"DeserializationError"),this.response=e}},re=class extends N{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o}};function te(r,e,o){let t=oe(o),n=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(n+=`?${t}`),n}function oe(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replace(/\+/g,"%20")}`).join("&")}function se(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function ne(r,e,o){let t={Accept:"application/json",...r,...e,...o},n={};return Object.keys(t).forEach(l=>{let h=t[l];n[l.toLowerCase()]=h}),n}function ae(r){try{return JSON.parse(r.content)}catch(e){throw new ee(e.message,r)}}function ie({content:r,status:e},o){try{let t=JSON.parse(r);return"error"in t?new re(t.message,e,t.error,o):new N(t.message,e,o)}catch{}return new N(r,e,o)}function ce({isTimedOut:r,status:e}){return!r&&~~e===0}function ue({isTimedOut:r,status:e}){return r||ce({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:r}){return~~(r/100)===2}function me(r){return r.map(e=>F(e))}function F(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function B({hosts:r,hostsCache:e,baseHeaders:o,logger:t,baseQueryParameters:n,algoliaAgent:l,timeouts:h,requester:a,requestsCache:s,responsesCache:i}){async function m(c){let u=await Promise.all(c.map(p=>e.get(p,()=>Promise.resolve(j(p))))),g=u.filter(p=>p.isUp()),P=u.filter(p=>p.isTimedOut()),R=[...g,...P];return{hosts:R.length>0?R:c,getTimeout(p,v){return(P.length===0&&p===0?1:P.length+3+p)*v}}}async function d(c,u,g=!0){let P=[],R=se(c,u),E=ne(o,c.headers,u.headers),p=c.method==="GET"?{...c.data,...u.data}:{},v={...n,...c.queryParameters,...p};if(l.value&&(v["x-algolia-agent"]=l.value),u&&u.queryParameters)for(let f of Object.keys(u.queryParameters))!u.queryParameters[f]||Object.prototype.toString.call(u.queryParameters[f])==="[object Object]"?v[f]=u.queryParameters[f]:v[f]=u.queryParameters[f].toString();let O=0,I=async(f,C)=>{let x=f.pop();if(x===void 0)throw new Z(me(P));let b={...h,...u.timeouts},_={data:R,headers:E,method:c.method,url:te(x,c.path,v),connectTimeout:C(O,b.connect),responseTimeout:C(O,g?b.read:b.write)},U=S=>{let L={request:_,response:S,host:x,triesLeft:f.length};return P.push(L),L},T=await a.send(_);if(ue(T)){let S=U(T);return T.isTimedOut&&O++,t.info("Retryable failure",F(S)),await e.set(x,j(x,T.isTimedOut?"timed out":"down")),I(f,C)}if(le(T))return ae(T);throw U(T),ie(T,P)},K=r.filter(f=>f.accept==="readWrite"||(g?f.accept==="read":f.accept==="write")),k=await m(K);return I([...k.hosts].reverse(),k.getTimeout)}function y(c,u={}){let g=c.useReadTransporter||c.method==="GET";if(!g)return d(c,u,g);let P=()=>d(c,u);if((u.cacheable||c.cacheable)!==!0)return P();let E={request:c,requestOptions:u,transporter:{queryParameters:n,headers:o}};return i.get(E,()=>s.get(E,()=>s.set(E,P()).then(p=>Promise.all([s.delete(E),p]),p=>Promise.all([s.delete(E),Promise.reject(p)])).then(([p,v])=>v)),{miss:p=>i.set(E,p)})}return{hostsCache:e,requester:a,timeouts:h,logger:t,algoliaAgent:l,baseHeaders:o,baseQueryParameters:n,hosts:r,request:y,requestsCache:s,responsesCache:i}}var A="5.17.1",D=["de","us"];function pe(r){return[{url:r?"insights.{region}.algolia.io".replace("{region}",r):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function X({appId:r,apiKey:e,authMode:o,algoliaAgents:t,region:n,...l}){let h=J(r,e,o),a=B({hosts:pe(n),...l,algoliaAgent:z({algoliaAgents:t,client:"Insights",version:A}),baseHeaders:{"content-type":"text/plain",...h.headers(),...l.baseHeaders},baseQueryParameters:{...h.queryParameters(),...l.baseQueryParameters}});return{transporter:a,appId:r,clearCache(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then(()=>{})},get _ua(){return a.algoliaAgent.value},addAlgoliaAgent(s,i){a.algoliaAgent.add({segment:s,version:i})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?a.baseHeaders["x-algolia-api-key"]=s:a.baseQueryParameters["x-algolia-api-key"]=s},customDelete({path:s,parameters:i},m){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return a.request(u,m)},customGet({path:s,parameters:i},m){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return a.request(u,m)},customPost({path:s,parameters:i,body:m},d){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let g={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:m||{}};return a.request(g,d)},customPut({path:s,parameters:i,body:m},d){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let g={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:m||{}};return a.request(g,d)},deleteUserToken({userToken:s},i){if(!s)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let c={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,i)},pushEvents(s,i){if(!s)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!s.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let c={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:s};return a.request(c,i)}}}function er(r,e,o,t){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(o&&(typeof o!="string"||!D.includes(o)))throw new Error(`\`region\` must be one of the following: ${D.join(", ")}`);return X({appId:r,apiKey:e,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},logger:M(),requester:H(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:q(),requestsCache:q({serializable:!1}),hostsCache:w({caches:[W({key:`${A}-${r}`}),q()]}),...t})}export{A as apiClientVersion,er as insightsClient};
function H(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>t.setRequestHeader(a,e.headers[a]));let n=(a,s)=>setTimeout(()=>{t.abort(),o({status:0,content:s,isTimedOut:!0})},a),l=n(e.connectTimeout,"Connection timeout"),h;t.onreadystatechange=()=>{t.readyState>t.OPENED&&h===void 0&&(clearTimeout(l),h=n(e.responseTimeout,"Socket timeout"))},t.onerror=()=>{t.status===0&&(clearTimeout(l),clearTimeout(h),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}))},t.onload=()=>{clearTimeout(l),clearTimeout(h),o({content:t.responseText,status:t.status,isTimedOut:!1})},t.send(e.data)})}return{send:r}}function W(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function n(){return JSON.parse(t().getItem(o)||"{}")}function l(a){t().setItem(o,JSON.stringify(a))}function h(){let a=r.timeToLive?r.timeToLive*1e3:null,s=n(),i=Object.fromEntries(Object.entries(s).filter(([,d])=>d.timestamp!==void 0));if(l(i),!a)return;let m=Object.fromEntries(Object.entries(i).filter(([,d])=>{let y=new Date().getTime();return!(d.timestamp+a<y)}));l(m)}return{get(a,s,i={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),n()[JSON.stringify(a)])).then(m=>Promise.all([m?m.value:s(),m!==void 0])).then(([m,d])=>Promise.all([m,d||i.miss(m)])).then(([m])=>m)},set(a,s){return Promise.resolve().then(()=>{let i=n();return i[JSON.stringify(a)]={timestamp:new Date().getTime(),value:s},t().setItem(o,JSON.stringify(i)),s})},delete(a){return Promise.resolve().then(()=>{let s=n();delete s[JSON.stringify(a)],t().setItem(o,JSON.stringify(s))})},clear(){return Promise.resolve().then(()=>{t().removeItem(o)})}}}function V(){return{get(r,e,o={miss:()=>Promise.resolve()}){return e().then(n=>Promise.all([n,o.miss(n)])).then(([n])=>n)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function w(r){let e=[...r.caches],o=e.shift();return o===void 0?V():{get(t,n,l={miss:()=>Promise.resolve()}){return o.get(t,n,l).catch(()=>w({caches:e}).get(t,n,l))},set(t,n){return o.set(t,n).catch(()=>w({caches:e}).set(t,n))},delete(t){return o.delete(t).catch(()=>w({caches:e}).delete(t))},clear(){return o.clear().catch(()=>w({caches:e}).clear())}}}function q(r={serializable:!0}){let e={};return{get(o,t,n={miss:()=>Promise.resolve()}){let l=JSON.stringify(o);if(l in e)return Promise.resolve(r.serializable?JSON.parse(e[l]):e[l]);let h=t();return h.then(a=>n.miss(a)).then(()=>h)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function Y(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function J(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return{headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function z({algoliaAgents:r,client:e,version:o}){let t=Y(o).add({segment:e,version:o});return r.forEach(n=>t.add(n)),t}function M(){return{debug(r,e){return Promise.resolve()},info(r,e){return Promise.resolve()},error(r,e){return Promise.resolve()}}}var $=2*60*1e3;function j(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>$}function n(){return e==="timed out"&&Date.now()-o<=$}return{...r,status:e,lastUpdate:o,isUp:t,isTimedOut:n}}var Q=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e)}},G=class extends Q{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e}},Z=class extends G{constructor(r){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",r,"RetryError")}},N=class extends G{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e}},ee=class extends Q{response;constructor(r,e){super(r,"DeserializationError"),this.response=e}},re=class extends N{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o}};function te(r,e,o){let t=oe(o),n=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(n+=`?${t}`),n}function oe(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replace(/\+/g,"%20")}`).join("&")}function se(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function ne(r,e,o){let t={Accept:"application/json",...r,...e,...o},n={};return Object.keys(t).forEach(l=>{let h=t[l];n[l.toLowerCase()]=h}),n}function ae(r){try{return JSON.parse(r.content)}catch(e){throw new ee(e.message,r)}}function ie({content:r,status:e},o){try{let t=JSON.parse(r);return"error"in t?new re(t.message,e,t.error,o):new N(t.message,e,o)}catch{}return new N(r,e,o)}function ce({isTimedOut:r,status:e}){return!r&&~~e===0}function ue({isTimedOut:r,status:e}){return r||ce({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:r}){return~~(r/100)===2}function me(r){return r.map(e=>F(e))}function F(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function B({hosts:r,hostsCache:e,baseHeaders:o,logger:t,baseQueryParameters:n,algoliaAgent:l,timeouts:h,requester:a,requestsCache:s,responsesCache:i}){async function m(c){let u=await Promise.all(c.map(p=>e.get(p,()=>Promise.resolve(j(p))))),g=u.filter(p=>p.isUp()),P=u.filter(p=>p.isTimedOut()),R=[...g,...P];return{hosts:R.length>0?R:c,getTimeout(p,v){return(P.length===0&&p===0?1:P.length+3+p)*v}}}async function d(c,u,g=!0){let P=[],R=se(c,u),E=ne(o,c.headers,u.headers),p=c.method==="GET"?{...c.data,...u.data}:{},v={...n,...c.queryParameters,...p};if(l.value&&(v["x-algolia-agent"]=l.value),u&&u.queryParameters)for(let f of Object.keys(u.queryParameters))!u.queryParameters[f]||Object.prototype.toString.call(u.queryParameters[f])==="[object Object]"?v[f]=u.queryParameters[f]:v[f]=u.queryParameters[f].toString();let O=0,I=async(f,C)=>{let x=f.pop();if(x===void 0)throw new Z(me(P));let b={...h,...u.timeouts},_={data:R,headers:E,method:c.method,url:te(x,c.path,v),connectTimeout:C(O,b.connect),responseTimeout:C(O,g?b.read:b.write)},U=S=>{let L={request:_,response:S,host:x,triesLeft:f.length};return P.push(L),L},T=await a.send(_);if(ue(T)){let S=U(T);return T.isTimedOut&&O++,t.info("Retryable failure",F(S)),await e.set(x,j(x,T.isTimedOut?"timed out":"down")),I(f,C)}if(le(T))return ae(T);throw U(T),ie(T,P)},K=r.filter(f=>f.accept==="readWrite"||(g?f.accept==="read":f.accept==="write")),k=await m(K);return I([...k.hosts].reverse(),k.getTimeout)}function y(c,u={}){let g=c.useReadTransporter||c.method==="GET";if(!g)return d(c,u,g);let P=()=>d(c,u);if((u.cacheable||c.cacheable)!==!0)return P();let E={request:c,requestOptions:u,transporter:{queryParameters:n,headers:o}};return i.get(E,()=>s.get(E,()=>s.set(E,P()).then(p=>Promise.all([s.delete(E),p]),p=>Promise.all([s.delete(E),Promise.reject(p)])).then(([p,v])=>v)),{miss:p=>i.set(E,p)})}return{hostsCache:e,requester:a,timeouts:h,logger:t,algoliaAgent:l,baseHeaders:o,baseQueryParameters:n,hosts:r,request:y,requestsCache:s,responsesCache:i}}var A="5.18.0",D=["de","us"];function pe(r){return[{url:r?"insights.{region}.algolia.io".replace("{region}",r):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function X({appId:r,apiKey:e,authMode:o,algoliaAgents:t,region:n,...l}){let h=J(r,e,o),a=B({hosts:pe(n),...l,algoliaAgent:z({algoliaAgents:t,client:"Insights",version:A}),baseHeaders:{"content-type":"text/plain",...h.headers(),...l.baseHeaders},baseQueryParameters:{...h.queryParameters(),...l.baseQueryParameters}});return{transporter:a,appId:r,clearCache(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then(()=>{})},get _ua(){return a.algoliaAgent.value},addAlgoliaAgent(s,i){a.algoliaAgent.add({segment:s,version:i})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?a.baseHeaders["x-algolia-api-key"]=s:a.baseQueryParameters["x-algolia-api-key"]=s},customDelete({path:s,parameters:i},m){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return a.request(u,m)},customGet({path:s,parameters:i},m){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return a.request(u,m)},customPost({path:s,parameters:i,body:m},d){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let g={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:m||{}};return a.request(g,d)},customPut({path:s,parameters:i,body:m},d){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let g={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:m||{}};return a.request(g,d)},deleteUserToken({userToken:s},i){if(!s)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let c={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,i)},pushEvents(s,i){if(!s)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!s.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let c={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:s};return a.request(c,i)}}}function er(r,e,o,t){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(o&&(typeof o!="string"||!D.includes(o)))throw new Error(`\`region\` must be one of the following: ${D.join(", ")}`);return X({appId:r,apiKey:e,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},logger:M(),requester:H(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:q(),requestsCache:q({serializable:!1}),hostsCache:w({caches:[W({key:`${A}-${r}`}),q()]}),...t})}export{A as apiClientVersion,er as insightsClient};
//# sourceMappingURL=browser.min.js.map

@@ -7,3 +7,3 @@ (function (global, factory) {

function H(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>t.setRequestHeader(a,e.headers[a]));let n=(a,s)=>setTimeout(()=>{t.abort(),o({status:0,content:s,isTimedOut:!0});},a),l=n(e.connectTimeout,"Connection timeout"),h;t.onreadystatechange=()=>{t.readyState>t.OPENED&&h===void 0&&(clearTimeout(l),h=n(e.responseTimeout,"Socket timeout"));},t.onerror=()=>{t.status===0&&(clearTimeout(l),clearTimeout(h),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}));},t.onload=()=>{clearTimeout(l),clearTimeout(h),o({content:t.responseText,status:t.status,isTimedOut:!1});},t.send(e.data);})}return {send:r}}function W(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function n(){return JSON.parse(t().getItem(o)||"{}")}function l(a){t().setItem(o,JSON.stringify(a));}function h(){let a=r.timeToLive?r.timeToLive*1e3:null,s=n(),i=Object.fromEntries(Object.entries(s).filter(([,d])=>d.timestamp!==void 0));if(l(i),!a)return;let m=Object.fromEntries(Object.entries(i).filter(([,d])=>{let y=new Date().getTime();return !(d.timestamp+a<y)}));l(m);}return {get(a,s,i={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),n()[JSON.stringify(a)])).then(m=>Promise.all([m?m.value:s(),m!==void 0])).then(([m,d])=>Promise.all([m,d||i.miss(m)])).then(([m])=>m)},set(a,s){return Promise.resolve().then(()=>{let i=n();return i[JSON.stringify(a)]={timestamp:new Date().getTime(),value:s},t().setItem(o,JSON.stringify(i)),s})},delete(a){return Promise.resolve().then(()=>{let s=n();delete s[JSON.stringify(a)],t().setItem(o,JSON.stringify(s));})},clear(){return Promise.resolve().then(()=>{t().removeItem(o);})}}}function V(){return {get(r,e,o={miss:()=>Promise.resolve()}){return e().then(n=>Promise.all([n,o.miss(n)])).then(([n])=>n)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function w(r){let e=[...r.caches],o=e.shift();return o===void 0?V():{get(t,n,l={miss:()=>Promise.resolve()}){return o.get(t,n,l).catch(()=>w({caches:e}).get(t,n,l))},set(t,n){return o.set(t,n).catch(()=>w({caches:e}).set(t,n))},delete(t){return o.delete(t).catch(()=>w({caches:e}).delete(t))},clear(){return o.clear().catch(()=>w({caches:e}).clear())}}}function q(r={serializable:!0}){let e={};return {get(o,t,n={miss:()=>Promise.resolve()}){let l=JSON.stringify(o);if(l in e)return Promise.resolve(r.serializable?JSON.parse(e[l]):e[l]);let h=t();return h.then(a=>n.miss(a)).then(()=>h)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function Y(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function J(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return {headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function z({algoliaAgents:r,client:e,version:o}){let t=Y(o).add({segment:e,version:o});return r.forEach(n=>t.add(n)),t}function M(){return {debug(r,e){return Promise.resolve()},info(r,e){return Promise.resolve()},error(r,e){return Promise.resolve()}}}var $=2*60*1e3;function j(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>$}function n(){return e==="timed out"&&Date.now()-o<=$}return {...r,status:e,lastUpdate:o,isUp:t,isTimedOut:n}}var Q=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e);}},G=class extends Q{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e;}},Z=class extends G{constructor(r){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",r,"RetryError");}},N=class extends G{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e;}},ee=class extends Q{response;constructor(r,e){super(r,"DeserializationError"),this.response=e;}},re=class extends N{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o;}};function te(r,e,o){let t=oe(o),n=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(n+=`?${t}`),n}function oe(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replace(/\+/g,"%20")}`).join("&")}function se(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function ne(r,e,o){let t={Accept:"application/json",...r,...e,...o},n={};return Object.keys(t).forEach(l=>{let h=t[l];n[l.toLowerCase()]=h;}),n}function ae(r){try{return JSON.parse(r.content)}catch(e){throw new ee(e.message,r)}}function ie({content:r,status:e},o){try{let t=JSON.parse(r);return "error"in t?new re(t.message,e,t.error,o):new N(t.message,e,o)}catch{}return new N(r,e,o)}function ce({isTimedOut:r,status:e}){return !r&&~~e===0}function ue({isTimedOut:r,status:e}){return r||ce({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:r}){return ~~(r/100)===2}function me(r){return r.map(e=>F(e))}function F(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function B({hosts:r,hostsCache:e,baseHeaders:o,logger:t,baseQueryParameters:n,algoliaAgent:l,timeouts:h,requester:a,requestsCache:s,responsesCache:i}){async function m(c){let u=await Promise.all(c.map(p=>e.get(p,()=>Promise.resolve(j(p))))),g=u.filter(p=>p.isUp()),P=u.filter(p=>p.isTimedOut()),R=[...g,...P];return {hosts:R.length>0?R:c,getTimeout(p,v){return (P.length===0&&p===0?1:P.length+3+p)*v}}}async function d(c,u,g=!0){let P=[],R=se(c,u),E=ne(o,c.headers,u.headers),p=c.method==="GET"?{...c.data,...u.data}:{},v={...n,...c.queryParameters,...p};if(l.value&&(v["x-algolia-agent"]=l.value),u&&u.queryParameters)for(let f of Object.keys(u.queryParameters))!u.queryParameters[f]||Object.prototype.toString.call(u.queryParameters[f])==="[object Object]"?v[f]=u.queryParameters[f]:v[f]=u.queryParameters[f].toString();let O=0,I=async(f,C)=>{let x=f.pop();if(x===void 0)throw new Z(me(P));let b={...h,...u.timeouts},_={data:R,headers:E,method:c.method,url:te(x,c.path,v),connectTimeout:C(O,b.connect),responseTimeout:C(O,g?b.read:b.write)},U=S=>{let L={request:_,response:S,host:x,triesLeft:f.length};return P.push(L),L},T=await a.send(_);if(ue(T)){let S=U(T);return T.isTimedOut&&O++,t.info("Retryable failure",F(S)),await e.set(x,j(x,T.isTimedOut?"timed out":"down")),I(f,C)}if(le(T))return ae(T);throw U(T),ie(T,P)},K=r.filter(f=>f.accept==="readWrite"||(g?f.accept==="read":f.accept==="write")),k=await m(K);return I([...k.hosts].reverse(),k.getTimeout)}function y(c,u={}){let g=c.useReadTransporter||c.method==="GET";if(!g)return d(c,u,g);let P=()=>d(c,u);if((u.cacheable||c.cacheable)!==!0)return P();let E={request:c,requestOptions:u,transporter:{queryParameters:n,headers:o}};return i.get(E,()=>s.get(E,()=>s.set(E,P()).then(p=>Promise.all([s.delete(E),p]),p=>Promise.all([s.delete(E),Promise.reject(p)])).then(([p,v])=>v)),{miss:p=>i.set(E,p)})}return {hostsCache:e,requester:a,timeouts:h,logger:t,algoliaAgent:l,baseHeaders:o,baseQueryParameters:n,hosts:r,request:y,requestsCache:s,responsesCache:i}}var A="5.17.1",D=["de","us"];function pe(r){return [{url:r?"insights.{region}.algolia.io".replace("{region}",r):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function X({appId:r,apiKey:e,authMode:o,algoliaAgents:t,region:n,...l}){let h=J(r,e,o),a=B({hosts:pe(n),...l,algoliaAgent:z({algoliaAgents:t,client:"Insights",version:A}),baseHeaders:{"content-type":"text/plain",...h.headers(),...l.baseHeaders},baseQueryParameters:{...h.queryParameters(),...l.baseQueryParameters}});return {transporter:a,appId:r,clearCache(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then(()=>{})},get _ua(){return a.algoliaAgent.value},addAlgoliaAgent(s,i){a.algoliaAgent.add({segment:s,version:i});},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?a.baseHeaders["x-algolia-api-key"]=s:a.baseQueryParameters["x-algolia-api-key"]=s;},customDelete({path:s,parameters:i},m){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return a.request(u,m)},customGet({path:s,parameters:i},m){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return a.request(u,m)},customPost({path:s,parameters:i,body:m},d){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let g={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:m||{}};return a.request(g,d)},customPut({path:s,parameters:i,body:m},d){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let g={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:m||{}};return a.request(g,d)},deleteUserToken({userToken:s},i){if(!s)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let c={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,i)},pushEvents(s,i){if(!s)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!s.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let c={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:s};return a.request(c,i)}}}function er(r,e,o,t){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(o&&(typeof o!="string"||!D.includes(o)))throw new Error(`\`region\` must be one of the following: ${D.join(", ")}`);return X({appId:r,apiKey:e,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},logger:M(),requester:H(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:q(),requestsCache:q({serializable:!1}),hostsCache:w({caches:[W({key:`${A}-${r}`}),q()]}),...t})}
function H(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>t.setRequestHeader(a,e.headers[a]));let n=(a,s)=>setTimeout(()=>{t.abort(),o({status:0,content:s,isTimedOut:!0});},a),l=n(e.connectTimeout,"Connection timeout"),h;t.onreadystatechange=()=>{t.readyState>t.OPENED&&h===void 0&&(clearTimeout(l),h=n(e.responseTimeout,"Socket timeout"));},t.onerror=()=>{t.status===0&&(clearTimeout(l),clearTimeout(h),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}));},t.onload=()=>{clearTimeout(l),clearTimeout(h),o({content:t.responseText,status:t.status,isTimedOut:!1});},t.send(e.data);})}return {send:r}}function W(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function n(){return JSON.parse(t().getItem(o)||"{}")}function l(a){t().setItem(o,JSON.stringify(a));}function h(){let a=r.timeToLive?r.timeToLive*1e3:null,s=n(),i=Object.fromEntries(Object.entries(s).filter(([,d])=>d.timestamp!==void 0));if(l(i),!a)return;let m=Object.fromEntries(Object.entries(i).filter(([,d])=>{let y=new Date().getTime();return !(d.timestamp+a<y)}));l(m);}return {get(a,s,i={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),n()[JSON.stringify(a)])).then(m=>Promise.all([m?m.value:s(),m!==void 0])).then(([m,d])=>Promise.all([m,d||i.miss(m)])).then(([m])=>m)},set(a,s){return Promise.resolve().then(()=>{let i=n();return i[JSON.stringify(a)]={timestamp:new Date().getTime(),value:s},t().setItem(o,JSON.stringify(i)),s})},delete(a){return Promise.resolve().then(()=>{let s=n();delete s[JSON.stringify(a)],t().setItem(o,JSON.stringify(s));})},clear(){return Promise.resolve().then(()=>{t().removeItem(o);})}}}function V(){return {get(r,e,o={miss:()=>Promise.resolve()}){return e().then(n=>Promise.all([n,o.miss(n)])).then(([n])=>n)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function w(r){let e=[...r.caches],o=e.shift();return o===void 0?V():{get(t,n,l={miss:()=>Promise.resolve()}){return o.get(t,n,l).catch(()=>w({caches:e}).get(t,n,l))},set(t,n){return o.set(t,n).catch(()=>w({caches:e}).set(t,n))},delete(t){return o.delete(t).catch(()=>w({caches:e}).delete(t))},clear(){return o.clear().catch(()=>w({caches:e}).clear())}}}function q(r={serializable:!0}){let e={};return {get(o,t,n={miss:()=>Promise.resolve()}){let l=JSON.stringify(o);if(l in e)return Promise.resolve(r.serializable?JSON.parse(e[l]):e[l]);let h=t();return h.then(a=>n.miss(a)).then(()=>h)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function Y(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function J(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return {headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function z({algoliaAgents:r,client:e,version:o}){let t=Y(o).add({segment:e,version:o});return r.forEach(n=>t.add(n)),t}function M(){return {debug(r,e){return Promise.resolve()},info(r,e){return Promise.resolve()},error(r,e){return Promise.resolve()}}}var $=2*60*1e3;function j(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>$}function n(){return e==="timed out"&&Date.now()-o<=$}return {...r,status:e,lastUpdate:o,isUp:t,isTimedOut:n}}var Q=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e);}},G=class extends Q{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e;}},Z=class extends G{constructor(r){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",r,"RetryError");}},N=class extends G{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e;}},ee=class extends Q{response;constructor(r,e){super(r,"DeserializationError"),this.response=e;}},re=class extends N{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o;}};function te(r,e,o){let t=oe(o),n=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(n+=`?${t}`),n}function oe(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replace(/\+/g,"%20")}`).join("&")}function se(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function ne(r,e,o){let t={Accept:"application/json",...r,...e,...o},n={};return Object.keys(t).forEach(l=>{let h=t[l];n[l.toLowerCase()]=h;}),n}function ae(r){try{return JSON.parse(r.content)}catch(e){throw new ee(e.message,r)}}function ie({content:r,status:e},o){try{let t=JSON.parse(r);return "error"in t?new re(t.message,e,t.error,o):new N(t.message,e,o)}catch{}return new N(r,e,o)}function ce({isTimedOut:r,status:e}){return !r&&~~e===0}function ue({isTimedOut:r,status:e}){return r||ce({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:r}){return ~~(r/100)===2}function me(r){return r.map(e=>F(e))}function F(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function B({hosts:r,hostsCache:e,baseHeaders:o,logger:t,baseQueryParameters:n,algoliaAgent:l,timeouts:h,requester:a,requestsCache:s,responsesCache:i}){async function m(c){let u=await Promise.all(c.map(p=>e.get(p,()=>Promise.resolve(j(p))))),g=u.filter(p=>p.isUp()),P=u.filter(p=>p.isTimedOut()),R=[...g,...P];return {hosts:R.length>0?R:c,getTimeout(p,v){return (P.length===0&&p===0?1:P.length+3+p)*v}}}async function d(c,u,g=!0){let P=[],R=se(c,u),E=ne(o,c.headers,u.headers),p=c.method==="GET"?{...c.data,...u.data}:{},v={...n,...c.queryParameters,...p};if(l.value&&(v["x-algolia-agent"]=l.value),u&&u.queryParameters)for(let f of Object.keys(u.queryParameters))!u.queryParameters[f]||Object.prototype.toString.call(u.queryParameters[f])==="[object Object]"?v[f]=u.queryParameters[f]:v[f]=u.queryParameters[f].toString();let O=0,I=async(f,C)=>{let x=f.pop();if(x===void 0)throw new Z(me(P));let b={...h,...u.timeouts},_={data:R,headers:E,method:c.method,url:te(x,c.path,v),connectTimeout:C(O,b.connect),responseTimeout:C(O,g?b.read:b.write)},U=S=>{let L={request:_,response:S,host:x,triesLeft:f.length};return P.push(L),L},T=await a.send(_);if(ue(T)){let S=U(T);return T.isTimedOut&&O++,t.info("Retryable failure",F(S)),await e.set(x,j(x,T.isTimedOut?"timed out":"down")),I(f,C)}if(le(T))return ae(T);throw U(T),ie(T,P)},K=r.filter(f=>f.accept==="readWrite"||(g?f.accept==="read":f.accept==="write")),k=await m(K);return I([...k.hosts].reverse(),k.getTimeout)}function y(c,u={}){let g=c.useReadTransporter||c.method==="GET";if(!g)return d(c,u,g);let P=()=>d(c,u);if((u.cacheable||c.cacheable)!==!0)return P();let E={request:c,requestOptions:u,transporter:{queryParameters:n,headers:o}};return i.get(E,()=>s.get(E,()=>s.set(E,P()).then(p=>Promise.all([s.delete(E),p]),p=>Promise.all([s.delete(E),Promise.reject(p)])).then(([p,v])=>v)),{miss:p=>i.set(E,p)})}return {hostsCache:e,requester:a,timeouts:h,logger:t,algoliaAgent:l,baseHeaders:o,baseQueryParameters:n,hosts:r,request:y,requestsCache:s,responsesCache:i}}var A="5.18.0",D=["de","us"];function pe(r){return [{url:r?"insights.{region}.algolia.io".replace("{region}",r):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function X({appId:r,apiKey:e,authMode:o,algoliaAgents:t,region:n,...l}){let h=J(r,e,o),a=B({hosts:pe(n),...l,algoliaAgent:z({algoliaAgents:t,client:"Insights",version:A}),baseHeaders:{"content-type":"text/plain",...h.headers(),...l.baseHeaders},baseQueryParameters:{...h.queryParameters(),...l.baseQueryParameters}});return {transporter:a,appId:r,clearCache(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then(()=>{})},get _ua(){return a.algoliaAgent.value},addAlgoliaAgent(s,i){a.algoliaAgent.add({segment:s,version:i});},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?a.baseHeaders["x-algolia-api-key"]=s:a.baseQueryParameters["x-algolia-api-key"]=s;},customDelete({path:s,parameters:i},m){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return a.request(u,m)},customGet({path:s,parameters:i},m){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{}};return a.request(u,m)},customPost({path:s,parameters:i,body:m},d){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let g={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:m||{}};return a.request(g,d)},customPut({path:s,parameters:i,body:m},d){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let g={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:i||{},headers:{},data:m||{}};return a.request(g,d)},deleteUserToken({userToken:s},i){if(!s)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let c={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,i)},pushEvents(s,i){if(!s)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!s.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let c={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:s};return a.request(c,i)}}}function er(r,e,o,t){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(o&&(typeof o!="string"||!D.includes(o)))throw new Error(`\`region\` must be one of the following: ${D.join(", ")}`);return X({appId:r,apiKey:e,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},logger:M(),requester:H(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:q(),requestsCache:q({serializable:!1}),hostsCache:w({caches:[W({key:`${A}-${r}`}),q()]}),...t})}

@@ -10,0 +10,0 @@ exports.apiClientVersion = A;

@@ -7,3 +7,3 @@ // builds/fetch.ts

import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.17.1";
var apiClientVersion = "5.18.0";
var REGIONS = ["de", "us"];

@@ -243,4 +243,4 @@ function getDefaultHosts(region) {

logger: createNullLogger(),
requester: createFetchRequester(),
algoliaAgents: [{ segment: "Fetch" }],
requester: createFetchRequester(),
responsesCache: createNullCache(),

@@ -247,0 +247,0 @@ requestsCache: createNullCache(),

@@ -7,3 +7,3 @@ // builds/node.ts

import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.17.1";
var apiClientVersion = "5.18.0";
var REGIONS = ["de", "us"];

@@ -10,0 +10,0 @@ function getDefaultHosts(region) {

@@ -577,3 +577,3 @@ import * as _algolia_client_common from '@algolia/client-common';

declare const apiClientVersion = "5.17.1";
declare const apiClientVersion = "5.18.0";
declare const REGIONS: readonly ["de", "us"];

@@ -580,0 +580,0 @@ type Region = (typeof REGIONS)[number];

@@ -577,3 +577,3 @@ import * as _algolia_client_common from '@algolia/client-common';

declare const apiClientVersion = "5.17.1";
declare const apiClientVersion = "5.18.0";
declare const REGIONS: readonly ["de", "us"];

@@ -580,0 +580,0 @@ type Region = (typeof REGIONS)[number];

// src/insightsClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.17.1";
var apiClientVersion = "5.18.0";
var REGIONS = ["de", "us"];

@@ -5,0 +5,0 @@ function getDefaultHosts(region) {

{
"version": "5.17.1",
"version": "5.18.0",
"repository": {

@@ -31,4 +31,4 @@ "type": "git",

"worker": {
"types": "./dist/fetch.d.ts",
"default": "./dist/builds/fetch.js"
"types": "./dist/worker.d.ts",
"default": "./dist/builds/worker.js"
},

@@ -53,10 +53,10 @@ "default": {

"dependencies": {
"@algolia/client-common": "5.17.1",
"@algolia/requester-browser-xhr": "5.17.1",
"@algolia/requester-fetch": "5.17.1",
"@algolia/requester-node-http": "5.17.1"
"@algolia/client-common": "5.18.0",
"@algolia/requester-browser-xhr": "5.18.0",
"@algolia/requester-fetch": "5.18.0",
"@algolia/requester-node-http": "5.18.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "0.17.1",
"@types/node": "22.10.1",
"@types/node": "22.10.2",
"publint": "0.2.12",

@@ -63,0 +63,0 @@ "rollup": "4.28.1",

@@ -44,7 +44,7 @@ <p align="center">

```bash
yarn add @algolia/client-insights@5.17.1
yarn add @algolia/client-insights@5.18.0
# or
npm install @algolia/client-insights@5.17.1
npm install @algolia/client-insights@5.18.0
# or
pnpm add @algolia/client-insights@5.17.1
pnpm add @algolia/client-insights@5.18.0
```

@@ -57,3 +57,3 @@

```html
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-insights@5.17.1/dist/builds/browser.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-insights@5.18.0/dist/builds/browser.umd.js"></script>
```

@@ -60,0 +60,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc