@algolia/client-insights 5.0.0-alpha.71 → 5.0.0-alpha.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client-insights.cjs.js +10 -10
- package/dist/client-insights.esm.browser.js +10 -10
- package/dist/client-insights.esm.node.js +10 -10
- package/dist/client-insights.umd.js +2 -2
- package/dist/model/clickEvent.d.ts +2 -0
- package/dist/model/clickEvent.d.ts.map +1 -0
- package/dist/model/clickedFilters.d.ts +28 -0
- package/dist/model/clickedFilters.d.ts.map +1 -0
- package/dist/model/clickedObjectIDs.d.ts +28 -0
- package/dist/model/clickedObjectIDs.d.ts.map +1 -0
- package/dist/model/clickedObjectIDsAfterSearch.d.ts +36 -0
- package/dist/model/clickedObjectIDsAfterSearch.d.ts.map +1 -0
- package/dist/model/conversionEvent.d.ts +2 -0
- package/dist/model/conversionEvent.d.ts.map +1 -0
- package/dist/model/convertedFilters.d.ts +25 -0
- package/dist/model/convertedFilters.d.ts.map +1 -0
- package/dist/model/convertedObjectIDs.d.ts +28 -0
- package/dist/model/convertedObjectIDs.d.ts.map +1 -0
- package/dist/model/convertedObjectIDsAfterSearch.d.ts +32 -0
- package/dist/model/convertedObjectIDsAfterSearch.d.ts.map +1 -0
- package/dist/model/eventsItems.d.ts +10 -0
- package/dist/model/eventsItems.d.ts.map +1 -0
- package/dist/model/eventsResponse.d.ts +14 -0
- package/dist/model/eventsResponse.d.ts.map +1 -0
- package/dist/model/index.d.ts +14 -4
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/insightsEvents.d.ts +8 -0
- package/dist/model/insightsEvents.d.ts.map +1 -0
- package/dist/model/viewEvent.d.ts +2 -0
- package/dist/model/viewEvent.d.ts.map +1 -0
- package/dist/model/viewedFilters.d.ts +28 -0
- package/dist/model/viewedFilters.d.ts.map +1 -0
- package/dist/model/viewedObjectIDs.d.ts +28 -0
- package/dist/model/viewedObjectIDs.d.ts.map +1 -0
- package/dist/src/insightsClient.d.ts +7 -7
- package/dist/src/insightsClient.d.ts.map +1 -1
- package/model/{eventType.ts → clickEvent.ts} +1 -1
- package/model/clickedFilters.ts +35 -0
- package/model/clickedObjectIDs.ts +35 -0
- package/model/clickedObjectIDsAfterSearch.ts +45 -0
- package/model/{pushEventsResponse.ts → conversionEvent.ts} +1 -6
- package/model/convertedFilters.ts +32 -0
- package/model/convertedObjectIDs.ts +35 -0
- package/model/convertedObjectIDsAfterSearch.ts +40 -0
- package/model/eventsItems.ts +20 -0
- package/model/eventsResponse.ts +16 -0
- package/model/index.ts +14 -4
- package/model/insightsEvents.ts +10 -0
- package/model/viewEvent.ts +3 -0
- package/model/viewedFilters.ts +35 -0
- package/model/viewedObjectIDs.ts +35 -0
- package/package.json +4 -4
- package/dist/model/eventType.d.ts +0 -2
- package/dist/model/eventType.d.ts.map +0 -1
- package/dist/model/insightEvent.d.ts +0 -40
- package/dist/model/insightEvent.d.ts.map +0 -1
- package/dist/model/insightEvents.d.ts +0 -11
- package/dist/model/insightEvents.d.ts.map +0 -1
- package/dist/model/pushEventsResponse.d.ts +0 -7
- package/dist/model/pushEventsResponse.d.ts.map +0 -1
- package/model/insightEvent.ts +0 -50
- package/model/insightEvents.ts +0 -13
|
@@ -6,7 +6,7 @@ var clientCommon = require('@algolia/client-common');
|
|
|
6
6
|
var requesterNodeHttp = require('@algolia/requester-node-http');
|
|
7
7
|
|
|
8
8
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
9
|
-
const apiClientVersion = '5.0.0-alpha.
|
|
9
|
+
const apiClientVersion = '5.0.0-alpha.73';
|
|
10
10
|
const REGIONS = ['de', 'us'];
|
|
11
11
|
function getDefaultHosts(region) {
|
|
12
12
|
const url = !region
|
|
@@ -140,18 +140,18 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
|
|
|
140
140
|
return transporter.request(request, requestOptions);
|
|
141
141
|
},
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.
|
|
144
144
|
*
|
|
145
|
-
* @summary
|
|
146
|
-
* @param
|
|
145
|
+
* @summary Send events.
|
|
146
|
+
* @param insightsEvents - The insightsEvents object.
|
|
147
147
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
148
148
|
*/
|
|
149
|
-
pushEvents(
|
|
150
|
-
if (!
|
|
151
|
-
throw new Error('Parameter `
|
|
149
|
+
pushEvents(insightsEvents, requestOptions) {
|
|
150
|
+
if (!insightsEvents) {
|
|
151
|
+
throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');
|
|
152
152
|
}
|
|
153
|
-
if (!
|
|
154
|
-
throw new Error('Parameter `
|
|
153
|
+
if (!insightsEvents.events) {
|
|
154
|
+
throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');
|
|
155
155
|
}
|
|
156
156
|
const requestPath = '/1/events';
|
|
157
157
|
const headers = {};
|
|
@@ -161,7 +161,7 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
|
|
|
161
161
|
path: requestPath,
|
|
162
162
|
queryParameters,
|
|
163
163
|
headers,
|
|
164
|
-
data:
|
|
164
|
+
data: insightsEvents,
|
|
165
165
|
};
|
|
166
166
|
return transporter.request(request, requestOptions);
|
|
167
167
|
},
|
|
@@ -662,7 +662,7 @@ function createXhrRequester() {
|
|
|
662
662
|
}
|
|
663
663
|
|
|
664
664
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
665
|
-
const apiClientVersion = '5.0.0-alpha.
|
|
665
|
+
const apiClientVersion = '5.0.0-alpha.73';
|
|
666
666
|
const REGIONS = ['de', 'us'];
|
|
667
667
|
function getDefaultHosts(region) {
|
|
668
668
|
const url = !region
|
|
@@ -796,18 +796,18 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
|
|
|
796
796
|
return transporter.request(request, requestOptions);
|
|
797
797
|
},
|
|
798
798
|
/**
|
|
799
|
-
*
|
|
799
|
+
* Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.
|
|
800
800
|
*
|
|
801
|
-
* @summary
|
|
802
|
-
* @param
|
|
801
|
+
* @summary Send events.
|
|
802
|
+
* @param insightsEvents - The insightsEvents object.
|
|
803
803
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
804
804
|
*/
|
|
805
|
-
pushEvents(
|
|
806
|
-
if (!
|
|
807
|
-
throw new Error('Parameter `
|
|
805
|
+
pushEvents(insightsEvents, requestOptions) {
|
|
806
|
+
if (!insightsEvents) {
|
|
807
|
+
throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');
|
|
808
808
|
}
|
|
809
|
-
if (!
|
|
810
|
-
throw new Error('Parameter `
|
|
809
|
+
if (!insightsEvents.events) {
|
|
810
|
+
throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');
|
|
811
811
|
}
|
|
812
812
|
const requestPath = '/1/events';
|
|
813
813
|
const headers = {};
|
|
@@ -817,7 +817,7 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
|
|
|
817
817
|
path: requestPath,
|
|
818
818
|
queryParameters,
|
|
819
819
|
headers,
|
|
820
|
-
data:
|
|
820
|
+
data: insightsEvents,
|
|
821
821
|
};
|
|
822
822
|
return transporter.request(request, requestOptions);
|
|
823
823
|
},
|
|
@@ -2,7 +2,7 @@ import { createAuth, createTransporter, getAlgoliaAgent, DEFAULT_CONNECT_TIMEOUT
|
|
|
2
2
|
import { createHttpRequester } from '@algolia/requester-node-http';
|
|
3
3
|
|
|
4
4
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
5
|
-
const apiClientVersion = '5.0.0-alpha.
|
|
5
|
+
const apiClientVersion = '5.0.0-alpha.73';
|
|
6
6
|
const REGIONS = ['de', 'us'];
|
|
7
7
|
function getDefaultHosts(region) {
|
|
8
8
|
const url = !region
|
|
@@ -136,18 +136,18 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
|
|
|
136
136
|
return transporter.request(request, requestOptions);
|
|
137
137
|
},
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
139
|
+
* Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.
|
|
140
140
|
*
|
|
141
|
-
* @summary
|
|
142
|
-
* @param
|
|
141
|
+
* @summary Send events.
|
|
142
|
+
* @param insightsEvents - The insightsEvents object.
|
|
143
143
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
144
144
|
*/
|
|
145
|
-
pushEvents(
|
|
146
|
-
if (!
|
|
147
|
-
throw new Error('Parameter `
|
|
145
|
+
pushEvents(insightsEvents, requestOptions) {
|
|
146
|
+
if (!insightsEvents) {
|
|
147
|
+
throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');
|
|
148
148
|
}
|
|
149
|
-
if (!
|
|
150
|
-
throw new Error('Parameter `
|
|
149
|
+
if (!insightsEvents.events) {
|
|
150
|
+
throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');
|
|
151
151
|
}
|
|
152
152
|
const requestPath = '/1/events';
|
|
153
153
|
const headers = {};
|
|
@@ -157,7 +157,7 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
|
|
|
157
157
|
path: requestPath,
|
|
158
158
|
queryParameters,
|
|
159
159
|
headers,
|
|
160
|
-
data:
|
|
160
|
+
data: insightsEvents,
|
|
161
161
|
};
|
|
162
162
|
return transporter.request(request, requestOptions);
|
|
163
163
|
},
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! client-insights.umd.js | 5.0.0-alpha.
|
|
2
|
-
!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)["@algolia/client-insights"]={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),s=a()[r];return Promise.all([s||t(),void 0!==s])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=a();return n[JSON.stringify(e)]=t,s().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function r(e){const t=[...e.caches],s=t.shift();return void 0===s?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,n={miss:()=>Promise.resolve()})=>s.get(e,a,n).catch((()=>r({caches:t}).get(e,a,n))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=s();return o.then((e=>a.miss(e))).then((()=>o))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const a=12e4;function n(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),o(this,"name","AlgoliaError"),t&&(this.name=t)}}class c extends i{constructor(e,t,r){super(e,r),o(this,"stackTrace",void 0),this.stackTrace=t}}class u extends c{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class l extends c{constructor(e,t,r,s="ApiError"){super(e,r,s),o(this,"status",void 0),this.status=t}}class h extends i{constructor(e,t){super(e,"DeserializationError"),o(this,"response",void 0),this.response=t}}class d extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),o(this,"error",void 0),this.error=r}}function m(e,t,r){const s=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${encodeURIComponent(t(e[r])?JSON.stringify(e[r]):e[r])}`)).join("&")}(r);let a=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return s.length&&(a+=`?${s}`),a}function p(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function g({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:o,requester:i,requestsCache:c,responsesCache:g}){async function f(c,g,f=!0){const y=[],v=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,g),P=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,g.headers),w="GET"===c.method?{...c.data,...g.data}:{},b={...s,...c.queryParameters,...w};if(a.value&&(b["x-algolia-agent"]=a.value),g&&g.queryParameters)for(const e of Object.keys(g.queryParameters))g.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(g.queryParameters[e])?b[e]=g.queryParameters[e].toString():b[e]=g.queryParameters[e];let q=0;const O=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>p(e)))}(y));let a=g.timeout;void 0===a&&(a=f?o.read:o.write);const w={data:v,headers:P,method:c.method,url:m(s,c.path,b),connectTimeout:r(q,o.connect),responseTimeout:r(q,a)},T=t=>{const r={request:w,response:t,host:s,triesLeft:e.length};return y.push(r),r},E=await i.send(w);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&0==~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(E)){const a=T(E);return E.isTimedOut&&q++,console.log("Retryable failure",p(a)),await t.set(s,n(s,E.isTimedOut?"timed out":"down")),O(e,r)}if(function({status:e}){return 2==~~(e/100)}(E))return function(e){try{return JSON.parse(e.content)}catch(t){throw new h(t.message,e)}}(E);throw T(E),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new d(s.message,t,s.error,r):new l(s.message,t,r)}catch(e){}return new l(e,t,r)}(E,y)},T=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),E=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(n(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),o=[...s,...a];return{hosts:o.length>0?o:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(T);return O([...E.hosts].reverse(),E.getTimeout)}return{hostsCache:t,requester:i,timeouts:o,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return f(e,t,a);const n=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return g.get(o,(()=>c.get(o,(()=>c.set(o,n()).then((e=>Promise.all([c.delete(o),e])),(e=>Promise.all([c.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>g.set(o,e)})},requestsCache:c,responsesCache:g}}function f({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const y="5.0.0-alpha.71",v=["de","us"];e.apiClientVersion=y,e.insightsClient=function(e,a,n,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");if(n&&("string"!=typeof n||!v.includes(n)))throw new Error(`\`region\` must be one of the following: ${v.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,region:a,...n}){const o=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(e,t,r),i=g({hosts:(c=a,[{url:c?"insights.{region}.algolia.io".replace("{region}",c):"insights.algolia.io",accept:"readWrite",protocol:"https"}]),...n,algoliaAgent:f({algoliaAgents:s,client:"Insights",version:y}),baseHeaders:{"content-type":"text/plain",...o.headers(),...n.baseHeaders},baseQueryParameters:{...o.queryParameters(),...n.baseQueryParameters}});var c;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},del({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `del`.");const s={method:"DELETE",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},get({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `get`.");const s={method:"GET",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},post({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `post`.");const a={method:"POST",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},pushEvents(e,t){if(!e)throw new Error("Parameter `insightEvents` is required when calling `pushEvents`.");if(!e.events)throw new Error("Parameter `insightEvents.events` is required when calling `pushEvents`.");const r={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:e};return i.request(r,t)},put({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `put`.");const a={method:"PUT",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)}}}({appId:e,apiKey:a,region:n,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`${y}-${e}`}),s()]}),...o})}}));
|
|
1
|
+
/*! client-insights.umd.js | 5.0.0-alpha.73 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
|
|
2
|
+
!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)["@algolia/client-insights"]={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),s=a()[r];return Promise.all([s||t(),void 0!==s])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=a();return n[JSON.stringify(e)]=t,s().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function r(e){const t=[...e.caches],s=t.shift();return void 0===s?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,n={miss:()=>Promise.resolve()})=>s.get(e,a,n).catch((()=>r({caches:t}).get(e,a,n))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=s();return o.then((e=>a.miss(e))).then((()=>o))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const a=12e4;function n(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),o(this,"name","AlgoliaError"),t&&(this.name=t)}}class c extends i{constructor(e,t,r){super(e,r),o(this,"stackTrace",void 0),this.stackTrace=t}}class u extends c{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class l extends c{constructor(e,t,r,s="ApiError"){super(e,r,s),o(this,"status",void 0),this.status=t}}class h extends i{constructor(e,t){super(e,"DeserializationError"),o(this,"response",void 0),this.response=t}}class d extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),o(this,"error",void 0),this.error=r}}function m(e,t,r){const s=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${encodeURIComponent(t(e[r])?JSON.stringify(e[r]):e[r])}`)).join("&")}(r);let a=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return s.length&&(a+=`?${s}`),a}function p(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function g({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:o,requester:i,requestsCache:c,responsesCache:g}){async function f(c,g,f=!0){const y=[],v=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,g),P=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,g.headers),w="GET"===c.method?{...c.data,...g.data}:{},b={...s,...c.queryParameters,...w};if(a.value&&(b["x-algolia-agent"]=a.value),g&&g.queryParameters)for(const e of Object.keys(g.queryParameters))g.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(g.queryParameters[e])?b[e]=g.queryParameters[e].toString():b[e]=g.queryParameters[e];let q=0;const O=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>p(e)))}(y));let a=g.timeout;void 0===a&&(a=f?o.read:o.write);const w={data:v,headers:P,method:c.method,url:m(s,c.path,b),connectTimeout:r(q,o.connect),responseTimeout:r(q,a)},T=t=>{const r={request:w,response:t,host:s,triesLeft:e.length};return y.push(r),r},E=await i.send(w);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&0==~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(E)){const a=T(E);return E.isTimedOut&&q++,console.log("Retryable failure",p(a)),await t.set(s,n(s,E.isTimedOut?"timed out":"down")),O(e,r)}if(function({status:e}){return 2==~~(e/100)}(E))return function(e){try{return JSON.parse(e.content)}catch(t){throw new h(t.message,e)}}(E);throw T(E),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new d(s.message,t,s.error,r):new l(s.message,t,r)}catch(e){}return new l(e,t,r)}(E,y)},T=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),E=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(n(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),o=[...s,...a];return{hosts:o.length>0?o:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(T);return O([...E.hosts].reverse(),E.getTimeout)}return{hostsCache:t,requester:i,timeouts:o,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return f(e,t,a);const n=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return g.get(o,(()=>c.get(o,(()=>c.set(o,n()).then((e=>Promise.all([c.delete(o),e])),(e=>Promise.all([c.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>g.set(o,e)})},requestsCache:c,responsesCache:g}}function f({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const y="5.0.0-alpha.73",v=["de","us"];e.apiClientVersion=y,e.insightsClient=function(e,a,n,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");if(n&&("string"!=typeof n||!v.includes(n)))throw new Error(`\`region\` must be one of the following: ${v.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,region:a,...n}){const o=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(e,t,r),i=g({hosts:(c=a,[{url:c?"insights.{region}.algolia.io".replace("{region}",c):"insights.algolia.io",accept:"readWrite",protocol:"https"}]),...n,algoliaAgent:f({algoliaAgents:s,client:"Insights",version:y}),baseHeaders:{"content-type":"text/plain",...o.headers(),...n.baseHeaders},baseQueryParameters:{...o.queryParameters(),...n.baseQueryParameters}});var c;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},del({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `del`.");const s={method:"DELETE",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},get({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `get`.");const s={method:"GET",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},post({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `post`.");const a={method:"POST",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},pushEvents(e,t){if(!e)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!e.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");const r={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:e};return i.request(r,t)},put({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `put`.");const a={method:"PUT",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)}}}({appId:e,apiKey:a,region:n,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`${y}-${e}`}),s()]}),...o})}}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickEvent.d.ts","sourceRoot":"","sources":["../../model/clickEvent.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ClickEvent } from './clickEvent';
|
|
2
|
+
/**
|
|
3
|
+
* Use this event to track when users click facet filters in your user interface.
|
|
4
|
+
*/
|
|
5
|
+
export type ClickedFilters = {
|
|
6
|
+
/**
|
|
7
|
+
* Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
|
|
8
|
+
*/
|
|
9
|
+
eventName: string;
|
|
10
|
+
eventType: ClickEvent;
|
|
11
|
+
/**
|
|
12
|
+
* Name of the Algolia index.
|
|
13
|
+
*/
|
|
14
|
+
index: string;
|
|
15
|
+
/**
|
|
16
|
+
* Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`.
|
|
17
|
+
*/
|
|
18
|
+
filters: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
|
|
21
|
+
*/
|
|
22
|
+
userToken: string;
|
|
23
|
+
/**
|
|
24
|
+
* Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
|
|
25
|
+
*/
|
|
26
|
+
timestamp?: number;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=clickedFilters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickedFilters.d.ts","sourceRoot":"","sources":["../../model/clickedFilters.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,UAAU,CAAC;IAEtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ClickEvent } from './clickEvent';
|
|
2
|
+
/**
|
|
3
|
+
* Use this event to track when users click items unrelated to a previous Algolia request. For example, if you don\'t use Algolia to build your category pages, use this event. To track click events related to Algolia requests, use the \"Clicked object IDs after search\" event.
|
|
4
|
+
*/
|
|
5
|
+
export type ClickedObjectIDs = {
|
|
6
|
+
/**
|
|
7
|
+
* Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
|
|
8
|
+
*/
|
|
9
|
+
eventName: string;
|
|
10
|
+
eventType: ClickEvent;
|
|
11
|
+
/**
|
|
12
|
+
* Name of the Algolia index.
|
|
13
|
+
*/
|
|
14
|
+
index: string;
|
|
15
|
+
/**
|
|
16
|
+
* List of object identifiers for items of an Algolia index.
|
|
17
|
+
*/
|
|
18
|
+
objectIDs: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
|
|
21
|
+
*/
|
|
22
|
+
userToken: string;
|
|
23
|
+
/**
|
|
24
|
+
* Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
|
|
25
|
+
*/
|
|
26
|
+
timestamp?: number;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=clickedObjectIDs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickedObjectIDs.d.ts","sourceRoot":"","sources":["../../model/clickedObjectIDs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,UAAU,CAAC;IAEtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ClickEvent } from './clickEvent';
|
|
2
|
+
/**
|
|
3
|
+
* Click event after an Algolia request. Use this event to track when users click items in the search results. If you\'re building your category pages with Algolia, you\'ll also use this event.
|
|
4
|
+
*/
|
|
5
|
+
export type ClickedObjectIDsAfterSearch = {
|
|
6
|
+
/**
|
|
7
|
+
* Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
|
|
8
|
+
*/
|
|
9
|
+
eventName: string;
|
|
10
|
+
eventType: ClickEvent;
|
|
11
|
+
/**
|
|
12
|
+
* Name of the Algolia index.
|
|
13
|
+
*/
|
|
14
|
+
index: string;
|
|
15
|
+
/**
|
|
16
|
+
* List of object identifiers for items of an Algolia index.
|
|
17
|
+
*/
|
|
18
|
+
objectIDs: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Position of the clicked objects in the search results. The first search result has a position of 1 (not 0). You must provide 1 `position` for each `objectID`.
|
|
21
|
+
*/
|
|
22
|
+
positions: number[];
|
|
23
|
+
/**
|
|
24
|
+
* Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response.
|
|
25
|
+
*/
|
|
26
|
+
queryID: string;
|
|
27
|
+
/**
|
|
28
|
+
* Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
|
|
29
|
+
*/
|
|
30
|
+
userToken: string;
|
|
31
|
+
/**
|
|
32
|
+
* Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
|
|
33
|
+
*/
|
|
34
|
+
timestamp?: number;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=clickedObjectIDsAfterSearch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickedObjectIDsAfterSearch.d.ts","sourceRoot":"","sources":["../../model/clickedObjectIDsAfterSearch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,UAAU,CAAC;IAEtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversionEvent.d.ts","sourceRoot":"","sources":["../../model/conversionEvent.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ConversionEvent } from './conversionEvent';
|
|
2
|
+
export type ConvertedFilters = {
|
|
3
|
+
/**
|
|
4
|
+
* Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
|
|
5
|
+
*/
|
|
6
|
+
eventName: string;
|
|
7
|
+
eventType: ConversionEvent;
|
|
8
|
+
/**
|
|
9
|
+
* Name of the Algolia index.
|
|
10
|
+
*/
|
|
11
|
+
index: string;
|
|
12
|
+
/**
|
|
13
|
+
* Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`.
|
|
14
|
+
*/
|
|
15
|
+
filters: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
|
|
18
|
+
*/
|
|
19
|
+
userToken: string;
|
|
20
|
+
/**
|
|
21
|
+
* Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
|
|
22
|
+
*/
|
|
23
|
+
timestamp?: number;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=convertedFilters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertedFilters.d.ts","sourceRoot":"","sources":["../../model/convertedFilters.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,eAAe,CAAC;IAE3B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ConversionEvent } from './conversionEvent';
|
|
2
|
+
/**
|
|
3
|
+
* Use this event to track when users convert on items unrelated to a previous Algolia request. For example, if you don\'t use Algolia to build your category pages, use this event. To track conversion events related to Algolia requests, use the \"Converted object IDs after search\" event.
|
|
4
|
+
*/
|
|
5
|
+
export type ConvertedObjectIDs = {
|
|
6
|
+
/**
|
|
7
|
+
* Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
|
|
8
|
+
*/
|
|
9
|
+
eventName: string;
|
|
10
|
+
eventType: ConversionEvent;
|
|
11
|
+
/**
|
|
12
|
+
* Name of the Algolia index.
|
|
13
|
+
*/
|
|
14
|
+
index: string;
|
|
15
|
+
/**
|
|
16
|
+
* List of object identifiers for items of an Algolia index.
|
|
17
|
+
*/
|
|
18
|
+
objectIDs: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
|
|
21
|
+
*/
|
|
22
|
+
userToken: string;
|
|
23
|
+
/**
|
|
24
|
+
* Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
|
|
25
|
+
*/
|
|
26
|
+
timestamp?: number;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=convertedObjectIDs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertedObjectIDs.d.ts","sourceRoot":"","sources":["../../model/convertedObjectIDs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,eAAe,CAAC;IAE3B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ConversionEvent } from './conversionEvent';
|
|
2
|
+
/**
|
|
3
|
+
* Use this event to track when users convert after a previous Algolia request. For example, a user clicks on an item in the search results to view the product detail page. Then, the user adds the item to their shopping cart. If you\'re building your category pages with Algolia, you\'ll also use this event.
|
|
4
|
+
*/
|
|
5
|
+
export type ConvertedObjectIDsAfterSearch = {
|
|
6
|
+
/**
|
|
7
|
+
* Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
|
|
8
|
+
*/
|
|
9
|
+
eventName: string;
|
|
10
|
+
eventType: ConversionEvent;
|
|
11
|
+
/**
|
|
12
|
+
* Name of the Algolia index.
|
|
13
|
+
*/
|
|
14
|
+
index: string;
|
|
15
|
+
/**
|
|
16
|
+
* List of object identifiers for items of an Algolia index.
|
|
17
|
+
*/
|
|
18
|
+
objectIDs: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response.
|
|
21
|
+
*/
|
|
22
|
+
queryID: string;
|
|
23
|
+
/**
|
|
24
|
+
* Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
|
|
25
|
+
*/
|
|
26
|
+
userToken: string;
|
|
27
|
+
/**
|
|
28
|
+
* Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
|
|
29
|
+
*/
|
|
30
|
+
timestamp?: number;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=convertedObjectIDsAfterSearch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertedObjectIDsAfterSearch.d.ts","sourceRoot":"","sources":["../../model/convertedObjectIDsAfterSearch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,eAAe,CAAC;IAE3B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClickedFilters } from './clickedFilters';
|
|
2
|
+
import type { ClickedObjectIDs } from './clickedObjectIDs';
|
|
3
|
+
import type { ClickedObjectIDsAfterSearch } from './clickedObjectIDsAfterSearch';
|
|
4
|
+
import type { ConvertedFilters } from './convertedFilters';
|
|
5
|
+
import type { ConvertedObjectIDs } from './convertedObjectIDs';
|
|
6
|
+
import type { ConvertedObjectIDsAfterSearch } from './convertedObjectIDsAfterSearch';
|
|
7
|
+
import type { ViewedFilters } from './viewedFilters';
|
|
8
|
+
import type { ViewedObjectIDs } from './viewedObjectIDs';
|
|
9
|
+
export type EventsItems = ClickedFilters | ClickedObjectIDs | ClickedObjectIDsAfterSearch | ConvertedFilters | ConvertedObjectIDs | ConvertedObjectIDsAfterSearch | ViewedFilters | ViewedObjectIDs;
|
|
10
|
+
//# sourceMappingURL=eventsItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventsItems.d.ts","sourceRoot":"","sources":["../../model/eventsItems.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,MAAM,WAAW,GACnB,cAAc,GACd,gBAAgB,GAChB,2BAA2B,GAC3B,gBAAgB,GAChB,kBAAkB,GAClB,6BAA6B,GAC7B,aAAa,GACb,eAAe,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The response of the Insights API.
|
|
3
|
+
*/
|
|
4
|
+
export type EventsResponse = {
|
|
5
|
+
/**
|
|
6
|
+
* Details about the response, such as error messages.
|
|
7
|
+
*/
|
|
8
|
+
message?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The HTTP status code of the response.
|
|
11
|
+
*/
|
|
12
|
+
status?: number;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=eventsResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventsResponse.d.ts","sourceRoot":"","sources":["../../model/eventsResponse.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
package/dist/model/index.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
export * from './clickEvent';
|
|
2
|
+
export * from './clickedFilters';
|
|
3
|
+
export * from './clickedObjectIDs';
|
|
4
|
+
export * from './clickedObjectIDsAfterSearch';
|
|
5
|
+
export * from './conversionEvent';
|
|
6
|
+
export * from './convertedFilters';
|
|
7
|
+
export * from './convertedObjectIDs';
|
|
8
|
+
export * from './convertedObjectIDsAfterSearch';
|
|
1
9
|
export * from './errorBase';
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
10
|
+
export * from './eventsItems';
|
|
11
|
+
export * from './eventsResponse';
|
|
12
|
+
export * from './insightsEvents';
|
|
13
|
+
export * from './viewEvent';
|
|
14
|
+
export * from './viewedFilters';
|
|
15
|
+
export * from './viewedObjectIDs';
|
|
6
16
|
export * from './clientMethodProps';
|
|
7
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../model/index.ts"],"names":[],"mappings":"AAEA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../model/index.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EventsItems } from './eventsItems';
|
|
2
|
+
export type InsightsEvents = {
|
|
3
|
+
/**
|
|
4
|
+
* List of click and conversion events. An event is an object representing a user interaction. Events have attributes that describe the interaction, such as an event name, a type, or a user token. Some attributes require other attributes to be declared, and some attributes can\'t be declared at the same time. **All** events must be valid, otherwise the API returns an error.
|
|
5
|
+
*/
|
|
6
|
+
events: EventsItems[];
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=insightsEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insightsEvents.d.ts","sourceRoot":"","sources":["../../model/insightsEvents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewEvent.d.ts","sourceRoot":"","sources":["../../model/viewEvent.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ViewEvent } from './viewEvent';
|
|
2
|
+
/**
|
|
3
|
+
* Use this method to capture active filters. For example, when browsing a category page, users see content filtered on that specific category.
|
|
4
|
+
*/
|
|
5
|
+
export type ViewedFilters = {
|
|
6
|
+
/**
|
|
7
|
+
* Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
|
|
8
|
+
*/
|
|
9
|
+
eventName: string;
|
|
10
|
+
eventType: ViewEvent;
|
|
11
|
+
/**
|
|
12
|
+
* Name of the Algolia index.
|
|
13
|
+
*/
|
|
14
|
+
index: string;
|
|
15
|
+
/**
|
|
16
|
+
* Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`.
|
|
17
|
+
*/
|
|
18
|
+
filters: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
|
|
21
|
+
*/
|
|
22
|
+
userToken: string;
|
|
23
|
+
/**
|
|
24
|
+
* Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
|
|
25
|
+
*/
|
|
26
|
+
timestamp?: number;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=viewedFilters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewedFilters.d.ts","sourceRoot":"","sources":["../../model/viewedFilters.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ViewEvent } from './viewEvent';
|
|
2
|
+
/**
|
|
3
|
+
* Use this event to track when users viewed items in the search results.
|
|
4
|
+
*/
|
|
5
|
+
export type ViewedObjectIDs = {
|
|
6
|
+
/**
|
|
7
|
+
* Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
|
|
8
|
+
*/
|
|
9
|
+
eventName: string;
|
|
10
|
+
eventType: ViewEvent;
|
|
11
|
+
/**
|
|
12
|
+
* Name of the Algolia index.
|
|
13
|
+
*/
|
|
14
|
+
index: string;
|
|
15
|
+
/**
|
|
16
|
+
* List of object identifiers for items of an Algolia index.
|
|
17
|
+
*/
|
|
18
|
+
objectIDs: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
|
|
21
|
+
*/
|
|
22
|
+
userToken: string;
|
|
23
|
+
/**
|
|
24
|
+
* Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
|
|
25
|
+
*/
|
|
26
|
+
timestamp?: number;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=viewedObjectIDs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewedObjectIDs.d.ts","sourceRoot":"","sources":["../../model/viewedObjectIDs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CreateClientOptions, RequestOptions } from '@algolia/client-common';
|
|
2
2
|
import type { DelProps, GetProps, PostProps, PutProps } from '../model/clientMethodProps';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
export declare const apiClientVersion = "5.0.0-alpha.
|
|
3
|
+
import type { EventsResponse } from '../model/eventsResponse';
|
|
4
|
+
import type { InsightsEvents } from '../model/insightsEvents';
|
|
5
|
+
export declare const apiClientVersion = "5.0.0-alpha.73";
|
|
6
6
|
export declare const REGIONS: readonly ["de", "us"];
|
|
7
7
|
export type Region = (typeof REGIONS)[number];
|
|
8
8
|
export declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & {
|
|
@@ -60,13 +60,13 @@ export declare function createInsightsClient({ appId: appIdOption, apiKey: apiKe
|
|
|
60
60
|
*/
|
|
61
61
|
post({ path, parameters, body }: PostProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.
|
|
64
64
|
*
|
|
65
|
-
* @summary
|
|
66
|
-
* @param
|
|
65
|
+
* @summary Send events.
|
|
66
|
+
* @param insightsEvents - The insightsEvents object.
|
|
67
67
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
68
68
|
*/
|
|
69
|
-
pushEvents(
|
|
69
|
+
pushEvents(insightsEvents: InsightsEvents, requestOptions?: RequestOptions): Promise<EventsResponse>;
|
|
70
70
|
/**
|
|
71
71
|
* This method allow you to send requests to the Algolia REST API.
|
|
72
72
|
*
|